-
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 policy enforcement from RSA #8492
Comments
I'm not sure it is or should be the job of PK to enforce policies. We already have a well-designed API that handles policies: the PSA Crypto API. The PK API on the other hand was not well designed and not with policies in mind. We are (probably) keeping it in 4.0 mostly for backwards compatibility purposes. If we try to extend it to enforce policies, we'll be partially negating the backwards compatibility benefits of keeping it, and we'll be fighting an uphill battle trying to extend a currently inconsistent API. I'm not sure that's something we want to do at this point. Note: the RSA-PSS type is not actually a key type in that you can't create a key of that type; it's just a value you can pass to some I think we probably need to have a holistic discussion about the future of PK at some point. |
PK needs to know what algorithm to use when calling |
|
Remove policy enforcement from the RSA module. Instead of configuring a key to use a specific padding mode and hash, let each function call decide what to use.
Remove
mbedtls_rsa_pkcs1_sign
,mbedtls_rsa_pkcs1_verify
,mbedtls_rsa_pkcs1_encrypt
andmbedtls_rsa_pkcs1_decrypt
. Let the caller call a v15/OAEP/PSS-specific function.Create a separate
mbedtls_pk_type_t
value for OAEP (there are already separate types for RSA, meaning v15, and RSA-PSS). Use that to choose the function to dispatch to in pk.PSA already knows the key's policy and the requested algorithm, so we just need to make it call the appropriate function.
Justification: having policy enforcement both in RSA (but partially and clumsily) and in higher-level modules is confusing. See for example the long discussion in #7930. It's simpler to let
rsa.c
focus on doing the calculations, and letpk.c
andpsa_crypto*.c
worry about policies.Prerequisite: #8452
The text was updated successfully, but these errors were encountered: