aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/cast
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/block/cast
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/block/cast')
-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
4 files changed, 6 insertions, 6 deletions
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];