Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/check-doxy-blocks.pl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
include/mbedtls
drivers/builtin/include/mbedtls
drivers/builtin/src core dispatch
dispatch/include/psa
doxygen/input extras platform utilities);

# very naive pattern to find directives:
Expand Down
5 changes: 3 additions & 2 deletions scripts/check_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ def __init__(self, log: logging.Logger) -> None:

H_PUBLIC = [
"include/**/*.h",
"dispatch/include/**/*.h",
"drivers/*/include/**/*.h",
]
H_PUBLIC_EXCLUDE = [
Expand Down Expand Up @@ -830,7 +831,7 @@ def comprehensive_parse(self) -> ParseResult:
self.H_PUBLIC_EXCLUDE + ["drivers/p256-m/p256-m/p256-m.h"])
mbed_psa_words = self.parse_mbed_psa_words(
self.H_PUBLIC + self.H_INTERNAL + self.C_INTERNAL,
self.H_PUBLIC_EXCLUDE + ["core/psa_crypto_driver_wrappers.h"])
self.H_PUBLIC_EXCLUDE)
symbols = self.parse_symbols()

return self._parse(all_macros, enum_consts, identifiers,
Expand Down Expand Up @@ -963,7 +964,7 @@ def comprehensive_parse(self) -> ParseResult:
"library/*.c",
"3rdparty/everest/library/everest.c",
"3rdparty/everest/library/x25519.c"
], ["library/psa_crypto_driver_wrappers.h"])
])
else:
all_macros = {"public": [], "internal": [], "private":[]}
all_macros["public"] = self.parse_macros([
Expand Down
8 changes: 6 additions & 2 deletions scripts/make_generated_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@
]

if build_tree.looks_like_tf_psa_crypto_root("."):
if (Path.cwd() / "dispatch" / "CMakeLists.txt").exists():
DISPATCH_PREFIX = Path("dispatch")
else:
DISPATCH_PREFIX = Path("core")
TF_PSA_CRYPTO_GENERATION_SCRIPTS = [
GenerationScript(
Path("scripts/generate_driver_wrappers.py"),
[Path("core/psa_crypto_driver_wrappers.h"),
Path("core/psa_crypto_driver_wrappers_no_static.c")],
[DISPATCH_PREFIX / "psa_crypto_driver_wrappers.h",
DISPATCH_PREFIX / "psa_crypto_driver_wrappers_no_static.c"],
"", None
),
GenerationScript(
Expand Down
2 changes: 2 additions & 0 deletions scripts/mbedtls_framework/psa_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ def update_cache(self) -> None:
if build_tree.looks_like_root('.'):
includes = ['include']
if build_tree.looks_like_tf_psa_crypto_root('.'):
includes.append('dispatch/include')
includes.append('drivers/builtin/include')
includes.append('drivers/everest/include')
includes.append('drivers/everest/include/tf-psa-crypto/private/')
includes.append('drivers/pqcp/include')
elif not build_tree.is_mbedtls_3_6():
includes.append('tf-psa-crypto/include')
includes.append('tf-psa-crypto/dispatch/include')
includes.append('tf-psa-crypto/drivers/builtin/include')
includes.append('tf-psa-crypto/drivers/everest/include')
includes.append('tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/')
Expand Down
1 change: 1 addition & 0 deletions scripts/test_psa_constant_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def main():
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.

'tf-psa-crypto/drivers/builtin/include',
'tf-psa-crypto/drivers/everest/include',
'tf-psa-crypto/drivers/everest/include/' +
Expand Down