Test more truncated MAC and short AEAD tag lengths
The current macro collector only tried the minimum and maximum expressible lengths for PSA_ALG_TRUNCATED_MAC and PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG. This was good enough for psa_constant_names, but it's weak for exercising keys, in particular because it doesn't include any valid AEAD tag length. So cover more lengths. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
bbf452c689
commit
d78c59c0de
1 changed files with 20 additions and 4 deletions
|
@ -400,10 +400,26 @@ enumerate
|
|||
'other_algorithm': [],
|
||||
'lifetime': [self.lifetimes],
|
||||
} #type: Dict[str, List[Set[str]]]
|
||||
self.arguments_for['mac_length'] += ['1', '63']
|
||||
self.arguments_for['min_mac_length'] += ['1', '63']
|
||||
self.arguments_for['tag_length'] += ['1', '63']
|
||||
self.arguments_for['min_tag_length'] += ['1', '63']
|
||||
mac_lengths = [str(n) for n in [
|
||||
1, # minimum expressible
|
||||
4, # minimum allowed by policy
|
||||
13, # an odd size in a plausible range
|
||||
14, # an even non-power-of-two size in a plausible range
|
||||
16, # same as full size for at least one algorithm
|
||||
63, # maximum expressible
|
||||
]]
|
||||
self.arguments_for['mac_length'] += mac_lengths
|
||||
self.arguments_for['min_mac_length'] += mac_lengths
|
||||
aead_lengths = [str(n) for n in [
|
||||
1, # minimum expressible
|
||||
4, # minimum allowed by policy
|
||||
13, # an odd size in a plausible range
|
||||
14, # an even non-power-of-two size in a plausible range
|
||||
16, # same as full size for at least one algorithm
|
||||
63, # maximum expressible
|
||||
]]
|
||||
self.arguments_for['tag_length'] += aead_lengths
|
||||
self.arguments_for['min_tag_length'] += aead_lengths
|
||||
|
||||
def add_numerical_values(self) -> None:
|
||||
"""Add numerical values that are not supported to the known identifiers."""
|
||||
|
|
Loading…
Reference in a new issue