mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Adapt cipher and MD layer with _init() and _free()
This commit is contained in:
@ -194,6 +194,8 @@ int pkcs12_pbe( asn1_buf *pbe_params, int mode,
|
||||
return( ret );
|
||||
}
|
||||
|
||||
cipher_init( &cipher_ctx );
|
||||
|
||||
if( ( ret = cipher_init_ctx( &cipher_ctx, cipher_info ) ) != 0 )
|
||||
goto exit;
|
||||
|
||||
@ -218,7 +220,7 @@ int pkcs12_pbe( asn1_buf *pbe_params, int mode,
|
||||
exit:
|
||||
polarssl_zeroize( key, sizeof( key ) );
|
||||
polarssl_zeroize( iv, sizeof( iv ) );
|
||||
cipher_free_ctx( &cipher_ctx );
|
||||
cipher_free( &cipher_ctx );
|
||||
|
||||
return( ret );
|
||||
}
|
||||
@ -265,6 +267,8 @@ int pkcs12_derivation( unsigned char *data, size_t datalen,
|
||||
if( md_info == NULL )
|
||||
return( POLARSSL_ERR_PKCS12_FEATURE_UNAVAILABLE );
|
||||
|
||||
md_init( &md_ctx );
|
||||
|
||||
if( ( ret = md_init_ctx( &md_ctx, md_info ) ) != 0 )
|
||||
return( ret );
|
||||
hlen = md_get_size( md_info );
|
||||
@ -348,7 +352,7 @@ exit:
|
||||
polarssl_zeroize( hash_block, sizeof( hash_block ) );
|
||||
polarssl_zeroize( hash_output, sizeof( hash_output ) );
|
||||
|
||||
md_free_ctx( &md_ctx );
|
||||
md_free( &md_ctx );
|
||||
|
||||
return( ret );
|
||||
}
|
||||
|
Reference in New Issue
Block a user