aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk_pad
diff options
context:
space:
mode:
Diffstat (limited to 'src/pk_pad')
-rw-r--r--src/pk_pad/eme1/eme1.cpp10
-rw-r--r--src/pk_pad/eme1/eme1.h8
-rw-r--r--src/pk_pad/eme1/info.txt2
3 files changed, 13 insertions, 7 deletions
diff --git a/src/pk_pad/eme1/eme1.cpp b/src/pk_pad/eme1/eme1.cpp
index 2ca10c166..b5f2af6d3 100644
--- a/src/pk_pad/eme1/eme1.cpp
+++ b/src/pk_pad/eme1/eme1.cpp
@@ -4,7 +4,7 @@
*************************************************/
#include <botan/eme1.h>
-#include <botan/lookup.h>
+#include <botan/mgf1.h>
#include <memory>
namespace Botan {
@@ -83,13 +83,11 @@ u32bit EME1::maximum_input_size(u32bit keybits) const
/*************************************************
* EME1 Constructor *
*************************************************/
-EME1::EME1(const std::string& hash_name, const std::string& mgf_name,
- const std::string& P) :
- HASH_LENGTH(output_length_of(hash_name))
+EME1::EME1(HashFunction* hash, const std::string& P) :
+ HASH_LENGTH(hash->OUTPUT_LENGTH)
{
- mgf = get_mgf(mgf_name + "(" + hash_name + ")");
- std::auto_ptr<HashFunction> hash(get_hash(hash_name));
Phash = hash->process(P);
+ mgf = new MGF1(hash);
}
}
diff --git a/src/pk_pad/eme1/eme1.h b/src/pk_pad/eme1/eme1.h
index af8530470..e33b0e917 100644
--- a/src/pk_pad/eme1/eme1.h
+++ b/src/pk_pad/eme1/eme1.h
@@ -19,7 +19,13 @@ class BOTAN_DLL EME1 : public EME
public:
u32bit maximum_input_size(u32bit) const;
- EME1(const std::string&, const std::string&, const std::string& = "");
+ /**
+ EME1 constructor. Hash will be deleted by ~EME1 (when mgf is deleted)
+
+ P is an optional label. Normally empty.
+ */
+ EME1(HashFunction* hash, const std::string& P = "");
+
~EME1() { delete mgf; }
private:
SecureVector<byte> pad(const byte[], u32bit, u32bit,
diff --git a/src/pk_pad/eme1/info.txt b/src/pk_pad/eme1/info.txt
index dafb595c1..e2b74265f 100644
--- a/src/pk_pad/eme1/info.txt
+++ b/src/pk_pad/eme1/info.txt
@@ -11,4 +11,6 @@ eme1.cpp
<requires>
mgf1
+utils
+core
</requires>