From 7f958575eaf267c8011e25dfbe6350b818524ff4 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Thu, 8 Sep 2016 20:24:25 -0400 Subject: [PATCH] Squashed commit of the following: commit 47c75c6e9397e240919207e50e5a611d3e2a2428 Merge: d7685c2 42085ee Author: Jeffrey Walton Date: Thu Sep 8 20:20:39 2016 -0400 Attempting to fix binary file merge conflict commit d7685c2d946beecc419ddb6901c24e972c7cf3ee Author: Jeffrey Walton Date: Thu Sep 8 16:39:23 2016 -0400 Add vsClean.cmd to vs2010.zip commit 4b96fdf1c551260da60eb021f324bcc3fcfec626 Author: Jeffrey Walton Date: Thu Sep 8 16:15:38 2016 -0400 Add Keccak to vs2010.zip commit 3962db73b7113ee805b46a5bb4da64e204fe6bb0 Author: Jeffrey Walton Date: Thu Sep 8 15:40:35 2016 -0400 Fold hmqv.cpp and fhmqv.cpp into mqv.cpp. There's no need for three empty source files commit 44401448cbb6c8125b0f1ab4419c5b174408ffd7 Author: Jeffrey Walton Date: Thu Sep 8 15:39:23 2016 -0400 Fold hmqv.cpp and fhmqv.cpp into mqv.cpp. There's no need for three empty source files commit 847bfccb8d5c388e67745dc8c69768fa503c5135 Author: Jeffrey Walton Date: Thu Sep 8 14:48:02 2016 -0400 Whitespace cleanup commit 46a37be6fef361704dcf852bc9a099ce0a1da4c8 Merge: aefb8f8 3697867 Author: Jeffrey Walton Date: Thu Sep 8 14:43:01 2016 -0400 Merge 'master' into 'keccak' commit aefb8f8ff2b81b967089c53b457a92fc6f7544d6 Merge: 51a828b 3c91d93 Author: Jeffrey Walton Date: Thu Sep 8 12:39:51 2016 -0400 Merge 'master' into 'keccak' commit 51a828b88e37a4d18abb00300cd5522bd0e110c5 Merge: 4152870 e7c7722 Author: Jeffrey Walton Date: Thu Sep 8 10:41:36 2016 -0400 Merge 'master' into 'keccak' commit 415287041e69ddadf5ca1f6fc794b87e145fc2db Merge: 357a0c5 83ac849 Author: Jeffrey Walton Date: Thu Sep 8 10:34:45 2016 -0400 Merge 'master' into 'keccak' commit 357a0c510f75e4e58078b500dd469462e90f7650 Author: Jeffrey Walton Date: Thu Sep 8 10:13:32 2016 -0400 Removed deprecated warning from SHA3 classes commit 5cf9ec10d53b895b5a583e265e4e1298ed402195 Merge: 10ce0ed c2d60cc Author: Jeffrey Walton Date: Thu Sep 8 09:43:15 2016 -0400 Merge 'master' into 'keccak' commit 10ce0ed4c5b8a1ea230062fd2dfdec0d87ec5b42 Author: Jeffrey Walton Date: Thu Sep 8 09:37:40 2016 -0400 Add Keccak implementation based on early SHA3. Change SHA3 to NIST FIPS 202 conforming implementation --- Filelist.txt | 6 +- GNUmakefile | 2 +- TestVectors/all.txt | 4 +- TestVectors/all_fips_202.txt | 38 ---- TestVectors/{sha3.txt => keccak.txt} | 8 +- TestVectors/sha3_224_fips_202.txt | 2 +- TestVectors/sha3_256_fips_202.txt | 2 +- TestVectors/sha3_384_fips_202.txt | 2 +- TestVectors/sha3_512_fips_202.txt | 2 +- bench1.cpp | 8 +- config.h | 7 - config.recommend | 7 - cryptest.nmake | 8 +- cryptest.sh | 52 ----- cryptlib.dsp | 16 +- cryptlib.vcproj | 226 +++++++-------------- cryptlib_bds.bdsproj | 2 - fhmqv.cpp | 16 -- hmqv.cpp | 16 -- keccak.cpp | 291 +++++++++++++++++++++++++++ keccak.h | 91 +++++++++ mqv.cpp | 14 ++ regtest.cpp | 5 + sha3.cpp | 9 +- sha3.h | 28 ++- test.cpp | 6 - validat1.cpp | 5 +- vs2010.zip | Bin 20060 -> 20126 bytes 28 files changed, 526 insertions(+), 347 deletions(-) delete mode 100644 TestVectors/all_fips_202.txt rename TestVectors/{sha3.txt => keccak.txt} (99%) delete mode 100644 fhmqv.cpp delete mode 100644 hmqv.cpp create mode 100644 keccak.cpp create mode 100644 keccak.h diff --git a/Filelist.txt b/Filelist.txt index 45aefbb1..983b81e8 100644 --- a/Filelist.txt +++ b/Filelist.txt @@ -148,6 +148,8 @@ integer.cpp integer.h iterhash.cpp iterhash.h +keccak.cpp +keccak.h lubyrack.h luc.cpp luc.h @@ -380,7 +382,6 @@ TestData/xtrdh342.dat TestVectors/Readme.txt TestVectors/aes.txt TestVectors/all.txt -TestVectors/all_fips_202.txt TestVectors/blake2.txt TestVectors/blake2b.txt TestVectors/blake2s.txt @@ -396,18 +397,19 @@ TestVectors/esign.txt TestVectors/gcm.txt TestVectors/hkdf.txt TestVectors/hmac.txt +TestVectors/keccak.txt TestVectors/mars.txt TestVectors/nr.txt TestVectors/panama.txt TestVectors/rsa_oaep.txt TestVectors/rsa_pkcs1_1_5.txt TestVectors/rsa_pss.txt +TestVectors/dsa_rfc6979.txt TestVectors/rw.txt TestVectors/salsa.txt TestVectors/seal.txt TestVectors/seed.txt TestVectors/sha.txt -TestVectors/sha3.txt TestVectors/sha3_fips_202.txt TestVectors/sha3_224_fips_202.txt TestVectors/sha3_256_fips_202.txt diff --git a/GNUmakefile b/GNUmakefile index f76ec0d2..d32e56f9 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -443,7 +443,7 @@ TESTOBJS := $(TESTSRCS:.cpp=.o) LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS)) # List cryptlib.cpp first in an attempt to tame C++ static initialization problems -DLLSRCS := cryptlib.cpp cpu.cpp integer.cpp shacal2.cpp md5.cpp shark.cpp zinflate.cpp gf2n.cpp salsa.cpp xtr.cpp oaep.cpp hmqv.cpp polynomi.cpp rc2.cpp default.cpp wait.cpp wake.cpp twofish.cpp iterhash.cpp adler32.cpp elgamal.cpp marss.cpp blowfish.cpp ecp.cpp filters.cpp strciphr.cpp camellia.cpp ida.cpp zlib.cpp des.cpp crc.cpp algparam.cpp dessp.cpp tea.cpp eax.cpp network.cpp emsa2.cpp pkcspad.cpp squaretb.cpp idea.cpp authenc.cpp hmac.cpp zdeflate.cpp xtrcrypt.cpp queue.cpp mars.cpp rc5.cpp blake2.cpp hrtimer.cpp eprecomp.cpp hex.cpp dsa.cpp fhmqv.cpp sha.cpp fips140.cpp gzip.cpp seal.cpp files.cpp base32.cpp vmac.cpp tigertab.cpp sharkbox.cpp safer.cpp randpool.cpp esign.cpp arc4.cpp osrng.cpp skipjack.cpp seed.cpp sha3.cpp sosemanuk.cpp bfinit.cpp rabin.cpp 3way.cpp rw.cpp rdrand.cpp rsa.cpp rdtables.cpp gost.cpp socketft.cpp tftables.cpp nbtheory.cpp panama.cpp modes.cpp rijndael.cpp casts.cpp chacha.cpp gfpcrypt.cpp poly1305.cpp dll.cpp ec2n.cpp blumshub.cpp algebra.cpp basecode.cpp base64.cpp cbcmac.cpp rc6.cpp dh2.cpp gf256.cpp mqueue.cpp misc.cpp pssr.cpp channels.cpp tiger.cpp cast.cpp rng.cpp square.cpp asn.cpp whrlpool.cpp md4.cpp dh.cpp ccm.cpp md2.cpp mqv.cpp gf2_32.cpp ttmac.cpp luc.cpp trdlocal.cpp pubkey.cpp gcm.cpp ripemd.cpp eccrypto.cpp serpent.cpp cmac.cpp +DLLSRCS := cryptlib.cpp cpu.cpp integer.cpp shacal2.cpp md5.cpp shark.cpp zinflate.cpp gf2n.cpp salsa.cpp xtr.cpp oaep.cpp polynomi.cpp rc2.cpp default.cpp wait.cpp wake.cpp twofish.cpp iterhash.cpp adler32.cpp elgamal.cpp marss.cpp blowfish.cpp ecp.cpp filters.cpp strciphr.cpp camellia.cpp ida.cpp zlib.cpp des.cpp crc.cpp algparam.cpp dessp.cpp tea.cpp eax.cpp network.cpp emsa2.cpp pkcspad.cpp squaretb.cpp idea.cpp authenc.cpp hmac.cpp zdeflate.cpp xtrcrypt.cpp queue.cpp mars.cpp rc5.cpp blake2.cpp hrtimer.cpp eprecomp.cpp hex.cpp dsa.cpp sha.cpp fips140.cpp gzip.cpp seal.cpp files.cpp base32.cpp vmac.cpp tigertab.cpp sharkbox.cpp safer.cpp randpool.cpp esign.cpp arc4.cpp osrng.cpp skipjack.cpp seed.cpp sha3.cpp sosemanuk.cpp bfinit.cpp rabin.cpp 3way.cpp rw.cpp rdrand.cpp rsa.cpp rdtables.cpp gost.cpp socketft.cpp tftables.cpp nbtheory.cpp panama.cpp modes.cpp rijndael.cpp casts.cpp chacha.cpp gfpcrypt.cpp poly1305.cpp dll.cpp ec2n.cpp blumshub.cpp algebra.cpp basecode.cpp base64.cpp cbcmac.cpp rc6.cpp dh2.cpp gf256.cpp mqueue.cpp misc.cpp pssr.cpp channels.cpp tiger.cpp cast.cpp rng.cpp square.cpp asn.cpp whrlpool.cpp md4.cpp dh.cpp ccm.cpp md2.cpp mqv.cpp gf2_32.cpp ttmac.cpp luc.cpp trdlocal.cpp pubkey.cpp gcm.cpp ripemd.cpp eccrypto.cpp serpent.cpp cmac.cpp DLLOBJS := $(DLLSRCS:.cpp=.export.o) # Import lib testing diff --git a/TestVectors/all.txt b/TestVectors/all.txt index cfa6e4cc..51c19946 100644 --- a/TestVectors/all.txt +++ b/TestVectors/all.txt @@ -20,8 +20,8 @@ Test: TestVectors/rsa_pss.txt Test: TestVectors/rw.txt Test: TestVectors/seal.txt Test: TestVectors/sha.txt -Test: TestVectors/sha3.txt -#Test: TestVectors/sha3_fips_202.txt +Test: TestVectors/keccak.txt +Test: TestVectors/sha3_fips_202.txt Test: TestVectors/panama.txt Test: TestVectors/aes.txt Test: TestVectors/salsa.txt diff --git a/TestVectors/all_fips_202.txt b/TestVectors/all_fips_202.txt deleted file mode 100644 index e7c08c7d..00000000 --- a/TestVectors/all_fips_202.txt +++ /dev/null @@ -1,38 +0,0 @@ -AlgorithmType: FileList -Name: all.txt collection -Test: TestVectors/tea.txt -Test: TestVectors/wake.txt -Test: TestVectors/camellia.txt -Test: TestVectors/shacal2.txt -Test: TestVectors/ttmac.txt -Test: TestVectors/whrlpool.txt -Test: TestVectors/dlies.txt -Test: TestVectors/dsa.txt -Test: TestVectors/dsa_1363.txt -Test: TestVectors/dsa_rfc6979.txt -#Test: TestVectors/ecdsa_rfc6979.txt -Test: TestVectors/esign.txt -Test: TestVectors/hmac.txt -Test: TestVectors/nr.txt -Test: TestVectors/rsa_oaep.txt -Test: TestVectors/rsa_pkcs1_1_5.txt -Test: TestVectors/rsa_pss.txt -Test: TestVectors/rw.txt -Test: TestVectors/seal.txt -Test: TestVectors/sha.txt -#Test: TestVectors/sha3.txt -Test: TestVectors/sha3_fips_202.txt -Test: TestVectors/panama.txt -Test: TestVectors/aes.txt -Test: TestVectors/salsa.txt -Test: TestVectors/chacha.txt -Test: TestVectors/vmac.txt -Test: TestVectors/sosemanuk.txt -Test: TestVectors/ccm.txt -Test: TestVectors/gcm.txt -Test: TestVectors/cmac.txt -Test: TestVectors/eax.txt -Test: TestVectors/mars.txt -Test: TestVectors/blake2s.txt -Test: TestVectors/blake2b.txt -Test: TestVectors/hkdf.txt diff --git a/TestVectors/sha3.txt b/TestVectors/keccak.txt similarity index 99% rename from TestVectors/sha3.txt rename to TestVectors/keccak.txt index 2a6c4cc1..292e91b1 100644 --- a/TestVectors/sha3.txt +++ b/TestVectors/keccak.txt @@ -1,5 +1,5 @@ AlgorithmType: MessageDigest -Name: SHA-3-224 +Name: Keccak-224 Message: "" Digest: f71837502ba8e108 37bdd8d365adb855 91895602fc552b48 b7390abd Test: Verify @@ -23,7 +23,7 @@ Digest: 19f9167be2a04c43 abd0ed554788101b 9c339031acc8e146 8531303f Test: Verify AlgorithmType: MessageDigest -Name: SHA-3-256 +Name: Keccak-256 Message: "" Digest: c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 Test: Verify @@ -47,7 +47,7 @@ Digest: fadae6b49f129bbb 812be8407b7b2894 f34aecf6dbd1f9b0 f0c7e9853098fc96 Test: Verify AlgorithmType: MessageDigest -Name: SHA-3-384 +Name: Keccak-384 Message: "" Digest: 2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff Test: Verify @@ -71,7 +71,7 @@ Digest: 0c8324e1ebc18282 2c5e2a086cac07c2 fe00e3bce61d01ba 8ad6b71780e2dec5 fb89 Test: Verify AlgorithmType: MessageDigest -Name: SHA-3-512 +Name: Keccak-512 Message: "" Digest: 0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e Test: Verify diff --git a/TestVectors/sha3_224_fips_202.txt b/TestVectors/sha3_224_fips_202.txt index 286ee864..77933702 100644 --- a/TestVectors/sha3_224_fips_202.txt +++ b/TestVectors/sha3_224_fips_202.txt @@ -1,6 +1,6 @@ AlgorithmType: MessageDigest Source: SHA-3 Hash Function Test Vectors for Hashing Byte-Oriented Messages (http://csrc.nist.gov/groups/STM/cavp/secure-hashing.html) -Name: SHA-3-224 +Name: SHA3-224 Comment: length 0 Message: "" Digest: 6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7 diff --git a/TestVectors/sha3_256_fips_202.txt b/TestVectors/sha3_256_fips_202.txt index 511dfe2a..105b2cf7 100644 --- a/TestVectors/sha3_256_fips_202.txt +++ b/TestVectors/sha3_256_fips_202.txt @@ -1,6 +1,6 @@ AlgorithmType: MessageDigest Source: SHA-3 Hash Function Test Vectors for Hashing Byte-Oriented Messages (http://csrc.nist.gov/groups/STM/cavp/secure-hashing.html) -Name: SHA-3-256 +Name: SHA3-256 Comment: length 0 Message: "" Digest: a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a diff --git a/TestVectors/sha3_384_fips_202.txt b/TestVectors/sha3_384_fips_202.txt index d19738d8..9cf41fdc 100644 --- a/TestVectors/sha3_384_fips_202.txt +++ b/TestVectors/sha3_384_fips_202.txt @@ -1,6 +1,6 @@ AlgorithmType: MessageDigest Source: SHA-3 Hash Function Test Vectors for Hashing Byte-Oriented Messages (http://csrc.nist.gov/groups/STM/cavp/secure-hashing.html) -Name: SHA-3-384 +Name: SHA3-384 Comment: length 0 Message: "" Digest: 0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004 diff --git a/TestVectors/sha3_512_fips_202.txt b/TestVectors/sha3_512_fips_202.txt index ef6b5e9b..af25bb35 100644 --- a/TestVectors/sha3_512_fips_202.txt +++ b/TestVectors/sha3_512_fips_202.txt @@ -1,6 +1,6 @@ AlgorithmType: MessageDigest Source: SHA-3 Hash Function Test Vectors for Hashing Byte-Oriented Messages (http://csrc.nist.gov/groups/STM/cavp/secure-hashing.html) -Name: SHA-3-512 +Name: SHA3-512 Comment: length 0 Message: "" Digest: a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26 diff --git a/bench1.cpp b/bench1.cpp index 8492b327..d352ed92 100644 --- a/bench1.cpp +++ b/bench1.cpp @@ -315,10 +315,10 @@ void BenchmarkAll(double t, double hertz) BenchMarkByNameKeyLess("SHA-1"); BenchMarkByNameKeyLess("SHA-256"); BenchMarkByNameKeyLess("SHA-512"); - BenchMarkByNameKeyLess("SHA-3-224"); - BenchMarkByNameKeyLess("SHA-3-256"); - BenchMarkByNameKeyLess("SHA-3-384"); - BenchMarkByNameKeyLess("SHA-3-512"); + BenchMarkByNameKeyLess("SHA3-224"); + BenchMarkByNameKeyLess("SHA3-256"); + BenchMarkByNameKeyLess("SHA3-384"); + BenchMarkByNameKeyLess("SHA3-512"); BenchMarkByNameKeyLess("Tiger"); BenchMarkByNameKeyLess("Whirlpool"); BenchMarkByNameKeyLess("RIPEMD-160"); diff --git a/config.h b/config.h index 8c58004d..bd168a7c 100644 --- a/config.h +++ b/config.h @@ -60,13 +60,6 @@ // # define CRYPTOPP_NO_UNALIGNED_DATA_ACCESS #endif -// Define this to choose the FIPS 202 version of SHA3, and not the original version of SHA3. NIST selected Keccak as SHA3 -// in January 2013. SHA3 was finalized in FIPS 202 in August 2015, and it was a modified version of the original selection. -// If CRYPTOPP_USE_FIPS_202_SHA3 is defined, then sha3_fips_202.txt test vectors will be used instead of sha3.txt. -// #ifndef CRYPTOPP_USE_FIPS_202_SHA3 -// # define CRYPTOPP_USE_FIPS_202_SHA3 -// #endif - // ***************** Less Important Settings *************** // Library version diff --git a/config.recommend b/config.recommend index 2b28d541..991355a9 100644 --- a/config.recommend +++ b/config.recommend @@ -60,13 +60,6 @@ # define CRYPTOPP_NO_UNALIGNED_DATA_ACCESS #endif -// Define this to choose the FIPS 202 version of SHA3, and not the original version of SHA3. NIST selected Keccak as SHA3 -// in January 2013. SHA3 was finalized in FIPS 202 in August 2015, and it was a modified version of the original selection. -// If CRYPTOPP_USE_FIPS_202_SHA3 is defined, then sha3_fips_202.txt test vectors will be used instead of sha3.txt. -#ifndef CRYPTOPP_USE_FIPS_202_SHA3 -# define CRYPTOPP_USE_FIPS_202_SHA3 -#endif - // ***************** Less Important Settings *************** // Library version diff --git a/cryptest.nmake b/cryptest.nmake index 3e32c3cf..78afe164 100644 --- a/cryptest.nmake +++ b/cryptest.nmake @@ -18,15 +18,15 @@ # build it using NASM, and then include the NASM object file rdrand_x86.obj or rdrand_x64.obj. # If you use 'make sources' from Linux makefile, then add 'winpipes.cpp' -LIB_SRCS = cryptlib.cpp cpu.cpp integer.cpp shacal2.cpp md5.cpp shark.cpp zinflate.cpp gf2n.cpp salsa.cpp xtr.cpp oaep.cpp hmqv.cpp rc2.cpp default.cpp wait.cpp wake.cpp twofish.cpp iterhash.cpp adler32.cpp algparam.cpp marss.cpp blowfish.cpp ecp.cpp strciphr.cpp camellia.cpp dh2.cpp ida.cpp zlib.cpp elgamal.cpp crc.cpp dessp.cpp tea.cpp eax.cpp network.cpp fhmqv.cpp sha.cpp emsa2.cpp pkcspad.cpp squaretb.cpp idea.cpp authenc.cpp hmac.cpp xtrcrypt.cpp queue.cpp mars.cpp rc5.cpp md2.cpp hrtimer.cpp vmac.cpp eprecomp.cpp hex.cpp dsa.cpp fips140.cpp gzip.cpp seal.cpp blake2.cpp files.cpp base32.cpp sharkbox.cpp safer.cpp randpool.cpp sosemanuk.cpp arc4.cpp osrng.cpp skipjack.cpp seed.cpp sha3.cpp filters.cpp bfinit.cpp rabin.cpp 3way.cpp rw.cpp rdtables.cpp rsa.cpp tftables.cpp gost.cpp socketft.cpp nbtheory.cpp panama.cpp modes.cpp rijndael.cpp casts.cpp algebra.cpp esign.cpp gfpcrypt.cpp dll.cpp ec2n.cpp polynomi.cpp blumshub.cpp des.cpp basecode.cpp zdeflate.cpp base64.cpp rc6.cpp gf256.cpp mqueue.cpp misc.cpp pssr.cpp channels.cpp rng.cpp tiger.cpp cast.cpp square.cpp asn.cpp chacha.cpp whrlpool.cpp md4.cpp dh.cpp ccm.cpp mqv.cpp tigertab.cpp gf2_32.cpp cbcmac.cpp ttmac.cpp luc.cpp trdlocal.cpp pubkey.cpp gcm.cpp ripemd.cpp rdrand.cpp eccrypto.cpp serpent.cpp cmac.cpp winpipes.cpp +LIB_SRCS = cryptlib.cpp cpu.cpp integer.cpp shacal2.cpp md5.cpp shark.cpp zinflate.cpp gf2n.cpp salsa.cpp xtr.cpp oaep.cpp rc2.cpp default.cpp wait.cpp wake.cpp twofish.cpp iterhash.cpp adler32.cpp algparam.cpp marss.cpp blowfish.cpp ecp.cpp strciphr.cpp camellia.cpp dh2.cpp ida.cpp zlib.cpp elgamal.cpp crc.cpp dessp.cpp tea.cpp eax.cpp network.cpp sha.cpp emsa2.cpp pkcspad.cpp squaretb.cpp idea.cpp authenc.cpp hmac.cpp xtrcrypt.cpp queue.cpp mars.cpp rc5.cpp md2.cpp hrtimer.cpp vmac.cpp eprecomp.cpp hex.cpp dsa.cpp fips140.cpp gzip.cpp seal.cpp blake2.cpp files.cpp base32.cpp sharkbox.cpp safer.cpp randpool.cpp sosemanuk.cpp arc4.cpp osrng.cpp skipjack.cpp seed.cpp sha3.cpp filters.cpp bfinit.cpp rabin.cpp 3way.cpp rw.cpp rdtables.cpp rsa.cpp tftables.cpp gost.cpp socketft.cpp nbtheory.cpp panama.cpp modes.cpp rijndael.cpp casts.cpp algebra.cpp esign.cpp gfpcrypt.cpp dll.cpp ec2n.cpp polynomi.cpp blumshub.cpp des.cpp basecode.cpp zdeflate.cpp base64.cpp rc6.cpp gf256.cpp mqueue.cpp misc.cpp pssr.cpp channels.cpp rng.cpp tiger.cpp cast.cpp square.cpp asn.cpp chacha.cpp whrlpool.cpp md4.cpp dh.cpp ccm.cpp mqv.cpp tigertab.cpp gf2_32.cpp cbcmac.cpp ttmac.cpp luc.cpp trdlocal.cpp pubkey.cpp gcm.cpp ripemd.cpp rdrand.cpp eccrypto.cpp serpent.cpp cmac.cpp winpipes.cpp -LIB_OBJS = cryptlib.obj cpu.obj integer.obj shacal2.obj md5.obj shark.obj zinflate.obj gf2n.obj salsa.obj xtr.obj oaep.obj hmqv.obj rc2.obj default.obj wait.obj wake.obj twofish.obj iterhash.obj adler32.obj algparam.obj marss.obj blowfish.obj ecp.obj strciphr.obj camellia.obj dh2.obj ida.obj zlib.obj elgamal.obj crc.obj dessp.obj tea.obj eax.obj network.obj fhmqv.obj sha.obj emsa2.obj pkcspad.obj squaretb.obj idea.obj authenc.obj hmac.obj xtrcrypt.obj queue.obj mars.obj rc5.obj md2.obj hrtimer.obj vmac.obj eprecomp.obj hex.obj dsa.obj fips140.obj gzip.obj seal.obj blake2.obj files.obj base32.obj sharkbox.obj safer.obj randpool.obj sosemanuk.obj arc4.obj osrng.obj skipjack.obj seed.obj sha3.obj filters.obj bfinit.obj rabin.obj 3way.obj rw.obj rdtables.obj rsa.obj tftables.obj gost.obj socketft.obj nbtheory.obj panama.obj modes.obj rijndael.obj casts.obj algebra.obj esign.obj gfpcrypt.obj dll.obj ec2n.obj polynomi.obj blumshub.obj des.obj basecode.obj zdeflate.obj base64.obj rc6.obj gf256.obj mqueue.obj misc.obj pssr.obj channels.obj rng.obj tiger.obj cast.obj square.obj asn.obj chacha.obj whrlpool.obj md4.obj dh.obj ccm.obj mqv.obj tigertab.obj gf2_32.obj cbcmac.obj ttmac.obj luc.obj trdlocal.obj pubkey.obj gcm.obj ripemd.obj rdrand.obj eccrypto.obj serpent.obj cmac.obj winpipes.obj +LIB_OBJS = cryptlib.obj cpu.obj integer.obj shacal2.obj md5.obj shark.obj zinflate.obj gf2n.obj salsa.obj xtr.obj oaep.obj rc2.obj default.obj wait.obj wake.obj twofish.obj iterhash.obj adler32.obj algparam.obj marss.obj blowfish.obj ecp.obj strciphr.obj camellia.obj dh2.obj ida.obj zlib.obj elgamal.obj crc.obj dessp.obj tea.obj eax.obj network.obj sha.obj emsa2.obj pkcspad.obj squaretb.obj idea.obj authenc.obj hmac.obj xtrcrypt.obj queue.obj mars.obj rc5.obj md2.obj hrtimer.obj vmac.obj eprecomp.obj hex.obj dsa.obj fips140.obj gzip.obj seal.obj blake2.obj files.obj base32.obj sharkbox.obj safer.obj randpool.obj sosemanuk.obj arc4.obj osrng.obj skipjack.obj seed.obj sha3.obj filters.obj bfinit.obj rabin.obj 3way.obj rw.obj rdtables.obj rsa.obj tftables.obj gost.obj socketft.obj nbtheory.obj panama.obj modes.obj rijndael.obj casts.obj algebra.obj esign.obj gfpcrypt.obj dll.obj ec2n.obj polynomi.obj blumshub.obj des.obj basecode.obj zdeflate.obj base64.obj rc6.obj gf256.obj mqueue.obj misc.obj pssr.obj channels.obj rng.obj tiger.obj cast.obj square.obj asn.obj chacha.obj whrlpool.obj md4.obj dh.obj ccm.obj mqv.obj tigertab.obj gf2_32.obj cbcmac.obj ttmac.obj luc.obj trdlocal.obj pubkey.obj gcm.obj ripemd.obj rdrand.obj eccrypto.obj serpent.obj cmac.obj winpipes.obj TEST_SRCS = bench1.cpp bench2.cpp test.cpp validat1.cpp validat2.cpp validat3.cpp datatest.cpp regtest.cpp fipsalgt.cpp dlltest.cpp fipstest.cpp TEST_OBJS = bench1.obj bench2.obj test.obj validat1.obj validat2.obj validat3.obj datatest.obj regtest.obj fipsalgt.obj dlltest.obj fipstest.obj -CXX = cl.exe +CXX = cl.exe LD = link.exe AR = lib.exe RM = del.exe @@ -52,7 +52,7 @@ ARFLAGS = /nologo LDLIBS = !IF "$(PLATFORM)" == "" -!IF "$(PROCESSOR_ARCHITECTURE)" == "x86" +!IF "$(PROCESSOR_ARCHITECTURE)" == "x86" PLATFORM = x86 !ELSEIF "$(PROCESSOR_ARCHITECTURE)" == "x64" || "$(PROCESSOR_ARCHITECTURE)" == "AMD64" PLATFORM = x64 diff --git a/cryptest.sh b/cryptest.sh index 0378c2ba..1ba762d7 100755 --- a/cryptest.sh +++ b/cryptest.sh @@ -2406,58 +2406,6 @@ else fi fi -############################################ -# Debug build, SHA3/FIPS 202 -echo -echo "************************************" | tee -a "$TEST_RESULTS" -echo "Testing: Debug, USE_FIPS_202_SHA3" | tee -a "$TEST_RESULTS" -echo - -"$MAKE" clean > /dev/null 2>&1 -rm -f adhoc.cpp > /dev/null 2>&1 - -CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_USE_FIPS_202_SHA3 ${PLATFORM_CXXFLAGS[@]} $USER_CXXFLAGS ${DEPRECATED_CXXFLAGS[@]}" -CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - -if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" -else - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" - fi - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi -fi - -############################################ -# Release build, SHA3/FIPS 202 -echo -echo "************************************" | tee -a "$TEST_RESULTS" -echo "Testing: Release, USE_FIPS_202_SHA3" | tee -a "$TEST_RESULTS" -echo - -"$MAKE" clean > /dev/null 2>&1 -rm -f adhoc.cpp > /dev/null 2>&1 - -CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_USE_FIPS_202_SHA3 ${PLATFORM_CXXFLAGS[@]} $USER_CXXFLAGS ${DEPRECATED_CXXFLAGS[@]}" -CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - -if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" -else - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" - fi - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi -fi - ############################################ # Build with LD-Gold if [[ "$HAVE_LDGOLD" -ne "0" ]]; then diff --git a/cryptlib.dsp b/cryptlib.dsp index 0d4e9e1f..b020ad4c 100644 --- a/cryptlib.dsp +++ b/cryptlib.dsp @@ -347,10 +347,6 @@ SOURCE=.\esign.cpp # End Source File # Begin Source File -SOURCE=.\fhmqv.cpp -# End Source File -# Begin Source File - SOURCE=.\files.cpp # End Source File # Begin Source File @@ -403,10 +399,6 @@ SOURCE=.\hmac.cpp # End Source File # Begin Source File -SOURCE=.\hmqv.cpp -# End Source File -# Begin Source File - SOURCE=.\hrtimer.cpp # End Source File # Begin Source File @@ -428,6 +420,10 @@ SOURCE=.\iterhash.cpp # End Source File # Begin Source File +SOURCE=.\keccak.cpp +# End Source File +# Begin Source File + SOURCE=.\luc.cpp # End Source File # Begin Source File @@ -945,6 +941,10 @@ SOURCE=.\iterhash.h # End Source File # Begin Source File +SOURCE=.\keccak.h +# End Source File +# Begin Source File + SOURCE=.\lubyrack.h # End Source File # Begin Source File diff --git a/cryptlib.vcproj b/cryptlib.vcproj index 751ddf44..58aa7551 100644 --- a/cryptlib.vcproj +++ b/cryptlib.vcproj @@ -3058,80 +3058,6 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -4024,80 +3950,6 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -4477,6 +4329,80 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -9572,6 +9498,10 @@ RelativePath="iterhash.h" > + + diff --git a/cryptlib_bds.bdsproj b/cryptlib_bds.bdsproj index b7444ccb..fa145e68 100644 --- a/cryptlib_bds.bdsproj +++ b/cryptlib_bds.bdsproj @@ -235,7 +235,6 @@ - @@ -249,7 +248,6 @@ - diff --git a/fhmqv.cpp b/fhmqv.cpp deleted file mode 100644 index b400b0d8..00000000 --- a/fhmqv.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// fhmqv.cpp - written and placed in the public domain by Jeffrey Walton -// Shamelessly based upon Wei Dai's MQV source files - -#include "pch.h" -#include "fhmqv.h" - -NAMESPACE_BEGIN(CryptoPP) - -#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) -void TestInstantiations_FHMQV() -{ - FHMQV fhmqv; -} -#endif - -NAMESPACE_END diff --git a/hmqv.cpp b/hmqv.cpp deleted file mode 100644 index 9ef0fbb8..00000000 --- a/hmqv.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// hmqv.cpp - written and placed in the public domain by Uri Blumenthal -// Shamelessly based upon Jeffrey Walton's FHMQV and Wei Dai's MQV source files - -#include "pch.h" -#include "hmqv.h" - -NAMESPACE_BEGIN(CryptoPP) - -#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) -void TestInstantiations_HMQV() -{ - HMQV hmqv; -} -#endif - -NAMESPACE_END diff --git a/keccak.cpp b/keccak.cpp new file mode 100644 index 00000000..452df6d6 --- /dev/null +++ b/keccak.cpp @@ -0,0 +1,291 @@ +// keccak.cpp - modified by Wei Dai from Ronny Van Keer's public domain sha3-simple.c +// all modifications here are placed in the public domain by Wei Dai + +/* +The Keccak sponge function, designed by Guido Bertoni, Joan Daemen, +Michael Peeters and Gilles Van Assche. For more information, feedback or +questions, please refer to our website: http://keccak.noekeon.org/ + +Implementation by Ronny Van Keer, +hereby denoted as "the implementer". + +To the extent possible under law, the implementer has waived all copyright +and related or neighboring rights to the source code in this file. +http://creativecommons.org/publicdomain/zero/1.0/ +*/ + +#include "pch.h" +#include "keccak.h" + +NAMESPACE_BEGIN(CryptoPP) + +static const word64 KeccakF_RoundConstants[24] = +{ + W64LIT(0x0000000000000001), W64LIT(0x0000000000008082), W64LIT(0x800000000000808a), + W64LIT(0x8000000080008000), W64LIT(0x000000000000808b), W64LIT(0x0000000080000001), + W64LIT(0x8000000080008081), W64LIT(0x8000000000008009), W64LIT(0x000000000000008a), + W64LIT(0x0000000000000088), W64LIT(0x0000000080008009), W64LIT(0x000000008000000a), + W64LIT(0x000000008000808b), W64LIT(0x800000000000008b), W64LIT(0x8000000000008089), + W64LIT(0x8000000000008003), W64LIT(0x8000000000008002), W64LIT(0x8000000000000080), + W64LIT(0x000000000000800a), W64LIT(0x800000008000000a), W64LIT(0x8000000080008081), + W64LIT(0x8000000000008080), W64LIT(0x0000000080000001), W64LIT(0x8000000080008008) +}; + +static void KeccakF1600(word64 *state) +{ + { + word64 Aba, Abe, Abi, Abo, Abu; + word64 Aga, Age, Agi, Ago, Agu; + word64 Aka, Ake, Aki, Ako, Aku; + word64 Ama, Ame, Ami, Amo, Amu; + word64 Asa, Ase, Asi, Aso, Asu; + word64 BCa, BCe, BCi, BCo, BCu; + word64 Da, De, Di, Do, Du; + word64 Eba, Ebe, Ebi, Ebo, Ebu; + word64 Ega, Ege, Egi, Ego, Egu; + word64 Eka, Eke, Eki, Eko, Eku; + word64 Ema, Eme, Emi, Emo, Emu; + word64 Esa, Ese, Esi, Eso, Esu; + + //copyFromState(A, state) + typedef BlockGetAndPut Block; + Block::Get(state)(Aba)(Abe)(Abi)(Abo)(Abu)(Aga)(Age)(Agi)(Ago)(Agu)(Aka)(Ake)(Aki)(Ako)(Aku)(Ama)(Ame)(Ami)(Amo)(Amu)(Asa)(Ase)(Asi)(Aso)(Asu); + + for( unsigned int round = 0; round < 24; round += 2 ) + { + // prepareTheta + BCa = Aba^Aga^Aka^Ama^Asa; + BCe = Abe^Age^Ake^Ame^Ase; + BCi = Abi^Agi^Aki^Ami^Asi; + BCo = Abo^Ago^Ako^Amo^Aso; + BCu = Abu^Agu^Aku^Amu^Asu; + + //thetaRhoPiChiIotaPrepareTheta(round , A, E) + Da = BCu^rotlFixed(BCe, 1); + De = BCa^rotlFixed(BCi, 1); + Di = BCe^rotlFixed(BCo, 1); + Do = BCi^rotlFixed(BCu, 1); + Du = BCo^rotlFixed(BCa, 1); + + Aba ^= Da; + BCa = Aba; + Age ^= De; + BCe = rotlFixed(Age, 44); + Aki ^= Di; + BCi = rotlFixed(Aki, 43); + Amo ^= Do; + BCo = rotlFixed(Amo, 21); + Asu ^= Du; + BCu = rotlFixed(Asu, 14); + Eba = BCa ^((~BCe)& BCi ); + Eba ^= (word64)KeccakF_RoundConstants[round]; + Ebe = BCe ^((~BCi)& BCo ); + Ebi = BCi ^((~BCo)& BCu ); + Ebo = BCo ^((~BCu)& BCa ); + Ebu = BCu ^((~BCa)& BCe ); + + Abo ^= Do; + BCa = rotlFixed(Abo, 28); + Agu ^= Du; + BCe = rotlFixed(Agu, 20); + Aka ^= Da; + BCi = rotlFixed(Aka, 3); + Ame ^= De; + BCo = rotlFixed(Ame, 45); + Asi ^= Di; + BCu = rotlFixed(Asi, 61); + Ega = BCa ^((~BCe)& BCi ); + Ege = BCe ^((~BCi)& BCo ); + Egi = BCi ^((~BCo)& BCu ); + Ego = BCo ^((~BCu)& BCa ); + Egu = BCu ^((~BCa)& BCe ); + + Abe ^= De; + BCa = rotlFixed(Abe, 1); + Agi ^= Di; + BCe = rotlFixed(Agi, 6); + Ako ^= Do; + BCi = rotlFixed(Ako, 25); + Amu ^= Du; + BCo = rotlFixed(Amu, 8); + Asa ^= Da; + BCu = rotlFixed(Asa, 18); + Eka = BCa ^((~BCe)& BCi ); + Eke = BCe ^((~BCi)& BCo ); + Eki = BCi ^((~BCo)& BCu ); + Eko = BCo ^((~BCu)& BCa ); + Eku = BCu ^((~BCa)& BCe ); + + Abu ^= Du; + BCa = rotlFixed(Abu, 27); + Aga ^= Da; + BCe = rotlFixed(Aga, 36); + Ake ^= De; + BCi = rotlFixed(Ake, 10); + Ami ^= Di; + BCo = rotlFixed(Ami, 15); + Aso ^= Do; + BCu = rotlFixed(Aso, 56); + Ema = BCa ^((~BCe)& BCi ); + Eme = BCe ^((~BCi)& BCo ); + Emi = BCi ^((~BCo)& BCu ); + Emo = BCo ^((~BCu)& BCa ); + Emu = BCu ^((~BCa)& BCe ); + + Abi ^= Di; + BCa = rotlFixed(Abi, 62); + Ago ^= Do; + BCe = rotlFixed(Ago, 55); + Aku ^= Du; + BCi = rotlFixed(Aku, 39); + Ama ^= Da; + BCo = rotlFixed(Ama, 41); + Ase ^= De; + BCu = rotlFixed(Ase, 2); + Esa = BCa ^((~BCe)& BCi ); + Ese = BCe ^((~BCi)& BCo ); + Esi = BCi ^((~BCo)& BCu ); + Eso = BCo ^((~BCu)& BCa ); + Esu = BCu ^((~BCa)& BCe ); + + // prepareTheta + BCa = Eba^Ega^Eka^Ema^Esa; + BCe = Ebe^Ege^Eke^Eme^Ese; + BCi = Ebi^Egi^Eki^Emi^Esi; + BCo = Ebo^Ego^Eko^Emo^Eso; + BCu = Ebu^Egu^Eku^Emu^Esu; + + //thetaRhoPiChiIotaPrepareTheta(round+1, E, A) + Da = BCu^rotlFixed(BCe, 1); + De = BCa^rotlFixed(BCi, 1); + Di = BCe^rotlFixed(BCo, 1); + Do = BCi^rotlFixed(BCu, 1); + Du = BCo^rotlFixed(BCa, 1); + + Eba ^= Da; + BCa = Eba; + Ege ^= De; + BCe = rotlFixed(Ege, 44); + Eki ^= Di; + BCi = rotlFixed(Eki, 43); + Emo ^= Do; + BCo = rotlFixed(Emo, 21); + Esu ^= Du; + BCu = rotlFixed(Esu, 14); + Aba = BCa ^((~BCe)& BCi ); + Aba ^= (word64)KeccakF_RoundConstants[round+1]; + Abe = BCe ^((~BCi)& BCo ); + Abi = BCi ^((~BCo)& BCu ); + Abo = BCo ^((~BCu)& BCa ); + Abu = BCu ^((~BCa)& BCe ); + + Ebo ^= Do; + BCa = rotlFixed(Ebo, 28); + Egu ^= Du; + BCe = rotlFixed(Egu, 20); + Eka ^= Da; + BCi = rotlFixed(Eka, 3); + Eme ^= De; + BCo = rotlFixed(Eme, 45); + Esi ^= Di; + BCu = rotlFixed(Esi, 61); + Aga = BCa ^((~BCe)& BCi ); + Age = BCe ^((~BCi)& BCo ); + Agi = BCi ^((~BCo)& BCu ); + Ago = BCo ^((~BCu)& BCa ); + Agu = BCu ^((~BCa)& BCe ); + + Ebe ^= De; + BCa = rotlFixed(Ebe, 1); + Egi ^= Di; + BCe = rotlFixed(Egi, 6); + Eko ^= Do; + BCi = rotlFixed(Eko, 25); + Emu ^= Du; + BCo = rotlFixed(Emu, 8); + Esa ^= Da; + BCu = rotlFixed(Esa, 18); + Aka = BCa ^((~BCe)& BCi ); + Ake = BCe ^((~BCi)& BCo ); + Aki = BCi ^((~BCo)& BCu ); + Ako = BCo ^((~BCu)& BCa ); + Aku = BCu ^((~BCa)& BCe ); + + Ebu ^= Du; + BCa = rotlFixed(Ebu, 27); + Ega ^= Da; + BCe = rotlFixed(Ega, 36); + Eke ^= De; + BCi = rotlFixed(Eke, 10); + Emi ^= Di; + BCo = rotlFixed(Emi, 15); + Eso ^= Do; + BCu = rotlFixed(Eso, 56); + Ama = BCa ^((~BCe)& BCi ); + Ame = BCe ^((~BCi)& BCo ); + Ami = BCi ^((~BCo)& BCu ); + Amo = BCo ^((~BCu)& BCa ); + Amu = BCu ^((~BCa)& BCe ); + + Ebi ^= Di; + BCa = rotlFixed(Ebi, 62); + Ego ^= Do; + BCe = rotlFixed(Ego, 55); + Eku ^= Du; + BCi = rotlFixed(Eku, 39); + Ema ^= Da; + BCo = rotlFixed(Ema, 41); + Ese ^= De; + BCu = rotlFixed(Ese, 2); + Asa = BCa ^((~BCe)& BCi ); + Ase = BCe ^((~BCi)& BCo ); + Asi = BCi ^((~BCo)& BCu ); + Aso = BCo ^((~BCu)& BCa ); + Asu = BCu ^((~BCa)& BCe ); + } + + //copyToState(state, A) + Block::Put(NULL, state)(Aba)(Abe)(Abi)(Abo)(Abu)(Aga)(Age)(Agi)(Ago)(Agu)(Aka)(Ake)(Aki)(Ako)(Aku)(Ama)(Ame)(Ami)(Amo)(Amu)(Asa)(Ase)(Asi)(Aso)(Asu); + } +} + +void Keccak::Update(const byte *input, size_t length) +{ + assert((input && length) || !(input || length)); + if (!length) + return; + + size_t spaceLeft; + while (length >= (spaceLeft = r() - m_counter)) + { + if (spaceLeft) + xorbuf(m_state.BytePtr() + m_counter, input, spaceLeft); + KeccakF1600(m_state); + input += spaceLeft; + length -= spaceLeft; + m_counter = 0; + } + + if (length) + xorbuf(m_state.BytePtr() + m_counter, input, length); + m_counter += (unsigned int)length; +} + +void Keccak::Restart() +{ + memset(m_state, 0, m_state.SizeInBytes()); + m_counter = 0; +} + +void Keccak::TruncatedFinal(byte *hash, size_t size) +{ + ThrowIfInvalidTruncatedSize(size); + + m_state.BytePtr()[m_counter] ^= 1; + m_state.BytePtr()[r()-1] ^= 0x80; + KeccakF1600(m_state); + memcpy(hash, m_state, size); + Restart(); +} + +NAMESPACE_END diff --git a/keccak.h b/keccak.h new file mode 100644 index 00000000..a5f4193a --- /dev/null +++ b/keccak.h @@ -0,0 +1,91 @@ +// keccak.h - written and placed in the public domain by Wei Dai + +//! \file keccak.h +//! \brief Classes for Keccak message digests +//! \sa Keccak + +#ifndef CRYPTOPP_KECCAK_H +#define CRYPTOPP_KECCAK_H + +#include "cryptlib.h" +#include "secblock.h" + +NAMESPACE_BEGIN(CryptoPP) + +//! \class Keccak +//! \brief Keccak message digest base class +class Keccak : public HashTransformation +{ +public: + //! \brief Construct a Keccak + //! \param digestSize the digest size, in bytes + //! \details Keccak is the base class for Keccak_224, Keccak_256, Keccak_384 and Keccak_512. + //! Library users should construct a derived class instead, and only use Keccak + //! as a base class reference or pointer. + Keccak(unsigned int digestSize) : m_digestSize(digestSize) {Restart();} + unsigned int DigestSize() const {return m_digestSize;} + std::string AlgorithmName() const {return "Keccak-" + IntToString(m_digestSize*8);} + unsigned int OptimalDataAlignment() const {return GetAlignmentOf();} + + void Update(const byte *input, size_t length); + void Restart(); + void TruncatedFinal(byte *hash, size_t size); + +protected: + inline unsigned int r() const {return 200 - 2 * m_digestSize;} + + FixedSizeSecBlock m_state; + unsigned int m_digestSize, m_counter; +}; + +//! \class Keccak_224 +//! \brief Keccak-224 message digest +class Keccak_224 : public Keccak +{ +public: + CRYPTOPP_CONSTANT(DIGESTSIZE = 28) + + //! \brief Construct a Keccak-224 message digest + Keccak_224() : Keccak(DIGESTSIZE) {} + CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Keccak-224";} +}; + +//! \class Keccak_256 +//! \brief Keccak-256 message digest +class Keccak_256 : public Keccak +{ +public: + CRYPTOPP_CONSTANT(DIGESTSIZE = 32) + + //! \brief Construct a Keccak-256 message digest + Keccak_256() : Keccak(DIGESTSIZE) {} + CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Keccak-256";} +}; + +//! \class Keccak_384 +//! \brief Keccak-384 message digest +class Keccak_384 : public Keccak +{ +public: + CRYPTOPP_CONSTANT(DIGESTSIZE = 48) + + //! \brief Construct a Keccak-384 message digest + Keccak_384() : Keccak(DIGESTSIZE) {} + CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Keccak-384";} +}; + +//! \class Keccak_512 +//! \brief Keccak-512 message digest +class Keccak_512 : public Keccak +{ +public: + CRYPTOPP_CONSTANT(DIGESTSIZE = 64) + + //! \brief Construct a Keccak-512 message digest + Keccak_512() : Keccak(DIGESTSIZE) {} + CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "Keccak-512";} +}; + +NAMESPACE_END + +#endif diff --git a/mqv.cpp b/mqv.cpp index 84a6af03..71c185c7 100644 --- a/mqv.cpp +++ b/mqv.cpp @@ -1,7 +1,11 @@ // mqv.cpp - written and placed in the public domain by Wei Dai +// HMQV provided by Jeffrey Walton, Ray Clayton and Uri Blumenthal. +// FHMQV provided by Uri Blumenthal. #include "pch.h" #include "mqv.h" +#include "hmqv.h" +#include "fhmqv.h" NAMESPACE_BEGIN(CryptoPP) @@ -10,6 +14,16 @@ void TestInstantiations_MQV() { MQV mqv; } + +void TestInstantiations_HMQV() +{ + HMQV hmqv; +} + +void TestInstantiations_FHMQV() +{ + FHMQV fhmqv; +} #endif NAMESPACE_END diff --git a/regtest.cpp b/regtest.cpp index e5827f92..37b65982 100644 --- a/regtest.cpp +++ b/regtest.cpp @@ -50,6 +50,7 @@ #include "seal.h" #include "crc.h" #include "adler32.h" +#include "keccak.h" #include "sha3.h" #include "blake2.h" #include "hkdf.h" @@ -94,6 +95,10 @@ void RegisterFactories() RegisterDefaultFactoryFor(); RegisterDefaultFactoryFor >(); RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); RegisterDefaultFactoryFor(); RegisterDefaultFactoryFor(); RegisterDefaultFactoryFor(); diff --git a/sha3.cpp b/sha3.cpp index c94bec39..4e383479 100644 --- a/sha3.cpp +++ b/sha3.cpp @@ -19,14 +19,14 @@ http://creativecommons.org/publicdomain/zero/1.0/ NAMESPACE_BEGIN(CryptoPP) -static const word64 KeccakF_RoundConstants[24] = +static const word64 KeccakF_RoundConstants[24] = { W64LIT(0x0000000000000001), W64LIT(0x0000000000008082), W64LIT(0x800000000000808a), W64LIT(0x8000000080008000), W64LIT(0x000000000000808b), W64LIT(0x0000000080000001), W64LIT(0x8000000080008081), W64LIT(0x8000000000008009), W64LIT(0x000000000000008a), W64LIT(0x0000000000000088), W64LIT(0x0000000080008009), W64LIT(0x000000008000000a), W64LIT(0x000000008000808b), W64LIT(0x800000000000008b), W64LIT(0x8000000000008089), - W64LIT(0x8000000000008003), W64LIT(0x8000000000008002), W64LIT(0x8000000000000080), + W64LIT(0x8000000000008003), W64LIT(0x8000000000008002), W64LIT(0x8000000000000080), W64LIT(0x000000000000800a), W64LIT(0x800000008000000a), W64LIT(0x8000000080008081), W64LIT(0x8000000000008080), W64LIT(0x0000000080000001), W64LIT(0x8000000080008008) }; @@ -281,12 +281,7 @@ void SHA3::TruncatedFinal(byte *hash, size_t size) { ThrowIfInvalidTruncatedSize(size); -#if defined(CRYPTOPP_USE_FIPS_202_SHA3) m_state.BytePtr()[m_counter] ^= 0x06; -#else - m_state.BytePtr()[m_counter] ^= 1; -#endif - m_state.BytePtr()[r()-1] ^= 0x80; KeccakF1600(m_state); memcpy(hash, m_state, size); diff --git a/sha3.h b/sha3.h index d0222150..ed3a03b8 100644 --- a/sha3.h +++ b/sha3.h @@ -2,12 +2,10 @@ //! \file sha3.h //! \brief Classes for SHA-3 message digests -//! \details The Crypto++ SHA-3 implementation dates back to January 2013 when NIST -//! selected Keccak as SHA-3. In August 2015 NIST finalized SHA-3, and it was a -//! modified version of the Keccak selection. Crypto++ 5.6.2 through 5.6.4 provides -//! the pre-FIPS 202 version of SHA-3; while Crypto++ 5.7 and above provides -//! the FIPS 202 version of SHA-3. -//! \sa SHA-3 +//! \details The Crypto++ SHA-3 conforms to FIPS 202 version of SHA-3. +//! Previous behavior is available in Keccak classes. +//! \sa SHA-3, +//! SHA-3 STANDARD (FIPS 202). #ifndef CRYPTOPP_SHA3_H #define CRYPTOPP_SHA3_H @@ -29,7 +27,7 @@ public: //! as a base class reference or pointer. SHA3(unsigned int digestSize) : m_digestSize(digestSize) {Restart();} unsigned int DigestSize() const {return m_digestSize;} - std::string AlgorithmName() const {return "SHA-3-" + IntToString(m_digestSize*8);} + std::string AlgorithmName() const {return "SHA3-" + IntToString(m_digestSize*8);} unsigned int OptimalDataAlignment() const {return GetAlignmentOf();} void Update(const byte *input, size_t length); @@ -52,8 +50,8 @@ public: //! \brief Construct a SHA3-224 message digest SHA3_224() : SHA3(DIGESTSIZE) {} - CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA-3-224";} -} CRYPTOPP_DEPRECATED("SHA-3 will be changing in the future due to FIPS 202 finalization"); + CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA3-224";} +}; //! \class SHA3_256 //! \brief SHA3-256 message digest @@ -64,8 +62,8 @@ public: //! \brief Construct a SHA3-256 message digest SHA3_256() : SHA3(DIGESTSIZE) {} - CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA-3-256";} -} CRYPTOPP_DEPRECATED("SHA-3 will be changing in the future due to FIPS 202 finalization"); + CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA3-256";} +}; //! \class SHA3_384 //! \brief SHA3-384 message digest @@ -76,8 +74,8 @@ public: //! \brief Construct a SHA3-384 message digest SHA3_384() : SHA3(DIGESTSIZE) {} - CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA-3-384";} -} CRYPTOPP_DEPRECATED("SHA-3 will be changing in the future due to FIPS 202 finalization"); + CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA3-384";} +}; //! \class SHA3_512 //! \brief SHA3-512 message digest @@ -88,8 +86,8 @@ public: //! \brief Construct a SHA3-512 message digest SHA3_512() : SHA3(DIGESTSIZE) {} - CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA-3-512";} -} CRYPTOPP_DEPRECATED("SHA-3 will be changing in the future due to FIPS 202 finalization"); + CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "SHA3-512";} +}; NAMESPACE_END diff --git a/test.cpp b/test.cpp index 61965685..bf0ddc02 100644 --- a/test.cpp +++ b/test.cpp @@ -291,12 +291,6 @@ int CRYPTOPP_API main(int argc, char *argv[]) { // TestDataFile() adds CRYPTOPP_DATA_DIR as required std::string fname = (argv[2] ? argv[2] : "all"); -#if defined(CRYPTOPP_USE_FIPS_202_SHA3) - if (fname == "sha3") - fname = "sha3_fips_202"; - if (fname == "all") - fname = "all_fips_202"; -#endif if (fname.find(".txt") == std::string::npos) fname = "TestVectors/" + fname + ".txt"; diff --git a/validat1.cpp b/validat1.cpp index fc86a08d..6a022d5c 100644 --- a/validat1.cpp +++ b/validat1.cpp @@ -98,11 +98,8 @@ bool ValidateAll(bool thorough) pass=ValidateMD5() && pass; pass=ValidateSHA() && pass; -#if defined(CRYPTOPP_USE_FIPS_202_SHA3) + pass=RunTestDataFile(CRYPTOPP_DATA_DIR "TestVectors/keccak.txt") && pass; pass=RunTestDataFile(CRYPTOPP_DATA_DIR "TestVectors/sha3_fips_202.txt") && pass; -#else - pass=RunTestDataFile(CRYPTOPP_DATA_DIR "TestVectors/sha3.txt") && pass; -#endif pass=ValidateTiger() && pass; pass=ValidateRIPEMD() && pass; diff --git a/vs2010.zip b/vs2010.zip index 616ea200e871ebf351ac2e19330d704668abb3ca..858257df76b6a36c23782c0121af1fba557d7063 100644 GIT binary patch delta 9382 zcmZ`<1zc25v?c@*B%~YZUJ#^9=~TLw5D^eqy7Nj3Ea}oIAs|S1ON(^Z(g+d@3Ifs( z#rnVZdwaj%-I>|hnKNh3`OeJT3r|H(PeaC0RYJW%h=hWKfg~Nkq7Z{ai~gi%SVyL> zj87RAWhxLBfXa-n+c&JE+gDMFDvJH1Xb1045yhR?m^f2`EDC*?m3{SuNJyFkupSDE zU;lt@QrrdlA+JbUZ$)qS1(zzmcozM{U((!hK#f6j2Q*7{5?`?SWNrI+CvQfe^qyuw z!)^1+k!`lcyoQ2|`m>Lpa+{7zjPM1TmEL4?_%!W#A51Gs!nf2P12yI_|3Nu7^ij%{$v!0Qm=(@8w_9I``})TpBuBXB6A)K#Jr z>@qbl;yT6}%U#VahEcs#VPv!Y=Al90-oeL62v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