Skip to content

Commit

Permalink
Use mbedtls_xor in PKCS Mbed-TLS#5
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Rodgman <[email protected]>
  • Loading branch information
daverodgman committed Nov 22, 2022
1 parent 99a507e commit 74b345f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions library/pkcs5.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ static int pkcs5_pbkdf2_hmac( mbedtls_md_context_t *ctx,
uint32_t key_length, unsigned char *output )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
int j;
unsigned int i;
unsigned char md1[MBEDTLS_MD_MAX_SIZE];
unsigned char work[MBEDTLS_MD_MAX_SIZE];
Expand Down Expand Up @@ -263,8 +262,7 @@ static int pkcs5_pbkdf2_hmac( mbedtls_md_context_t *ctx,

// U1 xor U2
//
for( j = 0; j < md_size; j++ )
work[j] ^= md1[j];
mbedtls_xor( work, work, md1, md_size );
}

use_len = ( key_length < md_size ) ? key_length : md_size;
Expand Down Expand Up @@ -396,8 +394,7 @@ int mbedtls_pkcs5_pbkdf2_hmac_ext( mbedtls_md_type_t md_alg,

// U1 xor U2
//
for( j = 0; j < md_size; j++ )
work[j] ^= md1[j];
mbedtls_xor( work, work, md1, md_size );
}

use_len = ( key_length < md_size ) ? key_length : md_size;
Expand Down

0 comments on commit 74b345f

Please sign in to comment.