Skip to content

psa_crypto_driver_wrappers uses return instead of setting status #10035

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

Open
VitChmelarNXP opened this issue Mar 5, 2025 · 1 comment
Open
Labels
bug component-psa PSA keystore/dispatch layer (storage, drivers, …)

Comments

@VitChmelarNXP
Copy link

Summary

Inconsictency in psa_crypto_driver_wrappers

Some of functions in psa_driver_wrapper_verify_message are called with return, which creating unreachable code and skiping condition for PSA_ERROR_NOT_SUPPORTED
Seens on line 226 https://github.com/Mbed-TLS/mbedtls/blob/v3.6.2/scripts/data_files/driver_templates/psa_crypto_driver_wrappers.h.jinja#L226
Probably correct way of calling on line 208 https://github.com/Mbed-TLS/mbedtls/blob/v3.6.2/scripts/data_files/driver_templates/psa_crypto_driver_wrappers.h.jinja#L208

System information

Mbed TLS version (number or commit id): 3.6.2
Operating system and version: embedded
Configuration (if not default, please attach mbedtls_config.h):
Compiler and options (if you used a pre-built binary, please indicate how you obtained it): N/A
Additional environment information:

Expected behavior

Actual behavior

Steps to reproduce

Additional information

@davidhorstmann-arm
Copy link
Contributor

Thanks for reporting this!

Indeed I think you are correct about the inconsistency, but I think we actually need to remove the dead code that checks the status. The opaque test driver which has the inconsistency is declared without fallback == true, which means that it should not fall back to the builtin implementation if the driver does not support the algorithm.

The correct code should just return and not have the check of status afterwards.

@davidhorstmann-arm davidhorstmann-arm added bug component-psa PSA keystore/dispatch layer (storage, drivers, …) labels Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-psa PSA keystore/dispatch layer (storage, drivers, …)
Projects
None yet
Development

No branches or pull requests

2 participants