Conversation
Similar to n20_stream_t which offers safe writing to a buffer n20_istream_t offers a safe way to read from a buffer lowering the risk for out of bounds access.
Add primitives for parsing CBOR headers, extracting slices of octet and text strings, and recursively skipping unknown fields.
Implements marshalling and unmarshalling for DICE service messages using CBOR encoding.
Move certificate format enum to nat20/constants.h
n20_istream_get_slice now returns a boolean and fills an n20_slice_t structure, which allows for more consistent control flow. This patch also adds the n20_istream_get_string_slice variant, which fills an n20_string_slice_t structure instead. Complete test coverage for stream module.
Enable annotations only in the library under test to avoid overwriting data with results from different tests.
LCOV of commit
|
azsteinb
reviewed
Sep 26, 2025
azsteinb
left a comment
There was a problem hiding this comment.
Left some comments. Haven't dived deep into the service tests yet.
Comment on lines
228
to
253
There was a problem hiding this comment.
This stuff is not in the other PR, but lgtm
Comment on lines
163
to
188
| @@ -121,6 +172,7 @@ enum n20_error_s { | |||
| * if the context given is valid. | |||
| */ | |||
| n20_error_crypto_invalid_context_e = 0x1001, | |||
|
|
|||
| /** | |||
| * @brief Indicates that an input key argument was NULL. | |||
| * | |||
| @@ -132,6 +184,7 @@ enum n20_error_s { | |||
| * @sa n20_crypto_context_t.sign | |||
| */ | |||
| n20_error_crypto_unexpected_null_key_in_e = 0x1002, | |||
|
|
|||
| /** | |||
There was a problem hiding this comment.
Are the hex value errors specifically only for crypto errors?
Comment on lines
269
to
283
There was a problem hiding this comment.
I am a bit confused parsing the values in the vectors. What does the 0xf6 mean here?
There was a problem hiding this comment.
Ah, wait, I understand it now. Disregard.
Comment on lines
120
to
126
There was a problem hiding this comment.
nit: I understand these values are pretty clear in the cbor parsing world, but it may be worth creating constants for better legibility from those not super familiar with cbor
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.
Implements marshalling and unmarshalling for DICE service messages using
CBOR encoding.