Variable key length crypters use default key length if zero given

This commit is contained in:
Martin Willi
2010-08-16 17:06:27 +02:00
parent 806ec8b1d6
commit e2c3b4820b
5 changed files with 54 additions and 64 deletions
@@ -166,7 +166,8 @@ METHOD(crypter_t, destroy, void,
/*
* Described in header
*/
blowfish_crypter_t *blowfish_crypter_create(encryption_algorithm_t algo, size_t key_size)
blowfish_crypter_t *blowfish_crypter_create(encryption_algorithm_t algo,
size_t key_size)
{
private_blowfish_crypter_t *this;
@@ -185,7 +186,7 @@ blowfish_crypter_t *blowfish_crypter_create(encryption_algorithm_t algo, size_t
.set_key = _set_key,
.destroy = _destroy,
},
.key_size = key_size,
.key_size = key_size ?: 16,
);
return &this->public;