Read constant names from crypto_extra.h as well as crypto_values.h
test_psa_constant_names.py was originally written before the split of
crypto.h into crypto_values.h and more, so it now needs to read
crypto_values.h as well.
In both generate_psa_constants.py and test_psa_constant_names.py, read
crypto_extra.h as well. We don't currently define any value there, but
it's plausible that we will one day.
diff --git a/scripts/generate_psa_constants.py b/scripts/generate_psa_constants.py
index bcda282..f32339f 100755
--- a/scripts/generate_psa_constants.py
+++ b/scripts/generate_psa_constants.py
@@ -276,10 +276,11 @@
data['key_usage_code'] = self.make_key_usage_code()
output_file.write(output_template % data)
-def generate_psa_constants(header_file_name, output_file_name):
+def generate_psa_constants(header_file_names, output_file_name):
collector = MacroCollector()
- with open(header_file_name) as header_file:
- collector.read_file(header_file)
+ for header_file_name in header_file_names:
+ with open(header_file_name) as header_file:
+ collector.read_file(header_file)
temp_file_name = output_file_name + '.tmp'
with open(temp_file_name, 'w') as output_file:
collector.write_file(output_file)
@@ -288,5 +289,6 @@
if __name__ == '__main__':
if not os.path.isdir('programs') and os.path.isdir('../programs'):
os.chdir('..')
- generate_psa_constants('include/psa/crypto_values.h',
+ generate_psa_constants(['include/psa/crypto_values.h',
+ 'include/psa/crypto_extra.h'],
'programs/psa/psa_constant_names_generated.c')