aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-18 22:37:19 +0000
committerlloyd <[email protected]>2014-01-18 22:37:19 +0000
commit700ae0440c1fac65a218fc2ae5883bdc63683f08 (patch)
treefaab5bcdf076b2e25a783755c3f7792f93869c6a /src/lib/pubkey
parenta769d409b252f62d97e9f71dd38a7131f8b8155e (diff)
More unique_ptr
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r--src/lib/pubkey/dlies/dlies.cpp12
-rw-r--r--src/lib/pubkey/dlies/dlies.h13
2 files changed, 5 insertions, 20 deletions
diff --git a/src/lib/pubkey/dlies/dlies.cpp b/src/lib/pubkey/dlies/dlies.cpp
index 715b55a36..a969eaec7 100644
--- a/src/lib/pubkey/dlies/dlies.cpp
+++ b/src/lib/pubkey/dlies/dlies.cpp
@@ -25,12 +25,6 @@ DLIES_Encryptor::DLIES_Encryptor(const PK_Key_Agreement_Key& key,
my_key = key.public_value();
}
-DLIES_Encryptor::~DLIES_Encryptor()
- {
- delete kdf;
- delete mac;
- }
-
/*
* DLIES Encryption
*/
@@ -99,12 +93,6 @@ DLIES_Decryptor::DLIES_Decryptor(const PK_Key_Agreement_Key& key,
my_key = key.public_value();
}
-DLIES_Decryptor::~DLIES_Decryptor()
- {
- delete kdf;
- delete mac;
- }
-
/*
* DLIES Decryption
*/
diff --git a/src/lib/pubkey/dlies/dlies.h b/src/lib/pubkey/dlies/dlies.h
index 9739afeb2..643ef95c5 100644
--- a/src/lib/pubkey/dlies/dlies.h
+++ b/src/lib/pubkey/dlies/dlies.h
@@ -11,6 +11,7 @@
#include <botan/pubkey.h>
#include <botan/mac.h>
#include <botan/kdf.h>
+#include <memory>
namespace Botan {
@@ -25,8 +26,6 @@ class BOTAN_DLL DLIES_Encryptor : public PK_Encryptor
MessageAuthenticationCode* mac,
size_t mac_key_len = 20);
- ~DLIES_Encryptor();
-
void set_other_key(const std::vector<byte>&);
private:
std::vector<byte> enc(const byte[], size_t,
@@ -37,8 +36,8 @@ class BOTAN_DLL DLIES_Encryptor : public PK_Encryptor
std::vector<byte> other_key, my_key;
PK_Key_Agreement ka;
- KDF* kdf;
- MessageAuthenticationCode* mac;
+ std::unique_ptr<KDF> kdf;
+ std::unique_ptr<MessageAuthenticationCode> mac;
size_t mac_keylen;
};
@@ -53,16 +52,14 @@ class BOTAN_DLL DLIES_Decryptor : public PK_Decryptor
MessageAuthenticationCode* mac,
size_t mac_key_len = 20);
- ~DLIES_Decryptor();
-
private:
secure_vector<byte> dec(const byte[], size_t) const;
std::vector<byte> my_key;
PK_Key_Agreement ka;
- KDF* kdf;
- MessageAuthenticationCode* mac;
+ std::unique_ptr<KDF> kdf;
+ std::unique_ptr<MessageAuthenticationCode> mac;
size_t mac_keylen;
};