diff options
author | lloyd <[email protected]> | 2010-09-13 15:21:31 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-09-13 15:21:31 +0000 |
commit | 4a7e9edcc92b08a285ea24549fd8c813d10b63b9 (patch) | |
tree | 569e357cbc1bd2b195c1b10b281f6c0bbf01fd33 /src/block/cast | |
parent | 27d79c87365105d6128afe9eaf8a82383976ed44 (diff) |
First set of changes for avoiding use implicit vector->pointer conversions
Diffstat (limited to 'src/block/cast')
-rw-r--r-- | src/block/cast/cast128.cpp | 9 | ||||
-rw-r--r-- | src/block/cast/cast128.h | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/block/cast/cast128.cpp b/src/block/cast/cast128.cpp index cabde4b4f..b68b7abd7 100644 --- a/src/block/cast/cast128.cpp +++ b/src/block/cast/cast128.cpp @@ -123,8 +123,8 @@ void CAST_128::key_schedule(const byte key[], u32bit length) for(u32bit j = 0; j != length; ++j) X[j/4] = (X[j/4] << 8) + key[j]; - key_schedule(MK, X); - key_schedule(RK, X); + cast_ks(MK, X); + cast_ks(RK, X); for(u32bit j = 0; j != 16; ++j) RK[j] %= 32; @@ -133,7 +133,8 @@ void CAST_128::key_schedule(const byte key[], u32bit length) /* * S-Box Based Key Expansion */ -void CAST_128::key_schedule(u32bit K[16], u32bit X[4]) +void CAST_128::cast_ks(MemoryRegion<u32bit>& K, + MemoryRegion<u32bit>& X) { class ByteReader { @@ -145,7 +146,7 @@ void CAST_128::key_schedule(u32bit K[16], u32bit X[4]) }; SecureVector<u32bit, 4> Z; - ByteReader x(X), z(Z); + ByteReader x(&X[0]), z(&Z[0]); Z[0] = X[0] ^ S5[x(13)] ^ S6[x(15)] ^ S7[x(12)] ^ S8[x(14)] ^ S7[x( 8)]; Z[1] = X[2] ^ S5[z( 0)] ^ S6[z( 2)] ^ S7[z( 1)] ^ S8[z( 3)] ^ S8[x(10)]; diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h index e5d4a884b..425eb46cc 100644 --- a/src/block/cast/cast128.h +++ b/src/block/cast/cast128.h @@ -29,7 +29,8 @@ class BOTAN_DLL CAST_128 : public BlockCipher private: void key_schedule(const byte[], u32bit); - static void key_schedule(u32bit[16], u32bit[4]); + static void cast_ks(MemoryRegion<u32bit>& ks, + MemoryRegion<u32bit>& user_key); static const u32bit S5[256]; static const u32bit S6[256]; |