check_names: Allow mldsa-native symbols to be undeclared

The mldsa-native and mlkem-native headers use preprocessor tricks to
construct identifiers. We can't recognize those. So f a symbol found in the
binary is in the expected sub-namespace for those parts of the library,
allow it to be undeclared.

Make the exception general enough for mldsa-native (needed now) and
mlkem-native (needed soon).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2026-01-15 19:25:53 +01:00
parent dd06b4989f
commit 0c94e7d164
+13
View File
@@ -1119,6 +1119,17 @@ class NameChecker():
self.log.info("PASS")
return 0
@staticmethod
def symbol_may_be_undeclared(symbol: str) -> bool:
"""Whether it's ok for the symbol not to be declared in any header."""
# The mldsa-native and mlkem-native headers use preprocessor tricks
# to construct identifiers. We can't recognize those. If a symbol
# found in the binary is in the expected sub-namespace for those
# parts of the library, allow it to be undeclared.
if symbol.startswith('tf_psa_crypto_pqcp_'):
return True
return False
def check_symbols_declared_in_header(self) -> int:
"""
Perform a check that all detected symbols in the library object files
@@ -1134,6 +1145,8 @@ class NameChecker():
self.parse_result.excluded_identifiers))
for symbol in self.parse_result.symbols:
if self.symbol_may_be_undeclared(symbol):
continue
if symbol not in all_identifiers:
problems.append(SymbolNotInHeader(symbol))