Split mbedtls_ccm_init() -> setkey()
This commit is contained in:
parent
d54e617ea6
commit
6963ff0969
7 changed files with 50 additions and 17 deletions
|
@ -61,8 +61,15 @@ static void mbedtls_zeroize( void *v, size_t n ) {
|
|||
/*
|
||||
* Initialize context
|
||||
*/
|
||||
int mbedtls_ccm_init( mbedtls_ccm_context *ctx, mbedtls_cipher_id_t cipher,
|
||||
const unsigned char *key, unsigned int keysize )
|
||||
void mbedtls_ccm_init( mbedtls_ccm_context *ctx )
|
||||
{
|
||||
memset( ctx, 0, sizeof( mbedtls_ccm_context ) );
|
||||
}
|
||||
|
||||
int mbedtls_ccm_setkey( mbedtls_ccm_context *ctx,
|
||||
mbedtls_cipher_id_t cipher,
|
||||
const unsigned char *key,
|
||||
unsigned int keysize )
|
||||
{
|
||||
int ret;
|
||||
const mbedtls_cipher_info_t *cipher_info;
|
||||
|
@ -398,7 +405,9 @@ int mbedtls_ccm_self_test( int verbose )
|
|||
size_t i;
|
||||
int ret;
|
||||
|
||||
if( mbedtls_ccm_init( &ctx, MBEDTLS_CIPHER_ID_AES, key, 8 * sizeof key ) != 0 )
|
||||
mbedtls_ccm_init( &ctx );
|
||||
|
||||
if( mbedtls_ccm_setkey( &ctx, MBEDTLS_CIPHER_ID_AES, key, 8 * sizeof key ) != 0 )
|
||||
{
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( " CCM: setup failed" );
|
||||
|
|
|
@ -395,7 +395,7 @@ static const mbedtls_cipher_info_t aes_256_gcm_info = {
|
|||
static int ccm_aes_setkey_wrap( void *ctx, const unsigned char *key,
|
||||
unsigned int key_length )
|
||||
{
|
||||
return mbedtls_ccm_init( (mbedtls_ccm_context *) ctx, MBEDTLS_CIPHER_ID_AES,
|
||||
return mbedtls_ccm_setkey( (mbedtls_ccm_context *) ctx, MBEDTLS_CIPHER_ID_AES,
|
||||
key, key_length );
|
||||
}
|
||||
|
||||
|
@ -752,7 +752,7 @@ static const mbedtls_cipher_info_t camellia_256_gcm_info = {
|
|||
static int ccm_camellia_setkey_wrap( void *ctx, const unsigned char *key,
|
||||
unsigned int key_length )
|
||||
{
|
||||
return mbedtls_ccm_init( (mbedtls_ccm_context *) ctx, MBEDTLS_CIPHER_ID_CAMELLIA,
|
||||
return mbedtls_ccm_setkey( (mbedtls_ccm_context *) ctx, MBEDTLS_CIPHER_ID_CAMELLIA,
|
||||
key, key_length );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue