mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-24 02:15:32 +00:00
Removed unneed memsets and fixed spacing
This commit is contained in:
parent
6eae89bb6f
commit
cdd1f6d96c
|
@ -74,7 +74,6 @@ static int cmac_multiply_by_u( unsigned char *output,
|
|||
const unsigned char *input,
|
||||
size_t blocksize )
|
||||
{
|
||||
|
||||
const unsigned char R_128 = 0x87;
|
||||
const unsigned char R_64 = 0x1B;
|
||||
unsigned char R_n, mask;
|
||||
|
@ -91,7 +90,6 @@ static int cmac_multiply_by_u( unsigned char *output,
|
|||
return( MBEDTLS_ERR_CMAC_BAD_INPUT );
|
||||
}
|
||||
|
||||
|
||||
for( i = starting_index; i >= 0; i-- )
|
||||
{
|
||||
output[i] = input[i] << 1 | overflow;
|
||||
|
@ -134,7 +132,6 @@ static int cmac_generate_subkeys( mbedtls_cmac_context *ctx )
|
|||
goto exit;
|
||||
}
|
||||
/* Calculate Ek(0) */
|
||||
memset( L, 0, block_size );
|
||||
if( ( ret = mbedtls_cipher_update( &ctx->cipher_ctx,
|
||||
L, block_size, L, &olen ) ) != 0 )
|
||||
{
|
||||
|
@ -152,7 +149,7 @@ static int cmac_generate_subkeys( mbedtls_cmac_context *ctx )
|
|||
exit:
|
||||
if( L != NULL )
|
||||
mbedtls_zeroize( L, sizeof( L ) );
|
||||
free( L );
|
||||
mbedtls_free( L );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
|
@ -308,8 +305,6 @@ int mbedtls_cmac_generate( mbedtls_cmac_context *ctx,
|
|||
XOR_BLOCK( M_last, input + block_size * ( n - 1 ), ctx->K1 );
|
||||
}
|
||||
|
||||
memset( state, 0, block_size );
|
||||
|
||||
for( j = 0; j < n - 1; j++ )
|
||||
UPDATE_CMAC( input + block_size * j );
|
||||
|
||||
|
@ -318,8 +313,8 @@ int mbedtls_cmac_generate( mbedtls_cmac_context *ctx,
|
|||
memcpy( tag, state, tag_len );
|
||||
|
||||
exit:
|
||||
free( state );
|
||||
free( M_last );
|
||||
mbedtls_free( state );
|
||||
mbedtls_free( M_last );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
|
@ -361,7 +356,7 @@ int mbedtls_cmac_verify( mbedtls_cmac_context *ctx,
|
|||
goto exit;
|
||||
|
||||
exit:
|
||||
free( check_tag );
|
||||
mbedtls_free( check_tag );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
|
@ -734,7 +729,7 @@ int test_cmac_with_cipher( int verbose,
|
|||
mbedtls_printf( "passed\n" );
|
||||
}
|
||||
exit:
|
||||
free( tag );
|
||||
mbedtls_free( tag );
|
||||
mbedtls_cmac_free( &ctx );
|
||||
return( ret );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue