aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/xtea
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-10-23 01:26:05 +0000
committerlloyd <[email protected]>2009-10-23 01:26:05 +0000
commit7cb65e4e768115b9475d6e14c4fe7660c481e841 (patch)
treeb7df3fadc1b2533acbe4f1008c4550597eefe0c9 /src/block/xtea
parentfd1e0bcf053a1f154604ecd6dcd82f7e06a5726c (diff)
Use new load/store ops in xtea x4 code
Diffstat (limited to 'src/block/xtea')
-rw-r--r--src/block/xtea/xtea.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/block/xtea/xtea.cpp b/src/block/xtea/xtea.cpp
index 83c7d9ce5..1179d011a 100644
--- a/src/block/xtea/xtea.cpp
+++ b/src/block/xtea/xtea.cpp
@@ -16,10 +16,8 @@ namespace {
void xtea_encrypt_4(const byte in[32], byte out[32], const u32bit EK[64])
{
- u32bit L0 = load_be<u32bit>(in, 0), R0 = load_be<u32bit>(in, 1);
- u32bit L1 = load_be<u32bit>(in, 2), R1 = load_be<u32bit>(in, 3);
- u32bit L2 = load_be<u32bit>(in, 4), R2 = load_be<u32bit>(in, 5);
- u32bit L3 = load_be<u32bit>(in, 6), R3 = load_be<u32bit>(in, 7);
+ u32bit L0, R0, L1, R1, L2, R2, L3, R3;
+ load_be(in, L0, R0, L1, R1, L2, R2, L3, R3);
for(u32bit i = 0; i != 32; ++i)
{
@@ -34,16 +32,13 @@ void xtea_encrypt_4(const byte in[32], byte out[32], const u32bit EK[64])
R3 += (((L3 << 4) ^ (L3 >> 5)) + L3) ^ EK[2*i+1];
}
- store_be(out , L0, R0, L1, R1);
- store_be(out + 16, L2, R2, L3, R3);
+ store_be(out, L0, R0, L1, R1, L2, R2, L3, R3);
}
void xtea_decrypt_4(const byte in[32], byte out[32], const u32bit EK[64])
{
- u32bit L0 = load_be<u32bit>(in, 0), R0 = load_be<u32bit>(in, 1);
- u32bit L1 = load_be<u32bit>(in, 2), R1 = load_be<u32bit>(in, 3);
- u32bit L2 = load_be<u32bit>(in, 4), R2 = load_be<u32bit>(in, 5);
- u32bit L3 = load_be<u32bit>(in, 6), R3 = load_be<u32bit>(in, 7);
+ u32bit L0, R0, L1, R1, L2, R2, L3, R3;
+ load_be(in, L0, R0, L1, R1, L2, R2, L3, R3);
for(u32bit i = 0; i != 32; ++i)
{
@@ -58,8 +53,7 @@ void xtea_decrypt_4(const byte in[32], byte out[32], const u32bit EK[64])
L3 -= (((R3 << 4) ^ (R3 >> 5)) + R3) ^ EK[62 - 2*i];
}
- store_be(out , L0, R0, L1, R1);
- store_be(out + 16, L2, R2, L3, R3);
+ store_be(out, L0, R0, L1, R1, L2, R2, L3, R3);
}
}