aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/rec_wri.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-07-05 15:09:33 +0000
committerlloyd <[email protected]>2012-07-05 15:09:33 +0000
commit2f94d5c85d3eb05a3d2f83e7783fb8d1bc2d5536 (patch)
tree03c2dfe5bc79f9c753a7b24086e811c641e0f6b3 /src/tls/rec_wri.cpp
parentefa00d7ffddc9a41b1fe74ed863bc7debfc44359 (diff)
Record_Writer needs a PRNG for the IV generation. Share the reference
with the channel object instead of calling the global object.
Diffstat (limited to 'src/tls/rec_wri.cpp')
-rw-r--r--src/tls/rec_wri.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tls/rec_wri.cpp b/src/tls/rec_wri.cpp
index d18ab6594..082cdd880 100644
--- a/src/tls/rec_wri.cpp
+++ b/src/tls/rec_wri.cpp
@@ -22,10 +22,12 @@ namespace TLS {
/*
* Record_Writer Constructor
*/
-Record_Writer::Record_Writer(std::function<void (const byte[], size_t)> out) :
+Record_Writer::Record_Writer(std::function<void (const byte[], size_t)> out,
+ RandomNumberGenerator& rng) :
m_output_fn(out),
m_writebuf(TLS_HEADER_SIZE + MAX_CIPHERTEXT_SIZE),
- m_mac(nullptr)
+ m_mac(nullptr),
+ m_rng(rng)
{
reset();
set_maximum_fragment_size(0);
@@ -258,8 +260,7 @@ void Record_Writer::send_record(byte type, const byte input[], size_t length)
if(m_iv_size)
{
- RandomNumberGenerator& rng = global_state().global_rng();
- rng.randomize(buf_write_ptr, m_iv_size);
+ m_rng.randomize(buf_write_ptr, m_iv_size);
buf_write_ptr += m_iv_size;
}