mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-23 15:55:10 +01:00
Blowfish accepts variable key len in cipher layer
This commit is contained in:
parent
ed5c03ff1d
commit
398c57b0b3
4 changed files with 38 additions and 5 deletions
|
|
@ -168,8 +168,11 @@ int cipher_setkey( cipher_context_t *ctx, const unsigned char *key,
|
|||
if( NULL == ctx || NULL == ctx->cipher_info )
|
||||
return( POLARSSL_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
|
||||
if( (int) ctx->cipher_info->key_length != key_length )
|
||||
if( ( ctx->cipher_info->flags & POLARSSL_CIPHER_VARIABLE_KEY_LEN ) == 0 &&
|
||||
(int) ctx->cipher_info->key_length != key_length )
|
||||
{
|
||||
return( POLARSSL_ERR_CIPHER_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
ctx->key_length = key_length;
|
||||
ctx->operation = operation;
|
||||
|
|
|
|||
|
|
@ -1180,7 +1180,7 @@ const cipher_info_t blowfish_ecb_info = {
|
|||
128,
|
||||
"BLOWFISH-ECB",
|
||||
8,
|
||||
0,
|
||||
POLARSSL_CIPHER_VARIABLE_KEY_LEN,
|
||||
8,
|
||||
&blowfish_info
|
||||
};
|
||||
|
|
@ -1192,7 +1192,7 @@ const cipher_info_t blowfish_cbc_info = {
|
|||
128,
|
||||
"BLOWFISH-CBC",
|
||||
8,
|
||||
0,
|
||||
POLARSSL_CIPHER_VARIABLE_KEY_LEN,
|
||||
8,
|
||||
&blowfish_info
|
||||
};
|
||||
|
|
@ -1205,7 +1205,7 @@ const cipher_info_t blowfish_cfb64_info = {
|
|||
128,
|
||||
"BLOWFISH-CFB64",
|
||||
8,
|
||||
0,
|
||||
POLARSSL_CIPHER_VARIABLE_KEY_LEN,
|
||||
8,
|
||||
&blowfish_info
|
||||
};
|
||||
|
|
@ -1218,7 +1218,7 @@ const cipher_info_t blowfish_ctr_info = {
|
|||
128,
|
||||
"BLOWFISH-CTR",
|
||||
8,
|
||||
0,
|
||||
POLARSSL_CIPHER_VARIABLE_KEY_LEN,
|
||||
8,
|
||||
&blowfish_info
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue