Skip to content
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

Hackathon114: Values of COSE Tagged are undefined in the cddl file #67

Closed
mcd500 opened this issue Jul 24, 2022 · 4 comments
Closed

Hackathon114: Values of COSE Tagged are undefined in the cddl file #67

mcd500 opened this issue Jul 24, 2022 · 4 comments

Comments

@mcd500
Copy link
Contributor

mcd500 commented Jul 24, 2022

Was found during the using cddl tools at ietf-teep/teep-protocol#198.

Values for the bellow COSE_*_Tagged were undefined in the cddl file.

SUIT_Authentication_Block /= COSE_Mac_Tagged
SUIT_Authentication_Block /= COSE_Sign_Tagged
SUIT_Authentication_Block /= COSE_Mac0_Tagged
SUIT_Authentication_Block /= COSE_Sign1_Tagged
@bremoran
Copy link
Collaborator

Do the instructions for using the CDDL in the draft make sense?

https://github.com/suit-wg/manifest-spec/blob/master/draft-ietf-suit-manifest.md?plain=1#L1356

@mcd500
Copy link
Contributor Author

mcd500 commented Aug 2, 2022

The usage of the CDDL in the draft is no problem.

We still need the values for the COSE Tagged in the form of CDDL file to perform CDDL grammar check which is not able to find any place in the CDDL format other than the table 1 in the page 9 of the rfc8152 at the bellow link.
https://www.rfc-editor.org/rfc/rfc8152.html#page-78

For the performing cddl tool for the cddl check, please see the page 13 of my hackathon report.
https://datatracker.ietf.org/meeting/114/materials/slides-114-teep-hackathon-report-01

Adding the values of the Taged used in the in the cddl file of the suit-manifest is only way to pass the grammar check.

@oyvindronningstad
Copy link
Contributor

FWIW, here's (I think) the complete CDDL for COSE, scraped from RFC 8152:

Headers = (
	protected : empty_or_serialized_map,
	unprotected : header_map
)

label = int / tstr
values = any

header_map = {
	Generic_Headers,
	* label => values
}

empty_or_serialized_map = bstr .cbor header_map / bstr .size 0

Generic_Headers = (
	? alg_id: 1 => int / tstr,
	? criticality: 2 => [+label],
	? content_type: 3 => tstr / int,
	? key_id: 4 => bstr,
	? IV: 5 => bstr,
	? partial_IV: 6 => bstr,
	? counter_signature: 7 => COSE_Signature / [+COSE_Signature] ; Counter signature
)


COSE_Sign_Tagged = #6.98(COSE_Sign)

COSE_Sign = [
	Headers,
	payload : bstr / nil,
	signatures : [+ COSE_Signature]
]

COSE_Signature =  [
	Headers,
	signature : bstr
]

COSE_Sign1_Tagged = #6.18(COSE_Sign1)

COSE_Sign1 = [
	Headers,
	payload : bstr / nil,
	signature : bstr
]

Sig_structure = [
	context : "Signature" / "Signature1" / "CounterSignature",
	body_protected : empty_or_serialized_map,
	? sign_protected : empty_or_serialized_map,
	external_aad : bstr,
	payload : bstr
]

COSE_Encrypt_Tagged = #6.96(COSE_Encrypt)

COSE_Encrypt = [
	Headers,
	ciphertext : bstr / nil,
	recipients : [+COSE_recipient]
]

COSE_recipient = [
	Headers,
	ciphertext : bstr / nil,
	? recipients : [+COSE_recipient]
]

COSE_Encrypt0_Tagged = #6.16(COSE_Encrypt0)

COSE_Encrypt0 = [
	Headers,
	ciphertext : bstr / nil,
]

Enc_structure = [
	context : "Encrypt" / "Encrypt0" / "Enc_Recipient" /
		"Mac_Recipient" / "Rec_Recipient",
	protected : empty_or_serialized_map,
	external_aad : bstr
]

COSE_Mac_Tagged = #6.97(COSE_Mac)

COSE_Mac = [
	Headers,
	payload : bstr / nil,
	tag : bstr,
	recipients :[+COSE_recipient]
]

COSE_Mac0_Tagged = #6.17(COSE_Mac0)

COSE_Mac0 = [
	Headers,
	payload : bstr / nil,
	tag : bstr,
]

MAC_structure = [
	context : "MAC" / "MAC0",
	protected : empty_or_serialized_map,
	external_aad : bstr,
	payload : bstr
]

COSE_Key = {
	kty: 1 => tstr / int,
	kid: ? 2 => bstr,
	alg: ? 3 => tstr / int,
	key_ops: ? 4 => [+ (tstr / int) ],
	base_IV: ? 5 => bstr,
	* label => values
}

COSE_KeySet = [+COSE_Key]

PartyInfo = (
	identity : bstr / nil,
	nonce : bstr / int / nil,
	other : bstr / nil
)

COSE_KDF_Context = [
	AlgorithmID : int / tstr,
	PartyUInfo : [ PartyInfo ],
	PartyVInfo : [ PartyInfo ],
	SuppPubInfo : [
		keyDataLength : uint,
		protected : empty_or_serialized_map,
		? other : bstr
	],
	? SuppPrivInfo : bstr
]

COSE_Messages = COSE_Untagged_Message / COSE_Tagged_Message

COSE_Untagged_Message = COSE_Sign / COSE_Sign1 /
	COSE_Encrypt / COSE_Encrypt0 /
	COSE_Mac / COSE_Mac0

COSE_Tagged_Message = COSE_Sign_Tagged / COSE_Sign1_Tagged /
	COSE_Encrypt_Tagged / COSE_Encrypt0_Tagged /
	COSE_Mac_Tagged / COSE_Mac0_Tagged

@bremoran bremoran mentioned this issue Aug 9, 2022
@bremoran
Copy link
Collaborator

bremoran commented Aug 9, 2022

Please can you confirm if #78 has fixed this issue?

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

No branches or pull requests

4 participants