Rename key_length in cipher_info
This commit is contained in:
parent
b8186a5e54
commit
898e0aa210
11 changed files with 57 additions and 55 deletions
|
@ -111,7 +111,7 @@ const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values( const mbedtls_ciph
|
|||
|
||||
for( def = mbedtls_cipher_definitions; def->info != NULL; def++ )
|
||||
if( def->info->base->cipher == cipher_id &&
|
||||
def->info->key_length == (unsigned) key_bitlen &&
|
||||
def->info->key_bitlen == (unsigned) key_bitlen &&
|
||||
def->info->mode == mode )
|
||||
return( def->info );
|
||||
|
||||
|
@ -167,12 +167,12 @@ int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx, const unsigned char *k
|
|||
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
|
||||
if( ( ctx->cipher_info->flags & MBEDTLS_CIPHER_VARIABLE_KEY_LEN ) == 0 &&
|
||||
(int) ctx->cipher_info->key_length != key_bitlen )
|
||||
(int) ctx->cipher_info->key_bitlen != key_bitlen )
|
||||
{
|
||||
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
ctx->key_length = key_bitlen;
|
||||
ctx->key_bitlen = key_bitlen;
|
||||
ctx->operation = operation;
|
||||
|
||||
/*
|
||||
|
@ -183,12 +183,12 @@ int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx, const unsigned char *k
|
|||
MBEDTLS_MODE_CTR == ctx->cipher_info->mode )
|
||||
{
|
||||
return ctx->cipher_info->base->setkey_enc_func( ctx->cipher_ctx, key,
|
||||
ctx->key_length );
|
||||
ctx->key_bitlen );
|
||||
}
|
||||
|
||||
if( MBEDTLS_DECRYPT == operation )
|
||||
return ctx->cipher_info->base->setkey_dec_func( ctx->cipher_ctx, key,
|
||||
ctx->key_length );
|
||||
ctx->key_bitlen );
|
||||
|
||||
return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue