-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Remove all non ext apis #10439
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
base: development
Are you sure you want to change the base?
Remove all non ext apis #10439
Conversation
de6efc8
to
6a5dee1
Compare
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.
The first 2 commits' titles say that they are replacing mbedtls_pk_sign
with mbedtls_pk_sign_ext
, but in facts they are replacing with mbedtls_pk_sign_restartable
.
Looking also at the description of the original issue wasn't _ext
the expected replacement?
Replace mbedtls_pk_sign with mbedtls_pk_sign_restartable, as mbedtls_pk_sign has now been removed and was origonally a pass through call to mbedtls_pk_sign_restartable. Signed-off-by: Ben Taylor <[email protected]>
Replace mbedtls_pk_verify with mbedtls_pk_verify_restartable, as mbedtls_pk_verify has now been removed and was origonally a pass through call to mbedtls_pk_verify_restartable. Signed-off-by: Ben Taylor <[email protected]>
…ssl_write_handshake_msg_ext Signed-off-by: Ben Taylor <[email protected]>
Signed-off-by: Ben Taylor <[email protected]>
6a5dee1
to
45daab5
Compare
@valeriosetti, this is a good spot. I originally looked at the non ext functions as saw they were just calling the restartable versions, so converted them as I suspect there was in issue converting them to ext versions. Let me investigate further though and come back to you. |
In case you need to find all non-replaced occurrences of
It looks for all functions that have an For the records here a list of the non-replaced functions found by this script:
|
@valeriosetti So for mbedtls_pk_can_do, we've agreed to postpone it as I believe we maybe need to change it to the psa form instead of mbedtls_pk_can_do_ext. The reason that I used the restartable version of mbedtls_pk_sign/mbedtls_pk_verify is that the original function was a passthrough for these. The ext version requires that you pass in mbedtls_pk_sigalg_t pk_type and as far as I can tell this is only stored in the private struct mbedtls_pk_info_t, or at least the mbedtls_pk_type_t version is. Which is buried in the mbedtls_pk_context. We have an access function pk_get_type_ext(const mbedtls_pk_context *pk). However this is also private as it is not declared outside of pkwrite.c. Do you know the plan around these functions? Is the API for example expecting you to pass it down through the stack? Or are these ones best left as they are for now? Thanks for the script, I'll go through and take a look at the other ext functions. |
Since |
Please don't replace To improve things, we need to replace sign/verify with the ext variant, where the caller specifies which algorithm it wants. The caller should always know.
Yes, exactly: the X.509 or TLS protocol says which algorithm to use. When our code says “use whatever algorithm the key was set up for”, that's potentially wrong. Practically, things are different for RSA and ECC. For RSA, there are two completely different signature/verification algorithms (PKCS#1v1.5 and PSS), and the caller always knows which one to use because it's dictated by the protocol. For ECC, there are two variants of ECDSA (deterministic and randomized) which are functionally equivalent, but the signature operation has different security properties, and the caller needs to use whichever variant the key allows. Generally that will be |
Description
Remove all non ext apis, resolves #8135 depends Mbed-TLS/TF-PSA-Crypto#499. Currently not including mbedtls_x509_get_subject_alt_name removal, as this is under discussion.
This PR is part of a multistage PR to be merged in the following order:
PR checklist