Rename internal HMAC structure type to match convention
Typedef'ed structures are suffixed _t Also updated the initialiser macro with content that actually matches the structure's content. Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
4fdf060a81
commit
d1955af5df
5 changed files with 24 additions and 24 deletions
|
@ -52,9 +52,9 @@ typedef struct
|
||||||
struct psa_hash_operation_s hash_ctx;
|
struct psa_hash_operation_s hash_ctx;
|
||||||
/** The HMAC part of the context. */
|
/** The HMAC part of the context. */
|
||||||
uint8_t opad[PSA_HMAC_MAX_HASH_BLOCK_SIZE];
|
uint8_t opad[PSA_HMAC_MAX_HASH_BLOCK_SIZE];
|
||||||
} psa_hmac_internal_data;
|
} psa_hmac_internal_data_t;
|
||||||
|
|
||||||
#define MBEDTLS_PSA_HMAC_OPERATION_INIT {0, {0}, {0}}
|
#define MBEDTLS_PSA_HMAC_OPERATION_INIT {0, PSA_HASH_OPERATION_INIT, {0}}
|
||||||
#endif /* PSA_WANT_ALG_HMAC */
|
#endif /* PSA_WANT_ALG_HMAC */
|
||||||
|
|
||||||
#include "mbedtls/cmac.h"
|
#include "mbedtls/cmac.h"
|
||||||
|
@ -73,7 +73,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
||||||
#if defined(PSA_WANT_ALG_HMAC)
|
#if defined(PSA_WANT_ALG_HMAC)
|
||||||
psa_hmac_internal_data hmac;
|
psa_hmac_internal_data_t hmac;
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_CMAC_C)
|
#if defined(MBEDTLS_CMAC_C)
|
||||||
mbedtls_cipher_context_t cmac;
|
mbedtls_cipher_context_t cmac;
|
||||||
|
|
|
@ -173,7 +173,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
uint8_t *info;
|
uint8_t *info;
|
||||||
size_t info_length;
|
size_t info_length;
|
||||||
psa_hmac_internal_data hmac;
|
psa_hmac_internal_data_t hmac;
|
||||||
uint8_t prk[PSA_HASH_MAX_SIZE];
|
uint8_t prk[PSA_HASH_MAX_SIZE];
|
||||||
uint8_t output_block[PSA_HASH_MAX_SIZE];
|
uint8_t output_block[PSA_HASH_MAX_SIZE];
|
||||||
#if PSA_HASH_MAX_SIZE > 0xff
|
#if PSA_HASH_MAX_SIZE > 0xff
|
||||||
|
@ -215,7 +215,7 @@ typedef struct psa_tls12_prf_key_derivation_s
|
||||||
size_t seed_length;
|
size_t seed_length;
|
||||||
uint8_t *label;
|
uint8_t *label;
|
||||||
size_t label_length;
|
size_t label_length;
|
||||||
psa_hmac_internal_data hmac;
|
psa_hmac_internal_data_t hmac;
|
||||||
uint8_t Ai[PSA_HASH_MAX_SIZE];
|
uint8_t Ai[PSA_HASH_MAX_SIZE];
|
||||||
|
|
||||||
/* `HMAC_hash( prk, A(i) + seed )` in the notation of RFC 5246, Sect. 5. */
|
/* `HMAC_hash( prk, A(i) + seed )` in the notation of RFC 5246, Sect. 5. */
|
||||||
|
|
|
@ -3365,7 +3365,7 @@ static psa_status_t psa_key_derivation_tls12_prf_generate_next_block(
|
||||||
{
|
{
|
||||||
psa_algorithm_t hash_alg = PSA_ALG_HKDF_GET_HASH( alg );
|
psa_algorithm_t hash_alg = PSA_ALG_HKDF_GET_HASH( alg );
|
||||||
uint8_t hash_length = PSA_HASH_LENGTH( hash_alg );
|
uint8_t hash_length = PSA_HASH_LENGTH( hash_alg );
|
||||||
psa_hmac_internal_data backup = MBEDTLS_PSA_HMAC_OPERATION_INIT;
|
psa_hmac_internal_data_t backup = MBEDTLS_PSA_HMAC_OPERATION_INIT;
|
||||||
psa_status_t status, cleanup_status;
|
psa_status_t status, cleanup_status;
|
||||||
|
|
||||||
/* We can't be wanting more output after block 0xff, otherwise
|
/* We can't be wanting more output after block 0xff, otherwise
|
||||||
|
|
|
@ -69,13 +69,13 @@ static size_t psa_get_hash_block_size( psa_algorithm_t alg )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t psa_hmac_abort_internal( psa_hmac_internal_data *hmac )
|
psa_status_t psa_hmac_abort_internal( psa_hmac_internal_data_t *hmac )
|
||||||
{
|
{
|
||||||
mbedtls_platform_zeroize( hmac->opad, sizeof( hmac->opad ) );
|
mbedtls_platform_zeroize( hmac->opad, sizeof( hmac->opad ) );
|
||||||
return( psa_hash_abort( &hmac->hash_ctx ) );
|
return( psa_hash_abort( &hmac->hash_ctx ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t psa_hmac_setup_internal( psa_hmac_internal_data *hmac,
|
psa_status_t psa_hmac_setup_internal( psa_hmac_internal_data_t *hmac,
|
||||||
const uint8_t *key,
|
const uint8_t *key,
|
||||||
size_t key_length,
|
size_t key_length,
|
||||||
psa_algorithm_t hash_alg )
|
psa_algorithm_t hash_alg )
|
||||||
|
@ -139,14 +139,14 @@ cleanup:
|
||||||
return( status );
|
return( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t psa_hmac_update_internal( psa_hmac_internal_data *hmac,
|
psa_status_t psa_hmac_update_internal( psa_hmac_internal_data_t *hmac,
|
||||||
const uint8_t *data,
|
const uint8_t *data,
|
||||||
size_t data_length )
|
size_t data_length )
|
||||||
{
|
{
|
||||||
return( psa_hash_update( &hmac->hash_ctx, data, data_length ) );
|
return( psa_hash_update( &hmac->hash_ctx, data, data_length ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t psa_hmac_finish_internal( psa_hmac_internal_data *hmac,
|
psa_status_t psa_hmac_finish_internal( psa_hmac_internal_data_t *hmac,
|
||||||
uint8_t *mac,
|
uint8_t *mac,
|
||||||
size_t mac_size )
|
size_t mac_size )
|
||||||
{
|
{
|
||||||
|
@ -184,8 +184,8 @@ exit:
|
||||||
return( status );
|
return( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t psa_hmac_clone_internal( const psa_hmac_internal_data *source,
|
psa_status_t psa_hmac_clone_internal( const psa_hmac_internal_data_t *source,
|
||||||
psa_hmac_internal_data *destination )
|
psa_hmac_internal_data_t *destination )
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
* \return Any error code reported by psa_hash_compute(), psa_hash_setup() or
|
* \return Any error code reported by psa_hash_compute(), psa_hash_setup() or
|
||||||
* psa_hash_update().
|
* psa_hash_update().
|
||||||
*/
|
*/
|
||||||
psa_status_t psa_hmac_setup_internal( psa_hmac_internal_data *hmac,
|
psa_status_t psa_hmac_setup_internal( psa_hmac_internal_data_t *hmac,
|
||||||
const uint8_t *key,
|
const uint8_t *key,
|
||||||
size_t key_length,
|
size_t key_length,
|
||||||
psa_algorithm_t hash_alg );
|
psa_algorithm_t hash_alg );
|
||||||
|
@ -59,7 +59,7 @@ psa_status_t psa_hmac_setup_internal( psa_hmac_internal_data *hmac,
|
||||||
* Success.
|
* Success.
|
||||||
* \return Any error code reported by psa_hash_update().
|
* \return Any error code reported by psa_hash_update().
|
||||||
*/
|
*/
|
||||||
psa_status_t psa_hmac_update_internal( psa_hmac_internal_data *hmac,
|
psa_status_t psa_hmac_update_internal( psa_hmac_internal_data_t *hmac,
|
||||||
const uint8_t *data,
|
const uint8_t *data,
|
||||||
size_t data_length );
|
size_t data_length );
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ psa_status_t psa_hmac_update_internal( psa_hmac_internal_data *hmac,
|
||||||
* \return Any error code reported by psa_hash_setup(), psa_hash_update() or
|
* \return Any error code reported by psa_hash_setup(), psa_hash_update() or
|
||||||
* psa_hash_finish().
|
* psa_hash_finish().
|
||||||
*/
|
*/
|
||||||
psa_status_t psa_hmac_finish_internal( psa_hmac_internal_data *hmac,
|
psa_status_t psa_hmac_finish_internal( psa_hmac_internal_data_t *hmac,
|
||||||
uint8_t *mac,
|
uint8_t *mac,
|
||||||
size_t mac_size );
|
size_t mac_size );
|
||||||
|
|
||||||
|
@ -96,8 +96,8 @@ psa_status_t psa_hmac_finish_internal( psa_hmac_internal_data *hmac,
|
||||||
* Success.
|
* Success.
|
||||||
* \return Any error code reported by psa_hash_clone().
|
* \return Any error code reported by psa_hash_clone().
|
||||||
*/
|
*/
|
||||||
psa_status_t psa_hmac_clone_internal( const psa_hmac_internal_data *source,
|
psa_status_t psa_hmac_clone_internal( const psa_hmac_internal_data_t *source,
|
||||||
psa_hmac_internal_data *destination );
|
psa_hmac_internal_data_t *destination );
|
||||||
|
|
||||||
/** Internal API for aborting an HMAC operation, using PSA hash primitives.
|
/** Internal API for aborting an HMAC operation, using PSA hash primitives.
|
||||||
*
|
*
|
||||||
|
@ -110,7 +110,7 @@ psa_status_t psa_hmac_clone_internal( const psa_hmac_internal_data *source,
|
||||||
* Success.
|
* Success.
|
||||||
* \return Any error code reported by psa_hash_abort().
|
* \return Any error code reported by psa_hash_abort().
|
||||||
*/
|
*/
|
||||||
psa_status_t psa_hmac_abort_internal( psa_hmac_internal_data *hmac );
|
psa_status_t psa_hmac_abort_internal( psa_hmac_internal_data_t *hmac );
|
||||||
|
|
||||||
/** Calculate the MAC (message authentication code) of a message using Mbed TLS.
|
/** Calculate the MAC (message authentication code) of a message using Mbed TLS.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue