aboutsummaryrefslogtreecommitdiffstats
path: root/src/kdf/prf_tls
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-05-18 20:32:36 +0000
committerlloyd <[email protected]>2012-05-18 20:32:36 +0000
commitc691561f3198f481c13457433efbccc1c9fcd898 (patch)
treea45ea2c5a30e0cb009fbcb68a61ef39332ff790c /src/kdf/prf_tls
parentd76700f01c7ecac5633edf75f8d7408b46c5dbac (diff)
Fairly huge update that replaces the old secmem types with std::vector
using a custom allocator. Currently our allocator just does new/delete with a memset before deletion, and the mmap and mlock allocators have been removed.
Diffstat (limited to 'src/kdf/prf_tls')
-rw-r--r--src/kdf/prf_tls/prf_tls.cpp14
-rw-r--r--src/kdf/prf_tls/prf_tls.h4
2 files changed, 9 insertions, 9 deletions
diff --git a/src/kdf/prf_tls/prf_tls.cpp b/src/kdf/prf_tls/prf_tls.cpp
index 1236e13c7..006b418c9 100644
--- a/src/kdf/prf_tls/prf_tls.cpp
+++ b/src/kdf/prf_tls/prf_tls.cpp
@@ -18,7 +18,7 @@ namespace {
/*
* TLS PRF P_hash function
*/
-void P_hash(MemoryRegion<byte>& output,
+void P_hash(secure_vector<byte>& output,
MessageAuthenticationCode* mac,
const byte secret[], size_t secret_len,
const byte seed[], size_t seed_len)
@@ -34,7 +34,7 @@ void P_hash(MemoryRegion<byte>& output,
" bytes is too long for the PRF");
}
- SecureVector<byte> A(seed, seed_len);
+ secure_vector<byte> A(seed, seed + seed_len);
size_t offset = 0;
@@ -47,7 +47,7 @@ void P_hash(MemoryRegion<byte>& output,
mac->update(A);
mac->update(seed, seed_len);
- SecureVector<byte> block = mac->final();
+ secure_vector<byte> block = mac->final();
xor_buf(&output[offset], &block[0], this_block_len);
offset += this_block_len;
@@ -74,11 +74,11 @@ TLS_PRF::~TLS_PRF()
/*
* TLS PRF
*/
-SecureVector<byte> TLS_PRF::derive(size_t key_len,
+secure_vector<byte> TLS_PRF::derive(size_t key_len,
const byte secret[], size_t secret_len,
const byte seed[], size_t seed_len) const
{
- SecureVector<byte> output(key_len);
+ secure_vector<byte> output(key_len);
size_t S1_len = (secret_len + 1) / 2,
S2_len = (secret_len + 1) / 2;
@@ -103,11 +103,11 @@ TLS_12_PRF::~TLS_12_PRF()
delete hmac;
}
-SecureVector<byte> TLS_12_PRF::derive(size_t key_len,
+secure_vector<byte> TLS_12_PRF::derive(size_t key_len,
const byte secret[], size_t secret_len,
const byte seed[], size_t seed_len) const
{
- SecureVector<byte> output(key_len);
+ secure_vector<byte> output(key_len);
P_hash(output, hmac, secret, secret_len, seed, seed_len);
diff --git a/src/kdf/prf_tls/prf_tls.h b/src/kdf/prf_tls/prf_tls.h
index 5237f17c0..fce11eae0 100644
--- a/src/kdf/prf_tls/prf_tls.h
+++ b/src/kdf/prf_tls/prf_tls.h
@@ -20,7 +20,7 @@ namespace Botan {
class BOTAN_DLL TLS_PRF : public KDF
{
public:
- SecureVector<byte> derive(size_t key_len,
+ secure_vector<byte> derive(size_t key_len,
const byte secret[], size_t secret_len,
const byte seed[], size_t seed_len) const;
@@ -40,7 +40,7 @@ class BOTAN_DLL TLS_PRF : public KDF
class BOTAN_DLL TLS_12_PRF : public KDF
{
public:
- SecureVector<byte> derive(size_t key_len,
+ secure_vector<byte> derive(size_t key_len,
const byte secret[], size_t secret_len,
const byte seed[], size_t seed_len) const;