Blowfish accepts variable key len in cipher layer
diff --git a/library/cipher.c b/library/cipher.c
index 01913b5..558c4b3 100644
--- a/library/cipher.c
+++ b/library/cipher.c
@@ -168,8 +168,11 @@
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;
diff --git a/library/cipher_wrap.c b/library/cipher_wrap.c
index 34fc9e7..f4d39fa 100644
--- a/library/cipher_wrap.c
+++ b/library/cipher_wrap.c
@@ -1180,7 +1180,7 @@
128,
"BLOWFISH-ECB",
8,
- 0,
+ POLARSSL_CIPHER_VARIABLE_KEY_LEN,
8,
&blowfish_info
};
@@ -1192,7 +1192,7 @@
128,
"BLOWFISH-CBC",
8,
- 0,
+ POLARSSL_CIPHER_VARIABLE_KEY_LEN,
8,
&blowfish_info
};
@@ -1205,7 +1205,7 @@
128,
"BLOWFISH-CFB64",
8,
- 0,
+ POLARSSL_CIPHER_VARIABLE_KEY_LEN,
8,
&blowfish_info
};
@@ -1218,7 +1218,7 @@
128,
"BLOWFISH-CTR",
8,
- 0,
+ POLARSSL_CIPHER_VARIABLE_KEY_LEN,
8,
&blowfish_info
};