aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/cast/cast128.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-13 15:21:31 +0000
committerlloyd <[email protected]>2010-09-13 15:21:31 +0000
commit4a7e9edcc92b08a285ea24549fd8c813d10b63b9 (patch)
tree569e357cbc1bd2b195c1b10b281f6c0bbf01fd33 /src/block/cast/cast128.cpp
parent27d79c87365105d6128afe9eaf8a82383976ed44 (diff)
First set of changes for avoiding use implicit vector->pointer conversions
Diffstat (limited to 'src/block/cast/cast128.cpp')
-rw-r--r--src/block/cast/cast128.cpp9
1 files changed, 5 insertions, 4 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)];