diff options
author | lloyd <[email protected]> | 2010-03-23 01:17:41 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-23 01:17:41 +0000 |
commit | d66be84b420fbb0afb6a22610cfd5b46b76a5150 (patch) | |
tree | 2a13c36cf1a0e51dc945fbc27da373bbed7123c1 /src/block | |
parent | d695d7832a86c0c7f165ab8b052c59525d210966 (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/block')
38 files changed, 51 insertions, 51 deletions
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; }; } |