From caca7f9ec2e725ee066e5dfa7ce437fd8020a2b6 Mon Sep 17 00:00:00 2001 From: Karel Kubicek Date: Fri, 13 Apr 2018 09:22:17 +0200 Subject: [PATCH] Kasumi cipher fixed round reduction --- streams/block/ciphers/kasumi/kasumi.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/streams/block/ciphers/kasumi/kasumi.cpp b/streams/block/ciphers/kasumi/kasumi.cpp index 28898525..2705a1a2 100644 --- a/streams/block/ciphers/kasumi/kasumi.cpp +++ b/streams/block/ciphers/kasumi/kasumi.cpp @@ -208,12 +208,12 @@ R = FI(R ^ K[4], K[5]) ^ L; L = FI(L ^ K[6], K[7]) ^ R; - if (j +1 == rounds) - break; - R = B2 ^= R; L = B3 ^= L; + if (j + 1 == rounds) + break; + R = FI(R ^ K[10], K[11]) ^ L; L = FI(L ^ K[12], K[13]) ^ R; R = FI(R ^ K[14], K[15]) ^ L; @@ -257,12 +257,12 @@ L ^= (rotl<1>(R) & K[8]); R ^= (rotl<1>(L) | K[9]); - if (j + 1 == rounds) - break; - R = B0 ^= R; L = B1 ^= L; + if (j + 1 == rounds) + break; + L ^= (rotl<1>(R) & K[0]); R ^= (rotl<1>(L) | K[1]);