aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-13 21:51:07 +0000
committerlloyd <[email protected]>2010-09-13 21:51:07 +0000
commit3a8202e6c0a372e222d03744686241e8101829d3 (patch)
tree4fec1a844575e5fdfbba2e0b57f439368706f1b2
parentd34529a53979bc5be37c37f0250ad358c1f18e1c (diff)
Remove constructors of MemoryVector and SecureVector that took two
MemoryRegions and concatenated them.
-rw-r--r--src/alloc/secmem.h18
-rw-r--r--src/pubkey/dlies/dlies.cpp6
-rw-r--r--src/ssl/handshake_hash.cpp10
-rw-r--r--src/sym_algo/symkey.cpp5
4 files changed, 16 insertions, 23 deletions
diff --git a/src/alloc/secmem.h b/src/alloc/secmem.h
index c87035a1e..194a78e5f 100644
--- a/src/alloc/secmem.h
+++ b/src/alloc/secmem.h
@@ -320,15 +320,6 @@ class MemoryVector : public MemoryRegion<T>
*/
MemoryVector(const MemoryRegion<T>& in)
{ init(false); set(&in[0], in.size()); }
-
- /**
- * Create a buffer whose content is the concatenation of two other
- * buffers.
- * @param in1 the first part of the new contents
- * @param in2 the contents to be appended to in1
- */
- MemoryVector(const MemoryRegion<T>& in1, const MemoryRegion<T>& in2)
- { init(false); set(&in1[0], in1.size()); append(in2); }
};
/**
@@ -389,15 +380,6 @@ class SecureVector : public MemoryRegion<T>
else
set(&in[0], in.size());
}
-
- /**
- * Create a buffer whose content is the concatenation of two other
- * buffers.
- * @param in1 the first part of the new contents
- * @param in2 the contents to be appended to in1
- */
- SecureVector(const MemoryRegion<T>& in1, const MemoryRegion<T>& in2)
- { init(true); set(&in1[0], in1.size()); append(in2); }
};
/**
diff --git a/src/pubkey/dlies/dlies.cpp b/src/pubkey/dlies/dlies.cpp
index 07477fd5d..5dd557b6f 100644
--- a/src/pubkey/dlies/dlies.cpp
+++ b/src/pubkey/dlies/dlies.cpp
@@ -46,7 +46,8 @@ 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;
+ vz.append(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());
@@ -118,7 +119,8 @@ 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(msg, my_key.size());
+ vz.append(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/ssl/handshake_hash.cpp b/src/ssl/handshake_hash.cpp
index 2331d015e..fb9f5f9f4 100644
--- a/src/ssl/handshake_hash.cpp
+++ b/src/ssl/handshake_hash.cpp
@@ -23,7 +23,10 @@ SecureVector<byte> HandshakeHash::final()
md5.update(data);
sha1.update(data);
- return SecureVector<byte>(md5.final(), sha1.final());
+ SecureVector<byte> output;
+ output.append(md5.final());
+ output.append(sha1.final());
+ return output;
}
/**
@@ -54,7 +57,10 @@ SecureVector<byte> HandshakeHash::final_ssl3(const MemoryRegion<byte>& secret)
md5.update(inner_md5);
sha1.update(inner_sha1);
- return SecureVector<byte>(md5.final(), sha1.final());
+ SecureVector<byte> output;
+ output.append(md5.final());
+ output.append(sha1.final());
+ return output;
}
}
diff --git a/src/sym_algo/symkey.cpp b/src/sym_algo/symkey.cpp
index c7533d256..160149b01 100644
--- a/src/sym_algo/symkey.cpp
+++ b/src/sym_algo/symkey.cpp
@@ -116,7 +116,10 @@ bool operator!=(const OctetString& s1, const OctetString& s2)
*/
OctetString operator+(const OctetString& k1, const OctetString& k2)
{
- return OctetString(SecureVector<byte>(k1.bits_of(), k2.bits_of()));
+ SecureVector<byte> out;
+ out.append(k1.bits_of());
+ out.append(k2.bits_of());
+ return OctetString(out);
}
/*