Skip to content
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

[Backport 3.6] psa_util.c included in builds without PSA, which can break the build #9463

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

sezrab
Copy link
Contributor

@sezrab sezrab commented Aug 9, 2024

Backport of #9313

PR checklist

… when PSA enabled

Signed-off-by: Sam Berry <sam.berry@arm.com>
Signed-off-by: Sam Berry <sam.berry@arm.com>
@sezrab sezrab added needs-review Every commit must be reviewed by at least two team members, component-crypto Crypto primitives and low-level interfaces size-s Estimated task size: small (~2d) priority-very-high Highest priority - prioritise this over other review work labels Aug 9, 2024
@gilles-peskine-arm
Copy link
Contributor

This is missing the changes to the test suite.

@gilles-peskine-arm gilles-peskine-arm added needs-work and removed needs-review Every commit must be reviewed by at least two team members, labels Aug 9, 2024
@sezrab
Copy link
Contributor Author

sezrab commented Aug 9, 2024

This is missing the changes to the test suite.

@gilles-peskine-arm I think test_suite_psa_crypto_util.function already uses MBEDTLS_PSA_UTIL_HAVE_ECDSA in 3.6

@gilles-peskine-arm
Copy link
Contributor

I think test_suite_psa_crypto_util.function already uses MBEDTLS_PSA_UTIL_HAVE_ECDSA in 3.6

Ah. So it does. The difference between 3.6 and development still doesn't quite make sense to me, but I now think that something's wrong with the development PR because things changed on the development branch after you started working. Let me look closer.

Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this independently on the mbedtls-3.6 branch:

We want to resolve a bug in 3.6.0 whereby the ECDSA conversion functions don't work when PSA is disabled (due to a buffer size that only works in builds with PSA). Since the functions are not very useful without PSA and didn't work without PSA, we want to disable them in builds without PSA. This pull request does the requisite change.

Incidentally, it has come up that the tests of these functions were only running in builds with PSA. The preprocessor guard on the test functions is the same as the guard on the library functions: MBEDTLS_PSA_UTIL_HAVE_ECDSA, so there's nothing to fix there. The lack of test coverage came from guards on the test cases, which depend on PSA support for curve sizes. Since the library functions are now enabled only in builds with PSA, the test cases do run in all the builds that have the library functions. So we don't need to change anything else in the tests.

Therefore this pull request correctly fixes the bug.

There is no non-regression test, but that would come through stricter compiler flags and we'll handle that in a separate pull request (backport of #9456, addressing #9317).

@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members, and removed needs-work labels Aug 9, 2024
Copy link
Contributor

@mpg mpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. As pointed out previously, the patch differs from the development patch, but in ways that have been explained in the meantime, so it's all good.

@sezrab sezrab added approved Design and code approved - may be waiting for CI or backports and removed needs-review Every commit must be reviewed by at least two team members, labels Aug 12, 2024
@mpg mpg added this pull request to the merge queue Aug 14, 2024
Merged via the queue into Mbed-TLS:mbedtls-3.6 with commit 70658db Aug 14, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports component-crypto Crypto primitives and low-level interfaces priority-very-high Highest priority - prioritise this over other review work size-s Estimated task size: small (~2d)
Development

Successfully merging this pull request may close these issues.

3 participants