aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pbkdf
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/pbkdf')
-rw-r--r--src/lib/pbkdf/pbkdf1/pbkdf1.h12
-rw-r--r--src/lib/pbkdf/pbkdf2/pbkdf2.h10
2 files changed, 5 insertions, 17 deletions
diff --git a/src/lib/pbkdf/pbkdf1/pbkdf1.h b/src/lib/pbkdf/pbkdf1/pbkdf1.h
index 783b70ed9..2f14c3f32 100644
--- a/src/lib/pbkdf/pbkdf1/pbkdf1.h
+++ b/src/lib/pbkdf/pbkdf1/pbkdf1.h
@@ -10,6 +10,7 @@
#include <botan/pbkdf.h>
#include <botan/hash.h>
+#include <memory>
namespace Botan {
@@ -27,15 +28,6 @@ class BOTAN_DLL PKCS5_PBKDF1 : public PBKDF
*/
PKCS5_PBKDF1(HashFunction* hash_in) : hash(hash_in) {}
- /**
- * Copy constructor
- * @param other the object to copy
- */
- PKCS5_PBKDF1(const PKCS5_PBKDF1& other) :
- PBKDF(), hash(other.hash->clone()) {}
-
- ~PKCS5_PBKDF1() { delete hash; }
-
std::string name() const
{
return "PBKDF1(" + hash->name() + ")";
@@ -53,7 +45,7 @@ class BOTAN_DLL PKCS5_PBKDF1 : public PBKDF
size_t iterations,
std::chrono::milliseconds msec) const override;
private:
- HashFunction* hash;
+ std::unique_ptr<HashFunction> hash;
};
}
diff --git a/src/lib/pbkdf/pbkdf2/pbkdf2.h b/src/lib/pbkdf/pbkdf2/pbkdf2.h
index 8bc271fcf..a88f2dd31 100644
--- a/src/lib/pbkdf/pbkdf2/pbkdf2.h
+++ b/src/lib/pbkdf/pbkdf2/pbkdf2.h
@@ -10,6 +10,7 @@
#include <botan/pbkdf.h>
#include <botan/mac.h>
+#include <memory>
namespace Botan {
@@ -38,16 +39,11 @@ class BOTAN_DLL PKCS5_PBKDF2 : public PBKDF
/**
* Create a PKCS #5 instance using the specified message auth code
- * @param mac_fn the MAC to use
+ * @param mac_fn the MAC object to use as PRF
*/
PKCS5_PBKDF2(MessageAuthenticationCode* mac_fn) : mac(mac_fn) {}
-
- /**
- * Destructor
- */
- ~PKCS5_PBKDF2() { delete mac; }
private:
- MessageAuthenticationCode* mac;
+ std::unique_ptr<MessageAuthenticationCode> mac;
};
}