8000 fix!: unsigned CoRIMs always tagged by setrofim · Pull Request #187 · veraison/corim · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix!: unsigned CoRIMs always tagged #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025
Merged

fix!: unsigned CoRIMs always tagged #187

merged 1 commit into from
Jun 13, 2025

Conversation

setrofim
Copy link
Contributor

Update ToCBOR/FromCBOR for UnsignedCorim to add/expect tag 501.

Current spec requires that unsigned CoRIMs are always tagged with tag 501, both, when appearing as stand-alone CBOR documents, and when embedded as payloads of signed CoRIMs.

Note: There was already TaggedUnsignedCorim type registered under tagged 501, however it was not being used and its marshalling and didn't work correctly due to the custom To/FromCBOR in UnsignedCorim used in lieu of the standard marshalling mechanism. Rather than (a) fixing its serialization, (b) forwarding all UnsignedCorim methods, and (c) replacing UnsignedCorim usaged with TaggedUnsignedCorim all over the place, TaggedUnsignedCorim was simply removed, and tagging was added to CBOR serialization of UnsignedCorim, as it's not really valid for it to appear untagged, and this minimizes API impact (and is also consistent with SignedCorim that serializes tagged).

BREAKING CHANGE: serialized unsigned CoRIMs now start with tag 501. (This is an ABI-only break; all APIs remain the same).

This addresses #131

Update ToCBOR/FromCBOR for UnsignedCorim to add/expect tag 501.

Current spec requires that unsigned CoRIMs are always tagged with tag
501, both, when appearing as stand-alone CBOR documents, and when
embedded as payloads of signed CoRIMs.

Note: There was already TaggedUnsignedCorim type registered under tagged
501, however it was not being used and its marshalling didn't work
correctly due to the custom To/FromCBOR in UnsignedCorim used in lieu of
the standard marshalling mechanism. Rather than (a) fixing  its
serialization, (b) forwarding all UnsignedCorim methods, and (c)
replacing UnsignedCorim usaged with TaggedUnsignedCorim all over the
place,  TaggedUnsignedCorim was simply removed, and tagging was added to
CBOR serialization of UnsignedCorim, as it's not really valid for it to
appear untagged, and this minimizes API impact (and is also consistent
with SignedCorim that serializes tagged).

BREAKING CHANGE: serialized unsigned CoRIMs now start with tag 501.
(This is an ABI-only break; all APIs remain the same).

Signed-off-by: Sergei Trofimov <sergei.trofimov@arm.com>
Copy link
Contributor
@thomas-fossati thomas-fossati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@@ -74,11 +76,15 @@ func UnmarshalSignedCorimFromCBOR(buf []byte) (*SignedCorim, error) {
// the data, they will be registered with the UnsignedCorim before it is
// unmarshaled.
func UnmarshalUnsignedCorimFromCBOR(buf []byte) (*UnsignedCorim, error) {
if !bytes.Equal(buf[:3], UnsignedCorimTag) {
Copy link
Contributor
@yogeshbdeshpande yogeshbdeshpande Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the comment on Line 74 not clarify that the CBOR payload is now expected to be tagged?

// UnmarshalUnsignedCorimFromCBOR unmarshals a tagged UnsignedCorim from provided
// CBOR data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"tagged" is implied. It's not valid for an unsigned corim not to be tagged.

Q7vjfy5hSzOu01PP8UKLFg==
2:
- 0: ACME Ltd.
tag: 501
Copy link
Contributor
@yogeshbdeshpande yogeshbdeshpande Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 1 presumably should say
minimalist tagged unsigned-corim that embeds a comid.PSARefValJSONTemplate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"tagged" is implied. It's not valid for a CoRIM not to be tagged, so the distinction does not needs to be made ( just like we don't say "tagged signed corim".

@@ -1,66 +1,68 @@
# minimalist unsigned-corim that embeds comid.PSARefValJSONTemplate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 1 presumably should say
minimalist tagged unsigned-corim that embeds a comid.PSARefValJSONTemplate

Copy link
Contributor
@yogeshbdeshpande yogeshbdeshpande left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I added few minor comments for you to look at!

@setrofim setrofim merged commit 59105a8 into main Jun 13, 2025
13 checks passed
@setrofim setrofim deleted the tagged-unsigned branch June 13, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0