aboutsummaryrefslogtreecommitdiffstats
path: root/src/stream
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-11-29 18:58:54 +0000
committerlloyd <[email protected]>2012-11-29 18:58:54 +0000
commit12c128c1fbb483ae9042b47fc544adf0e55d0693 (patch)
tree46aa39dcfb055c84778fa842a2d66249f6d175c8 /src/stream
parent2d8dff7079d4a8eabd848bd0e88b38a2112b333e (diff)
Add new helper zap which zeros a vector, clears it, and then calls
shrink_to_fit to actually deallocate memory.
Diffstat (limited to 'src/stream')
-rw-r--r--src/stream/arc4/arc4.cpp4
-rw-r--r--src/stream/salsa20/salsa20.cpp4
-rw-r--r--src/stream/turing/turing.cpp12
-rw-r--r--src/stream/wid_wake/wid_wake.cpp8
4 files changed, 14 insertions, 14 deletions
diff --git a/src/stream/arc4/arc4.cpp b/src/stream/arc4/arc4.cpp
index 16c6058d2..da1694a96 100644
--- a/src/stream/arc4/arc4.cpp
+++ b/src/stream/arc4/arc4.cpp
@@ -96,8 +96,8 @@ std::string ARC4::name() const
*/
void ARC4::clear()
{
- state.clear();
- buffer.clear();
+ zap(state);
+ zap(buffer);
position = X = Y = 0;
}
diff --git a/src/stream/salsa20/salsa20.cpp b/src/stream/salsa20/salsa20.cpp
index a7d1b2622..d8db69ae6 100644
--- a/src/stream/salsa20/salsa20.cpp
+++ b/src/stream/salsa20/salsa20.cpp
@@ -235,8 +235,8 @@ std::string Salsa20::name() const
*/
void Salsa20::clear()
{
- state.clear();
- buffer.clear();
+ zap(state);
+ zap(buffer);
position = 0;
}
diff --git a/src/stream/turing/turing.cpp b/src/stream/turing/turing.cpp
index bdc53cff1..8d9b6f090 100644
--- a/src/stream/turing/turing.cpp
+++ b/src/stream/turing/turing.cpp
@@ -320,12 +320,12 @@ void Turing::set_iv(const byte iv[], size_t length)
*/
void Turing::clear()
{
- S0.clear();
- S1.clear();
- S2.clear();
- S3.clear();
- R.clear();
- K.clear();
+ zap(S0);
+ zap(S1);
+ zap(S2);
+ zap(S3);
+ zap(R);
+ zap(K);
buffer.clear();
position = 0;
}
diff --git a/src/stream/wid_wake/wid_wake.cpp b/src/stream/wid_wake/wid_wake.cpp
index 0f56148a5..317613404 100644
--- a/src/stream/wid_wake/wid_wake.cpp
+++ b/src/stream/wid_wake/wid_wake.cpp
@@ -149,11 +149,11 @@ void WiderWake_41_BE::set_iv(const byte iv[], size_t length)
*/
void WiderWake_41_BE::clear()
{
+ zap(t_key);
+ zap(state);
+ zap(T);
+ zap(buffer);
position = 0;
- t_key.clear();
- state.clear();
- T.clear();
- buffer.clear();
}
}