Skip to content

scripts: Add dispatch include path and new generation location#307

Open
asmellby wants to merge 5 commits into
Mbed-TLS:mainfrom
asmellby:feature/dispatch-library
Open

scripts: Add dispatch include path and new generation location#307
asmellby wants to merge 5 commits into
Mbed-TLS:mainfrom
asmellby:feature/dispatch-library

Conversation

@asmellby

@asmellby asmellby commented Jun 11, 2026

Copy link
Copy Markdown

Description

PSA crypto driver dispatch files are generated into dispatch/ instead of core/ in newer TF-PSA-Crypto versions. API headers that rely on driver and dispatch implementation details are also moved from include/ to dispatch/include/.

Update the framework scripts to work with both the old and new layouts.

PR checklist

PSA crypto driver dispatch files are generated into dispatch/
instead of core/ in newer TF-PSA-Crypto versions. API headers
that rely on driver/dispatch implementation details are also
moved from include/ to dispatch/include/.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
@gilles-peskine-arm gilles-peskine-arm added enhancement New feature or request 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 size-s Estimated task size: small (~2d) priority-high High priority - will be reviewed soon size-xs Estimated task size: extra small (a few hours at most) and removed size-s Estimated task size: small (~2d) labels Jun 11, 2026
@gilles-peskine-arm

gilles-peskine-arm commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

(Priority note: this fits under our “PSA crypto driver standardization” work, for which we have allocated a little bandwidth this quarter. Thanks Aksel for contributing it!)

@asmellby asmellby marked this pull request as ready for review June 11, 2026 11:58
@gilles-peskine-arm gilles-peskine-arm removed the needs-reviewer This PR needs someone to pick it up for review label Jun 11, 2026

@gilles-peskine-arm gilles-peskine-arm left a comment

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 don't think tf_psa_crypto_version() is necessary. But if it is, it needs to pass the static checks. Otherwise looks good to me.

Comment thread scripts/make_generated_files.py Outdated

if build_tree.looks_like_tf_psa_crypto_root("."):
new_dispatch_layout = (Path.cwd() / "dispatch" / "CMakeLists.txt").exists()
if build_tree.tf_psa_crypto_version() >= (1,1,0) and new_dispatch_layout:

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.

What's the point of checking the version? I'd prefer to avoid relying on any version number.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I did it to limit when the new layout was considered to releases that are "supposed to" have the new layout. But unconditionally allowing the new layout does mean we avoid the version check. Updated to remove the version check.

else:
parser.add_argument('--include', '-I',
action='append', default=['tf-psa-crypto/include',
'tf-psa-crypto/dispatch/include',

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.

There's still a reference to core/psa_crypto_driver_wrappers.h in scripts/check_names.py, and even a reference to library/psa_crypto_driver_wrappers.h which only exists in the 3.6 branch. It was introduced in 634e0d2 and I think it's now obsolete (especially since check_names.py passes just fine with the generated files in dispatch), but I'm not completely sure. If it's obsolete, we might as well remove it now, although it would be strictly speaking out of scope.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch. Updated to include the new dispatch include path (which was missing) and generalizing the excluded autogen files. I agree that it looks like the script passes even if psa_crypto_driver_wrappers.h isn't excluded, so if you want me to, I can remove the exclusion instead. I don't know if the lack of "bad" symbols in the generated file is a long-term commitment or just how things are right now.

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.

The problem isn't with symbols that violate our naming conventions, but about symbols that look like a typo because check_names finds their use but not their definition or vice versa.

Since 634e0d2, we've both fixed a few bugs in check_names.py and changed the structure of the driver wrapper code. Today check_names.py passes on 3.6 if I remove all references to psa_crypto_driver_wrappers.h (all of them in exclude lists) (69fa1da). So please go ahead and do that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.

@gilles-peskine-arm gilles-peskine-arm added needs-work and removed needs-review Every commit must be reviewed by at least two team members. labels Jun 11, 2026
asmellby added 2 commits June 12, 2026 11:02
Assume the new dispatch location is possible for any
TF-PSA-Crypto version to avoid needing to perform a version
check.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Add the dispatch include directory to the list of public
paths to check. Add the generated driver wrapper path to
the list of excluded patterns.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members. needs-ci Needs to pass CI tests and removed needs-work labels Jun 12, 2026

@gilles-peskine-arm gilles-peskine-arm left a comment

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.

LGTM, but let's not add to the complexity in check_names, please remove the psa_crypto_driver_wrappers.h exclusion.

else:
parser.add_argument('--include', '-I',
action='append', default=['tf-psa-crypto/include',
'tf-psa-crypto/dispatch/include',

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.

The problem isn't with symbols that violate our naming conventions, but about symbols that look like a typo because check_names finds their use but not their definition or vice versa.

Since 634e0d2, we've both fixed a few bugs in check_names.py and changed the structure of the driver wrapper code. Today check_names.py passes on 3.6 if I remove all references to psa_crypto_driver_wrappers.h (all of them in exclude lists) (69fa1da). So please go ahead and do that.

asmellby added 2 commits June 15, 2026 09:40
The check_names.py script excluded the driver wrapper from being
included in API checks. The limitations that led to that being
necessary are no longer present, so remove the exclude for all
possible driver wrapper locations across Mbed TLS and TF-PSA-Crypto.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Check for stray Doxygen commands in the dispatch include
directory.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs-ci Needs to pass CI tests needs-review Every commit must be reviewed by at least two team members. priority-high High priority - will be reviewed soon size-xs Estimated task size: extra small (a few hours at most)

Projects

Development

Successfully merging this pull request may close these issues.

2 participants