aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pk_pad/emsa_pssr
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-01-31 16:18:09 +0000
committerlloyd <[email protected]>2015-01-31 16:18:09 +0000
commitfd3016d10124d2b7ccd7bc885235f2e407d73800 (patch)
treee237b54c3a8d465c893a012157d9d52014eaccc9 /src/lib/pk_pad/emsa_pssr
parent00c9b3f4834603946065c15b9b2e9fa5e973b979 (diff)
Use registry also for KDF, EMSA, and EME
Diffstat (limited to 'src/lib/pk_pad/emsa_pssr')
-rw-r--r--src/lib/pk_pad/emsa_pssr/pssr.cpp19
-rw-r--r--src/lib/pk_pad/emsa_pssr/pssr.h2
2 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/pk_pad/emsa_pssr/pssr.cpp b/src/lib/pk_pad/emsa_pssr/pssr.cpp
index a7e5de6f1..3f93ca79d 100644
--- a/src/lib/pk_pad/emsa_pssr/pssr.cpp
+++ b/src/lib/pk_pad/emsa_pssr/pssr.cpp
@@ -5,13 +5,30 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
+#include <botan/internal/pad_utils.h>
#include <botan/pssr.h>
#include <botan/mgf1.h>
#include <botan/internal/bit_ops.h>
-#include <botan/internal/xor_buf.h>
namespace Botan {
+PSSR* PSSR::make(const Spec& request)
+ {
+ if(request.arg(1, "MGF1") != "MGF1")
+ return nullptr;
+
+ auto hash = make_a<HashFunction>(request.arg(0));
+
+ if(!hash)
+ return nullptr;
+
+ const size_t salt_size = request.arg_as_integer(2, hash->output_length());
+
+ return new PSSR(hash, salt_size);
+ }
+
+BOTAN_REGISTER_NAMED_T(EMSA, "PSSR", PSSR, PSSR::make);
+
/*
* PSSR Update Operation
*/
diff --git a/src/lib/pk_pad/emsa_pssr/pssr.h b/src/lib/pk_pad/emsa_pssr/pssr.h
index b5a4e393f..e51ade494 100644
--- a/src/lib/pk_pad/emsa_pssr/pssr.h
+++ b/src/lib/pk_pad/emsa_pssr/pssr.h
@@ -30,6 +30,8 @@ class BOTAN_DLL PSSR : public EMSA
* @param salt_size the size of the salt to use in bytes
*/
PSSR(HashFunction* hash, size_t salt_size);
+
+ static PSSR* make(const Spec& spec);
private:
void update(const byte input[], size_t length);