diff --git a/tf-psa-crypto/core/psa_crypto_driver_wrappers.h b/tf-psa-crypto/core/psa_crypto_driver_wrappers.h index 1999a8a60b..955b181e5a 100644 --- a/tf-psa-crypto/core/psa_crypto_driver_wrappers.h +++ b/tf-psa-crypto/core/psa_crypto_driver_wrappers.h @@ -90,9 +90,9 @@ #endif -/* Headers for atca_ecdsa opaque driver */ -#if defined(ATCA_ECDSA_DRIVER_ENABLED) -#include "../../../port/psa_driver/include/psa_crypto_driver_atca_ecdsa.h" +/* Headers for secure element opaque driver */ +#if defined(SECURE_ELEMENT_DRIVER_ENABLED) +#include "../../../port/psa_driver/include/psa_crypto_driver_secure_element.h" #endif /* END-driver headers */ @@ -113,7 +113,7 @@ #define ESP_CMAC_TRANSPARENT_DRIVER_ID (11) #define ESP_HMAC_TRANSPARENT_DRIVER_ID (12) #define ESP_HMAC_OPAQUE_DRIVER_ID (13) -#define ATCA_ECDSA_OPAQUE_DRIVER_ID (14) +#define SECURE_ELEMENT_OPAQUE_DRIVER_ID (14) /* END-driver id */ @@ -404,15 +404,15 @@ static inline psa_status_t psa_driver_wrapper_sign_hash( } return PSA_ERROR_INVALID_ARGUMENT; #endif /* ESP_RSA_DS_DRIVER_ENABLED */ -#if defined(ATCA_ECDSA_DRIVER_ENABLED) && defined(ATCA_ECDSA_SIGN_DRIVER_ENABLED) - case PSA_KEY_LOCATION_ATCA_ECDSA: - return( atca_ecdsa_opaque_sign_hash( +#if defined(SECURE_ELEMENT_DRIVER_ENABLED) + case PSA_KEY_LOCATION_SECURE_ELEMENT: + return( secure_element_opaque_sign_hash( attributes, key_buffer, key_buffer_size, alg, hash, hash_length, signature, signature_size, signature_length ) ); -#endif /* ATCA_ECDSA_DRIVER_ENABLED && ATCA_ECDSA_SIGN_DRIVER_ENABLED */ +#endif /* SECURE_ELEMENT_DRIVER_ENABLED */ #endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */ default: /* Key is declared with a lifetime not known to us */ @@ -487,8 +487,8 @@ static inline psa_status_t psa_driver_wrapper_verify_hash( return( status ); } #endif /* MBEDTLS_PSA_P256M_DRIVER_ENABLED */ -#if defined(ATCA_ECDSA_DRIVER_ENABLED) && defined(ATCA_ECDSA_VERIFY_DRIVER_ENABLED) - status = atca_ecdsa_transparent_verify_hash( +#if defined(SECURE_ELEMENT_DRIVER_ENABLED) + status = secure_element_transparent_verify_hash( attributes, key_buffer, key_buffer_size, @@ -499,7 +499,7 @@ static inline psa_status_t psa_driver_wrapper_verify_hash( signature_length ); if( status != PSA_ERROR_NOT_SUPPORTED ) return( status ); -#endif /* ATCA_ECDSA_DRIVER_ENABLED && ATCA_ECDSA_VERIFY_DRIVER_ENABLED */ +#endif /* SECURE_ELEMENT_DRIVER_ENABLED */ #endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */ return( psa_verify_hash_builtin( attributes, @@ -935,13 +935,13 @@ static inline psa_status_t psa_driver_wrapper_get_key_buffer_size_from_key_data( PSA_SUCCESS : PSA_ERROR_NOT_SUPPORTED ); #endif /* defined(ESP_HMAC_OPAQUE_DRIVER_ENABLED) */ -#if defined(ATCA_ECDSA_DRIVER_ENABLED) && defined(ATCA_ECDSA_SIGN_DRIVER_ENABLED) - case PSA_KEY_LOCATION_ATCA_ECDSA: - *key_buffer_size = atca_ecdsa_opaque_size_function( key_type, +#if defined(SECURE_ELEMENT_DRIVER_ENABLED) + case PSA_KEY_LOCATION_SECURE_ELEMENT: + *key_buffer_size = secure_element_opaque_size_function( key_type, PSA_BYTES_TO_BITS( data_length ) ); return( ( *key_buffer_size != 0 ) ? PSA_SUCCESS : PSA_ERROR_NOT_SUPPORTED ); -#endif /* ATCA_ECDSA_DRIVER_ENABLED && ATCA_ECDSA_SIGN_DRIVER_ENABLED */ +#endif /* SECURE_ELEMENT_DRIVER_ENABLED */ default: (void)key_type; @@ -1141,14 +1141,14 @@ static inline psa_status_t psa_driver_wrapper_import_key( )); #endif /* ESP_RSA_DS_DRIVER_ENABLED */ -#if defined(ATCA_ECDSA_DRIVER_ENABLED) && defined(ATCA_ECDSA_SIGN_DRIVER_ENABLED) - case PSA_KEY_LOCATION_ATCA_ECDSA: - return( atca_ecdsa_opaque_import_key( +#if defined(SECURE_ELEMENT_DRIVER_ENABLED) + case PSA_KEY_LOCATION_SECURE_ELEMENT: + return( secure_element_opaque_import_key( attributes, data, data_length, key_buffer, key_buffer_size, key_buffer_length, bits ) ); -#endif /* ATCA_ECDSA_DRIVER_ENABLED && ATCA_ECDSA_SIGN_DRIVER_ENABLED */ +#endif /* SECURE_ELEMENT_DRIVER_ENABLED */ #endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */ default: (void)status; diff --git a/tf-psa-crypto/core/psa_crypto_driver_wrappers_no_static.c b/tf-psa-crypto/core/psa_crypto_driver_wrappers_no_static.c index 71aff2c9b9..e4e20d5ce7 100644 --- a/tf-psa-crypto/core/psa_crypto_driver_wrappers_no_static.c +++ b/tf-psa-crypto/core/psa_crypto_driver_wrappers_no_static.c @@ -50,9 +50,9 @@ #endif -/* Headers for atca_ecdsa opaque driver */ -#if defined(ATCA_ECDSA_DRIVER_ENABLED) -#include "../../../port/psa_driver/include/psa_crypto_driver_atca_ecdsa.h" +/* Headers for secure element opaque driver */ +#if defined(SECURE_ELEMENT_DRIVER_ENABLED) +#include "../../../port/psa_driver/include/psa_crypto_driver_secure_element.h" #endif /* END-driver headers */ @@ -116,13 +116,13 @@ psa_status_t psa_driver_wrapper_get_key_buffer_size( PSA_SUCCESS : PSA_ERROR_NOT_SUPPORTED ); #endif /* PSA_CRYPTO_DRIVER_TEST */ -#if defined(ATCA_ECDSA_DRIVER_ENABLED) && defined(ATCA_ECDSA_SIGN_DRIVER_ENABLED) - case PSA_KEY_LOCATION_ATCA_ECDSA: - *key_buffer_size = atca_ecdsa_opaque_size_function( key_type, - key_bits ); +#if defined(SECURE_ELEMENT_DRIVER_ENABLED) + case PSA_KEY_LOCATION_SECURE_ELEMENT: + *key_buffer_size = secure_element_opaque_size_function( key_type, + key_bits ); return( ( *key_buffer_size != 0 ) ? PSA_SUCCESS : PSA_ERROR_NOT_SUPPORTED ); -#endif /* ATCA_ECDSA_DRIVER_ENABLED && ATCA_ECDSA_SIGN_DRIVER_ENABLED */ +#endif /* SECURE_ELEMENT_DRIVER_ENABLED */ default: (void)key_type; @@ -217,19 +217,13 @@ psa_status_t psa_driver_wrapper_export_public_key( } return PSA_ERROR_INVALID_ARGUMENT; #endif /* defined(ESP_ECDSA_DRIVER_ENABLED) && defined(ESP_ECDSA_SIGN_DRIVER_ENABLED) */ -#if defined(ATCA_ECDSA_DRIVER_ENABLED) && defined(ATCA_ECDSA_SIGN_DRIVER_ENABLED) - case PSA_KEY_LOCATION_ATCA_ECDSA: - if( PSA_KEY_TYPE_IS_ECC( psa_get_key_type(attributes) ) && - PSA_ALG_IS_ECDSA( psa_get_key_algorithm(attributes) ) && - PSA_KEY_TYPE_ECC_GET_FAMILY(psa_get_key_type(attributes)) == PSA_ECC_FAMILY_SECP_R1) - { - return( atca_ecdsa_opaque_export_public_key( - attributes, - key_buffer, key_buffer_size, - data, data_size, data_length ) ); - } - return PSA_ERROR_INVALID_ARGUMENT; -#endif /* ATCA_ECDSA_DRIVER_ENABLED && ATCA_ECDSA_SIGN_DRIVER_ENABLED */ +#if defined(SECURE_ELEMENT_DRIVER_ENABLED) + case PSA_KEY_LOCATION_SECURE_ELEMENT: + return( secure_element_opaque_export_public_key( + attributes, + key_buffer, key_buffer_size, + data, data_size, data_length ) ); +#endif /* SECURE_ELEMENT_DRIVER_ENABLED */ #endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */ default: /* Key is declared with a lifetime not known to us */