mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-06 12:40:02 +00:00
FIx name of macro
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
This commit is contained in:
parent
b3042c39fe
commit
3fde8feaa9
@ -277,7 +277,7 @@
|
|||||||
#define PSA_VENDOR_PBKDF2_MAX_ITERATIONS 0xffffffff
|
#define PSA_VENDOR_PBKDF2_MAX_ITERATIONS 0xffffffff
|
||||||
|
|
||||||
/* Output size of AES_CMAC_PRF_128 algorithm */
|
/* Output size of AES_CMAC_PRF_128 algorithm */
|
||||||
#define AES_CMAC_PRF_128_OUTPUT_SIZE 16
|
#define PSA_AES_CMAC_PRF_128_OUTPUT_SIZE 16
|
||||||
|
|
||||||
/** The maximum size of a block cipher. */
|
/** The maximum size of a block cipher. */
|
||||||
#define PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE 16
|
#define PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE 16
|
||||||
|
@ -5616,8 +5616,10 @@ static psa_status_t psa_key_derivation_pbkdf2_read(
|
|||||||
psa_set_key_type(&attributes, PSA_KEY_TYPE_HMAC);
|
psa_set_key_type(&attributes, PSA_KEY_TYPE_HMAC);
|
||||||
} else if (kdf_alg == PSA_ALG_PBKDF2_AES_CMAC_PRF_128) {
|
} else if (kdf_alg == PSA_ALG_PBKDF2_AES_CMAC_PRF_128) {
|
||||||
prf_alg = PSA_ALG_CMAC;
|
prf_alg = PSA_ALG_CMAC;
|
||||||
prf_output_length = AES_CMAC_PRF_128_OUTPUT_SIZE;
|
prf_output_length = PSA_AES_CMAC_PRF_128_OUTPUT_SIZE;
|
||||||
psa_set_key_type(&attributes, PSA_KEY_TYPE_AES);
|
psa_set_key_type(&attributes, PSA_KEY_TYPE_AES);
|
||||||
|
} else {
|
||||||
|
return PSA_ERROR_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (pbkdf2->state) {
|
switch (pbkdf2->state) {
|
||||||
@ -6184,7 +6186,7 @@ static psa_status_t psa_key_derivation_setup_kdf(
|
|||||||
if (kdf_alg == PSA_ALG_TLS12_ECJPAKE_TO_PMS) {
|
if (kdf_alg == PSA_ALG_TLS12_ECJPAKE_TO_PMS) {
|
||||||
hash_size = PSA_HASH_LENGTH(PSA_ALG_SHA_256);
|
hash_size = PSA_HASH_LENGTH(PSA_ALG_SHA_256);
|
||||||
} else if (kdf_alg == PSA_ALG_PBKDF2_AES_CMAC_PRF_128) {
|
} else if (kdf_alg == PSA_ALG_PBKDF2_AES_CMAC_PRF_128) {
|
||||||
hash_size = AES_CMAC_PRF_128_OUTPUT_SIZE;
|
hash_size = PSA_AES_CMAC_PRF_128_OUTPUT_SIZE;
|
||||||
} else {
|
} else {
|
||||||
if (hash_size == 0) {
|
if (hash_size == 0) {
|
||||||
return PSA_ERROR_NOT_SUPPORTED;
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
@ -6738,23 +6740,23 @@ static psa_status_t psa_pbkdf2_cmac_set_password(const uint8_t *input,
|
|||||||
size_t *output_len)
|
size_t *output_len)
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_SUCCESS;
|
psa_status_t status = PSA_SUCCESS;
|
||||||
if (input_len != AES_CMAC_PRF_128_OUTPUT_SIZE) {
|
if (input_len != PSA_AES_CMAC_PRF_128_OUTPUT_SIZE) {
|
||||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||||
uint8_t zeros[16] = {0};
|
uint8_t zeros[16] = { 0 };
|
||||||
psa_set_key_type(&attributes, PSA_KEY_TYPE_AES);
|
psa_set_key_type(&attributes, PSA_KEY_TYPE_AES);
|
||||||
psa_set_key_bits(&attributes, PSA_BYTES_TO_BITS(sizeof(zeros)));
|
psa_set_key_bits(&attributes, PSA_BYTES_TO_BITS(sizeof(zeros)));
|
||||||
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_MESSAGE);
|
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_MESSAGE);
|
||||||
/* Passing AES_CMAC_PRF_128_OUTPUT_SIZE as mac_size as the driver
|
/* Passing PSA_AES_CMAC_PRF_128_OUTPUT_SIZE as mac_size as the driver
|
||||||
* function sets mac_output_length = mac_size on success. See #7801*/
|
* function sets mac_output_length = mac_size on success. See #7801*/
|
||||||
status = psa_driver_wrapper_mac_compute(&attributes,
|
status = psa_driver_wrapper_mac_compute(&attributes,
|
||||||
zeros, sizeof(zeros),
|
zeros, sizeof(zeros),
|
||||||
PSA_ALG_CMAC, input, input_len,
|
PSA_ALG_CMAC, input, input_len,
|
||||||
output,
|
output,
|
||||||
AES_CMAC_PRF_128_OUTPUT_SIZE,
|
PSA_AES_CMAC_PRF_128_OUTPUT_SIZE,
|
||||||
output_len);
|
output_len);
|
||||||
} else {
|
} else {
|
||||||
memcpy(output, input, input_len);
|
memcpy(output, input, input_len);
|
||||||
*output_len = AES_CMAC_PRF_128_OUTPUT_SIZE;
|
*output_len = PSA_AES_CMAC_PRF_128_OUTPUT_SIZE;
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user