-
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
Define PSA_WANT symbols for key creation methods #7439
Comments
What symbols do we need?From a basic orthogonality perspective, we could create new symbols for each key managemenr method, i.e. define symbols of the form
So I think that:
Backward compatibilityWhat do we do with existing configurations that don't define the new symbols? E.g. if A basic principle of Thus I see two sensible designs:
The |
I tend to agree on both fronts:
Though I think with option (2) we need an extra symbol like Then we have a diamond dependency/auto-enablement graph:
|
I agree. Though I am a little annoyed that A counter-argument is that |
I'm not sure I'd consider it a design defect as opposed to a limitation of the implementation. I think to some extend "full support" always translates to "what you can". For example, an implementation could be restricted to certain key sizes (say, multiples of 8 no larger than 4096). I agree that this is not completely analogous to the present situation, in that here is no flag to say "support all key sizes" while there is (will be) a flag for "key derivation" and then it's indeed weird for an implementation to accept that flag being set while it can't provide the corresponding feature. I'm trying to think of more similar situations but I can't find better examples. I'm also trying to think about what I would expect as a user, and I seem to have conflicted feelings. I'm not sure how happy I would be about something like " In this respect option (1) would be cleaner, despite its compatibility issues. I think there's also an intermediate solution which would create compatibility issues but only for RSA, let's call it (2s) for "2 strict": So, to sum up:
Note that the compat issues are only for users of |
Looking at this, my preference goes to (1): semantically clean and only three PSA_WANT_xyz symbols instead of four for (2s) if I understand correctly. I don't think the compatibility issue is a huge problem as it seems manageable from the user perspective. Option (2I) is less problematic for some users in the short term but having something not semantically clean does not seem a good longer term solution. |
Following some discussion, we seem to have reached a consensus on the following proposal. For each existing
The documented "auto-enable graph" would be very simple: ALL enables IMPORT, EXPORT, GENERATE, DERIVE, and any of those 4 enable USE. In the foreseeable future though, in practice, USE would auto-enable IMPORT and EXPORT. This is because our tests heavily rely on it, and we don't want to allow configurations that we can't actually test. Migration plan:
|
I don't think this macro is needed. Few users care about derivation, for example. And it's unclear what we might add in the future that would be also covered by ALL. For example, when we add support for fancy import/export formats, would they be covered by ALL? |
One question, what would be the definition of the macro with suffix USE? |
Currently, |
Regarding RSASSA-PSS above do you mean that for a user to express "I want only RSASSA-PSS signature verification" he/she would define PSA_WANT_ALG_RSA_PSS but not PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_USE? |
That's my understanding:
We currently don't support one without the other, but in the future we want to support 1 without 2. (Though 2 will always imply 1 AFAICS.) |
With this you cannot express I want RSA-PSS signature generation and RSA-PKCS1V15 signature verification but not generation if I understand correctly. I am not sure there is any value in such a setting but this reveals a weakness in the scheme to me. Not simpler and/or cleaner to have rather PSA_WANT_ALG_RSA_PSS_VERIFICATION/SIGNATURE to express this and no _USE macros for the key types? |
Good point. However I think it's not specific for asymmetric algorithms/keys. We have the same situation for example with block ciphers and modes: there's no way to say "I want only AES-GCM and ARIA-CBC but not AES-CBC or ARIA-GCM". You can only say I want "CBC and GCM algs and AES and ARIA key types" and then you get the full matrix. I seem to remember that was by design. Btw this has a non-trivial impact on the decision process for what built-in version to include in the presence of drivers. If you have a driver for say AES-GCM and another for ARIA-CBC and these are the only combinations you're going to use, then you'll still end up with build-in AES, ARIA, GCM and CBC in your build. So, in terms of driver-only support, this is suboptimal if these situations exist/matter - which I have no idea if they do. I would assume that highly constrained devices will tend to support only one block cipher, which trivialises the matrix and makes the problem go away. But perhaps the situation can arise for moderately-constrained devices? |
Indeed. This sort of limitation is acceptable because as you note, it isn't something that people particularly care about. Even if there are users who might want such an arrangement (only generate modern PSS signatures, but accept legacy v1.5 signatures when verifying), there is not much gain in code size or attack surface by not including the code for v1.5 signature generation. My original proposal for a configuration description was a list of capabilities with a JSON concrete syntax, similar to a list of capabilities offered by a driver. But this went nowhere because there are many users who want to describe the configuration entirely with booleans expressed as preprocessor macros being on or off. So the scheme has to be simplified.
In practice, an implementation needs what we're calling |
I created a task for the first step, that will be executed as part of the driver-only ECC work: #7614 The only deviation from this message is I omitted the |
@gilles-peskine-arm @ronald-cron-arm I'm afraid we completely forgot to discuss the impact on I think for the But for the If so, do we want to provide some migration help as well, like if someone defines |
Indeed the |
Note: while updating the documentation, we noticed |
per Mbed-TLS#7439 (comment) and Mbed-TLS#7774 (comment) State that EXPORT implies BASIC. Also fix missing `WANT_` parts. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
It's ok if people use MBEDTLS_PSA_CRYPTO_CONFIG: it's not unstable or unpredictable. But we still reserve the right to make minor changes (e.g. Mbed-TLS#7439). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Resolved by #7774.
#7614 and its follow-ups. The feature was released in Mbed TLS 3.5.0. |
The
PSA_WANT_xxx
compile-time configuration mechanisms allows users to declare which cryptographic mechanisms they need. Currently, this is based on key types and algorithms.PSA_WANT_KEY_TYPE_xxx
requests full support for a key type (import, export, generate, derive), andPSA_WANT_ALG_yyy
requests support for an algorithm (only with supported key types). (Key type support has a refinement for DH/ECC groups/curves, but this is not relevant here.)Some key management mechanisms involve a significant amount of code size or might not be available with some drivers, so we would like to be able to restrict them. The goal is to reduce code size, so this is only relevant for mechanisms where a particular operation requires a significant amount of dedicated code. Specifically:
MBEDTLS_RSA_C
but notMBEDTLS_RSA_GENPRIME
with the legacy interface. Mbed TLS does not intend to support RSA key derivation in any case.This is an Mbed TLS-only interface, since we do not currently intend to make
PSA_WANT
an official PSA standard.Definition of done for this issue: a draft specification is merged into https://github.com/Mbed-TLS/mbedtls/blob/development/docs/proposed/psa-conditional-inclusion-c.md.
Follow-ups: issues to be created based on the specification.
The text was updated successfully, but these errors were encountered: