lib: Allow ID_CRED_I to be a value#267
Conversation
This converts corner cases that would have previously resulted in a panic or garbled CBOR into EDHOC errors.
|
Note that this is not quite trivial to test because using the test vector credential by value (it is relatively long given we use p256 and not x25519, and on top of that has a serial number in it) exceeds the 256 default length by some bytes. |
|
I think this is showing a few cases where instead of doing CBOR encoding there is the tacit assumption that a byte value is just CBOR_MAJOR_BYTE_STRING ^ value :-/ |
|
I've added a crude CBOR dissection for the message 3 lengths, and adjusted the Python tests so that different variations are run. I didn't quickly find where else we had that kind of CBOR processing -- refactoring would be welcome, but getting this out with the next release might be more urgent than doing this cleanly. |
|
Thanks for the PR. Left a few comments. I agree that the CBOR encoding could be improved. |
|
Thanks for the review, I think all are addressed in some way or other. |
|
Yep good on my side. Merging as CI passes. |
Currently, EDHOC panics when attempting to use use a credential by value in CRED_I.
This fixes this, mainly by copying code from the CRED_R case where that was already supported.