aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-23 01:17:41 +0000
committerlloyd <[email protected]>2010-03-23 01:17:41 +0000
commitd66be84b420fbb0afb6a22610cfd5b46b76a5150 (patch)
tree2a13c36cf1a0e51dc945fbc27da373bbed7123c1 /src
parentd695d7832a86c0c7f165ab8b052c59525d210966 (diff)
Remove SecureBuffer, which is the fixed-size variant of SecureVector.
Add a second template param to SecureVector which specifies the initial length. Change all callers to be SecureVector instead of SecureBuffer. This can go away in C++0x, once compilers implement N2712 ("Non-static data member initializers"), and we can just write code as SecureVector<byte> P{18}; instead
Diffstat (limited to 'src')
-rw-r--r--src/alloc/secmem.h40
-rw-r--r--src/block/aes/aes.cpp2
-rw-r--r--src/block/aes/aes.h8
-rw-r--r--src/block/aes_intel/aes_intel.h6
-rw-r--r--src/block/blowfish/blowfish.h4
-rw-r--r--src/block/cast/cast128.cpp4
-rw-r--r--src/block/cast/cast128.h2
-rw-r--r--src/block/cast/cast256.cpp2
-rw-r--r--src/block/cast/cast256.h4
-rw-r--r--src/block/des/des.h4
-rw-r--r--src/block/des/desx.h2
-rw-r--r--src/block/gost_28147/gost_28147.h6
-rw-r--r--src/block/idea/idea.h2
-rw-r--r--src/block/kasumi/kasumi.cpp2
-rw-r--r--src/block/kasumi/kasumi.h2
-rw-r--r--src/block/mars/mars.cpp2
-rw-r--r--src/block/mars/mars.h2
-rw-r--r--src/block/misty1/misty1.cpp2
-rw-r--r--src/block/misty1/misty1.h2
-rw-r--r--src/block/noekeon/noekeon.h2
-rw-r--r--src/block/rc2/rc2.cpp2
-rw-r--r--src/block/rc2/rc2.h2
-rw-r--r--src/block/rc5/rc5.cpp2
-rw-r--r--src/block/rc6/rc6.cpp2
-rw-r--r--src/block/rc6/rc6.h2
-rw-r--r--src/block/safer/safer_sk.cpp2
-rw-r--r--src/block/seed/seed.cpp2
-rw-r--r--src/block/seed/seed.h2
-rw-r--r--src/block/serpent/serpent.cpp2
-rw-r--r--src/block/serpent/serpent.h2
-rw-r--r--src/block/serpent_ia32/serp_ia32.cpp2
-rw-r--r--src/block/skipjack/skipjack.h2
-rw-r--r--src/block/square/square.cpp2
-rw-r--r--src/block/square/square.h4
-rw-r--r--src/block/tea/tea.h2
-rw-r--r--src/block/twofish/twofish.cpp2
-rw-r--r--src/block/twofish/twofish.h4
-rw-r--r--src/block/xtea/xtea.cpp2
-rw-r--r--src/block/xtea/xtea.h2
-rw-r--r--src/filters/base64/base64.cpp4
-rw-r--r--src/filters/secqueue.cpp2
-rw-r--r--src/hash/bmw/bmw_512.h4
-rw-r--r--src/hash/fork256/fork256.h4
-rw-r--r--src/hash/gost_3411/gost_3411.cpp4
-rw-r--r--src/hash/gost_3411/gost_3411.h6
-rw-r--r--src/hash/has160/has160.h4
-rw-r--r--src/hash/md2/md2.h4
-rw-r--r--src/hash/md4/md4.h4
-rw-r--r--src/hash/md5/md5.h4
-rw-r--r--src/hash/rmd128/rmd128.h4
-rw-r--r--src/hash/rmd160/rmd160.h4
-rw-r--r--src/hash/sha1/sha160.h2
-rw-r--r--src/hash/sha2/sha2_32.h4
-rw-r--r--src/hash/sha2/sha2_64.h4
-rw-r--r--src/hash/skein/skein_512.cpp2
-rw-r--r--src/hash/skein/skein_512.h6
-rw-r--r--src/hash/tiger/tiger.h4
-rw-r--r--src/hash/whirlpool/whrlpool.h2
-rw-r--r--src/mac/x919_mac/x919_mac.h2
-rw-r--r--src/stream/arc4/arc4.h4
-rw-r--r--src/stream/salsa20/salsa20.h4
-rw-r--r--src/stream/turing/turing.h6
-rw-r--r--src/stream/wid_wake/wid_wake.h8
63 files changed, 101 insertions, 137 deletions
diff --git a/src/alloc/secmem.h b/src/alloc/secmem.h
index 4f2a06683..4073167cb 100644
--- a/src/alloc/secmem.h
+++ b/src/alloc/secmem.h
@@ -337,7 +337,7 @@ class MemoryVector : public MemoryRegion<T>
* swapped out to disk. In this way, a security hole allowing attackers
* to find swapped out secret keys is closed.
*/
-template<typename T>
+template<typename T, u32bit L = 0>
class SecureVector : public MemoryRegion<T>
{
public:
@@ -353,7 +353,7 @@ class SecureVector : public MemoryRegion<T>
* Create a buffer of the specified length.
* @param n the length of the buffer to create.
*/
- SecureVector(u32bit n = 0) { MemoryRegion<T>::init(true, n); }
+ SecureVector(u32bit n = L) { MemoryRegion<T>::init(true, n); }
/**
* Create a buffer with the specified contents.
@@ -382,42 +382,6 @@ class SecureVector : public MemoryRegion<T>
{ MemoryRegion<T>::init(true); set(in1); append(in2); }
};
-/**
-* This class represents fixed length buffers using the operating
-* systems capability to lock memory, i.e. keeping it from being
-* swapped out to disk. In this way, a security hole allowing attackers
-* to find swapped out secret keys is closed.
-*/
-template<typename T, u32bit L>
-class SecureBuffer : public MemoryRegion<T>
- {
- public:
- /**
- * Copy the contents of another buffer into this buffer.
- * @param in the buffer to copy the contents from
- * @return a reference to *this
- */
- SecureBuffer<T,L>& operator=(const SecureBuffer<T,L>& in)
- { if(this != &in) set(in); return (*this); }
-
- /**
- * Create a buffer of the length L.
- */
- SecureBuffer() { MemoryRegion<T>::init(true, L); }
-
- /**
- * Create a buffer of size L with the specified contents.
- * @param in the array containing the data to be initially copied
- * into the newly created buffer
- * @param n the size of the array in
- */
- SecureBuffer(const T in[], u32bit n)
- { MemoryRegion<T>::init(true, L); copy(in, n); }
- private:
- SecureBuffer<T, L>& operator=(const MemoryRegion<T>& in)
- { if(this != &in) set(in); return (*this); }
- };
-
}
#endif
diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp
index 721c4ac75..df2674f34 100644
--- a/src/block/aes/aes.cpp
+++ b/src/block/aes/aes.cpp
@@ -594,7 +594,7 @@ void AES::key_schedule(const byte key[], u32bit length)
ROUNDS = (length / 4) + 6;
- SecureBuffer<u32bit, 64> XEK, XDK;
+ SecureVector<u32bit, 64> XEK, XDK;
const u32bit X = length / 4;
for(u32bit j = 0; j != X; ++j)
diff --git a/src/block/aes/aes.h b/src/block/aes/aes.h
index 4ff3360de..45026f732 100644
--- a/src/block/aes/aes.h
+++ b/src/block/aes/aes.h
@@ -33,11 +33,11 @@ class BOTAN_DLL AES : public BlockCipher
u32bit ROUNDS;
- SecureBuffer<u32bit, 56> EK;
- SecureBuffer<byte, 16> ME;
+ SecureVector<u32bit, 56> EK;
+ SecureVector<byte, 16> ME;
- SecureBuffer<u32bit, 56> DK;
- SecureBuffer<byte, 16> MD;
+ SecureVector<u32bit, 56> DK;
+ SecureVector<byte, 16> MD;
};
/**
diff --git a/src/block/aes_intel/aes_intel.h b/src/block/aes_intel/aes_intel.h
index 239516e24..a3ebf153b 100644
--- a/src/block/aes_intel/aes_intel.h
+++ b/src/block/aes_intel/aes_intel.h
@@ -31,7 +31,7 @@ class BOTAN_DLL AES_128_Intel : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 44> EK, DK;
+ SecureVector<u32bit, 44> EK, DK;
};
/**
@@ -53,7 +53,7 @@ class BOTAN_DLL AES_192_Intel : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 52> EK, DK;
+ SecureVector<u32bit, 52> EK, DK;
};
/**
@@ -75,7 +75,7 @@ class BOTAN_DLL AES_256_Intel : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 60> EK, DK;
+ SecureVector<u32bit, 60> EK, DK;
};
}
diff --git a/src/block/blowfish/blowfish.h b/src/block/blowfish/blowfish.h
index 5419308ca..2306f0e37 100644
--- a/src/block/blowfish/blowfish.h
+++ b/src/block/blowfish/blowfish.h
@@ -33,8 +33,8 @@ class BOTAN_DLL Blowfish : public BlockCipher
static const u32bit P_INIT[18];
static const u32bit S_INIT[1024];
- SecureBuffer<u32bit, 1024> S;
- SecureBuffer<u32bit, 18> P;
+ SecureVector<u32bit, 1024> S;
+ SecureVector<u32bit, 18> P;
};
}
diff --git a/src/block/cast/cast128.cpp b/src/block/cast/cast128.cpp
index 887dcf994..cabde4b4f 100644
--- a/src/block/cast/cast128.cpp
+++ b/src/block/cast/cast128.cpp
@@ -119,7 +119,7 @@ void CAST_128::decrypt_n(const byte in[], byte out[], u32bit blocks) const
void CAST_128::key_schedule(const byte key[], u32bit length)
{
clear();
- SecureBuffer<u32bit, 4> X;
+ SecureVector<u32bit, 4> X;
for(u32bit j = 0; j != length; ++j)
X[j/4] = (X[j/4] << 8) + key[j];
@@ -144,7 +144,7 @@ void CAST_128::key_schedule(u32bit K[16], u32bit X[4])
const u32bit* X;
};
- SecureBuffer<u32bit, 4> Z;
+ SecureVector<u32bit, 4> Z;
ByteReader x(X), z(Z);
Z[0] = X[0] ^ S5[x(13)] ^ S6[x(15)] ^ S7[x(12)] ^ S8[x(14)] ^ S7[x( 8)];
diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h
index caffb97ea..048d2e43c 100644
--- a/src/block/cast/cast128.h
+++ b/src/block/cast/cast128.h
@@ -36,7 +36,7 @@ class BOTAN_DLL CAST_128 : public BlockCipher
static const u32bit S7[256];
static const u32bit S8[256];
- SecureBuffer<u32bit, 16> MK, RK;
+ SecureVector<u32bit, 16> MK, RK;
};
extern const u32bit CAST_SBOX1[256];
diff --git a/src/block/cast/cast256.cpp b/src/block/cast/cast256.cpp
index 7a4a4e805..8aaf8009f 100644
--- a/src/block/cast/cast256.cpp
+++ b/src/block/cast/cast256.cpp
@@ -138,7 +138,7 @@ void CAST_256::decrypt_n(const byte in[], byte out[], u32bit blocks) const
*/
void CAST_256::key_schedule(const byte key[], u32bit length)
{
- SecureBuffer<u32bit, 8> TMP;
+ SecureVector<u32bit, 8> TMP;
for(u32bit j = 0; j != length; ++j)
TMP[j/4] = (TMP[j/4] << 8) + key[j];
diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h
index 0db3682ba..170d94e77 100644
--- a/src/block/cast/cast256.h
+++ b/src/block/cast/cast256.h
@@ -32,8 +32,8 @@ class BOTAN_DLL CAST_256 : public BlockCipher
static const u32bit KEY_MASK[192];
static const byte KEY_ROT[32];
- SecureBuffer<u32bit, 48> MK;
- SecureBuffer<byte, 48> RK;
+ SecureVector<u32bit, 48> MK;
+ SecureVector<byte, 48> RK;
};
extern const u32bit CAST_SBOX1[256];
diff --git a/src/block/des/des.h b/src/block/des/des.h
index b28990178..32dd3daf6 100644
--- a/src/block/des/des.h
+++ b/src/block/des/des.h
@@ -29,7 +29,7 @@ class BOTAN_DLL DES : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 32> round_key;
+ SecureVector<u32bit, 32> round_key;
};
/*
@@ -49,7 +49,7 @@ class BOTAN_DLL TripleDES : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 96> round_key;
+ SecureVector<u32bit, 96> round_key;
};
/*
diff --git a/src/block/des/desx.h b/src/block/des/desx.h
index 89664d064..440574e9d 100644
--- a/src/block/des/desx.h
+++ b/src/block/des/desx.h
@@ -28,7 +28,7 @@ class BOTAN_DLL DESX : public BlockCipher
DESX() : BlockCipher(8, 24) {}
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<byte, 8> K1, K2;
+ SecureVector<byte, 8> K1, K2;
DES des;
};
diff --git a/src/block/gost_28147/gost_28147.h b/src/block/gost_28147/gost_28147.h
index 2b7daaf6a..2ccb3214d 100644
--- a/src/block/gost_28147/gost_28147.h
+++ b/src/block/gost_28147/gost_28147.h
@@ -52,13 +52,13 @@ class BOTAN_DLL GOST_28147_89 : public BlockCipher
GOST_28147_89(const GOST_28147_89_Params& params);
private:
- GOST_28147_89(const SecureBuffer<u32bit, 1024>& other_SBOX) :
+ GOST_28147_89(const SecureVector<u32bit, 1024>& other_SBOX) :
BlockCipher(8, 32), SBOX(other_SBOX) {}
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 1024> SBOX;
- SecureBuffer<u32bit, 8> EK;
+ SecureVector<u32bit, 1024> SBOX;
+ SecureVector<u32bit, 8> EK;
};
}
diff --git a/src/block/idea/idea.h b/src/block/idea/idea.h
index 89ec117e3..1a9644d4e 100644
--- a/src/block/idea/idea.h
+++ b/src/block/idea/idea.h
@@ -28,7 +28,7 @@ class BOTAN_DLL IDEA : public BlockCipher
IDEA() : BlockCipher(8, 16) {}
protected:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u16bit, 52> EK, DK;
+ SecureVector<u16bit, 52> EK, DK;
};
}
diff --git a/src/block/kasumi/kasumi.cpp b/src/block/kasumi/kasumi.cpp
index dff6db13c..d7f981b20 100644
--- a/src/block/kasumi/kasumi.cpp
+++ b/src/block/kasumi/kasumi.cpp
@@ -204,7 +204,7 @@ void KASUMI::key_schedule(const byte key[], u32bit)
static const u16bit RC[] = { 0x0123, 0x4567, 0x89AB, 0xCDEF,
0xFEDC, 0xBA98, 0x7654, 0x3210 };
- SecureBuffer<u16bit, 16> K;
+ SecureVector<u16bit, 16> K;
for(u32bit j = 0; j != 8; ++j)
{
K[j] = load_be<u16bit>(key, j);
diff --git a/src/block/kasumi/kasumi.h b/src/block/kasumi/kasumi.h
index c3db1cb05..827989a57 100644
--- a/src/block/kasumi/kasumi.h
+++ b/src/block/kasumi/kasumi.h
@@ -29,7 +29,7 @@ class BOTAN_DLL KASUMI : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u16bit, 64> EK;
+ SecureVector<u16bit, 64> EK;
};
}
diff --git a/src/block/mars/mars.cpp b/src/block/mars/mars.cpp
index 6b73ea054..57a224fac 100644
--- a/src/block/mars/mars.cpp
+++ b/src/block/mars/mars.cpp
@@ -320,7 +320,7 @@ void MARS::decrypt_n(const byte in[], byte out[], u32bit blocks) const
*/
void MARS::key_schedule(const byte key[], u32bit length)
{
- SecureBuffer<u32bit, 15> T;
+ SecureVector<u32bit, 15> T;
for(u32bit j = 0; j != length / 4; ++j)
T[j] = load_le<u32bit>(key, j);
T[length / 4] = length / 4;
diff --git a/src/block/mars/mars.h b/src/block/mars/mars.h
index 7a598d2bd..f2a6d0197 100644
--- a/src/block/mars/mars.h
+++ b/src/block/mars/mars.h
@@ -26,7 +26,7 @@ class BOTAN_DLL MARS : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 40> EK;
+ SecureVector<u32bit, 40> EK;
};
}
diff --git a/src/block/misty1/misty1.cpp b/src/block/misty1/misty1.cpp
index 8a92824cc..9ab4d11f4 100644
--- a/src/block/misty1/misty1.cpp
+++ b/src/block/misty1/misty1.cpp
@@ -204,7 +204,7 @@ void MISTY1::decrypt_n(const byte in[], byte out[], u32bit blocks) const
*/
void MISTY1::key_schedule(const byte key[], u32bit length)
{
- SecureBuffer<u16bit, 32> KS;
+ SecureVector<u16bit, 32> KS;
for(u32bit j = 0; j != length / 2; ++j)
KS[j] = load_be<u16bit>(key, j);
diff --git a/src/block/misty1/misty1.h b/src/block/misty1/misty1.h
index 000830915..7b4d91def 100644
--- a/src/block/misty1/misty1.h
+++ b/src/block/misty1/misty1.h
@@ -29,7 +29,7 @@ class BOTAN_DLL MISTY1 : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u16bit, 100> EK, DK;
+ SecureVector<u16bit, 100> EK, DK;
};
}
diff --git a/src/block/noekeon/noekeon.h b/src/block/noekeon/noekeon.h
index 22ef65342..abeecbc64 100644
--- a/src/block/noekeon/noekeon.h
+++ b/src/block/noekeon/noekeon.h
@@ -31,7 +31,7 @@ class BOTAN_DLL Noekeon : public BlockCipher
static const byte RC[17];
- SecureBuffer<u32bit, 4> EK, DK;
+ SecureVector<u32bit, 4> EK, DK;
};
}
diff --git a/src/block/rc2/rc2.cpp b/src/block/rc2/rc2.cpp
index b5e4a7d50..3114c6055 100644
--- a/src/block/rc2/rc2.cpp
+++ b/src/block/rc2/rc2.cpp
@@ -124,7 +124,7 @@ void RC2::key_schedule(const byte key[], u32bit length)
0xC5, 0xF3, 0xDB, 0x47, 0xE5, 0xA5, 0x9C, 0x77, 0x0A, 0xA6, 0x20, 0x68,
0xFE, 0x7F, 0xC1, 0xAD };
- SecureBuffer<byte, 128> L;
+ SecureVector<byte, 128> L;
L.copy(key, length);
for(u32bit j = length; j != 128; ++j)
diff --git a/src/block/rc2/rc2.h b/src/block/rc2/rc2.h
index c6e4946f9..dd0295572 100644
--- a/src/block/rc2/rc2.h
+++ b/src/block/rc2/rc2.h
@@ -31,7 +31,7 @@ class BOTAN_DLL RC2 : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u16bit, 64> K;
+ SecureVector<u16bit, 64> K;
};
}
diff --git a/src/block/rc5/rc5.cpp b/src/block/rc5/rc5.cpp
index 0bd596b10..dcda1bb25 100644
--- a/src/block/rc5/rc5.cpp
+++ b/src/block/rc5/rc5.cpp
@@ -82,7 +82,7 @@ void RC5::key_schedule(const byte key[], u32bit length)
for(u32bit j = 1; j != S.size(); ++j)
S[j] = S[j-1] + 0x9E3779B9;
- SecureBuffer<u32bit, 8> K;
+ SecureVector<u32bit, 8> K;
for(s32bit j = length-1; j >= 0; --j)
K[j/4] = (K[j/4] << 8) + key[j];
for(u32bit j = 0, A = 0, B = 0; j != MIX_ROUNDS; ++j)
diff --git a/src/block/rc6/rc6.cpp b/src/block/rc6/rc6.cpp
index 8bda62259..ff846f006 100644
--- a/src/block/rc6/rc6.cpp
+++ b/src/block/rc6/rc6.cpp
@@ -119,7 +119,7 @@ void RC6::key_schedule(const byte key[], u32bit length)
for(u32bit j = 1; j != S.size(); ++j)
S[j] = S[j-1] + 0x9E3779B9;
- SecureBuffer<u32bit, 8> K;
+ SecureVector<u32bit, 8> K;
for(s32bit j = length-1; j >= 0; --j)
K[j/4] = (K[j/4] << 8) + key[j];
for(u32bit j = 0, A = 0, B = 0; j != MIX_ROUNDS; ++j)
diff --git a/src/block/rc6/rc6.h b/src/block/rc6/rc6.h
index 6cd0f54db..cc1534ee2 100644
--- a/src/block/rc6/rc6.h
+++ b/src/block/rc6/rc6.h
@@ -29,7 +29,7 @@ class BOTAN_DLL RC6 : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 44> S;
+ SecureVector<u32bit, 44> S;
};
}
diff --git a/src/block/safer/safer_sk.cpp b/src/block/safer/safer_sk.cpp
index eb5c22fc9..74e7b6298 100644
--- a/src/block/safer/safer_sk.cpp
+++ b/src/block/safer/safer_sk.cpp
@@ -91,7 +91,7 @@ void SAFER_SK::decrypt_n(const byte in[], byte out[], u32bit blocks) const
*/
void SAFER_SK::key_schedule(const byte key[], u32bit)
{
- SecureBuffer<byte, 18> KB;
+ SecureVector<byte, 18> KB;
for(u32bit j = 0; j != 8; ++j)
{
diff --git a/src/block/seed/seed.cpp b/src/block/seed/seed.cpp
index 378be16e4..651233bdb 100644
--- a/src/block/seed/seed.cpp
+++ b/src/block/seed/seed.cpp
@@ -111,7 +111,7 @@ void SEED::key_schedule(const byte key[], u32bit)
0x779B99E3, 0xEF3733C6, 0xDE6E678D, 0xBCDCCF1B
};
- SecureBuffer<u32bit, 4> WK;
+ SecureVector<u32bit, 4> WK;
for(u32bit j = 0; j != 4; ++j)
WK[j] = load_be<u32bit>(key, j);
diff --git a/src/block/seed/seed.h b/src/block/seed/seed.h
index 5a4b44057..e56b77dbb 100644
--- a/src/block/seed/seed.h
+++ b/src/block/seed/seed.h
@@ -37,7 +37,7 @@ class BOTAN_DLL SEED : public BlockCipher
static const u32bit S0[256], S1[256], S2[256], S3[256];
};
- SecureBuffer<u32bit, 32> K;
+ SecureVector<u32bit, 32> K;
};
}
diff --git a/src/block/serpent/serpent.cpp b/src/block/serpent/serpent.cpp
index e16afc89c..b93326e58 100644
--- a/src/block/serpent/serpent.cpp
+++ b/src/block/serpent/serpent.cpp
@@ -355,7 +355,7 @@ void Serpent::key_schedule(const byte key[], u32bit length)
{
const u32bit PHI = 0x9E3779B9;
- SecureBuffer<u32bit, 140> W;
+ SecureVector<u32bit, 140> W;
for(u32bit j = 0; j != length / 4; ++j)
W[j] = load_le<u32bit>(key, j);
diff --git a/src/block/serpent/serpent.h b/src/block/serpent/serpent.h
index 4fa7451b9..37ce10c7b 100644
--- a/src/block/serpent/serpent.h
+++ b/src/block/serpent/serpent.h
@@ -28,7 +28,7 @@ class BOTAN_DLL Serpent : public BlockCipher
protected:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 132> round_key;
+ SecureVector<u32bit, 132> round_key;
};
}
diff --git a/src/block/serpent_ia32/serp_ia32.cpp b/src/block/serpent_ia32/serp_ia32.cpp
index 721584b18..ff454ab4c 100644
--- a/src/block/serpent_ia32/serp_ia32.cpp
+++ b/src/block/serpent_ia32/serp_ia32.cpp
@@ -49,7 +49,7 @@ void Serpent_IA32::decrypt_n(const byte in[], byte out[], u32bit blocks) const
*/
void Serpent_IA32::key_schedule(const byte key[], u32bit length)
{
- SecureBuffer<u32bit, 140> W;
+ SecureVector<u32bit, 140> W;
for(u32bit j = 0; j != length / 4; ++j)
W[j] = load_le<u32bit>(key, j);
W[length / 4] |= u32bit(1) << ((length%4)*8);
diff --git a/src/block/skipjack/skipjack.h b/src/block/skipjack/skipjack.h
index b701e2091..d481aee08 100644
--- a/src/block/skipjack/skipjack.h
+++ b/src/block/skipjack/skipjack.h
@@ -29,7 +29,7 @@ class BOTAN_DLL Skipjack : public BlockCipher
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<byte, 2560> FTAB;
+ SecureVector<byte, 2560> FTAB;
};
}
diff --git a/src/block/square/square.cpp b/src/block/square/square.cpp
index 892568655..adcf18611 100644
--- a/src/block/square/square.cpp
+++ b/src/block/square/square.cpp
@@ -140,7 +140,7 @@ void Square::decrypt_n(const byte in[], byte out[], u32bit blocks) const
*/
void Square::key_schedule(const byte key[], u32bit)
{
- SecureBuffer<u32bit, 36> XEK, XDK;
+ SecureVector<u32bit, 36> XEK, XDK;
for(u32bit i = 0; i != 4; ++i)
XEK[i] = load_be<u32bit>(key, i);
diff --git a/src/block/square/square.h b/src/block/square/square.h
index 088122181..8e1f7f815 100644
--- a/src/block/square/square.h
+++ b/src/block/square/square.h
@@ -45,8 +45,8 @@ class BOTAN_DLL Square : public BlockCipher
static const u32bit TD2[256];
static const u32bit TD3[256];
- SecureBuffer<u32bit, 28> EK, DK;
- SecureBuffer<byte, 32> ME, MD;
+ SecureVector<u32bit, 28> EK, DK;
+ SecureVector<byte, 32> ME, MD;
};
}
diff --git a/src/block/tea/tea.h b/src/block/tea/tea.h
index c19f272a6..152c9a905 100644
--- a/src/block/tea/tea.h
+++ b/src/block/tea/tea.h
@@ -28,7 +28,7 @@ class BOTAN_DLL TEA : public BlockCipher
TEA() : BlockCipher(8, 16) {}
private:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 4> K;
+ SecureVector<u32bit, 4> K;
};
}
diff --git a/src/block/twofish/twofish.cpp b/src/block/twofish/twofish.cpp
index 3136837aa..a183821b2 100644
--- a/src/block/twofish/twofish.cpp
+++ b/src/block/twofish/twofish.cpp
@@ -118,7 +118,7 @@ void Twofish::decrypt_n(const byte in[], byte out[], u32bit blocks) const
*/
void Twofish::key_schedule(const byte key[], u32bit length)
{
- SecureBuffer<byte, 16> S;
+ SecureVector<byte, 16> S;
for(u32bit j = 0; j != length; ++j)
rs_mul(S + 4*(j/8), key[j], j);
diff --git a/src/block/twofish/twofish.h b/src/block/twofish/twofish.h
index 71a1e8781..7600abca8 100644
--- a/src/block/twofish/twofish.h
+++ b/src/block/twofish/twofish.h
@@ -41,8 +41,8 @@ class BOTAN_DLL Twofish : public BlockCipher
static const byte EXP_TO_POLY[255];
static const byte POLY_TO_EXP[255];
- SecureBuffer<u32bit, 256> SBox0, SBox1, SBox2, SBox3;
- SecureBuffer<u32bit, 40> round_key;
+ SecureVector<u32bit, 256> SBox0, SBox1, SBox2, SBox3;
+ SecureVector<u32bit, 40> round_key;
};
}
diff --git a/src/block/xtea/xtea.cpp b/src/block/xtea/xtea.cpp
index fc14c0a57..bb1a30374 100644
--- a/src/block/xtea/xtea.cpp
+++ b/src/block/xtea/xtea.cpp
@@ -121,7 +121,7 @@ void XTEA::decrypt_n(const byte in[], byte out[], u32bit blocks) const
*/
void XTEA::key_schedule(const byte key[], u32bit)
{
- SecureBuffer<u32bit, 4> UK;
+ SecureVector<u32bit, 4> UK;
for(u32bit i = 0; i != 4; ++i)
UK[i] = load_be<u32bit>(key, i);
diff --git a/src/block/xtea/xtea.h b/src/block/xtea/xtea.h
index 9982d0712..940992dfa 100644
--- a/src/block/xtea/xtea.h
+++ b/src/block/xtea/xtea.h
@@ -28,7 +28,7 @@ class BOTAN_DLL XTEA : public BlockCipher
XTEA() : BlockCipher(8, 16) {}
protected:
void key_schedule(const byte[], u32bit);
- SecureBuffer<u32bit, 64> EK;
+ SecureVector<u32bit, 64> EK;
};
}
diff --git a/src/filters/base64/base64.cpp b/src/filters/base64/base64.cpp
index 9110dc57e..e342f7109 100644
--- a/src/filters/base64/base64.cpp
+++ b/src/filters/base64/base64.cpp
@@ -107,7 +107,7 @@ void Base64_Encoder::end_msg()
if(left_over)
{
- SecureBuffer<byte, 3> remainder(in + start_of_last_block, left_over);
+ SecureVector<byte, 3> remainder(in + start_of_last_block, left_over);
encode(remainder, out);
@@ -217,7 +217,7 @@ void Base64_Decoder::end_msg()
if(left_over)
{
- SecureBuffer<byte, 4> remainder(in + start_of_last_block, left_over);
+ SecureVector<byte, 4> remainder(in + start_of_last_block, left_over);
decode(remainder, out);
send(out, ((left_over == 1) ? (1) : (left_over - 1)));
}
diff --git a/src/filters/secqueue.cpp b/src/filters/secqueue.cpp
index f63ef898c..c8d1c5fbf 100644
--- a/src/filters/secqueue.cpp
+++ b/src/filters/secqueue.cpp
@@ -44,7 +44,7 @@ class SecureQueueNode
private:
friend class SecureQueue;
SecureQueueNode* next;
- SecureBuffer<byte, DEFAULT_BUFFERSIZE> buffer;
+ SecureVector<byte, DEFAULT_BUFFERSIZE> buffer;
u32bit start, end;
};
diff --git a/src/hash/bmw/bmw_512.h b/src/hash/bmw/bmw_512.h
index 8130a88e4..c1c5238bd 100644
--- a/src/hash/bmw/bmw_512.h
+++ b/src/hash/bmw/bmw_512.h
@@ -23,8 +23,8 @@ class BOTAN_DLL BMW_512 : public MDx_HashFunction
void compress_n(const byte input[], u32bit blocks);
void copy_out(byte output[]);
- SecureBuffer<u64bit, 16> H, M;
- SecureBuffer<u64bit, 32> Q;
+ SecureVector<u64bit, 16> H, M;
+ SecureVector<u64bit, 32> Q;
};
}
diff --git a/src/hash/fork256/fork256.h b/src/hash/fork256/fork256.h
index f535370e6..ed945b9d8 100644
--- a/src/hash/fork256/fork256.h
+++ b/src/hash/fork256/fork256.h
@@ -26,8 +26,8 @@ class BOTAN_DLL FORK_256 : public MDx_HashFunction
void compress_n(const byte[], u32bit blocks);
void copy_out(byte[]);
- SecureBuffer<u32bit, 8> digest;
- SecureBuffer<u32bit, 16> M;
+ SecureVector<u32bit, 8> digest;
+ SecureVector<u32bit, 16> M;
};
}
diff --git a/src/hash/gost_3411/gost_3411.cpp b/src/hash/gost_3411/gost_3411.cpp
index 244a3fddf..f09b0fc60 100644
--- a/src/hash/gost_3411/gost_3411.cpp
+++ b/src/hash/gost_3411/gost_3411.cpp
@@ -223,11 +223,11 @@ void GOST_34_11::final_result(byte out[])
compress_n(buffer, 1);
}
- SecureBuffer<byte, 32> length_buf;
+ SecureVector<byte, 32> length_buf;
const u64bit bit_count = count * 8;
store_le(bit_count, length_buf);
- SecureBuffer<byte, 32> sum_buf(sum);
+ SecureVector<byte, 32> sum_buf(sum);
compress_n(length_buf, 1);
compress_n(sum_buf, 1);
diff --git a/src/hash/gost_3411/gost_3411.h b/src/hash/gost_3411/gost_3411.h
index 7b17bdc1f..d2bada7ab 100644
--- a/src/hash/gost_3411/gost_3411.h
+++ b/src/hash/gost_3411/gost_3411.h
@@ -31,9 +31,9 @@ class BOTAN_DLL GOST_34_11 : public HashFunction
void final_result(byte[]);
GOST_28147_89 cipher;
- SecureBuffer<byte, 32> buffer;
- SecureBuffer<byte, 32> sum;
- SecureBuffer<byte, 32> hash;
+ SecureVector<byte, 32> buffer;
+ SecureVector<byte, 32> sum;
+ SecureVector<byte, 32> hash;
u64bit count;
u32bit position;
};
diff --git a/src/hash/has160/has160.h b/src/hash/has160/has160.h
index cae66c93a..210145484 100644
--- a/src/hash/has160/has160.h
+++ b/src/hash/has160/has160.h
@@ -26,8 +26,8 @@ class BOTAN_DLL HAS_160 : public MDx_HashFunction
void compress_n(const byte[], u32bit blocks);
void copy_out(byte[]);
- SecureBuffer<u32bit, 20> X;
- SecureBuffer<u32bit, 5> digest;
+ SecureVector<u32bit, 20> X;
+ SecureVector<u32bit, 5> digest;
};
}
diff --git a/src/hash/md2/md2.h b/src/hash/md2/md2.h
index 0a7125759..df056dc12 100644
--- a/src/hash/md2/md2.h
+++ b/src/hash/md2/md2.h
@@ -27,8 +27,8 @@ class BOTAN_DLL MD2 : public HashFunction
void hash(const byte[]);
void final_result(byte[]);
- SecureBuffer<byte, 48> X;
- SecureBuffer<byte, 16> checksum, buffer;
+ SecureVector<byte, 48> X;
+ SecureVector<byte, 16> checksum, buffer;
u32bit position;
};
diff --git a/src/hash/md4/md4.h b/src/hash/md4/md4.h
index 0bff5a4ce..843727f6d 100644
--- a/src/hash/md4/md4.h
+++ b/src/hash/md4/md4.h
@@ -27,8 +27,8 @@ class BOTAN_DLL MD4 : public MDx_HashFunction
void hash_old(const byte[]);
void copy_out(byte[]);
- SecureBuffer<u32bit, 16> M;
- SecureBuffer<u32bit, 4> digest;
+ SecureVector<u32bit, 16> M;
+ SecureVector<u32bit, 4> digest;
};
}
diff --git a/src/hash/md5/md5.h b/src/hash/md5/md5.h
index 456a02c28..d1f294a87 100644
--- a/src/hash/md5/md5.h
+++ b/src/hash/md5/md5.h
@@ -26,8 +26,8 @@ class BOTAN_DLL MD5 : public MDx_HashFunction
void compress_n(const byte[], u32bit blocks);
void copy_out(byte[]);
- SecureBuffer<u32bit, 16> M;
- SecureBuffer<u32bit, 4> digest;
+ SecureVector<u32bit, 16> M;
+ SecureVector<u32bit, 4> digest;
};
}
diff --git a/src/hash/rmd128/rmd128.h b/src/hash/rmd128/rmd128.h
index d9cb4ebb4..9ae43483c 100644
--- a/src/hash/rmd128/rmd128.h
+++ b/src/hash/rmd128/rmd128.h
@@ -26,8 +26,8 @@ class BOTAN_DLL RIPEMD_128 : public MDx_HashFunction
void compress_n(const byte[], u32bit blocks);
void copy_out(byte[]);
- SecureBuffer<u32bit, 16> M;
- SecureBuffer<u32bit, 4> digest;
+ SecureVector<u32bit, 16> M;
+ SecureVector<u32bit, 4> digest;
};
}
diff --git a/src/hash/rmd160/rmd160.h b/src/hash/rmd160/rmd160.h
index aee007b98..399d5a7c3 100644
--- a/src/hash/rmd160/rmd160.h
+++ b/src/hash/rmd160/rmd160.h
@@ -26,8 +26,8 @@ class BOTAN_DLL RIPEMD_160 : public MDx_HashFunction
void compress_n(const byte[], u32bit blocks);
void copy_out(byte[]);
- SecureBuffer<u32bit, 16> M;
- SecureBuffer<u32bit, 5> digest;
+ SecureVector<u32bit, 16> M;
+ SecureVector<u32bit, 5> digest;
};
}
diff --git a/src/hash/sha1/sha160.h b/src/hash/sha1/sha160.h
index 142c6bf17..cb7e63821 100644
--- a/src/hash/sha1/sha160.h
+++ b/src/hash/sha1/sha160.h
@@ -29,7 +29,7 @@ class BOTAN_DLL SHA_160 : public MDx_HashFunction
void compress_n(const byte[], u32bit blocks);
void copy_out(byte[]);
- SecureBuffer<u32bit, 5> digest;
+ SecureVector<u32bit, 5> digest;
SecureVector<u32bit> W;
};
diff --git a/src/hash/sha2/sha2_32.h b/src/hash/sha2/sha2_32.h
index 313eec676..e157fd657 100644
--- a/src/hash/sha2/sha2_32.h
+++ b/src/hash/sha2/sha2_32.h
@@ -23,8 +23,8 @@ class BOTAN_DLL SHA_224_256_BASE : public MDx_HashFunction
SHA_224_256_BASE(u32bit out) :
MDx_HashFunction(out, 64, true, true) { clear(); }
- SecureBuffer<u32bit, 64> W;
- SecureBuffer<u32bit, 8> digest;
+ SecureVector<u32bit, 64> W;
+ SecureVector<u32bit, 8> digest;
private:
void compress_n(const byte[], u32bit blocks);
void copy_out(byte[]);
diff --git a/src/hash/sha2/sha2_64.h b/src/hash/sha2/sha2_64.h
index 8e4d171f8..ed261b1c2 100644
--- a/src/hash/sha2/sha2_64.h
+++ b/src/hash/sha2/sha2_64.h
@@ -23,12 +23,12 @@ class BOTAN_DLL SHA_384_512_BASE : public MDx_HashFunction
SHA_384_512_BASE(u32bit out) :
MDx_HashFunction(out, 128, true, true, 16) {}
- SecureBuffer<u64bit, 8> digest;
+ SecureVector<u64bit, 8> digest;
private:
void compress_n(const byte[], u32bit blocks);
void copy_out(byte[]);
- SecureBuffer<u64bit, 80> W;
+ SecureVector<u64bit, 80> W;
};
/*
diff --git a/src/hash/skein/skein_512.cpp b/src/hash/skein/skein_512.cpp
index cb4b7a7a2..3b716e8f5 100644
--- a/src/hash/skein/skein_512.cpp
+++ b/src/hash/skein/skein_512.cpp
@@ -234,7 +234,7 @@ void Skein_512::final_result(byte out[])
u32bit out_bytes = output_bits / 8;
- SecureBuffer<u64bit, 9> H_out;
+ SecureVector<u64bit, 9> H_out;
while(out_bytes)
{
diff --git a/src/hash/skein/skein_512.h b/src/hash/skein/skein_512.h
index db8d3c8b7..222db5d68 100644
--- a/src/hash/skein/skein_512.h
+++ b/src/hash/skein/skein_512.h
@@ -29,10 +29,10 @@ class BOTAN_DLL Skein_512 : public HashFunction
std::string personalization;
u32bit output_bits;
- SecureBuffer<u64bit, 9> H;
- SecureBuffer<u64bit, 3> T;
+ SecureVector<u64bit, 9> H;
+ SecureVector<u64bit, 3> T;
- SecureBuffer<byte, 64> buffer;
+ SecureVector<byte, 64> buffer;
u32bit buf_pos;
};
diff --git a/src/hash/tiger/tiger.h b/src/hash/tiger/tiger.h
index 20dcf99ff..918e2de3c 100644
--- a/src/hash/tiger/tiger.h
+++ b/src/hash/tiger/tiger.h
@@ -33,8 +33,8 @@ class BOTAN_DLL Tiger : public MDx_HashFunction
static const u64bit SBOX3[256];
static const u64bit SBOX4[256];
- SecureBuffer<u64bit, 8> X;
- SecureBuffer<u64bit, 3> digest;
+ SecureVector<u64bit, 8> X;
+ SecureVector<u64bit, 3> digest;
const u32bit PASS;
};
diff --git a/src/hash/whirlpool/whrlpool.h b/src/hash/whirlpool/whrlpool.h
index 34b4d2302..4711fafa3 100644
--- a/src/hash/whirlpool/whrlpool.h
+++ b/src/hash/whirlpool/whrlpool.h
@@ -34,7 +34,7 @@ class BOTAN_DLL Whirlpool : public MDx_HashFunction
static const u64bit C5[256];
static const u64bit C6[256];
static const u64bit C7[256];
- SecureBuffer<u64bit, 8> M, digest;
+ SecureVector<u64bit, 8> M, digest;
};
}
diff --git a/src/mac/x919_mac/x919_mac.h b/src/mac/x919_mac/x919_mac.h
index a4690fdcd..abd149ecd 100644
--- a/src/mac/x919_mac/x919_mac.h
+++ b/src/mac/x919_mac/x919_mac.h
@@ -32,7 +32,7 @@ class BOTAN_DLL ANSI_X919_MAC : public MessageAuthenticationCode
BlockCipher* e;
BlockCipher* d;
- SecureBuffer<byte, 8> state;
+ SecureVector<byte, 8> state;
u32bit position;
};
diff --git a/src/stream/arc4/arc4.h b/src/stream/arc4/arc4.h
index ae37cb165..07633f9ef 100644
--- a/src/stream/arc4/arc4.h
+++ b/src/stream/arc4/arc4.h
@@ -34,8 +34,8 @@ class BOTAN_DLL ARC4 : public StreamCipher
const u32bit SKIP;
- SecureBuffer<byte, DEFAULT_BUFFERSIZE> buffer;
- SecureBuffer<u32bit, 256> state;
+ SecureVector<byte, DEFAULT_BUFFERSIZE> buffer;
+ SecureVector<u32bit, 256> state;
u32bit X, Y, position;
};
diff --git a/src/stream/salsa20/salsa20.h b/src/stream/salsa20/salsa20.h
index af7ddd145..67fe54dda 100644
--- a/src/stream/salsa20/salsa20.h
+++ b/src/stream/salsa20/salsa20.h
@@ -34,8 +34,8 @@ class BOTAN_DLL Salsa20 : public StreamCipher
private:
void key_schedule(const byte key[], u32bit key_len);
- SecureBuffer<u32bit, 16> state;
- SecureBuffer<byte, 64> buffer;
+ SecureVector<u32bit, 16> state;
+ SecureVector<byte, 64> buffer;
u32bit position;
};
diff --git a/src/stream/turing/turing.h b/src/stream/turing/turing.h
index 7291647ea..19d151fca 100644
--- a/src/stream/turing/turing.h
+++ b/src/stream/turing/turing.h
@@ -37,10 +37,10 @@ class BOTAN_DLL Turing : public StreamCipher
static const u32bit Q_BOX[256];
static const byte SBOX[256];
- SecureBuffer<u32bit, 256> S0, S1, S2, S3;
- SecureBuffer<u32bit, 17> R;
+ SecureVector<u32bit, 256> S0, S1, S2, S3;
+ SecureVector<u32bit, 17> R;
SecureVector<u32bit> K;
- SecureBuffer<byte, 340> buffer;
+ SecureVector<byte, 340> buffer;
u32bit position;
};
diff --git a/src/stream/wid_wake/wid_wake.h b/src/stream/wid_wake/wid_wake.h
index 23e1eacab..1c52e8ba1 100644
--- a/src/stream/wid_wake/wid_wake.h
+++ b/src/stream/wid_wake/wid_wake.h
@@ -33,10 +33,10 @@ class BOTAN_DLL WiderWake_41_BE : public StreamCipher
void generate(u32bit);
- SecureBuffer<byte, DEFAULT_BUFFERSIZE> buffer;
- SecureBuffer<u32bit, 256> T;
- SecureBuffer<u32bit, 5> state;
- SecureBuffer<u32bit, 4> t_key;
+ SecureVector<byte, DEFAULT_BUFFERSIZE> buffer;
+ SecureVector<u32bit, 256> T;
+ SecureVector<u32bit, 5> state;
+ SecureVector<u32bit, 4> t_key;
u32bit position;
};