diff options
author | lloyd <[email protected]> | 2008-09-30 06:47:38 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-30 06:47:38 +0000 |
commit | 66869d7e0fcaf120f5c22eee43277fabd00e94fd (patch) | |
tree | 5161b89557a8a8cd8f69ee7459368391872980fb /src/kdf | |
parent | 33bb3dca54ecef2599b756d27b66781e14d06ae3 (diff) |
Remove lookup.h from X9.31 PRNG, X9.19 MAC, SSLv3 MAC, PBKDF1
Diffstat (limited to 'src/kdf')
-rw-r--r-- | src/kdf/pbkdf1/pbkdf1.cpp | 16 | ||||
-rw-r--r-- | src/kdf/pbkdf1/pbkdf1.h | 11 |
2 files changed, 14 insertions, 13 deletions
diff --git a/src/kdf/pbkdf1/pbkdf1.cpp b/src/kdf/pbkdf1/pbkdf1.cpp index 70cff9eee..00d1ea9ab 100644 --- a/src/kdf/pbkdf1/pbkdf1.cpp +++ b/src/kdf/pbkdf1/pbkdf1.cpp @@ -4,8 +4,6 @@ *************************************************/ #include <botan/pbkdf1.h> -#include <botan/lookup.h> -#include <memory> namespace Botan { @@ -20,7 +18,6 @@ OctetString PKCS5_PBKDF1::derive(u32bit key_len, if(iterations == 0) throw Invalid_Argument("PKCS#5 PBKDF1: Invalid iteration count"); - std::auto_ptr<HashFunction> hash(get_hash(hash_name)); if(key_len > hash->OUTPUT_LENGTH) throw Exception("PKCS#5 PBKDF1: Requested output length too long"); @@ -38,20 +35,19 @@ OctetString PKCS5_PBKDF1::derive(u32bit key_len, } /************************************************* -* Return the name of this type * +* Clone this type * *************************************************/ -std::string PKCS5_PBKDF1::name() const +S2K* PKCS5_PBKDF1::clone() const { - return "PBKDF1(" + hash_name + ")"; + return new PKCS5_PBKDF1(hash->clone()); } /************************************************* -* PKCS5_PBKDF1 Constructor * +* Return the name of this type * *************************************************/ -PKCS5_PBKDF1::PKCS5_PBKDF1(const std::string& h_name) : hash_name(h_name) +std::string PKCS5_PBKDF1::name() const { - if(!have_hash(hash_name)) - throw Algorithm_Not_Found(hash_name); + return "PBKDF1(" + hash->name() + ")"; } } diff --git a/src/kdf/pbkdf1/pbkdf1.h b/src/kdf/pbkdf1/pbkdf1.h index 3608bb470..e5fd66db8 100644 --- a/src/kdf/pbkdf1/pbkdf1.h +++ b/src/kdf/pbkdf1/pbkdf1.h @@ -7,6 +7,7 @@ #define BOTAN_PBKDF1_H__ #include <botan/s2k.h> +#include <botan/base.h> namespace Botan { @@ -17,12 +18,16 @@ class BOTAN_DLL PKCS5_PBKDF1 : public S2K { public: std::string name() const; - S2K* clone() const { return new PKCS5_PBKDF1(hash_name); } - PKCS5_PBKDF1(const std::string&); + S2K* clone() const; + + PKCS5_PBKDF1(HashFunction* hash_in) : hash(hash_in) {} + PKCS5_PBKDF1(const PKCS5_PBKDF1& other) : hash(other.hash->clone()) {} + ~PKCS5_PBKDF1() { delete hash; } private: OctetString derive(u32bit, const std::string&, const byte[], u32bit, u32bit) const; - const std::string hash_name; + + HashFunction* hash; }; } |