18 #ifndef TI_PSA_CRYPTO_HELPER_H 19 #define TI_PSA_CRYPTO_HELPER_H 24 #include <ti/devices/DeviceFamily.h> 25 #if ((TFM_ENABLED == 1) && !defined(TFM_BUILD)) 26 #include <third_party/tfm/interface/include/psa/crypto.h> 28 #include <third_party/mbedtls/include/psa/crypto.h> 33 #if ((DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC35XX)) 40 #if (TI_SW_CRYPTO_ENABLED == 1) 41 #include <third_party/mbedtls/library/psa_crypto_core.h> 42 #include <third_party/mbedtls/include/psa/build_info.h> 49 #define PSA_CRYPTO_TI_DRIVER_ID 1 50 #define PSA_CRYPTO_MBED_TLS_DRIVER_ID 2 54 #if (TI_SW_CRYPTO_ENABLED == 1) 55 #include <third_party/mbedtls/library/psa_crypto_core.h> 56 #include <third_party/mbedtls/include/psa/build_info.h> 63 #define PSA_CRYPTO_TI_DRIVER_ID 1 64 #define PSA_CRYPTO_MBED_TLS_DRIVER_ID 2 78 psa_key_id_t
toKeyID(mbedtls_svc_key_id_t keystoreKeyID);
81 #if ((DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC35XX)) 118 #if (TI_SW_CRYPTO_ENABLED == 1) 119 #if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS) 132 #define LOCAL_INPUT_DECLARE(input, input_copy_name) \ 133 psa_crypto_local_input_t LOCAL_INPUT_COPY_OF_##input = PSA_CRYPTO_LOCAL_INPUT_INIT; \ 134 const uint8_t *input_copy_name = NULL; 145 #define LOCAL_INPUT_ALLOC(input, length, input_copy) \ 146 status = psa_crypto_local_input_alloc(input, length, &LOCAL_INPUT_COPY_OF_##input); \ 147 if (status != PSA_SUCCESS) \ 151 input_copy = LOCAL_INPUT_COPY_OF_##input.buffer; 159 #define LOCAL_INPUT_FREE(input, input_copy) \ 161 psa_crypto_local_input_free(&LOCAL_INPUT_COPY_OF_##input); 174 #define LOCAL_OUTPUT_DECLARE(output, output_copy_name) \ 175 psa_crypto_local_output_t LOCAL_OUTPUT_COPY_OF_##output = PSA_CRYPTO_LOCAL_OUTPUT_INIT; \ 176 uint8_t *output_copy_name = NULL; 187 #define LOCAL_OUTPUT_ALLOC(output, length, output_copy) \ 188 status = psa_crypto_local_output_alloc(output, length, &LOCAL_OUTPUT_COPY_OF_##output); \ 189 if (status != PSA_SUCCESS) \ 193 output_copy = LOCAL_OUTPUT_COPY_OF_##output.buffer; 203 #define LOCAL_OUTPUT_FREE(output, output_copy) \ 204 output_copy = NULL; \ 207 psa_status_t local_output_status; \ 208 local_output_status = psa_crypto_local_output_free(&LOCAL_OUTPUT_COPY_OF_##output); \ 209 if (local_output_status != PSA_SUCCESS) \ 214 status = local_output_status; \ 218 #define LOCAL_INPUT_DECLARE(input, input_copy_name) const uint8_t *input_copy_name = NULL; 219 #define LOCAL_INPUT_ALLOC(input, length, input_copy) input_copy = input; 220 #define LOCAL_INPUT_FREE(input, input_copy) input_copy = NULL; 221 #define LOCAL_OUTPUT_DECLARE(output, output_copy_name) uint8_t *output_copy_name = NULL; 222 #define LOCAL_OUTPUT_ALLOC(output, length, output_copy) output_copy = output; 223 #define LOCAL_OUTPUT_FREE(output, output_copy) output_copy = NULL; TI Driver for Elliptic Curve Digital Signature Algorithm.
ECDSA_CurveType
Enum for the curve types supported by the driver.
Definition: ECDSA.h:644
ECDH_CurveType map_keyTypeToECDHCurveTypeHSM(psa_key_type_t keyType, size_t keyBits)
ECDH_CurveType
Enum for the curve types supported by the driver.
Definition: ECDH.h:602
psa_key_id_t toKeyID(mbedtls_svc_key_id_t keystoreKeyID)
void setAeadOperationID(psa_aead_operation_t *operation, unsigned int id)
psa_status_t map_EDDSA_status(int_fast16_t status, bool isVerifyOp)
psa_status_t map_ECDSA_status(int_fast16_t status, bool isVerifyOp)
void setCipherOperationID(psa_cipher_operation_t *operation, unsigned int id)
psa_status_t map_AES_status(int_fast16_t status)
bool isHardwareMacOperation(const psa_mac_operation_t *operation)
bool isHardwareHashOperation(const psa_hash_operation_t *operation)
bool isHardwareAccelerated(psa_algorithm_t alg)
TI Driver for Elliptic Curve Diffie-Hellman key agreement scheme.
bool isHardwareCipherOperation(const psa_cipher_operation_t *operation)
const ECCParams_CurveParams * map_keyTypeToECCParams(psa_key_type_t keyType, size_t keyBits)
bool isHardwareKeyDerivationOperation(const psa_key_derivation_operation_t *operation)
void setHashOperationID(psa_hash_operation_t *operation, unsigned int id)
void setMacOperationID(psa_mac_operation_t *operation, unsigned int id)
psa_status_t map_RNG_status(int_fast16_t status)
void setKeyDerivationOperationID(psa_key_derivation_operation_t *operation, unsigned int id)
A structure containing the parameters of an elliptic curve.
Definition: ECCParams.h:145
psa_status_t map_TRNG_status(int_fast16_t status)
ECDSA_CurveType map_keyTypeToECDSACurveTypeHSM(psa_key_type_t keyType, size_t keyBits)
mbedtls_svc_key_id_t toKeyStoreKeyID(psa_key_id_t keyID)
psa_algorithm_t alg
Definition: ti_psa_crypto_hash.h:73
psa_status_t map_SHA2_status(int_fast16_t status)
psa_status_t map_ECDH_status(int_fast16_t status)
bool isHardwareAeadOperation(const psa_aead_operation_t *operation)