mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-04 16:29:43 +00:00
Remove incorrect hashing
Incorrect interpretation of 'empty' Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
8d7eef470b
commit
c89e209ded
|
@ -264,7 +264,6 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
|
||||||
|
|
||||||
unsigned char diversifier[128];
|
unsigned char diversifier[128];
|
||||||
unsigned char salt_block[128], pwd_block[128], hash_block[128];
|
unsigned char salt_block[128], pwd_block[128], hash_block[128];
|
||||||
unsigned char empty_string[2] = { 0, 0 };
|
|
||||||
unsigned char hash_output[MBEDTLS_MD_MAX_SIZE];
|
unsigned char hash_output[MBEDTLS_MD_MAX_SIZE];
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
@ -331,24 +330,12 @@ int mbedtls_pkcs12_derivation( unsigned char *data, size_t datalen,
|
||||||
if( ( ret = mbedtls_md_update( &md_ctx, salt_block, v )) != 0 )
|
if( ( ret = mbedtls_md_update( &md_ctx, salt_block, v )) != 0 )
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if( ( ret = mbedtls_md_update( &md_ctx, empty_string,
|
|
||||||
sizeof( empty_string ) )) != 0 )
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( use_password != 0)
|
if( use_password != 0)
|
||||||
{
|
{
|
||||||
if( ( ret = mbedtls_md_update( &md_ctx, pwd_block, v )) != 0 )
|
if( ( ret = mbedtls_md_update( &md_ctx, pwd_block, v )) != 0 )
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if( ( ret = mbedtls_md_update( &md_ctx, empty_string,
|
|
||||||
sizeof( empty_string ) )) != 0 )
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( ret = mbedtls_md_finish( &md_ctx, hash_output ) ) != 0 )
|
if( ( ret = mbedtls_md_finish( &md_ctx, hash_output ) ) != 0 )
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
Loading…
Reference in a new issue