psa_hmac_start: remove useless casts
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 1eecd3e..794af37 100755
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1067,10 +1067,10 @@
{
unsigned char sum[PSA_CRYPTO_MD_MAX_SIZE];
unsigned char ipad[PSA_CRYPTO_MD_BLOCK_SIZE];
- unsigned char *opad;
+ unsigned char *opad = operation->ctx.hmac.hmac_ctx;
size_t i;
size_t sum_size = MBEDTLS_MD_MAX_SIZE;
- unsigned int block_size =
+ size_t block_size =
PSA_HASH_BLOCK_SIZE( ( PSA_ALG_HMAC_HASH( alg ) ) );
unsigned int digest_size =
PSA_HASH_FINAL_SIZE( ( PSA_ALG_HMAC_HASH( alg ) ) );
@@ -1092,7 +1092,7 @@
if( status != PSA_SUCCESS )
return( status );
- if( key_bits / 8 > (size_t) block_size )
+ if( key_bits / 8 > block_size )
{
status = psa_hash_update( &operation->ctx.hmac.hash_ctx,
key_ptr, slot->data.raw.bytes);
@@ -1107,15 +1107,13 @@
key_ptr = sum;
}
- opad = (unsigned char *) operation->ctx.hmac.hmac_ctx;
-
memset( ipad, 0x36, block_size );
memset( opad, 0x5C, block_size );
for( i = 0; i < key_length; i++ )
{
- ipad[i] = (unsigned char) ( ipad[i] ^ key_ptr[i] );
- opad[i] = (unsigned char) ( opad[i] ^ key_ptr[i] );
+ ipad[i] = ipad[i] ^ key_ptr[i];
+ opad[i] = opad[i] ^ key_ptr[i];
}
status = psa_hash_start( &operation->ctx.hmac.hash_ctx,
@@ -1281,7 +1279,7 @@
if( PSA_ALG_IS_HMAC( operation->alg ) )
{
unsigned char tmp[MBEDTLS_MD_MAX_SIZE];
- unsigned char *opad;
+ unsigned char *opad = operation->ctx.hmac.hmac_ctx;
size_t hash_size = 0;
unsigned int block_size =
PSA_HASH_BLOCK_SIZE( ( PSA_ALG_HMAC_HASH( operation->alg ) ) );
@@ -1289,8 +1287,6 @@
if( block_size == 0 )
return( PSA_ERROR_NOT_SUPPORTED );
- opad = (unsigned char *) operation->ctx.hmac.hmac_ctx;
-
status = psa_hash_finish( &operation->ctx.hmac.hash_ctx, tmp,
sizeof( tmp ), &hash_size );
if( status != PSA_SUCCESS )