From 8ad82f3f660eabe7b63218db8c1d79340dac4c76 Mon Sep 17 00:00:00 2001 From: Uri Blumenthal Date: Fri, 16 Sep 2016 12:36:05 -0400 Subject: [PATCH] $%^@! 448 bits is 56 bytes, not 58!!! Fixing that oversight. --- mars.h | 2 +- validat1.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mars.h b/mars.h index f2502e62..0e41cd16 100644 --- a/mars.h +++ b/mars.h @@ -13,7 +13,7 @@ NAMESPACE_BEGIN(CryptoPP) //! \class MARS_Info //! \brief MARS block cipher information -struct MARS_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 58, 8> +struct MARS_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 56, 8> { CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "MARS";} }; diff --git a/validat1.cpp b/validat1.cpp index 5874f774..86680d92 100644 --- a/validat1.cpp +++ b/validat1.cpp @@ -2500,8 +2500,8 @@ bool ValidateMARS() pass1 = enc.StaticGetValidKeyLength(16) == 16 && pass1; pass1 = enc.StaticGetValidKeyLength(24) == 24 && pass1; pass1 = enc.StaticGetValidKeyLength(32) == 32 && pass1; - pass1 = enc.StaticGetValidKeyLength(64) == 58 && pass1; - pass1 = enc.StaticGetValidKeyLength(128) == 58 && pass1; + pass1 = enc.StaticGetValidKeyLength(64) == 56 && pass1; + pass1 = enc.StaticGetValidKeyLength(128) == 56 && pass1; pass1 = enc.StaticGetValidKeyLength(0) == enc.MinKeyLength() && pass1; pass1 = enc.StaticGetValidKeyLength(SIZE_MAX) == enc.MaxKeyLength() && pass1; @@ -2510,8 +2510,8 @@ bool ValidateMARS() pass2 = dec.StaticGetValidKeyLength(16) == 16 && pass2; pass2 = dec.StaticGetValidKeyLength(24) == 24 && pass2; pass2 = dec.StaticGetValidKeyLength(32) == 32 && pass2; - pass2 = dec.StaticGetValidKeyLength(64) == 58 && pass2; - pass2 = dec.StaticGetValidKeyLength(128) == 58 && pass2; + pass2 = dec.StaticGetValidKeyLength(64) == 56 && pass2; + pass2 = dec.StaticGetValidKeyLength(128) == 56 && pass2; pass2 = dec.StaticGetValidKeyLength(0) == dec.MinKeyLength() && pass2; pass2 = dec.StaticGetValidKeyLength(SIZE_MAX) == dec.MaxKeyLength() && pass2; cout << (pass1 && pass2 ? "passed:" : "FAILED:") << " Algorithm key lengths\n";