diff options
author | Jack Lloyd <[email protected]> | 2018-07-18 16:45:17 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-05-31 21:32:19 -0400 |
commit | 184a7825a8cc449476951de0d2019d8014667c8f (patch) | |
tree | 329d69bfd71d53b126c02864d779887b42ce13dd /src/lib/block | |
parent | dbf4b8d7418587d4d30c048e1ff13f418944ffc4 (diff) |
Add Bcrypt-PBKDF
Diffstat (limited to 'src/lib/block')
-rw-r--r-- | src/lib/block/blowfish/blowfish.cpp | 14 | ||||
-rw-r--r-- | src/lib/block/blowfish/blowfish.h | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/lib/block/blowfish/blowfish.cpp b/src/lib/block/blowfish/blowfish.cpp index d219bc22a..ecb9f82e3 100644 --- a/src/lib/block/blowfish/blowfish.cpp +++ b/src/lib/block/blowfish/blowfish.cpp @@ -374,7 +374,7 @@ void Blowfish::key_expansion(const uint8_t key[], */ void Blowfish::salted_set_key(const uint8_t key[], size_t length, const uint8_t salt[], size_t salt_length, - size_t workfactor) + size_t workfactor, bool salt_first) { BOTAN_ARG_CHECK(salt_length > 0 && salt_length % 4 == 0, "Invalid salt length for Blowfish salted key schedule"); @@ -398,8 +398,16 @@ void Blowfish::salted_set_key(const uint8_t key[], size_t length, for(size_t r = 0; r != rounds; ++r) { - key_expansion(key, length, nullptr, 0); - key_expansion(salt, salt_length, nullptr, 0); + if(salt_first) + { + key_expansion(salt, salt_length, nullptr, 0); + key_expansion(key, length, nullptr, 0); + } + else + { + key_expansion(key, length, nullptr, 0); + key_expansion(salt, salt_length, nullptr, 0); + } } } } diff --git a/src/lib/block/blowfish/blowfish.h b/src/lib/block/blowfish/blowfish.h index d5c318752..97a1b841c 100644 --- a/src/lib/block/blowfish/blowfish.h +++ b/src/lib/block/blowfish/blowfish.h @@ -26,7 +26,7 @@ class BOTAN_PUBLIC_API(2,0) Blowfish final : public Block_Cipher_Fixed_Params<8, */ void salted_set_key(const uint8_t key[], size_t key_length, const uint8_t salt[], size_t salt_length, - size_t workfactor); + const size_t workfactor, bool salt_first = false); BOTAN_DEPRECATED("Use Blowfish::salted_set_key taking salt length") void eks_key_schedule(const uint8_t key[], size_t key_length, |