mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-21 21:36:21 +01:00
Adapt cipher and MD layer with _init() and _free()
This commit is contained in:
parent
accaffe2c3
commit
84bbeb58df
13 changed files with 134 additions and 47 deletions
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue