Open
Conversation
Signed-off-by: Tamas Ban <tamas.ban@arm.com> Change-Id: I732db4fc4003c3895af342ec953bd1bdf1da28c0
| * The t_cose_key must be imported to the crypto library before this call. | ||
| */ | ||
| enum t_cose_err_t | ||
| t_cose_key_encode(struct t_cose_key key, |
There was a problem hiding this comment.
This name seems a bit too generic. I suggest adding an "ec2" infix somewhere, e.g., t_cose_key_encode_ec2
| QCBOREncodeContext cbor_encoder; | ||
| QCBORError qcbor_result; | ||
|
|
||
| result = t_cose_crypto_export_ec2_key(key, |
There was a problem hiding this comment.
I assume all the relevant checks from rfc9053 (point on curve, etc.) are done here, right?
| QCBOREncode_AddInt64ToMapN(&cbor_encoder, T_COSE_KEY_COMMON_KTY, T_COSE_KEY_TYPE_EC2); | ||
| QCBOREncode_AddInt64ToMapN(&cbor_encoder, T_COSE_KEY_PARAM_CRV, cose_curve); | ||
| QCBOREncode_AddBytesToMapN(&cbor_encoder, T_COSE_KEY_PARAM_X_COORDINATE, x_coord); | ||
| if (q_useful_buf_c_is_null(y_coord)) { |
There was a problem hiding this comment.
If this function is limited to EC2, both coordinates are needed - i.e., the compressed form x + y-sign is not allowed.
There was a problem hiding this comment.
Sorry, this comment is wrong. RFC9053 recommends not to use compressed (due to potential IPR), but it doesn't forbid it.
openci-bot
pushed a commit
to TrustedFirmware-M/trusted-firmware-m
that referenced
this pull request
Oct 15, 2024
Multiple partial implementations of the COSE_Key encode/decode APIs exists across the tf.org repos. To replace these with a full implementation copy the relevant functions from t_cose_psa_crypto.c from the upstream repo. On top of this, backporting two open PRs: - Only t_cose_key_decode(): laurencelundblade/t_cose#287 - laurencelundblade/t_cose#285 Signed-off-by: Tamas Ban <tamas.ban@arm.com> Change-Id: I6c7a67a4f2a57b90363ffeac9b023296a123e966
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.
No description provided.