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

Use PSA for ECDSA signature generation in PK #5163

Open
mpg opened this issue Nov 12, 2021 · 0 comments
Open

Use PSA for ECDSA signature generation in PK #5163

mpg opened this issue Nov 12, 2021 · 0 comments
Labels
enhancement size-m Estimated task size: medium (~1w)

Comments

@mpg
Copy link
Contributor

mpg commented Nov 12, 2021

In library/pk_wrap.c, re-implement the existing wrapper ecdsa_sign_wrap to use psa_sign_message() instead of mbedtls_rsa_pkcs1_sign().

This will require creating a temporary PSA private key with appropriate permissions. An example of something similar, but with a public key, can be found in ecdsa_verify_wrap() in the same file (note: there are currently two definitions of ecdsa_very_wrap(), we want to look at the one that uses PSA).

This also requires transcoding the resulting signature, as PSA encodes it differently from what the current PK API promises (which is what TLS and X.509 want). There's already a function for that: pk_ecdsa_sig_asn1_from_psa(), currently used by pk_opaque_sign_wrap().

The resulting wrapper will most likely look like a mix of the existing (PSA-based) ecdsa_very_wrap() (management of the temporary key) and pk_opaque_sign_wrap() (transcoding of the signature and or parameters / error codes).

Depends on: #5156 (to be able to use PSA without #ifdefs).

@mpg mpg added enhancement Product Backlog size-m Estimated task size: medium (~1w) labels Nov 12, 2021
@mpg mpg added this to Incoming Items in OBSOLETE - SEE https://github.com/orgs/Mbed-TLS/projects/3 via automation Nov 12, 2021
@mpg mpg changed the title Use PSA for RSA PKCS#1 v1.5 signature generation in PK Use PSA for ECDSA signature generation in PK Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement size-m Estimated task size: medium (~1w)
Projects
None yet
Development

No branches or pull requests

3 participants