Skip to content

Conversation

@gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Nov 10, 2025

Clean up some things in build_info.h and the header that it includes:

  • Resolves Cleanup after mechanism for marking a compilation option as private mbedtls#10305.
  • Move config adjustment headers to .../private — this had only been partially done in 1.0.
  • Sort out which config adjustments belong under /include and which ones belong under /drivers/builtin/include.
  • Rename config adjustment headers to follow a more systematic naming scheme, and to better reflect their role in a world where the user configuration is only driven by PSA.

Needs preceding PR: framework Mbed-TLS/mbedtls-framework#236

I used (and even wrote) Mbed-TLS/mbedtls-docs#193 to check for mistakes when reordering parts of build_info.h.

PR checklist

@gilles-peskine-arm gilles-peskine-arm added size-s Estimated task size: small (~2d) priority-high High priority - will be reviewed soon needs-preceding-pr Requires another PR to be merged first needs-ci Needs to pass CI tests labels Nov 10, 2025
@gilles-peskine-arm gilles-peskine-arm force-pushed the build_info-cleanup-1.0 branch 4 times, most recently from d353f00 to 1f55061 Compare November 17, 2025 23:01
@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members needs-reviewer This PR needs someone to pick it up for review and removed needs-ci Needs to pass CI tests labels Nov 18, 2025
@ronald-cron-arm ronald-cron-arm removed the needs-reviewer This PR needs someone to pick it up for review label Nov 18, 2025
ronald-cron-arm

This comment was marked as off-topic.

@ronald-cron-arm ronald-cron-arm self-requested a review November 19, 2025 10:23
Copy link
Contributor

@ronald-cron-arm ronald-cron-arm left a comment

Choose a reason for hiding this comment

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

Thanks for this nice clean-up. Thanks for the commit message that helped a lot reviewing the changes. I have some minor comments/questions.

@ronald-cron-arm
Copy link
Contributor

ronald-cron-arm commented Nov 20, 2025

One minor comment remaining. Otherwise it looks good to me.

Copy link
Contributor

@ronald-cron-arm ronald-cron-arm left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

minosgalanakis
minosgalanakis previously approved these changes Nov 20, 2025
Copy link
Contributor

@minosgalanakis minosgalanakis left a comment

Choose a reason for hiding this comment

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

LGTM

@github-project-automation github-project-automation bot moved this from In Development to Has Approval in Roadmap pull requests (new board) Nov 20, 2025
@ronald-cron-arm ronald-cron-arm 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 needs-preceding-pr Requires another PR to be merged first labels Nov 20, 2025
Individual headers or C files are supposed to include what they need.

Signed-off-by: Gilles Peskine <[email protected]>
This is changing PSA configurations, based on conditions that are not
driver-specific, so keep it in `/include`. The file has guards based on
whether some key derivation algorithms are accelerated, but these guards are
currently irrelevant since key derivation drivers are not supported yet.

This is not meant to be included directly by applications, so move it under
`.../private`.

Signed-off-by: Gilles Peskine <[email protected]>
This is at the PSA level, not driver-specific, so keep it in `/include`.

This is not meant to be included directly by applications, so move it under
`.../private`.

Signed-off-by: Gilles Peskine <[email protected]>
This commit changes the location of the file in the inclusion order, to
group it with other headers that tweak the PSA configuration. The former
order also worked because the macros that it references aren't used in
other configuration-tweaking headers at this time (and have never been,
I believe), so this is not a bug fix, just a readability and robustness
improvement.

This is at the PSA level, not driver-specific, so keep it in `/include`.

This is not meant to be included directly by applications, so move it under
`.../private`.

Rename the file to match the pattern followed by similar files (I had
forgotten a word when I created that file initially).

Signed-off-by: Gilles Peskine <[email protected]>
This commit changes the location of the file in the inclusion order, to
group it with other headers that tweak the PSA configuration. Specificaly,
this header is now included before `config_adjust_legacy_from_psa.h` and
`config_adjust_test_accelerators.h`. Both of these set driver-specific
macros based on `PSA_WANT` macros, whereas
`crypto_adjust_config_derived.h` does not query driver-specific macros, so
the new order is no worse.

