aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/dlies
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-08 15:36:18 +0000
committerlloyd <[email protected]>2010-03-08 15:36:18 +0000
commit8a47f6f2bbf169a2ea0853234f81b49070c770df (patch)
tree2633ed0d927faf23a067aa88d6cceb9de29f0be4 /src/pubkey/dlies
parent05f6d6c8edec9907778f362c927f368140fee6a2 (diff)
Modify pubkey classes to take names instead of object pointers.
Remove use of look_pk from the source and examples, instead instantiate classes directly.
Diffstat (limited to 'src/pubkey/dlies')
-rw-r--r--src/pubkey/dlies/dlies.cpp11
-rw-r--r--src/pubkey/dlies/dlies.h4
2 files changed, 6 insertions, 9 deletions
diff --git a/src/pubkey/dlies/dlies.cpp b/src/pubkey/dlies/dlies.cpp
index 2253f84d5..07477fd5d 100644
--- a/src/pubkey/dlies/dlies.cpp
+++ b/src/pubkey/dlies/dlies.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/dlies.h>
-#include <botan/look_pk.h>
#include <botan/internal/xor_buf.h>
namespace Botan {
@@ -18,7 +17,7 @@ DLIES_Encryptor::DLIES_Encryptor(const PK_Key_Agreement_Key& key,
KDF* kdf_obj,
MessageAuthenticationCode* mac_obj,
u32bit mac_kl) :
- ka(get_pk_kas(key, "Raw")),
+ ka(key, "Raw"),
kdf(kdf_obj),
mac(mac_obj),
mac_keylen(mac_kl)
@@ -28,7 +27,6 @@ DLIES_Encryptor::DLIES_Encryptor(const PK_Key_Agreement_Key& key,
DLIES_Encryptor::~DLIES_Encryptor()
{
- delete ka;
delete kdf;
delete mac;
}
@@ -48,7 +46,7 @@ SecureVector<byte> DLIES_Encryptor::enc(const byte in[], u32bit length,
out.copy(my_key, my_key.size());
out.copy(my_key.size(), in, length);
- SecureVector<byte> vz(my_key, ka->derive_key(0, other_key).bits_of());
+ SecureVector<byte> vz(my_key, ka.derive_key(0, other_key).bits_of());
const u32bit K_LENGTH = length + mac_keylen;
OctetString K = kdf->derive_key(K_LENGTH, vz, vz.size());
@@ -92,7 +90,7 @@ DLIES_Decryptor::DLIES_Decryptor(const PK_Key_Agreement_Key& key,
KDF* kdf_obj,
MessageAuthenticationCode* mac_obj,
u32bit mac_kl) :
- ka(get_pk_kas(key, "Raw")),
+ ka(key, "Raw"),
kdf(kdf_obj),
mac(mac_obj),
mac_keylen(mac_kl)
@@ -102,7 +100,6 @@ DLIES_Decryptor::DLIES_Decryptor(const PK_Key_Agreement_Key& key,
DLIES_Decryptor::~DLIES_Decryptor()
{
- delete ka;
delete kdf;
delete mac;
}
@@ -121,7 +118,7 @@ SecureVector<byte> DLIES_Decryptor::dec(const byte msg[], u32bit length) const
SecureVector<byte> C(msg + my_key.size(), CIPHER_LEN);
SecureVector<byte> T(msg + my_key.size() + CIPHER_LEN, mac->OUTPUT_LENGTH);
- SecureVector<byte> vz(v, ka->derive_key(0, v).bits_of());
+ SecureVector<byte> vz(v, ka.derive_key(0, v).bits_of());
const u32bit K_LENGTH = C.size() + mac_keylen;
OctetString K = kdf->derive_key(K_LENGTH, vz, vz.size());
diff --git a/src/pubkey/dlies/dlies.h b/src/pubkey/dlies/dlies.h
index e8b87a091..fd2cefe4a 100644
--- a/src/pubkey/dlies/dlies.h
+++ b/src/pubkey/dlies/dlies.h
@@ -35,7 +35,7 @@ class BOTAN_DLL DLIES_Encryptor : public PK_Encryptor
SecureVector<byte> other_key, my_key;
- PK_Key_Agreement* ka;
+ PK_Key_Agreement ka;
KDF* kdf;
MessageAuthenticationCode* mac;
u32bit mac_keylen;
@@ -59,7 +59,7 @@ class BOTAN_DLL DLIES_Decryptor : public PK_Decryptor
SecureVector<byte> my_key;
- PK_Key_Agreement* ka;
+ PK_Key_Agreement ka;
KDF* kdf;
MessageAuthenticationCode* mac;
u32bit mac_keylen;