tag | c10d9c7cfe15f1965d5e139d6b9e07cbf0c43333 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Tue May 14 16:43:41 2024 -0700 |
object | bb7f2a439b6756d2e02e837a3dd0f3cc26652476 |
Android 14.0.0 release 42
commit | bb7f2a439b6756d2e02e837a3dd0f3cc26652476 | [log] [tgz] |
---|---|---|
author | Matthew Maurer <mmaurer@google.com> | Thu Mar 09 18:07:16 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Mar 09 18:07:16 2023 +0000 |
tree | ba4e327477ad1386a0449ff67c60cd1f1c05a890 | |
parent | 40333aecef6b95f6505093d44681d39d9c3222e1 [diff] | |
parent | b220cdf3c1b1d1fe7a385db77fd2190d1abfe0a9 [diff] |
Make coset available to product and vendor am: aa2514c48b am: 944bb4e448 am: d5a81ce8c1 am: b220cdf3c1 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/coset/+/2474421 Change-Id: Ic4c858b4c18dc251f89b141f2a0c54e5e7c0f218 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This crate holds a set of Rust types for working with CBOR Object Signing and Encryption (COSE) objects, as defined in RFC 8152. It builds on the core CBOR parsing functionality from the ciborium
crate.
See crate docs, or the signature example for documentation on how to use the code.
This repo is under construction and so details of the API and the code may change without warning.
no_std
SupportThis crate supports no_std
, but uses the alloc
crate.
MSRV is 1.56 (the main ciborium
dependency is edition="2021"
)
CBOR supports integers in the range:
[-18_446_744_073_709_551_616, -1] ∪ [0, 18_446_744_073_709_551_615]
which is [-264, -1] ∪ [0, 264 - 1].
This does not map onto a single Rust integer type, so different CBOR crates take different approaches.
serde_cbor
crate uses a single i128
integer type for all integer values, which means that all CBOR integer values can be expressed, but there are also i128
values that cannot be encoded in CBOR. This also means that data size is larger.ciborium
also uses a single i128
integer type internally, but wraps it in its own Integer
type and only implements TryFrom
(not From
) for i128
/ u128
conversions so that unrepresentable numbers can be rejected.sk-cbor
crate uses distinct types:This crate uses a single type to encompass both positive and negative values, but uses i64
for that type to keep data sizes smaller. This means that:
i64
cover [0, 263 - 1]i64
cover [-263, -1]and so there are large values – both positive and negative – which are not supported by this crate.
Local coding conventions are enforced by the continuous integration jobs and include:
rustfmt
using the local rustfmt.toml settings.TODO
markers should be of form TODO(#99)
and refer to an open GitHub issue.panic!
, unwrap
, expect
) should have a comment on the same line in the form // safe: reason
(or /* safe: reason */
) to document the reason why panicking is acceptable.This is not an officially supported Google product.