mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-26 12:15:44 +00:00
Remove superfluous checking from MAC driver
The PSA core checks the key type and algorithm combination before calling the driver, so the driver doesn't have to do this once more. The PSA core will also not start an operation with a requested length which is larger than the full MAC output size, so the output length check in the driver isn't needed as long as the driver returns an error on mac_setup if it doesn't support the underlying hash algorithm. Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
15f0d92a48
commit
2a18f56b4e
|
@ -329,20 +329,6 @@ static psa_status_t mac_setup( mbedtls_psa_mac_operation_t *operation,
|
|||
#if defined(BUILTIN_ALG_HMAC)
|
||||
if( PSA_ALG_IS_HMAC( alg ) )
|
||||
{
|
||||
/* Sanity check. This shouldn't fail on a valid configuration. */
|
||||
if( PSA_MAC_LENGTH( psa_get_key_type( attributes ), 0, alg ) >
|
||||
sizeof( operation->ctx.hmac.opad ) )
|
||||
{
|
||||
status = PSA_ERROR_NOT_SUPPORTED;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if( psa_get_key_type( attributes ) != PSA_KEY_TYPE_HMAC )
|
||||
{
|
||||
status = PSA_ERROR_INVALID_ARGUMENT;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
status = psa_hmac_setup_internal( &operation->ctx.hmac,
|
||||
key_buffer,
|
||||
key_buffer_size,
|
||||
|
|
Loading…
Reference in a new issue