Native Layer 1: Zero-copy COSE primitives with streaming parse/sign/verify#181
Merged
JeromySt merged 1 commit intousers/jstatia/native_ports_finalfrom Mar 30, 2026
Conversation
0f67df0 to
ca206c3
Compare
ca206c3 to
4aa03a5
Compare
4ac8695 to
17c4a03
Compare
b9ba184 to
1bb6943
Compare
0a2c616 to
af8eac5
Compare
Member
Author
|
@copilot can you review the remaining files you didn't already review? |
54082a8 to
743a956
Compare
JeromySt
pushed a commit
that referenced
this pull request
Mar 21, 2026
- builder.rs: Add payload_len validation in streaming sign detached path with total_read counter and LengthMismatch error. Add usize::try_from guard for embedded path capacity. Keep CborProvider import (needed for trait method .encoder()). - ffi/types.rs: Replace unsound 'static lifetime on handle conversions with explicit lifetime parameter 'a to prevent use-after-free. - ffi/error.rs: Replace unsound 'static lifetime on handle_to_inner with explicit 'a. Add FFI_ERR_PAYLOAD_ERROR (-7) to distinguish PayloadError from PayloadMissing. Map PayloadError to new code. - ffi/cbindgen.toml: Remove unused prefix to avoid doubled symbol names. - ffi/Cargo.toml: Document why rlib is needed (integration tests). - sign1.h: Fix RFC 9338 -> RFC 9052, add COSE_SIGN1_ERR_PAYLOAD_ERROR. - cose.h: Fix doc to reference cose_string_free() not cose_sign1_string_free(). - README.md: Update to match actual API (cose_sign1_primitives, compile-time CBOR provider, CryptoSigner/CryptoVerifier traits). - troubleshooting.md: Fix constant name to LARGE_PAYLOAD_THRESHOLD. - dotnet.yml #15: Intentional - detect-changes gates all events including workflow_dispatch via dorny/paths-filter default branch comparison. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7607237 to
72bfc78
Compare
…ing support Rust crates (8): cbor_primitives, cbor_primitives_everparse, crypto_primitives, cose_primitives, cose_sign1_primitives, cose_sign1_crypto_openssl, cose_sign1_primitives_ffi, cose_sign1_crypto_openssl_ffi Architecture: Single Arc<[u8]> backing buffer, ArcSlice/ArcStr zero-copy headers, LazyHeaderMap via OnceLock, CoseData Buffered/Streamed variants, CborStreamDecoder for large files. Streaming parse (~1.4KB), sign (~64KB), verify (~64KB). Includes C/C++ header projections, documentation, CI caching, all review comments addressed, 90%+ coverage gate passing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
72bfc78 to
0c5e7ff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native Layer 1 — Primitives
Foundational Rust crates for COSE_Sign1 message handling with a zero-copy, streaming-first architecture.
Architecture
CoseSign1Messageowns a singleArc<[u8]>backing buffer. All fields are byte-range slices — no payload/signature copies on parse. Header values useArcSlice/ArcStrto share the same buffer.LazyHeaderMapdefers parsing until first access viaOnceLock.Memory profiles:
Rust Crates (8)
CBOR Layer:
cbor_primitives— Encoding/decoding traits (CborDecoder,CborStreamDecoder)cbor_primitives_everparse— EverParse backend + streaming decoder fromRead+SeekCOSE Layer:
cose_primitives— RFC 9052 types,CoseData(Buffered/Streamed),LazyHeaderMap,ArcSlice/ArcStrcose_sign1_primitives— Sign1 message, builder, sig_structure, streaming parse/sign/verifyCrypto Layer:
crypto_primitives— Signer/verifier traits, JWK types,SigningContext/VerifyingContextcose_sign1_crypto_openssl— OpenSSL EC/RSA/EdDSA/ML-DSA providerFFI Projections:
cose_sign1_primitives_ffi— C-ABI for Sign1 operationscose_sign1_crypto_openssl_ffi— C-ABI for crypto providerC/C++ Projections
cose.h/cose.hpp— Shared COSE typessign1.h/sign1.hpp— Sign1 primitivescrypto/openssl.h/crypto/openssl.hpp— Crypto providerKey Design Decisions
CoseDataowns the raw bytes;CoseSign1slices into itCborStreamDecoderreads fromRead+Seek, skips large payloads by offsetMemoryPayloadusesArc<[u8]>:open()is a pointer copy, not a data cloneOnceLockdefers BTreeMap allocation until first typed accessDocumentation
native/rust/docs/memory-characteristics.md— Full memory profiles and scenariosnative/docs/ARCHITECTURE.md— Layered dependency graphQuality
collect-coverage-asan.ps1passes)cargo clippywarningscargo fmtclean