aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-28 20:03:58 +0000
committerlloyd <[email protected]>2008-09-28 20:03:58 +0000
commiteb8fd42d6aa3ed267c7444b114e02e64a567ca00 (patch)
treeeac8431723ecd2d2985a7801c9877955d6ba50bf /src
parentfde29acbeb656bcffe13b91f08f847eee4509670 (diff)
Modularize MGF1. Make EME1 and EMSA4 depend on it
Diffstat (limited to 'src')
-rw-r--r--src/get_enc.cpp7
-rw-r--r--src/kdf/mgf1/mgf1.cpp (renamed from src/mgf1.cpp)0
-rw-r--r--src/kdf/mgf1/mgf1.h33
-rw-r--r--src/pk_pad/eme1/modinfo.txt4
-rw-r--r--src/pk_pad/emsa4/modinfo.txt4
5 files changed, 47 insertions, 1 deletions
diff --git a/src/get_enc.cpp b/src/get_enc.cpp
index cdef00980..fb5952a3e 100644
--- a/src/get_enc.cpp
+++ b/src/get_enc.cpp
@@ -6,9 +6,12 @@
#include <botan/lookup.h>
#include <botan/libstate.h>
#include <botan/parsing.h>
-#include <botan/mgf1.h>
#include <botan/util.h>
+#if defined(BOTAN_HAS_MGF1)
+ #include <botan/mgf1.h>
+#endif
+
#if defined(BOTAN_HAS_EMSA1)
#include <botan/emsa1.h>
#endif
@@ -202,11 +205,13 @@ MGF* get_mgf(const std::string& algo_spec)
std::vector<std::string> name = parse_algorithm_name(algo_spec);
const std::string mgf_name = global_state().deref_alias(name[0]);
+#ifdef BOTAN_HAS_MGF1
if(mgf_name == "MGF1")
{
if(name.size() == 2)
return new MGF1(get_hash(name[1]));
}
+#endif
throw Algorithm_Not_Found(algo_spec);
}
diff --git a/src/mgf1.cpp b/src/kdf/mgf1/mgf1.cpp
index c2cda7f4c..c2cda7f4c 100644
--- a/src/mgf1.cpp
+++ b/src/kdf/mgf1/mgf1.cpp
diff --git a/src/kdf/mgf1/mgf1.h b/src/kdf/mgf1/mgf1.h
new file mode 100644
index 000000000..c235821bf
--- /dev/null
+++ b/src/kdf/mgf1/mgf1.h
@@ -0,0 +1,33 @@
+/*************************************************
+* MGF1 Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_MGF1_H__
+#define BOTAN_MGF1_H__
+
+#include <botan/pk_util.h>
+
+namespace Botan {
+
+/*************************************************
+* MGF1 (Mask Generation Function) *
+*************************************************/
+class BOTAN_DLL MGF1 : public MGF
+ {
+ public:
+ void mask(const byte[], u32bit, byte[], u32bit) const;
+
+ /**
+ MGF1 constructor: takes ownership of hash
+ */
+ MGF1(HashFunction* hash);
+
+ ~MGF1();
+ private:
+ HashFunction* hash;
+ };
+
+}
+
+#endif
diff --git a/src/pk_pad/eme1/modinfo.txt b/src/pk_pad/eme1/modinfo.txt
index 5383d59b6..dafb595c1 100644
--- a/src/pk_pad/eme1/modinfo.txt
+++ b/src/pk_pad/eme1/modinfo.txt
@@ -8,3 +8,7 @@ load_on auto
eme1.h
eme1.cpp
</add>
+
+<requires>
+mgf1
+</requires>
diff --git a/src/pk_pad/emsa4/modinfo.txt b/src/pk_pad/emsa4/modinfo.txt
index 39a34c619..e37d72d77 100644
--- a/src/pk_pad/emsa4/modinfo.txt
+++ b/src/pk_pad/emsa4/modinfo.txt
@@ -8,3 +8,7 @@ load_on auto
emsa4.h
emsa4.cpp
</add>
+
+<requires>
+mgf1
+</requires>