-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Avoid parse/unparse public ECC keys in PK with USE_PSA when !ECP_C #7073
Labels
component-crypto
Crypto primitives and low-level interfaces
enhancement
size-m
Estimated task size: medium (~1w)
Comments
mpg
added
enhancement
component-crypto
Crypto primitives and low-level interfaces
size-m
Estimated task size: medium (~1w)
labels
Feb 9, 2023
This was referenced Feb 9, 2023
3 tasks
This was referenced Apr 5, 2023
This was referenced Apr 13, 2023
3 tasks
After the study work done with PR #7202 and once all PRs related to issue #7460 will be addressed, here is how the (new) solving PR should be shaped (as suggested here):
|
This was referenced Apr 28, 2023
valeriosetti
removed
the
needs-preceding-pr
Requires another PR to be merged first
label
May 10, 2023
valeriosetti
changed the title
Avoid parse/unparse public ECC keys in PK with USE_PSA
Extend pk_context structure to include public key in raw format when USE_PSA is enabled
May 11, 2023
valeriosetti
changed the title
Extend pk_context structure to include public key in raw format when USE_PSA is enabled
Avoid parse/unparse public ECC keys in PK with USE_PSA when !ECP_C
May 15, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
component-crypto
Crypto primitives and low-level interfaces
enhancement
size-m
Estimated task size: medium (~1w)
Background: see #6009 and in particular #6009 (comment).
When
USE_PSA_CRYPTO
is enabled, the PK module should:psa_import_key()
) in addition to storing them as anecp_keypair
pk_verify()
) or writing it out (pk_write_pubkey*()
) use that array in preference to theecp_keypair
structure.This reduces the reliance on ECP (and ultimately) bignum functions. Note: for now we're keeping the
ecp_keypair
structure for compatibility reasons, due to the existence of the public API functionmbedtls_pk_ec()
. In the future we'll probably remove it whenECP_C
is disabled.Suggested course of action:
mbedtls_pk_context
to hold the serialized key. Adaptpk_init()
andpk_free()
accordingly.pk_get_ecpubkey()
, which takes as input exactly the EC Point thatpsa_import_key()
wants. Make this function copy its input to the new members of thembedtls_pk_context
. (Note: actually this only works for uncompressed points (ie, input starts with 0x04). For compressed points, until PSA supports them, we have no choice but to callmbedtls_ecp_write_point_binary()
to get the uncompressed form fromkey->Q
. This leave one parse-serialize cycle, but at least it's isolated inpk_get_ecpubkey()
.ecdsa_verify_wrap()
we no longer need to callmbedtls_ecp_point_write_binary()
and can directly get the input topsa_import_key()
from the new members ofpk_context
.pk_write_ec_pubkey()
. Again, instead of callingmbedtls_ecp_point_write_binary()
we can just copy from the new members ofpk_context
.Depends on:
Follow-up: #7074 same for private keys.
The text was updated successfully, but these errors were encountered: