Skip to content

Commit b1eaed7

Browse files
Support key agreement
Key agreement algorithms were excluded back when they were constructed with a macro conveying the key agreement itself taking the KDF as an argument, because that was hard to support. Now the encoding has changed and key agreement algorithms are constructed with PSA_ALG_KEY_AGREEMENT taking two arguments, one that identifies the raw key agreement and one that identifies the KDF. This is easy to process, so add support.
1 parent 3f382e2 commit b1eaed7

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tests/scripts/test_psa_constant_names.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,6 @@ def _argument_split(cls, arguments):
186186
# Auxiliary macro whose name doesn't fit the usual patterns for
187187
# auxiliary macros.
188188
'PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH_CASE',
189-
# PSA_ALG_ECDH and PSA_ALG_FFDH are excluded for now as the script
190-
# currently doesn't support them.
191-
'PSA_ALG_ECDH',
192-
'PSA_ALG_FFDH',
193189
# Deprecated aliases.
194190
'PSA_ERROR_UNKNOWN_ERROR',
195191
'PSA_ERROR_OCCUPIED_SLOT',
@@ -237,17 +233,20 @@ def add_test_case_line(self, function, argument):
237233
"""Parse a test case data line, looking for algorithm metadata tests."""
238234
sets = []
239235
if function.endswith('_algorithm'):
240-
# As above, ECDH and FFDH algorithms are excluded for now.
241-
# Support for them will be added in the future.
242-
if 'ECDH' in argument or 'FFDH' in argument:
243-
return
244236
sets.append(self.algorithms)
245237
if function == 'hash_algorithm':
246238
sets.append(self.hash_algorithms)
247239
elif function in ['mac_algorithm', 'hmac_algorithm']:
248240
sets.append(self.mac_algorithms)
249241
elif function == 'aead_algorithm':
250242
sets.append(self.aead_algorithms)
243+
elif function == 'key_derivation_algorithm':
244+
sets.append(self.kdf_algorithms)
245+
elif function == 'key_agreement_algorithm':
246+
# We only want *raw* key agreement algorithms here, so
247+
# exclude ones that are already chained with a KDF.
248+
if not argument.startswith('PSA_ALG_KEY_AGREEMENT('):
249+
sets.append(self.ka_algorithms)
251250
elif function == 'key_type':
252251
sets.append(self.key_types)
253252
elif function == 'ecc_key_types':

0 commit comments

Comments
 (0)