-
Notifications
You must be signed in to change notification settings - Fork 96
Adapt ECDSA wrapper to new EC public key format #28
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
Adapt ECDSA wrapper to new EC public key format #28
Conversation
Could you please mention what tests did you perform on that code? |
Previously, PSA used SubjectPublicKeyInfo structures to serialize EC public keys. This has recently been changed to using ECPoint structures instead, but the wrapper making PSA ECDSA verification available through Mbed TLS' PK API hasn't yet been adapted accordingly - which is what this commit does. Luckily, Mbed TLS' PK API offers two functions mbedtls_pk_write_pubkey() and mbedtls_pk_write_pubkey_der(), the latter exporting a SubjectPublicKeyInfo structure and the former exporting an ECPoint structure in case of EC public keys. For the adaptation of the ECDSA wrapper ecdsa_verify_wrap() it is therefore sufficient to use mbedtls_pk_write_pubkey() instead of mbedtls_pk_write_pubkey_der().
5a0810e
to
5d5e90a
Compare
Sibling Mbed-TLS/mbedtls#2382 passes |
Note: the only travis failures are in a known-fragile DTLS 3d interop test. The same tests passed on Jenkins passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
I noted an outdated comment, but I don't think it's problematic enough to be worth fixing at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would recommend fixing the comment @mpg pointed out. Otherwise, looks fine.
@AndrzejKurek @mpg @Patater Fixed, please re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the comment. Result looks good to me.
CI only failed in known-intermittent timing test on BSD, so is as good as a pass. |
Summary: Previously, PSA used
SubjectPublicKeyInfo
structures to serialize EC public keys. This has been changed in #13 to usingECPoint
structures instead, but the wrapper making PSA ECDSA verification available through Mbed TLS' PK API hasn't yet been adapted accordingly - which is what this PR does.Luckily, Mbed TLS' PK API offers two functions
mbedtls_pk_write_pubkey()
andmbedtls_pk_write_pubkey_der()
, the latter exporting aSubjectPublicKeyInfo
structure and the former exporting anECPoint
structure in case of EC public keys. For the adaptation of the ECDSA wrapperecdsa_verify_wrap()
it is therefore sufficient to usembedtls_pk_write_pubkey()
instead ofmbedtls_pk_write_pubkey_der()
.This PR is the sibling of Mbed-TLS/mbedtls#2382 to the Mbed TLS repository.