diff options
author | lloyd <[email protected]> | 2010-08-21 20:02:19 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-08-21 20:02:19 +0000 |
commit | d34c9569af1c230c3ee52cef18aadf7d10bdf563 (patch) | |
tree | 51554cedf99989c5bb59e64a9d35f4af712dad17 /src/mac | |
parent | 50a545ebbfb9695159fbd607372a28798db1f413 (diff) |
Turns out OpenSSL's implementation of PBKDF2 allows empty passphrases,
so for compatability with keys that were encrypted with an empty
passphrase we probably want to support it as well.
In PBKDF2, don't reject empty passphrases out of hand; simply call
set_key and if the underlying MAC cannot use the key, throw an
informative exception. This will also be more helpful in the case that
someone tries using another MAC (say, CMAC) with a block cipher that
only supports keys of specific sizes.
In HMAC, allow zero-length keys. This is not really optimal in the
sense of allowing the user to do something dumb, but a 1 byte key
would be pretty dumb as well and we already allowed that.
Add a test vector using an empty passphrase generated by OpenSSL
Diffstat (limited to 'src/mac')
-rw-r--r-- | src/mac/hmac/hmac.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mac/hmac/hmac.cpp b/src/mac/hmac/hmac.cpp index f69504c82..0d5c99702 100644 --- a/src/mac/hmac/hmac.cpp +++ b/src/mac/hmac/hmac.cpp @@ -86,7 +86,7 @@ MessageAuthenticationCode* HMAC::clone() const */ HMAC::HMAC(HashFunction* hash_in) : MessageAuthenticationCode(hash_in->OUTPUT_LENGTH, - 1, 2*hash_in->HASH_BLOCK_SIZE), + 0, 2*hash_in->HASH_BLOCK_SIZE), hash(hash_in) { if(hash->HASH_BLOCK_SIZE == 0) |