Tag number processing update for QCBOR v2 #289
Merged
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.
This is a breaking change in the t_cose v2 API, but it is not difficult to adapt to it. To adapt, switch from t_cose_sign_verify() to t_cose_sign_verify_msg() with an additional parameter if tag numbers are expected or NULL if not.
The main entry points for verify/validate/decrypt are changed to take a QCBORDecodeContext from which to read the message to decode. This makes them simpler inside and more flexible for the caller.
A new additional entry point for verify/validate/decrypt is added with the name ending in _msg that takes the
pointer and length like the old main entry points. This also returns all the tag numbers. t_cose_mac_validate_nth_tag()
is removed and the size of the verify/validate/decrypt context is reduced.
This commit make t_cose compatible with QCBOR v2, which does tag number decoding in a different way than
QCBOR v1. This commit also continues to work with QCBOR v1 and the sign1 APIs are still compatible with t_cose v1.