aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-02-14 01:47:43 +0000
committerlloyd <[email protected]>2010-02-14 01:47:43 +0000
commit7a318571d030c467d387c64cdf08cc99ca9974d6 (patch)
treefe44ff795195fb181787b35c33c9368fe77e4389
parent3c8bfb624e321e5a56938fc27f9312cfd3d23d97 (diff)
Fix leaks in several of the cipher mode filters. Introduced by the
removal of the cipher mode base class, which handled deleting the cipher object.
-rw-r--r--src/filters/modes/cbc/cbc.h4
-rw-r--r--src/filters/modes/cfb/cfb.h4
-rw-r--r--src/filters/modes/cts/cts.h4
-rw-r--r--src/filters/modes/xts/xts.h2
4 files changed, 12 insertions, 2 deletions
diff --git a/src/filters/modes/cbc/cbc.h b/src/filters/modes/cbc/cbc.h
index b303a841f..6d9092041 100644
--- a/src/filters/modes/cbc/cbc.h
+++ b/src/filters/modes/cbc/cbc.h
@@ -39,7 +39,7 @@ class BOTAN_DLL CBC_Encryption : public Keyed_Filter,
const SymmetricKey& key,
const InitializationVector& iv);
- ~CBC_Encryption() { delete padder; }
+ ~CBC_Encryption() { delete cipher; delete padder; }
private:
void buffered_block(const byte input[], u32bit input_length);
void buffered_final(const byte input[], u32bit input_length);
@@ -76,7 +76,7 @@ class BOTAN_DLL CBC_Decryption : public Keyed_Filter,
const SymmetricKey& key,
const InitializationVector& iv);
- ~CBC_Decryption() { delete padder; }
+ ~CBC_Decryption() { delete cipher; delete padder; }
private:
void buffered_block(const byte input[], u32bit input_length);
void buffered_final(const byte input[], u32bit input_length);
diff --git a/src/filters/modes/cfb/cfb.h b/src/filters/modes/cfb/cfb.h
index 917125e46..249ae21db 100644
--- a/src/filters/modes/cfb/cfb.h
+++ b/src/filters/modes/cfb/cfb.h
@@ -34,6 +34,8 @@ class BOTAN_DLL CFB_Encryption : public Keyed_Filter
const SymmetricKey& key,
const InitializationVector& iv,
u32bit feedback = 0);
+
+ ~CFB_Encryption() { delete cipher; }
private:
void write(const byte[], u32bit);
@@ -63,6 +65,8 @@ class BOTAN_DLL CFB_Decryption : public Keyed_Filter
const SymmetricKey& key,
const InitializationVector& iv,
u32bit feedback = 0);
+
+ ~CFB_Decryption() { delete cipher; }
private:
void write(const byte[], u32bit);
diff --git a/src/filters/modes/cts/cts.h b/src/filters/modes/cts/cts.h
index 4a7513fa0..c15fa9510 100644
--- a/src/filters/modes/cts/cts.h
+++ b/src/filters/modes/cts/cts.h
@@ -33,6 +33,8 @@ class BOTAN_DLL CTS_Encryption : public Keyed_Filter
CTS_Encryption(BlockCipher* cipher,
const SymmetricKey& key,
const InitializationVector& iv);
+
+ ~CTS_Encryption() { delete cipher; }
private:
void write(const byte[], u32bit);
void end_msg();
@@ -63,6 +65,8 @@ class BOTAN_DLL CTS_Decryption : public Keyed_Filter
CTS_Decryption(BlockCipher* cipher,
const SymmetricKey& key,
const InitializationVector& iv);
+
+ ~CTS_Decryption() { delete cipher; }
private:
void write(const byte[], u32bit);
void end_msg();
diff --git a/src/filters/modes/xts/xts.h b/src/filters/modes/xts/xts.h
index 724085d9d..a01b1da1d 100644
--- a/src/filters/modes/xts/xts.h
+++ b/src/filters/modes/xts/xts.h
@@ -68,6 +68,8 @@ class BOTAN_DLL XTS_Decryption : public Keyed_Filter,
XTS_Decryption(BlockCipher* ciph,
const SymmetricKey& key,
const InitializationVector& iv);
+
+ ~XTS_Decryption() { delete cipher; delete cipher2; }
private:
void write(const byte[], u32bit);
void end_msg();