aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/log.txt4
-rw-r--r--src/block/gost_28147/gost_28147.cpp15
2 files changed, 10 insertions, 9 deletions
diff --git a/doc/log.txt b/doc/log.txt
index 7ff2023b9..b85df4db0 100644
--- a/doc/log.txt
+++ b/doc/log.txt
@@ -1,8 +1,8 @@
* 1.8.2-pre, 2009-??-??
- Make entropy polling more flexible and in most cases faster
- - Change GOST to use the GostR3411_94_TestParamSet sboxes
- - Another atempt at fixing botan-config on MacOS X
+ - GOST 28147 now supports multiple sbox parameters
+ - Fix botan-config problems on MacOS X
* 1.8.1, 2009-01-20
- Avoid a valgrind warning in es_unix.cpp on 32-bit Linux
diff --git a/src/block/gost_28147/gost_28147.cpp b/src/block/gost_28147/gost_28147.cpp
index 18fd38d30..bfd092c56 100644
--- a/src/block/gost_28147/gost_28147.cpp
+++ b/src/block/gost_28147/gost_28147.cpp
@@ -53,6 +53,7 @@ GOST_28147_89_Params::GOST_28147_89_Params(const std::string& n) : name(n)
GOST_28147_89::GOST_28147_89(const GOST_28147_89_Params& param) :
BlockCipher(8, 32)
{
+ // Convert the parallel 4x4 sboxes into larger word-based sboxes
for(size_t i = 0; i != 4; ++i)
for(size_t j = 0; j != 256; ++j)
{
@@ -66,19 +67,19 @@ GOST_28147_89::GOST_28147_89(const GOST_28147_89_Params& param) :
* Two rounds of GOST
*/
#define GOST_2ROUND(N1, N2, R1, R2) \
- { \
+ do { \
u32bit T0 = N1 + EK[R1]; \
N2 ^= SBOX[get_byte(3, T0)] | \
SBOX[get_byte(2, T0)+256] | \
SBOX[get_byte(1, T0)+512] | \
SBOX[get_byte(0, T0)+768]; \
\
- T0 = N2 + EK[R2]; \
- N1 ^= SBOX[get_byte(3, T0)] | \
- SBOX[get_byte(2, T0)+256] | \
- SBOX[get_byte(1, T0)+512] | \
- SBOX[get_byte(0, T0)+768]; \
- }
+ u32bit T1 = N2 + EK[R2]; \
+ N1 ^= SBOX[get_byte(3, T1)] | \
+ SBOX[get_byte(2, T1)+256] | \
+ SBOX[get_byte(1, T1)+512] | \
+ SBOX[get_byte(0, T1)+768]; \
+ } while(0)
/*
* GOST Encryption