mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-23 11:42:31 +00:00
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
@ -400,10 +400,26 @@ enumerate
|
|||||||
'other_algorithm': [],
|
'other_algorithm': [],
|
||||||
'lifetime': [self.lifetimes],
|
'lifetime': [self.lifetimes],
|
||||||
} #type: Dict[str, List[Set[str]]]
|
} #type: Dict[str, List[Set[str]]]
|
||||||
self.arguments_for['mac_length'] += ['1', '63']
|
mac_lengths = [str(n) for n in [
|
||||||
self.arguments_for['min_mac_length'] += ['1', '63']
|
1, # minimum expressible
|
||||||
self.arguments_for['tag_length'] += ['1', '63']
|
4, # minimum allowed by policy
|
||||||
self.arguments_for['min_tag_length'] += ['1', '63']
|
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:
|
def add_numerical_values(self) -> None:
|
||||||
"""Add numerical values that are not supported to the known identifiers."""
|
"""Add numerical values that are not supported to the known identifiers."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user