Skip to content

Unreachable code yielding compilation warnings with PSA driver-only configurations #10520

@PatrikNemethNXP

Description

@PatrikNemethNXP

Suggested enhancement

Modify code guarded by MBEDTLS_PSA_BUILTIN_xxx macros to support PSA driver-only builds. The same would apply to the PSA repository builtins after the split in version 4.0.0.

For example here https://github.com/Mbed-TLS/mbedtls/blob/v3.6.5/library/psa_crypto_aead.c#L256, if no builtin is compiled in, we exit early and unconditionally, resulting in unreachable dead code further down.

There are multiple instances of configuration-based dead code, namely in psa_crypto_cipher.c, psa_crypto_aead.c, and psa_crypto.c.

Justification

Mbed TLS needs this because some configurations of driver-only builds result in dead code that can raise warnings in some toolchains (e.g. Pe111 (unreachable statements) in IAR).

Metadata

Metadata

Labels

component-psaPSA keystore/dispatch layer (storage, drivers, …)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions