aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pk_pad/emsa1
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/pk_pad/emsa1')
-rw-r--r--src/lib/pk_pad/emsa1/emsa1.cpp5
-rw-r--r--src/lib/pk_pad/emsa1/emsa1.h6
2 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/pk_pad/emsa1/emsa1.cpp b/src/lib/pk_pad/emsa1/emsa1.cpp
index 0031bf263..67f8ab21f 100644
--- a/src/lib/pk_pad/emsa1/emsa1.cpp
+++ b/src/lib/pk_pad/emsa1/emsa1.cpp
@@ -40,6 +40,11 @@ secure_vector<byte> emsa1_encoding(const secure_vector<byte>& msg,
}
+EMSA* EMSA1::clone()
+ {
+ return new EMSA1(m_hash->clone());
+ }
+
void EMSA1::update(const byte input[], size_t length)
{
m_hash->update(input, length);
diff --git a/src/lib/pk_pad/emsa1/emsa1.h b/src/lib/pk_pad/emsa1/emsa1.h
index e346167da..5a4b4b372 100644
--- a/src/lib/pk_pad/emsa1/emsa1.h
+++ b/src/lib/pk_pad/emsa1/emsa1.h
@@ -25,8 +25,13 @@ class BOTAN_DLL EMSA1 : public EMSA
*/
explicit EMSA1(HashFunction* hash) : m_hash(hash) {}
+ EMSA* clone() override;
+
protected:
size_t hash_output_length() const { return m_hash->output_length(); }
+
+ std::unique_ptr<HashFunction> m_hash;
+
private:
void update(const byte[], size_t) override;
secure_vector<byte> raw_data() override;
@@ -39,7 +44,6 @@ class BOTAN_DLL EMSA1 : public EMSA
const secure_vector<byte>& raw,
size_t key_bits) override;
- std::unique_ptr<HashFunction> m_hash;
};
}