mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-24 13:01:13 +00:00
Remove unused items from MAC operation context structure
Apparently it was at some point assumed that there would be support for MAC algorithms with IV, but that hasn't been implemented yet. Until that time, these context structure members are superfluous and can be removed. Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
2d9a3f946e
commit
5c85ef0a56
|
@ -63,12 +63,9 @@ typedef struct
|
||||||
{
|
{
|
||||||
psa_algorithm_t alg;
|
psa_algorithm_t alg;
|
||||||
unsigned int key_set : 1;
|
unsigned int key_set : 1;
|
||||||
unsigned int iv_required : 1;
|
|
||||||
unsigned int iv_set : 1;
|
|
||||||
unsigned int has_input : 1;
|
unsigned int has_input : 1;
|
||||||
unsigned int is_sign : 1;
|
unsigned int is_sign : 1;
|
||||||
uint8_t mac_size;
|
uint8_t mac_size;
|
||||||
unsigned int id;
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
unsigned dummy; /* Make the union non-empty even with no supported algorithms. */
|
||||||
|
@ -81,7 +78,7 @@ typedef struct
|
||||||
} ctx;
|
} ctx;
|
||||||
} mbedtls_psa_mac_operation_t;
|
} mbedtls_psa_mac_operation_t;
|
||||||
|
|
||||||
#define MBEDTLS_PSA_MAC_OPERATION_INIT {0, 0, 0, 0, 0, 0, 0, 0, {0}}
|
#define MBEDTLS_PSA_MAC_OPERATION_INIT {0, 0, 0, 0, 0, {0}}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BEYOND THIS POINT, TEST DRIVER DECLARATIONS ONLY.
|
* BEYOND THIS POINT, TEST DRIVER DECLARATIONS ONLY.
|
||||||
|
|
|
@ -247,15 +247,12 @@ static psa_status_t mac_init(
|
||||||
|
|
||||||
operation->alg = PSA_ALG_FULL_LENGTH_MAC( alg );
|
operation->alg = PSA_ALG_FULL_LENGTH_MAC( alg );
|
||||||
operation->key_set = 0;
|
operation->key_set = 0;
|
||||||
operation->iv_set = 0;
|
|
||||||
operation->iv_required = 0;
|
|
||||||
operation->has_input = 0;
|
operation->has_input = 0;
|
||||||
operation->is_sign = 0;
|
operation->is_sign = 0;
|
||||||
|
|
||||||
#if defined(BUILTIN_ALG_CMAC)
|
#if defined(BUILTIN_ALG_CMAC)
|
||||||
if( operation->alg == PSA_ALG_CMAC )
|
if( operation->alg == PSA_ALG_CMAC )
|
||||||
{
|
{
|
||||||
operation->iv_required = 0;
|
|
||||||
mbedtls_cipher_init( &operation->ctx.cmac );
|
mbedtls_cipher_init( &operation->ctx.cmac );
|
||||||
status = PSA_SUCCESS;
|
status = PSA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -312,8 +309,6 @@ static psa_status_t mac_abort( mbedtls_psa_mac_operation_t *operation )
|
||||||
|
|
||||||
operation->alg = 0;
|
operation->alg = 0;
|
||||||
operation->key_set = 0;
|
operation->key_set = 0;
|
||||||
operation->iv_set = 0;
|
|
||||||
operation->iv_required = 0;
|
|
||||||
operation->has_input = 0;
|
operation->has_input = 0;
|
||||||
operation->is_sign = 0;
|
operation->is_sign = 0;
|
||||||
|
|
||||||
|
@ -452,8 +447,6 @@ static psa_status_t mac_update(
|
||||||
{
|
{
|
||||||
if( ! operation->key_set )
|
if( ! operation->key_set )
|
||||||
return( PSA_ERROR_BAD_STATE );
|
return( PSA_ERROR_BAD_STATE );
|
||||||
if( operation->iv_required && ! operation->iv_set )
|
|
||||||
return( PSA_ERROR_BAD_STATE );
|
|
||||||
operation->has_input = 1;
|
operation->has_input = 1;
|
||||||
|
|
||||||
#if defined(BUILTIN_ALG_CMAC)
|
#if defined(BUILTIN_ALG_CMAC)
|
||||||
|
@ -486,8 +479,6 @@ static psa_status_t mac_finish_internal( mbedtls_psa_mac_operation_t *operation,
|
||||||
{
|
{
|
||||||
if( ! operation->key_set )
|
if( ! operation->key_set )
|
||||||
return( PSA_ERROR_BAD_STATE );
|
return( PSA_ERROR_BAD_STATE );
|
||||||
if( operation->iv_required && ! operation->iv_set )
|
|
||||||
return( PSA_ERROR_BAD_STATE );
|
|
||||||
|
|
||||||
if( mac_size < operation->mac_size )
|
if( mac_size < operation->mac_size )
|
||||||
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
return( PSA_ERROR_BUFFER_TOO_SMALL );
|
||||||
|
|
Loading…
Reference in a new issue