diff options
author | lloyd <[email protected]> | 2008-09-30 05:41:04 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-30 05:41:04 +0000 |
commit | 75ef07ee5378341adf054bd729232167c73e9e47 (patch) | |
tree | 7c84c43a431f0313b4f08b4267ff066650948bb0 /src/pk_pad | |
parent | bc9e881d7c7a569664b5e753c12e4c8cbde06d2d (diff) |
Remove lookup/libstate dependency on Lion, KDF1, KDF2, EMSA[1-4]
Diffstat (limited to 'src/pk_pad')
-rw-r--r-- | src/pk_pad/emsa1/emsa1.cpp | 8 | ||||
-rw-r--r-- | src/pk_pad/emsa1/emsa1.h | 2 | ||||
-rw-r--r-- | src/pk_pad/emsa2/emsa2.cpp | 4 | ||||
-rw-r--r-- | src/pk_pad/emsa2/emsa2.h | 2 | ||||
-rw-r--r-- | src/pk_pad/emsa3/emsa3.cpp | 4 | ||||
-rw-r--r-- | src/pk_pad/emsa3/emsa3.h | 2 | ||||
-rw-r--r-- | src/pk_pad/emsa4/emsa4.cpp | 16 | ||||
-rw-r--r-- | src/pk_pad/emsa4/emsa4.h | 7 |
8 files changed, 16 insertions, 29 deletions
diff --git a/src/pk_pad/emsa1/emsa1.cpp b/src/pk_pad/emsa1/emsa1.cpp index 15d53f6e5..b0c505939 100644 --- a/src/pk_pad/emsa1/emsa1.cpp +++ b/src/pk_pad/emsa1/emsa1.cpp @@ -101,12 +101,4 @@ bool EMSA1::verify(const MemoryRegion<byte>& coded, } } -/************************************************* -* EMSA1 Constructor * -*************************************************/ -EMSA1::EMSA1(const std::string& hash_name) : - hash(get_hash(hash_name)) - { - } - } diff --git a/src/pk_pad/emsa1/emsa1.h b/src/pk_pad/emsa1/emsa1.h index c0eec8d17..2de2d325e 100644 --- a/src/pk_pad/emsa1/emsa1.h +++ b/src/pk_pad/emsa1/emsa1.h @@ -16,7 +16,7 @@ namespace Botan { class BOTAN_DLL EMSA1 : public EMSA { public: - EMSA1(const std::string&); + EMSA1(HashFunction* h) : hash(h) {} ~EMSA1() { delete hash; } private: void update(const byte[], u32bit); diff --git a/src/pk_pad/emsa2/emsa2.cpp b/src/pk_pad/emsa2/emsa2.cpp index 9f5f4b277..5ecbf005c 100644 --- a/src/pk_pad/emsa2/emsa2.cpp +++ b/src/pk_pad/emsa2/emsa2.cpp @@ -5,7 +5,6 @@ #include <botan/emsa2.h> #include <botan/hash_id.h> -#include <botan/lookup.h> namespace Botan { @@ -94,9 +93,8 @@ bool EMSA2::verify(const MemoryRegion<byte>& coded, /************************************************* * EMSA2 Constructor * *************************************************/ -EMSA2::EMSA2(const std::string& hash_name) +EMSA2::EMSA2(HashFunction* hash_in) : hash(hash_in) { - hash = get_hash(hash_name); empty_hash = hash->final(); hash_id = ieee1363_hash_id(hash->name()); diff --git a/src/pk_pad/emsa2/emsa2.h b/src/pk_pad/emsa2/emsa2.h index 79e21a8f8..d35cfe1aa 100644 --- a/src/pk_pad/emsa2/emsa2.h +++ b/src/pk_pad/emsa2/emsa2.h @@ -16,7 +16,7 @@ namespace Botan { class BOTAN_DLL EMSA2 : public EMSA { public: - EMSA2(const std::string&); + EMSA2(HashFunction* hash); ~EMSA2() { delete hash; } private: void update(const byte[], u32bit); diff --git a/src/pk_pad/emsa3/emsa3.cpp b/src/pk_pad/emsa3/emsa3.cpp index 255366503..060dd40d8 100644 --- a/src/pk_pad/emsa3/emsa3.cpp +++ b/src/pk_pad/emsa3/emsa3.cpp @@ -5,7 +5,6 @@ #include <botan/emsa3.h> #include <botan/hash_id.h> -#include <botan/lookup.h> namespace Botan { @@ -88,9 +87,8 @@ bool EMSA3::verify(const MemoryRegion<byte>& coded, /************************************************* * EMSA3 Constructor * *************************************************/ -EMSA3::EMSA3(const std::string& hash_name) +EMSA3::EMSA3(HashFunction* hash_in) : hash(hash_in) { - hash = get_hash(hash_name); hash_id = pkcs_hash_id(hash->name()); } diff --git a/src/pk_pad/emsa3/emsa3.h b/src/pk_pad/emsa3/emsa3.h index bdaec5c42..7c0d87147 100644 --- a/src/pk_pad/emsa3/emsa3.h +++ b/src/pk_pad/emsa3/emsa3.h @@ -16,7 +16,7 @@ namespace Botan { class BOTAN_DLL EMSA3 : public EMSA { public: - EMSA3(const std::string&); + EMSA3(HashFunction* hash); ~EMSA3() { delete hash; } private: void update(const byte[], u32bit); diff --git a/src/pk_pad/emsa4/emsa4.cpp b/src/pk_pad/emsa4/emsa4.cpp index e41b0d2fa..038489e15 100644 --- a/src/pk_pad/emsa4/emsa4.cpp +++ b/src/pk_pad/emsa4/emsa4.cpp @@ -4,7 +4,7 @@ *************************************************/ #include <botan/emsa4.h> -#include <botan/lookup.h> +#include <botan/mgf1.h> #include <botan/bit_ops.h> namespace Botan { @@ -123,21 +123,19 @@ bool EMSA4::verify(const MemoryRegion<byte>& const_coded, /************************************************* * EMSA4 Constructor * *************************************************/ -EMSA4::EMSA4(const std::string& hash_name, const std::string& mgf_name) : - SALT_SIZE(output_length_of(hash_name)) +EMSA4::EMSA4(HashFunction* h) : + SALT_SIZE(h->OUTPUT_LENGTH), hash(h) { - hash = get_hash(hash_name); - mgf = get_mgf(mgf_name + "(" + hash_name + ")"); + mgf = new MGF1(hash->clone()); } /************************************************* * EMSA4 Constructor * *************************************************/ -EMSA4::EMSA4(const std::string& hash_name, const std::string& mgf_name, - u32bit salt_size) : SALT_SIZE(salt_size) +EMSA4::EMSA4(HashFunction* h, u32bit salt_size) : + SALT_SIZE(salt_size), hash(h) { - hash = get_hash(hash_name); - mgf = get_mgf(mgf_name + "(" + hash_name + ")"); + mgf = new MGF1(hash->clone()); } } diff --git a/src/pk_pad/emsa4/emsa4.h b/src/pk_pad/emsa4/emsa4.h index 8f2505281..dded20ec3 100644 --- a/src/pk_pad/emsa4/emsa4.h +++ b/src/pk_pad/emsa4/emsa4.h @@ -17,8 +17,9 @@ namespace Botan { class BOTAN_DLL EMSA4 : public EMSA { public: - EMSA4(const std::string&, const std::string&); - EMSA4(const std::string&, const std::string&, u32bit); + EMSA4(HashFunction*); + EMSA4(HashFunction*, u32bit); + ~EMSA4() { delete hash; delete mgf; } private: void update(const byte[], u32bit); @@ -29,7 +30,7 @@ class BOTAN_DLL EMSA4 : public EMSA bool verify(const MemoryRegion<byte>&, const MemoryRegion<byte>&, u32bit) throw(); - const u32bit SALT_SIZE; + u32bit SALT_SIZE; HashFunction* hash; const MGF* mgf; }; |