From 88bc98fa2507eef8597c2030be9643c9f55ad004 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 5 Sep 2016 09:37:51 -0400 Subject: [PATCH] Modify "Algorithm key lengths" output format --- validat1.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/validat1.cpp b/validat1.cpp index 88507451..92f582c9 100644 --- a/validat1.cpp +++ b/validat1.cpp @@ -2007,7 +2007,6 @@ bool ValidateRijndael() pass1 = enc.StaticGetValidKeyLength(32) == 32 && pass1; pass1 = enc.StaticGetValidKeyLength(64) == 32 && pass1; pass1 = enc.StaticGetValidKeyLength(128) == 32 && pass1; - cout << (pass1 ? "passed:" : "FAILED:") << " RijndaelEncryption StaticGetValidKeyLength\n"; RijndaelDecryption dec; pass2 = dec.StaticGetValidKeyLength(8) == 16 && pass2; @@ -2016,7 +2015,7 @@ bool ValidateRijndael() pass2 = dec.StaticGetValidKeyLength(32) == 32 && pass2; pass2 = dec.StaticGetValidKeyLength(64) == 32 && pass2; pass2 = dec.StaticGetValidKeyLength(128) == 32 && pass2; - cout << (pass2 ? "passed:" : "FAILED:") << " RijndaelDecryption StaticGetValidKeyLength\n"; + cout << (pass1 && pass2 ? "passed:" : "FAILED:") << " Algorithm key lengths\n"; FileSource valdata(CRYPTOPP_DATA_DIR "TestData/rijndael.dat", true, new HexDecoder); pass3 = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass3; @@ -2032,22 +2031,21 @@ bool ValidateTwofish() bool pass1 = true, pass2 = true, pass3 = true; TwofishEncryption enc; - // pass1 = enc.StaticGetValidKeyLength(8) == 16 && pass1; + pass1 = enc.StaticGetValidKeyLength(8) == 16 && pass1; pass1 = enc.StaticGetValidKeyLength(16) == 16 && pass1; pass1 = enc.StaticGetValidKeyLength(24) == 24 && pass1; pass1 = enc.StaticGetValidKeyLength(32) == 32 && pass1; - // pass1 = enc.StaticGetValidKeyLength(64) == 32 && pass1; - // pass1 = enc.StaticGetValidKeyLength(128) == 32 && pass1; - cout << (pass1 ? "passed:" : "FAILED:") << " TwofishEncryption StaticGetValidKeyLength\n"; + pass1 = enc.StaticGetValidKeyLength(64) == 32 && pass1; + pass1 = enc.StaticGetValidKeyLength(128) == 32 && pass1; TwofishDecryption dec; - // pass2 = dec.StaticGetValidKeyLength(8) == 16 && pass2; + pass2 = dec.StaticGetValidKeyLength(8) == 16 && pass2; pass2 = dec.StaticGetValidKeyLength(16) == 16 && pass2; pass2 = dec.StaticGetValidKeyLength(24) == 24 && pass2; pass2 = dec.StaticGetValidKeyLength(32) == 32 && pass2; - // pass2 = dec.StaticGetValidKeyLength(64) == 32 && pass2; - // pass2 = dec.StaticGetValidKeyLength(128) == 32 && pass2; - cout << (pass2 ? "passed:" : "FAILED:") << " TwofishDecryption StaticGetValidKeyLength\n"; + pass2 = dec.StaticGetValidKeyLength(64) == 32 && pass2; + pass2 = dec.StaticGetValidKeyLength(128) == 32 && pass2; + cout << (pass1 && pass2 ? "passed:" : "FAILED:") << " Algorithm key lengths\n"; FileSource valdata(CRYPTOPP_DATA_DIR "TestData/twofishv.dat", true, new HexDecoder); pass3 = BlockTransformationTest(FixedRoundsCipherFactory(16), valdata, 4) && pass3;