psa: Add backwards compatible error codes
Add deprecated error codes to help transition between the previous version of the PSA Crypto specification and the current one.
This commit is contained in:
parent
1ac5e6a34c
commit
5e6d24c5e1
@ -37,6 +37,29 @@ extern "C" {
|
||||
/* UID for secure storage seed */
|
||||
#define PSA_CRYPTO_ITS_RANDOM_SEED_UID 0xFFFFFF52
|
||||
|
||||
/*
|
||||
* Deprecated PSA Crypto error code definitions
|
||||
*/
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define PSA_ERROR_UNKNOWN_ERROR \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_GENERIC_ERROR )
|
||||
#endif
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define PSA_ERROR_OCCUPIED_SLOT \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_ALREADY_EXISTS )
|
||||
#endif
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define PSA_ERROR_EMPTY_SLOT \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_DOES_NOT_EXIST )
|
||||
#endif
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define PSA_ERROR_INSUFFICIENT_CAPACITY \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_INSUFFICIENT_DATA )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Library deinitialization.
|
||||
*
|
||||
|
@ -167,6 +167,16 @@ class MacroCollector:
|
||||
return
|
||||
elif (name.startswith('PSA_ERROR_') or name == 'PSA_SUCCESS') \
|
||||
and not parameter:
|
||||
if name in [
|
||||
'PSA_ERROR_UNKNOWN_ERROR',
|
||||
'PSA_ERROR_OCCUPIED_SLOT',
|
||||
'PSA_ERROR_EMPTY_SLOT',
|
||||
'PSA_ERROR_INSUFFICIENT_CAPACITY',
|
||||
]:
|
||||
# Ad hoc skipping of deprecated error codes, which share
|
||||
# numerical values with non-deprecated error codes
|
||||
return
|
||||
|
||||
self.statuses.add(name)
|
||||
elif name.startswith('PSA_KEY_TYPE_') and not parameter:
|
||||
self.key_types.add(name)
|
||||
|
@ -131,11 +131,16 @@ where each argument takes each possible value at least once.'''
|
||||
excluded_name_re = re.compile('_(?:GET|IS|OF)_|_(?:BASE|FLAG|MASK)\Z')
|
||||
# Additional excluded macros.
|
||||
# PSA_ALG_ECDH and PSA_ALG_FFDH are excluded for now as the script
|
||||
# currently doesn't support them.
|
||||
# currently doesn't support them. Deprecated errors are also excluded.
|
||||
excluded_names = set(['PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH',
|
||||
'PSA_ALG_FULL_LENGTH_MAC',
|
||||
'PSA_ALG_ECDH',
|
||||
'PSA_ALG_FFDH'])
|
||||
'PSA_ALG_FFDH',
|
||||
'PSA_ERROR_UNKNOWN_ERROR',
|
||||
'PSA_ERROR_OCCUPIED_SLOT',
|
||||
'PSA_ERROR_EMPTY_SLOT',
|
||||
'PSA_ERROR_INSUFFICIENT_CAPACITY',
|
||||
])
|
||||
argument_split_re = re.compile(r' *, *')
|
||||
def parse_header_line(self, line):
|
||||
'''Parse a C header line, looking for "#define PSA_xxx".'''
|
||||
|
Loading…
Reference in New Issue
Block a user