mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-10-28 23:14:56 +03:00 
			
		
		
		
	Use mbedtls_xor in md
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
		| @@ -633,7 +633,6 @@ int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const unsigned char *key, | ||||
|     int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; | ||||
|     unsigned char sum[MBEDTLS_MD_MAX_SIZE]; | ||||
|     unsigned char *ipad, *opad; | ||||
|     size_t i; | ||||
|  | ||||
|     if( ctx == NULL || ctx->md_info == NULL || ctx->hmac_ctx == NULL ) | ||||
|         return( MBEDTLS_ERR_MD_BAD_INPUT_DATA ); | ||||
| @@ -657,11 +656,8 @@ int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const unsigned char *key, | ||||
|     memset( ipad, 0x36, ctx->md_info->block_size ); | ||||
|     memset( opad, 0x5C, ctx->md_info->block_size ); | ||||
|  | ||||
|     for( i = 0; i < keylen; i++ ) | ||||
|     { | ||||
|         ipad[i] = (unsigned char)( ipad[i] ^ key[i] ); | ||||
|         opad[i] = (unsigned char)( opad[i] ^ key[i] ); | ||||
|     } | ||||
|     mbedtls_xor( ipad, ipad, key, keylen ); | ||||
|     mbedtls_xor( opad, opad, key, keylen ); | ||||
|  | ||||
|     if( ( ret = mbedtls_md_starts( ctx ) ) != 0 ) | ||||
|         goto cleanup; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user