In fact the new order more correct because it would make sense for
`config_adjust_legacy_from_psa.h` to query macros set by
`crypto_adjust_config_derived.h`. However, it currently doesn't, so this
is not a bug fix, just a robustness improvement.

This is at the PSA level, not driver-specific, so keep it in `/include`.

This is not meant to be included directly by applications, so move it under
`.../private`.

Rename the file to match the pattern followed by similar files (I had
forgotten a word when I created that file initially).

Signed-off-by: Gilles Peskine <[email protected]>
Historically, we did config ajustments in a separate header `config_psa.h`.
Then we split `config_psa.h` into pieces. Today, having `config_psa.h` as a
layer of indirection in header inclusions is no longer useful. So remove it.

Signed-off-by: Gilles Peskine <[email protected]>
Rename the file to match the pattern followed by similar files, and to
better reflect the role of the file in the context of TF-PSA-Crypto. It's no
longer about enabling legacy interfaces, since low-level crypto is mostly no
longer part of a public interface, but about enabling internal interfaces
that implement actual cryptography.

Signed-off-by: Gilles Peskine <[email protected]>
This is specific to modules that are under `/drivers`, so keep it under
`/drivers`. Some of these modules are also public interfaces that are used
in builds with only third-party drivers, so the corresponding macros should
be outside of `/drivers`; this will be handled in a subsequent commit.

This is not meant to be included directly by applications, so move it under
`.../private`.

Rename the file to match the pattern followed by similar files, and to
better reflect its current role: it's tweaking modules that implement the
built-in cryptography, which were formerly legacy public interfaces but are
now internal.

Signed-off-by: Gilles Peskine <[email protected]>
This one comes after both the PSA feature set and the feature set of
built-in crypto have been determined.

This commit creates an empty file. It will be populated in a subsequent commit.

Signed-off-by: Gilles Peskine <[email protected]>
Split out the parts of `crypto_adjust_config_tweak_builtins.h` that are
actually about generic support modules (platform, ASN.1, MD, ...), and
move them outside `/drivers`, into `crypto_adjust_config_support.h`.

One macro only depends on PSA options, so move it to
`crypto_adjust_config_derived.h` instead.

Signed-off-by: Gilles Peskine <[email protected]>
Install all headers without hard-coding which sub(sub)directories exist.

Don't use file(GLOB), following CMake best practices (the list might not be
updated if a source file is added or removed when the build tree already
exists). It isn't actually useful anyway.

To keep things simple, don't permissions: we just want the default permissions.

Signed-off-by: Gilles Peskine <[email protected]>
Signed-off-by: Gilles Peskine <[email protected]>
This was done too late, so it could have led to mysterious build errors if
PKCS5 was the only thing that requires MD.

Signed-off-by: Gilles Peskine <[email protected]>
We added `#error` directives to prevent some headers from being included
directly because those headers were not clearly indicated as public (and, in
the case of `check_config.h`, were formerly public). Headers under
`.../private` have no history of being public and are obviously not intended
for direct consumption, so remove the enforcement.

Signed-off-by: Gilles Peskine <[email protected]>
@gilles-peskine-arm
Copy link
Contributor Author

I rebased to include the merge of the framework prerequisite and to resolve the framework conflict. The previous version is in https://github.com/gilles-peskine-arm/TF-PSA-Crypto/tree/build_info-cleanup-1.0-4

@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members and removed approved Design and code approved - may be waiting for CI or backports labels Nov 20, 2025
Copy link
Contributor

@ronald-cron-arm ronald-cron-arm left a comment

Choose a reason for hiding this comment

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

Rebase and framework update look good to me.

Copy link
Contributor

@minosgalanakis minosgalanakis left a comment

Choose a reason for hiding this comment

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

LGTM

@ronald-cron-arm ronald-cron-arm added this pull request to the merge queue Nov 24, 2025
Merged via the queue into Mbed-TLS:development with commit 5df23a9 Nov 24, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from Has Approval to Done in Roadmap pull requests (new board) Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review Every commit must be reviewed by at least two team members priority-high High priority - will be reviewed soon size-s Estimated task size: small (~2d)

Development

Successfully merging this pull request may close these issues.

Cleanup after mechanism for marking a compilation option as private

3 participants