Fix KeyType with parameters passed in the name argument

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2021-04-12 13:41:52 +02:00
parent 3d404b8a10
commit 4d0b089d2a

View file

@ -33,7 +33,7 @@ class KeyType:
`name` is a string 'PSA_KEY_TYPE_xxx' which is the name of a PSA key `name` is a string 'PSA_KEY_TYPE_xxx' which is the name of a PSA key
type macro. For key types that take arguments, the arguments can type macro. For key types that take arguments, the arguments can
be passed either through the optional argument `params` or by be passed either through the optional argument `params` or by
passing an expression of the form 'PSA_KEY_TYPE_xxx(param1, param2)' passing an expression of the form 'PSA_KEY_TYPE_xxx(param1, ...)'
in `name` as a string. in `name` as a string.
""" """
@ -48,7 +48,7 @@ class KeyType:
m = re.match(r'(\w+)\s*\((.*)\)\Z', self.name) m = re.match(r'(\w+)\s*\((.*)\)\Z', self.name)
assert m is not None assert m is not None
self.name = m.group(1) self.name = m.group(1)
params = ','.split(m.group(2)) params = m.group(2).split(',')
self.params = (None if params is None else self.params = (None if params is None else
[param.strip() for param in params]) [param.strip() for param in params])
"""The parameters of the key type, if there are any. """The parameters of the key type, if there are any.