aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/dh
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-03-14 04:31:24 +0000
committerlloyd <[email protected]>2015-03-14 04:31:24 +0000
commitccfcb3af8b8404f998aba895ddfc7f3d4405fdd5 (patch)
tree9b4d1ba62249681622051a92758a3dc3c82bfd6d /src/lib/pubkey/dh
parentd8ab5899e9f8c8d9987cec78fed34365b5ad0ee9 (diff)
In PK encrypt/decrypt move pad calls to the operation. This allows an
op to use a padding scheme outside of our knowledge or control, for instance an OpenSSL RSA op which uses OpenSSL's padding code. Similar change for key agreement and KDFs for the same reason. Add an EME_Raw type; previously this operation was implicit in the code in pubkey.cpp
Diffstat (limited to 'src/lib/pubkey/dh')
-rw-r--r--src/lib/pubkey/dh/dh.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/pubkey/dh/dh.cpp b/src/lib/pubkey/dh/dh.cpp
index be411c5d8..57310efae 100644
--- a/src/lib/pubkey/dh/dh.cpp
+++ b/src/lib/pubkey/dh/dh.cpp
@@ -82,13 +82,13 @@ namespace {
/**
* DH operation
*/
-class DH_KA_Operation : public PK_Ops::Key_Agreement
+class DH_KA_Operation : public PK_Ops::Key_Agreement_with_KDF
{
public:
typedef DH_PrivateKey Key_Type;
- DH_KA_Operation(const DH_PrivateKey& key, const std::string&);
+ DH_KA_Operation(const DH_PrivateKey& key, const std::string& kdf);
- secure_vector<byte> agree(const byte w[], size_t w_len);
+ secure_vector<byte> raw_agree(const byte w[], size_t w_len);
private:
const BigInt& m_p;
@@ -96,7 +96,8 @@ class DH_KA_Operation : public PK_Ops::Key_Agreement
Blinder m_blinder;
};
-DH_KA_Operation::DH_KA_Operation(const DH_PrivateKey& dh, const std::string&) :
+DH_KA_Operation::DH_KA_Operation(const DH_PrivateKey& dh, const std::string& kdf) :
+ PK_Ops::Key_Agreement_with_KDF(kdf),
m_p(dh.group_p()),
m_powermod_x_p(dh.get_x(), m_p),
m_blinder(m_p,
@@ -105,7 +106,7 @@ DH_KA_Operation::DH_KA_Operation(const DH_PrivateKey& dh, const std::string&) :
{
}
-secure_vector<byte> DH_KA_Operation::agree(const byte w[], size_t w_len)
+secure_vector<byte> DH_KA_Operation::raw_agree(const byte w[], size_t w_len)
{
BigInt input = BigInt::decode(w, w_len);