-
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
Remove discussions of MBEDTLS_USE_PSA_CRYPTO in API documentation #9781
Remove discussions of MBEDTLS_USE_PSA_CRYPTO in API documentation #9781
Conversation
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.
This mostly looks good, and I'm satisfied with completeness for the subtask “API documentation”. There are a few problems in mbedtls_config.h
. There are conflicts with #9771, so it would be better to wait until that is merged for rework and re-review.
include/mbedtls/mbedtls_config.h
Outdated
* \note When this option is enabled, restartable operations in PK, X.509 | ||
* and TLS (see above) are not using PSA. On the other hand, ECDH | ||
* computations in TLS are using PSA, and are not restartable. These | ||
* are temporary limitations that should be lifted in the future. |
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.
Minor: there is only one limitation now.
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.
I am sorry I am not sure I can see which of these limitations has gone. Could you please elaborate?
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.
Oh, based on your next comment the remaining limitation is the restartable ECDH. As far as I can tell the restartable operations in PK, X509 and TLS are still not using PSA.
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.
Raised #9817 for tracking.
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.
Sorry, I must have forgotten to actually write a sentence here, or I made a mistake when consolidating/separating comments. Grammatically, the current paragraph contains two limitations (one per sentence). The first limitation “… not using PSA” is not really meaningful anymore, since users must assume that everything is “using PSA” — users must call psa_crypto_init
and must enable PSA_WANT_xxx
. So I thought we should remove that sentence: it's now an implementation detail, no longer a statement about the interface. The sentence isn't misleading though, and it's informative in a non-semantic way, so it can stay.
@@ -853,8 +850,8 @@ | |||
* | |||
* Enable the ECDH-ECDSA based ciphersuite modes in SSL / TLS. | |||
* | |||
* Requires: MBEDTLS_ECDH_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDH) | |||
* MBEDTLS_ECDSA_C or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDSA) | |||
* Requires: MBEDTLS_ECDH_C or PSA_WANT_ALG_ECDH |
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.
Partly preexisting (in many places in this file): this isn't quite right, and it wasn't right in 3.6 either. When MBEDTLS_USE_PSA_CRYPTO
is enabled and MBEDTLS_PSA_CRYPTO_CONFIG
is enabled (i.e. the only thing that will remain in 4.0), defining MBEDTLS_ECDH_C
does not automatically enable ECDH in PSA, so here the requirement is on PSA_WANT_ALG_ECDH
only.
In 3.6, this would be correct, although not necessarily the most helpful way to put it:
(!MBEDTLS_USE_PSA_CRYPTO and MBEDTLS_ECDH_C) or (MBEDTLS_USE_PSA_CRYPTO and PSA_WANT_ALG_ECDH)
It's not the most helpful way because if MBEDTLS_PSA_CRYPTO_CONFIG
is disabled, which is the case by default, then enabling MBEDTLS_ECDH_C
works regardless of MBEDTLS_USE_PSA_CRYPTO
.
In some cases where there's a direct correspondence between legacy and PSA mechanisms, we have a rule that the PSA mechanism will always be enabled if the legacy mechanism is (unless PSA is completely disabled). This is done in config_adjust_psa_superset_legacy.h
. But we only do this for hashes and curves, not for things like ECC/RSA algorithms.
Given that the removal of MBEDTLS_PSA_CRYPTO_CONFIG
is happening in parallel (https://github.com/Mbed-TLS/mbedtls/pull/9771/files#r1848889790), I think it would be best to not try to get those statements exactly right on either side, because then we'd have a lot of conflicts. Rather, I propose to file a task to fix these requirement statements once both #9781 and #9771 are merged.
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.
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.
MBEDTLS_USE_PSA_CRYPTO is now always enabled we need to update the documentation accordingly. Signed-off-by: Janos Follath <janos.follath@arm.com>
MBEDTLS_USE_PSA_CRYPTO is now always enabled we need to update the documentation accordingly. Signed-off-by: Janos Follath <janos.follath@arm.com>
MBEDTLS_USE_PSA_CRYPTO is now always enabled we need to update the documentation accordingly. Signed-off-by: Janos Follath <janos.follath@arm.com>
MBEDTLS_USE_PSA_CRYPTO is now always enabled we need to update the documentation accordingly. Signed-off-by: Janos Follath <janos.follath@arm.com>
77d290e
to
056cb14
Compare
Recent commits have changed these reference configurations and they are not verbatim copies anymore. Signed-off-by: Janos Follath <janos.follath@arm.com>
Now that USA_PSA_CRYPTO is always on, users need to call psa_init() with all protocol versions. Signed-off-by: Janos Follath <janos.follath@arm.com>
Add reference to github issues to give a way for users to track progress and express interest. Signed-off-by: Janos Follath <janos.follath@arm.com>
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.
LGTM (given that we'll make a follow-up to handle #9791)
@@ -165,7 +162,8 @@ typedef struct mbedtls_pk_rsassa_pss_options { | |||
* which functions are used for various operations. The overall picture looks | |||
* like this: | |||
* - if USE_PSA is not defined and ECP_C is defined then use ecp_keypair data | |||
* structure and legacy functions | |||
* structure and legacy functions. (MBEDTLS_USE_PSA_CRYPTO is always on and |
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.
Cosmetic:
* structure and legacy functions. (MBEDTLS_USE_PSA_CRYPTO is always on and | |
* structure and legacy functions. (\c MBEDTLS_USE_PSA_CRYPTO is always on and |
* #MBEDTLS_USE_PSA_CRYPTO is defined, the salt length is not | ||
* verified as PSA_ALG_RSA_PSS_ANY_SALT is used. | ||
* otherwise it must be NULL. Note that the salt length is not | ||
* verified as contexes have PSA_ALG_RSA_PSS_ANY_SALT as default |
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.
Cosmetic, preexisting:
* verified as contexes have PSA_ALG_RSA_PSS_ANY_SALT as default | |
* verified as contexts have #PSA_ALG_RSA_PSS_ANY_SALT as default |
* \note When this option is enabled, restartable operations in PK, X.509 | ||
* and TLS (see above) are not using PSA. On the other hand, ECDH |
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.
Minor: “not using PSA” is not really meaningful anymore, since users must assume that everything is “using PSA” — users must call psa_crypto_init and must enable PSA_WANT_xxx. So arguably we should remove that sentence: it's now an implementation detail, no longer a statement about the interface. The sentence isn't misleading though, and it's informative in a non-semantic way, so it can stay.
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.
Using or not using PSA might be an implementation detail, but it has user visible consequences. (eg. using or not using drivers)
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.
Changes LGTM and there are no documentation mentions of USE_PSA in include
or tf-psa-crypto/include
, which are the public-facing parts.
Description
Remove discussions of MBEDTLS_USE_PSA_CRYPTO in API documentation. Resolves partially #9632.
PR checklist
Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.