Adapt cipher and MD layer with _init() and _free()
diff --git a/library/pkcs12.c b/library/pkcs12.c
index 027f84a..0cf2edf 100644
--- a/library/pkcs12.c
+++ b/library/pkcs12.c
@@ -194,6 +194,8 @@
return( ret );
}
+ cipher_init( &cipher_ctx );
+
if( ( ret = cipher_init_ctx( &cipher_ctx, cipher_info ) ) != 0 )
goto exit;
@@ -218,7 +220,7 @@
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 @@
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 @@
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 );
}