-
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
psa_util.c included in builds without PSA, which can break the build #9311
Comments
I'm adding this task to the 3.6.1 epic because it breaks the build. |
IIRC (couldn't find much written discussion, there's some on #7765 (comment)), it was intentional to include the the ECDSA raw2der/der2raw functions in any build that has at least one implementation of ECDSA. They're only used by the library in builds that have Also, now that they're part of the public API in 3.6.0, we need to be careful not to remove them in any configuration where they are working. We might want to just gate them with
To be clear: I don't think we want that, or can do that without breaking our compatibility promises, or need to do that (see below). |
Or we could just fix the code so that it works in all configs where the functions are currently defined.
I think the reasoning behind the current unconditional use of the PSA macro is that the set of curves enabled on the PSA side is a superset of those enabled on the legacy side (we make sure of that in |
Good point: the ECDSA signature conversion functions are also useful for users who use the legacy API but also need the raw signature format. We have them in |
Configurations where the functions try to store data in a 0-size array can't possibly be working. This affects both functions in the same sets of configurations, so there isn't a configuration where one function works but not the other. So we won't break backward compatibility if we gate both functions by the conditions under which they are working in 3.6.0. |
I was wondering why we didn't catch this in tests. We have tests that would overflow an array of length 0, but they're gated by PSA sizes, so they aren't running in non-PSA configurations. I'm leaning more and more towards going back to my original plan: exclude the functions in non-PSA configurations. In non-PSA configurations, these functions were not clearly documented as available, not working, and not tested. We should change the guard for |
Ah, good point, we're not as tied by our compatibility promises as I thought we were: if the functions have never been working in configuration X, then indeed it's OK to officially remove them in configuration X. So, removing them in non-PSA configs is indeed an option. I'm still undecided: initially we were thinking the functions could be useful in configurations with That's something I could understand. But otherwise, I'm still inclined to say that since our original intention was for the functions to be available in that case as well, then the obvious thing to do is to just make them work. Wdyt? |
The functions are declared in a header called If existing users have a protocol that needs raw signatures and are using the legacy API, they've presumably found a solution by themselves. And if they haven't, we would prefer it if they moved to the PSA API. If new users have a protocol that needs raw signatures, helping them use the legacy API is not a priority, especially now that there will no longer be a feature release where the legacy API is first-tier. So I think that making the functions work would run counter to our product strategy, both because we want people to move to PSA and because it would technically be a new feature in an LTS. I'm not fundamentally opposed to doing it, but those considerations put it very low on my priority list. |
Makes sense. So I'm happy going back to your original plan: remove those functions from non-PSA configs, where they never worked in the first place. |
In Mbed TLS 3.6.0, when
MBEDTLS_ECDSA_C
is enabled butMBEDTLS_PSA_CRYPTO_C
is disabled, some code frompsa_util.c
is included and declares a 0-size array, resulting in a compilation error (except under some non-picky compilers). In this configuration, no code frompsa_util.c
should be included.The culprit seems to be the definition of
MBEDTLS_PSA_UTIL_HAVE_ECDSA
ininclude/mbedtls/config_adjust_legacy_crypto.h
:MBEDTLS_PSA_UTIL_xxx
should be either undefined or ignored ifMBEDTLS_PSA_CRYPTO_C
isn't defined. (Or should this beMBEDTLS_PSA_CRYPTO_CLIENT
?)Originally reported on the mailing list
Definition of done:
MBEDTLS_PSA_CRYPTO_C
is disabled, no code frompsa_util.c
should be enabled.component_test_no_psa_crypto_full_cmake_asan
and in some of the reference configurations. Figure out why it wasn't caught and fix that.The text was updated successfully, but these errors were encountered: