From 8a47f6f2bbf169a2ea0853234f81b49070c770df Mon Sep 17 00:00:00 2001 From: lloyd Date: Mon, 8 Mar 2010 15:36:18 +0000 Subject: Modify pubkey classes to take names instead of object pointers. Remove use of look_pk from the source and examples, instead instantiate classes directly. --- src/pubkey/dlies/dlies.cpp | 11 ++++------- src/pubkey/dlies/dlies.h | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src/pubkey/dlies') 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 -#include #include 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 DLIES_Encryptor::enc(const byte in[], u32bit length, out.copy(my_key, my_key.size()); out.copy(my_key.size(), in, length); - SecureVector vz(my_key, ka->derive_key(0, other_key).bits_of()); + SecureVector 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 DLIES_Decryptor::dec(const byte msg[], u32bit length) const SecureVector C(msg + my_key.size(), CIPHER_LEN); SecureVector T(msg + my_key.size() + CIPHER_LEN, mac->OUTPUT_LENGTH); - SecureVector vz(v, ka->derive_key(0, v).bits_of()); + SecureVector 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 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 my_key; - PK_Key_Agreement* ka; + PK_Key_Agreement ka; KDF* kdf; MessageAuthenticationCode* mac; u32bit mac_keylen; -- cgit v1.2.3