Skip to content

Fix preprocessor logic for standalone TF-PSA-Crypto#277

Open
bensze01 wants to merge 1 commit intoMbed-TLS:mainfrom
bensze01:undef
Open

Fix preprocessor logic for standalone TF-PSA-Crypto#277
bensze01 wants to merge 1 commit intoMbed-TLS:mainfrom
bensze01:undef

Conversation

@bensze01
Copy link
Copy Markdown
Contributor

@bensze01 bensze01 commented Feb 5, 2026

Description

Fix preprocessor logic for standalone TF-PSA-Crypto

PR checklist

Please add the numbers (or links) of the associated pull requests for consuming branches. You can omit branches where this pull request is not needed.

  • TF-PSA-Crypto PR provided # | not required because:
  • development PR provided # | not required because:
  • 3.6 PR provided # | not required because:

@gilles-peskine-arm gilles-peskine-arm added needs-work priority-medium Medium priority - this can be reviewed as time permits labels Mar 5, 2026
#if (MBEDTLS_VERSION_MAJOR < 4 && defined(MBEDTLS_PSA_CRYPTO_C)) || \
(MBEDTLS_VERSION_MAJOR >= 4 && defined(MBEDTLS_PSA_CRYPTO_CLIENT))
#if (defined(MBEDTLS_VERSION_MAJOR) && MBEDTLS_VERSION_MAJOR < 4 && defined(MBEDTLS_PSA_CRYPTO_C)) || \
((!defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4) && defined(MBEDTLS_PSA_CRYPTO_CLIENT))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can't think of a good reason to write !defined(MBEDTLS_VERSION_MAJOR). Why would we need to do something special when not building Mbed TLS? If you mean a condition to apply to TF-PSA-Crypto, use defined(TF_PSA_CRYPTO_VERSION_MAJOR).

There are a few places where we are currently using !defined(MBEDTLS_VERSION_MAJOR). They're left behind from a time when we had alreday made TF-PSA-Crypto a separately testable entity but not yet given it version macros. That was just a planning mistake, and we should be removing those !defined(MBEDTLS_VERSION_MAJOR) and using the TF_PSA_CRYPTO_xxx macro now.

No logical changes intended

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-work priority-medium Medium priority - this can be reviewed as time permits

Projects

Status: In Development

Development

Successfully merging this pull request may close these issues.

2 participants