mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Change the pkcs5_pbkdf2_hmac deprecation approach
The shared part has now been extracted and will be used regardless of the deprecation define. Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
@ -209,14 +209,11 @@ exit:
|
|||||||
#endif /* MBEDTLS_ASN1_PARSE_C */
|
#endif /* MBEDTLS_ASN1_PARSE_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_C)
|
#if defined(MBEDTLS_MD_C)
|
||||||
#if defined(MBEDTLS_DEPRECATED_REMOVED)
|
static int pkcs5_pbkdf2_hmac( mbedtls_md_context_t *ctx,
|
||||||
static
|
const unsigned char *password,
|
||||||
#endif
|
size_t plen, const unsigned char *salt, size_t slen,
|
||||||
int mbedtls_pkcs5_pbkdf2_hmac( mbedtls_md_context_t *ctx,
|
unsigned int iteration_count,
|
||||||
const unsigned char *password,
|
uint32_t key_length, unsigned char *output )
|
||||||
size_t plen, const unsigned char *salt, size_t slen,
|
|
||||||
unsigned int iteration_count,
|
|
||||||
uint32_t key_length, unsigned char *output )
|
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
int j;
|
int j;
|
||||||
@ -293,6 +290,18 @@ cleanup:
|
|||||||
|
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||||
|
int mbedtls_pkcs5_pbkdf2_hmac( mbedtls_md_context_t *ctx,
|
||||||
|
const unsigned char *password,
|
||||||
|
size_t plen, const unsigned char *salt, size_t slen,
|
||||||
|
unsigned int iteration_count,
|
||||||
|
uint32_t key_length, unsigned char *output )
|
||||||
|
{
|
||||||
|
return( pkcs5_pbkdf2_hmac( ctx, password, plen, salt, slen, iteration_count,
|
||||||
|
key_length, output ) );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif /* MBEDTLS_MD_C */
|
#endif /* MBEDTLS_MD_C */
|
||||||
|
|
||||||
int mbedtls_pkcs5_pbkdf2_hmac_ext( mbedtls_md_type_t md_alg,
|
int mbedtls_pkcs5_pbkdf2_hmac_ext( mbedtls_md_type_t md_alg,
|
||||||
@ -314,8 +323,8 @@ int mbedtls_pkcs5_pbkdf2_hmac_ext( mbedtls_md_type_t md_alg,
|
|||||||
|
|
||||||
if( ( ret = mbedtls_md_setup( &md_ctx, md_info, 1 ) ) != 0 )
|
if( ( ret = mbedtls_md_setup( &md_ctx, md_info, 1 ) ) != 0 )
|
||||||
goto exit;
|
goto exit;
|
||||||
ret = mbedtls_pkcs5_pbkdf2_hmac( &md_ctx, password, plen, salt, slen,
|
ret = pkcs5_pbkdf2_hmac( &md_ctx, password, plen, salt, slen,
|
||||||
iteration_count, key_length, output );
|
iteration_count, key_length, output );
|
||||||
exit:
|
exit:
|
||||||
mbedtls_md_free( &md_ctx );
|
mbedtls_md_free( &md_ctx );
|
||||||
return( ret );
|
return( ret );
|
||||||
|
Reference in New Issue
Block a user