diff options
author | lloyd <[email protected]> | 2008-10-26 21:02:33 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-26 21:02:33 +0000 |
commit | a5572385088e399eecf5531074aecabadf24d611 (patch) | |
tree | 2735cbd23715bff478ca9f004e94ac6287e32f7e /src/s2k | |
parent | 9b7cd20217d1134754daf2b2046249607ab7a3a7 (diff) |
Remove lookup.h use from OpenPGP S2K
Diffstat (limited to 'src/s2k')
-rw-r--r-- | src/s2k/pgps2k/pgp_s2k.cpp | 14 | ||||
-rw-r--r-- | src/s2k/pgps2k/pgp_s2k.h | 8 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/s2k/pgps2k/pgp_s2k.cpp b/src/s2k/pgps2k/pgp_s2k.cpp index 66a243e45..b96fdf83b 100644 --- a/src/s2k/pgps2k/pgp_s2k.cpp +++ b/src/s2k/pgps2k/pgp_s2k.cpp @@ -4,7 +4,6 @@ *************************************************/ #include <botan/pgp_s2k.h> -#include <botan/lookup.h> #include <algorithm> #include <memory> @@ -23,8 +22,6 @@ OctetString OpenPGP_S2K::derive(u32bit key_len, const std::string& passphrase, total_size = passphrase.size() + salt_size; u32bit to_hash = std::max(iterations, total_size); - std::auto_ptr<HashFunction> hash(get_hash(hash_name)); - hash->clear(); while(key_len > generated) { @@ -61,7 +58,7 @@ OctetString OpenPGP_S2K::derive(u32bit key_len, const std::string& passphrase, *************************************************/ std::string OpenPGP_S2K::name() const { - return "OpenPGP-S2K(" + hash_name + ")"; + return "OpenPGP-S2K(" + hash->name() + ")"; } /************************************************* @@ -69,14 +66,7 @@ std::string OpenPGP_S2K::name() const *************************************************/ S2K* OpenPGP_S2K::clone() const { - return new OpenPGP_S2K(hash_name); - } - -/************************************************* -* OpenPGP S2K Constructor * -*************************************************/ -OpenPGP_S2K::OpenPGP_S2K(const std::string& h) : hash_name(h) - { + return new OpenPGP_S2K(hash->clone()); } } diff --git a/src/s2k/pgps2k/pgp_s2k.h b/src/s2k/pgps2k/pgp_s2k.h index cd263a735..80fd3ab29 100644 --- a/src/s2k/pgps2k/pgp_s2k.h +++ b/src/s2k/pgps2k/pgp_s2k.h @@ -7,6 +7,7 @@ #define BOTAN_OPENPGP_S2K_H__ #include <botan/s2k.h> +#include <botan/base.h> namespace Botan { @@ -18,11 +19,14 @@ class BOTAN_DLL OpenPGP_S2K : public S2K public: std::string name() const; S2K* clone() const; - OpenPGP_S2K(const std::string&); + + OpenPGP_S2K(HashFunction* hash_in) : hash(hash_in) {} + ~OpenPGP_S2K() { delete hash; } private: OctetString derive(u32bit, const std::string&, const byte[], u32bit, u32bit) const; - const std::string hash_name; + + HashFunction* hash; }; } |