Use PSA definitions in PSA file

This file will always be used with the PSA configurations, so use the
MBEDTLS_PSA_BUILTIN... definitions for the symmetric cyphers.

Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2021-01-26 11:39:16 -07:00
parent bc1731b24e
commit e04acc271c

View File

@ -495,25 +495,25 @@ static psa_status_t validate_unstructured_key_bit_size( psa_key_type_t type,
case PSA_KEY_TYPE_HMAC: case PSA_KEY_TYPE_HMAC:
case PSA_KEY_TYPE_DERIVE: case PSA_KEY_TYPE_DERIVE:
break; break;
#if defined(MBEDTLS_AES_C) #if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_AES)
case PSA_KEY_TYPE_AES: case PSA_KEY_TYPE_AES:
if( bits != 128 && bits != 192 && bits != 256 ) if( bits != 128 && bits != 192 && bits != 256 )
return( PSA_ERROR_INVALID_ARGUMENT ); return( PSA_ERROR_INVALID_ARGUMENT );
break; break;
#endif #endif
#if defined(MBEDTLS_CAMELLIA_C) #if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_CAMELLIA)
case PSA_KEY_TYPE_CAMELLIA: case PSA_KEY_TYPE_CAMELLIA:
if( bits != 128 && bits != 192 && bits != 256 ) if( bits != 128 && bits != 192 && bits != 256 )
return( PSA_ERROR_INVALID_ARGUMENT ); return( PSA_ERROR_INVALID_ARGUMENT );
break; break;
#endif #endif
#if defined(MBEDTLS_DES_C) #if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES)
case PSA_KEY_TYPE_DES: case PSA_KEY_TYPE_DES:
if( bits != 64 && bits != 128 && bits != 192 ) if( bits != 64 && bits != 128 && bits != 192 )
return( PSA_ERROR_INVALID_ARGUMENT ); return( PSA_ERROR_INVALID_ARGUMENT );
break; break;
#endif #endif
#if defined(MBEDTLS_ARC4_C) #if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ARC4)
case PSA_KEY_TYPE_ARC4: case PSA_KEY_TYPE_ARC4:
if( bits < 8 || bits > 2048 ) if( bits < 8 || bits > 2048 )
return( PSA_ERROR_INVALID_ARGUMENT ); return( PSA_ERROR_INVALID_ARGUMENT );