-
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
Build error with clang in case of minimal PSA crypto config #7625
Comments
I can confirm that the PAKE issues are fixed on the latest development branch (7f97675) |
Having looked at the code a little, clang's warnings are correct, but annoying: it would be nice if it would just silently optimize the unreachable code away. The code structure is of the form
And in the special case where none of the features are enabled, the cleanup code is indeed not reachable. I suppose we'll have to manually put the correct conditional directives around the cleanup code. In the meantime, a workaround is to remove |
Thanks for looking at the issue. So If I'm correct, this would be the workaround:
Shall I create a PR for this? |
That's a possible workaround, but we'd prefer to fix the code so that it doesn't trigger a warning. I'm not sure yet what we'll do. |
Summary
There is a build error when Mbed TLS is build with PSA Crypto support with a minimal configuration. clang reports unreachable code in
library/psa_crypto_aead.c
,library/psa_crypto_cipher.c
andlibrary/psa_crypto.c
. When all the algorithms are disabled, some of the functions return immediately, and some code at the end of the functions become unreachable.Please note that the attached reproducer won't trigger the errors in
library/psa_crypto.c
. I'm not sure why.System information
Mbed TLS version: v3.4.0 and developement branch:
Operating system and version: Bare metal and Linux
Configuration (if not default, please attach
mbedtls_config.h
): my_config.zipCompiler and options: cmake with clang 13.0.1. See steps to reproduce
Additional environment information: -
Expected behavior
Mbed TLS builds without error
Actual behavior
Compilation fails with error
Steps to reproduce
Additional information
The text was updated successfully, but these errors were encountered: