From 46ada21a303b4444b3e0a86be2d82148503f51fe Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Tue, 12 Jan 2021 22:36:27 -0800 Subject: [PATCH] Update to CryptoPP 8.5.0. This should make it work with Apple M1 --- ChangeLog.txt | 7 +- vendor/README | 9 +- vendor/cryptopp/vendor_cryptopp/.appveyor.yml | 55 + vendor/cryptopp/vendor_cryptopp/.cirrus.yml | 59 + .../cryptopp/vendor_cryptopp/.gitattributes | 1 + .../vendor_cryptopp/.github/issue_template.md | 17 + .../.github/workflows/c-cpp.yml | 19 + vendor/cryptopp/vendor_cryptopp/.gitignore | 17 +- vendor/cryptopp/vendor_cryptopp/.travis.yml | 655 + vendor/cryptopp/vendor_cryptopp/3way.cpp | 2 +- .../cryptopp/vendor_cryptopp/CMakeLists.txt | 440 +- vendor/cryptopp/vendor_cryptopp/Doxyfile | 165 +- vendor/cryptopp/vendor_cryptopp/Filelist.txt | 69 +- vendor/cryptopp/vendor_cryptopp/GNUmakefile | 895 +- .../vendor_cryptopp/GNUmakefile-cross | 411 +- vendor/cryptopp/vendor_cryptopp/History.txt | 62 + vendor/cryptopp/vendor_cryptopp/Install.txt | 78 +- vendor/cryptopp/vendor_cryptopp/License.txt | 5 +- vendor/cryptopp/vendor_cryptopp/Readme.txt | 177 +- vendor/cryptopp/vendor_cryptopp/Security.md | 15 + .../vendor_cryptopp/TestData/ecies_p160.dat | 1 + .../vendor_cryptopp/TestData/ecies_t163.dat | 1 + .../vendor_cryptopp/TestData/elgc1024.dat | 2 +- .../vendor_cryptopp/TestPrograms/dump2def.cxx | 214 + .../TestPrograms/test_32bit.cxx | 6 +- .../TestPrograms/test_64bit.cxx | 6 +- ..._arm_acle.cxx => test_arm_acle_header.cxx} | 3 +- .../TestPrograms/test_arm_aes.cxx | 24 +- .../TestPrograms/test_arm_asimd.cxx | 18 +- .../TestPrograms/test_arm_crc.cxx | 28 +- .../TestPrograms/test_arm_neon.cxx | 10 +- .../TestPrograms/test_arm_neon_header.cxx | 6 + .../TestPrograms/test_arm_pmull.cxx | 26 +- .../TestPrograms/test_arm_sha.cxx | 21 - .../TestPrograms/test_arm_sha1.cxx | 16 + .../TestPrograms/test_arm_sha256.cxx | 16 + .../TestPrograms/test_arm_sha3.cxx | 40 +- .../TestPrograms/test_arm_sha512.cxx | 40 +- .../TestPrograms/test_arm_sm3.cxx | 32 +- .../TestPrograms/test_arm_sm4.cxx | 22 +- .../TestPrograms/test_asm_mixed.cxx | 31 + .../vendor_cryptopp/TestPrograms/test_cxx.cxx | 4 +- .../TestPrograms/test_cxx11.cxx | 11 + .../TestPrograms/test_cxx11_alignas.cxx | 5 + .../TestPrograms/test_cxx11_alignof.cxx | 6 + .../TestPrograms/test_cxx11_assert.cxx | 10 + .../TestPrograms/test_cxx11_atomic.cxx | 7 + .../TestPrograms/test_cxx11_auto.cxx | 5 + .../TestPrograms/test_cxx11_constexpr.cxx | 10 + .../TestPrograms/test_cxx11_deletefn.cxx | 10 + .../TestPrograms/test_cxx11_enumtype.cxx | 7 + .../TestPrograms/test_cxx11_initializer.cxx | 6 + .../TestPrograms/test_cxx11_lambda.cxx | 10 + .../TestPrograms/test_cxx11_noexcept.cxx | 29 + .../TestPrograms/test_cxx11_nullptr.cxx | 6 + .../TestPrograms/test_cxx11_staticinit.cxx | 11 + .../TestPrograms/test_cxx11_sync.cxx | 7 + .../TestPrograms/test_cxx11_vartemplates.cxx | 9 + .../TestPrograms/test_cxx14.cxx | 9 + .../TestPrograms/test_cxx17.cxx | 9 + .../TestPrograms/test_cxx17_assert.cxx | 10 + .../TestPrograms/test_cxx17_exceptions.cxx | 11 + .../TestPrograms/test_cxx98_exception.cxx | 12 + .../TestPrograms/test_glibc.cxx | 8 + .../TestPrograms/test_mixed_asm.cxx | 31 - .../TestPrograms/test_newlib.cxx | 4 +- .../TestPrograms/test_ppc_aes.cxx | 34 +- .../TestPrograms/test_ppc_altivec.cxx | 13 +- .../TestPrograms/test_ppc_power7.cxx | 71 +- .../TestPrograms/test_ppc_power8.cxx | 45 +- .../TestPrograms/test_ppc_power9.cxx | 45 +- .../TestPrograms/test_ppc_sha.cxx | 14 +- .../TestPrograms/test_ppc_vmull.cxx | 14 +- .../TestPrograms/test_pthreads.cxx | 10 +- .../TestPrograms/test_x86_aes.cxx | 12 +- .../TestPrograms/test_x86_avx.cxx | 6 +- .../TestPrograms/test_x86_avx2.cxx | 8 +- .../TestPrograms/test_x86_clmul.cxx | 6 +- .../TestPrograms/test_x86_cpuid.cxx | 6 +- .../TestPrograms/test_x86_rdrand.cxx | 10 + .../TestPrograms/test_x86_rdseed.cxx | 10 + .../TestPrograms/test_x86_sha.cxx | 18 +- .../TestPrograms/test_x86_sse2.cxx | 6 +- .../TestPrograms/test_x86_sse3.cxx | 6 +- .../TestPrograms/test_x86_sse41.cxx | 10 +- .../TestPrograms/test_x86_sse42.cxx | 6 +- .../TestPrograms/test_x86_ssse3.cxx | 6 +- .../TestPrograms/test_x86_via_aes.cxx | 39 + .../TestPrograms/test_x86_via_rng.cxx | 38 + .../TestPrograms/test_x86_via_sha.cxx | 39 + .../TestScripts/change-version.sh | 26 +- .../vendor_cryptopp/TestScripts/configure.sh | 930 ++ .../TestScripts/cryptest-android-mk.sh | 126 + .../TestScripts/cryptest-android.sh | 138 +- .../TestScripts/cryptest-autotools.sh | 195 +- .../TestScripts/cryptest-cmake.sh | 73 +- .../TestScripts/cryptest-ios.sh | 123 +- .../TestScripts/cryptest-pem.sh | 111 + .../TestScripts/cryptest-symbols.sh | 302 +- .../TestScripts/cryptest-tidy.sh | 12 + .../vendor_cryptopp/TestScripts/cryptest.sh | 11049 ++++++++-------- .../vendor_cryptopp/TestScripts/governor.sh | 39 +- .../TestScripts/install-android.sh | 16 - .../TestScripts/install-ndk.sh | 207 + .../TestScripts/make-benchmarks.sh | 39 +- .../vendor_cryptopp/TestScripts/reset-fork.sh | 7 + .../TestScripts/setenv-android-gcc.sh | 449 - .../TestScripts/setenv-android-old.sh | 430 - .../TestScripts/setenv-android.sh | 364 + .../TestScripts/setenv-embedded.sh | 51 +- .../vendor_cryptopp/TestScripts/setenv-ios.sh | 486 +- .../TestScripts/setenv-travis.sh | 18 - .../vendor_cryptopp/TestScripts/tweetnacl.sh | 47 - .../vendor_cryptopp/TestVectors/aes.txt | 106 + .../vendor_cryptopp/TestVectors/all.txt | 2 + .../vendor_cryptopp/TestVectors/blake2b.txt | 1 - .../vendor_cryptopp/TestVectors/xts.txt | 8228 ++++++++++++ vendor/cryptopp/vendor_cryptopp/adler32.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/adler32.h | 2 +- vendor/cryptopp/vendor_cryptopp/adv_simd.h | 1220 +- vendor/cryptopp/vendor_cryptopp/aes.h | 2 +- vendor/cryptopp/vendor_cryptopp/aes_armv4.S | 101 +- vendor/cryptopp/vendor_cryptopp/aes_armv4.h | 8 +- vendor/cryptopp/vendor_cryptopp/algebra.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/algebra.h | 42 +- vendor/cryptopp/vendor_cryptopp/algparam.h | 12 +- vendor/cryptopp/vendor_cryptopp/allocate.cpp | 107 + vendor/cryptopp/vendor_cryptopp/allocate.h | 74 + vendor/cryptopp/vendor_cryptopp/arc4.h | 4 +- vendor/cryptopp/vendor_cryptopp/aria_simd.cpp | 10 +- vendor/cryptopp/vendor_cryptopp/arm_simd.h | 25 +- vendor/cryptopp/vendor_cryptopp/asn.cpp | 137 +- vendor/cryptopp/vendor_cryptopp/asn.h | 496 +- vendor/cryptopp/vendor_cryptopp/authenc.cpp | 3 + vendor/cryptopp/vendor_cryptopp/basecode.h | 25 +- vendor/cryptopp/vendor_cryptopp/bench.h | 54 +- vendor/cryptopp/vendor_cryptopp/bench1.cpp | 42 +- vendor/cryptopp/vendor_cryptopp/bench2.cpp | 11 +- vendor/cryptopp/vendor_cryptopp/bench3.cpp | 64 +- vendor/cryptopp/vendor_cryptopp/blake2.cpp | 81 +- vendor/cryptopp/vendor_cryptopp/blake2.h | 80 +- .../cryptopp/vendor_cryptopp/blake2b_simd.cpp | 271 +- .../cryptopp/vendor_cryptopp/blake2s_simd.cpp | 249 +- vendor/cryptopp/vendor_cryptopp/blumshub.h | 20 +- vendor/cryptopp/vendor_cryptopp/chacha.cpp | 28 +- vendor/cryptopp/vendor_cryptopp/chacha.h | 102 +- .../cryptopp/vendor_cryptopp/chacha_avx.cpp | 152 +- .../cryptopp/vendor_cryptopp/chacha_simd.cpp | 116 +- .../cryptopp/vendor_cryptopp/chachapoly.cpp | 8 +- vendor/cryptopp/vendor_cryptopp/chachapoly.h | 54 +- vendor/cryptopp/vendor_cryptopp/cham.cpp | 86 +- vendor/cryptopp/vendor_cryptopp/cham.h | 21 +- vendor/cryptopp/vendor_cryptopp/cham_simd.cpp | 645 +- vendor/cryptopp/vendor_cryptopp/cmac.cpp | 33 +- vendor/cryptopp/vendor_cryptopp/cmac.h | 8 +- vendor/cryptopp/vendor_cryptopp/config.h | 1270 +- .../cryptopp/vendor_cryptopp/config_align.h | 72 + vendor/cryptopp/vendor_cryptopp/config_asm.h | 476 + vendor/cryptopp/vendor_cryptopp/config_cpu.h | 211 + vendor/cryptopp/vendor_cryptopp/config_cxx.h | 259 + vendor/cryptopp/vendor_cryptopp/config_dll.h | 178 + vendor/cryptopp/vendor_cryptopp/config_int.h | 253 + vendor/cryptopp/vendor_cryptopp/config_misc.h | 194 + vendor/cryptopp/vendor_cryptopp/config_ns.h | 76 + vendor/cryptopp/vendor_cryptopp/config_os.h | 168 + vendor/cryptopp/vendor_cryptopp/config_ver.h | 79 + vendor/cryptopp/vendor_cryptopp/cpu.cpp | 993 +- vendor/cryptopp/vendor_cryptopp/cpu.h | 619 +- vendor/cryptopp/vendor_cryptopp/crc.h | 4 +- vendor/cryptopp/vendor_cryptopp/crc_simd.cpp | 8 +- .../cryptopp/vendor_cryptopp/cryptdll.vcxproj | 12 + .../vendor_cryptopp/cryptdll.vcxproj.filters | 36 + .../cryptopp/vendor_cryptopp/cryptest.nmake | 74 +- vendor/cryptopp/vendor_cryptopp/cryptest.sh | 7188 ---------- .../cryptopp/vendor_cryptopp/cryptest.vcxproj | 5 +- vendor/cryptopp/vendor_cryptopp/cryptlib.cpp | 77 +- vendor/cryptopp/vendor_cryptopp/cryptlib.h | 1068 +- .../cryptopp/vendor_cryptopp/cryptlib.vcxproj | 28 +- .../vendor_cryptopp/cryptlib.vcxproj.filters | 57 +- vendor/cryptopp/vendor_cryptopp/cryptopp.rc | 12 +- vendor/cryptopp/vendor_cryptopp/darn.cpp | 5 +- vendor/cryptopp/vendor_cryptopp/darn.h | 13 +- vendor/cryptopp/vendor_cryptopp/datatest.cpp | 4 +- vendor/cryptopp/vendor_cryptopp/default.h | 58 +- vendor/cryptopp/vendor_cryptopp/dmac.h | 2 +- vendor/cryptopp/vendor_cryptopp/donna.h | 17 +- vendor/cryptopp/vendor_cryptopp/donna_32.cpp | 69 +- vendor/cryptopp/vendor_cryptopp/donna_64.cpp | 69 +- vendor/cryptopp/vendor_cryptopp/donna_64.h | 2 +- vendor/cryptopp/vendor_cryptopp/donna_sse.cpp | 10 +- vendor/cryptopp/vendor_cryptopp/drbg.h | 210 +- vendor/cryptopp/vendor_cryptopp/dsa.h | 21 +- vendor/cryptopp/vendor_cryptopp/ec2n.cpp | 25 +- vendor/cryptopp/vendor_cryptopp/ec2n.h | 5 +- vendor/cryptopp/vendor_cryptopp/eccrypto.cpp | 10 + vendor/cryptopp/vendor_cryptopp/eccrypto.h | 4 + vendor/cryptopp/vendor_cryptopp/ecp.cpp | 44 +- vendor/cryptopp/vendor_cryptopp/ecp.h | 24 +- vendor/cryptopp/vendor_cryptopp/ecpoint.h | 18 +- vendor/cryptopp/vendor_cryptopp/elgamal.h | 183 +- vendor/cryptopp/vendor_cryptopp/eprecomp.h | 24 +- vendor/cryptopp/vendor_cryptopp/fhmqv.h | 231 +- vendor/cryptopp/vendor_cryptopp/files.cpp | 54 +- vendor/cryptopp/vendor_cryptopp/files.h | 12 +- vendor/cryptopp/vendor_cryptopp/filters.cpp | 29 +- vendor/cryptopp/vendor_cryptopp/filters.h | 310 +- vendor/cryptopp/vendor_cryptopp/fips140.cpp | 12 +- vendor/cryptopp/vendor_cryptopp/fips140.h | 8 +- vendor/cryptopp/vendor_cryptopp/fipstest.cpp | 4 +- vendor/cryptopp/vendor_cryptopp/gcm.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/gcm_simd.cpp | 84 +- vendor/cryptopp/vendor_cryptopp/gf2n.cpp | 10 +- vendor/cryptopp/vendor_cryptopp/gf2n.h | 12 +- vendor/cryptopp/vendor_cryptopp/gf2n_simd.cpp | 54 +- vendor/cryptopp/vendor_cryptopp/gfpcrypt.cpp | 31 +- vendor/cryptopp/vendor_cryptopp/gfpcrypt.h | 159 +- vendor/cryptopp/vendor_cryptopp/hight.h | 2 +- vendor/cryptopp/vendor_cryptopp/hkdf.h | 16 +- vendor/cryptopp/vendor_cryptopp/hmac.cpp | 6 +- vendor/cryptopp/vendor_cryptopp/hmac.h | 4 +- vendor/cryptopp/vendor_cryptopp/hmqv.h | 246 +- vendor/cryptopp/vendor_cryptopp/hrtimer.h | 85 +- vendor/cryptopp/vendor_cryptopp/integer.cpp | 95 +- vendor/cryptopp/vendor_cryptopp/integer.h | 108 +- vendor/cryptopp/vendor_cryptopp/iterhash.h | 15 +- vendor/cryptopp/vendor_cryptopp/kalyna.cpp | 50 +- vendor/cryptopp/vendor_cryptopp/kalyna.h | 10 +- vendor/cryptopp/vendor_cryptopp/keccak.h | 8 +- .../cryptopp/vendor_cryptopp/keccak_simd.cpp | 165 +- vendor/cryptopp/vendor_cryptopp/lea.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/lea.h | 4 +- vendor/cryptopp/vendor_cryptopp/lea_simd.cpp | 27 +- vendor/cryptopp/vendor_cryptopp/lubyrack.h | 2 +- vendor/cryptopp/vendor_cryptopp/md2.h | 4 +- vendor/cryptopp/vendor_cryptopp/mersenne.h | 87 +- vendor/cryptopp/vendor_cryptopp/misc.cpp | 107 +- vendor/cryptopp/vendor_cryptopp/misc.h | 894 +- vendor/cryptopp/vendor_cryptopp/modarith.h | 95 +- vendor/cryptopp/vendor_cryptopp/modes.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/modes.h | 16 +- vendor/cryptopp/vendor_cryptopp/mqv.cpp | 15 +- vendor/cryptopp/vendor_cryptopp/mqv.h | 65 +- vendor/cryptopp/vendor_cryptopp/naclite.h | 106 +- vendor/cryptopp/vendor_cryptopp/nbtheory.cpp | 24 +- vendor/cryptopp/vendor_cryptopp/nbtheory.h | 63 +- vendor/cryptopp/vendor_cryptopp/neon_simd.cpp | 239 +- vendor/cryptopp/vendor_cryptopp/nr.h | 5 + vendor/cryptopp/vendor_cryptopp/oids.h | 38 +- vendor/cryptopp/vendor_cryptopp/osrng.cpp | 36 +- vendor/cryptopp/vendor_cryptopp/osrng.h | 99 +- vendor/cryptopp/vendor_cryptopp/ossig.h | 44 +- vendor/cryptopp/vendor_cryptopp/padlkrng.cpp | 1 + vendor/cryptopp/vendor_cryptopp/padlkrng.h | 6 +- vendor/cryptopp/vendor_cryptopp/panama.h | 4 +- vendor/cryptopp/vendor_cryptopp/poly1305.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/poly1305.h | 12 +- .../cryptopp/vendor_cryptopp/ppc_power7.cpp | 23 +- .../cryptopp/vendor_cryptopp/ppc_power8.cpp | 14 +- .../cryptopp/vendor_cryptopp/ppc_power9.cpp | 14 +- vendor/cryptopp/vendor_cryptopp/ppc_simd.cpp | 3 + vendor/cryptopp/vendor_cryptopp/ppc_simd.h | 2648 ++-- vendor/cryptopp/vendor_cryptopp/pssr.h | 6 +- vendor/cryptopp/vendor_cryptopp/pubkey.h | 131 +- vendor/cryptopp/vendor_cryptopp/pwdbased.h | 67 +- vendor/cryptopp/vendor_cryptopp/queue.cpp | 25 + vendor/cryptopp/vendor_cryptopp/randpool.cpp | 17 +- vendor/cryptopp/vendor_cryptopp/randpool.h | 46 +- vendor/cryptopp/vendor_cryptopp/rc2.h | 5 +- .../cryptopp/vendor_cryptopp/rdrand-masm.cmd | 117 - .../cryptopp/vendor_cryptopp/rdrand-nasm.sh | 64 - vendor/cryptopp/vendor_cryptopp/rdrand.asm | 266 +- vendor/cryptopp/vendor_cryptopp/rdrand.cpp | 80 +- vendor/cryptopp/vendor_cryptopp/rdrand.h | 6 +- vendor/cryptopp/vendor_cryptopp/rdrand.s | 492 - vendor/cryptopp/vendor_cryptopp/rdseed.asm | 230 + vendor/cryptopp/vendor_cryptopp/regtest1.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/regtest2.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/regtest3.cpp | 4 +- vendor/cryptopp/vendor_cryptopp/regtest4.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/rijndael.cpp | 30 +- vendor/cryptopp/vendor_cryptopp/rijndael.h | 2 +- .../vendor_cryptopp/rijndael_simd.cpp | 89 +- vendor/cryptopp/vendor_cryptopp/rng.cpp | 11 +- vendor/cryptopp/vendor_cryptopp/rng.h | 30 +- vendor/cryptopp/vendor_cryptopp/rsa.h | 8 +- vendor/cryptopp/vendor_cryptopp/rw.cpp | 14 + vendor/cryptopp/vendor_cryptopp/salsa.cpp | 14 +- vendor/cryptopp/vendor_cryptopp/salsa.h | 19 +- vendor/cryptopp/vendor_cryptopp/scrypt.cpp | 29 +- vendor/cryptopp/vendor_cryptopp/scrypt.h | 8 +- vendor/cryptopp/vendor_cryptopp/secblock.h | 621 +- vendor/cryptopp/vendor_cryptopp/secblockfwd.h | 29 + vendor/cryptopp/vendor_cryptopp/seckey.h | 64 +- vendor/cryptopp/vendor_cryptopp/serpent.h | 19 +- vendor/cryptopp/vendor_cryptopp/serpentp.h | 5 + .../vendor_cryptopp/setenv-android-gcc.sh | 449 - .../vendor_cryptopp/setenv-embedded.sh | 145 - vendor/cryptopp/vendor_cryptopp/setenv-ios.sh | 332 - vendor/cryptopp/vendor_cryptopp/sha.cpp | 191 +- vendor/cryptopp/vendor_cryptopp/sha.h | 10 +- vendor/cryptopp/vendor_cryptopp/sha1_armv4.S | 1410 ++ vendor/cryptopp/vendor_cryptopp/sha1_armv4.h | 23 + .../cryptopp/vendor_cryptopp/sha256_armv4.S | 2670 ++++ .../cryptopp/vendor_cryptopp/sha256_armv4.h | 23 + vendor/cryptopp/vendor_cryptopp/sha3.h | 6 +- .../cryptopp/vendor_cryptopp/sha512_armv4.S | 1861 +++ .../cryptopp/vendor_cryptopp/sha512_armv4.h | 23 + vendor/cryptopp/vendor_cryptopp/sha_simd.cpp | 47 +- .../cryptopp/vendor_cryptopp/shacal2_simd.cpp | 4 +- vendor/cryptopp/vendor_cryptopp/shake.h | 6 +- vendor/cryptopp/vendor_cryptopp/simeck.cpp | 40 - vendor/cryptopp/vendor_cryptopp/simeck.h | 18 +- .../cryptopp/vendor_cryptopp/simeck_simd.cpp | 344 - vendor/cryptopp/vendor_cryptopp/simon.cpp | 183 +- vendor/cryptopp/vendor_cryptopp/simon.h | 89 +- .../vendor_cryptopp/simon128_simd.cpp | 286 +- .../cryptopp/vendor_cryptopp/simon64_simd.cpp | 877 -- vendor/cryptopp/vendor_cryptopp/simple.h | 205 +- vendor/cryptopp/vendor_cryptopp/siphash.h | 5 +- vendor/cryptopp/vendor_cryptopp/skipjack.h | 10 +- vendor/cryptopp/vendor_cryptopp/sm3.h | 2 +- vendor/cryptopp/vendor_cryptopp/sm4.cpp | 4 + vendor/cryptopp/vendor_cryptopp/sm4.h | 2 +- vendor/cryptopp/vendor_cryptopp/sm4_simd.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/smartptr.h | 9 +- vendor/cryptopp/vendor_cryptopp/speck.cpp | 199 +- vendor/cryptopp/vendor_cryptopp/speck.h | 59 +- .../vendor_cryptopp/speck128_simd.cpp | 253 +- .../cryptopp/vendor_cryptopp/speck64_simd.cpp | 787 -- vendor/cryptopp/vendor_cryptopp/sse_simd.cpp | 11 +- vendor/cryptopp/vendor_cryptopp/stdcpp.h | 2 +- vendor/cryptopp/vendor_cryptopp/strciphr.cpp | 41 +- vendor/cryptopp/vendor_cryptopp/strciphr.h | 62 +- vendor/cryptopp/vendor_cryptopp/tea.cpp | 15 +- vendor/cryptopp/vendor_cryptopp/tea.h | 6 +- vendor/cryptopp/vendor_cryptopp/test.cpp | 110 +- vendor/cryptopp/vendor_cryptopp/threefish.h | 4 +- vendor/cryptopp/vendor_cryptopp/tiger.cpp | 8 +- vendor/cryptopp/vendor_cryptopp/tiger.h | 25 +- vendor/cryptopp/vendor_cryptopp/trap.h | 134 +- vendor/cryptopp/vendor_cryptopp/trunhash.h | 13 +- vendor/cryptopp/vendor_cryptopp/ttmac.h | 4 +- vendor/cryptopp/vendor_cryptopp/tweetnacl.cpp | 10 +- vendor/cryptopp/vendor_cryptopp/tweetnacl.h | 9 + vendor/cryptopp/vendor_cryptopp/validat0.cpp | 6 +- vendor/cryptopp/vendor_cryptopp/validat2.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/validat3.cpp | 41 +- vendor/cryptopp/vendor_cryptopp/validat4.cpp | 10 +- vendor/cryptopp/vendor_cryptopp/validat5.cpp | 207 +- vendor/cryptopp/vendor_cryptopp/validat6.cpp | 122 +- vendor/cryptopp/vendor_cryptopp/validat7.cpp | 235 +- vendor/cryptopp/vendor_cryptopp/validat8.cpp | 166 + vendor/cryptopp/vendor_cryptopp/validate.h | 26 +- vendor/cryptopp/vendor_cryptopp/vmac.cpp | 124 +- vendor/cryptopp/vendor_cryptopp/vmac.h | 10 +- vendor/cryptopp/vendor_cryptopp/vs2005.zip | Bin 12532 -> 12596 bytes vendor/cryptopp/vendor_cryptopp/words.h | 113 +- vendor/cryptopp/vendor_cryptopp/x64dll.asm | 61 +- vendor/cryptopp/vendor_cryptopp/xed25519.cpp | 10 +- vendor/cryptopp/vendor_cryptopp/xed25519.h | 352 +- vendor/cryptopp/vendor_cryptopp/xtr.cpp | 2 +- vendor/cryptopp/vendor_cryptopp/xts.cpp | 516 + vendor/cryptopp/vendor_cryptopp/xts.h | 224 + vendor/cryptopp/vendor_cryptopp/zdeflate.cpp | 12 +- vendor/cryptopp/vendor_cryptopp/zdeflate.h | 4 +- vendor/cryptopp/vendor_cryptopp/zinflate.h | 5 + vendor/cryptopp/vendor_cryptopp/zlib.h | 5 + 367 files changed, 39938 insertions(+), 29066 deletions(-) create mode 100644 vendor/cryptopp/vendor_cryptopp/.appveyor.yml create mode 100644 vendor/cryptopp/vendor_cryptopp/.cirrus.yml create mode 100644 vendor/cryptopp/vendor_cryptopp/.gitattributes create mode 100644 vendor/cryptopp/vendor_cryptopp/.github/issue_template.md create mode 100644 vendor/cryptopp/vendor_cryptopp/.github/workflows/c-cpp.yml create mode 100644 vendor/cryptopp/vendor_cryptopp/.travis.yml mode change 100755 => 100644 vendor/cryptopp/vendor_cryptopp/GNUmakefile mode change 100755 => 100644 vendor/cryptopp/vendor_cryptopp/GNUmakefile-cross create mode 100644 vendor/cryptopp/vendor_cryptopp/Security.md create mode 100644 vendor/cryptopp/vendor_cryptopp/TestData/ecies_p160.dat create mode 100644 vendor/cryptopp/vendor_cryptopp/TestData/ecies_t163.dat create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/dump2def.cxx rename vendor/cryptopp/vendor_cryptopp/TestPrograms/{test_arm_acle.cxx => test_arm_acle_header.cxx} (73%) create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_neon_header.cxx delete mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha1.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha256.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_asm_mixed.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_alignas.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_alignof.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_assert.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_atomic.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_auto.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_constexpr.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_deletefn.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_enumtype.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_initializer.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_lambda.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_noexcept.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_nullptr.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_staticinit.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_sync.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_vartemplates.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx14.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17_assert.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17_exceptions.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx98_exception.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_glibc.cxx delete mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_mixed_asm.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_rdrand.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_rdseed.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_aes.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_rng.cxx create mode 100644 vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_sha.cxx create mode 100755 vendor/cryptopp/vendor_cryptopp/TestScripts/configure.sh create mode 100755 vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-android-mk.sh create mode 100755 vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-pem.sh delete mode 100755 vendor/cryptopp/vendor_cryptopp/TestScripts/install-android.sh create mode 100755 vendor/cryptopp/vendor_cryptopp/TestScripts/install-ndk.sh delete mode 100755 vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android-gcc.sh delete mode 100755 vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android-old.sh create mode 100755 vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android.sh delete mode 100755 vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-travis.sh delete mode 100755 vendor/cryptopp/vendor_cryptopp/TestScripts/tweetnacl.sh create mode 100644 vendor/cryptopp/vendor_cryptopp/TestVectors/xts.txt create mode 100644 vendor/cryptopp/vendor_cryptopp/allocate.cpp create mode 100644 vendor/cryptopp/vendor_cryptopp/allocate.h create mode 100644 vendor/cryptopp/vendor_cryptopp/config_align.h create mode 100644 vendor/cryptopp/vendor_cryptopp/config_asm.h create mode 100644 vendor/cryptopp/vendor_cryptopp/config_cpu.h create mode 100644 vendor/cryptopp/vendor_cryptopp/config_cxx.h create mode 100644 vendor/cryptopp/vendor_cryptopp/config_dll.h create mode 100644 vendor/cryptopp/vendor_cryptopp/config_int.h create mode 100644 vendor/cryptopp/vendor_cryptopp/config_misc.h create mode 100644 vendor/cryptopp/vendor_cryptopp/config_ns.h create mode 100644 vendor/cryptopp/vendor_cryptopp/config_os.h create mode 100644 vendor/cryptopp/vendor_cryptopp/config_ver.h delete mode 100755 vendor/cryptopp/vendor_cryptopp/cryptest.sh delete mode 100755 vendor/cryptopp/vendor_cryptopp/rdrand-masm.cmd delete mode 100755 vendor/cryptopp/vendor_cryptopp/rdrand-nasm.sh delete mode 100644 vendor/cryptopp/vendor_cryptopp/rdrand.s create mode 100644 vendor/cryptopp/vendor_cryptopp/rdseed.asm create mode 100644 vendor/cryptopp/vendor_cryptopp/secblockfwd.h delete mode 100755 vendor/cryptopp/vendor_cryptopp/setenv-android-gcc.sh delete mode 100755 vendor/cryptopp/vendor_cryptopp/setenv-embedded.sh delete mode 100755 vendor/cryptopp/vendor_cryptopp/setenv-ios.sh create mode 100644 vendor/cryptopp/vendor_cryptopp/sha1_armv4.S create mode 100644 vendor/cryptopp/vendor_cryptopp/sha1_armv4.h create mode 100644 vendor/cryptopp/vendor_cryptopp/sha256_armv4.S create mode 100644 vendor/cryptopp/vendor_cryptopp/sha256_armv4.h create mode 100644 vendor/cryptopp/vendor_cryptopp/sha512_armv4.S create mode 100644 vendor/cryptopp/vendor_cryptopp/sha512_armv4.h delete mode 100644 vendor/cryptopp/vendor_cryptopp/simeck_simd.cpp delete mode 100644 vendor/cryptopp/vendor_cryptopp/simon64_simd.cpp delete mode 100644 vendor/cryptopp/vendor_cryptopp/speck64_simd.cpp create mode 100644 vendor/cryptopp/vendor_cryptopp/xts.cpp create mode 100644 vendor/cryptopp/vendor_cryptopp/xts.h diff --git a/ChangeLog.txt b/ChangeLog.txt index 6af3907e..2f8e9c5a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -9,6 +9,9 @@ Security: able to access those two blocks (i.e. 64KB of the stored data) is bad enough. See Section 8.3 in https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf XChaCha20-Poly1305 does not suffer from this constraint and stays secure even if the filesystem gets very large. +New platforms: +* CryFS should now work on devices with Apple M1 silicon + Build changes: * Switch to Conan package manager * Allow an easy way to modify how the dependencies are found. This is mostly helpful for package maintainers. @@ -18,7 +21,7 @@ Build changes: Improvements: * Display the file system configuration when mounting a file system -* Now shows a better error message when failing to load the config file and distinguishes between "wrong password" and "config file not found". +* Now shows a better error message when failing to load the config file that distinguishes between "wrong password" and "config file not found". New features: * Add support for atime mount options (noatime, strictatime, relatime, atime, nodiratime). @@ -32,6 +35,8 @@ Other: * Updated to spdlog 1.8.5 * Updated to ranges-v3 0.11.0 * Updated to boost 1.75 +* Updated to crypto++ 8.5 + Version 0.10.3 --------------- diff --git a/vendor/README b/vendor/README index 4f14963c..b3e8066f 100644 --- a/vendor/README +++ b/vendor/README @@ -1,9 +1,8 @@ This directory contains external projects, taken from the following locations: googletest: https://github.com/google/googletest/commit/eaf9a3fd77869cf95befb87455a2e2a2e85044ff - changed: In googletest/cmake/internal_utils.cmake, add cmake_policy(SET CMP0069 NEW) to silence a warning -cryptopp: https://github.com/weidai11/cryptopp/tree/CRYPTOPP_8_2_0 - - changed: added CMakeLists.txt and cryptopp-config.cmake from https://github.com/noloader/cryptopp-cmake/tree/CRYPTOPP_8_2_0 - - changed: commented out line including winapifamily.h in CMakeLists.txt +cryptopp: https://github.com/weidai11/cryptopp/tree/CRYPTOPP_8_5_0 + - changed: added CMakeLists.txt and cryptopp-config.cmake from https://github.com/noloader/cryptopp-cmake/tree/CRYPTOPP_8_5_0 - changed: In CMakeLists.txt, rename BUILD_TESTING to CRYPTOPP_BUILD_TESTING so it doesn't clash with our BUILD_TESTING - - changed: In CmakeLists.txt, add cmake_policy(SET CMP0069 NEW) to silence a warning - - changed: Fix Android compilation using patch file https://github.com/termux/termux-root-packages/files/4664745/config.h.patch.txt from https://github.com/cryfs/cryfs/issues/345 \ No newline at end of file + - changed: In CMakeLists.txt, add cmake_policy(SET CMP0069 NEW) to silence a warning + - changed: In .gitignore, remove *.cxx entry so we don't miss checking in the test files, see https://github.com/noloader/cryptopp-cmake/issues/66 diff --git a/vendor/cryptopp/vendor_cryptopp/.appveyor.yml b/vendor/cryptopp/vendor_cryptopp/.appveyor.yml new file mode 100644 index 00000000..0c833005 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/.appveyor.yml @@ -0,0 +1,55 @@ +# Appveyor's documentation is at https://www.appveyor.com/docs/build-phase/, +# and a sample configuration file is at https://www.appveyor.com/docs/appveyor-yml/. +# I have to admit its a bit complex and I don't fully understand it. + +version: 1.0.{build} +clone_depth: 5 +skip_tags: true + +configuration: + +- Debug +- Release + +platform: + +- Win32 +- x64 + +image: + +- Visual Studio 2019 +- Visual Studio 2017 +- Visual Studio 2015 +- Visual Studio 2013 + +environment: + + matrix: + + - BUILD_MODE: MSBuild + +# Disable build through solution file +build: off + +# Build through commands in script below +test_script: + +- ps: >- + + msbuild /t:Build /p:platform="$env:platform" /p:configuration="$env:configuration" cryptlib.vcxproj + + msbuild /t:Build /p:platform="$env:platform" /p:configuration="$env:configuration" cryptest.vcxproj + + msbuild /t:CopyCryptestToRoot cryptest.vcxproj + + .\cryptest.exe v + + .\cryptest.exe tv all + +notifications: + - provider: Email + to: + - cryptopp-build@googlegroups.com + on_build_success: true + on_build_failure: true diff --git a/vendor/cryptopp/vendor_cryptopp/.cirrus.yml b/vendor/cryptopp/vendor_cryptopp/.cirrus.yml new file mode 100644 index 00000000..c1e0b025 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/.cirrus.yml @@ -0,0 +1,59 @@ +# https://cirrus-ci.org/examples/ +# https://github.com/curl/curl/blob/master/.cirrus.yml + +# FreeBSD seems to have constant version problems, which requires IGNORE_OSVERSION. + +env: + CIRRUS_CLONE_DEPTH: 5 + IGNORE_OSVERSION: yes + +task: + matrix: + - name: Debug build, FreeBSD 12.1 + freebsd_instance: + image_family: freebsd-12-1 + pkginstall_script: + - pkg update -f + - pkg install -y gmake + configure_script: + compile_script: + - CXXFLAGS="-DDEBUG -g3 -O0" gmake -j 3 + test_script: + - ./cryptest.exe v + - ./cryptest.exe tv all + - name: Release build, FreeBSD 12.1 + freebsd_instance: + image_family: freebsd-12-1 + pkginstall_script: + - pkg update -f + - pkg install -y gmake + configure_script: + compile_script: + - gmake -j 3 + test_script: + - ./cryptest.exe v + - ./cryptest.exe tv all + - name: Debug build, FreeBSD 13.0 (snap) + freebsd_instance: + image_family: freebsd-13-0-snap + pkginstall_script: + - pkg update -f + - pkg install -y gmake + configure_script: + compile_script: + - CXXFLAGS="-DDEBUG -g3 -O0" gmake -j 3 + test_script: + - ./cryptest.exe v + - ./cryptest.exe tv all + - name: Release build, FreeBSD 13.0 (snap) + freebsd_instance: + image_family: freebsd-13-0-snap + pkginstall_script: + - pkg update -f + - pkg install -y gmake + configure_script: + compile_script: + - gmake -j 3 + test_script: + - ./cryptest.exe v + - ./cryptest.exe tv all diff --git a/vendor/cryptopp/vendor_cryptopp/.gitattributes b/vendor/cryptopp/vendor_cryptopp/.gitattributes new file mode 100644 index 00000000..50ca329f --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/.gitattributes @@ -0,0 +1 @@ +*.sh eol=lf diff --git a/vendor/cryptopp/vendor_cryptopp/.github/issue_template.md b/vendor/cryptopp/vendor_cryptopp/.github/issue_template.md new file mode 100644 index 00000000..c6ee9f9e --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/.github/issue_template.md @@ -0,0 +1,17 @@ +### Crypto++ Issue Report + +Thanks for taking the time to report an issue. Reporting issues helps us improve stability and reliability for all users, so it is a valuable contribution. + +Please do not ask questions in the bug tracker. Please ask questions on the Crypto++ Users List at http://groups.google.com/forum/#!forum/cryptopp-users. + +Please _do not_ ask questions at Stack Overflow. We may not be able to answer your question. + +There is a wiki page with information on filing useful bug reports. If you have some time please visit http://www.cryptopp.com/wiki/Bug_Report on the wiki. The executive summary is: + +* State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) +* State the version of the Crypto++ library (Crypto++ 7.0, Master, etc) +* State how you built the library (Makefile, Cmake, distro, etc) +* Show a typical command line (the output of the compiler for cryptlib.cpp) +* Show the link command (the output of the linker for libcryptopp.so or cryptest.exe) +* Show the exact error message you are receiving (copy and paste it); or +* Clearly state the undesired behavior (and state the expected behavior) diff --git a/vendor/cryptopp/vendor_cryptopp/.github/workflows/c-cpp.yml b/vendor/cryptopp/vendor_cryptopp/.github/workflows/c-cpp.yml new file mode 100644 index 00000000..d802cdb6 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/.github/workflows/c-cpp.yml @@ -0,0 +1,19 @@ +name: C/C++ CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: make + run: make all + - name: make test + run: make test diff --git a/vendor/cryptopp/vendor_cryptopp/.gitignore b/vendor/cryptopp/vendor_cryptopp/.gitignore index b488e960..415ec804 100644 --- a/vendor/cryptopp/vendor_cryptopp/.gitignore +++ b/vendor/cryptopp/vendor_cryptopp/.gitignore @@ -3,7 +3,7 @@ # Allows you to use test.cxx and # avoid getting in the way of things #################################### -*.cxx +#*.cxx #################### ## Crypto++ specific @@ -38,6 +38,18 @@ a.out *.o +################# +## Emacs +################# +*~ +\#*\# + +################# +## Vi swap +################# +*.swp +*.swo + ################# ## Eclipse ################# @@ -85,7 +97,10 @@ local.properties [Dd]ebug/ [Rr]elease/ +Win32/ x64/ +Arm/ +Arm64/ build/ [Bb]in/ [Oo]bj/ diff --git a/vendor/cryptopp/vendor_cryptopp/.travis.yml b/vendor/cryptopp/vendor_cryptopp/.travis.yml new file mode 100644 index 00000000..fb5fc54c --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/.travis.yml @@ -0,0 +1,655 @@ +# In the YML below each job gets an environment that includes +# BUILD_OS and BUILD_MODE. The variables are used in the driver +# scripts and is used to select a test. For example, BUILD_OS=linux +# and BUILD_MODE=all means run 'make all' on Linux. The Android +# tests specify a ANDROID_API, ANDROID_CPU; and the iOS tests +# specify IOS_SDK and IOS_CPU. They are exported for the underlying +# setenv-*.sh scripts. + +# DO NOT create top level (global) keys like env, arch, os, compiler. +# The top level/global keys invoke [unwanted] matrix expansion. Also +# see https://stackoverflow.com/q/58473000/608639 and +# https://docs.travis-ci.com/user/reference/overview/ and +# https://docs.travis-ci.com/user/multi-cpu-architectures and +# https://github.com/travis-ci/travis-yml/blob/master/schema.json. + +language: cpp +dist: bionic + +git: + depth: 5 + +# Use jobs rather than matrix since we are precisely +# specifiying our test cases. Do not move any of the +# keys (env, os, arch, compiler, etc) into global. +# Putting them in global invokes the matrix expansion. +jobs: + include: + - name: Standard build, GCC, Linux, amd64 + os: linux + arch: amd64 + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=all + - name: Native build, GCC, Linux, amd64 + os: linux + arch: amd64 + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=native + - name: No-asm build, GCC, Linux, amd64 + os: linux + arch: amd64 + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=no-asm + - name: Debug build, GCC, Linux, amd64 + os: linux + arch: amd64 + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=debug + - name: Asan build, GCC, Linux, amd64 + os: linux + arch: amd64 + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=asan + - name: UBsan build, GCC, Linux, amd64 + os: linux + arch: amd64 + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=ubsan + - name: PEM build, GCC, Linux, amd64 + os: linux + arch: amd64 + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=pem + - name: Autotools build, GCC, Linux, amd64 + os: linux + arch: amd64 + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=autotools + - name: CMake build, GCC, Linux, amd64 + os: linux + arch: amd64 + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=cmake + - name: Standard build, Clang, Linux, amd64 + os: linux + arch: amd64 + compiler: clang + env: + - BUILD_OS=linux + - BUILD_MODE=all + - name: Native build, Clang, Linux, amd64 + os: linux + arch: amd64 + compiler: clang + env: + - BUILD_OS=linux + - BUILD_MODE=native + - name: No-asm build, Clang, Linux, amd64 + os: linux + arch: amd64 + compiler: clang + env: + - BUILD_OS=linux + - BUILD_MODE=no-asm + - name: Debug build, Clang, Linux, amd64 + os: linux + arch: amd64 + compiler: clang + env: + - BUILD_OS=linux + - BUILD_MODE=debug + - name: Asan build, Clang, Linux, amd64 + os: linux + arch: amd64 + compiler: clang + env: + - BUILD_OS=linux + - BUILD_MODE=asan + - name: UBsan build, Clang, Linux, amd64 + os: linux + arch: amd64 + compiler: clang + env: + - BUILD_OS=linux + - BUILD_MODE=ubsan + - name: PEM build, Clang, Linux, amd64 + os: linux + arch: amd64 + compiler: clang + env: + - BUILD_OS=linux + - BUILD_MODE=pem + - name: Autotools build, Clang, Linux, amd64 + os: linux + arch: amd64 + compiler: clang + env: + - BUILD_OS=linux + - BUILD_MODE=autotools + - name: CMake build, Clang, Linux, amd64 + os: linux + arch: amd64 + compiler: clang + env: + - BUILD_OS=linux + - BUILD_MODE=cmake + - name: Standard build, Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - BUILD_OS=osx + - BUILD_MODE=all + - name: Standard build (64-bit), Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - CXXFLAGS="-DNDEBUG -g2 -O3 -arch x86_64" + - BUILD_OS=osx + - BUILD_MODE=all + - name: Standard build (32-bit), Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - CXXFLAGS="-DNDEBUG -g2 -O3 -arch i386" + - BUILD_OS=osx + - BUILD_MODE=all + - name: Standard build (fat), Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - CXXFLAGS="-DNDEBUG -g2 -O3 -arch i386 -arch x86_64" + - BUILD_OS=osx + - BUILD_MODE=osx-fat + - name: Native build, Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - BUILD_OS=osx + - BUILD_MODE=native + - name: No-asm build, Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - BUILD_OS=osx + - BUILD_MODE=no-asm + - name: Debug build, Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - BUILD_OS=osx + - BUILD_MODE=debug + - name: Asan build, Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - BUILD_OS=osx + - BUILD_MODE=asan + - name: UBsan build, Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - BUILD_OS=osx + - BUILD_MODE=ubsan + - name: PEM build, Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - BUILD_OS=osx + - BUILD_MODE=pem + - name: Autotools build, Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - BUILD_OS=osx + - BUILD_MODE=autotools + - name: CMake build, Clang, OS X, amd64 + os: osx + osx_image: xcode10.1 + arch: amd64 + compiler: clang + env: + - BUILD_OS=osx + - BUILD_MODE=cmake + - name: Standard build, GCC, Linux, arm64 + os: linux + arch: arm64 + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=all + - name: Native build, GCC, Linux, arm64 + os: linux + arch: arm64 + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=native + - name: No-asm build, GCC, Linux, arm64 + os: linux + arch: arm64 + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=no-asm + - name: Debug build, GCC, Linux, arm64 + os: linux + arch: arm64 + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=debug + - name: Asan build, GCC, Linux, arm64 + os: linux + arch: arm64 + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=asan + - name: UBsan build, GCC, Linux, arm64 + os: linux + arch: arm64 + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=ubsan + - name: PEM build, GCC, Linux, arm64 + os: linux + arch: arm64 + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=pem + - name: Autotools build, GCC, Linux, arm64 + os: linux + arch: arm64 + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=autotools + - name: CMake build, GCC, Linux, arm64 + os: linux + arch: arm64 + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=cmake + - name: Standard build, Clang, Linux, arm64 + os: linux + arch: arm64 + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=all + - name: Native build, Clang, Linux, arm64 + os: linux + arch: arm64 + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=native + - name: No-asm build, Clang, Linux, arm64 + os: linux + arch: arm64 + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=no-asm + - name: Debug build, Clang, Linux, arm64 + os: linux + arch: arm64 + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=debug + - name: Asan build, Clang, Linux, arm64 + os: linux + arch: arm64 + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=asan + - name: UBsan build, Clang, Linux, arm64 + os: linux + arch: arm64 + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=ubsan + - name: PEM build, Clang, Linux, arm64 + os: linux + arch: arm64 + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=pem + - name: Autotools build, Clang, Linux, arm64 + os: linux + arch: arm64 + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=autotools + - name: CMake build, Clang, Linux, arm64 + os: linux + arch: arm64 + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=cmake + - name: Standard build, GCC, Linux, ppc64le + os: linux + arch: ppc64le + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=all + - name: Debug build, GCC, Linux, ppc64le + os: linux + arch: ppc64le + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=debug + - name: Standard build, Clang, Linux, ppc64le + os: linux + arch: ppc64le + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=all + - CC=clang-8 + - CXX=clang++-8 + - name: Debug build, Clang, Linux, ppc64le + os: linux + arch: ppc64le + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=debug + - CC=clang-8 + - CXX=clang++-8 + - name: Standard build, GCC, Linux, s390x + os: linux + arch: s390x + compiler: gcc + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=all + - name: Debug build, GCC, Linux, s390x + os: linux + arch: s390x + compiler: gcc + env: + - BUILD_OS=linux + - BUILD_MODE=debug + - name: Standard build, Clang, Linux, s390x + os: linux + arch: s390x + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=all + - CC=clang-8 + - CXX=clang++-8 + - name: Debug build, Clang, Linux, s390x + os: linux + arch: s390x + compiler: clang + dist: bionic + env: + - BUILD_OS=linux + - BUILD_MODE=debug + - CC=clang-8 + - CXX=clang++-8 + - name: Android, armv7a, Linux + os: linux + arch: amd64 + env: + - BUILD_OS=linux + - BUILD_MODE=android + - ANDROID_CPU=armv7a + - ANDROID_API=23 + - ANDROID_SDK_ROOT="/opt/android-sdk" + - ANDROID_NDK_ROOT="/opt/android-ndk" + - name: Android, aarch64, Linux + os: linux + arch: amd64 + env: + - BUILD_OS=linux + - BUILD_MODE=android + - ANDROID_CPU=aarch64 + - ANDROID_API=23 + - ANDROID_SDK_ROOT="/opt/android-sdk" + - ANDROID_NDK_ROOT="/opt/android-ndk" + - name: Android, x86, Linux + os: linux + arch: amd64 + env: + - BUILD_OS=linux + - BUILD_MODE=android + - ANDROID_CPU=x86 + - ANDROID_API=23 + - ANDROID_SDK_ROOT="/opt/android-sdk" + - ANDROID_NDK_ROOT="/opt/android-ndk" + - name: Android, x86_64, Linux + os: linux + arch: amd64 + env: + - BUILD_OS=linux + - BUILD_MODE=android + - ANDROID_CPU=x86_64 + - ANDROID_API=23 + - ANDROID_SDK_ROOT="/opt/android-sdk" + - ANDROID_NDK_ROOT="/opt/android-ndk" + - name: iPhoneOS, armv7, iOS + os: osx + osx_image: xcode10.1 + arch: amd64 + env: + - BUILD_OS=osx + - BUILD_MODE=ios + - IOS_CPU=armv7s + - IOS_SDK=iPhoneOS + - name: iPhoneOS, arm64, iOS + os: osx + osx_image: xcode10.1 + arch: amd64 + env: + - BUILD_OS=osx + - BUILD_MODE=ios + - IOS_CPU=arm64 + - IOS_SDK=iPhoneOS + - name: AppleTVOS, arm64, iOS + os: osx + osx_image: xcode10.1 + arch: amd64 + env: + - BUILD_OS=osx + - BUILD_MODE=ios + - IOS_CPU=arm64 + - IOS_SDK=AppleTVOS + - name: WatchOS, armv7, iOS + os: osx + osx_image: xcode10.1 + arch: amd64 + env: + - BUILD_OS=osx + - BUILD_MODE=ios + - IOS_CPU=armv7k + - IOS_SDK=WatchOS + - name: iPhoneSimulator, i386, OS X + os: osx + osx_image: xcode10.1 + arch: amd64 + env: + - BUILD_OS=osx + - BUILD_MODE=ios + - IOS_CPU=i386 + - IOS_SDK=iPhoneSimulator + - name: iPhoneSimulator, x86_64, OS X + os: osx + osx_image: xcode10.1 + arch: amd64 + env: + - BUILD_OS=osx + - BUILD_MODE=ios + - IOS_CPU=x86_64 + - IOS_SDK=iPhoneSimulator + - name: AppleTVSimulator, x86_64, OS X + os: osx + osx_image: xcode10.1 + arch: amd64 + env: + - BUILD_OS=osx + - BUILD_MODE=ios + - IOS_CPU=x86_64 + - IOS_SDK=AppleTVSimulator + - name: WatchSimulator, i386, OS X + os: osx + osx_image: xcode10.1 + arch: amd64 + env: + - BUILD_OS=osx + - BUILD_MODE=ios + - IOS_CPU=i386 + - IOS_SDK=WatchSimulator + + allow_failures: + # Clang has a fair amount of trouble + # on platforms Apple does not support + - os: linux + arch: s390x + compiler: clang + # Clang 7.0 and below will likely have trouble on ppc64le + # due to https://bugs.llvm.org/show_bug.cgi?id=39704. + - os: linux + arch: ppc64le + compiler: clang + +before_install: + - | + if [[ "$BUILD_OS" == "linux" ]] && [[ "$BUILD_MODE" == "android" ]]; then + # https://github.com/travis-ci/travis-ci/issues/9037 + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A145 + sudo apt-get -qq -y update + sudo -E TestScripts/install-ndk.sh + fi + if [[ "$BUILD_OS" == "linux" ]] && [[ "$BUILD_MODE" == "autotools" ]]; then + # https://github.com/travis-ci/travis-ci/issues/9037 + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A145 + sudo apt-get -qq -y install autoconf automake libtool + fi + # Clang 7 compiler is completely broken on PPC64 and s390x + if [[ "$TRAVIS_CPU_ARCH" == "ppc64le" ]] || [[ "$TRAVIS_CPU_ARCH" == "s390x" ]]; then + if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_COMPILER" == "clang" ]]; then + # https://github.com/travis-ci/travis-ci/issues/9037 + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A145 + sudo apt-get -qq -y install --no-install-recommends clang-8 + fi + fi + +script: + - | + if [[ "$BUILD_MODE" == "ios" ]]; then + source TestScripts/setenv-ios.sh + make -f GNUmakefile-cross -j 2 all static dynamic + elif [[ "$BUILD_MODE" == "android" ]]; then + source TestScripts/setenv-android.sh + make -f GNUmakefile-cross -j 2 all static dynamic + elif [[ "$BUILD_MODE" == "autotools" ]]; then + bash TestScripts/cryptest-autotools.sh + elif [[ "$BUILD_MODE" == "cmake" ]]; then + bash TestScripts/cryptest-cmake.sh + elif [[ "$BUILD_MODE" == "pem" ]]; then + bash TestScripts/cryptest-pem.sh + elif [[ "$BUILD_MODE" == "osx-fat" ]]; then + CXXFLAGS="-DNDEBUG -g2 -O3 -arch i386 -arch x86_64" make -j 2 + arch -i386 ./cryptest.exe v + arch -i386 ./cryptest.exe tv all + arch -x86_64 ./cryptest.exe v + arch -x86_64 ./cryptest.exe tv all + elif [[ "$BUILD_MODE" == "debug" ]]; then + CXXFLAGS="-DDEBUG -g2 -O1" make -j 2 + ./cryptest.exe v + ./cryptest.exe tv all + else + make "$BUILD_MODE" -j 2 + ./cryptest.exe v + ./cryptest.exe tv all + fi + +# Whitelist branches to avoid testing feature branches twice +branches: + only: + - master + - /\/ci$/ + +notifications: + email: + recipients: + - cryptopp-build@googlegroups.com + on_success: always # default: change + on_failure: always # default: always diff --git a/vendor/cryptopp/vendor_cryptopp/3way.cpp b/vendor/cryptopp/vendor_cryptopp/3way.cpp index bd610536..aecbaf01 100644 --- a/vendor/cryptopp/vendor_cryptopp/3way.cpp +++ b/vendor/cryptopp/vendor_cryptopp/3way.cpp @@ -1,4 +1,4 @@ -// 3way.cpp - modifed by Wei Dai from Joan Daemen's 3way.c +// 3way.cpp - modified by Wei Dai from Joan Daemen's 3way.c // The original code and all modifications are in the public domain. #include "pch.h" diff --git a/vendor/cryptopp/vendor_cryptopp/CMakeLists.txt b/vendor/cryptopp/vendor_cryptopp/CMakeLists.txt index 7510c441..6822f58c 100644 --- a/vendor/cryptopp/vendor_cryptopp/CMakeLists.txt +++ b/vendor/cryptopp/vendor_cryptopp/CMakeLists.txt @@ -34,11 +34,11 @@ cmake_policy(SET CMP0069 NEW) if (${CMAKE_VERSION} VERSION_LESS "3.0.0") project(cryptopp) set(cryptopp_VERSION_MAJOR 8) - set(cryptopp_VERSION_MINOR 2) + set(cryptopp_VERSION_MINOR 5) set(cryptopp_VERSION_PATCH 0) else () cmake_policy(SET CMP0048 NEW) - project(cryptopp VERSION 8.2.0) + project(cryptopp VERSION 8.3.0) if (NOT ${CMAKE_VERSION} VERSION_LESS "3.1.0") cmake_policy(SET CMP0054 NEW) endif () @@ -84,7 +84,6 @@ option(DISABLE_AESNI "Disable AES-NI" OFF) option(DISABLE_SHA "Disable SHA" OFF) option(DISABLE_AVX "Disable AVX" OFF) option(DISABLE_AVX2 "Disable AVX2" OFF) -option(CRYPTOPP_NATIVE_ARCH "Enable native architecture" OFF) set(CRYPTOPP_DATA_DIR "" CACHE PATH "Crypto++ test data directory") #============================================================================ @@ -117,9 +116,24 @@ endif () if (DISABLE_SSE4) list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE4) endif () +if (DISABLE_CLMUL) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_CLMUL) +endif () if (DISABLE_AESNI) list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AESNI) endif () +if (DISABLE_RDRAND) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_RDRAND) +endif () +if (DISABLE_RDSEED) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_RDSEED) +endif () +if (DISABLE_AVX) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AVX) +endif () +if (DISABLE_AVX2) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AVX2) +endif () if (DISABLE_SHA) list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SHA) endif () @@ -227,30 +241,25 @@ function(CheckCompileLinkOption opt var prog) # TODO: improve this... CHECK_CXX_COMPILER_FLAG(${opt} ${var}) + elseif (APPLE) + + message(STATUS "Performing Test ${var}") + try_compile(COMMAND_SUCCESS ${CMAKE_BINARY_DIR} ${prog} COMPILE_DEFINITIONS ${opt}) + if (COMMAND_SUCCESS) + set(${var} 1 PARENT_SCOPE) + message(STATUS "Performing Test ${var} - Success") + else () + set(${var} 0 PARENT_SCOPE) + message(STATUS "Performing Test ${var} - Failed") + endif () + else () message(STATUS "Performing Test ${var}") - execute_process( - COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} ${opt} ${prog} 2>&1" - RESULT_VARIABLE COMMAND_RESULT - OUTPUT_VARIABLE COMMAND_OUTPUT - OUTPUT_STRIP_TRAILING_WHITESPACE) - - # message(STATUS "RESULT_VARIABLE ${RESULT_VARIABLE}") - # message(STATUS "COMMAND_RESULT ${COMMAND_RESULT}") - # message(STATUS "OUTPUT_VARIABLE ${OUTPUT_VARIABLE}") - # message(STATUS "COMMAND_OUTPUT ${COMMAND_OUTPUT}") - - # This test is strict. We require two things. First, the invocation - # of the compile command must return 0. Second, there must be no - # messages on the console. We are interested in diagnostics like - # warnings to decide when to reject an option. But we will probably - # capture chatty compiler that want to say, "Hooray, success". For - # chatty compilers we will need to find a quiet option and use it - # for the test. Microsoft compilers come to mind. - if ("${COMMAND_RESULT}" EQUAL 0 AND "${COMMAND_OUTPUT}" STREQUAL "") - set(${var} 1 PARENT_SCOPE) - message(STATUS "Performing Test ${var} - Success") + try_compile(COMMAND_SUCCESS ${CMAKE_BINARY_DIR} ${prog} COMPILE_DEFINITIONS ${opt}) + if (COMMAND_SUCCESS) + set(${var} 1 PARENT_SCOPE) + message(STATUS "Performing Test ${var} - Success") else () set(${var} 0 PARENT_SCOPE) message(STATUS "Performing Test ${var} - Failed") @@ -279,35 +288,36 @@ function(DumpMachine output pattern) set(${output} 0 PARENT_SCOPE) else () - - execute_process( - COMMAND sh -c "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" - COMMAND ${GREP_CMD} -i -c -E "${pattern}" - OUTPUT_VARIABLE ${output} - OUTPUT_STRIP_TRAILING_WHITESPACE) - set(${output} "${${output}}" PARENT_SCOPE) - + if(CMAKE_SYSTEM_PROCESSOR MATCHES ${pattern}) + set(${output} TRUE PARENT_SCOPE) + endif() endif() endfunction(DumpMachine) # Thansk to Anonimal for MinGW; see http://github.com/weidai11/cryptopp/issues/466 -DumpMachine(CRYPTOPP_AMD64 "amd64|x86_64") -DumpMachine(CRYPTOPP_I386 "i.86") -DumpMachine(CRYPTOPP_MINGW32 "\\") -DumpMachine(CRYPTOPP_MINGW64 "w64-mingw32|mingw64") -DumpMachine(CRYPTOPP_X32 "x32") -DumpMachine(CRYPTOPP_AARCH32 "Aarch32") -DumpMachine(CRYPTOPP_AARCH64 "Aarch64") -DumpMachine(CRYPTOPP_ARMHF "armhf|arm7l|eabihf") -DumpMachine(CRYPTOPP_ARM "\\") +DumpMachine(CRYPTOPP_AMD64 "(x86_64|AMD64|amd64)") +DumpMachine(CRYPTOPP_I386 "^i.86$") +DumpMachine(CRYPTOPP_MINGW32 "^mingw32") +DumpMachine(CRYPTOPP_MINGW64 "(w64-mingw32)|(mingw64)") +DumpMachine(CRYPTOPP_ARMV8 "(armv8|aarch32|aarch64)") +DumpMachine(CRYPTOPP_ARM32 "(arm|armhf|arm7l|eabihf)") +DumpMachine(CRYPTOPP_PPC32 "^(powerpc|ppc)") +DumpMachine(CRYPTOPP_PPC64 "^ppc64") + +# Cleanup 32/64 bit +if (CRYPTOPP_AMD64) + set (CRYPTOPP_I386 0) +endif () + +if (CRYPTOPP_ARMV8) + set (CRYPTOPP_ARM32 0) +endif () + +if (CRYPTOPP_PPC64) + set (CRYPTOPP_PPC32 0) +endif () -# Detecting PowerPC is only good with GCC. IBM XLC compiler is -# a little different and I don't know how to ask to the triplet -# XLC is targeting. Below we punt by setting CRYPTOPP_POWERPC64 -# if we detect the compiler is XLC. -DumpMachine(CRYPTOPP_POWERPC "ppc|powerpc") -DumpMachine(CRYPTOPP_POWERPC64 "ppc64") ############################################################################### @@ -328,8 +338,8 @@ if (NOT CRYPTOPP_SOLARIS) endif () # Fixup PowerPC. If both 32-bit and 64-bit use 64-bit. -if (CRYPTOPP_POWERPC AND CRYPTOPP_POWERPC64) - unset(CRYPTOPP_POWERPC) +if (CRYPTOPP_PPC32 AND CRYPTOPP_PPC64) + unset(CRYPTOPP_PPC32) endif () # Fixup for xlC compiler. -dumpmachine fails so we miss PowerPC @@ -337,7 +347,7 @@ endif () # Must use CMAKE_CXX_COMPILER here due to XLC 13.1 and LLVM front-end. if (CMAKE_CXX_COMPILER MATCHES "xlC") message ("-- Fixing platform due to IBM xlC") - set(CRYPTOPP_POWERPC64 1) + set(CRYPTOPP_PPC64 1) endif () # DumpMachine SunCC style @@ -378,77 +388,12 @@ endif () ############################################################################### -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - - execute_process(COMMAND sh -c "${CMAKE_CXX_COMPILER} --version 2>&1" - COMMAND ${GREP_CMD} -i -c "macports" - OUTPUT_VARIABLE MACPORTS - OUTPUT_STRIP_TRAILING_WHITESPACE) - - if (MACPORTS EQUAL 0) - # Get GAS version, add defs + set as appropriate - set(GAS_CMD sh -c "${CMAKE_CXX_COMPILER} -xc -c /dev/null -Wa,-v -o/dev/null 2>&1") - - execute_process(COMMAND ${GAS_CMD} - OUTPUT_VARIABLE GAS_STRING - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(FIND "${GAS_STRING}" "GNU assembler" GAS_OUTPUT) - - if (NOT GAS_OUTPUT EQUAL -1) - #.intel_syntax wasn't supported until GNU assembler 2.10 - - # TODO(unassigned): string() REGEX was not cooperating at time of writing. Re-implement as needed. - execute_process(COMMAND echo ${GAS_STRING} - COMMAND ${GREP_CMD} -i -c -E "GNU.[Aa]ssembler.*(2\\.[1-9][0-9]|[3-9])" - OUTPUT_VARIABLE GAS210_OR_LATER) - if (GAS210_OR_LATER EQUAL 0) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ASM) - set(DISABLE_ASM 1) - endif () - - execute_process(COMMAND echo ${GAS_STRING} - COMMAND ${GREP_CMD} -i -c -E "GNU.[Aa]ssembler.*(2\\.1[7-9]|2\\.[2-9]|[3-9])" - OUTPUT_VARIABLE GAS217_OR_LATER) - if (GAS217_OR_LATER EQUAL 0) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE3) - set(DISABLE_SSSE3 1) - endif () - - # OpenBSD and CentOS 5 needed this one due to ARIA and BLAKE2 - execute_process(COMMAND echo ${GAS_STRING} - COMMAND ${GREP_CMD} -i -c -E "GNU.[Aa]ssembler.*(2\\.1[8-9]|2\\.[2-9]|[3-9])" - OUTPUT_VARIABLE GAS218_OR_LATER) - if (GAS218_OR_LATER EQUAL 0) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE4) - set(DISABLE_SSE4 1) - endif () - - execute_process(COMMAND echo ${GAS_STRING} - COMMAND ${GREP_CMD} -i -c -E "GNU.[Aa]ssembler.*(2\\.19|2\\.[2-9]|[3-9])" - OUTPUT_VARIABLE GAS219_OR_LATER) - if (GAS219_OR_LATER EQUAL 0) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AESNI) - set(DISABLE_AESNI 1) - endif () - - # Ubuntu 10 and Ubuntu 12 needed this one - execute_process(COMMAND echo ${GAS_STRING} - COMMAND ${GREP_CMD} -i -c -E "GNU.[Aa]ssembler.*(2\\.2[3-9]|2\\.[3-9]|[3-9])" - OUTPUT_VARIABLE GAS223_OR_LATER) - if (GAS223_OR_LATER EQUAL 0) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SHA) - set(DISABLE_SHA 1) - endif () - endif () - endif () -endif () - # TODO: what about ICC and LLVM on Windows? if (MSVC) if (CMAKE_SYSTEM_VERSION MATCHES "10\\.0.*") list(APPEND CRYPTOPP_COMPILE_DEFINITIONS "_WIN32_WINNT=0x0A00") endif () - #list(APPEND CRYPTOPP_COMPILE_OPTIONS "/FI\"winapifamily.h\"") + list(APPEND CRYPTOPP_COMPILE_OPTIONS /FI winapifamily.h) endif () # Enable PIC for all target machines except 32-bit i386 due to register pressures. @@ -563,6 +508,11 @@ set(cryptopp_SOURCES ${cryptopp_SOURCES} ) +if(ANDROID) + include_directories(${ANDROID_NDK}/sources/android/cpufeatures) + list(APPEND cryptopp_SOURCES ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) +endif() + set(cryptopp_SOURCES_ASM) if (MSVC AND NOT DISABLE_ASM) @@ -572,6 +522,7 @@ if (MSVC AND NOT DISABLE_ASM) enable_language(ASM_MASM) list(APPEND cryptopp_SOURCES_ASM ${SRC_DIR}/rdrand.asm + ${SRC_DIR}/rdseed.asm ) if (CMAKE_SIZEOF_VOID_P EQUAL 8) list(APPEND cryptopp_SOURCES_ASM @@ -596,7 +547,7 @@ endif () # Must use CMAKE_CXX_COMPILER here due to XLC 13.1 and LLVM front-end. if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel" OR CMAKE_CXX_COMPILER MATCHES "xlC") - if (CRYPTOPP_AMD64 OR CRYPTOPP_I386 OR CRYPTOPP_X32) + if (CRYPTOPP_AMD64 OR CRYPTOPP_I386) CheckCompileLinkOption("-msse2" CRYPTOPP_IA32_SSE2 "${TEST_PROG_DIR}/test_x86_sse2.cxx") @@ -616,8 +567,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU "${TEST_PROG_DIR}/test_x86_avx2.cxx") CheckCompileLinkOption("-msse4.2 -msha" CRYPTOPP_IA32_SHA "${TEST_PROG_DIR}/test_x86_sha.cxx") - CheckCompileLinkOption("" CRYPTOPP_MIXED_ASM - "${TEST_PROG_DIR}/test_mixed_asm.cxx") + if (EXISTS "${TEST_PROG_DIR}/test_asm_mixed.cxx") + CheckCompileLinkOption("" CRYPTOPP_MIXED_ASM + "${TEST_PROG_DIR}/test_asm_mixed.cxx") + else () + CheckCompileLinkOption("" CRYPTOPP_MIXED_ASM + "${TEST_PROG_DIR}/test_mixed_asm.cxx") + endif () # https://github.com/weidai11/cryptopp/issues/756 if (NOT CRYPTOPP_MIXED_ASM) @@ -638,7 +594,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3") set_source_files_properties(${SRC_DIR}/keccak_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3") set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3") - set_source_files_properties(${SRC_DIR}/simeck_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3") set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3") set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3") if (NOT CRYPTOPP_IA32_SSE41 AND NOT DISABLE_SSE4) @@ -646,16 +601,14 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU elseif (CRYPTOPP_IA32_SSE41 AND NOT DISABLE_SSE4) set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1") set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1") - set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1") - set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1") endif () if (NOT CRYPTOPP_IA32_SSE42 AND NOT DISABLE_SSE4) list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SSE4") elseif (CRYPTOPP_IA32_SSE42 AND NOT DISABLE_SSE4) set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2") - if (NOT CRYPTOPP_IA32_CLMUL AND NOT DISABLE_AES) + if (NOT CRYPTOPP_IA32_CLMUL AND NOT DISABLE_CLMUL) list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_CLMUL") - elseif (CRYPTOPP_IA32_CLMUL AND NOT DISABLE_AES) + elseif (CRYPTOPP_IA32_CLMUL AND NOT DISABLE_CLMUL) set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3 -mpclmul") set_source_files_properties(${SRC_DIR}/gf2n_simd.cpp PROPERTIES COMPILE_FLAGS "-mpclmul") endif () @@ -684,12 +637,22 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU endif () endif () - elseif (CRYPTOPP_AARCH32 OR CRYPTOPP_AARCH64) + elseif (CRYPTOPP_ARMV8) - CheckCompileOption("-march=armv8-a" CRYPTOPP_ARMV8A_ASIMD) - CheckCompileOption("-march=armv8-a+crc" CRYPTOPP_ARMV8A_CRC) - CheckCompileOption("-march=armv8-a+crypto" CRYPTOPP_ARMV8A_CRYPTO) - CheckCompileOption("-march=armv8-a" CRYPTOPP_ARMV8A_NATIVE) + # This checks for + CheckCompileLinkOption("-march=armv8-a" CRYPTOPP_ARM_ACLE_HEADER + "${TEST_PROG_DIR}/test_arm_acle_header.cxx") + + # Use if available + if (CRYPTOPP_ARM_NEON_HEADER) + CheckCompileOption("-march=armv8-a -DCRYPTOPP_ARM_ACLE_HEADER=1" CRYPTOPP_ARMV8A_ASIMD) + CheckCompileOption("-march=armv8-a+crc -DCRYPTOPP_ARM_ACLE_HEADER=1" CRYPTOPP_ARMV8A_CRC) + CheckCompileOption("-march=armv8-a+crypto -DCRYPTOPP_ARM_ACLE_HEADER=1" CRYPTOPP_ARMV8A_CRYPTO) + else () + CheckCompileOption("-march=armv8-a" CRYPTOPP_ARMV8A_ASIMD) + CheckCompileOption("-march=armv8-a+crc" CRYPTOPP_ARMV8A_CRC) + CheckCompileOption("-march=armv8-a+crypto" CRYPTOPP_ARMV8A_CRYPTO) + endif () if (CRYPTOPP_ARMV8A_ASIMD) set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") @@ -699,10 +662,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") set_source_files_properties(${SRC_DIR}/neon_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") - set_source_files_properties(${SRC_DIR}/simeck_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") - set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") - set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") endif () if (CRYPTOPP_ARMV8A_CRC) @@ -716,73 +676,90 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") endif () - elseif (CRYPTOPP_ARM OR CRYPTOPP_ARMHF) + elseif (CRYPTOPP_ARM32) - # Need to set floating point ABI to something, like "hard" of "softfp". - # Most Linux use hard floats. - CheckCompileLinkOption("-march=armv7-a -mfpu=neon" CRYPTOPP_ARMV7A_NEON - "${TEST_PROG_DIR}/test_arm_neon.cxx") - CheckCompileLinkOption("-march=armv7-a -mfloat-abi=hard -mfpu=neon" CRYPTOPP_ARMV7A_HARD - "${TEST_PROG_DIR}/test_arm_neon.cxx") - CheckCompileLinkOption("-march=armv7-a -mfloat-abi=softfp -mfpu=neon" CRYPTOPP_ARMV7A_SOFTFP - "${TEST_PROG_DIR}/test_arm_neon.cxx") + # This checks for + CheckCompileLinkOption("-march=armv7-a -mfpu=neon" CRYPTOPP_ARM_NEON_HEADER + "${TEST_PROG_DIR}/test_arm_neon_header.cxx") - if (CRYPTOPP_ARMV7A_HARD) - set(CRYPTOPP_ARMV7A_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon") - elseif (CRYPTOPP_ARMV7A_SOFTFP) - set(CRYPTOPP_ARMV7A_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon") + # Use if available + if (CRYPTOPP_ARM_NEON_HEADER) + CheckCompileLinkOption("-march=armv7-a -mfpu=neon -DCRYPTOPP_ARM_NEON_HEADER=1" CRYPTOPP_ARMV7A_NEON + "${TEST_PROG_DIR}/test_arm_neon.cxx") else () - AddCompileOption("-DCRYPTOPP_DISABLE_NEON") - endif() - - if (CRYPTOPP_ARMV7A_HARD OR CRYPTOPP_ARMV7A_SOFTFP) - # Add ASM files for ARM - if (NOT MSVC) - list(APPEND cryptopp_SOURCES ${SRC_DIR}/aes_armv4.S) - set_source_files_properties(${SRC_DIR}/aes_armv4.S PROPERTIES LANGUAGE C) - endif () - - set_source_files_properties(${SRC_DIR}/aes_armv4.S PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/neon_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/simeck_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") - set_source_files_properties(${SRC_DIR}/sm4_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}") + CheckCompileLinkOption("-march=armv7-a -mfpu=neon" CRYPTOPP_ARMV7A_NEON + "${TEST_PROG_DIR}/test_arm_neon.cxx") endif () - elseif (CRYPTOPP_POWERPC OR CRYPTOPP_POWERPC64) + if (CRYPTOPP_ARMV7A_NEON) + # Add Cryptogams ASM files for ARM on Linux. Linux is required due to GNU Assembler. + # AES requires -mthumb under Clang. Do not add -mthumb for SHA for any files. + if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android") + list(APPEND cryptopp_SOURCES ${SRC_DIR}/aes_armv4.S) + list(APPEND cryptopp_SOURCES ${SRC_DIR}/sha1_armv4.S) + list(APPEND cryptopp_SOURCES ${SRC_DIR}/sha256_armv4.S) + list(APPEND cryptopp_SOURCES ${SRC_DIR}/sha512_armv4.S) + + set_source_files_properties(${SRC_DIR}/aes_armv4.S PROPERTIES LANGUAGE CXX) + set_source_files_properties(${SRC_DIR}/sha1_armv4.S PROPERTIES LANGUAGE CXX) + set_source_files_properties(${SRC_DIR}/sha256_armv4.S PROPERTIES LANGUAGE CXX) + set_source_files_properties(${SRC_DIR}/sha512_armv4.S PROPERTIES LANGUAGE CXX) + + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set_source_files_properties(${SRC_DIR}/aes_armv4.S PROPERTIES COMPILE_FLAGS "-march=armv7-a -mthumb -mfpu=neon -Wa,--noexecstack") + else () + set_source_files_properties(${SRC_DIR}/aes_armv4.S PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon -Wa,--noexecstack") + endif () + + set_source_files_properties(${SRC_DIR}/sha1_armv4.S PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon -Wa,--noexecstack") + set_source_files_properties(${SRC_DIR}/sha256_armv4.S PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon -Wa,--noexecstack") + set_source_files_properties(${SRC_DIR}/sha512_armv4.S PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon -Wa,--noexecstack") + endif () + + set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/neon_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + set_source_files_properties(${SRC_DIR}/sm4_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon") + else () + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_ARM_NEON_AVAILABLE=0") + endif () + + elseif (CRYPTOPP_PPC32 OR CRYPTOPP_PPC64) + + # XLC requires -qaltivec in addition to Arch or CPU option + # Disable POWER9 due to https://github.com/weidai11/cryptopp/issues/986. if (CMAKE_CXX_COMPILER MATCHES "xlC") set(CRYPTOPP_ALTIVEC_FLAGS "-qaltivec") set(CRYPTOPP_POWER4_FLAGS "-qarch=pwr4 -qaltivec") set(CRYPTOPP_POWER5_FLAGS "-qarch=pwr5 -qaltivec") set(CRYPTOPP_POWER6_FLAGS "-qarch=pwr6 -qaltivec") - set(CRYPTOPP_POWER7_FLAGS "-qarch=pwr7 -qaltivec") + set(CRYPTOPP_POWER7_VSX_FLAG "-qarch=pwr7 -qvsx -qaltivec") + set(CRYPTOPP_POWER7_PWR_FLAGS "-qarch=pwr7 -qaltivec") set(CRYPTOPP_POWER8_FLAGS "-qarch=pwr8 -qaltivec") - set(CRYPTOPP_POWER9_FLAGS "-qarch=pwr9 -qaltivec") + #set(CRYPTOPP_POWER9_FLAGS "-qarch=pwr9 -qaltivec") else () set(CRYPTOPP_ALTIVEC_FLAGS "-maltivec") - set(CRYPTOPP_POWER7_FLAGS "-mcpu=power7 -maltivec") - set(CRYPTOPP_POWER8_FLAGS "-mcpu=power8 -maltivec") - set(CRYPTOPP_POWER9_FLAGS "-mcpu=power9 -maltivec") + set(CRYPTOPP_POWER7_VSX_FLAGS "-mcpu=power7 -mvsx") + set(CRYPTOPP_POWER7_PWR_FLAGS "-mcpu=power7") + set(CRYPTOPP_POWER8_FLAGS "-mcpu=power8") + #set(CRYPTOPP_POWER9_FLAGS "-mcpu=power9") endif () CheckCompileLinkOption("${CRYPTOPP_ALTIVEC_FLAGS}" PPC_ALTIVEC_FLAG "${TEST_PROG_DIR}/test_ppc_altivec.cxx") - # Hack for XLC + # Hack for XLC. Find the lowest PWR architecture. if (CMAKE_CXX_COMPILER MATCHES "xlC") if (NOT PPC_ALTIVEC_FLAG) CheckCompileLinkOption("${CRYPTOPP_POWER4_FLAGS}" PPC_POWER4_FLAG @@ -810,25 +787,39 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU endif () endif () - CheckCompileLinkOption("${CRYPTOPP_POWER7_FLAGS}" PPC_POWER7_FLAG + # Hack for XLC and GCC. Find the right combination for PWR7 and the VSX unit. + CheckCompileLinkOption("${CRYPTOPP_POWER7_VSX_FLAGS}" PPC_POWER7_FLAG "${TEST_PROG_DIR}/test_ppc_power7.cxx") + if (PPC_POWER7_FLAG) + set (CRYPTOPP_POWER7_FLAGS "${CRYPTOPP_POWER7_VSX_FLAGS}") + else () + CheckCompileLinkOption("${CRYPTOPP_POWER7_PWR_FLAGS}" PPC_POWER7_FLAG + "${TEST_PROG_DIR}/test_ppc_power7.cxx") + if (PPC_POWER7_FLAG) + set (CRYPTOPP_POWER7_FLAGS "${CRYPTOPP_POWER7_PWR_FLAGS}") + endif () + endif () CheckCompileLinkOption("${CRYPTOPP_POWER8_FLAGS}" PPC_POWER8_FLAG "${TEST_PROG_DIR}/test_ppc_power8.cxx") - CheckCompileLinkOption("${CRYPTOPP_POWER9_FLAGS}" PPC_POWER9_FLAG - "${TEST_PROG_DIR}/test_ppc_power9.cxx") + # Disable POWER9 due to https://github.com/weidai11/cryptopp/issues/986. + #CheckCompileLinkOption("${CRYPTOPP_POWER9_FLAGS}" PPC_POWER9_FLAG + # "${TEST_PROG_DIR}/test_ppc_power9.cxx") - if (PPC_POWER9_FLAG AND NOT DISABLE_POWER9) - set_source_files_properties(${SRC_DIR}/ppc_power9.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER9_FLAGS}) - endif () + #if (PPC_POWER9_FLAG AND NOT DISABLE_POWER9) + # set_source_files_properties(${SRC_DIR}/ppc_power9.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER9_FLAGS}) + #endif () if (PPC_POWER8_FLAG AND NOT DISABLE_POWER8) set_source_files_properties(${SRC_DIR}/ppc_power8.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) + #set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) + set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) #set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) set_source_files_properties(${SRC_DIR}/gf2n_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) + set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) @@ -838,34 +829,18 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU if (PPC_POWER7_FLAG AND NOT DISABLE_POWER7) set_source_files_properties(${SRC_DIR}/ppc_power7.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS}) - set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS}) - set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS}) - set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS}) - set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS}) - set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS}) - set_source_files_properties(${SRC_DIR}/simeck_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS}) - set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS}) - set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS}) endif () if (PPC_ALTIVEC_FLAG AND NOT DISABLE_ALTIVEC) set_source_files_properties(${SRC_DIR}/ppc_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS}) + set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS}) + set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS}) endif () - # Drop to Power7 if Power8 unavailable + # Drop to Altivec if Power8 unavailable if (NOT PPC_POWER8_FLAG) - if (PPC_POWER7_FLAG) - set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS}) - endif () - endif () - - # Drop to Altivec if Power7 unavailable - if (NOT PPC_POWER7_FLAG) if (PPC_ALTIVEC_FLAG) - set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS}) - set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS}) - set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS}) - set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS}) + set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS}) endif () endif () @@ -875,8 +850,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_POWER7") elseif (NOT PPC_POWER8_FLAG) list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_POWER8") - elseif (NOT PPC_POWER9_FLAG) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_POWER9") + #elseif (NOT PPC_POWER9_FLAG) + # list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_POWER9") endif () endif () @@ -885,7 +860,7 @@ endif () # New as of Pull Request 461, http://github.com/weidai11/cryptopp/pull/461. if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") - if (CRYPTOPP_AMD64 OR CRYPTOPP_I386 OR CRYPTOPP_X32) + if (CRYPTOPP_AMD64 OR CRYPTOPP_I386) CheckCompileLinkOption("-xarch=sse2" CRYPTOPP_IA32_SSE2 "${TEST_PROG_DIR}/test_x86_sse2.cxx") @@ -918,15 +893,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3") set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3") set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3") - set_source_files_properties(${SRC_DIR}/simeck_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3") set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3") set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3") set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=ssse3") if (CRYPTOPP_IA32_SSE41 AND NOT DISABLE_SSE4) set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse4_1") set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse4_1") - set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse4_1") - set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse4_1") set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=sse4_1") endif () if (CRYPTOPP_IA32_SSE42 AND NOT DISABLE_SSE4) @@ -967,25 +939,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") endif () endif () -# Attempt to determine a suitable native option -if (CRYPTOPP_NATIVE_ARCH) - - CheckCompileOption("-march=native" NATIVE_ARCH) - if (NATIVE_ARCH) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-march=native") - else () - CheckCompileOption("-native" NATIVE_ARCH) - if (NATIVE_ARCH) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-native") - endif () - endif () - - if (NOT NATIVE_ARCH) - message(WARNING "CRYPTOPP_NATIVE_ARCH enabled, but failed to detect native architecture option") - endif () - -endif() - #============================================================================ # Compile targets #============================================================================ @@ -1001,7 +954,7 @@ function(cryptopp_target_compile_properties target) set_target_properties(${target} PROPERTIES COMPILE_DEFINITIONS "${CRYPTOPP_COMPILE_DEFINITIONS}") endif() if (NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12") - target_compile_options(${target} PUBLIC ${CRYPTOPP_COMPILE_OPTIONS}) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}") else() string (REPLACE ";" " " PROP_STR "${CRYPTOPP_COMPILE_OPTIONS}") set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${PROP_STR}") @@ -1203,23 +1156,17 @@ if (CRYPTOPP_I386) message(STATUS "Platform: i386/i686") elseif (CRYPTOPP_AMD64) message(STATUS "Platform: x86_64") -elseif (CRYPTOPP_X32) - message(STATUS "Platform: x86_64-x32") -elseif (CRYPTOPP_ARMHF) - message(STATUS "Platform: armhf") -elseif (CRYPTOPP_ARM) - message(STATUS "Platform: arm") -elseif (CRYPTOPP_AARCH32) - message(STATUS "Platform: Aarch32") -elseif (CRYPTOPP_AARCH64) - message(STATUS "Platform: Aarch64") +elseif (CRYPTOPP_ARM32) + message(STATUS "Platform: ARM-32") +elseif (CRYPTOPP_ARMV8) + message(STATUS "Platform: ARMv8") elseif (CRYPTOPP_SPARC) message(STATUS "Platform: Sparc") elseif (CRYPTOPP_SPARC64) message(STATUS "Platform: Sparc64") -elseif (CRYPTOPP_POWERPC) +elseif (CRYPTOPP_PPC32) message(STATUS "Platform: PowerPC") -elseif (CRYPTOPP_POWERPC64) +elseif (CRYPTOPP_PPC64) message(STATUS "Platform: PowerPC-64") elseif (CRYPTOPP_MINGW32) message(STATUS "Platform: MinGW-32") @@ -1229,11 +1176,6 @@ endif () if (CRYPTOPP_ARMV7A_NEON) message(STATUS "NEON: TRUE") endif () -if (CRYPTOPP_NATIVE_ARCH) - message(STATUS "Native arch: TRUE") -else () - message(STATUS "Native arch: FALSE") -endif () message(STATUS "Compiler: ${CMAKE_CXX_COMPILER}") message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS} ${CRYPTOPP_COMPILE_OPTIONS}") message(STATUS "Compiler definitions: ${CRYPTOPP_COMPILE_DEFINITIONS}") diff --git a/vendor/cryptopp/vendor_cryptopp/Doxyfile b/vendor/cryptopp/vendor_cryptopp/Doxyfile index 74386e51..956ebd3f 100644 --- a/vendor/cryptopp/vendor_cryptopp/Doxyfile +++ b/vendor/cryptopp/vendor_cryptopp/Doxyfile @@ -1,4 +1,4 @@ -# Doxyfile 1.8.9 +# Doxyfile 1.8.13 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -12,9 +12,6 @@ # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). -# -# The file can be upgraded to the latest version of Doxygen with `doxygen -u /dev/null | cut -f 1 -d '-') +# Clang is reporting armv8l-unknown-linux-gnueabihf +# for ARMv7 images on Aarch64 hardware. +MACHINEX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null) +HOSTX := $(shell echo $(MACHINEX) | cut -f 1 -d '-') ifeq ($(HOSTX),) HOSTX := $(shell uname -m 2>/dev/null) endif @@ -48,8 +62,8 @@ IS_PPC32 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c -E 'ppc|po IS_PPC64 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'ppc64|powerpc64|power64') IS_SPARC32 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c -E 'sun|sparc') IS_SPARC64 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'sun|sparc64') -IS_ARM32 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf') -IS_ARMV8 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8') +IS_ARM32 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c -E 'arm|armhf|armv7|eabihf|armv8') +IS_ARMV8 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'aarch32|aarch64|arm64') # Attempt to determine platform SYSTEMX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null) @@ -87,7 +101,7 @@ ifneq ($(IS_LINUX)$(IS_HURD)$(IS_SUN),000) HAS_SOLIB_VERSION := 1 endif -# Formely adhoc.cpp was created from adhoc.cpp.proto when needed. +# Formerly adhoc.cpp was created from adhoc.cpp.proto when needed. ifeq ($(wildcard adhoc.cpp),) $(shell cp adhoc.cpp.proto adhoc.cpp) endif @@ -96,7 +110,7 @@ endif # http://github.com/weidai11/cryptopp/issues/190 ifeq ($(GCC_COMPILER)$(OSXPORT_COMPILER)$(IS_PPC32)$(IS_PPC64),1100) ifeq ($(findstring -Wa,-q,$(CXXFLAGS)),) - CXXFLAGS += -Wa,-q + CRYPTOPP_CXXFLAGS += -Wa,-q endif endif @@ -112,9 +126,10 @@ else ifeq ($(findstring distclean,$(MAKECMDGOALS)),trim) DETECT_FEATURES := 0 endif -# Strip out -Wall, -Wextra and friends for feature testing +# Strip out -Wall, -Wextra and friends for feature testing. FORTIFY_SOURCE is removed +# because it requires -O1 or higher, but we use -O0 to tame the optimizer. ifeq ($(DETECT_FEATURES),1) - TCXXFLAGS := $(filter-out -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS)) + TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -M -MM -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS)) ifneq ($(strip $(TCXXFLAGS)),) $(info Using testing flags: $(TCXXFLAGS)) endif @@ -126,7 +141,7 @@ endif # Fixup AIX ifeq ($(IS_AIX),1) TPROG = TestPrograms/test_64bit.cxx - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) IS_PPC64=1 else @@ -139,7 +154,7 @@ endif # question is, which choice is easier on users? ifneq ($(IS_DARWIN),0) CXX ?= c++ - # CXXFLAGS += -stdlib=libc++ + # CRYPTOPP_CXXFLAGS += -stdlib=libc++ AR = libtool ARFLAGS = -static -o endif @@ -149,12 +164,19 @@ endif ########################################################### # Base CXXFLAGS used if the user did not specify them -ifeq ($(SUN_COMPILER),1) - CXXFLAGS ?= -DNDEBUG -g -xO3 - ZOPT = -xO0 -else - CXXFLAGS ?= -DNDEBUG -g2 -O3 - ZOPT = -O0 +ifeq ($(CXXFLAGS),) + ifeq ($(SUN_COMPILER),1) + CRYPTOPP_CXXFLAGS += -DNDEBUG -g -xO3 + ZOPT = -xO0 + else + CRYPTOPP_CXXFLAGS += -DNDEBUG -g2 -O3 + ZOPT = -O0 + endif +endif + +# Fix CXX on Cygwin 1.1.4 +ifeq ($(CXX),gcc) +CXX := g++ endif # On ARM we may compile aes_armv4.S though the CC compiler @@ -164,28 +186,33 @@ else ifeq ($(CLANG_COMPILER),1) CC=clang endif -# Default prefix for make install +# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html ifeq ($(PREFIX),) PREFIX = /usr/local -endif - -# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html -ifeq ($(DATADIR),) -DATADIR := $(PREFIX)/share +PC_PREFIX = /usr/local +else +PC_PREFIX = $(PREFIX) endif ifeq ($(LIBDIR),) LIBDIR := $(PREFIX)/lib +PC_LIBDIR = $${prefix}/lib +else +PC_LIBDIR = $(LIBDIR) endif -ifeq ($(BINDIR),) -BINDIR := $(PREFIX)/bin +ifeq ($(DATADIR),) +DATADIR := $(PREFIX)/share +PC_DATADIR = $${prefix}/share +else +PC_DATADIR = $(DATADIR) endif ifeq ($(INCLUDEDIR),) INCLUDEDIR := $(PREFIX)/include +PC_INCLUDEDIR = $${prefix}/include +else +PC_INCLUDEDIR = $(INCLUDEDIR) endif - -# Fix CXX on Cygwin 1.1.4 -ifeq ($(CXX),gcc) -CXX := g++ +ifeq ($(BINDIR),) +BINDIR := $(PREFIX)/bin endif # We honor ARFLAGS, but the "v" option used by default causes a noisy make @@ -193,9 +220,6 @@ ifeq ($(ARFLAGS),rv) ARFLAGS = r endif -# Clang integrated assembler will be used with -Wa,-q -CLANG_INTEGRATED_ASSEMBLER ?= 0 - # Original MinGW targets Win2k by default, but lacks proper Win2k support # if target Windows version is not specified, use Windows XP instead ifeq ($(IS_MINGW),1) @@ -203,7 +227,7 @@ ifeq ($(findstring -D_WIN32_WINNT,$(CXXFLAGS)),) ifeq ($(findstring -D_WIN32_WINDOWS,$(CXXFLAGS)),) ifeq ($(findstring -DWINVER,$(CXXFLAGS)),) ifeq ($(findstring -DNTDDI_VERSION,$(CXXFLAGS)),) - CXXFLAGS += -D_WIN32_WINNT=0x0501 + CRYPTOPP_CXXFLAGS += -D_WIN32_WINNT=0x0501 endif # NTDDI_VERSION endif # WINVER endif # _WIN32_WINDOWS @@ -212,10 +236,10 @@ endif # IS_MINGW # Newlib needs _XOPEN_SOURCE=600 for signals TPROG = TestPrograms/test_newlib.cxx -HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) +HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) ifeq ($(findstring -D_XOPEN_SOURCE,$(CXXFLAGS)),) - CXXFLAGS += -D_XOPEN_SOURCE=600 + CRYPTOPP_CXXFLAGS += -D_XOPEN_SOURCE=600 endif endif @@ -223,7 +247,7 @@ endif ##### X86/X32/X64 Options ##### ########################################################### -ifneq ($(IS_X86)$(IS_X64),00) +ifneq ($(IS_X86)$(IS_X64)$(IS_MINGW),000) ifeq ($(DETECT_FEATURES),1) ifeq ($(SUN_COMPILER),1) @@ -252,7 +276,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_sse2.cxx TOPT = $(SSE2_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) CHACHA_FLAG = $(SSE2_FLAG) SUN_LDFLAGS += $(SSE2_FLAG) @@ -262,16 +286,13 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_ssse3.cxx TOPT = $(SSSE3_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) ARIA_FLAG = $(SSSE3_FLAG) CHAM_FLAG = $(SSSE3_FLAG) KECCAK_FLAG = $(SSSE3_FLAG) LEA_FLAG = $(SSSE3_FLAG) - SIMECK_FLAG = $(SSSE3_FLAG) - SIMON64_FLAG = $(SSSE3_FLAG) SIMON128_FLAG = $(SSSE3_FLAG) - SPECK64_FLAG = $(SSSE3_FLAG) SPECK128_FLAG = $(SSSE3_FLAG) SUN_LDFLAGS += $(SSSE3_FLAG) else @@ -280,12 +301,10 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_sse41.cxx TOPT = $(SSE41_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) BLAKE2B_FLAG = $(SSE41_FLAG) BLAKE2S_FLAG = $(SSE41_FLAG) - SIMON64_FLAG = $(SSE41_FLAG) - SPECK64_FLAG = $(SSE41_FLAG) SUN_LDFLAGS += $(SSE41_FLAG) else SSE41_FLAG = @@ -293,7 +312,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_sse42.cxx TOPT = $(SSE42_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) CRC_FLAG = $(SSE42_FLAG) SUN_LDFLAGS += $(SSE42_FLAG) @@ -303,7 +322,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_clmul.cxx TOPT = $(CLMUL_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) GCM_FLAG = $(SSSE3_FLAG) $(CLMUL_FLAG) GF2N_FLAG = $(CLMUL_FLAG) @@ -314,7 +333,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_aes.cxx TOPT = $(AESNI_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) AES_FLAG = $(SSE41_FLAG) $(AESNI_FLAG) SM4_FLAG = $(SSSE3_FLAG) $(AESNI_FLAG) @@ -325,7 +344,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_avx.cxx TOPT = $(AVX_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) # XXX_FLAG = $(AVX_FLAG) SUN_LDFLAGS += $(AVX_FLAG) @@ -335,7 +354,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_avx2.cxx TOPT = $(AVX2_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) CHACHA_AVX2_FLAG = $(AVX2_FLAG) SUN_LDFLAGS += $(AVX2_FLAG) @@ -345,7 +364,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_sha.cxx TOPT = $(SHANI_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) SHA_FLAG = $(SSE42_FLAG) $(SHANI_FLAG) SUN_LDFLAGS += $(SHANI_FLAG) @@ -354,19 +373,19 @@ ifeq ($(DETECT_FEATURES),1) endif ifeq ($(SUN_COMPILER),1) - LDFLAGS += $(SUN_LDFLAGS) + CRYPTOPP_LDFLAGS += $(SUN_LDFLAGS) endif ifeq ($(SSE2_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_ASM + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM else ifeq ($(SSE3_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_SSE3 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE3 else ifeq ($(SSSE3_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3 else ifeq ($(SSE41_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4 else ifeq ($(SSE42_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4 endif ifneq ($(SSE42_FLAG),) @@ -374,18 +393,18 @@ ifeq ($(DETECT_FEATURES),1) # Unusual GCC/Clang on Macports. It assembles AES, but not CLMUL. # test_x86_clmul.s:15: no such instruction: 'pclmulqdq $0, %xmm1,%xmm0' ifeq ($(CLMUL_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_CLMUL + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_CLMUL endif ifeq ($(AESNI_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI endif ifeq ($(AVX_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_AVX + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX else ifeq ($(AVX2_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2 else ifeq ($(SHANI_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI endif endif @@ -396,18 +415,30 @@ ifeq ($(DETECT_FEATURES),1) endif endif + # Most Clang cannot handle mixed asm with positional arguments, where the + # body is Intel style with no prefix and the templates are AT&T style. + # Also see https://bugs.llvm.org/show_bug.cgi?id=39895 . + + # CRYPTOPP_DISABLE_MIXED_ASM is now being added in config_asm.h for all + # Clang compilers. This test will need to be re-enabled if Clang fixes it. + #TPROG = TestPrograms/test_asm_mixed.cxx + #HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + #ifneq ($(strip $(HAVE_OPT)),0) + # CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM + #endif + # DETECT_FEATURES endif ifneq ($(INTEL_COMPILER),0) - CXXFLAGS += -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180 + CRYPTOPP_CXXFLAGS += -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180 ICC111_OR_LATER := $(shell $(CXX) --version 2>&1 | $(GREP) -c -E "\(ICC\) ([2-9][0-9]|1[2-9]|11\.[1-9])") ifeq ($(ICC111_OR_LATER),0) # "internal error: backend signals" occurs on some x86 inline assembly with ICC 9 and # some x64 inline assembly with ICC 11.0. If you want to use Crypto++'s assembly code # with ICC, try enabling it on individual files - CXXFLAGS += -DCRYPTOPP_DISABLE_ASM + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM endif endif @@ -415,34 +446,31 @@ endif # http://sourceware.org/bugzilla/show_bug.cgi?id=4572 ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),) ifeq ($(IS_SUN)$(GCC_COMPILER),11) - CXXFLAGS += -Wa,--divide + CRYPTOPP_CXXFLAGS += -Wa,--divide endif endif -# Most Clang cannot handle mixed asm with positional arguments, where the -# body is Intel style with no prefix and the templates are AT&T style. -# Also see https://bugs.llvm.org/show_bug.cgi?id=39895 . -TPROG = TestPrograms/test_mixed_asm.cxx -HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) -ifneq ($(strip $(HAVE_OPT)),0) - CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM -endif - # IS_X86, IS_X32 and IS_X64 endif ########################################################### -##### ARM A-32, Aach64 and NEON ##### +##### ARM A-32 and NEON ##### ########################################################### -ifneq ($(IS_ARM32)$(IS_ARMV8),00) +ifneq ($(IS_ARM32),0) ifeq ($(DETECT_FEATURES),1) -ifneq ($(IS_ARM32),0) + # Clang needs an option to include + TPROG = TestPrograms/test_arm_neon_header.cxx + TOPT = -march=armv7-a -mfpu=neon + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1 + endif TPROG = TestPrograms/test_arm_neon.cxx TOPT = -march=armv7-a -mfpu=neon - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) NEON_FLAG = -march=armv7-a -mfpu=neon ARIA_FLAG = -march=armv7-a -mfpu=neon @@ -455,33 +483,42 @@ ifneq ($(IS_ARM32),0) CHAM_FLAG = -march=armv7-a -mfpu=neon LEA_FLAG = -march=armv7-a -mfpu=neon SHA_FLAG = -march=armv7-a -mfpu=neon - SIMECK_FLAG = -march=armv7-a -mfpu=neon - SIMON64_FLAG = -march=armv7-a -mfpu=neon SIMON128_FLAG = -march=armv7-a -mfpu=neon - SPECK64_FLAG = -march=armv7-a -mfpu=neon SPECK128_FLAG = -march=armv7-a -mfpu=neon SM4_FLAG = -march=armv7-a -mfpu=neon else - CXXFLAGS += -DCRYPTOPP_DISABLE_ASM + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM endif +# DETECT_FEATURES +endif # IS_ARM32 endif -ifeq ($(IS_ARMV8),1) +########################################################### +##### Aach32 and Aarch64 ##### +########################################################### - TPROG = TestPrograms/test_arm_acle.cxx - TOPT = -march=armv8-a - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) +ifneq ($(IS_ARMV8),0) +ifeq ($(DETECT_FEATURES),1) + + TPROG = TestPrograms/test_arm_neon_header.cxx + TOPT = + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) - ACLE_FLAG += -DCRYPTOPP_ARM_ACLE_AVAILABLE=1 - else - CXXFLAGS += -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 + THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1 + endif + + TPROG = TestPrograms/test_arm_acle_header.cxx + TOPT = -march=armv8-a + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + THEADER += -DCRYPTOPP_ARM_ACLE_HEADER=1 endif TPROG = TestPrograms/test_arm_asimd.cxx TOPT = -march=armv8-a - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) ASIMD_FLAG = -march=armv8-a ARIA_FLAG = -march=armv8-a @@ -491,150 +528,175 @@ ifeq ($(IS_ARMV8),1) CHAM_FLAG = -march=armv8-a LEA_FLAG = -march=armv8-a NEON_FLAG = -march=armv8-a - SIMECK_FLAG = -march=armv8-a - SIMON64_FLAG = -march=armv8-a SIMON128_FLAG = -march=armv8-a - SPECK64_FLAG = -march=armv8-a SPECK128_FLAG = -march=armv8-a SM4_FLAG = -march=armv8-a else - CXXFLAGS += -DCRYPTOPP_DISABLE_ASM + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM endif ifneq ($(ASIMD_FLAG),) TPROG = TestPrograms/test_arm_crc.cxx TOPT = -march=armv8-a+crc - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) CRC_FLAG = -march=armv8-a+crc else - CXXFLAGS += -DCRYPTOPP_ARM_CRC32_AVAILABLE=0 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_CRC32 endif TPROG = TestPrograms/test_arm_aes.cxx TOPT = -march=armv8-a+crypto - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) AES_FLAG = -march=armv8-a+crypto else - CXXFLAGS += -DCRYPTOPP_ARM_AES_AVAILABLE=0 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_AES endif TPROG = TestPrograms/test_arm_pmull.cxx TOPT = -march=armv8-a+crypto - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) GCM_FLAG = -march=armv8-a+crypto GF2N_FLAG = -march=armv8-a+crypto else - CXXFLAGS += -DCRYPTOPP_ARM_PMULL_AVAILABLE=0 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_PMULL endif - TPROG = TestPrograms/test_arm_sha.cxx + TPROG = TestPrograms/test_arm_sha1.cxx TOPT = -march=armv8-a+crypto - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) SHA_FLAG = -march=armv8-a+crypto else - CXXFLAGS += -DCRYPTOPP_ARM_SHA_AVAILABLE=0 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA1 + endif + + TPROG = TestPrograms/test_arm_sha256.cxx + TOPT = -march=armv8-a+crypto + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + SHA_FLAG = -march=armv8-a+crypto + else + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA2 endif TPROG = TestPrograms/test_arm_sm3.cxx TOPT = -march=armv8.4-a+crypto - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) SM3_FLAG = -march=armv8.4-a+crypto SM4_FLAG = -march=armv8.4-a+crypto + else + #CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM3 + #CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4 endif TPROG = TestPrograms/test_arm_sha3.cxx TOPT = -march=armv8.4-a+crypto - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) SHA3_FLAG = -march=armv8.4-a+crypto + else + #CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA3 + endif + + TPROG = TestPrograms/test_arm_sha512.cxx + TOPT = -march=armv8.4-a+crypto + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + SHA512_FLAG = -march=armv8.4-a+crypto + else + #CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA512 endif # ASIMD_FLAG endif -# IS_ARMV8 -endif - # DETECT_FEATURES endif - -# IS_ARM32, IS_ARMV8 +# IS_ARMV8 endif ########################################################### ##### PowerPC ##### ########################################################### -# PowerPC and PowerPC-64. Altivec is available with POWER4 with GCC and +# PowerPC and PowerPC64. Altivec is available with POWER4 with GCC and # POWER6 with XLC. The tests below are crafted for IBM XLC and the LLVM # front-end. XLC/LLVM only supplies POWER8 so we have to set the flags for # XLC/LLVM to POWER8. I've got a feeling LLVM is going to cause trouble. + ifneq ($(IS_PPC32)$(IS_PPC64),00) ifeq ($(DETECT_FEATURES),1) + # IBM XL C/C++ has the -qaltivec flag really screwed up. We can't seem + # to get it enabled without an -qarch= option. And -qarch= produces an + # error on later versions of the compiler. The only thing that seems + # to work consistently is -qarch=auto. -qarch=auto is equivalent to + # GCC's -march=native, which we don't really want. + + # XLC requires -qaltivec in addition to Arch or CPU option ifeq ($(XLC_COMPILER),1) - POWER9_FLAG = -qarch=pwr9 -qaltivec + # POWER9_FLAG = -qarch=pwr9 -qaltivec POWER8_FLAG = -qarch=pwr8 -qaltivec - POWER7_FLAG = -qarch=pwr7 -qaltivec - POWER6_FLAG = -qarch=pwr6 -qaltivec - POWER5_FLAG = -qarch=pwr5 -qaltivec - POWER4_FLAG = -qarch=pwr4 -qaltivec - ALTIVEC_FLAG = -qaltivec + POWER7_VSX_FLAG = -qarch=pwr7 -qvsx -qaltivec + POWER7_PWR_FLAG = -qarch=pwr7 -qaltivec + ALTIVEC_FLAG = -qarch=auto -qaltivec else - POWER9_FLAG = -mcpu=power9 -maltivec - POWER8_FLAG = -mcpu=power8 -maltivec - POWER7_FLAG = -mcpu=power7 -maltivec + # POWER9_FLAG = -mcpu=power9 + POWER8_FLAG = -mcpu=power8 + POWER7_VSX_FLAG = -mcpu=power7 -mvsx + POWER7_PWR_FLAG = -mcpu=power7 ALTIVEC_FLAG = -maltivec endif + # GCC 10 is giving us trouble in CPU_ProbePower9() and + # CPU_ProbeDARN(). GCC is generating POWER9 instructions + # on POWER8 for ppc_power9.cpp. The compiler folks did + # not think through the consequences of requiring us to + # use -mcpu=power9 to unlock the ISA. Epic fail. + # https:#github.com/weidai11/cryptopp/issues/986 + POWER9_FLAG = + # XLC with LLVM front-ends failed to define XLC defines. #ifeq ($(findstring -qxlcompatmacros,$(CXXFLAGS)),) # TPROG = TestPrograms/test_ppc_altivec.cxx # TOPT = -qxlcompatmacros - # HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + # HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) # ifeq ($(strip $(HAVE_OPT)),0) - # CXXFLAGS += -qxlcompatmacros + # CRYPTOPP_CXXFLAGS += -qxlcompatmacros # endif #endif + ##################################################################### + # Looking for a POWER9 option + + #TPROG = TestPrograms/test_ppc_power9.cxx + #TOPT = $(POWER9_FLAG) + #HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + #ifeq ($(strip $(HAVE_OPT)),0) + # DARN_FLAG = $(POWER9_FLAG) + #else + # POWER9_FLAG = + #endif + ##################################################################### # Looking for a POWER8 option - TPROG = TestPrograms/test_ppc_power9.cxx - TOPT = $(POWER9_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) - ifeq ($(strip $(HAVE_OPT)),0) - # DARN_FLAG = $(POWER9_FLAG) - else - POWER9_FLAG = - endif - TPROG = TestPrograms/test_ppc_power8.cxx TOPT = $(POWER8_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) AES_FLAG = $(POWER8_FLAG) - ARIA_FLAG = $(POWER8_FLAG) BLAKE2B_FLAG = $(POWER8_FLAG) - BLAKE2S_FLAG = $(POWER8_FLAG) - CHACHA_FLAG = $(POWER8_FLAG) - CHAM_FLAG = $(POWER8_FLAG) CRC_FLAG = $(POWER8_FLAG) GCM_FLAG = $(POWER8_FLAG) GF2N_FLAG = $(POWER8_FLAG) LEA_FLAG = $(POWER8_FLAG) SHA_FLAG = $(POWER8_FLAG) SHACAL2_FLAG = $(POWER8_FLAG) - SIMECK_FLAG = $(POWER8_FLAG) - SIMON64_FLAG = $(POWER8_FLAG) - SPECK64_FLAG = $(POWER8_FLAG) - SIMON128_FLAG = $(POWER8_FLAG) - SPECK128_FLAG = $(POWER8_FLAG) else POWER8_FLAG = endif @@ -642,11 +704,23 @@ ifeq ($(DETECT_FEATURES),1) ##################################################################### # Looking for a POWER7 option + # GCC needs -mvsx for Power7 to enable 64-bit vector elements. + # XLC provides 64-bit vector elements without an option. + TPROG = TestPrograms/test_ppc_power7.cxx - TOPT = $(POWER7_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) - ifneq ($(strip $(HAVE_OPT)),0) - POWER7_FLAG = + TOPT = $(POWER7_VSX_FLAG) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + POWER7_FLAG = $(POWER7_VSX_FLAG) + else + TPROG = TestPrograms/test_ppc_power7.cxx + TOPT = $(POWER7_PWR_FLAG) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + POWER7_FLAG = $(POWER7_PWR_FLAG) + else + POWER7_FLAG = + endif endif ##################################################################### @@ -654,48 +728,27 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_ppc_altivec.cxx TOPT = $(ALTIVEC_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) - ifneq ($(strip $(HAVE_OPT)),0) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + ALTIVEC_FLAG := $(ALTIVEC_FLAG) + else ALTIVEC_FLAG = endif - # XLC fixup - ifeq ($(XLC_COMPILER)$(ALTIVEC_FLAG),1) - TPROG = TestPrograms/test_ppc_altivec.cxx - TOPT = $(POWER4_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) - ifeq ($(strip $(HAVE_OPT)),0) - ALTIVEC_FLAG = $(POWER4_FLAG) - else - TPROG = TestPrograms/test_ppc_altivec.cxx - TOPT = $(POWER5_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) - ifeq ($(strip $(HAVE_OPT)),0) - ALTIVEC_FLAG = $(POWER5_FLAG) - else - TPROG = TestPrograms/test_ppc_altivec.cxx - TOPT = $(POWER6_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) - ifeq ($(strip $(HAVE_OPT)),0) - ALTIVEC_FLAG = $(POWER6_FLAG) - else - ALTIVEC_FLAG = - endif - endif - endif + ifneq ($(ALTIVEC_FLAG),) + BLAKE2S_FLAG = $(ALTIVEC_FLAG) + CHACHA_FLAG = $(ALTIVEC_FLAG) + SPECK128_FLAG = $(ALTIVEC_FLAG) + SIMON128_FLAG = $(ALTIVEC_FLAG) endif ##################################################################### # Fixups for algorithms that can drop to a lower ISA, if needed - # Drop to Power4 if Power8 not available - ifeq ($(POWER8_FLAG),) - ifneq ($(ALTIVEC_FLAG),) - BLAKE2S_FLAG = $(ALTIVEC_FLAG) - CHACHA_FLAG = $(ALTIVEC_FLAG) + # Drop to Altivec if higher Power is not available + ifneq ($(ALTIVEC_FLAG),) + ifeq ($(GCM_FLAG),) GCM_FLAG = $(ALTIVEC_FLAG) - SIMON64_FLAG = $(ALTIVEC_FLAG) - SPECK64_FLAG = $(ALTIVEC_FLAG) endif endif @@ -703,26 +756,26 @@ ifeq ($(DETECT_FEATURES),1) # Fixups for missing ISAs ifeq ($(ALTIVEC_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_ALTIVEC - else ifeq ($(POWER8_FLAG)$(POWER7_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_POWER7 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ALTIVEC + else ifeq ($(POWER7_FLAG),) + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_POWER7 else ifeq ($(POWER8_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8 - else ifeq ($(POWER9_FLAG),) - CXXFLAGS += -DCRYPTOPP_DISABLE_POWER9 + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_POWER8 + #else ifeq ($(POWER9_FLAG),) + # CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_POWER9 endif # DETECT_FEATURES endif -# IBM XL C/C++ compiler +# IBM XL C++ compiler ifeq ($(XLC_COMPILER),1) ifeq ($(findstring -qmaxmem,$(CXXFLAGS)),) - CXXFLAGS += -qmaxmem=-1 + CRYPTOPP_CXXFLAGS += -qmaxmem=-1 endif # http://www-01.ibm.com/support/docview.wss?uid=swg21007500 ifeq ($(findstring -qrtti,$(CXXFLAGS)),) - CXXFLAGS += -qrtti + CRYPTOPP_CXXFLAGS += -qrtti endif endif @@ -736,7 +789,7 @@ endif # Add -fPIC for targets *except* X86, X32, Cygwin or MinGW ifeq ($(IS_X86)$(IS_CYGWIN)$(IS_MINGW),000) ifeq ($(findstring -fpic,$(CXXFLAGS))$(findstring -fPIC,$(CXXFLAGS)),) - CXXFLAGS += -fPIC + CRYPTOPP_CXXFLAGS += -fPIC endif endif @@ -747,19 +800,19 @@ ifeq ($(DETECT_FEATURES),1) ifeq ($(findstring -qthreaded,$(CXXFLAGS)),) TPROG = TestPrograms/test_pthreads.cxx TOPT = -qthreaded - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) - CXXFLAGS += -qthreaded - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -qthreaded + endif # CRYPTOPP_CXXFLAGS endif # qthreaded else ifeq ($(findstring -pthread,$(CXXFLAGS)),) TPROG = TestPrograms/test_pthreads.cxx TOPT = -pthread - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) - CXXFLAGS += -pthread - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -pthread + endif # CRYPTOPP_CXXFLAGS endif # pthread endif # XLC/GCC and friends endif # DETECT_FEATURES @@ -767,31 +820,47 @@ endif # DETECT_FEATURES # Remove -fPIC if present. SunCC use -KPIC, and needs the larger GOT table # https://docs.oracle.com/cd/E19205-01/819-5267/bkbaq/index.html ifeq ($(SUN_COMPILER),1) - CXXFLAGS := $(subst -fPIC,-KPIC,$(CXXFLAGS)) - CXXFLAGS := $(subst -fpic,-KPIC,$(CXXFLAGS)) + CRYPTOPP_CXXFLAGS := $(subst -fPIC,-KPIC,$(CRYPTOPP_CXXFLAGS)) + CRYPTOPP_CXXFLAGS := $(subst -fpic,-KPIC,$(CRYPTOPP_CXXFLAGS)) endif -# Remove -fPIC if present. IBM XL C/C++ use -qpic +# Remove -fPIC if present. IBM XL C++ uses -qpic ifeq ($(XLC_COMPILER),1) - CXXFLAGS := $(subst -fPIC,-qpic,$(CXXFLAGS)) - CXXFLAGS := $(subst -fpic,-qpic,$(CXXFLAGS)) + CRYPTOPP_CXXFLAGS := $(subst -fPIC,-qpic,$(CRYPTOPP_CXXFLAGS)) + CRYPTOPP_CXXFLAGS := $(subst -fpic,-qpic,$(CRYPTOPP_CXXFLAGS)) endif +# Disable IBM XL C++ "1500-036: (I) The NOSTRICT option (default at OPT(3)) +# has the potential to alter the semantics of a program." +ifeq ($(XLC_COMPILER),1) + TPROG = TestPrograms/test_cxx.cxx + TOPT = -qsuppress=1500-036 + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + CRYPTOPP_CXXFLAGS += -qsuppress=1500-036 + endif # -qsuppress +endif # IBM XL C++ compiler + # Add -xregs=no%appl SPARC. SunCC should not use certain registers in library code. # https://docs.oracle.com/cd/E18659_01/html/821-1383/bkamt.html -ifeq ($(IS_SUN)$(SUN_COMPILER),11) - ifneq ($(IS_SPARC32)$(IS_SPARC64),00) +ifneq ($(IS_SPARC32)$(IS_SPARC64),00) + ifeq ($(SUN_COMPILER),1) ifeq ($(findstring -xregs=no%appl,$(CXXFLAGS)),) - CXXFLAGS += -xregs=no%appl + CRYPTOPP_CXXFLAGS += -xregs=no%appl endif # -xregs - endif # Sparc -endif # SunOS + endif # SunCC + ifeq ($(GCC_COMPILER),1) + ifeq ($(findstring -mno-app-regs,$(CXXFLAGS)),) + CRYPTOPP_CXXFLAGS += -mno-app-regs + endif # no-app-regs + endif # GCC +endif # Sparc -# Add -pipe for everything except IBM XL C/C++, SunCC and ARM. +# Add -pipe for everything except IBM XL C++, SunCC and ARM. # Allow ARM-64 because they seems to have >1 GB of memory ifeq ($(XLC_COMPILER)$(SUN_COMPILER)$(IS_ARM32),000) ifeq ($(findstring -save-temps,$(CXXFLAGS)),) - CXXFLAGS += -pipe + CRYPTOPP_CXXFLAGS += -pipe endif endif @@ -800,22 +869,12 @@ endif # http://www.oracle.com/technetwork/server-storage/solaris/hwcap-modification-139536.html ifeq ($(IS_SUN)$(SUN_COMPILER),11) ifneq ($(IS_X86)$(IS_X64),00) - ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),) - LDFLAGS += -M cryptopp.mapfile + ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CRYPTOPP_CXXFLAGS) $(CXXFLAGS)),) + CRYPTOPP_LDFLAGS += -M cryptopp.mapfile endif # No CRYPTOPP_DISABLE_ASM endif # X86/X32/X64 endif # SunOS -# TODO: can we remove this since removing sockets? -#ifneq ($(IS_MINGW),0) -# LDLIBS += -lws2_32 -#endif - -# TODO: can we remove this since removing sockets? -#ifneq ($(IS_SUN),0) -# LDLIBS += -lnsl -lsocket -#endif - ifneq ($(IS_LINUX)$(IS_HURD),00) ifeq ($(findstring -fopenmp,$(CXXFLAGS)),-fopenmp) ifeq ($(findstring -lgomp,$(LDLIBS)),) @@ -827,12 +886,12 @@ endif # IS_LINUX or IS_HURD # Add -errtags=yes to get the name for a warning suppression ifneq ($(SUN_COMPILER),0) # override flags for CC Sun C++ compiler # Add to all Solaris -CXXFLAGS += -template=no%extdef +CRYPTOPP_CXXFLAGS += -template=no%extdef SUN_CC10_BUGGY := $(shell $(CXX) -V 2>&1 | $(GREP) -c -E "CC: Sun .* 5\.10 .* (2009|2010/0[1-4])") ifneq ($(SUN_CC10_BUGGY),0) # -DCRYPTOPP_INCLUDE_VECTOR_CC is needed for Sun Studio 12u1 Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21 # and was fixed in May 2010. Remove it if you get "already had a body defined" errors in vector.cc -CXXFLAGS += -DCRYPTOPP_INCLUDE_VECTOR_CC +CRYPTOPP_CXXFLAGS += -DCRYPTOPP_INCLUDE_VECTOR_CC endif AR = $(CXX) ARFLAGS = -xar -o @@ -841,9 +900,9 @@ endif # No ASM for Travis testing ifeq ($(findstring no-asm,$(MAKECMDGOALS)),no-asm) - ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),) - CXXFLAGS += -DCRYPTOPP_DISABLE_ASM - endif # CXXFLAGS + ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CRYPTOPP_CXXFLAGS) $(CXXFLAGS)),) + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM + endif # CRYPTOPP_CXXFLAGS endif # No ASM # Native build testing. Issue 'make native'. @@ -853,53 +912,62 @@ ifeq ($(findstring native,$(MAKECMDGOALS)),native) # Try GCC and compatibles first TPROG = TestPrograms/test_cxx.cxx TOPT = -march=native - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) NATIVE_OPT = -march=native endif # NATIVE_OPT + # And tune + ifeq ($(NATIVE_OPT),) + TOPT = -mtune=native + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + NATIVE_OPT = -mtune=native + endif # NATIVE_OPT + endif + # Try SunCC next ifeq ($(NATIVE_OPT),) TOPT = -native - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) NATIVE_OPT = -native endif # NATIVE_OPT endif ifneq ($(NATIVE_OPT),) - CXXFLAGS += $(NATIVE_OPT) + CRYPTOPP_CXXFLAGS += $(NATIVE_OPT) endif endif # Native # Undefined Behavior Sanitizer (UBsan) testing. Issue 'make ubsan'. ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan) - CXXFLAGS := $(CXXFLAGS:-g%=-g3) - CXXFLAGS := $(CXXFLAGS:-O%=-O1) - CXXFLAGS := $(CXXFLAGS:-xO%=-xO1) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1) ifeq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),) - CXXFLAGS += -fsanitize=undefined - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -fsanitize=undefined + endif # CRYPTOPP_CXXFLAGS ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),) - CXXFLAGS += -DCRYPTOPP_COVERAGE - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE + endif # CRYPTOPP_CXXFLAGS endif # UBsan # Address Sanitizer (Asan) testing. Issue 'make asan'. ifeq ($(findstring asan,$(MAKECMDGOALS)),asan) - CXXFLAGS := $(CXXFLAGS:-g%=-g3) - CXXFLAGS := $(CXXFLAGS:-O%=-O1) - CXXFLAGS := $(CXXFLAGS:-xO%=-xO1) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1) ifeq ($(findstring -fsanitize=address,$(CXXFLAGS)),) - CXXFLAGS += -fsanitize=address - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -fsanitize=address + endif # CRYPTOPP_CXXFLAGS ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),) - CXXFLAGS += -DCRYPTOPP_COVERAGE - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE + endif # CRYPTOPP_CXXFLAGS ifeq ($(findstring -fno-omit-frame-pointer,$(CXXFLAGS)),) - CXXFLAGS += -fno-omit-frame-pointer - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -fno-omit-frame-pointer + endif # CRYPTOPP_CXXFLAGS endif # Asan # LD gold linker testing. Triggered by 'LD=ld.gold'. @@ -908,92 +976,92 @@ ifeq ($(findstring ld.gold,$(LD)),ld.gold) LD_GOLD = $(shell command -v ld.gold) ELF_FORMAT := $(shell file $(LD_GOLD) 2>&1 | cut -d":" -f 2 | $(GREP) -i -c "elf") ifneq ($(ELF_FORMAT),0) - LDFLAGS += -fuse-ld=gold + CRYPTOPP_LDFLAGS += -fuse-ld=gold endif # ELF/ELF64 endif # CXXFLAGS endif # Gold # lcov code coverage. Issue 'make coverage'. ifneq ($(filter lcov coverage,$(MAKECMDGOALS)),) - CXXFLAGS := $(CXXFLAGS:-g%=-g3) - CXXFLAGS := $(CXXFLAGS:-O%=-O1) - CXXFLAGS := $(CXXFLAGS:-xO%=-xO1) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1) ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),) - CXXFLAGS += -DCRYPTOPP_COVERAGE + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE endif # CRYPTOPP_COVERAGE ifeq ($(findstring -coverage,$(CXXFLAGS)),) - CXXFLAGS += -coverage + CRYPTOPP_CXXFLAGS += -coverage endif # -coverage endif # GCC code coverage # gcov code coverage for Travis. Issue 'make codecov'. ifneq ($(filter gcov codecov,$(MAKECMDGOALS)),) - CXXFLAGS := $(CXXFLAGS:-g%=-g3) - CXXFLAGS := $(CXXFLAGS:-O%=-O1) - CXXFLAGS := $(CXXFLAGS:-xO%=-xO1) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1) ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),) - CXXFLAGS += -DCRYPTOPP_COVERAGE + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE endif # CRYPTOPP_COVERAGE ifeq ($(findstring -coverage,$(CXXFLAGS)),) - CXXFLAGS += -coverage + CRYPTOPP_CXXFLAGS += -coverage endif # -coverage endif # GCC code coverage # Valgrind testing. Issue 'make valgrind'. ifneq ($(filter valgrind,$(MAKECMDGOALS)),) # Tune flags; see http://valgrind.org/docs/manual/quick-start.html - CXXFLAGS := $(CXXFLAGS:-g%=-g3) - CXXFLAGS := $(CXXFLAGS:-O%=-O1) - CXXFLAGS := $(CXXFLAGS:-xO%=-xO1) - ifeq ($(findstring -DCRYPTOPP_VALGRIND,$(CXXFLAGS)),) - CXXFLAGS += -DCRYPTOPP_VALGRIND - endif # -DCRYPTOPP_VALGRIND + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-g%=-g3) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-O%=-O1) + CRYPTOPP_CXXFLAGS := $(CRYPTOPP_CXXFLAGS:-xO%=-xO1) + ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),) + CRYPTOPP_CXXFLAGS += -DCRYPTOPP_COVERAGE + endif # -DCRYPTOPP_COVERAGE endif # Valgrind # Debug testing on GNU systems. Triggered by -DDEBUG. # Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268 ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),) TPROG = TestPrograms/test_cxx.cxx - USING_GLIBCXX := $(shell $(CXX) $(CXXFLAGS) -E $(TPROG) -o $(TOUT) 2>&1 | $(GREP) -i -c "__GLIBCXX__") + USING_GLIBCXX := $(shell $(CXX)$(CXXFLAGS) -E $(TPROG) -o $(TOUT) 2>&1 | $(GREP) -i -c "__GLIBCXX__") ifneq ($(USING_GLIBCXX),0) ifeq ($(HAS_NEWLIB),0) ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),) - CXXFLAGS += -D_GLIBCXX_DEBUG - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -D_GLIBCXX_DEBUG + endif # CRYPTOPP_CXXFLAGS endif # HAS_NEWLIB endif # USING_GLIBCXX ifeq ($(XLC_COMPILER),1) TPROG = TestPrograms/test_cxx.cxx TOPT = -qheapdebug -qro - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) - CXXFLAGS += -qheapdebug -qro - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -qheapdebug -qro + endif # CRYPTOPP_CXXFLAGS endif # XLC_COMPILER endif # Debug build # Dead code stripping. Issue 'make lean'. ifeq ($(findstring lean,$(MAKECMDGOALS)),lean) ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),) - CXXFLAGS += -ffunction-sections - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -ffunction-sections + endif # CRYPTOPP_CXXFLAGS ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),) - CXXFLAGS += -fdata-sections - endif # CXXFLAGS + CRYPTOPP_CXXFLAGS += -fdata-sections + endif # CRYPTOPP_CXXFLAGS ifneq ($(IS_DARWIN),0) ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),) - LDFLAGS += -Wl,-dead_strip - endif # CXXFLAGS + CRYPTOPP_LDFLAGS += -Wl,-dead_strip + endif # CRYPTOPP_CXXFLAGS else # BSD, Linux and Unix ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),) - LDFLAGS += -Wl,--gc-sections + CRYPTOPP_LDFLAGS += -Wl,--gc-sections endif # LDFLAGS endif # MAKECMDGOALS endif # Dead code stripping # For Shared Objects, Diff, Dist/Zip rules -LIB_VER := $(shell $(GREP) "define CRYPTOPP_VERSION" config.h | cut -d" " -f 3) +LIB_VER := $(shell $(GREP) "define CRYPTOPP_VERSION" config_ver.h | cut -d" " -f 3) LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1) LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2) LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3) @@ -1042,7 +1110,7 @@ endif ########################################################### # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems. -SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(sort $(wildcard *.cpp))) +SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp,$(sort $(wildcard *.cpp))) # For Makefile.am; resource.h is Windows INCL := $(filter-out resource.h,$(sort $(wildcard *.h))) @@ -1050,12 +1118,30 @@ ifneq ($(IS_MINGW),0) INCL += resource.h endif -# Cryptogams AES for ARMv4 and above. We couple to ARMv7. -# Avoid iOS. It cannot consume the assembly. -ifeq ($(IS_ARM32),1) - CRYPTOGAMS_AES_FLAG = -march=armv7-a - CRYPTOGAMS_AES_FLAG += -Wa,--noexecstack - SRCS += aes_armv4.S +# Cryptogams source files. We couple to ARMv7. +# Limit to Linux. The source files target the GNU assembler. +# Also see https://www.cryptopp.com/wiki/Cryptogams. +ifeq ($(IS_ARM32)$(IS_LINUX),11) + ifeq ($(CLANG_COMPILER),1) + CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack + CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -mthumb -Wa,--noexecstack + else + CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack + CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -Wa,--noexecstack + endif + SRCS += aes_armv4.S sha1_armv4.S sha256_armv4.S sha512_armv4.S +endif + +# Remove unneeded arch specific files to speed build time. +ifeq ($(IS_PPC32)$(IS_PPC64),00) + SRCS := $(filter-out ppc_%,$(SRCS)) +endif +ifeq ($(IS_ARM32)$(IS_ARMV8),00) + SRCS := $(filter-out arm_%,$(SRCS)) + SRCS := $(filter-out neon_%,$(SRCS)) +endif +ifeq ($(IS_X86)$(IS_X32)$(IS_X64),000) + SRCS := $(filter-out sse_%,$(SRCS)) endif # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems. @@ -1082,6 +1168,23 @@ LIBIMPORTOBJS := $(LIBOBJS:.o=.import.o) TESTIMPORTOBJS := $(TESTOBJS:.o=.import.o) DLLTESTOBJS := dlltest.dllonly.o +# Clean recipe, Issue 998. Don't filter-out some artifacts from the list of objects +# The *.S is a hack. It makes the ASM appear like C++ so the object files make the CLEAN_OBJS list +CLEAN_SRCS := $(wildcard *.cpp) $(patsubst %.S,%.cpp,$(wildcard *.S)) +CLEAN_OBJS := $(CLEAN_SRCS:.cpp=.o) $(CLEAN_SRCS:.cpp=.import.o) $(CLEAN_SRCS:.cpp=.export.o) + +########################################################### +##### Add our flags to user flags ##### +########################################################### + +# This ensures we don't add flags when the user forbids +# use of customary library flags, like -fPIC. Make will +# ignore this assignment when CXXFLAGS is passed as an +# argument to the make program: make CXXFLAGS="..." +CPPFLAGS := $(strip $(CRYPTOPP_CPPFLAGS) $(CPPFLAGS)) +CXXFLAGS := $(strip $(CRYPTOPP_CXXFLAGS) $(CXXFLAGS)) +LDFLAGS := $(strip $(CRYPTOPP_LDFLAGS) $(LDFLAGS)) + ########################################################### ##### Targets and Recipes ##### ########################################################### @@ -1101,10 +1204,6 @@ static: libcryptopp.a shared dynamic: libcryptopp.so$(SOLIB_VERSION_SUFFIX) endif -.PHONY: dep deps depend -dep deps depend GNUmakefile.deps: - $(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DISABLE_ASM) -MM *.cpp > GNUmakefile.deps - # CXXFLAGS are tuned earlier. .PHONY: native no-asm asan ubsan native no-asm asan ubsan: cryptest.exe @@ -1183,7 +1282,7 @@ docs html: .PHONY: clean clean: - -$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) rdrand-*.o $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS) + -$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(CLEAN_OBJS) rdrand-*.o @-$(RM) libcryptopp.a libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a @-$(RM) libcryptopp.so libcryptopp.so$(SOLIB_COMPAT_SUFFIX) libcryptopp.so$(SOLIB_VERSION_SUFFIX) @-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.info ct et @@ -1199,15 +1298,20 @@ autotools-clean: @-$(RM) -f config.guess config.status config.sub config.h.in compile depcomp @-$(RM) -f install-sh stamp-h1 ar-lib *.lo *.la *.m4 local.* lt*.sh missing @-$(RM) -f cryptest cryptestcwd libtool* libcryptopp.la libcryptopp.pc* - @-$(RM) -rf m4/ auto*.cache/ .deps/ .libs/ + @-$(RM) -rf build-aux/ m4/ auto*.cache/ .deps/ .libs/ .PHONY: cmake-clean cmake-clean: @-$(RM) -f cryptopp-config.cmake CMakeLists.txt @-$(RM) -rf cmake_build/ +.PHONY: android-clean +android-clean: + @-$(RM) -f $(patsubst %_simd.cpp,%_simd.cpp.neon,$(wildcard *_simd.cpp)) + @-$(RM) -rf obj/ + .PHONY: distclean -distclean: clean autotools-clean cmake-clean +distclean: clean autotools-clean cmake-clean android-clean -$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt @-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~ @-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/ @@ -1222,13 +1326,13 @@ distclean: clean autotools-clean cmake-clean install: cryptest.exe install-lib @-$(MKDIR) $(DESTDIR)$(BINDIR) $(CP) cryptest.exe $(DESTDIR)$(BINDIR) - $(CHMOD) 0755 $(DESTDIR)$(BINDIR)/cryptest.exe + $(CHMOD) u=rwx,go=rx $(DESTDIR)$(BINDIR)/cryptest.exe @-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestData @-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestVectors $(CP) TestData/*.dat $(DESTDIR)$(DATADIR)/cryptopp/TestData - $(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat + $(CHMOD) u=rw,go=r $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat $(CP) TestVectors/*.txt $(DESTDIR)$(DATADIR)/cryptopp/TestVectors - $(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt + $(CHMOD) u=rw,go=r $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt # A recipe to install only the library, and not cryptest.exe. Also # see https://github.com/weidai11/cryptopp/issues/653. Some users @@ -1238,22 +1342,22 @@ install: cryptest.exe install-lib install-lib: @-$(MKDIR) $(DESTDIR)$(INCLUDEDIR)/cryptopp $(CP) *.h $(DESTDIR)$(INCLUDEDIR)/cryptopp - $(CHMOD) 0644 $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h + $(CHMOD) u=rw,go=r $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h ifneq ($(wildcard libcryptopp.a),) @-$(MKDIR) $(DESTDIR)$(LIBDIR) $(CP) libcryptopp.a $(DESTDIR)$(LIBDIR) - $(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/libcryptopp.a + $(CHMOD) u=rw,go=r $(DESTDIR)$(LIBDIR)/libcryptopp.a endif ifneq ($(wildcard libcryptopp.dylib),) @-$(MKDIR) $(DESTDIR)$(LIBDIR) $(CP) libcryptopp.dylib $(DESTDIR)$(LIBDIR) - $(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.dylib + $(CHMOD) u=rwx,go=rx $(DESTDIR)$(LIBDIR)/libcryptopp.dylib -install_name_tool -id $(DESTDIR)$(LIBDIR)/libcryptopp.dylib $(DESTDIR)$(LIBDIR)/libcryptopp.dylib endif ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),) @-$(MKDIR) $(DESTDIR)$(LIBDIR) $(CP) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR) - $(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX) + $(CHMOD) u=rwx,go=rx $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX) ifeq ($(HAS_SOLIB_VERSION),1) -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so $(LDCONF) $(DESTDIR)$(LIBDIR) @@ -1262,7 +1366,7 @@ endif ifneq ($(wildcard libcryptopp.pc),) @-$(MKDIR) $(DESTDIR)$(LIBDIR)/pkgconfig $(CP) libcryptopp.pc $(DESTDIR)$(LIBDIR)/pkgconfig - $(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc + $(CHMOD) u=rw,go=r $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc endif .PHONY: remove uninstall @@ -1270,14 +1374,18 @@ remove uninstall: -$(RM) -r $(DESTDIR)$(INCLUDEDIR)/cryptopp -$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.a -$(RM) $(DESTDIR)$(BINDIR)/cryptest.exe - @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.dylib +ifneq ($(wildcard $(DESTDIR)$(LIBDIR)/libcryptopp.dylib),) + -$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.dylib +endif +ifneq ($(wildcard $(DESTDIR)$(LIBDIR)/libcryptopp.so),) + -$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so +endif @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX) @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX) - @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so @-$(RM) $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc @-$(RM) -r $(DESTDIR)$(DATADIR)/cryptopp -libcryptopp.a: $(LIBOBJS) +libcryptopp.a: $(LIBOBJS) | osx_warning $(AR) $(ARFLAGS) $@ $(LIBOBJS) ifeq ($(IS_SUN),0) $(RANLIB) $@ @@ -1290,29 +1398,29 @@ endif libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS) ifeq ($(XLC_COMPILER),1) - $(CXX) -qmkshrobj $(SOLIB_FLAGS) -o $@ $(strip $(CXXFLAGS)) $(LDFLAGS) $(LIBOBJS) $(LDLIBS) + $(CXX) -qmkshrobj $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) $(LDFLAGS) $(LIBOBJS) $(LDLIBS) else - $(CXX) -shared $(SOLIB_FLAGS) -o $@ $(strip $(CXXFLAGS)) $(LDFLAGS) $(LIBOBJS) $(LDLIBS) + $(CXX) -shared $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) $(LDFLAGS) $(LIBOBJS) $(LDLIBS) endif ifeq ($(HAS_SOLIB_VERSION),1) -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX) endif -libcryptopp.dylib: $(LIBOBJS) - $(CXX) -dynamiclib -o $@ $(strip $(CXXFLAGS)) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS) +libcryptopp.dylib: $(LIBOBJS) | osx_warning + $(CXX) -dynamiclib -o $@ $(CXXFLAGS) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS) -cryptest.exe:libcryptopp.a $(TESTOBJS) - $(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS) +cryptest.exe: $(LINK_LIBRARY) $(TESTOBJS) | osx_warning + $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) $(LINK_LIBRARY_PATH)$(LINK_LIBRARY) $(LDFLAGS) $(LDLIBS) # Makes it faster to test changes nolib: $(OBJS) - $(CXX) -o ct $(strip $(CXXFLAGS)) $(OBJS) $(LDFLAGS) $(LDLIBS) + $(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) dll: cryptest.import.exe dlltest.exe cryptopp.dll: $(DLLOBJS) - $(CXX) -shared -o $@ $(strip $(CXXFLAGS)) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a + $(CXX) -shared -o $@ $(CXXFLAGS) $(DLLOBJS) $(LDFLAGS) $(LDLIBS) -Wl,--out-implib=libcryptopp.dll.a libcryptopp.import.a: $(LIBIMPORTOBJS) $(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS) @@ -1321,32 +1429,34 @@ ifeq ($(IS_SUN),0) endif cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS) - $(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS) + $(CXX) -o $@ $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS) dlltest.exe: cryptopp.dll $(DLLTESTOBJS) - $(CXX) -o $@ $(strip $(CXXFLAGS)) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS) + $(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS) # Some users already have a libcryptopp.pc. We install it if the file # is present. If you want one, then issue 'make libcryptopp.pc'. Be sure # to use/verify PREFIX and LIBDIR below after writing the file. -libcryptopp.pc: +cryptopp.pc libcryptopp.pc: @echo '# Crypto++ package configuration file' > libcryptopp.pc @echo '' >> libcryptopp.pc - @echo 'prefix=$(PREFIX)' >> libcryptopp.pc - @echo 'libdir=$(LIBDIR)' >> libcryptopp.pc - @echo 'includedir=$${prefix}/include' >> libcryptopp.pc + @echo 'prefix=$(PC_PREFIX)' >> libcryptopp.pc + @echo 'libdir=$(PC_LIBDIR)' >> libcryptopp.pc + @echo 'includedir=$(PC_INCLUDEDIR)' >> libcryptopp.pc + @echo 'datadir=$(PC_DATADIR)' >> libcryptopp.pc @echo '' >> libcryptopp.pc @echo 'Name: Crypto++' >> libcryptopp.pc @echo 'Description: Crypto++ cryptographic library' >> libcryptopp.pc - @echo 'Version: 8.2' >> libcryptopp.pc + @echo 'Version: 8.5' >> libcryptopp.pc @echo 'URL: https://cryptopp.com/' >> libcryptopp.pc @echo '' >> libcryptopp.pc @echo 'Cflags: -I$${includedir}' >> libcryptopp.pc @echo 'Libs: -L$${libdir} -lcryptopp' >> libcryptopp.pc # This recipe prepares the distro files -TEXT_FILES := *.h *.cpp adhoc.cpp License.txt Readme.txt Install.txt Filelist.txt Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.s *.S *.vcxproj *.filters cryptopp.rc TestVectors/*.txt TestData/*.dat TestPrograms/*.cxx TestScripts/*.sh TestScripts/*.cmd -EXEC_FILES := GNUmakefile GNUmakefile-cross TestData/ TestVectors/ TestScripts/ TestPrograms/ +TEXT_FILES := *.h *.cpp *.S GNUmakefile GNUmakefile-cross License.txt Readme.txt Install.txt Filelist.txt Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj *.filters cryptopp.rc TestVectors/*.txt TestData/*.dat TestPrograms/*.cxx +EXEC_FILES := TestScripts/*.sh TestScripts/*.cmd +EXEC_DIRS := TestData/ TestVectors/ TestScripts/ TestPrograms/ ifeq ($(wildcard Filelist.txt),Filelist.txt) DIST_FILES := $(shell cat Filelist.txt) @@ -1355,25 +1465,24 @@ endif .PHONY: trim trim: ifneq ($(IS_DARWIN),0) - sed -i '' -e's/[[:space:]]*$$//' *.supp *.txt *.sh .*.yml *.h *.cpp *.asm *.s *.S - sed -i '' -e's/[[:space:]]*$$//' *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross - sed -i '' -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cxx TestScripts/*.* + $(SED) -i '' -e's/[[:space:]]*$$//' *.supp *.txt .*.yml *.h *.cpp *.asm *.S + $(SED) -i '' -e's/[[:space:]]*$$//' *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross + $(SED) -i '' -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cxx TestScripts/*.* make convert else - sed -i -e's/[[:space:]]*$$//' *.supp *.txt *.sh .*.yml *.h *.cpp *.asm *.s *.S - sed -i -e's/[[:space:]]*$$//' *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross - sed -i -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cxx TestScripts/*.* + $(SED) -i -e's/[[:space:]]*$$//' *.supp *.txt .*.yml *.h *.cpp *.asm *.S + $(SED) -i -e's/[[:space:]]*$$//' *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross + $(SED) -i -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cxx TestScripts/*.* make convert endif .PHONY: convert convert: - @-$(CHMOD) 0700 TestVectors/ TestData/ TestPrograms/ TestScripts/ - @-$(CHMOD) 0600 $(TEXT_FILES) *.supp .*.yml *.asm *.s *.zip TestVectors/*.txt TestData/*.dat TestPrograms/*.cxx TestScripts/*.* - @-$(CHMOD) 0700 $(EXEC_FILES) *.sh *.cmd TestScripts/*.sh TestScripts/*.cmd - @-$(CHMOD) 0700 *.cmd *.sh GNUmakefile GNUmakefile-cross TestScripts/*.sh - -unix2dos --keepdate --quiet $(TEXT_FILES) .*.yml *.asm *.cmd TestScripts/*.* - -dos2unix --keepdate --quiet GNUmakefile* *.supp *.s *.S *.sh *.mapfile TestScripts/*.sh + @-$(CHMOD) u=rwx,go=rx $(EXEC_DIRS) + @-$(CHMOD) u=rw,go=r $(TEXT_FILES) *.supp .*.yml *.asm *.zip TestVectors/*.txt TestData/*.dat TestPrograms/*.cxx + @-$(CHMOD) u=rwx,go=rx $(EXEC_FILES) + -unix2dos --keepdate --quiet $(TEXT_FILES) .*.yml *.asm TestScripts/*.cmd TestScripts/*.txt TestScripts/*.cpp + -dos2unix --keepdate --quiet GNUmakefile GNUmakefile-cross *.S *.supp *.mapfile TestScripts/*.sh ifneq ($(IS_DARWIN),0) @-xattr -c * endif @@ -1417,138 +1526,141 @@ ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps) -include GNUmakefile.deps endif # Dependencies -# Cryptogams ARM asm implementation. +# A few recipes trigger warnings for -std=c++11 and -stdlib=c++ +NOSTD_CXXFLAGS=$(filter-out -stdlib=%,$(filter-out -std=%,$(CXXFLAGS))) + +# Cryptogams ARM asm implementation. AES needs -mthumb for Clang aes_armv4.o : aes_armv4.S - $(CC) $(strip $(CXXFLAGS) $(CRYPTOGAMS_AES_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_THUMB_FLAG) -c) $< # SSSE3 or NEON available aria_simd.o : aria_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(ARIA_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ARIA_FLAG) -c) $< # SSE, NEON or POWER7 available blake2s_simd.o : blake2s_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $< # SSE, NEON or POWER8 available blake2b_simd.o : blake2b_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $< # SSE2 or NEON available chacha_simd.o : chacha_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(CHACHA_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_FLAG) -c) $< # AVX2 available chacha_avx.o : chacha_avx.cpp - $(CXX) $(strip $(CXXFLAGS) $(CHACHA_AVX2_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_AVX2_FLAG) -c) $< # SSSE3 available cham_simd.o : cham_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(CHAM_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHAM_FLAG) -c) $< # SSE4.2 or ARMv8a available crc_simd.o : crc_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(CRC_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRC_FLAG) -c) $< # Power9 available darn.o : darn.cpp - $(CXX) $(strip $(CXXFLAGS) $(DARN_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(DARN_FLAG) -c) $< # SSE2 on i686 donna_sse.o : donna_sse.cpp - $(CXX) $(strip $(CXXFLAGS) $(SSE2_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $< # Carryless multiply gcm_simd.o : gcm_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(GCM_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GCM_FLAG) -c) $< # Carryless multiply gf2n_simd.o : gf2n_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(GF2N_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GF2N_FLAG) -c) $< # SSSE3 available keccak_simd.o : keccak_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(KECCAK_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(KECCAK_FLAG) -c) $< # SSSE3 available lea_simd.o : lea_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(LEA_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LEA_FLAG) -c) $< # NEON available neon_simd.o : neon_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(NEON_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(NEON_FLAG) -c) $< # AltiVec available ppc_simd.o : ppc_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(ALTIVEC_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ALTIVEC_FLAG) -c) $< # Power7 available ppc_power7.o : ppc_power7.cpp - $(CXX) $(strip $(CXXFLAGS) $(POWER7_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(POWER7_FLAG) -c) $< # Power8 available ppc_power8.o : ppc_power8.cpp - $(CXX) $(strip $(CXXFLAGS) $(POWER8_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(POWER8_FLAG) -c) $< # Power9 available ppc_power9.o : ppc_power9.cpp - $(CXX) $(strip $(CXXFLAGS) $(POWER9_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(POWER9_FLAG) -c) $< # AESNI or ARMv7a/ARMv8a available rijndael_simd.o : rijndael_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(AES_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(AES_FLAG) -c) $< # SSE4.2/SHA-NI or ARMv8a available sha_simd.o : sha_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $< + +# Cryptogams SHA1 asm implementation. +sha1_armv4.o : sha1_armv4.S + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< + +# Cryptogams SHA256 asm implementation. +sha256_armv4.o : sha256_armv4.S + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< + +# Cryptogams SHA512 asm implementation. +sha512_armv4.o : sha512_armv4.S + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< sha3_simd.o : sha3_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SHA3_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA3_FLAG) -c) $< # SSE4.2/SHA-NI or ARMv8a available shacal2_simd.o : shacal2_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $< - -# SSSE3 or NEON available -simeck_simd.o : simeck_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SIMECK_FLAG) -c) $< - -# SSE4.1, NEON or POWER7 available -simon64_simd.o : simon64_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SIMON64_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $< # SSSE3, NEON or POWER8 available simon128_simd.o : simon128_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SIMON128_FLAG) -c) $< - -# SSE4.1, NEON or POWER7 available -speck64_simd.o : speck64_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SPECK64_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SIMON128_FLAG) -c) $< # SSSE3, NEON or POWER8 available speck128_simd.o : speck128_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SPECK128_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SPECK128_FLAG) -c) $< # ARMv8.4 available sm3_simd.o : sm3_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SM3_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM3_FLAG) -c) $< # AESNI available sm4_simd.o : sm4_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SM4_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM4_FLAG) -c) $< # IBM XLC -O3 optimization bug ifeq ($(XLC_COMPILER),1) sm3.o : sm3.cpp - $(CXX) $(strip $(subst -O3,-O2,$(CXXFLAGS)) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(subst -O3,-O2,$(CXXFLAGS)) -c) $< donna_32.o : donna_32.cpp - $(CXX) $(strip $(subst -O3,-O2,$(CXXFLAGS)) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(subst -O3,-O2,$(CXXFLAGS)) -c) $< donna_64.o : donna_64.cpp - $(CXX) $(strip $(subst -O3,-O2,$(CXXFLAGS)) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(subst -O3,-O2,$(CXXFLAGS)) -c) $< endif # SSE2 on i686 sse_simd.o : sse_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SSE2_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $< # Don't build Rijndael with UBsan. Too much noise due to unaligned data accesses. ifneq ($(findstring -fsanitize=undefined,$(CXXFLAGS)),) @@ -1557,42 +1669,59 @@ rijndael.o : rijndael.cpp endif # Only use CRYPTOPP_DATA_DIR if its not set in CXXFLAGS -ifeq ($(findstring -DCRYPTOPP_DATA_DIR, $(strip $(CXXFLAGS))),) +ifeq ($(findstring -DCRYPTOPP_DATA_DIR, $(CXXFLAGS)),) ifneq ($(strip $(CRYPTOPP_DATA_DIR)),) validat%.o : validat%.cpp - $(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $< bench%.o : bench%.cpp - $(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $< datatest.o : datatest.cpp - $(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $< test.o : test.cpp - $(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c) $< endif endif validat1.o : validat1.cpp - $(CXX) $(strip $(CXXFLAGS) $(ALTIVEC_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ALTIVEC_FLAG) -c) $< %.dllonly.o : %.cpp - $(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c) $< -o $@ + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c) $< -o $@ %.import.o : %.cpp - $(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_IMPORTS -c) $< -o $@ + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_IMPORTS -c) $< -o $@ %.export.o : %.cpp - $(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c) $< -o $@ + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c) $< -o $@ %.bc : %.cpp - $(CXX) $(strip $(CXXFLAGS) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -c) $< %.o : %.cpp - $(CXX) $(strip $(CXXFLAGS) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -c) $< .PHONY: so_warning so_warning: ifeq ($(HAS_SOLIB_VERSION),1) + $(info ) $(info WARNING: Only the symlinks to the shared-object library have been updated.) $(info WARNING: If the library is installed in a system directory you will need) $(info WARNING: to run 'ldconfig' to update the shared-object library cache.) $(info ) endif + +.PHONY: osx_warning +osx_warning: +ifeq ($(IS_DARWIN),1) + ifeq ($(findstring -stdlib=libc++,$(CRYPTOPP_CXXFLAGS)$(CXXFLAGS)),) + $(info ) + $(info INFO: Crypto++ was built without LLVM's libc++. If you are using the library) + $(info INFO: with Xcode, then you should add -stdlib=libc++ to CXXFLAGS. It is) + $(info INFO: already present in the makefile, and you only need to uncomment it.) + $(info ) + endif +endif + +.PHONY: dep deps depend +dep deps depend GNUmakefile.deps: + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS)) -MM *.cpp > GNUmakefile.deps diff --git a/vendor/cryptopp/vendor_cryptopp/GNUmakefile-cross b/vendor/cryptopp/vendor_cryptopp/GNUmakefile-cross old mode 100755 new mode 100644 index c13cd68b..3c4aa124 --- a/vendor/cryptopp/vendor_cryptopp/GNUmakefile-cross +++ b/vendor/cryptopp/vendor_cryptopp/GNUmakefile-cross @@ -5,12 +5,16 @@ SHELL = /bin/sh # If needed TMPDIR ?= /tmp -# Used for ARMv7 and NEON. -FP_ABI ?= hard # Used for feature tests TOUT ?= a.out TOUT := $(strip $(TOUT)) +# Allow override for the cryptest.exe recipe. Change to +# ./libcryptopp.so or ./libcryptopp.dylib to suit your +# taste. https://github.com/weidai11/cryptopp/issues/866 +LINK_LIBRARY ?= libcryptopp.a +LINK_LIBRARY_PATH ?= ./ + # Default CXXFLAGS if none were provided CXXFLAGS ?= -DNDEBUG -g2 -O3 -fPIC -pipe @@ -21,7 +25,8 @@ CP ?= cp MV ?= mv CHMOD ?= chmod MKDIR ?= mkdir -p -EGREP ?= egrep +GREP ?= grep +SED ?= sed LN ?= ln -sf LDCONF ?= /sbin/ldconfig -n @@ -29,7 +34,16 @@ LDCONF ?= /sbin/ldconfig -n IS_IOS ?= 0 IS_ANDROID ?= 0 IS_ARM_EMBEDDED ?= 0 -IS_NEON ?= 0 + +# Clang is reporting armv8l-unknown-linux-gnueabihf +# for ARMv7 images on Aarch64 hardware. +MACHINEX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null) +HOSTX := $(shell echo $(MACHINEX) | cut -f 1 -d '-') +ifeq ($(HOSTX),) + HOSTX := $(shell uname -m 2>/dev/null) +endif + +IS_LINUX := $(shell echo $(MACHINEX) | $(GREP) -i -c "Linux") # Can be used by Android and Embeeded cross-compiles. Disable by default because # Android and embedded users typically don't run this configuration. @@ -83,14 +97,11 @@ endif # iOS cross-compile configuration. # See http://www.cryptopp.com/wiki/iOS_(Command_Line). ifeq ($(IS_IOS),1) - CXX = clang++ - - CXXFLAGS += $(IOS_FLAGS) -arch $(IOS_ARCH) - CXXFLAGS += -isysroot "$(IOS_SYSROOT)" -stdlib=libc++ + CXXFLAGS += $(IOS_CXXFLAGS) -stdlib=libc++ + CXXFLAGS += --sysroot "$(IOS_SYSROOT)" AR = libtool ARFLAGS = -static -o - RANLIB = ranlib endif ########################################################### @@ -100,22 +111,22 @@ endif # Android cross-compile configuration. # See http://www.cryptopp.com/wiki/Android_(Command_Line). ifeq ($(IS_ANDROID),1) - # CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-android.sh' - CXXFLAGS += $(AOSP_FLAGS) -DANDROID --sysroot=$(AOSP_SYSROOT) - CXXFLAGS += -Wa,--noexecstack -I$(AOSP_STL_INC) -I$(AOSP_SYS_ARCH_INC) - LDFLAGS += --sysroot=$(AOSP_LD_SYSROOT) + CPPFLAGS += $(ANDROID_CPPFLAGS) + CPPFLAGS += -DANDROID + CXXFLAGS += $(ANDROID_CXXFLAGS) + CXXFLAGS += --sysroot=$(ANDROID_SYSROOT) + CXXFLAGS += -Wa,--noexecstack - # c++config.h shows up in odd places at times. - ifneq ($(AOSP_BITS_INC),) - CXXFLAGS += -I$(AOSP_BITS_INC) - endif - - # STL headers - LDLIBS += $(AOSP_STL_LIB) + # Aarch64 ld does not understand --warn-execstack + LDFLAGS += $(ANDROID_LDFLAGS) + LDFLAGS += -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now + LDFLAGS += -Wl,--warn-shared-textrel -Wl,--warn-common + LDFLAGS += -Wl,--warn-unresolved-symbols + LDFLAGS += -Wl,--gc-sections -Wl,--fatal-warnings # Source files copied into PWD for Android cpu-features # setenv-android.sh does the copying. Its a dirty compile. - AOSP_CPU_OBJ = cpu-features.o + ANDROID_CPU_OBJ = cpu-features.o endif ########################################################### @@ -136,8 +147,8 @@ endif # Wait until CXXFLAGS have been set by setenv scripts. -GCC_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(EGREP) -v -E 'llvm|clang' | $(EGREP) -i -c -E '(gcc|g\+\+)') -CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(EGREP) -i -c -E 'llvm|clang') +GCC_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -v -E 'llvm|clang' | $(GREP) -i -c -E '(gcc|g\+\+)') +CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c -E 'llvm|clang') HOSTX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null | cut -f 1 -d '-') ifeq ($(HOSTX),) @@ -149,17 +160,25 @@ endif # -arch arm64 yields x86_64 instead of aarch64 or arm64. ifeq ($(CLANG_COMPILER),1) - IS_X86 := $(shell echo $(CXXFLAGS) | $(EGREP) -v 64 | $(EGREP) -i -c -E 'i.86') - IS_X64 := $(shell echo $(CXXFLAGS) | $(EGREP) -i -c -E 'x86_64|amd64') - IS_ARM32 := $(shell echo $(CXXFLAGS) | $(EGREP) -v 64 | $(EGREP) -i -c -E 'arm|armhf|arm7l|eabihf') - IS_ARMV8 := $(shell echo $(CXXFLAGS) | $(EGREP) -i -c -E 'aarch32|aarch64|arm64|armv8') + IS_X86 := $(shell echo $(CXXFLAGS) | $(GREP) -v 64 | $(GREP) -i -c -E 'i.86') + IS_X64 := $(shell echo $(CXXFLAGS) | $(GREP) -i -c -E 'x86_64|amd64') + IS_ARM32 := $(shell echo $(CXXFLAGS) | $(GREP) -v 64 | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf') + IS_ARMV8 := $(shell echo $(CXXFLAGS) | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8') else - IS_X86 := $(shell echo $(HOSTX) | $(EGREP) -v 64 | $(EGREP) -i -c -E 'i.86') - IS_X64 := $(shell echo $(HOSTX) | $(EGREP) -i -c -E 'x86_64|amd64') - IS_ARM32 := $(shell echo $(HOSTX) | $(EGREP) -v 64 | $(EGREP) -i -c -E 'arm|armhf|arm7l|eabihf') - IS_ARMV8 := $(shell echo $(HOSTX) | $(EGREP) -i -c -E 'aarch32|aarch64|arm64|armv8') + IS_X86 := $(shell echo $(HOSTX) | $(GREP) -v 64 | $(GREP) -i -c -E 'i.86') + IS_X64 := $(shell echo $(HOSTX) | $(GREP) -i -c -E 'x86_64|amd64') + IS_ARM32 := $(shell echo $(HOSTX) | $(GREP) -v 64 | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf') + IS_ARMV8 := $(shell echo $(HOSTX) | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8') endif +ifeq ($(IS_ARMV8),1) + IS_ARM32 = 0 +endif + +IS_X32 := 0 +IS_PPC32 := 0 +IS_PPC64 := 0 + $(info Here's what we found... IS_X86: $(IS_X86), IS_X64: $(IS_X64), IS_ARM32: $(IS_ARM32), IS_ARMV8: $(IS_ARMV8)) ########################################################### @@ -176,11 +195,14 @@ else ifeq ($(findstring distclean,$(MAKECMDGOALS)),distclean) DETECT_FEATURES := 0 else ifeq ($(findstring distclean,$(MAKECMDGOALS)),trim) DETECT_FEATURES := 0 +else ifeq ($(IS_IOS),1) + DETECT_FEATURES := 0 endif -# Strip out -Wall, -Wextra and friends for feature testing +# Strip out -Wall, -Wextra and friends for feature testing. FORTIFY_SOURCE is removed +# because it requires -O1 or higher, but we use -O0 to tame the optimizer. ifeq ($(DETECT_FEATURES),1) - TCXXFLAGS := $(filter-out -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS)) + TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -M -MM -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS)) ifneq ($(strip $(TCXXFLAGS)),) $(info Using testing flags: $(TCXXFLAGS)) endif @@ -212,7 +234,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_sse2.cxx TOPT = $(SSE2_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) CHACHA_FLAG = $(SSE2_FLAG) else @@ -221,15 +243,13 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_ssse3.cxx TOPT = $(SSSE3_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) ARIA_FLAG = $(SSSE3_FLAG) CHAM_FLAG = $(SSSE3_FLAG) + KECCAK_FLAG = $(SSSE3_FLAG) LEA_FLAG = $(SSSE3_FLAG) - SIMECK_FLAG = $(SSSE3_FLAG) - SIMON64_FLAG = $(SSSE3_FLAG) SIMON128_FLAG = $(SSSE3_FLAG) - SPECK64_FLAG = $(SSSE3_FLAG) SPECK128_FLAG = $(SSSE3_FLAG) else SSSE3_FLAG = @@ -237,19 +257,17 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_sse41.cxx TOPT = $(SSE41_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) BLAKE2B_FLAG = $(SSE41_FLAG) BLAKE2S_FLAG = $(SSE41_FLAG) - SIMON64_FLAG = $(SSE41_FLAG) - SPECK64_FLAG = $(SSE41_FLAG) else SSE41_FLAG = endif TPROG = TestPrograms/test_x86_sse42.cxx TOPT = $(SSE42_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) CRC_FLAG = $(SSE42_FLAG) else @@ -258,16 +276,17 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_clmul.cxx TOPT = $(CLMUL_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) GCM_FLAG = $(SSSE3_FLAG) $(CLMUL_FLAG) + GF2N_FLAG = $(CLMUL_FLAG) else CLMUL_FLAG = endif TPROG = TestPrograms/test_x86_aes.cxx TOPT = $(AESNI_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) AES_FLAG = $(SSE41_FLAG) $(AESNI_FLAG) SM4_FLAG = $(SSSE3_FLAG) $(AESNI_FLAG) @@ -277,7 +296,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_avx.cxx TOPT = $(AVX_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) # XXX_FLAG = $(AVX_FLAG) else @@ -286,7 +305,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_avx2.cxx TOPT = $(AVX2_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) CHACHA_AVX2_FLAG = $(AVX2_FLAG) else @@ -295,7 +314,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_x86_sha.cxx TOPT = $(SHANI_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) SHA_FLAG = $(SSE42_FLAG) $(SHANI_FLAG) else @@ -341,6 +360,18 @@ ifeq ($(DETECT_FEATURES),1) endif endif + # Most Clang cannot handle mixed asm with positional arguments, where the + # body is Intel style with no prefix and the templates are AT&T style. + # Also see https://bugs.llvm.org/show_bug.cgi?id=39895 . + + # CRYPTOPP_DISABLE_MIXED_ASM is now being added in config_asm.h for all + # Clang compilers. This test will need to be re-enabled if Clang fixes it. + #TPROG = TestPrograms/test_asm_mixed.cxx + #HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + #ifneq ($(strip $(HAVE_OPT)),0) + # CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM + #endif + # DETECT_FEATURES endif @@ -348,23 +379,30 @@ endif endif ########################################################### -##### ARM A-32, Aach64 and NEON ##### +##### ARM A-32 and NEON ##### ########################################################### -ifneq ($(IS_ARM32)$(IS_ARMV8),00) +ifneq ($(IS_ARM32),0) ifeq ($(DETECT_FEATURES),1) -ifeq ($(IS_ARM32),1) - - ifneq ($(IS_IOS)$(IS_ANDROID),00) - NEON_FLAG = + # Android needs -c compile flag for NEON. Otherwise there's an odd linker message. + ifeq ($(IS_ANDROID),1) + NEON_FLAG = -march=armv7-a -mfpu=vfpv3-d16 -mfpu=neon else - NEON_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon + NEON_FLAG = -march=armv7-a -mfpu=neon + endif + + # Clang needs an option to include + TPROG = TestPrograms/test_arm_neon_header.cxx + TOPT = $(NEON_FLAG) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1 endif TPROG = TestPrograms/test_arm_neon.cxx TOPT = $(NEON_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) ARIA_FLAG = $(NEON_FLAG) AES_FLAG = $(NEON_FLAG) @@ -376,10 +414,7 @@ ifeq ($(IS_ARM32),1) CHAM_FLAG = $(NEON_FLAG) LEA_FLAG = $(NEON_FLAG) SHA_FLAG = $(NEON_FLAG) - SIMECK_FLAG = $(NEON_FLAG) - SIMON64_FLAG = $(NEON_FLAG) SIMON128_FLAG = $(NEON_FLAG) - SPECK64_FLAG = $(NEON_FLAG) SPECK128_FLAG = $(NEON_FLAG) SM4_FLAG = $(NEON_FLAG) else @@ -387,10 +422,17 @@ ifeq ($(IS_ARM32),1) CXXFLAGS += -DCRYPTOPP_DISABLE_ASM endif +# DETECT_FEATURES +endif # IS_ARM32 endif -ifeq ($(IS_ARMV8),1) +########################################################### +##### Aach32 and Aarch64 ##### +########################################################### + +ifneq ($(IS_ARMV8),0) +ifeq ($(DETECT_FEATURES),1) ifeq ($(IS_IOS),1) ASIMD_FLAG = @@ -402,22 +444,28 @@ ifeq ($(IS_ARMV8),1) ASIMD_FLAG = -march=armv8-a CRC_FLAG = -march=armv8-a+crc AES_FLAG = -march=armv8-a+crypto - PMULL_FLAG = -march=armv8-a+crypto + GCM_FLAG = -march=armv8-a+crypto + GF2N_FLAG = -march=armv8-a+crypto SHA_FLAG = -march=armv8-a+crypto endif - TPROG = TestPrograms/test_arm_acle.cxx - TOPT = $(ASIMD_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + TPROG = TestPrograms/test_arm_neon_header.cxx + TOPT = + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) - ACLE_FLAG += -DCRYPTOPP_ARM_ACLE_AVAILABLE=1 - else - CXXFLAGS += -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 + THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1 + endif + + TPROG = TestPrograms/test_arm_acle_header.cxx + TOPT = $(ASIMD_FLAG) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifeq ($(strip $(HAVE_OPT)),0) + THEADER += -DCRYPTOPP_ARM_ACLE_HEADER=1 endif TPROG = TestPrograms/test_arm_asimd.cxx TOPT = $(ASIMD_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) ARIA_FLAG = $(ASIMD_FLAG) BLAKE2B_FLAG = $(ASIMD_FLAG) @@ -426,10 +474,7 @@ ifeq ($(IS_ARMV8),1) CHAM_FLAG = $(ASIMD_FLAG) LEA_FLAG = $(ASIMD_FLAG) NEON_FLAG = $(ASIMD_FLAG) - SIMECK_FLAG = $(ASIMD_FLAG) - SIMON64_FLAG = $(ASIMD_FLAG) SIMON128_FLAG = $(ASIMD_FLAG) - SPECK64_FLAG = $(ASIMD_FLAG) SPECK128_FLAG = $(ASIMD_FLAG) SM4_FLAG = $(ASIMD_FLAG) else @@ -439,59 +484,70 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_crc.cxx TOPT = $(CRC_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifneq ($(strip $(HAVE_OPT)),0) CRC_FLAG = - CXXFLAGS += -DCRYPTOPP_ARM_CRC32_AVAILABLE=0 + CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_CRC32 endif TPROG = TestPrograms/test_arm_aes.cxx TOPT = $(AES_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifneq ($(strip $(HAVE_OPT)),0) AES_FLAG = - CXXFLAGS += -DCRYPTOPP_ARM_AES_AVAILABLE=0 + CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_AES endif TPROG = TestPrograms/test_arm_pmull.cxx TOPT = $(PMULL_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifneq ($(strip $(HAVE_OPT)),0) - PMULL_FLAG = - CXXFLAGS += -DCRYPTOPP_ARM_PMULL_AVAILABLE=0 + GCM_FLAG = + GF2N_FLAG = + CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_PMULL endif - TPROG = TestPrograms/test_arm_sha.cxx + TPROG = TestPrograms/test_arm_sha1.cxx TOPT = $(SHA_FLAG) - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifneq ($(strip $(HAVE_OPT)),0) SHA_FLAG = - CXXFLAGS += -DCRYPTOPP_ARM_SHA_AVAILABLE=0 + CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA1 + endif + + TPROG = TestPrograms/test_arm_sha256.cxx + TOPT = $(SHA_FLAG) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) + ifneq ($(strip $(HAVE_OPT)),0) + SHA_FLAG = + CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA2 endif TPROG = TestPrograms/test_arm_sm3.cxx TOPT = -march=armv8.4-a+crypto - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) SM3_FLAG = -march=armv8.4-a+crypto SM4_FLAG = -march=armv8.4-a+crypto + else + #CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM3 + #CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4 endif TPROG = TestPrograms/test_arm_sha3.cxx TOPT = -march=armv8.4-a+crypto - HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w) ifeq ($(strip $(HAVE_OPT)),0) SHA3_FLAG = -march=armv8.4-a+crypto SHA512_FLAG = -march=armv8.4-a+crypto + else + #CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA3 + #CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4 endif -# IS_ARMV8 -endif - # DETECT_FEATURES endif - -# IS_ARM32, IS_ARMV8, IS_NEON +# IS_ARMV8 endif ########################################################### @@ -531,7 +587,7 @@ endif # Asan # LD gold linker testing. Triggered by 'LD=ld.gold'. ifeq ($(findstring ld.gold,$(LD)),ld.gold) ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),) - ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(EGREP) -i -c "elf") + ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(GREP) -i -c "elf") ifneq ($(ELF_FORMAT),0) LDFLAGS += -fuse-ld=gold endif # ELF/ELF64 @@ -544,15 +600,15 @@ ifneq ($(filter valgrind,$(MAKECMDGOALS)),) CXXFLAGS := $(CXXFLAGS:-g%=-g3) CXXFLAGS := $(CXXFLAGS:-O%=-O1) CXXFLAGS := $(CXXFLAGS:-xO%=-xO1) - ifeq ($(findstring -DCRYPTOPP_VALGRIND,$(CXXFLAGS)),) - CXXFLAGS += -DCRYPTOPP_VALGRIND - endif # -DCRYPTOPP_VALGRIND + ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),) + CXXFLAGS += -DCRYPTOPP_COVERAGE + endif # -DCRYPTOPP_COVERAGE endif # Valgrind # Debug testing on GNU systems. Triggered by -DDEBUG. # Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268 ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),) - USING_GLIBCXX := $(shell $(CXX) $(CXXFLAGS) -E pch.cpp 2>&1 | $(EGREP) -i -c "__GLIBCXX__") + USING_GLIBCXX := $(shell $(CXX) $(CXXFLAGS) -E pch.cpp 2>&1 | $(GREP) -i -c "__GLIBCXX__") ifneq ($(USING_GLIBCXX),0) ifeq ($(HAS_NEWLIB),0) ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),) @@ -586,18 +642,34 @@ endif # Dead code stripping ########################################################### # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems. -SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp cryptlib_bds.cpp,$(sort $(wildcard *.cpp))) +SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp,$(sort $(wildcard *.cpp))) # For Makefile.am; resource.h is Windows INCL := $(filter-out resource.h,$(sort $(wildcard *.h))) -# Cryptogams AES for ARMv4 and above. We couple to ARMv7. -# Avoid iOS. It cannot consume the assembly. -ifeq ($(IS_ARM32),1) - ifneq ($(IS_IOS),1) - CRYPTOGAMS_AES_FLAG = -march=armv7-a - CRYPTOGAMS_AES_FLAG += -Wa,--noexecstack - SRCS += aes_armv4.S +# Cryptogams source files. We couple to ARMv7. +# Limit to Linux. The source files target the GNU assembler. +# Also see https://www.cryptopp.com/wiki/Cryptogams. +ifeq ($(IS_ARM32)$(IS_LINUX),11) + ifeq ($(CLANG_COMPILER),1) + CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack + CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -mthumb -Wa,--noexecstack + else + CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack + CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -Wa,--noexecstack endif + SRCS += aes_armv4.S sha1_armv4.S sha256_armv4.S sha512_armv4.S +endif + +# Remove unneeded arch specific files to speed build time. +ifeq ($(IS_PPC32)$(IS_PPC64),00) + SRCS := $(filter-out ppc_%,$(SRCS)) +endif +ifeq ($(IS_ARM32)$(IS_ARMV8),00) + SRCS := $(filter-out arm_%,$(SRCS)) + SRCS := $(filter-out neon_%,$(SRCS)) +endif +ifeq ($(IS_X86)$(IS_X32)$(IS_X64),000) + SRCS := $(filter-out sse_%,$(SRCS)) endif # List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems. @@ -612,8 +684,13 @@ TESTINCL := bench.h factory.h validate.h TESTOBJS := $(TESTSRCS:.cpp=.o) LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS)) +# Clean recipe, Issue 998. Don't filter-out some artifacts from the list of objects +# The *.S is a hack. It makes the ASM appear like C++ so the object files make the CLEAN_OBJS list +CLEAN_SRCS := $(wildcard *.cpp) $(patsubst %.S,%.cpp,$(wildcard *.S)) +CLEAN_OBJS := $(CLEAN_SRCS:.cpp=.o) $(CLEAN_SRCS:.cpp=.import.o) $(CLEAN_SRCS:.cpp=.export.o) + # For Shared Objects, Diff, Dist/Zip rules -LIB_VER := $(shell $(EGREP) "define CRYPTOPP_VERSION" config.h | cut -d" " -f 3) +LIB_VER := $(shell $(GREP) "define CRYPTOPP_VERSION" config_ver.h | cut -d" " -f 3) LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1) LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2) LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3) @@ -660,7 +737,7 @@ lean: static dynamic cryptest.exe .PHONY: clean clean: - -$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) $(AOSP_CPU_OBJ) rdrand-*.o $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS) + -$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(CLEAN_OBJS) $(ANDROID_CPU_OBJ) rdrand-*.o @-$(RM) libcryptopp.a libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a @-$(RM) libcryptopp.so libcryptopp.so$(SOLIB_COMPAT_SUFFIX) libcryptopp.so$(SOLIB_VERSION_SUFFIX) @-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.info ct et @@ -677,15 +754,20 @@ autotools-clean: @-$(RM) -f config.guess config.status config.sub config.h.in compile depcomp @-$(RM) -f install-sh stamp-h1 ar-lib *.lo *.la *.m4 local.* lt*.sh missing @-$(RM) -f cryptest cryptestcwd libtool* libcryptopp.la libcryptopp.pc* - @-$(RM) -rf m4/ auto*.cache/ .deps/ .libs/ + @-$(RM) -rf build-aux/ m4/ auto*.cache/ .deps/ .libs/ .PHONY: cmake-clean cmake-clean: @-$(RM) -f cryptopp-config.cmake CMakeLists.txt @-$(RM) -rf cmake_build/ +.PHONY: android-clean +android-clean: + @-$(RM) -f $(patsubst %_simd.cpp,%_simd.cpp.neon,$(wildcard *_simd.cpp)) + @-$(RM) -rf obj/ + .PHONY: distclean -distclean: clean autotools-clean cmake-clean +distclean: clean autotools-clean cmake-clean android-clean -$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt @-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~ @-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/ @@ -700,13 +782,13 @@ distclean: clean autotools-clean cmake-clean install: cryptest.exe install-lib @-$(MKDIR) $(DESTDIR)$(BINDIR) $(CP) cryptest.exe $(DESTDIR)$(BINDIR) - $(CHMOD) 0755 $(DESTDIR)$(BINDIR)/cryptest.exe + $(CHMOD) u=rwx,go=rx $(DESTDIR)$(BINDIR)/cryptest.exe @-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestData @-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestVectors $(CP) TestData/*.dat $(DESTDIR)$(DATADIR)/cryptopp/TestData - $(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat + $(CHMOD) u=rw,go=r $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat $(CP) TestVectors/*.txt $(DESTDIR)$(DATADIR)/cryptopp/TestVectors - $(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt + $(CHMOD) u=rw,go=r $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt # A recipe to install only the library, and not cryptest.exe. Also # see https://github.com/weidai11/cryptopp/issues/653. @@ -714,22 +796,22 @@ install: cryptest.exe install-lib install-lib: @-$(MKDIR) $(DESTDIR)$(INCLUDEDIR)/cryptopp $(CP) *.h $(DESTDIR)$(INCLUDEDIR)/cryptopp - $(CHMOD) 0644 $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h + $(CHMOD) u=rw,go=r $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h ifneq ($(wildcard libcryptopp.a),) @-$(MKDIR) $(DESTDIR)$(LIBDIR) $(CP) libcryptopp.a $(DESTDIR)$(LIBDIR) - $(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/libcryptopp.a + $(CHMOD) u=rw,go=r $(DESTDIR)$(LIBDIR)/libcryptopp.a endif ifneq ($(wildcard libcryptopp.dylib),) @-$(MKDIR) $(DESTDIR)$(LIBDIR) $(CP) libcryptopp.dylib $(DESTDIR)$(LIBDIR) - $(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.dylib + $(CHMOD) u=rwx,go=rx $(DESTDIR)$(LIBDIR)/libcryptopp.dylib -install_name_tool -id $(DESTDIR)$(LIBDIR)/libcryptopp.dylib $(DESTDIR)$(LIBDIR)/libcryptopp.dylib endif ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),) @-$(MKDIR) $(DESTDIR)$(LIBDIR) $(CP) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR) - $(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX) + $(CHMOD) u=rwx,go=rx $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX) ifeq ($(HAS_SOLIB_VERSION),1) -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so $(LDCONF) $(DESTDIR)$(LIBDIR) @@ -738,7 +820,7 @@ endif ifneq ($(wildcard libcryptopp.pc),) @-$(MKDIR) $(DESTDIR)$(LIBDIR)/pkgconfig $(CP) libcryptopp.pc $(DESTDIR)$(LIBDIR)/pkgconfig - $(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc + $(CHMOD) u=rw,go=r $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc endif .PHONY: remove uninstall @@ -751,8 +833,8 @@ remove uninstall: @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX) @-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so -libcryptopp.a: $(LIBOBJS) $(AOSP_CPU_OBJ) - $(AR) $(ARFLAGS) $@ $(LIBOBJS) $(AOSP_CPU_OBJ) +libcryptopp.a: $(LIBOBJS) $(ANDROID_CPU_OBJ) + $(AR) $(ARFLAGS) $@ $(LIBOBJS) $(ANDROID_CPU_OBJ) $(RANLIB) $@ ifeq ($(HAS_SOLIB_VERSION),1) @@ -760,18 +842,18 @@ ifeq ($(HAS_SOLIB_VERSION),1) libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX) endif -libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS) $(AOSP_CPU_OBJ) - $(CXX) -shared $(SOLIB_FLAGS) -o $@ $(strip $(CXXFLAGS)) -Wl,--exclude-libs,ALL $(LIBOBJS) $(AOSP_CPU_OBJ) $(LDFLAGS) $(LDLIBS) +libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS) $(ANDROID_CPU_OBJ) + $(CXX) -shared $(SOLIB_FLAGS) -o $@ $(strip $(CPPFLAGS) $(CXXFLAGS)) -Wl,--exclude-libs,ALL $(LIBOBJS) $(ANDROID_CPU_OBJ) $(LDFLAGS) $(LDLIBS) ifeq ($(HAS_SOLIB_VERSION),1) -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so -$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX) endif -libcryptopp.dylib: $(LIBOBJS) $(AOSP_CPU_OBJ) - $(CXX) -dynamiclib -o $@ $(strip $(CXXFLAGS)) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS) $(AOSP_CPU_OBJ) +libcryptopp.dylib: $(LIBOBJS) + $(CXX) -dynamiclib -o $@ $(strip $(CPPFLAGS) $(CXXFLAGS)) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS) -cryptest.exe: libcryptopp.a $(TESTOBJS) - $(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS) +cryptest.exe: $(LINK_LIBRARY) $(TESTOBJS) + $(CXX) -o $@ $(strip $(CPPFLAGS) $(CXXFLAGS)) $(TESTOBJS) $(LINK_LIBRARY_PATH)$(LINK_LIBRARY) $(LDFLAGS) $(LDLIBS) # Used to generate list of source files for Autotools, CMakeList and Android.mk .PHONY: sources @@ -800,108 +882,121 @@ ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps) -include GNUmakefile.deps endif # Dependencies -# Cryptogams ARM asm implementation. -aes_armv4.o : aes_armv4.S - $(CXX) $(strip $(CXXFLAGS) -fpermissive $(CRYPTOGAMS_AES_FLAG) -c) $< +# A few recipes trigger warnings for -std=c++11 and -stdlib=c++ +NOSTD_CXXFLAGS=$(filter-out -stdlib=%,$(filter-out -std=%,$(CXXFLAGS))) +# Cryptogams ARM asm implementation. AES needs -mthumb for Clang +aes_armv4.o : aes_armv4.S + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_THUMB_FLAG) -c) $< + +# Use C++ compiler on C source after patching. +# https://github.com/weidai11/cryptopp/issues/926 cpu-features.o: cpu-features.h cpu-features.c - $(CXX) $(strip $(CXXFLAGS) -fpermissive -c) cpu-features.c + $(CXX) -x c $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) -c) cpu-features.c # SSSE3 or NEON available aria_simd.o : aria_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(ARIA_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ARIA_FLAG) -c) $< # SSE, NEON or POWER7 available blake2s_simd.o : blake2s_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $< # SSE, NEON or POWER8 available blake2b_simd.o : blake2b_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $< # SSE2 or NEON available chacha_simd.o : chacha_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(CHACHA_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_FLAG) -c) $< # AVX2 available chacha_avx.o : chacha_avx.cpp - $(CXX) $(strip $(CXXFLAGS) $(CHACHA_AVX2_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_AVX2_FLAG) -c) $< # SSSE3 available cham_simd.o : cham_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(CHAM_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHAM_FLAG) -c) $< # Power9 available darn.o : darn.cpp - $(CXX) $(strip $(CXXFLAGS) $(DARN_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(DARN_FLAG) -c) $< # SSE2 on i686 donna_sse.o : donna_sse.cpp - $(CXX) $(strip $(CXXFLAGS) $(SSE2_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $< # SSE2 on i686 sse_simd.o : sse_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SSE2_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $< # SSE4.2 or ARMv8a available crc_simd.o : crc_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(CRC_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRC_FLAG) -c) $< # PCLMUL or ARMv7a/ARMv8a available gcm_simd.o : gcm_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(GCM_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GCM_FLAG) -c) $< + +# Carryless multiply +gf2n_simd.o : gf2n_simd.cpp + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GF2N_FLAG) -c) $< + +# SSSE3 available +keccak_simd.o : keccak_simd.cpp + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(KECCAK_FLAG) -c) $< # SSSE3 available lea_simd.o : lea_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(LEA_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LEA_FLAG) -c) $< # NEON available neon_simd.o : neon_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(NEON_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(NEON_FLAG) -c) $< # AESNI or ARMv7a/ARMv8a available rijndael_simd.o : rijndael_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(AES_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(AES_FLAG) -c) $< # SSE4.2/SHA-NI or ARMv8a available sha_simd.o : sha_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $< + +# Cryptogams SHA1 asm implementation. +sha1_armv4.o : sha1_armv4.S + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< + +# Cryptogams SHA256 asm implementation. +sha256_armv4.o : sha256_armv4.S + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< + +# Cryptogams SHA512 asm implementation. +sha512_armv4.o : sha512_armv4.S + $(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $< # SSE4.2/SHA-NI or ARMv8a available shacal2_simd.o : shacal2_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $< - -# SSSE3 or NEON available -simeck_simd.o : simeck_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SIMECK_FLAG) -c) $< - -# SSE4.1, NEON or POWER7 available -simon64_simd.o : simon64_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SIMON64_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $< # SSSE3, NEON or POWER8 available simon128_simd.o : simon128_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SIMON128_FLAG) -c) $< - -# SSE4.1, NEON or POWER7 available -speck64_simd.o : speck64_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SPECK64_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SIMON128_FLAG) -c) $< # SSSE3, NEON or POWER8 available speck128_simd.o : speck128_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SPECK128_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SPECK128_FLAG) -c) $< # ARMv8.4 available sm3_simd.o : sm3_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SM3_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM3_FLAG) -c) $< # AESNI available sm4_simd.o : sm4_simd.cpp - $(CXX) $(strip $(CXXFLAGS) $(SM4_FLAG) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM4_FLAG) -c) $< %.o : %.cpp - $(CXX) $(strip $(CXXFLAGS) -c) $< + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -c) $< .PHONY: dep deps depend dep deps depend GNUmakefile.deps: - $(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DISABLE_ASM) -MM *.cpp > GNUmakefile.deps + $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS)) -MM *.cpp > GNUmakefile.deps diff --git a/vendor/cryptopp/vendor_cryptopp/History.txt b/vendor/cryptopp/vendor_cryptopp/History.txt index 7897dd23..0e748302 100644 --- a/vendor/cryptopp/vendor_cryptopp/History.txt +++ b/vendor/cryptopp/vendor_cryptopp/History.txt @@ -480,3 +480,65 @@ last several releases. - fix missing GF2NT_233_Multiply_Reduce_CLMUL in FIPS DLL - add missing BLAKE2 constructors - fix missing BlockSize() in BLAKE2 classes + +8.3.0 - December 20, 2020 + - minor release, recompile of programs required + - expanded community input and support + * 66 unique contributors as of this release + - fix use of macro CRYPTOPP_ALIGN_DATA + - fix potential out-of-bounds read in ECDSA + - fix std::bad_alloc when using ByteQueue in pipeline + - fix missing CRYPTOPP_CXX17_EXCEPTIONS with Clang + - fix potential out-of-bounds read in GCM mode + - add configure.sh when preprocessor macros fail + - fix potential out-of-bounds read in SipHash + - fix compile error on POWER9 due to vec_xl_be + - fix K233 curve on POWER8 + - add Cirrus CI testing + - fix broken encryption for some 64-bit ciphers + - fix Android cpu-features.c using C++ compiler + - disable RDRAND and RDSEED for some AMD processors + - fix BLAKE2 hash calculation using Salt and Personalization + - refresh Android and iOS build scripts + - add XTS mode + - fix circular dependency between misc.h and secblock.h + - add Certificate interface + - fix recursion in AES::Encryption without AESNI + - add missing OID for ElGamal encryption + - fix missing override in KeyDerivationFunction-derived classes + - fix RDSEED assemble under MSVC + - fix elliptic curve timing leaks (CVE-2019-14318) + - add link-library variable to Makefiles + - fix SIZE_MAX definition in misc.h + - add GetWord64 and PutWord64 to BufferedTransformation + - use HKDF in AutoSeededX917RNG::Reseed + - fix Asan finding in VMAC on i686 in inline asm + - fix undeclared identifier _mm_roti_epi64 on Gentoo + - fix ECIES and GetSymmetricKeyLength + - fix possible divide by zero in PKCS5_PBKDF2_HMAC + - refine ASN.1 encoders and decoders + - disable BMI2 code paths in Integer class + - fix use of CRYPTOPP_CLANG_VERSION + - add NEON SHA1, SHA256 and SHA512 from Cryptogams + - add ARM SHA1, SHA256 and SHA512 from Cryptogams + - make config.h more autoconf friendly + - handle Clang triplet armv8l-unknown-linux-gnueabihf + - fix reference binding to misaligned address in xed25519 + - clear asserts in TestDataNameValuePairs + +8.4.0 - January 2, 2021 + - minor release, recompile of programs required + - expanded community input and support + * 67 unique contributors as of this release + - fix SIGILL on POWER8 when compiling with GCC 10 + - fix potential out-of-bounds write in FixedSizeAllocatorWithCleanup + - fix compile on AIX POWER7 with IBM XLC 12.01 + - fix compile on Solaris with SunCC 12.6 + - revert changes for constant-time elliptic curve algorithms + - fix makefile clean and distclean recipes + +8.5.0 - March 7, 2021 + - minor release, no recompile of programs required + - expanded community input and support + * 70 unique contributors as of this release + - port to Apple M1 diff --git a/vendor/cryptopp/vendor_cryptopp/Install.txt b/vendor/cryptopp/vendor_cryptopp/Install.txt index 19bc581e..5bc3d351 100644 --- a/vendor/cryptopp/vendor_cryptopp/Install.txt +++ b/vendor/cryptopp/vendor_cryptopp/Install.txt @@ -2,6 +2,7 @@ CONTENTS OF THIS FILE --------------------- * Introduction +* Prerequisites * Building the Library * Alternate Build Systems * Installing the Library @@ -16,27 +17,34 @@ INTRODUCTION Crypto++ Library is a free C++ class library of cryptographic algorithms and schemes. The library was originally written and placed in public domain by Wei Dai, but it is now maintained by the community. The library homepage is at http://www.cryptopp.com/. The latest library source code can be found at http://github.com/weidai11/cryptopp. For licensing and copyright information, please see License.txt. -These are general instructions for the AIX, BSDs, Linux, OS X, Solaris and Unix. The library uses a GNU makefile, which combines configuration and a non-anemic make. On AIX, BSD and Solaris you will likely have to use `gmake` to build the library. On Linux, OS X and Unix, the system's make should be OK. On Windows, Crypto++ provides Visual Studio solutions. +These are general instructions for AIX, BSDs, Linux, OS X, Solaris and Unix. The library uses GNU Make and a GNUmakefile to avoid anemic make. On AIX, BSD and Solaris you will likely have to use `gmake` to build the library. On Linux and OS X, the system's make should be OK. On Windows, Crypto++ provides Visual Studio solutions. You should look through the GNUmakefile and config.h to ensure settings look reasonable before building. There are two wiki pages that help explain them at http://www.cryptopp.com/wiki/GNUmakefile and http://www.cryptopp.com/wiki/Config.h. Wiki pages are available for some platforms with specific build instructions. The pages include Android, ARM, iOS, MSBuild and Solaris. Solaris users should visit the wiki for important information on compiling the library with different versions of SunCC and options, and information on improving library performance and features. -Crypto++ does not depend upon other tools or libraries. It does not use Autotools, does not use CMake, and does not use Boost. If you use an alternate build system, like Autotools or CMake, then see the warning below about CXXFLAGS and lack of -DNDEBUG. CMake is available in Master as a matter of convenience, but its not officially supported. +Crypto++ does not depend upon other tools or libraries. The library only needs GNU Make 3.80 on Unix & Linux; or Visual Studio 2010 and above build tools on Windows. The library does not use Autotools, does not use CMake, and does not use Boost. -There is a partially complete CmakeList.txt available on the wiki at http://www.cryptopp.com/wiki/CMake. It is not recommended for use because it is not in a good state. If you have CMake expertise and can work some problems, then please see the wiki page for tasks related to CMake. +Autotools and CMake projects are not officially supported. The build systems take too much time and effort. Unofficial projects are available at https://github.com/noloader/cryptopp-autotools and https://github.com/noloader/cryptopp-cmake. The projects provide a central location to support Autotools and CMake. Collaborators for Autotools and CMake are welcomed. +PREREQUISITES +------------- + +The library requires a semi-modern C++ compiler and GNU Make 3.81 or above. The compiler must support 64-bit words, C++03, namespaces, RTTI and exceptions. + +The library does not depend on other build systems, like Autotools or CMake. The library does not depend on other libraries, like Boost. + BUILDING THE LIBRARY -------------------- -In general, all you should have to do is open a terminal, and then: +In general, all you should have to do is open a terminal, cd to the cryptopp directory, and then: make make test sudo make install -The command above builds the static library and cryptest.exe program. It also uses a sane set of default flags, which are usually "-DNDEBUG -g2 -O3 -fPIC". +The command above builds the static library and cryptest.exe program. It also uses a sane default flags, which are usually "-DNDEBUG -g2 -O3 -fPIC". If you want to build the shared object, then issue: @@ -70,7 +78,16 @@ LLVM's libc++ is also supported, so you can: export CXXFLAGS="-std=c++11 -stdlib=libc++" make -If you target 32-bit IA-32 machines (i386, i586 or i686), then the makefile forgoes -fPIC due to register pressures. You should add -fPIC yourself in this case: +If you are using the library on OS X with XCode then you should add LLVM's libc++. You can do so by modifying CXXFLAGS, or you can modify the GNUmakefile. To modify the GNUmakefile, open it and find the line for OS X builds around line 150: + + ifneq ($(IS_DARWIN),0) + CXX ?= c++ + CRYPTOPP_CXXFLAGS += -stdlib=libc++ + AR = libtool + ARFLAGS = -static -o + endif + +If you target 32-bit IA-32 machines (i386, i586 or i686), then the makefile forgoes -fPIC due to register pressures. You should add -fPIC yourself, if needed: CXXFLAGS="-DNDEBUG -g2 -O3 -fPIC" make @@ -78,10 +95,27 @@ You can also override a variable so that only your flags are present. That is, t make CXXFLAGS="-std=c++11" -Crypto++ does not enagage Specter remediations at this time. You can build with Specter resistance with the following flags: +Crypto++ does not engage Specter remediations at this time. You can build with Specter resistance with the following flags: CXXFLAGS="-DNDEBUG -g2 -O3 -mfunction-return=thunk -mindirect-branch=thunk" make +The library does not support out-of-tree builds. You must cd to the Crypto++ directory before building. `make distclean` will return the Crypto++ directory to a pristine state. + + +BUILDING WITH VCPKG +------------------- + +You can download and install cryptopp using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager: + + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ./vcpkg integrate install + ./vcpkg install cryptopp + +The cryptopp port in vcpkg is kept up to date by Microsoft team members and community contributors. +If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. + ALTERNATE BUILD SYSTEMS ----------------------- @@ -124,7 +158,7 @@ The following are some of the targets provided by the GNU makefile. `make cryptest.exe` builds the library test harness. -`make test` and `make check` are the same recipe and invoke the test harness with the the validation option. That is, it executes `cryptest.exe v`. +`make test` and `make check` are the same recipe and invoke the test harness with the validation option. That is, it executes `cryptest.exe v`. `make install` installs the library. By default, the makefile copies into `/usr/local` by default. @@ -147,18 +181,16 @@ The Crypto++ embraces tools like Undefined Behavior sanitizer (UBsan), Address s UBsan and Asan are mutually exclusive options, so you can perform only one of these at a time: make ubsan - ./cryptest.exe v 2>&1 | egrep "(error|FAILED)" - ./cryptest.exe tv all 2>&1 | egrep "(error|FAILED)" + ./cryptest.exe v 2>&1 | grep -E "(error:|FAILED)" + ./cryptest.exe tv all 2>&1 | grep -E "(error:|FAILED)" Or: make asan - ./cryptest.exe v 2>&1 | egrep "(error|FAILED)" - ./cryptest.exe tv all 2>&1 | egrep "(error|FAILED)" + ./cryptest.exe v 2>&1 | grep -E "(error:|FAILED)" + ./cryptest.exe tv all 2>&1 | grep -E "(error:|FAILED)" -If you experience self test failures or see reports of undefined behavior, then you should ensure CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is defined in config.h. CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is not defined due to historical purposes. - -If you experience failures under Asan, then gather more information with: +If you experience failures under Asan, then gather more information with asan_symbolize. You may not need asan_symbolize nowadays: ./cryptest.exe v 2>&1 | asan_symbolize @@ -185,25 +217,25 @@ Fifth, the test harness provides a "validation" option which performs basic syst ./cryptest.exe v ... - All tests passed! - Test ended at Sun Jul 26 02:10:57 2015 - Seed used was: 1437891055 + Seed used was 1612313449 + Test started at Tue Feb 2 19:50:49 2021 + Test ended at Tue Feb 2 19:50:52 2021 Sixth, the test harness provides a "test vector" option which uses many known test vectors, even those published by other people (like Brian Gladman for AES). You run the test vectors as shown below. The tail of the output should indicate 0 failed tests. ./cryptest.exe tv all ... - Testing SymmetricCipher algorithm MARS/ECB. - ................. - Tests complete. Total tests = 4094. Failed tests = 0. + Testing SymmetricCipher algorithm AES/XTS. + ..................... + Tests complete. Total tests = 11260. Failed tests = 0. -The library also offers its test script for those who want to use it. The test script is names cryptest.sh, and it repeatedly builds the library and exectues the tests under various configurations. It takes 2 to 4 hours to run on a semi-modern desktop or server; and days to run on an IoT gadget. Also see http://github.com/weidai11/cryptopp/blob/master/cryptest.sh and http://cryptopp.com/wiki/Cryptest.sh. +The library also offers its test script for those who want to use it. The test script is names cryptest.sh, and it repeatedly builds the library and exectues the tests under various configurations. It takes about 4 hours to run on a semi-modern desktop or server; and several days to run on an IoT gadget. Also see http://github.com/weidai11/cryptopp/blob/master/cryptest.sh and http://cryptopp.com/wiki/Cryptest.sh. REPORTING PROBLEMS ------------------ -Dirty compiles and failures in the validation suite or test vectors should be reported at the Crypto++ User Group. The User Group is located at http://groups.google.com/forum/#!forum/cryptopp-users. +Build failures, dirty compiles and failures in the validation suite or test vectors should be reported at the Crypto++ User Group. The User Group is located at http://groups.google.com/forum/#!forum/cryptopp-users. The library uses Wei Dai's GitHub to track issues. The tracker is located at http://github.com/weidai11/cryptopp/issues. Please do not ask questions in the bug tracker; ask questions on the mailing list instead. Also see http://www.cryptopp.com/wiki/Bug_Report. diff --git a/vendor/cryptopp/vendor_cryptopp/License.txt b/vendor/cryptopp/vendor_cryptopp/License.txt index d48cdbb4..e2a30d9a 100644 --- a/vendor/cryptopp/vendor_cryptopp/License.txt +++ b/vendor/cryptopp/vendor_cryptopp/License.txt @@ -29,8 +29,9 @@ Daniel J. Bernstein, Jack Lloyd - chacha.cpp, chacha_simd.cpp, chacha_avx.cpp Andrew Moon - ed25519, x25519, donna_32.cpp, donna_64.cpp, donna_sse.cpp The Crypto++ Library uses portions of Andy Polyakov's CRYPTOGAMS for Poly1305 -scalar multiplication and aes_armv4.S. CRYPTOGAMS is dual licensed with a -permissive BSD-style license. The CRYPTOGAMS license is reproduced below. +scalar multiplication, aes_armv4.S, sha1_armv4.S and sha256_armv4.S. CRYPTOGAMS +is dual licensed with a permissive BSD-style license. The CRYPTOGAMS license is +reproduced below. The Crypto++ Library uses portions of Jack Lloyd's Botan for ChaCha SSE2 and AVX. Botan placed the code in public domain for Crypto++ to use. diff --git a/vendor/cryptopp/vendor_cryptopp/Readme.txt b/vendor/cryptopp/vendor_cryptopp/Readme.txt index 1831facb..57d04fc6 100644 --- a/vendor/cryptopp/vendor_cryptopp/Readme.txt +++ b/vendor/cryptopp/vendor_cryptopp/Readme.txt @@ -1,5 +1,5 @@ Crypto++: free C++ Class Library of Cryptographic Schemes -Version 8.2 - APR/28/2019 +Version 8.5 - March 7, 2021 Crypto++ Library is a free C++ class library of cryptographic schemes. Currently the library contains the following algorithms: @@ -22,7 +22,7 @@ Currently the library contains the following algorithms: Triple-DES (DES-EDE2 and DES-EDE3), TEA, XTEA block cipher modes of operation ECB, CBC, CBC ciphertext stealing (CTS), - CFB, OFB, counter mode (CTR) + CFB, OFB, counter mode (CTR), XTS message authentication codes BLAKE2s, BLAKE2b, CMAC, CBC-MAC, DMAC, GMAC, HMAC, Poly1305, Poly1305 (IETF), SipHash, Two-Track-MAC, @@ -33,7 +33,7 @@ Currently the library contains the following algorithms: SHAKE (128/256), SipHash, SM3, Tiger, RIPEMD (128/160/256/320), WHIRLPOOL - RSA, DSA, Determinsitic DSA, ElGamal, + RSA, DSA, Deterministic DSA, ElGamal, public-key cryptography Nyberg-Rueppel (NR), Rabin-Williams (RW), LUC, LUCELG, EC-based German Digital Signature (ECGDSA), DLIES (variants of DHAES), ESIGN @@ -45,7 +45,7 @@ Currently the library contains the following algorithms: key agreement schemes Menezes-Qu-Vanstone (MQV), Hashed MQV (HMQV), Fully Hashed MQV (FHMQV), LUCDIF, XTR-DH - elliptic curve cryptography ECDSA, Determinsitic ECDSA, ed25519, ECNR, ECIES, + elliptic curve cryptography ECDSA, Deterministic ECDSA, ed25519, ECNR, ECIES, ECDH, ECMQV, x25519 insecure or obsolescent MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL @@ -84,21 +84,21 @@ Other features include: + ARM-32, Aarch32 and Aarch64 provides NEON, ASIMD and ARMv8 implementations + Power8 provides in-core AES using NX Crypto Acceleration -The Crypto++ library was orginally written by Wei Dai. The library is now +The Crypto++ library was originally written by Wei Dai. The library is now maintained by several team members and the community. You are welcome to use it for any purpose without paying anyone, but see License.txt for the fine print. The following compilers are supported for this release. Please visit http://www.cryptopp.com the most up to date build instructions and porting notes. - * Visual Studio 2003 - 2017 - * GCC 3.3 - 9.0 - * Apple Clang 4.3 - 9.3 - * LLVM Clang 2.9 - 7.0 - * C++Builder 2015 + * Visual Studio 2003 - 2019 + * GCC 3.3 - 10.1 + * Apple Clang 4.3 - 12.0 + * LLVM Clang 2.9 - 11.0 + * C++ Builder 2015 * Intel C++ Compiler 9 - 16.0 * Sun Studio 12u1 - 12.6 - * IBM XL C/C++ 10.0 - 13.3 + * IBM XL C/C++ 10.0 - 14.0 *** Important Usage Notes *** @@ -205,23 +205,28 @@ library in your programs to help avoid unwanted redirections. *** Side Channel Attacks *** -Crypto++ attempts to resist side channel attacks using various remediations. We -believe the library is mostly hardened but the remdiations may be incomplete. The -first line of defense uses hardware instructions when possible for block ciphers, -hashes and other primitives. Hardware acceleration remediates many timing attacks. -The library also uses cache-aware algoirthms and access patterns to minimize leakage. +Crypto++ attempts to resist side channel attacks using various remediations. +The remdiations are applied as a best effort but are probably incomplete. They +are incomplete due to cpu speculation bugs like Spectre, Meltdown, Foreshadow. +The attacks target both cpu caches and internal buffers. Intel generally refers +to internal buffer attacks as "Microarchitectural Data Sampling" (MDS). -Some of the public key algorithms have branches and some of the branches depend on -data that can be private or secret. The branching occurs in some field operations -like exponentiation over integers and elliptic curves. The branching has been -minimized but not completely eliminated. +The library uses hardware instructions when possible for block ciphers, hashes +and other operations. The hardware acceleration remediates some timing +attacks. The library also uses cache-aware algoirthms and access patterns +to minimize leakage cache evictions. -Crypto++ does not enagage Specter remediations at this time. The GCC options for -Specter are -mfunction-return=thunk and -mindirect-branch=thunk, and the library -uses them during testing. If you want the Specter workarounds then add the GCC -options to your CXXFLAGS when building the library. +Elliptic curves over binary fields are believed to leak information. The task is a +work in progress. We don't believe binary fields are used in production, so we feel it +is a low risk at the moment. -If you suspect or find an information leak then please report it. +Crypto++ does not enagage Specter remediations at this time. The GCC options +for Specter are -mfunction-return=thunk and -mindirect-branch=thunk, and the +library uses them during testing. If you want the Specter workarounds then add +the GCC options to your CXXFLAGS when building the library. + +To help resist attacks you should disable hyperthreading on cpus. If you +suspect or find an information leak then please report it. *** Documentation and Support *** @@ -243,7 +248,7 @@ The source code and its planned changes are available at the following locations * The Crypto++ GitHub repository allows you to view the latest (unreleased) Crypto++ source code via the Linux kernel's git beginning around June 2015. - Its also serves as an incubator to nuture and grow the library. + Its also serves as an incubator to nurture and grow the library. * The former Crypto++ SourceForge repository allows you to view the Crypto++ source code via Apache's subversion until about July 2015. At that time, SourceForge had infrastructure problems and a cutover to GutHub was performed. @@ -290,6 +295,68 @@ documentation is one of the highest returns on investment. The items in this section comprise the most recent history. Please see History.txt for the record back to Crypto++ 1.0. +8.5.0 - March 7, 2021 + - minor release, no recompile of programs required + - expanded community input and support + * 70 unique contributors as of this release + - port to Apple M1 + +8.4.0 - January 2, 2021 + - minor release, recompile of programs required + - expanded community input and support + * 67 unique contributors as of this release + - fix SIGILL on POWER8 when compiling with GCC 10 + - fix potential out-of-bounds write in FixedSizeAllocatorWithCleanup + - fix compile on AIX POWER7 with IBM XLC 12.01 + - fix compile on Solaris with SunCC 12.6 + - revert changes for constant-time elliptic curve algorithms + - fix makefile clean and distclean recipes + +8.3.0 - December 20, 2020 + - minor release, recompile of programs required + - expanded community input and support + * 66 unique contributors as of this release + - fix use of macro CRYPTOPP_ALIGN_DATA + - fix potential out-of-bounds read in ECDSA + - fix std::bad_alloc when using ByteQueue in pipeline + - fix missing CRYPTOPP_CXX17_EXCEPTIONS with Clang + - fix potential out-of-bounds read in GCM mode + - add configure.sh when preprocessor macros fail + - fix potential out-of-bounds read in SipHash + - fix compile error on POWER9 due to vec_xl_be + - fix K233 curve on POWER8 + - add Cirrus CI testing + - fix broken encryption for some 64-bit ciphers + - fix Android cpu-features.c using C++ compiler + - disable RDRAND and RDSEED for some AMD processors + - fix BLAKE2 hash calculation using Salt and Personalization + - refresh Android and iOS build scripts + - add XTS mode + - fix circular dependency between misc.h and secblock.h + - add Certificate interface + - fix recursion in AES::Encryption without AESNI + - add missing OID for ElGamal encryption + - fix missing override in KeyDerivationFunction-derived classes + - fix RDSEED assemble under MSVC + - fix elliptic curve timing leaks (CVE-2019-14318) + - add link-library variable to Makefiles + - fix SIZE_MAX definition in misc.h + - add GetWord64 and PutWord64 to BufferedTransformation + - use HKDF in AutoSeededX917RNG::Reseed + - fix Asan finding in VMAC on i686 in inline asm + - fix undeclared identifier _mm_roti_epi64 on Gentoo + - fix ECIES and GetSymmetricKeyLength + - fix possible divide by zero in PKCS5_PBKDF2_HMAC + - refine ASN.1 encoders and decoders + - disable BMI2 code paths in Integer class + - fix use of CRYPTOPP_CLANG_VERSION + - add NEON SHA1, SHA256 and SHA512 from Cryptogams + - add ARM SHA1, SHA256 and SHA512 from Cryptogams + - make config.h more autoconf friendly + - handle Clang triplet armv8l-unknown-linux-gnueabihf + - fix reference binding to misaligned address in xed25519 + - clear asserts in TestDataNameValuePairs + 8.2.0 - April 28, 2019 - minor release, no recompile of programs required - expanded community input and support @@ -337,64 +404,6 @@ for the record back to Crypto++ 1.0. - add ARM AES asm implementation from Cryptogams - remove CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS support -7.0.0 - April 8, 2018 - - major release, recompile of programs required - - expanded community input and support - * 48 unique contributors as of this release - - fix incorrect result when using Integer::ModInverse - * may be CVE worthy, but request was not submitted - - fix ARIA/CTR bus error on Sparc64 - - fix incorrect result when using a_exp_b_mod_c - - fix undeclared identifier uint32_t on early Visual Studio - - fix iPhoneSimulator build on i386 - - fix incorrect adler32 in ZlibDecompressor - - fix Power7 test using PPC_FEATURE_ARCH_2_06 - - workaround incorrect Glibc sysconf return value on ppc64-le - - add KeyDerivationFunction interface - - add scrypt key derivation function - - add Salsa20_Core transform callable from outside class - - add sbyte, sword16, sword32 and sword64 - - remove s_nullNameValuePairs from unnamed namespace - - ported to MSVC 2017, Xcode 9.3, Sun Studio 12.5, GCC 8.0.1, - MacPorts GCC 7.0, Clang 4.0, Intel C++ 17.00, IBM XL C/C++ 13.1 - -6.1.0 - February 22, 2018 - - minor release, maintenance items - - expanded community input and support - * 46 unique contributors as of this release - - use 2048-bit modulus default for DSA - - fix build under Linuxbrew - - use /bin/sh in GNUmakefile - - fix missing flags for SIMON and SPECK in GNUMakefile-cross - - fix ARM and MinGW misdetection - - port setenv-android.sh to latest NDK - - fix Clang check for C++11 lambdas - - Simon and Speck to little-endian implementation - - use LIB_MAJOR for ABI compatibility - - fix ODR violation in AdvancedProcessBlocks_{ARCH} templates - - handle C++17 std::uncaught_exceptions - - ported to MSVC 2017, Xcode 8.1, Sun Studio 12.5, GCC 8.0.1, - MacPorts GCC 7.0, Clang 4.0, Intel C++ 17.00, IBM XL C/C++ 13.1 - -6.0.0 - January 22, 2018 - - major release, recompile of programs required - - expanded community input and support - * 43 unique contributors as of this release - - fixed CVE-2016-9939 (Issue 346, transient DoS) - - fixed CVE-2017-9434 (Issue 414, misidentified memory error) - - converted to BASE+SIMD implementation - * BASE provides an architecture neutral C++ implementation - * SIMD provides architecture specific hardware acceleration - - improved PowerPC Power4, Power7 and Power8 support - - added ARIA, EC German DSA, Deterministic signatures (RFC 6979), - Kalyna, NIST Hash and HMAC DRBG, Padlock RNG, Poly1305, SipHash, - Simon, Speck, SM3, SM4, Threefish algorithms - - added NaCl interface from the compact library - * x25519 key exhange and ed25519 signing provided through NaCl interface - - improved Testing and QA - - ported to MSVC 2017, Xcode 8.1, Sun Studio 12.5, GCC 7.3, - MacPorts GCC 7.0, Clang 4.0, Intel C++ 17.00, IBM XL C/C++ 13.1 - June 2015 - Changing of the guard. Wei Dai turned the library over to the community. The first community release was Crypto++ 5.6.3. Wei is no longer involved with the daily operations of the project. Wei diff --git a/vendor/cryptopp/vendor_cryptopp/Security.md b/vendor/cryptopp/vendor_cryptopp/Security.md new file mode 100644 index 00000000..5fe1ccde --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/Security.md @@ -0,0 +1,15 @@ +# Security Policy + +## Supported Versions + +We support modern versions of the Crypto++ library. Modern versions include the tip of Master and the latest release. + +We also support versions of the library supplied by distributions such as Debian, Fedora, Red Hat and Ubuntu. We don't leave distros unsupported simply because we have released a new version of the library. And we don't expect a package maintainer to fix our bugs for us. + +## Reporting a Vulnerability + +You can report a security related bug in the [GitHub bug tracker](https://github.com/weidai11/cryptopp) or at the [mailing list](https://groups.google.com/g/cryptopp-users). + +If we receive a report of a security related bug then we will ensure a Github issue is opened and we will make an announcement on the mailing list. If you corresponded by private email then we will open the Github issue and make the announcement. + +All information will be made public. We do not withhold information from users because stake holders need accurate information to access risk and place controls to remediate the risk. diff --git a/vendor/cryptopp/vendor_cryptopp/TestData/ecies_p160.dat b/vendor/cryptopp/vendor_cryptopp/TestData/ecies_p160.dat new file mode 100644 index 00000000..c360337a --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestData/ecies_p160.dat @@ -0,0 +1 @@ +3081C80201003081A406072A8648CE3D0201308198020101302006072A8648CE3D0101021500FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF302C0414FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC04141C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA450429044A96B5688EF573284664698968C38BB913CBFC8223A628553168947D59DCC912042351377AC5FB3202150100000000000000000001F4C8F927AED3CA752257020101041C301A02010104150023A68821ABB99DBB8429ED2320D61A8EA4C6D81B diff --git a/vendor/cryptopp/vendor_cryptopp/TestData/ecies_t163.dat b/vendor/cryptopp/vendor_cryptopp/TestData/ecies_t163.dat new file mode 100644 index 00000000..30508843 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestData/ecies_t163.dat @@ -0,0 +1 @@ +3081D10201003081AD06072A8648CE3D02013081A1020101302506072A8648CE3D0102301A020200A306092A8648CE3D010203033009020103020106020107302E041507B6882CAAEFA84F9554FF8428BD88E246D2782AE204150713612DCDDCB40AAB946BDA29CA91F73AF958AFD9042B040369979697AB43897789566789567F787A7876A65400435EDB42EFAFB2989D51FEFCE3C80988F41FF883021503FFFFFFFFFFFFFFFFFFFF48AAB689C29CA710279B020102041C301A02010104150003693AB4D83EE8B544548BE7647AEA0EA64E8211 diff --git a/vendor/cryptopp/vendor_cryptopp/TestData/elgc1024.dat b/vendor/cryptopp/vendor_cryptopp/TestData/elgc1024.dat index c2f6a39b..0a663a11 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestData/elgc1024.dat +++ b/vendor/cryptopp/vendor_cryptopp/TestData/elgc1024.dat @@ -1 +1 @@ -308201A40201003082011706072A8648CE3804013082010A028181008B333697371663F8869E3EC80A414E46BBAFE41F6D40E754A01ADA60FE7D12ACD16DE311C4115293114F6B92A54195909276380F04BCD4ED5CD993ED7F516DF7A752B928E5035E0D3A1A979A1CDE8387734338793C02001D59B662D4FC8F2BF0EABB1F553F9F46F57E74BCABCBA4E458812DB601FCD04609D435317181236B9702818045999B4B9B8B31FC434F1F640520A7235DD7F20FB6A073AA500D6D307F3E895668B6F188E208A94988A7B5C952A0CAC8493B1C07825E6A76AE6CC9F6BFA8B6FBD3A95C947281AF069D0D4BCD0E6F41C3B9A19C3C9E01000EACDB316A7E4795F8755D8FAA9FCFA37ABF3A5E55E5D2722C4096DB00FE682304EA1A98B8C091B5CB02010204818302818045999B4B9B8B31FC434F1F640520A7235DD7F20FB6A073AA500D6D307F3E895668B6F188E208A94988A7B5C952A0CAC8493B1C07825E6A76AE6CC9F6BFA8B6FBD3A95C947281AF069D0D4BCD0E6F41C3B9A19C3C9E01000EACDB316A7E4795F8755D8FAA9FCFA37ABF3A5E2958F40032EF29CB145C7481380458812D62F09287 \ No newline at end of file +308201360201003082011606062B0E070201013082010A02818100D18892CC35AD9E532C53810019E525CDE08882E6344D6787C366B171D68948F53D74F7923B148E0A0B4C9B956D695384DE24AC3034000B3C4AD4C8226470BBD88B5B053BCCB01E608B1352D6ED16324745253BDB204308E065368CB9D75ACDB290E671BD4CA1608500BFACD758E6E9EFAC8CCBAD83BE7E397A62E4F55634FC3B02818068C449661AD6CF299629C0800CF292E6F04441731A26B3C3E1B358B8EB44A47A9EBA7BC91D8A470505A64DCAB6B4A9C26F1256181A00059E256A641132385DEC45AD829DE6580F304589A96B768B1923A2929DED90218470329B465CEBAD66D9487338DEA650B042805FD66BAC7374F7D64665D6C1DF3F1CBD31727AAB1A7E1D0201030417021504ED7AED68B1A5EFDE11262210D9F1121D4A119CE8 \ No newline at end of file diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/dump2def.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/dump2def.cxx new file mode 100644 index 00000000..3e41f6e6 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/dump2def.cxx @@ -0,0 +1,214 @@ +// dump2def.cxx - Written and placed in public domain by Jeffrey Walton +// Create a module definitions file from a dumpbin file. +// dump2def can be used to create a list of exports from +// a static library. Then, the exports can used to build +// a dynamic link library with the same exports. +// +// If you wish to compile this source file using cl.exe, then: +// cl.exe /DNDEBUG /Oi /Oy /O2 /Zi /TP /GR /EHsc /MT dump2def.cxx +// +// The intended workflow in Crypto++ is: +// +// 1. Open a Developer Prompt +// 2. CD to cryptopp/ directory +// 3. nmake /f cryptest.nmake cryptopp.dll +// +// The cryptopp.dll recipe first builds cryptlib.lib. Then it calls +// dumpbin.exe to export all symbols from cryptlib.lib and writes them +// to cryptopp.dump. The recipe then calls dump2def.exe to create a +// module definition file. Finally, the recipe builds cryptopp.dll +// using the module definition file cryptopp.def. The linker creates +// the import lib cryptopp.lib and export cryptopp.exp automatically. +// +// This is only "half the problem solved" for those who wish to use +// a DLL. The program must import the import lib cryptopp.lib. Then +// the program must ensure the library headers export the symbol or +// class with CRYPTOPP_DLL. CRYPTOPP_DLL is only present on some classes +// because the FIPS module only allowed approved algorithms like AES and +// SHA. Other classes like Base64Encoder and HexEncoder lack CRYPTOPP_DLL. +// +// CRYPTOPP_DLL simply adds declspec(dllimport) when CRYPTOPP_IMPORTS is +// defined. The limitation of requiring declspec(dllimport) is imposed by +// Microsoft. Microsoft does not allow a program to "import everything". +// +// If you would like to read more about the FIPS module and the pain it +// causes then see https://www.cryptopp.com/wiki/FIPS_DLL. In fact we +// recommend you delete the CryptDll and DllTest projects from the +// Visual Studio solution file. + +#include +#include +#include +#include +#include +#include + +// Friendly name +#define LIBRARY_DESC "Crypto++ Library" +typedef std::set SymbolMap; + +const int ErrorSuccess = 0; +const int ErrorDumpExtension = 1; +const int ErrorTooFewOpts = 2; +const int ErrorTooManyOpts = 3; +const int ErrorOpenInputFailed = 4; +const int ErrorOpenOutputFailed = 5; +const int ErrorReadException = 6; +const int ErrorWriteException = 7; + +void PrintHelpAndExit(int code) +{ + std::cout << "dump2def - create a module definitions file from a dumpbin file" << std::endl; + std::cout << " Written and placed in public domain by Jeffrey Walton" << std::endl; + std::cout << std::endl; + + switch (code) + { + case ErrorDumpExtension: + std::cout << "Error: input file is missing \".dump\" extension.\n" << std::endl; + break; + case ErrorTooFewOpts: + std::cout << "Error: Too few options were supplied.\n" << std::endl; + break; + case ErrorTooManyOpts: + std::cout << "Error: Too many options were supplied.\n" << std::endl; + break; + case ErrorOpenInputFailed: + std::cout << "Error: Failed to open input file.\n" << std::endl; + break; + case ErrorOpenOutputFailed: + std::cout << "Error: Failed to open output file.\n" << std::endl; + break; + default: + ;; + } + + std::cout << "Usage: " << std::endl; + + std::cout << " dump2def " << std::endl; + std::cout << " - Create a def file from and write it to a file with" << std::endl; + std::cout << " the same name as but using the .def extension" << std::endl; + + std::cout << " dump2def " << std::endl; + std::cout << " - Create a def file from and write it to " << std::endl; + + std::exit((code == ErrorSuccess ? 0 : 1)); +} + +int main(int argc, char* argv[]) +{ + // ******************** Handle Options ******************** // + + // Convenience item + std::vector opts; + for (size_t i=0; i 1 ? opts[1].substr(0,2) : ""); + if (opt == "/h" || opt == "-h" || opt == "/?" || opt == "-?") + PrintHelpAndExit(ErrorSuccess); + + // Add as needed + if (opts.size() == 2) + { + std::string outfile = opts[1]; + std::string::size_type pos = outfile.length() < 5 ? std::string::npos : outfile.length() - 5; + if (pos == std::string::npos || outfile.substr(pos) != ".dump") + PrintHelpAndExit(ErrorDumpExtension); + + outfile.replace(pos, 5, ".def"); + opts.push_back(outfile); + } + + // Check or exit + if (opts.size() < 2) + PrintHelpAndExit(ErrorTooFewOpts); + if (opts.size() > 3) + PrintHelpAndExit(ErrorTooManyOpts); + + // ******************** Read MAP file ******************** // + + SymbolMap symbols; + + try + { + std::ifstream infile(opts[1].c_str()); + + if (infile.is_open() == false) + PrintHelpAndExit(ErrorOpenInputFailed); + + std::string::size_type pos; + std::string line; + + // Find start of the symbol table + while (std::getline(infile, line)) + { + pos = line.find("public symbols"); + if (pos == std::string::npos) { continue; } + + // Eat the whitespace after the table heading + infile >> std::ws; + break; + } + + while (std::getline(infile, line)) + { + // End of table + if (line.empty()) { break; } + + std::istringstream iss(line); + std::string address, symbol; + iss >> address >> symbol; + + symbols.insert(symbol); + } + } + catch (const std::exception& ex) + { + std::cerr << "Unexpected exception:" << std::endl; + std::cerr << ex.what() << std::endl; + std::cerr << std::endl; + + PrintHelpAndExit(ErrorReadException); + } + + // ******************** Write DEF file ******************** // + + try + { + std::ofstream outfile(opts[2].c_str()); + + if (outfile.is_open() == false) + PrintHelpAndExit(ErrorOpenOutputFailed); + + // Library name, cryptopp.dll + std::string name = opts[2]; + std::string::size_type pos = name.find_last_of("."); + + if (pos != std::string::npos) + name.erase(pos); + + outfile << "LIBRARY " << name << std::endl; + outfile << "DESCRIPTION \"" << LIBRARY_DESC << "\"" << std::endl; + outfile << "EXPORTS" << std::endl; + outfile << std::endl; + + outfile << "\t;; " << symbols.size() << " symbols" << std::endl; + + // Symbols from our object files + SymbolMap::const_iterator it = symbols.begin(); + for ( ; it != symbols.end(); ++it) + outfile << "\t" << *it << std::endl; + } + catch (const std::exception& ex) + { + std::cerr << "Unexpected exception:" << std::endl; + std::cerr << ex.what() << std::endl; + std::cerr << std::endl; + + PrintHelpAndExit(ErrorWriteException); + } + + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_32bit.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_32bit.cxx index a8783394..410bba62 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_32bit.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_32bit.cxx @@ -1,7 +1,7 @@ #include int main(int argc, char* argv[]) { - enum {N = (sizeof(std::size_t) == 4 ? 4 : -1)}; - int x[N]; - return 0; + enum {N = (sizeof(std::size_t) == 4 ? 4 : -1)}; + int x[N]; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_64bit.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_64bit.cxx index e55e2fd1..eb7eb2a0 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_64bit.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_64bit.cxx @@ -1,7 +1,7 @@ #include int main(int argc, char* argv[]) { - enum {N = (sizeof(std::size_t) == 8 ? 8 : -1)}; - int x[N]; - return 0; + enum {N = (sizeof(std::size_t) == 8 ? 8 : -1)}; + int x[N]; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_acle.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_acle_header.cxx similarity index 73% rename from vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_acle.cxx rename to vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_acle_header.cxx index 63073be3..21a3342d 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_acle.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_acle_header.cxx @@ -1,5 +1,6 @@ #include + int main(int argc, char* argv[]) { - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_aes.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_aes.cxx index 66cfd0c3..f9795327 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_aes.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_aes.cxx @@ -1,19 +1,17 @@ -#include #include - -// test_acle.h determines if this is available. Then, -// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS -// if the ACLE header is not available. -#if (CRYPTOPP_ARM_ACLE_AVAILABLE) -# include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif +#ifdef CRYPTOPP_ARM_ACLE_HEADER +# include #endif int main(int argc, char* argv[]) { - uint8x16_t x={0}; - x=vaeseq_u8(x,x); - x=vaesmcq_u8(x); - x=vaesdq_u8(x,x); - x=vaesimcq_u8(x); - return 0; + uint8x16_t x={0}; + x=vaeseq_u8(x,x); + x=vaesmcq_u8(x); + x=vaesdq_u8(x,x); + x=vaesimcq_u8(x); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_asimd.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_asimd.cxx index 1d4ff3d1..a83e73b8 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_asimd.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_asimd.cxx @@ -1,16 +1,14 @@ -#include #include - -// test_acle.h determines if this is available. Then, -// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS -// if the ACLE header is not available. -#if (CRYPTOPP_ARM_ACLE_AVAILABLE) -# include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif +#ifdef CRYPTOPP_ARM_ACLE_HEADER +# include #endif int main(int argc, char* argv[]) { - uint32x4_t x={0}; - x=veorq_u32(x,x); - return 0; + uint32x4_t x={0}; + x=veorq_u32(x,x); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_crc.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_crc.cxx index 3f1539fc..aecd50a7 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_crc.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_crc.cxx @@ -1,23 +1,21 @@ -#include #include - -// test_acle.h determines if this is available. Then, -// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS -// if the ACLE header is not available. -#if (CRYPTOPP_ARM_ACLE_AVAILABLE) -# include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif +#ifdef CRYPTOPP_ARM_ACLE_HEADER +# include #endif int main(int argc, char* argv[]) { - uint32_t w=0xffffffff; + uint32_t w=0xffffffff; - w = __crc32w(w,w); - w = __crc32h(w,w); - w = __crc32b(w,w); - w = __crc32cw(w,w); - w = __crc32ch(w,w); - w = __crc32cb(w,w); + w = __crc32w(w,w); + w = __crc32h(w,w); + w = __crc32b(w,w); + w = __crc32cw(w,w); + w = __crc32ch(w,w); + w = __crc32cb(w,w); - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_neon.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_neon.cxx index e123d6c6..edb627af 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_neon.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_neon.cxx @@ -1,9 +1,11 @@ -#include #include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif int main(int argc, char* argv[]) { - uint32x4_t x={0}; - x=veorq_u32(x,x); - return 0; + uint32x4_t x={0}; + x=veorq_u32(x,x); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_neon_header.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_neon_header.cxx new file mode 100644 index 00000000..f9df787f --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_neon_header.cxx @@ -0,0 +1,6 @@ +#include + +int main(int argc, char* argv[]) +{ + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_pmull.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_pmull.cxx index 2d345e39..3ed7fd2d 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_pmull.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_pmull.cxx @@ -1,22 +1,20 @@ -#include #include - -// test_acle.h determines if this is available. Then, -// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS -// if the ACLE header is not available. -#if (CRYPTOPP_ARM_ACLE_AVAILABLE) -# include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif +#ifdef CRYPTOPP_ARM_ACLE_HEADER +# include #endif int main(int argc, char* argv[]) { - const poly64_t a=0x60606060, b=0x90909090, c=0xb0b0b0b0; - const poly64x2_t d={0x60606060,0x90909090}; - const poly8x16_t e={0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0}; + const poly64_t a=0x60606060, b=0x90909090, c=0xb0b0b0b0; + const poly64x2_t d={0x60606060,0x90909090}; + const poly8x16_t e={0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0}; - const poly128_t r1 = vmull_p64(a, b); - const poly128_t r2 = vmull_high_p64(d, d); + const poly128_t r1 = vmull_p64(a, b); + const poly128_t r2 = vmull_high_p64(d, d); - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha.cxx deleted file mode 100644 index be437077..00000000 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha.cxx +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -// test_acle.h determines if this is available. Then, -// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS -// if the ACLE header is not available. -#if (CRYPTOPP_ARM_ACLE_AVAILABLE) -# include -#endif - -int main(int argc, char* argv[]) -{ - uint32x4_t y = {0}; - y=vsha1cq_u32(y,0,y); - y=vsha1mq_u32(y,1,y); - y=vsha1pq_u32(y,2,y); - y=vsha256hq_u32(y, y, y); - y=vsha256h2q_u32(y, y, y); - y=vsha256su1q_u32(y, y, y); - return 0; -} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha1.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha1.cxx new file mode 100644 index 00000000..4a247d4d --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha1.cxx @@ -0,0 +1,16 @@ +#include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif +#ifdef CRYPTOPP_ARM_ACLE_HEADER +# include +#endif + +int main(int argc, char* argv[]) +{ + uint32x4_t y = {0}; + y=vsha1cq_u32(y,0,y); + y=vsha1mq_u32(y,1,y); + y=vsha1pq_u32(y,2,y); + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha256.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha256.cxx new file mode 100644 index 00000000..75bb5694 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha256.cxx @@ -0,0 +1,16 @@ +#include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif +#ifdef CRYPTOPP_ARM_ACLE_HEADER +# include +#endif + +int main(int argc, char* argv[]) +{ + uint32x4_t y = {0}; + y=vsha256hq_u32(y, y, y); + y=vsha256h2q_u32(y, y, y); + y=vsha256su1q_u32(y, y, y); + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha3.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha3.cxx index a71721f9..5f990ba6 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha3.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha3.cxx @@ -1,29 +1,27 @@ -#include #include - -// test_acle.h determines if this is available. Then, -// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS -// if the ACLE header is not available. -#if (CRYPTOPP_ARM_ACLE_AVAILABLE) -# include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif +#ifdef CRYPTOPP_ARM_ACLE_HEADER +# include #endif int main(int argc, char* argv[]) { - // SM4 block cipher - uint32x4_t x; - x=vsm4ekeyq_u32(x,x); - x=vsm4eq_u32(x,x); + // SM4 block cipher + uint32x4_t x; + x=vsm4ekeyq_u32(x,x); + x=vsm4eq_u32(x,x); - // SM3 hash - uint32x4_t y; - y=vsm3ss1q_u32(x,y,y); - y=vsm3tt1aq_u32(x,y,y,3); - y=vsm3tt1bq_u32(x,y,y,1); - y=vsm3tt2aq_u32(x,y,y,2); - y=vsm3tt2bq_u32(x,y,y,3); - y=vsm3partw1q_u32(x,y,y); - y=vsm3partw2q_u32(x,y,y); + // SM3 hash + uint32x4_t y; + y=vsm3ss1q_u32(x,y,y); + y=vsm3tt1aq_u32(x,y,y,3); + y=vsm3tt1bq_u32(x,y,y,1); + y=vsm3tt2aq_u32(x,y,y,2); + y=vsm3tt2bq_u32(x,y,y,3); + y=vsm3partw1q_u32(x,y,y); + y=vsm3partw2q_u32(x,y,y); - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha512.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha512.cxx index a71721f9..5f990ba6 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha512.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sha512.cxx @@ -1,29 +1,27 @@ -#include #include - -// test_acle.h determines if this is available. Then, -// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS -// if the ACLE header is not available. -#if (CRYPTOPP_ARM_ACLE_AVAILABLE) -# include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif +#ifdef CRYPTOPP_ARM_ACLE_HEADER +# include #endif int main(int argc, char* argv[]) { - // SM4 block cipher - uint32x4_t x; - x=vsm4ekeyq_u32(x,x); - x=vsm4eq_u32(x,x); + // SM4 block cipher + uint32x4_t x; + x=vsm4ekeyq_u32(x,x); + x=vsm4eq_u32(x,x); - // SM3 hash - uint32x4_t y; - y=vsm3ss1q_u32(x,y,y); - y=vsm3tt1aq_u32(x,y,y,3); - y=vsm3tt1bq_u32(x,y,y,1); - y=vsm3tt2aq_u32(x,y,y,2); - y=vsm3tt2bq_u32(x,y,y,3); - y=vsm3partw1q_u32(x,y,y); - y=vsm3partw2q_u32(x,y,y); + // SM3 hash + uint32x4_t y; + y=vsm3ss1q_u32(x,y,y); + y=vsm3tt1aq_u32(x,y,y,3); + y=vsm3tt1bq_u32(x,y,y,1); + y=vsm3tt2aq_u32(x,y,y,2); + y=vsm3tt2bq_u32(x,y,y,3); + y=vsm3partw1q_u32(x,y,y); + y=vsm3partw2q_u32(x,y,y); - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sm3.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sm3.cxx index d00d1b46..6d1cfe38 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sm3.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sm3.cxx @@ -1,23 +1,21 @@ -#include #include - -// test_acle.h determines if this is available. Then, -// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS -// if the ACLE header is not available. -#if (CRYPTOPP_ARM_ACLE_AVAILABLE) -# include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif +#ifdef CRYPTOPP_ARM_ACLE_HEADER +# include #endif int main(int argc, char* argv[]) { - // SM3 hash - uint32x4_t y; - y=vsm3ss1q_u32(x,y,y); - y=vsm3tt1aq_u32(x,y,y,3); - y=vsm3tt1bq_u32(x,y,y,1); - y=vsm3tt2aq_u32(x,y,y,2); - y=vsm3tt2bq_u32(x,y,y,3); - y=vsm3partw1q_u32(x,y,y); - y=vsm3partw2q_u32(x,y,y); - return 0; + // SM3 hash + uint32x4_t y; + y=vsm3ss1q_u32(x,y,y); + y=vsm3tt1aq_u32(x,y,y,3); + y=vsm3tt1bq_u32(x,y,y,1); + y=vsm3tt2aq_u32(x,y,y,2); + y=vsm3tt2bq_u32(x,y,y,3); + y=vsm3partw1q_u32(x,y,y); + y=vsm3partw2q_u32(x,y,y); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sm4.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sm4.cxx index 3dbfd902..3a618512 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sm4.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_arm_sm4.cxx @@ -1,18 +1,16 @@ -#include #include - -// test_acle.h determines if this is available. Then, -// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS -// if the ACLE header is not available. -#if (CRYPTOPP_ARM_ACLE_AVAILABLE) -# include +#ifdef CRYPTOPP_ARM_NEON_HEADER +# include +#endif +#ifdef CRYPTOPP_ARM_ACLE_HEADER +# include #endif int main(int argc, char* argv[]) { - // SM4 block cipher - uint32x4_t x; - x=vsm4ekeyq_u32(x,x); - x=vsm4eq_u32(x,x); - return 0; + // SM4 block cipher + uint32x4_t x; + x=vsm4ekeyq_u32(x,x); + x=vsm4eq_u32(x,x); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_asm_mixed.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_asm_mixed.cxx new file mode 100644 index 00000000..03ed5795 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_asm_mixed.cxx @@ -0,0 +1,31 @@ +// Most Clang cannot handle mixed asm with positional arguments, where the +// body is Intel style with no prefix and the templates are AT&T style. +// Also see https://bugs.llvm.org/show_bug.cgi?id=39895 . +#include +int main(int argc, char* argv[]) +{ + size_t ret = 1, N = 1; + asm __volatile__ + ( +#if defined(__amd64__) || defined(__x86_64__) + ".intel_syntax noprefix ;\n" + "xor rsi, rsi ;\n" + "neg %1 ;\n" + "inc %1 ;\n" + "push %1 ;\n" + "pop rax ;\n" + ".att_syntax prefix ;\n" + : "=a" (ret) : "c" (N) : "%rsi" +#else + ".intel_syntax noprefix ;\n" + "xor esi, esi ;\n" + "neg %1 ;\n" + "inc %1 ;\n" + "push %1 ;\n" + "pop eax ;\n" + ".att_syntax prefix ;\n" + : "=a" (ret) : "c" (N) : "%esi" +#endif + ); + return (int)ret; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx.cxx index 90f24b2d..e8a8af8a 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx.cxx @@ -1,6 +1,6 @@ #include int main(int argc, char* argv[]) { - unsigned int x=0; - return x; + unsigned int x=0; + return x; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11.cxx new file mode 100644 index 00000000..9545a7d9 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11.cxx @@ -0,0 +1,11 @@ +// Real C++11 libraries provide +#include +int main(int argc, char* argv[]) +{ +#if __cplusplus >= 201103L + std::forward_list x; +#else + int x[-1]; +#endif + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_alignas.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_alignas.cxx new file mode 100644 index 00000000..58c5f391 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_alignas.cxx @@ -0,0 +1,5 @@ +int main(int argc, char* argv[]) +{ + alignas(8) unsigned char x[16]; + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_alignof.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_alignof.cxx new file mode 100644 index 00000000..f2d701ce --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_alignof.cxx @@ -0,0 +1,6 @@ +#include +int main (int argc, char* argv[]) +{ + std::size_t n = alignof(int); + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_assert.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_assert.cxx new file mode 100644 index 00000000..7d37315d --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_assert.cxx @@ -0,0 +1,10 @@ +// https://en.cppreference.com/w/cpp/feature_test +int main(int argc, char* argv[]) +{ +#if __cpp_static_assert >= 200410L + int x[1]; +#else + int x[-1]; +#endif + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_atomic.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_atomic.cxx new file mode 100644 index 00000000..93745e1b --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_atomic.cxx @@ -0,0 +1,7 @@ +#include +int main(int argc, char* argv[]) +{ + std::atomic_flag f = ATOMIC_FLAG_INIT; + std::atomic g (false); + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_auto.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_auto.cxx new file mode 100644 index 00000000..190f9aaa --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_auto.cxx @@ -0,0 +1,5 @@ +int main(int argc, char* argv[]) +{ + auto a = 1 + 2; + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_constexpr.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_constexpr.cxx new file mode 100644 index 00000000..0551746c --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_constexpr.cxx @@ -0,0 +1,10 @@ +constexpr int fact(int n) +{ + return n <= 1 ? 1 : (n * fact(n - 1)); +} + +int main(int argc, char* argv[]) +{ + fact(4); + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_deletefn.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_deletefn.cxx new file mode 100644 index 00000000..94e56744 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_deletefn.cxx @@ -0,0 +1,10 @@ +struct S { + S() = delete; + explicit S(int n) { } +}; + +int main (int argc, char* rgv[]) +{ + S s(1); + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_enumtype.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_enumtype.cxx new file mode 100644 index 00000000..5e066e42 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_enumtype.cxx @@ -0,0 +1,7 @@ +#include +int main(int argc, char* argv[]) +{ + enum Size : std::size_t { Zero=0, One=1, Two=2 }; + Size s(Size::Zero); + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_initializer.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_initializer.cxx new file mode 100644 index 00000000..050dc939 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_initializer.cxx @@ -0,0 +1,6 @@ +#include +int main(int argc, char* argv[]) +{ + std::vector v{0,1,2,3,4}; + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_lambda.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_lambda.cxx new file mode 100644 index 00000000..d85b7af9 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_lambda.cxx @@ -0,0 +1,10 @@ +// https://en.cppreference.com/w/cpp/feature_test +int main(int argc, char* argv[]) +{ +#if __cpp_lambdas >= 200907L + int x[1]; +#else + int x[-1]; +#endif + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_noexcept.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_noexcept.cxx new file mode 100644 index 00000000..3afcc0fd --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_noexcept.cxx @@ -0,0 +1,29 @@ +#if defined(__GNUC__) +# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10) +#endif + +#if defined(__clang__) && defined(__apple_build_version__) +# undef GNUC_VERSION +# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10) +#elif defined(__clang__) +# undef GNUC_VERSION +# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10) +#endif + +#if (GNUC_VERSION >= 7030) +# pragma GCC diagnostic ignored "-Wterminate" +#endif + +#include + +void f(int n) noexcept(false) +{ + if (n > 2) + throw std::runtime_error("Oops"); +} + +int main(int argc, char* argv[]) +{ + f(argc); + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_nullptr.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_nullptr.cxx new file mode 100644 index 00000000..9dc0c977 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_nullptr.cxx @@ -0,0 +1,6 @@ +#include +int main(int argc, char* argv[]) +{ + int* p = nullptr; + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_staticinit.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_staticinit.cxx new file mode 100644 index 00000000..610c19d1 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_staticinit.cxx @@ -0,0 +1,11 @@ +// https://en.cppreference.com/w/cpp/feature_test +// Apple bug https://bugs.llvm.org/show_bug.cgi?id=47012. +int main(int argc, char* argv[]) +{ +#if __cpp_threadsafe_static_init >= 200806L + int x[1]; +#else + int x[-1]; +#endif + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_sync.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_sync.cxx new file mode 100644 index 00000000..92c7b514 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_sync.cxx @@ -0,0 +1,7 @@ +#include +int main(int argc, char* argv[]) +{ + std::mutex m; + std::lock_guard l(m); + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_vartemplates.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_vartemplates.cxx new file mode 100644 index 00000000..2590c0d9 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx11_vartemplates.cxx @@ -0,0 +1,9 @@ +int main(int argc, char* argv[]) +{ +#if __cpp_variadic_templates >= 200704L + int x[1]; +#else + int x[-1]; +#endif + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx14.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx14.cxx new file mode 100644 index 00000000..ede3bf74 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx14.cxx @@ -0,0 +1,9 @@ +int main(int argc, char* argv[]) +{ +#if __cplusplus >= 201402L + int x[1]; +#else + int x[-1]; +#endif + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17.cxx new file mode 100644 index 00000000..c3d43aa2 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17.cxx @@ -0,0 +1,9 @@ +int main(int argc, char* argv[]) +{ +#if __cplusplus >= 201703L + int x[1]; +#else + int x[-1]; +#endif + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17_assert.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17_assert.cxx new file mode 100644 index 00000000..a365789a --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17_assert.cxx @@ -0,0 +1,10 @@ +// https://en.cppreference.com/w/cpp/feature_test +int main(int argc, char* argv[]) +{ +#if __cpp_static_assert >= 201411L + int x[1]; +#else + int x[-1]; +#endif + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17_exceptions.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17_exceptions.cxx new file mode 100644 index 00000000..b2401a38 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx17_exceptions.cxx @@ -0,0 +1,11 @@ +// https://en.cppreference.com/w/cpp/feature_test +#include +int main(int argc, char* argv[]) +{ +#if __cpp_lib_uncaught_exceptions >= 201411L + int x = std::uncaught_exceptions(); +#else + int x[-1]; +#endif + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx98_exception.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx98_exception.cxx new file mode 100644 index 00000000..4af903d4 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_cxx98_exception.cxx @@ -0,0 +1,12 @@ +#include +struct S { + S() {} + virtual ~S() { + bool b = std::uncaught_exception(); + } +}; +int main(int argc, char* argv[]) +{ + S s; + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_glibc.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_glibc.cxx new file mode 100644 index 00000000..702ef8be --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_glibc.cxx @@ -0,0 +1,8 @@ +#include +int main(int argc, char* argv[]) +{ +#ifndef __GLIBCXX__ + int x[-1]; +#endif + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_mixed_asm.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_mixed_asm.cxx deleted file mode 100644 index ada17e61..00000000 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_mixed_asm.cxx +++ /dev/null @@ -1,31 +0,0 @@ -// Most Clang cannot handle mixed asm with positional arguments, where the -// body is Intel style with no prefix and the templates are AT&T style. -// Also see https://bugs.llvm.org/show_bug.cgi?id=39895 . -#include -int main(int argc, char* argv[]) -{ - size_t ret = 1, N = 1; - asm __volatile__ - ( -#if defined(__amd64__) || defined(__x86_64__) - ".intel_syntax noprefix ;\n" - "xor rsi, rsi ;\n" - "neg %1 ;\n" - "inc %1 ;\n" - "push %1 ;\n" - "pop rax ;\n" - ".att_syntax prefix ;\n" - : "=a" (ret) : "c" (N) : "%rsi" -#else - ".intel_syntax noprefix ;\n" - "xor esi, esi ;\n" - "neg %1 ;\n" - "inc %1 ;\n" - "push %1 ;\n" - "pop eax ;\n" - ".att_syntax prefix ;\n" - : "=a" (ret) : "c" (N) : "%esi" -#endif - ); - return (int)ret; -} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_newlib.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_newlib.cxx index 08d23408..d5e91c8b 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_newlib.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_newlib.cxx @@ -2,7 +2,7 @@ int main(int argc, char* argv[]) { #ifndef __NEWLIB__ - XXX + int x[-1]; #endif - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_aes.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_aes.cxx index cb999fb8..92c4bb0d 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_aes.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_aes.cxx @@ -2,25 +2,25 @@ int main(int argc, char* argv[]) { #if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__)) - __vector unsigned char x = {1,2,3,4,5,6,7,8}; - x=__vcipher(x,x); - x=__vcipherlast(x,x); - x=__vncipher(x,x); - x=__vncipherlast(x,x); + __vector unsigned char x = {1,2,3,4,5,6,7,8}; + x=__vcipher(x,x); + x=__vcipherlast(x,x); + x=__vncipher(x,x); + x=__vncipherlast(x,x); #elif defined(__clang__) - __vector unsigned long long x = {1,2}; - x=__builtin_altivec_crypto_vcipher(x,x); - x=__builtin_altivec_crypto_vcipherlast(x,x); - x=__builtin_altivec_crypto_vncipher(x,x); - x=__builtin_altivec_crypto_vncipherlast(x,x); + __vector unsigned long long x = {1,2}; + x=__builtin_altivec_crypto_vcipher(x,x); + x=__builtin_altivec_crypto_vcipherlast(x,x); + x=__builtin_altivec_crypto_vncipher(x,x); + x=__builtin_altivec_crypto_vncipherlast(x,x); #elif defined(__GNUC__) - __vector unsigned long long x = {1,2}; - x=__builtin_crypto_vcipher(x,x); - x=__builtin_crypto_vcipherlast(x,x); - x=__builtin_crypto_vncipher(x,x); - x=__builtin_crypto_vncipherlast(x,x); + __vector unsigned long long x = {1,2}; + x=__builtin_crypto_vcipher(x,x); + x=__builtin_crypto_vcipherlast(x,x); + x=__builtin_crypto_vncipher(x,x); + x=__builtin_crypto_vncipherlast(x,x); #else - int XXX[-1]; + int XXX[-1]; #endif - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_altivec.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_altivec.cxx index 64784256..b28a39dd 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_altivec.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_altivec.cxx @@ -1,8 +1,13 @@ +#define GNUC_VERSION (__GNUC__*1000 + __GNUC_MAJOR__*10) +#if (GNUC_VERSION >= 4060) || defined(__clang__) +# pragma GCC diagnostic ignored "-Wdeprecated" +#endif + #include int main(int argc, char* argv[]) { - __vector unsigned char x; - x=vec_ld(0, (unsigned char*)argv[0]); - x=vec_add(x,x); - return 0; + __vector unsigned char x; + x=vec_ld(0, (unsigned char*)argv[0]); + x=vec_add(x,x); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power7.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power7.cxx index 103034ea..24ecf4bd 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power7.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power7.cxx @@ -1,41 +1,44 @@ +#if defined(__GNUC__) +# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10) +#endif + +#if defined(__clang__) && defined(__apple_build_version__) +# undef GNUC_VERSION +# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10) +#elif defined(__clang__) +# undef GNUC_VERSION +# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10) +#endif + +#if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000) +# pragma GCC diagnostic ignored "-Wdeprecated" +#endif + +// XL C++ on AIX does not define VSX and does not +// provide an option to set it. We have to set it +// for the code below. This define must stay in +// sync with the define in test_ppc_power7.cxx. +#if defined(_AIX) && defined(_ARCH_PWR7) && defined(__xlC__) +# define __VSX__ 1 +#endif + #include - -// This follows ppc_simd.h. XLC compilers for POWER7 use vec_xlw4 and -// vec_xstw4. Some XLC compilers for POWER7 and above use vec_xl and -// vec_xst. The way to tell the difference is, XLC compilers version -// 13.0 and earlier use use vec_xlw4 and vec_xstw4 XLC compilers 13.1 -// and later are use vec_xl and vec_xst. The open question is, how to -// handle early Clang compilers for POWER7. We know the latest Clang -// compilers support vec_xl and vec_xst. Also see -// https://www-01.ibm.com/support/docview.wss?uid=swg21683541 - -#if defined(__xlc__) && (__xlc__ < 0x0d01) -# define __early_xlc__ 1 -#endif - -#if defined(__xlC__) && (__xlC__ < 0x0d01) -# define __early_xlC__ 1 -#endif - int main(int argc, char* argv[]) { - __vector unsigned char x; - unsigned char res[16]; +#if defined(_ARCH_PWR7) && defined(__VSX__) + // PWR7 + __vector unsigned int a = {1,2,3,4}; + __vector unsigned int b = vec_ld(0, (unsigned int*)argv[0]); + __vector unsigned int c = vec_xor(a, b); -#if defined(_ARCH_PWR7) && (defined(__early_xlc__) || defined(__early_xlC__)) - x=vec_xlw4(0, (unsigned char*)argv[0]); - x=vec_add(x,x); - vec_xstw4(x, 0, res); -#elif defined(_ARCH_PWR7) && (defined(__xlc__) || defined(__xlC__) || defined(__clang__)) - x=vec_xl(0, (unsigned char*)argv[0]); - x=vec_add(x,x); - vec_xst(x, 0, res); -#elif defined(_ARCH_PWR7) && defined(__GNUC__) - x=vec_vsx_ld(0, (unsigned char*)argv[0]); - x=vec_add(x,x); - vec_vsx_st(x, 0, res); + // VSX + __vector unsigned int x = {5,6,7,8}; + __vector unsigned int y = vec_xl(0, (unsigned int*)argv[0]); + __vector unsigned int z = vec_xor(x, y); + __vector unsigned long long xx = {1,2}; + __vector unsigned long long yy = (__vector unsigned long long)y; #else - int XXX[-1]; + int x[-1]; #endif - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power8.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power8.cxx index 808cb907..7fec83bb 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power8.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power8.cxx @@ -1,7 +1,46 @@ +#if defined(__GNUC__) +# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10) +#endif + +#if defined(__clang__) && defined(__apple_build_version__) +# undef GNUC_VERSION +# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10) +#elif defined(__clang__) +# undef GNUC_VERSION +# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10) +#endif + +#if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000) +# pragma GCC diagnostic ignored "-Wdeprecated" +#endif + +// XL C++ on AIX does not define CRYPTO and does not +// provide an option to set it. We have to set it +// for the code below. This define must stay in +// sync with the define in test_ppc_power8.cxx +#if defined(_AIX) && defined(_ARCH_PWR8) && defined(__xlC__) +# define __CRYPTO__ 1 +#endif + #include int main(int argc, char* argv[]) { - __vector unsigned long long z = {1, 2}; - z=vec_add(z,z); - return 0; +#if defined(_ARCH_PWR8) + __vector unsigned long long r = {1, 2}; + __vector unsigned int s = vec_xl(0, (unsigned int*)argv[0]); // Power7 + __vector unsigned long long w = (__vector unsigned long long)r; + __vector unsigned long long x = (__vector unsigned long long)s; + __vector unsigned long long y = vec_xor(w, x); + __vector unsigned long long z = vec_add(y, vec_add(w, x)); +# if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__)) + __vector unsigned long long u = __vpmsumd (y, z); +# elif defined(__clang__) + __vector unsigned long long u = __builtin_altivec_crypto_vpmsumd (y, z); +# else + __vector unsigned long long u = __builtin_crypto_vpmsumd (y, z); +# endif +#else + int x[-1]; +#endif + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power9.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power9.cxx index 38e87398..3586073b 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power9.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_power9.cxx @@ -1,36 +1,33 @@ -// The problem we have here is, it appears only GCC 7.0 and above -// support Power9 builtins. Clang 7.0 has support for some (all?) -// assembly instructions but we don't see builtin support. We can't -// determine the state of XLC. Searching IBM's website for -// terms like 'darn' 'random number' is returning irrelevant hits. -// Searching with Google from the outside returns 0 hits. -// -// The support disconnect means we may report Power9 as unavailable -// and support DARN at the same time. We get into that state because -// we use inline asm to detect DARN availablity in the compiler. -// Also see cpu.cpp and the two query functions; and ppc_power9.cpp -// and the two probe functions. +#if defined(__GNUC__) +# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10) +#endif + +#if defined(__clang__) && defined(__apple_build_version__) +# undef GNUC_VERSION +# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10) +#elif defined(__clang__) +# undef GNUC_VERSION +# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10) +#endif + +#if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000) +# pragma GCC diagnostic ignored "-Wdeprecated" +#endif #include int main(int argc, char* argv[]) { -#if 0 - const unsigned char b = (unsigned char)argc; - const unsigned int r = (0xf << 24) | (0x3 << 16) | (0xf << 8) | (0x3 << 0); -#if defined(__clang__) - bool x = __builtin_altivec_byte_in_range(b, r); -#elif defined(__GNUC__) - bool x = __builtin_byte_in_range(b, r); +#if defined(_ARCH_PWR9) + __vector unsigned int v = vec_xl_be(0, (unsigned int*)argv[0]); #else - int XXX[-1]; -#endif + int XXX[-1]; #endif #if defined(__GNUC__) || defined(__IBM_GCC_ASM) - unsigned int y = __builtin_darn_32(); + unsigned int y = __builtin_darn_32(); #else - int XXX[-1]; + int XXX[-1]; #endif - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_sha.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_sha.cxx index 8fb23336..51567367 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_sha.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_sha.cxx @@ -2,22 +2,22 @@ int main(int argc, char* argv[]) { #if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__)) - __vector unsigned int x = {1,2,3,4}; + __vector unsigned int x = {1,2,3,4}; x=__vshasigmaw(x, 0, 0); - __vector unsigned long long y = {1,2}; + __vector unsigned long long y = {1,2}; y=__vshasigmad(y, 0, 0); #elif defined(__clang__) - __vector unsigned int x = {1,2,3,4}; + __vector unsigned int x = {1,2,3,4}; x=__builtin_altivec_crypto_vshasigmaw(x, 0, 0); - __vector unsigned long long y = {1,2}; + __vector unsigned long long y = {1,2}; y=__builtin_altivec_crypto_vshasigmad(y, 0, 0); #elif defined(__GNUC__) - __vector unsigned int x = {1,2,3,4}; + __vector unsigned int x = {1,2,3,4}; x=__builtin_crypto_vshasigmaw(x, 0, 0); - __vector unsigned long long y = {1,2}; + __vector unsigned long long y = {1,2}; y=__builtin_crypto_vshasigmad(y, 0, 0); #else int XXX[-1]; #endif - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_vmull.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_vmull.cxx index e2ef6dae..733d00dd 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_vmull.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_ppc_vmull.cxx @@ -1,17 +1,17 @@ #include int main(int argc, char* argv[]) { - __vector unsigned long long x = {1,2}; - __vector unsigned long long y = {3,4}; + __vector unsigned long long x = {1,2}; + __vector unsigned long long y = {3,4}; #if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__)) - __vector unsigned long long z=__vpmsumd(x,y); + __vector unsigned long long z=__vpmsumd(x,y); #elif defined(__clang__) - __vector unsigned long long z=__builtin_altivec_crypto_vpmsumd(x,y); + __vector unsigned long long z=__builtin_altivec_crypto_vpmsumd(x,y); #elif defined(__GNUC__) - __vector unsigned long long z=__builtin_crypto_vpmsumd(x,y); + __vector unsigned long long z=__builtin_crypto_vpmsumd(x,y); #else - int XXX[-1]; + int XXX[-1]; #endif - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_pthreads.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_pthreads.cxx index f14b8a0e..c2fa7b93 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_pthreads.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_pthreads.cxx @@ -3,13 +3,13 @@ void* function(void *ptr) { - return 0; + return 0; } int main(int argc, char* argv[]) { - pthread_t thread; - int ret = pthread_create(&thread, NULL, function, (void*)0); - pthread_join(thread, NULL); - return 0; + pthread_t thread; + int ret = pthread_create(&thread, NULL, function, (void*)0); + pthread_join(thread, NULL); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_aes.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_aes.cxx index b4d31f90..25c5e9b3 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_aes.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_aes.cxx @@ -2,10 +2,10 @@ #include int main(int argc, char* argv[]) { - __m128i x = _mm_setzero_si128(); - x=_mm_aesenc_si128(x,x); - x=_mm_aesenclast_si128(x,x); - x=_mm_aesdec_si128(x,x); - x=_mm_aesdeclast_si128(x,x); - return 0; + __m128i x = _mm_setzero_si128(); + x=_mm_aesenc_si128(x,x); + x=_mm_aesenclast_si128(x,x); + x=_mm_aesdec_si128(x,x); + x=_mm_aesdeclast_si128(x,x); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_avx.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_avx.cxx index ec17fb71..ad6d14ca 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_avx.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_avx.cxx @@ -1,7 +1,7 @@ #include int main(int argc, char* argv[]) { - __m256d x = _mm256_setzero_pd(); - x=_mm256_addsub_pd(x,x); - return 0; + __m256d x = _mm256_setzero_pd(); + x=_mm256_addsub_pd(x,x); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_avx2.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_avx2.cxx index 073e9c6f..fde426f6 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_avx2.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_avx2.cxx @@ -1,7 +1,9 @@ #include int main(int argc, char* argv[]) { - __m256i x = _mm256_setzero_si256(); - x=_mm256_add_epi64 (x,x); - return 0; + // _mm256_broadcastsi128_si256 due to Clang + __m128i x = _mm_setzero_si128 (); + __m256i y = _mm256_broadcastsi128_si256 (x); + y = _mm256_add_epi64 (y,y); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_clmul.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_clmul.cxx index 84ee9595..bfbf3bd1 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_clmul.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_clmul.cxx @@ -2,7 +2,7 @@ #include int main(int argc, char* argv[]) { - __m128i x = _mm_setzero_si128(); - x=_mm_clmulepi64_si128(x,x,0x11); - return 0; + __m128i x = _mm_setzero_si128(); + x=_mm_clmulepi64_si128(x,x,0x11); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_cpuid.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_cpuid.cxx index 2fa58f25..841d1f7a 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_cpuid.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_cpuid.cxx @@ -1,7 +1,7 @@ int main(int argc, char* argv[]) { - unsigned int a, b, c, d; - asm volatile ( "cpuid" : "+a"(a), "=b"(b), "+c"(c), "=d"(d) ); + unsigned int a, b, c, d; + asm volatile ( "cpuid" : "+a"(a), "=b"(b), "+c"(c), "=d"(d) ); - return 0; + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_rdrand.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_rdrand.cxx new file mode 100644 index 00000000..dc0b65fe --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_rdrand.cxx @@ -0,0 +1,10 @@ +#include +#if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) +# include +#endif +int main(int argc, char* argv[]) +{ + unsigned int x=0; + (void)_rdrand32_step (&x); + return x == 0 ? 0 : 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_rdseed.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_rdseed.cxx new file mode 100644 index 00000000..172cde95 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_rdseed.cxx @@ -0,0 +1,10 @@ +#include +#if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) +# include +#endif +int main(int argc, char* argv[]) +{ + unsigned int x=0; + (void)_rdseed32_step (&x); + return x == 0 ? 0 : 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sha.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sha.cxx index 8dff4702..80d8b9c7 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sha.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sha.cxx @@ -2,13 +2,13 @@ #include int main(int argc, char* argv[]) { - __m128i x = _mm_setzero_si128(); - x=_mm_sha1msg1_epu32(x,x); - x=_mm_sha1msg2_epu32(x,x); - x=_mm_sha1nexte_epu32(x,x); - x=_mm_sha1rnds4_epu32(x,x,0); - x=_mm_sha256msg1_epu32(x,x); - x=_mm_sha256msg2_epu32(x,x); - x=_mm_sha256rnds2_epu32(x,x,x); - return 0; + __m128i x = _mm_setzero_si128(); + x=_mm_sha1msg1_epu32(x,x); + x=_mm_sha1msg2_epu32(x,x); + x=_mm_sha1nexte_epu32(x,x); + x=_mm_sha1rnds4_epu32(x,x,0); + x=_mm_sha256msg1_epu32(x,x); + x=_mm_sha256msg2_epu32(x,x); + x=_mm_sha256rnds2_epu32(x,x,x); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse2.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse2.cxx index 641ec2fa..9f9de413 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse2.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse2.cxx @@ -1,7 +1,7 @@ #include int main(int argc, char* argv[]) { - __m128i x = _mm_setzero_si128(); - x=_mm_add_epi64(x,x); - return 0; + __m128i x = _mm_setzero_si128(); + x=_mm_add_epi64(x,x); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse3.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse3.cxx index 8dcbfb97..75b3da2c 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse3.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse3.cxx @@ -2,7 +2,7 @@ #include int main(int argc, char* argv[]) { - __m128d x = _mm_setzero_pd(); - x=_mm_addsub_pd(x,x); - return 0; + __m128d x = _mm_setzero_pd(); + x=_mm_addsub_pd(x,x); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse41.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse41.cxx index e3aee077..41230849 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse41.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse41.cxx @@ -2,9 +2,9 @@ #include int main(int argc, char* argv[]) { - __m128i x = _mm_setzero_si128(); - __m128i a = _mm_setzero_si128(); - __m128i b = _mm_setzero_si128(); - x=_mm_blend_epi16(a,b,4); - return 0; + __m128i x = _mm_setzero_si128(); + __m128i a = _mm_setzero_si128(); + __m128i b = _mm_setzero_si128(); + x=_mm_blend_epi16(a,b,4); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse42.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse42.cxx index 9a55010b..94f666ac 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse42.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_sse42.cxx @@ -1,7 +1,7 @@ #include int main(int argc, char* argv[]) { - unsigned int x=32; - x=_mm_crc32_u8(x,4); - return 0; + unsigned int x=32; + x=_mm_crc32_u8(x,4); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_ssse3.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_ssse3.cxx index 43bfc28e..1759b6d8 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_ssse3.cxx +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_ssse3.cxx @@ -2,7 +2,7 @@ #include int main(int argc, char* argv[]) { - __m128i x = _mm_setzero_si128(); - x=_mm_alignr_epi8(x,x,2); - return 0; + __m128i x = _mm_setzero_si128(); + x=_mm_alignr_epi8(x,x,2); + return 0; } diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_aes.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_aes.cxx new file mode 100644 index 00000000..7b14958c --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_aes.cxx @@ -0,0 +1,39 @@ +// TODO: cut-in xcrypt-ecb +#include +int main(int argc, char* argv[]) +{ + unsigned int msr=0; + unsigned int divisor=2; + unsigned int buffer; + + __asm__ __volatile__ + ( +#if defined(__x86_64__) || defined(__amd64__) + "mov %1, %%rdi ;\n" + "movl %2, %%edx ;\n" +#else + "mov %1, %%edi ;\n" + "movl %2, %%edx ;\n" +#endif + + // xstore-rng + ".byte 0x0f, 0xa7, 0xc0 ;\n" + +#if defined(__x86_64__) || defined(__amd64__) + "andq %%rax, 0x1f ;\n" + "movl %%eax, %0 ;\n" +#else + "andl %%eax, 0x1f ;\n" + "movl %%eax, %0 ;\n" +#endif + + : "=g" (msr) : "g" (buffer), "g" (divisor) +#if defined(__x86_64__) || defined(__amd64__) + : "rax", "rdx", "rdi", "cc" +#else + : "eax", "edx", "edi", "cc" +#endif + ); + + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_rng.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_rng.cxx new file mode 100644 index 00000000..1ecd8f53 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_rng.cxx @@ -0,0 +1,38 @@ +#include +int main(int argc, char* argv[]) +{ + unsigned int msr=0; + unsigned int divisor=2; + unsigned int buffer; + + __asm__ __volatile__ + ( +#if defined(__x86_64__) || defined(__amd64__) + "mov %1, %%rdi ;\n" + "movl %2, %%edx ;\n" +#else + "mov %1, %%edi ;\n" + "movl %2, %%edx ;\n" +#endif + + // xstore-rng + ".byte 0x0f, 0xa7, 0xc0 ;\n" + +#if defined(__x86_64__) || defined(__amd64__) + "andq %%rax, 0x1f ;\n" + "movl %%eax, %0 ;\n" +#else + "andl %%eax, 0x1f ;\n" + "movl %%eax, %0 ;\n" +#endif + + : "=g" (msr) : "g" (buffer), "g" (divisor) +#if defined(__x86_64__) || defined(__amd64__) + : "rax", "rdx", "rdi", "cc" +#else + : "eax", "edx", "edi", "cc" +#endif + ); + + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_sha.cxx b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_sha.cxx new file mode 100644 index 00000000..bb8be1cd --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestPrograms/test_x86_via_sha.cxx @@ -0,0 +1,39 @@ +// TODO: cut-in xsha1 +#include +int main(int argc, char* argv[]) +{ + unsigned int msr=0; + unsigned int divisor=2; + unsigned int buffer; + + __asm__ __volatile__ + ( +#if defined(__x86_64__) || defined(__amd64__) + "mov %1, %%rdi ;\n" + "movl %2, %%edx ;\n" +#else + "mov %1, %%edi ;\n" + "movl %2, %%edx ;\n" +#endif + + // xstore-rng + ".byte 0x0f, 0xa7, 0xc0 ;\n" + +#if defined(__x86_64__) || defined(__amd64__) + "andq %%rax, 0x1f ;\n" + "movl %%eax, %0 ;\n" +#else + "andl %%eax, 0x1f ;\n" + "movl %%eax, %0 ;\n" +#endif + + : "=g" (msr) : "g" (buffer), "g" (divisor) +#if defined(__x86_64__) || defined(__amd64__) + : "rax", "rdx", "rdi", "cc" +#else + : "eax", "edx", "edi", "cc" +#endif + ); + + return 0; +} diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/change-version.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/change-version.sh index af2475ed..c0b2580e 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/change-version.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/change-version.sh @@ -1,17 +1,29 @@ #!/usr/bin/env bash -# Use this script to switch back to the previous Crypto++ version before +############################################################################# +# +# This script switches back to the previous Crypto++ version before # building the docs. Before running the script, copy it to the root # directory. After running this script, you can 'make docs' +# +# Written and placed in public domain by Jeffrey Walton. +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +# See https://www.cryptopp.com/wiki/Release_Versioning for more details +# +############################################################################# -sed 's|Library 8.2 API|Library 8.1 API|g' cryptlib.h > cryptlib.h.new +sed 's|Library 8.4 API|Library 8.3 API|g' cryptlib.h > cryptlib.h.new mv cryptlib.h.new cryptlib.h -sed 's|= 8.2|= 8.1|g' Doxyfile > Doxyfile.new +sed 's|= 8.4|= 8.3|g' Doxyfile > Doxyfile.new mv Doxyfile.new Doxyfile -sed 's|CRYPTOPP_MINOR 2|CRYPTOPP_MINOR 1|g' config.h > config.h.new -mv config.h.new config.h +sed 's|CRYPTOPP_MINOR 4|CRYPTOPP_MINOR 3|g' config_ver.h > config_ver.h.new +mv config_ver.h.new config_ver.h -sed 's|CRYPTOPP_VERSION 820|CRYPTOPP_VERSION 810|g' config.h > config.h.new -mv config.h.new config.h +sed 's|CRYPTOPP_VERSION 840|CRYPTOPP_VERSION 830|g' config_ver.h > config_ver.h.new +mv config_ver.h.new config_ver.h diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/configure.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/configure.sh new file mode 100755 index 00000000..62306127 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/configure.sh @@ -0,0 +1,930 @@ +#!/usr/bin/env bash + +# Written and placed in public domain by Jeffrey Walton +# +# This script attempts to update various config_xxx.h files based on the +# current toolchain. It fills a gap where some features are misdetected based +# on compiler version and associated macros, but the feature is (or is not) +# present. For example, modern Android toolchains should be AES-NI and AVX +# capable, but the project removes the feature support. +# +# Use the same compiler and environment to run configure and the makefile. +# +# To use the script, copy the script to the root of the Crypto++ directory. +# Set the environment, and then run the tool: +# +# export CXX="..." +# export CXXFLAGS="..." +# export LDFLAGS="..." +# ./configure.sh +# +# Android and iOS would use the following if you are using setenv-android.sh +# or setenv-ios.sh to set the environment. Otherwise the script expects +# CXX and CXXFLAGS to be set properly for Android or iOS. +# +# export CXXFLAGS="$IOS_CXXFLAGS --sysroot=$IOS_SYSROOT" +# or +# export CXXFLAGS="${ANDROID_CXXFLAGS} --sysroot=${ANDROID_SYSROOT}" +# +# Do not use this script for a multiarch environment unless the cpu features +# are the same for each arch. For example, -arch i386 -arch x86_64 could +# cause problems if x86 only included SSE4.2, while x64 included AVX. +# +# A wiki page is available for this script at +# https://www.cryptopp.com/wiki/Configure.sh +# +# This script was added at Crypto++ 8.3. Also see GH #850. This script will +# work with earlier versions of the library that use config_xxx.h files. +# The monolithic config.h was split into config_xxx.h in May 2019 at +# Crypto++ 8.3. Also see GH #835, PR #836. + + +# shellcheck disable=SC2086 + +# Verify the file exists and is writeable. +if [[ ! -f ./config_asm.h ]]; then + echo "WARNING:" + echo "WARNING: Unable to locate config_asm.h" + echo "WARNING:" +elif [[ ! -w ./config_asm.h ]]; then + echo "WARNING:" + echo "WARNING: Unable to write to config_asm.h" + echo "WARNING:" +fi + +TMPDIR="${TMPDIR:-$HOME/tmp}" +TPROG="${TPROG:-TestPrograms/test_cxx.cxx}" +TOUT="${TOUT:-a.out}" + +CXX="${CXX:-c++}" +LD="${LD:-ld}" +CXXFLAGS="${CXXFLAGS:--DNDEBUG -g2 -O3}" +GREP="${GREP:-grep}" + +if [[ -z "$(command -v ${CXX} 2>/dev/null)" ]]; then + echo "Compiler is not valid. Please install a compiler" + exit 1 +fi + +if [[ -z "$(command -v ${LD} 2>/dev/null)" ]]; then + echo "Linker is not valid. Please install a linker" + exit 1 +fi + +# Solaris fixup +if [[ -d /usr/gnu/bin ]]; then + GREP=/usr/gnu/bin/grep +fi + +# Initialize these once +IS_X86=0 +IS_X64=0 +IS_IA32=0 +IS_ARM32=0 +IS_ARMV8=0 +IS_PPC=0 +IS_PPC64=0 + +# Determine compiler +GCC_COMPILER=$(${CXX} --version 2>/dev/null | ${GREP} -i -c -E '(^g\+\+|GNU)') +SUN_COMPILER=$(${CXX} -V 2>/dev/null | ${GREP} -i -c -E 'CC: (Sun|Oracle) Studio') +XLC_COMPILER=$(${CXX} -qversion 2>/dev/null | ${GREP} -i -c "IBM XL C/C++") +CLANG_COMPILER=$(${CXX} --version 2>/dev/null | ${GREP} -i -c -E 'clang|llvm') + +if [[ "$SUN_COMPILER" -ne 0 ]] +then + # TODO: fix use of uname for SunCC + IS_X86=$(uname -m 2>&1 | ${GREP} -c -E 'i386|i486|i585|i686') + IS_X64=$(uname -m 2>&1 | ${GREP} -c -E 'i86pc|x86_64|amd64') +elif [[ "$XLC_COMPILER" -ne 0 ]] +then + IS_PPC=$(${CXX} ${CXXFLAGS} -qshowmacros -E ${TPROG} | ${GREP} -i -c -E '__PPC__|__POWERPC__') + IS_PPC64=$(${CXX} ${CXXFLAGS} -qshowmacros -E ${TPROG} | ${GREP} -i -c -E '__PPC64__|__POWERPC64__') +elif [[ "$CLANG_COMPILER" -ne 0 ]] +then + IS_X86=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -i -c -E 'i386|i486|i585|i686') + IS_X64=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -i -c -E 'i86pc|x86_64|amd64') + IS_ARM32=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -i -c -E 'arm|armhf|armv7|eabihf|armv8') + IS_ARMV8=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -i -c -E 'aarch32|aarch64|arm64') + IS_PPC=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -i -c -E 'ppc|powerpc') + IS_PPC64=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -c -E 'ppc64|powerpc64') +else + IS_X86=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'i386|i486|i585|i686') + IS_X64=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'x86_64|amd64') + IS_ARM32=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'arm|armhf|armv7|eabihf|armv8') + IS_ARMV8=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'aarch32|aarch64|arm64') + IS_PPC=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'ppc|powerpc') + IS_PPC64=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'ppc64|powerpc64') +fi + +# One check for intel compatibles +if [[ "${IS_X86}" -ne 0 || "${IS_X64}" -ne 0 ]]; then IS_IA32=1; fi + +# A 64-bit platform often matches the 32-bit variant due to appending '64' +if [[ "${IS_X64}" -ne 0 ]]; then IS_X86=0; fi +if [[ "${IS_ARMV8}" -ne 0 ]]; then IS_ARM32=0; fi +if [[ "${IS_PPC64}" -ne 0 ]]; then IS_PPC=0; fi + +# Default values for setenv-*.sh scripts +IS_IOS="${IS_IOS:-0}" +IS_ANDROID="${IS_ANDROID:-0}" +TIMESTAMP=$(date "+%A, %B %d %Y, %I:%M %p") + +# =========================================================================== +# =================================== Info ================================== +# =========================================================================== + +if [[ "${IS_X86}" -ne 0 ]]; then echo "Configuring for x86"; fi +if [[ "${IS_X64}" -ne 0 ]]; then echo "Configuring for x86_64"; fi +if [[ "${IS_ARM32}" -ne 0 ]]; then echo "Configuring for ARM32"; fi +if [[ "${IS_ARMV8}" -ne 0 ]]; then echo "Configuring for Aarch64"; fi +if [[ "${IS_PPC}" -ne 0 ]]; then echo "Configuring for PowerPC"; fi +if [[ "${IS_PPC64}" -ne 0 ]]; then echo "Configuring for PowerPC64"; fi + +echo "Compiler: $(command -v ${CXX})" +echo "Linker: $(command -v ${LD})" + +# =========================================================================== +# =============================== config_asm.h ============================== +# =========================================================================== + +rm -f config_asm.h.new + +# ==================================================== +# =================== common header ================== +# ==================================================== +{ + echo '// config_asm.h rewritten by configure.sh script' + echo '//' "${TIMESTAMP}" + echo '// Also see https://www.cryptopp.com/wiki/configure.sh' + echo '' + echo '#ifndef CRYPTOPP_CONFIG_ASM_H' + echo '#define CRYPTOPP_CONFIG_ASM_H' + echo '' +} >> config_asm.h.new + +############################################################################# +# Pickup CRYPTOPP_DISABLE_ASM + +disable_asm=$($GREP -c '\-DCRYPTOPP_DISABLE_ASM' <<< "${CPPFLAGS} ${CXXFLAGS}") +if [[ "$disable_asm" -ne 0 ]]; +then + + # Shell redirection + { + echo '' + echo '// Set in CPPFLAGS or CXXFLAGS' + echo '#define CRYPTOPP_DISABLE_ASM 1' + } >> config_asm.h.new + +fi + +############################################################################# +# Intel x86-based machines + +if [[ "$disable_asm" -eq 0 && "$IS_IA32" -ne 0 ]]; +then + + if [[ "${SUN_COMPILER}" -ne 0 ]]; then + SSE2_FLAG=-xarch=sse2 + SSE3_FLAG=-xarch=sse3 + SSSE3_FLAG=-xarch=ssse3 + SSE41_FLAG=-xarch=sse4_1 + SSE42_FLAG=-xarch=sse4_2 + CLMUL_FLAG=-xarch=aes + AESNI_FLAG=-xarch=aes + RDRAND_FLAG=-xarch=avx_i + RDSEED_FLAG=-xarch=avx2_i + AVX_FLAG=-xarch=avx + AVX2_FLAG=-xarch=avx2 + SHANI_FLAG=-xarch=sha + else + SSE2_FLAG=-msse2 + SSE3_FLAG=-msse3 + SSSE3_FLAG=-mssse3 + SSE41_FLAG=-msse4.1 + SSE42_FLAG=-msse4.2 + CLMUL_FLAG=-mpclmul + AESNI_FLAG=-maes + RDRAND_FLAG=-mrdrnd + RDSEED_FLAG=-mrdseed + AVX_FLAG=-mavx + AVX2_FLAG=-mavx2 + SHANI_FLAG=-msha + fi + + # Shell redirection + { + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_x86_sse2.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -ne 0 ]]; then + echo '#define CRYPTOPP_DISABLE_ASM 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_asm_sse2.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_X86_ASM_AVAILABLE 1' + if [[ "${IS_X64}" -ne 0 ]]; then + echo '#define CRYPTOPP_X64_ASM_AVAILABLE 1' + echo '#define CRYPTOPP_SSE2_ASM_AVAILABLE 1' + fi + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_x86_sse2.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + have_sse2=1 + echo '#define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE3_FLAG} TestPrograms/test_x86_sse3.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + have_sse3=1 + echo '#define CRYPTOPP_SSE3_AVAILABLE 1' + else + have_sse3=0 + echo '#define CRYPTOPP_DISABLE_SSE3 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSSE3_FLAG} TestPrograms/test_x86_ssse3.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_sse3" -ne 0 ]]; then + have_ssse3=1 + echo '#define CRYPTOPP_SSSE3_ASM_AVAILABLE 1' + echo '#define CRYPTOPP_SSSE3_AVAILABLE 1' + else + have_ssse3=0 + echo '#define CRYPTOPP_DISABLE_SSSE3 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE41_FLAG} TestPrograms/test_x86_sse41.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_ssse3" -ne 0 ]]; then + have_sse41=1 + echo '#define CRYPTOPP_SSE41_AVAILABLE 1' + else + have_sse41=0 + echo '#define CRYPTOPP_DISABLE_SSE4 1' + echo '#define CRYPTOPP_DISABLE_SSE41 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE42_FLAG} TestPrograms/test_x86_sse42.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_sse41" -ne 0 ]]; then + have_sse42=1 + echo '#define CRYPTOPP_SSE42_AVAILABLE 1' + else + have_sse42=0 + echo '#define CRYPTOPP_DISABLE_SSE4 1' + echo '#define CRYPTOPP_DISABLE_SSE42 1' + fi + + ######################################################## + # AES, CLMUL, RDRAND, RDSEED, SHA and AVX tied to SSE4.2 + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${CLMUL_FLAG} TestPrograms/test_x86_clmul.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then + echo '#define CRYPTOPP_CLMUL_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_CLMUL 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${AESNI_FLAG} TestPrograms/test_x86_aes.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then + echo '#define CRYPTOPP_AESNI_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_AESNI 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${RDRAND_FLAG} TestPrograms/test_x86_rdrand.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then + echo '#define CRYPTOPP_RDRAND_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_RDRAND 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${RDSEED_FLAG} TestPrograms/test_x86_rdseed.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then + echo '#define CRYPTOPP_RDSEED_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_RDSEED 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SHANI_FLAG} TestPrograms/test_x86_sha.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then + echo '#define CRYPTOPP_SHANI_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_SHANI 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${AVX_FLAG} TestPrograms/test_x86_avx.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then + have_avx=1 + echo '#define CRYPTOPP_AVX_AVAILABLE 1' + else + have_avx=0 + echo '#define CRYPTOPP_DISABLE_AVX 1' + fi + + ##################### + # AVX2 depends on AVX + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${AVX2_FLAG} TestPrograms/test_x86_avx2.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_avx" -ne 0 ]]; then + have_avx2=1 + echo '#define CRYPTOPP_AVX2_AVAILABLE 1' + else + have_avx2=0 + echo '#define CRYPTOPP_DISABLE_AVX2 1' + fi + + # No flags, requires inline ASM + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_rng.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_PADLOCK_RNG_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_PADLOCK_RNG 1' + fi + + # No flags, requires inline ASM + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_aes.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_PADLOCK_AES_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_PADLOCK_AES 1' + fi + + # No flags, requires inline ASM + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_sha.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_PADLOCK_SHA_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_PADLOCK_SHA 1' + fi + + # Clang workaround + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_asm_mixed.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -ne 0 ]]; then + echo '#define CRYPTOPP_DISABLE_MIXED_ASM 1' + fi + + if [[ "${SUN_COMPILER}" -ne 0 ]]; then + + echo '' + echo '// Fixup for SunCC 12.1-12.4. Bad code generation in AES_Encrypt and friends.' + echo '#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5130)' + echo '# undef CRYPTOPP_AESNI_AVAILABLE' + echo '#endif' + echo '' + echo '// Fixup for SunCC 12.1-12.6. Compiler crash on GCM_Reduce_CLMUL.' + echo '// http://github.com/weidai11/cryptopp/issues/226' + echo '#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5150)' + echo '# undef CRYPTOPP_CLMUL_AVAILABLE' + echo '#endif' + fi + + } >> config_asm.h.new + +fi + +############################################################################# +# ARM 32-bit machines + +if [[ "$disable_asm" -eq 0 && "$IS_ARM32" -ne 0 ]]; +then + + # IS_IOS is set when ./setenv-ios is run + if [[ "$IS_IOS" -ne 0 ]]; then + ARMV7_FLAG="-arch arm" + NEON_FLAG="-arch arm" + elif [[ "$CLANG_COMPILER" -ne 0 ]]; then + ARMV7_FLAG="-march=armv7" + NEON_FLAG="-march=armv7 -mfpu=neon" + else + ARMV7_FLAG="-march=armv7" + NEON_FLAG="-mfpu=neon" + fi + + # Shell redirection + { + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${NEON_FLAG} TestPrograms/test_arm_neon_header.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_NEON_HEADER 1' + HDRFLAGS="-DCRYPTOPP_ARM_NEON_HEADER=1" + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV7_FLAG} TestPrograms/test_cxx.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_ARMV7_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_ARMV7 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${NEON_FLAG} TestPrograms/test_arm_neon.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_NEON_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_NEON 1' + fi + + # Cryptogams is special. Attempt to compile the actual source files + # TestPrograms/test_cxx.cxx is needed for main(). + CXX_RESULT=$(${CXX} ${CXXFLAGS} aes_armv4.S TestPrograms/test_cxx.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOGAMS_ARM_AES 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} sha1_armv4.S TestPrograms/test_cxx.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOGAMS_ARM_SHA1 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} sha256_armv4.S TestPrograms/test_cxx.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOGAMS_ARM_SHA256 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} sha512_armv4.S TestPrograms/test_cxx.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOGAMS_ARM_SHA512 1' + fi + + } >> config_asm.h.new + +fi + +############################################################################# +# ARM 64-bit machines + +if [[ "$disable_asm" -eq 0 && "$IS_ARMV8" -ne 0 ]]; +then + + # IS_IOS is set when ./setenv-ios is run + if [[ "$IS_IOS" -ne 0 ]]; then + ARMV8_FLAG="-arch arm64" + ARMV81_CRC_FLAG="-arch arm64" + ARMV81_CRYPTO_FLAG="-arch arm64" + ARMV84_CRYPTO_FLAG="-arch arm64" + else + ARMV8_FLAG="-march=armv8-a" + ARMV81_CRC_FLAG="-march=armv8-a+crc" + ARMV81_CRYPTO_FLAG="-march=armv8-a+crypto" + ARMV84_CRYPTO_FLAG="-march=armv8.4-a+crypto" + fi + + # Shell redirection + { + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_arm_neon_header.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_NEON_HEADER 1' + HDRFLAGS="-DCRYPTOPP_ARM_NEON_HEADER=1" + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} TestPrograms/test_arm_acle_header.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_ACLE_HEADER 1' + HDRFLAGS="${HDRFLAGS} -DCRYPTOPP_ARM_ACLE_HEADER=1" + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} TestPrograms/test_arm_neon.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_NEON_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_NEON 1' + fi + + # This should be an unneeded test. ASIMD on Aarch64 is NEON on A32 and T32 + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} TestPrograms/test_arm_asimd.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_ASIMD_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_ASIMD 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRC_FLAG} TestPrograms/test_arm_crc.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_CRC32_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_CRC32 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_aes.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_AES_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_AES 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_pmull.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_PMULL_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_PMULL 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_sha1.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_SHA_AVAILABLE 1' + echo '#define CRYPTOPP_ARM_SHA1_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_SHA 1' + echo '#define CRYPTOPP_DISABLE_ARM_SHA1 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_sha256.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_SHA2_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_SHA2 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sha3.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_SHA3_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_SHA3 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sha512.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_SHA512_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_SHA512 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sm3.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_SM3_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_SM3 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sm4.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_ARM_SM4_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_ARM_SM4 1' + fi + + } >> config_asm.h.new + +fi + +############################################################################# +# PowerPC machines + +if [[ "$disable_asm" -eq 0 && ("$IS_PPC" -ne 0 || "$IS_PPC64" -ne 0) ]]; +then + + # IBM XL C/C++ has the -qaltivec flag really screwed up. We can't seem + # to get it enabled without an -qarch= option. And -qarch= produces an + # error on later versions of the compiler. The only thing that seems + # to work consistently is -qarch=auto. + if [[ "${XLC_COMPILER}" -ne 0 ]]; then + POWER9_FLAG="-qarch=pwr9 -qaltivec" + POWER8_FLAG="-qarch=pwr8 -qaltivec" + POWER7_VSX_FLAG="-qarch=pwr7 -qvsx -qaltivec" + POWER7_PWR_FLAG="-qarch=pwr7 -qaltivec" + ALTIVEC_FLAG="-qarch=auto -qaltivec" + else + POWER9_FLAG="-mcpu=power9" + POWER8_FLAG="-mcpu=power8" + POWER7_VSX_FLAG="-mcpu=power7 -mvsx" + POWER7_PWR_FLAG="-mcpu=power7" + ALTIVEC_FLAG="-maltivec" + fi + + # Shell redirection + { + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${ALTIVEC_FLAG} TestPrograms/test_ppc_altivec.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + have_altivec=1 + echo '#define CRYPTOPP_ALTIVEC_AVAILABLE 1' + else + have_altivec=0 + echo '#define CRYPTOPP_DISABLE_ALTIVEC 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER7_PWR_FLAG} TestPrograms/test_ppc_power7.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_altivec" -ne 0 ]]; then + have_power7=1 + echo '#define CRYPTOPP_POWER7_AVAILABLE 1' + else + have_power7=0 + echo '#define CRYPTOPP_DISABLE_POWER7 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_power8.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_power7" -ne 0 ]]; then + have_power8=1 + echo '#define CRYPTOPP_POWER8_AVAILABLE 1' + else + have_power8=0 + echo '#define CRYPTOPP_DISABLE_POWER8 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER9_FLAG} TestPrograms/test_ppc_power9.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_power8" -ne 0 ]]; then + have_power9=1 + echo '#define CRYPTOPP_POWER9_AVAILABLE 1' + else + have_power9=0 + echo '#define CRYPTOPP_DISABLE_POWER9 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_aes.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_power8" -ne 0 ]]; then + echo '#define CRYPTOPP_POWER8_AES_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_POWER8_AES 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_vmull.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_power8" -ne 0 ]]; then + echo '#define CRYPTOPP_POWER8_VMULL_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_POWER8_VMULL 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_sha.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 && "$have_power8" -ne 0 ]]; then + echo '#define CRYPTOPP_POWER8_SHA_AVAILABLE 1' + else + echo '#define CRYPTOPP_DISABLE_POWER8_SHA 1' + fi + + } >> config_asm.h.new + +fi + +# ==================================================== +# =================== common footer ================== +# ==================================================== +{ + echo '' + echo '#endif // CRYPTOPP_CONFIG_ASM_H' + echo '' +} >> config_asm.h.new + +if [[ -e config_asm.h ]]; then + cp config_asm.h config_asm.h.old + mv config_asm.h.new config_asm.h +fi + +echo 'Done writing config_asm.h' + +# =========================================================================== +# =============================== config_cxx.h ============================== +# =========================================================================== + +rm -f config_cxx.h.new + +# ==================================================== +# =================== common header ================== +# ==================================================== +{ + echo '// config_cxx.h rewritten by configure.sh script' + echo '//' "${TIMESTAMP}" + echo '// Also see https://www.cryptopp.com/wiki/configure.sh' + echo '' + echo '#ifndef CRYPTOPP_CONFIG_CXX_H' + echo '#define CRYPTOPP_CONFIG_CXX_H' +} >> config_cxx.h.new + +# Shell redirection +{ + echo '' + echo '// ***************** C++98 and C++03 ********************' + echo '' + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx98_exception.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '// Ancient Crypto++ define, dating back to C++98.' + echo '#define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE 1' + echo '#define CRYPTOPP_CXX98_UNCAUGHT_EXCEPTION 1' + else + echo '// Ancient Crypto++ define, dating back to C++98.' + echo '// #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE 1' + echo '// #define CRYPTOPP_CXX98_UNCAUGHT_EXCEPTION 1' + fi + + echo '' + echo '// ***************** C++11 and above ********************' + echo '' + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11 1' + else + echo '// test_cxx11.cxx returned non-zero result' + echo '// #define CRYPTOPP_CXX11 1' + fi + + echo '' + echo '#if defined(CRYPTOPP_CXX11)' + echo '' + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_atomic.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_ATOMIC 1' + else + echo '// #define CRYPTOPP_CXX11_ATOMIC 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_auto.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_AUTO 1' + else + echo '// #define CRYPTOPP_CXX11_AUTO 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_sync.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_SYNCHRONIZATION 1' + else + echo '// #define CRYPTOPP_CXX11_SYNCHRONIZATION 1' + fi + + # CRYPTOPP_CXX11_DYNAMIC_INIT is old name + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_staticinit.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_STATIC_INIT 1' + echo '#define CRYPTOPP_CXX11_DYNAMIC_INIT 1' + else + echo '// #define CRYPTOPP_CXX11_STATIC_INIT 1' + echo '// #define CRYPTOPP_CXX11_DYNAMIC_INIT 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_deletefn.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_DELETED_FUNCTIONS 1' + else + echo '// #define CRYPTOPP_CXX11_DELETED_FUNCTIONS 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_alignas.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_ALIGNAS 1' + else + echo '// #define CRYPTOPP_CXX11_ALIGNAS 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_alignof.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_ALIGNOF 1' + else + echo '// #define CRYPTOPP_CXX11_ALIGNOF 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_initializer.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_INITIALIZER_LIST 1' + else + echo '// #define CRYPTOPP_CXX11_INITIALIZER_LIST 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_lambda.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_LAMBDA 1' + else + echo '// #define CRYPTOPP_CXX11_LAMBDA 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_noexcept.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_NOEXCEPT 1' + else + echo '// #define CRYPTOPP_CXX11_NOEXCEPT 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_vartemplates.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1' + else + echo '// #define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_constexpr.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_CONSTEXPR 1' + else + echo '// #define CRYPTOPP_CXX11_CONSTEXPR 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_enumtype.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_STRONG_ENUM 1' + else + echo '// #define CRYPTOPP_CXX11_STRONG_ENUM 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_nullptr.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_NULLPTR 1' + else + echo '// #define CRYPTOPP_CXX11_NULLPTR 1' + fi + + # 2-argument static assert + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_assert.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX11_ASSERT 1' + else + echo '// #define CRYPTOPP_CXX11_ASSERT 1' + fi + + echo '' + echo '#endif // CRYPTOPP_CXX11' + + echo '' + echo '// ***************** C++14 and above ********************' + echo '' + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx14.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX14 1' + else + echo '// test_cxx14.cxx returned non-zero result' + echo '// #define CRYPTOPP_CXX14 1' + fi + + echo '' + echo '#if defined(CRYPTOPP_CXX14)' + echo '' + echo '// No dead bodies here. Move on...' + echo '' + echo '#endif // CRYPTOPP_CXX14' + + echo '' + echo '// ***************** C++17 and above ********************' + echo '' + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX17 1' + else + echo '// test_cxx17.cxx returned non-zero result' + echo '// #define CRYPTOPP_CXX17 1' + fi + + echo '' + echo '#if defined(CRYPTOPP_CXX17)' + echo '' + + # 1-argument static assert + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17_assert.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX17_ASSERT 1' + else + echo '// #define CRYPTOPP_CXX17_ASSERT 1' + fi + + CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17_exceptions.cxx -o ${TOUT} 2>&1 | wc -w) + if [[ "${CXX_RESULT}" -eq 0 ]]; then + echo '#define CRYPTOPP_CXX17_UNCAUGHT_EXCEPTIONS 1' + else + echo '// #define CRYPTOPP_CXX17_UNCAUGHT_EXCEPTIONS 1' + fi + + echo '' + echo '#endif // CRYPTOPP_CXX17' + + echo '' + echo '// ***************** C++ fixups ********************' + echo '' + + echo '#if defined(CRYPTOPP_CXX11_NOEXCEPT)' + echo '# define CRYPTOPP_THROW noexcept(false)' + echo '# define CRYPTOPP_NO_THROW noexcept(true)' + echo '#else' + echo '# define CRYPTOPP_THROW' + echo '# define CRYPTOPP_NO_THROW' + echo '#endif // CRYPTOPP_CXX11_NOEXCEPT' + echo '' + echo '// C++11 nullptr_t type safety and analysis' + echo '#if defined(CRYPTOPP_CXX11_NULLPTR) && !defined(NULLPTR)' + echo '# define NULLPTR nullptr' + echo '#elif !defined(NULLPTR)' + echo '# define NULLPTR NULL' + echo '#endif // CRYPTOPP_CXX11_NULLPTR' + +} >> config_cxx.h.new + +# ==================================================== +# =================== common footer ================== +# ==================================================== +{ + echo '' + echo '#endif // CRYPTOPP_CONFIG_CXX_H' + echo '' +} >> config_cxx.h.new + +if [[ -e config_cxx.h ]]; then + cp config_cxx.h config_cxx.h.old + mv config_cxx.h.new config_cxx.h +fi + +echo 'Done writing config_cxx.h' + +rm -f "${TOUT}" + +exit 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-android-mk.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-android-mk.sh new file mode 100755 index 00000000..1b661da1 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-android-mk.sh @@ -0,0 +1,126 @@ +#!/usr/bin/env bash + +############################################################################# +# +# This script tests the cryptopp-android-mk gear using ndk-build. The +# source files include Application.mk and Android.mk. +# +# Written and placed in public domain by Jeffrey Walton. +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +# See http://www.cryptopp.com/wiki/Android.mk_(Command_Line) for more details +# +############################################################################# + +# Error checking +if [ ! -d "${ANDROID_NDK_ROOT}" ]; then + echo "ERROR: ANDROID_NDK_ROOT is not a valid path for ${USER}. Please set it." + echo "ANDROID_NDK_ROOT is '${ANDROID_NDK_ROOT}'" + exit 1 +fi + +# Error checking +if [ ! -d "${ANDROID_SDK_ROOT}" ]; then + echo "ERROR: ANDROID_SDK_ROOT is not a valid path for ${USER}. Please set it." + echo "ANDROID_SDK_ROOT is '${ANDROID_SDK_ROOT}'" + exit 1 +fi + +# Error checking +if [ -z "$(command -v ndk-build 2>/dev/null)" ]; then + echo "ERROR: ndk-build is not on-path for ${USER}. Please set it." + echo "PATH is '${PATH}'" + exit 1 +fi + +# Temp directory +if [[ -z "${TMPDIR}" ]]; then + TMPDIR="$HOME/tmp" + mkdir -p "${TMPDIR}" + if [ -n "${SUDO_USER}" ]; then + chown -R "${SUDO_USER}" "${TMPDIR}" + fi +fi + +# Sane default +if [[ -z "${MAKE_JOBS}" ]]; then + MAKE_JOBS=4 +fi + +# Fixup for sed and "illegal byte sequence" +IS_DARWIN=$(uname -s 2>/dev/null | grep -i -c darwin) +if [[ "${IS_DARWIN}" -ne 0 ]] && [[ -z "${LC_ALL}" ]]; then + export LC_ALL=C +fi + +# Cleanup old artifacts +rm -rf "${TMPDIR}/build.failed" 2>/dev/null +rm -rf "${TMPDIR}/build.log" 2>/dev/null + +############################################################################# + +files=(Android.mk Application.mk make_neon.sh test_shared.hxx test_shared.cxx) + +for file in "${files[@]}"; do + echo "Downloading $file" + if ! curl -L -s -o "${file}" "https://raw.githubusercontent.com/noloader/cryptopp-android-mk/master/${file}"; then + echo "${file} download failed" + exit 1 + fi + # Permissions + chmod u=rw,go=r "${file}" + # Throttle + sleep 1 +done + +# Fix permissions and quarantine +chmod u=rwx,go=rx make_neon.sh + +if [[ "${IS_DARWIN}" -ne 0 ]] && [[ $(command -v xattr 2>/dev/null) ]]; then + echo "Removing make_neon.sh quarantine" + xattr -d "com.apple.quarantine" make_neon.sh &>/dev/null +fi + +# Fix missing *neon files +echo "Adding NEON files for armeabi-v7a" +bash make_neon.sh + +############################################################################# + +# Paydirt +NDK_PROJECT_PATH="$PWD" +NDK_APPLICATION_MK="$PWD/Application.mk" +PLATFORMS=(armeabi-v7a arm64-v8a x86 x86_64) + +# Clean all past artifacts +ndk-build APP_ABI=all NDK_PROJECT_PATH="${NDK_PROJECT_PATH}" NDK_APPLICATION_MK="${NDK_APPLICATION_MK}" distclean &>/dev/null + +for platform in "${PLATFORMS[@]}" +do + echo "" + echo "====================================================================" + echo "Building for ${platform}..." + + if ndk-build -j "${MAKE_JOBS}" APP_ABI="${platform}" NDK_PROJECT_PATH="${NDK_PROJECT_PATH}" NDK_APPLICATION_MK="${NDK_APPLICATION_MK}" V=1; + then + echo "${platform} ==> SUCCESS" >> "${TMPDIR}/build.log" + else + echo "${platform} ==> FAILURE" >> "${TMPDIR}/build.log" + touch "${TMPDIR}/build.failed" + fi + +done + +echo +echo "====================================================================" +cat "${TMPDIR}/build.log" + +# let the script fail if any of the builds failed +if [ -f "${TMPDIR}/build.failed" ]; then + exit 1 +fi + +exit 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-android.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-android.sh index b7440f51..7c6db5ce 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-android.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-android.sh @@ -1,75 +1,115 @@ #!/usr/bin/env bash -# ==================================================================== -# Tests Android cross-compiles +############################################################################# +# +# This script tests Android cross-compiles using setenv-android.sh script. +# +# Written and placed in public domain by Jeffrey Walton. # # Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) # licensed under the Boost Software License 1.0, while the individual files # in the compilation are all public domain. # # See http://www.cryptopp.com/wiki/Android_(Command_Line) for more details -# ==================================================================== -set +e +# +############################################################################# -if [ -z $(command -v ./setenv-android-gcc.sh) ]; then - echo "Failed to locate setenv-android-gcc.sh" - ls -Al *.sh - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 +# Error checking +if [ -z "$(command -v ./setenv-android.sh 2>/dev/null)" ]; then + echo "Failed to locate setenv-android.sh." + exit 1 fi -if [ -z "${PLATFORM-}" ]; then - PLATFORMS=(armeabi armeabi-v7a armv7a-neon aarch64 mipsel mipsel64 x86 x86_64) -else - PLATFORMS=(${PLATFORM}) +# Error checking +if [ ! -d "${ANDROID_NDK_ROOT}" ]; then + echo "ERROR: ANDROID_NDK_ROOT is not a valid path for ${USER}. Please set it." + echo "ANDROID_NDK_ROOT is '${ANDROID_NDK_ROOT}'" + exit 1 fi -RUNTIMES=(gnu-static gnu-shared stlport-static stlport-shared) #llvm-static llvm-shared -for platform in ${PLATFORMS[@]} +# Error checking +if [ ! -d "${ANDROID_SDK_ROOT}" ]; then + echo "ERROR: ANDROID_SDK_ROOT is not a valid path for ${USER}. Please set it." + echo "ANDROID_SDK_ROOT is '${ANDROID_SDK_ROOT}'" + exit 1 +fi + +# Error checking +if [ -z "$(command -v ndk-build 2>/dev/null)" ]; then + echo "ERROR: ndk-build is not on-path for ${USER}. Please set it." + echo "PATH is '${PATH}'" + exit 1 +fi + +# Temp directory +if [[ -z "${TMPDIR}" ]]; then + TMPDIR="$HOME/tmp" + mkdir -p "${TMPDIR}" + if [ -n "${SUDO_USER}" ]; then + chown -R "${SUDO_USER}" "${TMPDIR}" + fi +fi + +# Sane default +if [[ -z "${MAKE_JOBS}" ]]; then + MAKE_JOBS=4 +fi + +# Cleanup old artifacts +rm -rf "${TMPDIR}/build.failed" 2>/dev/null +rm -rf "${TMPDIR}/build.log" 2>/dev/null + +############################################################################# + +PLATFORMS=(armv7a aarch64 x86 x86_64) + +for platform in "${PLATFORMS[@]}" do - for runtime in ${RUNTIMES[@]} - do - make -f GNUmakefile-cross distclean > /dev/null 2>&1 + # setenv-android.sh reads these two variables for configuration info. + # Android 5.0 is 21. Android 6.0 is 23. + export ANDROID_API="21" + export ANDROID_CPU="${platform}" - echo - echo "====================================================================" - echo "Testing for Android support of $platform using $runtime" + make -f GNUmakefile-cross distclean > /dev/null 2>&1 - # Test if we can set the environment for the platform - ./setenv-android-gcc.sh "$platform" "$runtime" + echo + echo "====================================================================" + echo "Testing for Android support of ${platform}" - if [ "$?" -ne "0" ]; - then - echo - echo "There were problems testing $platform with $runtime" - echo "$platform:$runtime ==> FAILURE" >> /tmp/build.log + # Test if we can set the environment for the platform + if ! ./setenv-android.sh > /dev/null 2>&1; + then + echo + echo "There were problems testing ${platform}" + echo "${platform} ==> SKIPPED" >> "${TMPDIR}/build.log" - touch /tmp/build.failed - continue - fi + continue + fi - echo - echo "Building for $platform using $runtime..." - echo + echo + echo "====================================================================" + echo "Building for ${platform}..." - # run in subshell to not keep any env vars - ( - source ./setenv-android-gcc.sh "$platform" "$runtime" > /dev/null 2>&1 - make -f GNUmakefile-cross static dynamic cryptest.exe - if [ "$?" -eq "0" ]; then - echo "$platform:$runtime ==> SUCCESS" >> /tmp/build.log - else - echo "$platform:$runtime ==> FAILURE" >> /tmp/build.log - touch /tmp/build.failed - fi - ) - done + # run in subshell to not keep any envars + ( + source ./setenv-android.sh + if make -k -j "${MAKE_JOBS}" -f GNUmakefile-cross static dynamic cryptest.exe; + then + echo "${platform} ==> SUCCESS" >> "${TMPDIR}/build.log" + else + echo "${platform} ==> FAILURE" >> "${TMPDIR}/build.log" + touch "${TMPDIR}/build.failed" + fi + ) done -cat /tmp/build.log +echo +echo "=====================================================" +cat "${TMPDIR}/build.log" # let the script fail if any of the builds failed -if [ -f /tmp/build.failed ]; then - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 +if [ -f "${TMPDIR}/build.failed" ]; then + exit 1 fi -[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0 +exit 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-autotools.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-autotools.sh index f70035f2..2d4df9aa 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-autotools.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-autotools.sh @@ -1,77 +1,74 @@ #!/usr/bin/env bash -PWD_DIR=$(pwd) -function cleanup { - cd "$PWD_DIR" -} -trap cleanup EXIT +############################################################################# +# +# This script tests the Autotools gear. +# +# Written and placed in public domain by Jeffrey Walton. +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +# See https://www.cryptopp.com/wiki/Autotools for more details +# +############################################################################# +# Default tools GREP=grep SED=sed AWK=awk MAKE=make -# Fixup ancient Bash -# https://unix.stackexchange.com/q/468579/56041 -if [[ -z "$BASH_SOURCE" ]]; then - BASH_SOURCE="$0" -fi +############################################################################# # Fixup, Solaris and friends -if [[ (-d /usr/xpg4/bin) ]]; then +if [[ -d /usr/xpg4/bin ]]; then SED=/usr/xpg4/bin/sed AWK=/usr/xpg4/bin/awk GREP=/usr/xpg4/bin/grep -elif [[ (-d /usr/bin/posix) ]]; then +elif [[ -d /usr/bin/posix ]]; then SED=/usr/bin/posix/sed AWK=/usr/bin/posix/awk GREP=/usr/bin/posix/grep fi # Fixup for sed and "illegal byte sequence" -IS_DARWIN=$(uname -s | "$GREP" -i -c darwin) +IS_DARWIN=$(uname -s 2>/dev/null | "$GREP" -i -c darwin) if [[ "$IS_DARWIN" -ne 0 ]]; then export LC_ALL=C fi # Fixup for Solaris and BSDs -# Fixup for Solaris and BSDs -if [[ ! -z $(command -v gmake) ]]; then +if [[ -n "$(command -v gmake 2>/dev/null)" ]]; then MAKE=gmake else MAKE=make fi # Fixup for missing libtool -if [[ ! -z $(command -v libtoolize) ]]; then - LIBTOOLIZE=$(command -v libtoolize) -elif [[ ! -z $(command -v glibtoolize) ]]; then - LIBTOOLIZE=$(command -v glibtoolize) -elif [[ ! -z $(command -v libtool) ]]; then - LIBTOOLIZE=$(command -v libtool) -elif [[ ! -z $(command -v glibtool) ]]; then - LIBTOOLIZE=$(command -v glibtool) +if [[ ! -z $(command -v glibtoolize 2>/dev/null) ]]; then + export LIBTOOLIZE=$(command -v glibtoolize) +elif [[ ! -z $(command -v libtoolize 2>/dev/null) ]]; then + export LIBTOOLIZE=$(command -v libtoolize) +elif [[ ! -z $(command -v glibtool 2>/dev/null) ]]; then + export LIBTOOLIZE=$(command -v glibtool) +elif [[ ! -z $(command -v libtool 2>/dev/null) ]]; then + export LIBTOOLIZE=$(command -v libtool) fi -# Fecth the three required files -if ! wget --no-check-certificate 'https://raw.githubusercontent.com/noloader/cryptopp-autotools/master/Makefile.am' -O Makefile.am; then - echo "Makefile.am download failed" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 +# In case libtool is located in /opt, like under MacPorts or Compile Farm +if [[ -z $(command -v glibtoolize 2>/dev/null) ]]; then + export LIBTOOLIZE=$(find /opt -name libtool 2>/dev/null | head -n 1) fi -if ! wget --no-check-certificate 'https://raw.githubusercontent.com/noloader/cryptopp-autotools/master/configure.ac' -O configure.ac; then - echo "configure.ac download failed" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 +############################################################################# + +if [[ -z $(command -v aclocal 2>/dev/null) ]]; then + echo "Cannot find aclocal. Things may fail." fi -if ! wget --no-check-certificate 'https://raw.githubusercontent.com/noloader/cryptopp-autotools/master/libcryptopp.pc.in' -O libcryptopp.pc.in; then - echo "libcryptopp.pc.in download failed" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 -fi - -mkdir -p m4/ - -if [[ -z $(command -v autoupdate) ]]; then +if [[ -z $(command -v autoupdate 2>/dev/null) ]]; then echo "Cannot find autoupdate. Things may fail." fi @@ -79,77 +76,137 @@ if [[ -z "$LIBTOOLIZE" ]]; then echo "Cannot find libtoolize. Things may fail." fi -if [[ -z $(command -v autoreconf) ]]; then +if [[ -z $(command -v automake 2>/dev/null) ]]; then + echo "Cannot find automake. Things may fail." +fi + +if [[ -z $(command -v autoreconf 2>/dev/null) ]]; then echo "Cannot find autoreconf. Things may fail." fi -echo "Running autoupdate" -if ! autoupdate 2>/dev/null; then - echo "autoupdate failed." - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 +if [[ -z $(command -v curl 2>/dev/null) ]]; then + echo "Cannot find cURL. Things may fail." fi -echo "Running libtoolize" -if ! "$LIBTOOLIZE" 2>/dev/null; then - echo "libtoolize failed." - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 +############################################################################# + +files=(configure.ac Makefile.am libcryptopp.pc.in) + +for file in "${files[@]}"; do + echo "Downloading $file" + if ! curl -L -s -o "$file" "https://raw.githubusercontent.com/noloader/cryptopp-autotools/master/$file"; then + echo "$file download failed" + exit 1 + fi + # Throttle + sleep 1 +done + +mkdir -p m4/ + +############################################################################# + +echo "Running aclocal" +if ! aclocal &>/dev/null; then + echo "aclocal failed." + exit 1 +fi + +echo "Running autoupdate" +if ! autoupdate &>/dev/null; then + echo "autoupdate failed." + exit 1 fi # Run autoreconf twice on failure. Also see # https://github.com/tracebox/tracebox/issues/57 echo "Running autoreconf" -if ! autoreconf 2>/dev/null; then +if ! autoreconf --force --install &>/dev/null; then echo "autoreconf failed, running again." - if ! autoreconf -fi; then + if ! autoreconf --force --install; then echo "autoreconf failed, again." - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 fi fi -# Sparc need +w -if [[ -e config.sub ]]; then - chmod +w config.sub -fi -if [[ -e config.guess ]]; then - chmod +w config.guess -fi +############################################################################# # Update config.sub config.guess. GNU recommends using the latest for all projects. echo "Updating config.sub" -wget --no-check-certificate 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub' -O config.sub +curl -L -s -o config.sub.new 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub' -if [[ -e config.sub ]]; then - chmod +x config.sub +# Solaris removes +w, can't overwrite +chmod +w build-aux/config.sub +mv config.sub.new build-aux/config.sub +chmod +x build-aux/config.sub + +if [[ "$IS_DARWIN" -ne 0 ]] && [[ -n $(command -v xattr 2>/dev/null) ]]; then + echo "Removing config.sub quarantine" + xattr -d "com.apple.quarantine" build-aux/config.sub &>/dev/null fi echo "Updating config.guess" -wget --no-check-certificate 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess' -O config.guess +curl -L -s -o config.guess.new 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess' -if [[ -e config.guess ]]; then - chmod +x config.guess +# Solaris removes +w, can't overwrite +chmod +w build-aux/config.guess +mv config.guess.new build-aux/config.guess +chmod +x build-aux/config.guess + +if [[ "$IS_DARWIN" -ne 0 ]] && [[ -n $(command -v xattr 2>/dev/null) ]]; then + echo "Removing config.guess quarantine" + xattr -d "com.apple.quarantine" build-aux/config.guess &>/dev/null fi +############################################################################# + +echo "Running configure" +echo "" + if ! ./configure; then echo "configure failed." - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 fi -"$MAKE" clean 2>/dev/null +############################################################################# + +echo "" +echo "Building test artifacts" +echo "" + +"$MAKE" clean &>/dev/null if ! "$MAKE" -j2 -f Makefile; then echo "make failed." - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 fi +############################################################################# + +echo "" +echo "Testing library" +echo "" + if ! ./cryptest v; then echo "cryptest v failed." - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 fi if ! ./cryptest tv all; then echo "cryptest tv all failed." - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 +fi + +############################################################################# + +echo "" +echo "Building tarball" +echo "" + +if ! make dist; then + echo "make dist failed." + exit 1 fi # Return success -[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0 +exit 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-cmake.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-cmake.sh index e51c9c39..9900497b 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-cmake.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-cmake.sh @@ -1,10 +1,18 @@ #!/usr/bin/env bash -PWD_DIR=$(pwd) -function cleanup { - cd "$PWD_DIR" -} -trap cleanup EXIT +############################################################################# +# +# This script tests the CMake gear. +# +# Written and placed in public domain by Jeffrey Walton. +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +# See https://www.cryptopp.com/wiki/CMake for more details +# +############################################################################# # Fixup ancient Bash # https://unix.stackexchange.com/q/468579/56041 @@ -24,50 +32,69 @@ if [[ -z "$CMAKE" ]]; then CMAKE=cmake fi -# Feth the three required files -if ! wget --no-check-certificate https://raw.githubusercontent.com/noloader/cryptopp-cmake/master/CMakeLists.txt -O CMakeLists.txt; then - echo "CMakeLists.txt download failed" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 +############################################################################# + +if [[ -z $(command -v "$CMAKE") ]]; then + echo "Cannot find $CMAKE. Things may fail." fi -if ! wget --no-check-certificate https://github.com/noloader/cryptopp-cmake/blob/master/cryptopp-config.cmake -O cryptopp-config.cmake; then - echo "cryptopp-config.cmake download failed" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 +if [[ -z $(command -v curl) ]]; then + echo "Cannot find cURL. Things may fail." fi -rm -rf "$PWD_DIR/cmake_build" -mkdir -p "$PWD_DIR/cmake_build" -cd "$PWD_DIR/cmake_build" +############################################################################# -if [[ ! -z "$CXX" ]]; +files=(CMakeLists.txt cryptopp-config.cmake) + +for file in "${files[@]}"; do + echo "Downloading $file" + if ! curl -L -s -o "$file" "https://raw.githubusercontent.com/noloader/cryptopp-cmake/master/$file"; then + echo "$file download failed" + exit 1 + fi + # Throttle + sleep 1 +done + +rm -rf "$(pwd)/cmake_build" +mkdir -p "$(pwd)/cmake_build" +cd "$(pwd)/cmake_build" || exit 1 + +############################################################################# + +echo "" +echo "Building test artifacts" +echo "" + +if [[ -n "$CXX" ]]; then if ! CXX="$CXX" "$CMAKE" -DCMAKE_CXX_COMPILER="$CXX" ../; then echo "cmake failed" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 fi else if ! "$CMAKE" ../; then echo "cmake failed" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 fi fi -"$MAKE" clean 2>/dev/null +"$MAKE" clean &>/dev/null if ! "$MAKE" -j2 -f Makefile VERBOSE=1; then echo "make failed" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 fi if ! ./cryptest.exe v; then echo "cryptest.exe v failed" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 fi if ! ./cryptest.exe tv all; then echo "cryptest.exe v failed" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 fi # Return success -[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0 +exit 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-ios.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-ios.sh index 48e0f82b..5b462402 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-ios.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-ios.sh @@ -1,70 +1,105 @@ #!/usr/bin/env bash -# ==================================================================== -# Tests iOS cross-compiles +############################################################################# +# +# This script tests the cryptopp-ios gear. +# +# Written and placed in public domain by Jeffrey Walton. # # Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) # licensed under the Boost Software License 1.0, while the individual files # in the compilation are all public domain. # # See http://www.cryptopp.com/wiki/iOS_(Command_Line) for more details -# ==================================================================== +############################################################################# -if [ -z $(command -v ./setenv-ios.sh) ]; then - echo "Failed to locate setenv-ios.sh" - ls -Al *.sh - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 +if [ -z "$(command -v ./setenv-ios.sh)" ]; then + echo "Failed to locate setenv-ios.sh" + exit 1 fi -if [ -z "${PLATFORM-}" ]; then - PLATFORMS=(iPhoneOS iPhoneSimulator Arm64 WatchOS WatchSimulator AppleTVOS AppleTVSimulator) -else - PLATFORMS=(${PLATFORM}) +# Temp directory +if [[ -z "${TMPDIR}" ]]; then + TMPDIR="$HOME/tmp" + mkdir "${TMPDIR}" fi -for platform in ${PLATFORMS[@]} +# Sane default +if [[ -z "${MAKE_JOBS}" ]]; then + MAKE_JOBS=4 +fi + +# Cleanup old artifacts +rm -rf "${TMPDIR}/build.failed" 2>/dev/null +rm -rf "${TMPDIR}/build.log" 2>/dev/null + +############################################################################# + +# Hack a Bash data structure... +PLATFORMS=() +PLATFORMS+=("iPhoneOS:armv7") +PLATFORMS+=("iPhoneOS:arm64") +PLATFORMS+=("AppleTVOS:armv7") +PLATFORMS+=("AppleTVOS:arm64") +PLATFORMS+=("WatchOS:armv7") +PLATFORMS+=("WatchOS:arm64") +PLATFORMS+=("iPhoneSimulator:i386") +PLATFORMS+=("iPhoneSimulator:x86_64") +PLATFORMS+=("AppleTVSimulator:i386") +PLATFORMS+=("AppleTVSimulator:x86_64") +PLATFORMS+=("WatchSimulator:i386") +PLATFORMS+=("WatchSimulator:x86_64") + +for platform in "${PLATFORMS[@]}" do - make -f GNUmakefile-cross distclean > /dev/null 2>&1 - echo - echo "=====================================================" - echo "Testing for iOS support of $platform" + sdk=$(echo "${platform[@]}" | awk -F':' '{print $1}') + cpu=$(echo "${platform[@]}" | awk -F':' '{print $2}') - # Test if we can set the environment for the platform - ./setenv-ios.sh "$platform" + # setenv-ios.sh reads these two variables for configuration info. + export IOS_SDK="$sdk" + export IOS_CPU="$cpu" - if [ "$?" -ne "0" ]; - then - echo - echo "$platform not supported by Xcode" - echo "$platform ==> FAILURE" >> /tmp/build.log + make -f GNUmakefile-cross distclean > /dev/null 2>&1 - touch /tmp/build.failed - continue - fi + echo + echo "=====================================================" + echo "Testing for iOS support of ${platform}" - echo - echo "Building for $platform using $runtime..." - echo + # Test if we can set the environment for the platform + if ! ./setenv-ios.sh > /dev/null 2>&1; + then + echo + echo "${platform} not supported by Xcode" + echo "${platform} ==> SKIPPED" >> "${TMPDIR}/build.log" - # run in subshell to not keep any env vars - ( - source ./setenv-ios.sh "$platform" > /dev/null 2>&1 - make -f GNUmakefile-cross static dynamic cryptest.exe - if [ "$?" -eq "0" ]; then - echo "$platform ==> SUCCESS" >> /tmp/build.log - else - echo "$platform ==> FAILURE" >> /tmp/build.log - touch /tmp/build.failed - fi - ) + continue + fi + + echo + echo "=====================================================" + echo "Building for ${platform}..." + + # run in subshell to not keep any envars + ( + source ./setenv-ios.sh + if make -k -j "${MAKE_JOBS}" -f GNUmakefile-cross static dynamic cryptest.exe; + then + echo "${platform} ==> SUCCESS" >> "${TMPDIR}/build.log" + else + echo "${platform} ==> FAILURE" >> "${TMPDIR}/build.log" + touch "${TMPDIR}/build.failed" + fi + ) done -cat /tmp/build.log +echo +echo "=====================================================" +cat "${TMPDIR}/build.log" # let the script fail if any of the builds failed -if [ -f /tmp/build.failed ]; then - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 +if [ -f "${TMPDIR}/build.failed" ]; then + exit 1 fi -[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0 +exit 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-pem.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-pem.sh new file mode 100755 index 00000000..d4d076df --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-pem.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash + +############################################################################# +# +# This script tests the cryptopp-pem gear. +# +# Written and placed in public domain by Jeffrey Walton. +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +############################################################################# + +GREP=grep +SED=sed +AWK=awk +MAKE=make + +# Fixup, Solaris and friends +if [[ (-d /usr/xpg4/bin) ]]; then + SED=/usr/xpg4/bin/sed + AWK=/usr/xpg4/bin/awk + GREP=/usr/xpg4/bin/grep +elif [[ (-d /usr/bin/posix) ]]; then + SED=/usr/bin/posix/sed + AWK=/usr/bin/posix/awk + GREP=/usr/bin/posix/grep +fi + +# Fixup for sed and "illegal byte sequence" +IS_DARWIN=$(uname -s | "$GREP" -i -c darwin) +if [[ "$IS_DARWIN" -ne 0 ]]; then + export LC_ALL=C +fi + +# Fixup for Solaris and BSDs +if [[ ! -z $(command -v gmake) ]]; then + MAKE=gmake +else + MAKE=make +fi + +############################################################################# + +if [[ -z $(command -v "$MAKE") ]]; then + echo "Cannot find $MAKE. Things may fail." +fi + +if [[ -z $(command -v curl) ]]; then + echo "Cannot find cURL. Things may fail." +fi + +if [[ -z $(command -v openssl) ]]; then + echo "Cannot find openssl. Things may fail." +fi + +############################################################################# + +files=(pem_create.sh pem_verify.sh pem_test.cxx pem_eol.cxx + pem.h pem_common.cpp pem_common.h pem_read.cpp pem_write.cpp + x509cert.h x509cert.cpp) + +for file in "${files[@]}"; do + echo "Downloading $file" + if ! curl -L -s -o "$file" "https://raw.githubusercontent.com/noloader/cryptopp-pem/master/$file"; then + echo "$file download failed" + exit 1 + fi + # Throttle + sleep 1 +done + +# Add execute to scripts +chmod +x *.sh + +if [[ "$IS_DARWIN" -ne 0 ]] && [[ -n $(command -v xattr) ]]; then + echo "Removing pem_create.sh pem_verify.sh quarantine" + xattr -d "com.apple.quarantine" pem_create.sh pem_verify.sh &>/dev/null +fi + +############################################################################# + +echo "" +echo "Building test artifacts" +echo "" + +"$MAKE" clean &>/dev/null + +if ! "$MAKE" -j 2; then + echo "make failed." + exit 1 +fi + +if ! ./cryptest.exe v; then + echo "cryptest v failed." + exit 1 +fi + +if ! ./pem_create.sh; then + echo "pem_create.sh failed." + exit 1 +fi + +if ! ./pem_verify.sh; then + echo "pem_verify.sh failed." + exit 1 +fi + +# Return success +exit 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-symbols.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-symbols.sh index ea65c84b..1519b78e 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-symbols.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-symbols.sh @@ -1,60 +1,53 @@ #!/usr/bin/env bash -# cryptest.sh - written and placed in public domain by Jeffrey Walton and Uri -# Blumenthal. - +############################################################################# +# # This is a test script that can be used on some Linux/Unix/Apple machines to # automate testing of the shared object to ensure linking and symbols don't go # missing from release to release. +# +# Written and placed in public domain by Jeffrey Walton and Uri Blumenthal. +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +# See http://www.cryptopp.com/wiki/Android.mk_(Command_Line) for more details +# +############################################################################# -# Fixup ancient Bash -# https://unix.stackexchange.com/q/468579/56041 -if [[ -z "$BASH_SOURCE" ]]; then - BASH_SOURCE="$0" -fi - -############################################ -# Cleanup - -PWD_DIR=$(pwd) -function cleanup { - rm -f adhoc.cpp *.a *.o *.so *.dylib GNUmakefile-symbols - cd "$PWD_DIR" -} -trap cleanup EXIT - -############################################ +############################################################################# # Tags to test -OLD_VERSION_TAG=CRYPTOPP_8_1_0 +OLD_VERSION_TAG=CRYPTOPP_8_3_0 NEW_VERSION_TAG=master -############################################ +############################################################################# # If local repo is dirty, then promt first DIRTY=$(git diff --shortstat 2> /dev/null | tail -1) -if [[ ! (-z "$DIRTY") ]]; then +if [[ ! -z "$DIRTY" ]]; then echo echo "The local repo is dirty. Continuing will reset the repo and lose changes." read -p "Type 'Y' to proceed or 'N' to exit. Proceed? " -n 1 -r echo # (optional) move to a new line if [[ !($REPLY =~ ^[Yy]$) ]]; then - [[ "$0" = "$BASH_SOURCE" ]] && exit 0 || return 0 + exit 0 fi else echo echo "The local repo is clean. Proceeding..." fi -############################################ +############################################################################# echo echo "****************************************************************" echo "Testing '$NEW_VERSION_TAG' against '$OLD_VERSION_TAG'" echo "****************************************************************" -############################################ +############################################################################# # Setup tools and platforms GREP=grep @@ -64,118 +57,55 @@ AWK=awk CXXFILT=c++filt THIS_SYSTEM=$(uname -s 2>&1) -IS_DARWIN=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c darwin) -IS_LINUX=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c linux) -IS_CYGWIN=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c cygwin) -IS_MINGW=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c mingw) -IS_OPENBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c openbsd) -IS_FREEBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c freebsd) -IS_NETBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c netbsd) -IS_SOLARIS=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c sunos) +IS_DARWIN=$("${GREP}" -i -c darwin <<< "${THIS_SYSTEM}") +IS_LINUX=$("${GREP}" -i -c linux <<< "${THIS_SYSTEM}") +IS_CYGWIN=$("${GREP}" -i -c cygwin <<< "${THIS_SYSTEM}") +IS_MINGW=$("${GREP}" -i -c mingw <<< "${THIS_SYSTEM}") +IS_OPENBSD=$("${GREP}" -i -c openbsd <<< "${THIS_SYSTEM}") +IS_FREEBSD=$("${GREP}" -i -c freebsd <<< "${THIS_SYSTEM}") +IS_NETBSD=$("${GREP}" -i -c netbsd <<< "${THIS_SYSTEM}") +IS_SOLARIS=$("${GREP}" -i -c sunos <<< "${THIS_SYSTEM}") THIS_MACHINE=$(uname -m 2>&1) -IS_X86=$(echo -n "$THIS_MACHINE" | "$EGREP" -i -c "(i386|i486|i586|i686)") -IS_X64=$(echo -n "$THIS_MACHINE" | "$EGREP" -i -c "(amd64|x86_64)") -IS_PPC=$(echo -n "$THIS_MACHINE" | "$EGREP" -i -c "(Power|PPC)") -IS_ARM32=$(echo -n "$THIS_MACHINE" | "$GREP" -v "64" | "$EGREP" -i -c "(arm|aarch32)") -IS_ARM64=$(echo -n "$THIS_MACHINE" | "$EGREP" -i -c "(arm64|aarch64)") -IS_S390=$(echo -n "$THIS_MACHINE" | "$EGREP" -i -c "s390") -IS_X32=0 +IS_X86=$("${EGREP}" -i -c 'i386|i486|i586|i686' <<< "${THIS_MACHINE}") +IS_X64=$("${EGREP}" -i -c "amd64|x86_64" <<< "${THIS_MACHINE}") +IS_PPC32=$("${EGREP}" -i -c "PowerPC|PPC" <<< "${THIS_MACHINE}") +IS_PPC64=$("${EGREP}" -i -c "PowerPC64|PPC64" <<< "${THIS_MACHINE}") +IS_ARM32=$("${EGREP}" -i -c "arm|aarch32" <<< "${THIS_MACHINE}") +IS_ARMV8=$("${EGREP}" -i -c "arm64|aarch64" <<< "${THIS_MACHINE}") +IS_S390=$("${EGREP}" -i -c "s390" <<< "${THIS_MACHINE}") + +if [[ "${IS_X64}" -eq 1 ]]; then IS_X86=0; fi +if [[ "${IS_ARMV8}" -eq 1 ]]; then IS_ARM32=0; fi +if [[ "${IS_PPC64}" -eq 1 ]]; then IS_PPC32=0; fi # Fixup -if [[ "$IS_SOLARIS" -ne "0" ]]; then - IS_X64=$(isainfo 2>/dev/null | "$GREP" -i -c "amd64") - if [[ "$IS_X64" -ne "0" ]]; then - IS_X86=0 - fi - - # Need something more powerful than the Posix versions - if [[ (-e "/usr/gnu/bin/grep") ]]; then - GREP=/usr/gnu/bin/grep - fi - if [[ (-e "/usr/gnu/bin/egrep") ]]; then - EGREP=/usr/gnu/bin/egrep - fi - if [[ (-e "/usr/gnu/bin/sed") ]]; then - SED=/usr/gnu/bin/sed - fi - if [[ (-e "/usr/gnu/bin/c++filt") ]]; then - CXXFILT=/usr/gnu/bin/c++filt - fi - if [[ (-e "/usr/gnu/bin/awk") ]]; then - AWK=/usr/gnu/bin/awk - else - AWK=nawk; - fi -fi - -if [[ "$IS_DARWIN" -ne "0" ]]; then - SED_OPTS=(-i '') -else - SED_OPTS=(-i) -fi - -# Fixup -if [[ ("$IS_FREEBSD" -ne "0" || "$IS_OPENBSD" -ne "0" || "$IS_NETBSD" -ne "0") ]]; then +if [[ "$IS_FREEBSD" -ne "0" || "$IS_OPENBSD" -ne "0" || "$IS_NETBSD" -ne "0" ]]; then MAKE=gmake -elif [[ ("$IS_SOLARIS" -ne "0") ]]; then - MAKE=$(which gmake 2>/dev/null | "$GREP" -v "no gmake" | head -1) - if [[ (-z "$MAKE") && (-e "/usr/sfw/bin/gmake") ]]; then +elif [[ "$IS_SOLARIS" -ne "0" ]]; then + MAKE=$(command -v gmake 2>/dev/null | "${GREP}" -v "no gmake" | head -1) + if [[ -z "$MAKE" && -e "/usr/sfw/bin/gmake" ]]; then MAKE=/usr/sfw/bin/gmake fi else MAKE=make fi -# We need to use the C++ compiler to determine feature availablility. Otherwise -# mis-detections occur on a number of platforms. -if [[ ((-z "$CXX") || ("$CXX" == "gcc")) ]]; then - if [[ ("$CXX" == "gcc") ]]; then - CXX=g++ - elif [[ "$IS_DARWIN" -ne "0" ]]; then - CXX=c++ - elif [[ "$IS_SOLARIS" -ne "0" ]]; then - if [[ (-e "/opt/developerstudio12.5/bin/CC") ]]; then - CXX=/opt/developerstudio12.5/bin/CC - elif [[ (-e "/opt/solarisstudio12.4/bin/CC") ]]; then - CXX=/opt/solarisstudio12.4/bin/CC - elif [[ (-e "/opt/solarisstudio12.3/bin/CC") ]]; then - CXX=/opt/solarisstudio12.3/bin/CC - elif [[ (-e "/opt/solstudio12.2/bin/CC") ]]; then - CXX=/opt/solstudio12.2/bin/CC - elif [[ (-e "/opt/solstudio12.1/bin/CC") ]]; then - CXX=/opt/solstudio12.1/bin/CC - elif [[ (-e "/opt/solstudio12.0/bin/CC") ]]; then - CXX=/opt/solstudio12.0/bin/CC - elif [[ (! -z $(which CC 2>/dev/null | "$GREP" -v "no CC" | head -1)) ]]; then - CXX=$(which CC | head -1) - elif [[ (! -z $(which g++ 2>/dev/null | "$GREP" -v "no g++" | head -1)) ]]; then - CXX=$(which g++ | head -1) - else - CXX=CC - fi - elif [[ ($(which g++ 2>&1 | "$GREP" -v "no g++" | "$GREP" -i -c g++) -ne "0") ]]; then - CXX=g++ - else - CXX=c++ - fi +if [[ "$IS_DARWIN" -ne "0" ]]; then + LINK_LIBRARY=libcryptopp.dylib +else + LINK_LIBRARY=libcryptopp.so fi -SUN_COMPILER=$("$CXX" -V 2>&1 | "$EGREP" -i -c "CC: (Sun|Studio)") -GCC_COMPILER=$("$CXX" --version 2>&1 | "$GREP" -i -v "clang" | "$EGREP" -i -c "(gcc|g\+\+)") -INTEL_COMPILER=$("$CXX" --version 2>&1 | "$EGREP" -i -c "\(icc\)") -MACPORTS_COMPILER=$("$CXX" --version 2>&1 | "$EGREP" -i -c "MacPorts") -CLANG_COMPILER=$("$CXX" --version 2>&1 | "$EGREP" -i -c "clang") +if [[ -z "${CXX}" ]]; then CXX=c++; fi -if [[ ("$SUN_COMPILER" -eq "0") ]]; then - AMD64=$("$CXX" -dM -E - /dev/null | "$EGREP" -c "(__x64_64__|__amd64__)") - ILP32=$("$CXX" -dM -E - /dev/null | "$EGREP" -c "(__ILP32__|__ILP32)") - if [[ ("$AMD64" -ne "0") && ("$ILP32" -ne "0") ]]; then - IS_X32=1 - fi -fi +SUN_COMPILER=$("${CXX}" -V 2>&1 | "${EGREP}" -i -c "CC: (Sun|Studio)") +GCC_COMPILER=$("${CXX}" --version 2>&1 | "${EGREP}" -i -c "^(gcc|g\+\+)") +INTEL_COMPILER=$("${CXX}" --version 2>&1 | "${GREP}" -i -c "icc") +MACPORTS_COMPILER=$("${CXX}" --version 2>&1 | "${GREP}" -i -c "MacPorts") +CLANG_COMPILER=$("${CXX}" --version 2>&1 | "${GREP}" -i -c "clang") -############################################ +############################################################################# # CPU is logical count, memory is in MiB. Low resource boards have # fewer than 4 cores and 1GB or less memory. We use this to @@ -183,25 +113,25 @@ fi CPU_COUNT=1 MEM_SIZE=512 -if [[ (-e "/proc/cpuinfo") && (-e "/proc/meminfo") ]]; then - CPU_COUNT=$(cat /proc/cpuinfo | "$GREP" -c '^processor') - MEM_SIZE=$(cat /proc/meminfo | "$GREP" "MemTotal" | "$AWK" '{print $2}') +if [[ -e "/proc/cpuinfo" && -e "/proc/meminfo" ]]; then + CPU_COUNT=$(cat /proc/cpuinfo | "${GREP}" -c '^processor') + MEM_SIZE=$(cat /proc/meminfo | "${GREP}" "MemTotal" | "${AWK}" '{print $2}') MEM_SIZE=$(($MEM_SIZE/1024)) elif [[ "$IS_DARWIN" -ne "0" ]]; then - CPU_COUNT=$(sysctl -a 2>&1 | "$GREP" 'hw.availcpu' | "$AWK" '{print $3; exit}') - MEM_SIZE=$(sysctl -a 2>&1 | "$GREP" 'hw.memsize' | "$AWK" '{print $3; exit;}') + CPU_COUNT=$(sysctl -a 2>&1 | "${GREP}" 'hw.availcpu' | "${AWK}" '{print $3; exit}') + MEM_SIZE=$(sysctl -a 2>&1 | "${GREP}" 'hw.memsize' | "${AWK}" '{print $3; exit;}') MEM_SIZE=$(($MEM_SIZE/1024/1024)) elif [[ "$IS_SOLARIS" -ne "0" ]]; then - CPU_COUNT=$(psrinfo 2>/dev/null | wc -l | "$AWK" '{print $1}') - MEM_SIZE=$(prtconf 2>/dev/null | "$GREP" Memory | "$AWK" '{print $3}') + CPU_COUNT=$(psrinfo 2>/dev/null | wc -l | "${AWK}" '{print $1}') + MEM_SIZE=$(prtconf 2>/dev/null | "${GREP}" Memory | "${AWK}" '{print $3}') fi # Some ARM devboards cannot use 'make -j N', even with multiple cores and RAM # An 8-core Cubietruck Plus with 2GB RAM experiences OOM kills with '-j 2'. HAVE_SWAP=1 if [[ "$IS_LINUX" -ne "0" ]]; then - if [[ (-e "/proc/meminfo") ]]; then - SWAP_SIZE=$(cat /proc/meminfo | "$GREP" "SwapTotal" | "$AWK" '{print $2}') + if [[ -e "/proc/meminfo" ]]; then + SWAP_SIZE=$(cat /proc/meminfo | "${GREP}" "SwapTotal" | "${AWK}" '{print $2}') if [[ "$SWAP_SIZE" -eq "0" ]]; then HAVE_SWAP=0 fi @@ -210,41 +140,20 @@ if [[ "$IS_LINUX" -ne "0" ]]; then fi fi -if [[ ("$CPU_COUNT" -ge "2" && "$MEM_SIZE" -ge "1280" && "$HAVE_SWAP" -ne "0") ]]; then - if [[ ("$WANT_NICE" -eq "1") ]]; then - CPU_COUNT=$(echo -n "$CPU_COUNT 2" | "$AWK" '{print int($1/$2)}') - fi +if [[ "$CPU_COUNT" -ge "2" && "$MEM_SIZE" -ge "1280" && "$HAVE_SWAP" -ne "0" ]]; then MAKEARGS=(-j "$CPU_COUNT") fi -############################################################################### -############################################################################### - -"$MAKE" distclean &>/dev/null - -rm -f GNUmakefile-symbols +############################################################################# +############################################################################# +"${MAKE}" distclean &>/dev/null && cleanup &>/dev/null git checkout master -f &>/dev/null -cp GNUmakefile GNUmakefile-symbols - git checkout "$OLD_VERSION_TAG" -f &>/dev/null if [[ "$?" -ne "0" ]]; then echo "Failed to checkout $OLD_VERSION_TAG" - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 -fi - -echo -echo "****************************************************************" -echo "Patching makefile for dynamic linking by cryptest.exe" -echo "****************************************************************" - -if [[ "$IS_DARWIN" -ne "0" ]]; then - "$SED" "$SED_OPTS" -e 's|libcryptopp.a $(TESTOBJS)|libcryptopp.dylib $(TESTOBJS)|g' GNUmakefile-symbols - "$SED" "$SED_OPTS" -e 's|$(TESTOBJS) ./libcryptopp.a |$(TESTOBJS) ./libcryptopp.dylib |g' GNUmakefile-symbols -else - "$SED" "$SED_OPTS" -e 's|libcryptopp.a $(TESTOBJS)|libcryptopp.so $(TESTOBJS)|g' GNUmakefile-symbols - "$SED" "$SED_OPTS" -e 's|$(TESTOBJS) ./libcryptopp.a |$(TESTOBJS) ./libcryptopp.so |g' GNUmakefile-symbols + exit 1 fi echo @@ -253,30 +162,11 @@ echo "Building dynamic library for $OLD_VERSION_TAG" echo "****************************************************************" echo -"$MAKE" "${MAKEARGS[@]}" -f GNUmakefile-symbols dynamic +LINK_LIBRARY="$LINK_LIBRARY" "$MAKE" "${MAKEARGS[@]}" -f GNUmakefile cryptest.exe dynamic -if [[ "$IS_DARWIN" -ne "0" ]]; then - LIBNAME=libcryptopp.dylib -else - LIBNAME=libcryptopp.so -fi - -if [[ ! -f "$LIBNAME" ]]; then +if [[ ! -f "$LINK_LIBRARY" ]]; then echo "Failed to make $OLD_VERSION_TAG library" - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 -fi - -echo -echo "****************************************************************" -echo "Building cryptest.exe for $OLD_VERSION_TAG" -echo "****************************************************************" -echo - -"$MAKE" "${MAKEARGS[@]}" -f GNUmakefile-symbols cryptest.exe - -if [[ ! -f "cryptest.exe" ]]; then - echo "Failed to make cryptest.exe" - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 + exit 1 fi echo @@ -286,26 +176,15 @@ echo "****************************************************************" echo if [[ "$IS_DARWIN" -ne "0" ]]; then - DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" "$PWD/cryptest.exe" v 2>&1 | "$CXXFILT" - DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" "$PWD/cryptest.exe" tv all 2>&1 | "$CXXFILT" + DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" ./cryptest.exe v 2>&1 | "$CXXFILT" + DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" ./cryptest.exe tv all 2>&1 | "$CXXFILT" else - LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" "$PWD/cryptest.exe" v 2>&1 | "$CXXFILT" - LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" "$PWD/cryptest.exe" tv all 2>&1 | "$CXXFILT" + LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" ./cryptest.exe v 2>&1 | "$CXXFILT" + LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" ./cryptest.exe tv all 2>&1 | "$CXXFILT" fi -echo -echo "****************************************************************" -echo "Removing dynamic library and artifacts for $OLD_VERSION_TAG" -echo "****************************************************************" - -rm -f adhoc.cpp *.a *.o *.so *.dylib - -git checkout "$NEW_VERSION_TAG" -f &>/dev/null - -if [[ "$?" -ne "0" ]]; then - echo "Failed to checkout $OLD_VERSION_TAG" - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 -fi +# Stash away old cryptest.exe +cp cryptest.exe cryptest.exe.saved echo echo "****************************************************************" @@ -313,13 +192,20 @@ echo "Building dynamic library for $NEW_VERSION_TAG" echo "****************************************************************" echo -"$MAKE" "${MAKEARGS[@]}" -f GNUmakefile-symbols dynamic +"${MAKE}" distclean &>/dev/null && cleanup &>/dev/null +git checkout master -f &>/dev/null +git checkout "$NEW_VERSION_TAG" -f &>/dev/null -if [[ ! -f "$LIBNAME" ]]; then +LINK_LIBRARY="$LINK_LIBRARY" "$MAKE" "${MAKEARGS[@]}" -f GNUmakefile cryptest.exe dynamic + +if [[ ! -f "$LINK_LIBRARY" ]]; then echo "Failed to make $NEW_VERSION_TAG library" - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 + exit 1 fi +# Fetch old cryptest.exe +cp cryptest.exe.saved cryptest.exe + echo echo "****************************************************************" echo "Running $OLD_VERSION_TAG cryptest.exe using $NEW_VERSION_TAG library" @@ -327,18 +213,14 @@ echo "****************************************************************" echo if [[ "$IS_DARWIN" -ne "0" ]]; then - DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" "$PWD/cryptest.exe" v 2>&1 | "$CXXFILT" - DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" "$PWD/cryptest.exe" tv all 2>&1 | "$CXXFILT" + DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" ./cryptest.exe v 2>&1 | "$CXXFILT" + DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" ./cryptest.exe tv all 2>&1 | "$CXXFILT" else - LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" "$PWD/cryptest.exe" v 2>&1 | "$CXXFILT" - LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" "$PWD/cryptest.exe" tv all 2>&1 | "$CXXFILT" + LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" ./cryptest.exe v 2>&1 | "$CXXFILT" + LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" ./cryptest.exe tv all 2>&1 | "$CXXFILT" fi +"${MAKE}" distclean &>/dev/null && cleanup &>/dev/null git checkout master -f &>/dev/null -if [[ "$?" -ne "0" ]]; then - echo "Failed to checkout Master" - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 -fi - -[[ "$0" = "$BASH_SOURCE" ]] && exit 0 || return 0 +exit 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-tidy.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-tidy.sh index 537b3785..2a70b29e 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-tidy.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-tidy.sh @@ -1,5 +1,17 @@ #!/usr/bin/env bash +############################################################################# +# +# This script invokes clang-tidy on source files. +# +# Written and placed in public domain by Jeffrey Walton. +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +############################################################################# + for file in $(find . -maxdepth 1 -type f -name '*.cpp'); do echo "Tidying $file" clang-tidy $file -checks=-clang-analyzer-optin.cplusplus.VirtualCall -- -std=c++03 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest.sh index b79a6577..41e7f1ba 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest.sh @@ -31,34 +31,40 @@ # Keep the noise down # shellcheck disable=SC2181 +# shellcheck disable=SC2016 +# shellcheck disable=SC2034 ############################################ # Set to suite your taste if [[ (-z "$TEST_RESULTS") ]]; then - TEST_RESULTS=cryptest-result.txt + TEST_RESULTS=cryptest-result.txt fi if [[ (-z "$BENCHMARK_RESULTS") ]]; then - BENCHMARK_RESULTS=cryptest-bench.txt + BENCHMARK_RESULTS=cryptest-bench.txt fi if [[ (-z "$WARN_RESULTS") ]]; then - WARN_RESULTS=cryptest-warn.txt + WARN_RESULTS=cryptest-warn.txt fi if [[ (-z "$INSTALL_RESULTS") ]]; then - INSTALL_RESULTS=cryptest-install.txt + INSTALL_RESULTS=cryptest-install.txt +fi + +if [[ -z "$test_prog" ]]; then + test_prog="TestPrograms/test_cxx.cxx" fi # Remove previous test results -rm -f "$TEST_RESULTS" > /dev/null 2>&1 +rm -f "$TEST_RESULTS" &>/dev/null touch "$TEST_RESULTS" -rm -f "$BENCHMARK_RESULTS" > /dev/null 2>&1 +rm -f "$BENCHMARK_RESULTS" &>/dev/null touch "$BENCHMARK_RESULTS" -rm -f "$WARN_RESULTS" > /dev/null 2>&1 +rm -f "$WARN_RESULTS" &>/dev/null touch "$WARN_RESULTS" -rm -f "$INSTALL_RESULTS" > /dev/null 2>&1 +rm -f "$INSTALL_RESULTS" &>/dev/null touch "$INSTALL_RESULTS" # Avoid CRYPTOPP_DATA_DIR in this shell (it is tested below) @@ -81,142 +87,152 @@ MAKE=make DISASS=objdump DISASSARGS=("--disassemble") -# Fixup ancient Bash -# https://unix.stackexchange.com/q/468579/56041 -if [[ -z "$BASH_SOURCE" ]]; then - BASH_SOURCE="$0" -fi - # Fixup, Solaris and friends if [[ (-d /usr/xpg4/bin) ]]; then - SED=/usr/xpg4/bin/sed - AWK=/usr/xpg4/bin/awk - GREP=/usr/xpg4/bin/grep + SED=/usr/xpg4/bin/sed + AWK=/usr/xpg4/bin/awk + GREP=/usr/xpg4/bin/grep elif [[ (-d /usr/bin/posix) ]]; then - SED=/usr/bin/posix/sed - AWK=/usr/bin/posix/awk - GREP=/usr/bin/posix/grep + SED=/usr/bin/posix/sed + AWK=/usr/bin/posix/awk + GREP=/usr/bin/posix/grep fi # Fixup, Solaris and BSDs if [[ $(command -v gmake 2>/dev/null) ]]; then - MAKE="gmake" + MAKE="gmake" else - MAKE="make" + MAKE="make" fi THIS_SYSTEM=$(uname -s 2>&1) -IS_AIX=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c aix) -IS_DARWIN=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c darwin) -IS_HURD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c gnu) -IS_LINUX=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c linux) -IS_CYGWIN=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c cygwin) -IS_MINGW=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c mingw) -IS_OPENBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c openbsd) -IS_DRAGONFLY=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c dragonfly) -IS_FREEBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c freebsd) -IS_NETBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c netbsd) -IS_SOLARIS=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c sunos) -IS_BSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c bsd) +IS_AIX=$("$GREP" -i -c aix <<< "$THIS_SYSTEM") +IS_DARWIN=$("$GREP" -i -c darwin <<< "$THIS_SYSTEM") +IS_HURD=$("$GREP" -i -c gnu <<< "$THIS_SYSTEM") +IS_LINUX=$("$GREP" -i -c linux <<< "$THIS_SYSTEM") +IS_CYGWIN=$("$GREP" -i -c cygwin <<< "$THIS_SYSTEM") +IS_MINGW=$("$GREP" -i -c mingw <<< "$THIS_SYSTEM") +IS_OPENBSD=$("$GREP" -i -c openbsd <<< "$THIS_SYSTEM") +IS_DRAGONFLY=$("$GREP" -i -c dragonfly <<< "$THIS_SYSTEM") +IS_FREEBSD=$("$GREP" -i -c freebsd <<< "$THIS_SYSTEM") +IS_NETBSD=$("$GREP" -i -c netbsd <<< "$THIS_SYSTEM") +IS_SOLARIS=$("$GREP" -i -c sunos <<< "$THIS_SYSTEM") +IS_BSD=$("$GREP" -i -c bsd <<< "$THIS_SYSTEM") -IS_DEBIAN=$(lsb_release -a 2>&1 | "$GREP" -i -c debian) -IS_FEDORA=$(lsb_release -a 2>&1 | "$GREP" -i -c fedora) -IS_UBUNTU=$(lsb_release -a 2>&1 | "$GREP" -i -c ubuntu) +THIS_RELEASE=$(lsb_release -a 2>&1) +IS_DEBIAN=$("$GREP" -i -c debian <<< "$THIS_RELEASE") +IS_FEDORA=$("$GREP" -i -c fedora <<< "$THIS_RELEASE") +IS_UBUNTU=$("$GREP" -i -c ubuntu <<< "$THIS_RELEASE") +IS_SUSE=$("$GREP" -i -c opensuse <<< "$THIS_RELEASE") THIS_MACHINE=$(uname -m 2>&1) -IS_X86=$(echo -n "$THIS_MACHINE" | "$GREP" -i -c -E "(i386|i486|i686|i686)") -IS_X64=$(echo -n "$THIS_MACHINE" | "$GREP" -i -c -E "(amd64|x86_64)") -IS_PPC32=$(echo -n "$THIS_MACHINE" | "$GREP" -v "64" | "$GREP" -i -c -E "(Power|PPC)") -IS_PPC64=$(echo -n "$THIS_MACHINE" | "$GREP" -i -c -E "(Power64|PPC64)") -IS_ARM32=$(echo -n "$THIS_MACHINE" | "$GREP" -v "64" | "$GREP" -i -c -E "(arm|aarch32)") -IS_ARM64=$(echo -n "$THIS_MACHINE" | "$GREP" -i -c -E "(arm64|aarch64)") -IS_S390=$(echo -n "$THIS_MACHINE" | "$GREP" -i -c "s390") -IS_SPARC=$(echo -n "$THIS_MACHINE" | "$GREP" -i -c "sparc") +IS_X86=$("$GREP" -i -c -E "(i386|i486|i686|i686)" <<< "$THIS_MACHINE") +IS_X64=$("$GREP" -i -c -E "(amd64|x86_64)" <<< "$THIS_MACHINE") +IS_PPC32=$("$GREP" -i -c -E "(Power|PPC)" <<< "$THIS_MACHINE") +IS_PPC64=$("$GREP" -i -c -E "(Power64|PPC64)" <<< "$THIS_MACHINE") +IS_ARM32=$("$GREP" -i -c -E "(arm|aarch32)" <<< "$THIS_MACHINE") +IS_ARM64=$("$GREP" -i -c -E "(arm64|aarch64)" <<< "$THIS_MACHINE") +IS_S390=$("$GREP" -i -c "s390" <<< "$THIS_MACHINE") +IS_SPARC=$("$GREP" -i -c "sparc" <<< "$THIS_MACHINE") IS_X32=0 # Fixup -if [[ "$IS_SOLARIS" -ne "0" ]]; then - DISASS=dis - DISASSARGS=() +if [[ "$IS_PPC64" -ne 0 ]]; then + IS_PPC32=0 +fi + +# Fixup +if [[ "$IS_ARM64" -ne 0 ]]; then + IS_ARM32=0 +fi + +# Fixup +if [[ "$IS_SOLARIS" -ne 0 ]]; then + DISASS=dis + DISASSARGS=() fi # Fixup if [[ "$IS_DARWIN" -ne 0 ]]; then - DISASS=otool - DISASSARGS=("-tV") + DISASS=otool + DISASSARGS=("-tV") fi # CPU features and flags -if [[ ("$IS_X86" -ne "0" || "$IS_X64" -ne "0") ]]; then - if [[ ("$IS_DARWIN" -ne "0") ]]; then - X86_CPU_FLAGS=$(sysctl machdep.cpu.features 2>&1 | cut -f 2 -d ':') - elif [[ ("$IS_SOLARIS" -ne "0") ]]; then - X86_CPU_FLAGS=$(isainfo -v 2>/dev/null) - elif [[ ("$IS_FREEBSD" -ne "0") ]]; then - X86_CPU_FLAGS=$(grep Features /var/run/dmesg.boot) - elif [[ ("$IS_DRAGONFLY" -ne "0") ]]; then - X86_CPU_FLAGS=$(dmesg | grep Features) - elif [[ ("$IS_HURD" -ne "0") ]]; then - : # Do nothing... cpuid is not helpful at the moment - else - X86_CPU_FLAGS="$($AWK '{IGNORECASE=1}{if ($1 == "flags"){print;exit}}' < /proc/cpuinfo | cut -f 2 -d ':')" - fi -elif [[ ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0") ]]; then - if [[ ("$IS_DARWIN" -ne "0") ]]; then - ARM_CPU_FLAGS="$(sysctl machdep.cpu.features 2>&1 | cut -f 2 -d ':')" - else - ARM_CPU_FLAGS="$($AWK '{IGNORECASE=1}{if ($1 == "Features"){print;exit}}' < /proc/cpuinfo | cut -f 2 -d ':')" - fi +if [[ ("$IS_X86" -ne 0 || "$IS_X64" -ne 0) ]]; then + if [[ ("$IS_DARWIN" -ne 0) ]]; then + X86_CPU_FLAGS=$(sysctl machdep.cpu.features 2>&1 | cut -f 2 -d ':') + elif [[ ("$IS_SOLARIS" -ne 0) ]]; then + X86_CPU_FLAGS=$(isainfo -v 2>/dev/null) + elif [[ ("$IS_FREEBSD" -ne 0) ]]; then + X86_CPU_FLAGS=$(grep Features /var/run/dmesg.boot) + elif [[ ("$IS_DRAGONFLY" -ne 0) ]]; then + X86_CPU_FLAGS=$(dmesg | grep Features) + elif [[ ("$IS_HURD" -ne 0) ]]; then + : # Do nothing... cpuid is not helpful at the moment + else + X86_CPU_FLAGS="$($AWK '{IGNORECASE=1}{if ($1 == "flags"){print;exit}}' < /proc/cpuinfo | cut -f 2 -d ':')" + fi +elif [[ ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0) ]]; then + if [[ ("$IS_DARWIN" -ne 0) ]]; then + ARM_CPU_FLAGS="$(sysctl machdep.cpu.features 2>&1 | cut -f 2 -d ':')" + else + ARM_CPU_FLAGS="$($AWK '{IGNORECASE=1}{if ($1 == "Features"){print;exit}}' < /proc/cpuinfo | cut -f 2 -d ':')" + fi fi for ARG in "$@" do - # Recognize "fast" and "quick", which does not perform tests that take more time to execute + # Recognize "fast" and "quick", which does not perform tests that take more time to execute if [[ ($("$GREP" -ix "fast" <<< "$ARG") || $("$GREP" -ix "quick" <<< "$ARG")) ]]; then - HAVE_VALGRIND=0 - WANT_BENCHMARKS=0 - # Recognize "farm" and "nice", which uses 1/2 the CPU cores in accordance with GCC Compile Farm policy - elif [[ ($("$GREP" -ix "farm" <<< "$ARG") || $("$GREP" -ix "nice" <<< "$ARG")) ]]; then - WANT_NICE=1 - elif [[ ($("$GREP" -ix "orig" <<< "$ARG") || $("$GREP" -ix "original" <<< "$ARG") || $("$GREP" -ix "config.h" <<< "$ARG")) ]]; then - git checkout config.h > /dev/null 2>&1 - else - echo "Unknown option $ARG" - fi + HAVE_VALGRIND=0 + WANT_BENCHMARKS=0 + # Recognize "farm" and "nice", which uses 1/2 the CPU cores in accordance with GCC Compile Farm policy + elif [[ ($("$GREP" -ix "farm" <<< "$ARG") || $("$GREP" -ix "nice" <<< "$ARG")) ]]; then + WANT_NICE=1 + elif [[ ($("$GREP" -ix "orig" <<< "$ARG") || $("$GREP" -ix "original" <<< "$ARG") || $("$GREP" -ix "config.h" <<< "$ARG")) ]]; then + git checkout config.h &>/dev/null + else + echo "Unknown option $ARG" + fi done # We need to use the C++ compiler to determine feature availablility. Otherwise # mis-detections occur on a number of platforms. if [[ ((-z "$CXX") || ("$CXX" == "gcc")) ]]; then - if [[ ("$CXX" == "gcc") ]]; then - CXX="g++" - elif [[ "$IS_DARWIN" -ne "0" ]]; then - CXX="c++" - elif [[ "$IS_SOLARIS" -ne "0" ]]; then - if [[ (-e "/opt/developerstudio12.5/bin/CC") ]]; then - CXX="/opt/developerstudio12.5/bin/CC" - elif [[ (-e "/opt/solarisstudio12.4/bin/CC") ]]; then - CXX="/opt/solarisstudio12.4/bin/CC" - elif [[ (-e "/opt/solarisstudio12.3/bin/CC") ]]; then - CXX="/opt/solarisstudio12.3/bin/CC" - elif [[ (-e "/opt/solstudio12.2/bin/CC") ]]; then - CXX="/opt/solstudio12.2/bin/CC" - elif [[ (-e "/opt/solstudio12.1/bin/CC") ]]; then - CXX="/opt/solstudio12.1/bin/CC" - elif [[ (-e "/opt/solstudio12.0/bin/CC") ]]; then - CXX="/opt/solstudio12.0/bin/CC" - elif [[ $(command -v CC 2>/dev/null) ]]; then - CXX="CC" - elif [[ $(command -v g++ 2>/dev/null) ]]; then - CXX="g++" - else - CXX=CC - fi - elif [[ $(command -v g++ 2>/dev/null) ]]; then - CXX="g++" - else - CXX="c++" - fi + if [[ ("$CXX" == "gcc") ]]; then + CXX="g++" + elif [[ "$IS_DARWIN" -ne 0 ]]; then + CXX="c++" + elif [[ "$IS_SOLARIS" -ne 0 ]]; then + if [[ (-e "/opt/developerstudio12.7/bin/CC") ]]; then + CXX="/opt/developerstudio12.7/bin/CC" + elif [[ (-e "/opt/developerstudio12.6/bin/CC") ]]; then + CXX="/opt/developerstudio12.6/bin/CC" + elif [[ (-e "/opt/developerstudio12.5/bin/CC") ]]; then + CXX="/opt/developerstudio12.5/bin/CC" + elif [[ (-e "/opt/solarisstudio12.4/bin/CC") ]]; then + CXX="/opt/solarisstudio12.4/bin/CC" + elif [[ (-e "/opt/solarisstudio12.3/bin/CC") ]]; then + CXX="/opt/solarisstudio12.3/bin/CC" + elif [[ (-e "/opt/solstudio12.2/bin/CC") ]]; then + CXX="/opt/solstudio12.2/bin/CC" + elif [[ (-e "/opt/solstudio12.1/bin/CC") ]]; then + CXX="/opt/solstudio12.1/bin/CC" + elif [[ (-e "/opt/solstudio12.0/bin/CC") ]]; then + CXX="/opt/solstudio12.0/bin/CC" + elif [[ $(command -v CC 2>/dev/null) ]]; then + CXX="CC" + elif [[ $(command -v g++ 2>/dev/null) ]]; then + CXX="g++" + else + CXX=CC + fi + elif [[ $(command -v g++ 2>/dev/null) ]]; then + CXX="g++" + else + CXX="c++" + fi fi SUN_COMPILER=$("$CXX" -V 2>&1 | "$GREP" -i -c -E "CC: (Sun|Studio)") @@ -227,684 +243,708 @@ MACPORTS_COMPILER=$("$CXX" --version 2>&1 | "$GREP" -i -c "MacPorts") CLANG_COMPILER=$("$CXX" --version 2>&1 | "$GREP" -i -c "clang") GNU_LINKER=$(ld --version 2>&1 | "$GREP" -i -c "GNU ld") -if [[ ("$SUN_COMPILER" -eq "0") ]]; then - AMD64=$("$CXX" -dM -E - /dev/null | "$GREP" -i -c -E "(__x64_64__|__amd64__)") - ILP32=$("$CXX" -dM -E - /dev/null | "$GREP" -i -c -E "(__ILP32__|__ILP32)") - if [[ ("$AMD64" -ne "0") && ("$ILP32" -ne "0") ]]; then - IS_X32=1 - fi +if [[ ("$SUN_COMPILER" -eq 0) ]]; then + AMD64=$("$CXX" -dM -E - /dev/null | "$GREP" -i -c -E "(__x64_64__|__amd64__)") + ILP32=$("$CXX" -dM -E - /dev/null | "$GREP" -i -c -E "(__ILP32__|__ILP32)") + if [[ ("$AMD64" -ne 0) && ("$ILP32" -ne 0) ]]; then + IS_X32=1 + fi fi # Now that the compiler is fixed, determine the compiler version for fixups -GCC_51_OR_ABOVE=$("$CXX" -v 2>&1 | "$GREP" -i -c -E 'gcc version (5\.[1-9]|[6-9])') -GCC_48_COMPILER=$("$CXX" -v 2>&1 | "$GREP" -i -c -E 'gcc version 4\.8') -SUNCC_510_OR_ABOVE=$("$CXX" -V 2>&1 | "$GREP" -c -E "CC: (Sun|Studio) .* (5\.1[0-9]|5\.[2-9]|[6-9]\.)") -SUNCC_511_OR_ABOVE=$("$CXX" -V 2>&1 | "$GREP" -c -E "CC: (Sun|Studio) .* (5\.1[1-9]|5\.[2-9]|[6-9]\.)") +CXX_VERSION=$("$CXX" -v 2>&1) +GCC_4_8=$("$GREP" -i -c -E 'gcc version 4\.8' <<< "$CXX_VERSION") +GCC_4_8_OR_ABOVE=$("$GREP" -i -c -E 'gcc version (4\.[8-9]|[5-9]\.[0-9])' <<< "$CXX_VERSION") +GCC_11_0_OR_ABOVE=$("$GREP" -i -c -E 'gcc \(GCC\) (1[1-9]\.|[2-9][0-9]\.)' <<< "$CXX_VERSION") + +CXX_VERSION=$("$CXX" -V 2>&1) +SUNCC_5_10_OR_ABOVE=$("$GREP" -c -E "CC: (Sun|Studio) .* (5\.1[0-9]|5\.[2-9]|[6-9]\.)" <<< "$CXX_VERSION") # Fixup, bad code generation -if [[ ("$SUNCC_510_OR_ABOVE" -ne "0") ]]; then - HAVE_O5=0 - HAVE_OFAST=0 +if [[ ("$SUNCC_5_10_OR_ABOVE" -ne 0) ]]; then + HAVE_OFAST=0 +fi + +# Fixup, Analyzer available in GCC 10.0, but C++ is not planned until GCC 11. +if [[ ("$GCC_COMPILER" -ne 0) && ("$GCC_11_0_OR_ABOVE" -ne 0) ]]; then + HAVE_ANALYZER=0 fi # GCC compile farm is mounted RO -if [[ (-z "$TMPDIR") ]]; then - if [[ (-d "/tmp") ]] && [[ $(touch "/tmp/ok-to-delete" &>/dev/null) ]]; then - TMPDIR=/tmp - elif [[ (-d "/temp") ]]; then - TMPDIR=/temp - elif [[ (-d "$HOME/tmp") ]]; then - TMPDIR="$HOME/tmp" - else - echo "Please set TMPDIR to a valid directory" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 - fi +if [[ (-z "${TMPDIR}") ]]; then + if [[ (-d "/tmp") ]] && [[ $(touch "/tmp/ok-to-delete" &>/dev/null) ]]; then + TMPDIR=/tmp + rm -f "/tmp/ok-to-delete" + elif [[ (-d "/temp") ]]; then + TMPDIR=/temp + elif [[ (-d "$HOME/tmp") ]]; then + TMPDIR="$HOME/tmp" + else + echo "Please set TMPDIR to a valid directory" + exit 1 + fi fi # Make temp if it does not exist -mkdir -p "$TMPDIR" &>/dev/null +mkdir -p "${TMPDIR}" &>/dev/null -# Sun Studio does not allow '-x c++'. Copy it here... -rm -f adhoc.cpp > /dev/null 2>&1 -cp adhoc.cpp.proto adhoc.cpp - -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_CXX17") ]]; then - HAVE_CXX17=0 - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=c++17 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_CXX17=1 - fi + HAVE_CXX17=0 + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -std=c++17 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_CXX17=1 + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_GNU17") ]]; then - HAVE_GNU17=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=gnu++17 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_GNU17=1 - fi + HAVE_GNU17=0 + "$CXX" -std=gnu++17 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_GNU17=1 + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_CXX20") ]]; then - HAVE_CXX20=0 - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=c++20 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_CXX20=1 - fi + HAVE_CXX20=0 + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -std=c++20 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_CXX20=1 + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_GNU20") ]]; then - HAVE_GNU20=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=gnu++20 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_GNU20=1 - fi + HAVE_GNU20=0 + "$CXX" -std=gnu++20 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_GNU20=1 + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_CXX14") ]]; then - HAVE_CXX14=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=c++14 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_CXX14=1 - fi + HAVE_CXX14=0 + "$CXX" -std=c++14 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_CXX14=1 + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_GNU14") ]]; then - HAVE_GNU14=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=gnu++14 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_GNU14=1 - fi + HAVE_GNU14=0 + "$CXX" -std=gnu++14 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_GNU14=1 + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_CXX11") ]]; then - HAVE_CXX11=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=c++11 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_CXX11=1 - fi + HAVE_CXX11=0 + "$CXX" -std=c++11 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_CXX11=1 + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_GNU11") ]]; then - HAVE_GNU11=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=gnu++11 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_GNU11=1 - fi + HAVE_GNU11=0 + "$CXX" -std=gnu++11 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_GNU11=1 + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_CXX03") ]]; then - HAVE_CXX03=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=c++03 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_CXX03=1 - fi + HAVE_CXX03=0 + "$CXX" -std=c++03 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_CXX03=1 + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_GNU03") ]]; then - HAVE_GNU03=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -std=gnu++03 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_GNU03=1 - fi + HAVE_GNU03=0 + "$CXX" -std=gnu++03 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_GNU03=1 + fi +fi + +# Apple M1's do not do the -stdlib=libstdc++ thing +rm -f "${TMPDIR}/test.exe" &>/dev/null +if [[ (-z "$HAVE_LIBSTDCXX") ]]; then + HAVE_LIBSTDCXX=0 + "$CXX" -stdlib=libstdc++ "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_LIBSTDCXX=1 + fi fi # Use a fallback strategy so OPT_O0 can be used with DEBUG_CXXFLAGS OPT_O0= -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -"$CXX" -DCRYPTOPP_ADHOC_MAIN -O0 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -if [[ ("$?" -eq "0") ]]; then - OPT_O0=-O0 +rm -f "${TMPDIR}/test.exe" &>/dev/null +"$CXX" -O0 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null +if [[ ("$?" -eq 0) ]]; then + OPT_O0=-O0 else - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -xO0 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - OPT_O0=-xO0 - fi + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -xO0 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + OPT_O0=-xO0 + fi fi # Use a fallback strategy so OPT_O1 can be used with VALGRIND_CXXFLAGS OPT_O1= -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -"$CXX" -DCRYPTOPP_ADHOC_MAIN -O1 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -if [[ ("$?" -eq "0") ]]; then - HAVE_O1=1 - OPT_O1=-O1 +rm -f "${TMPDIR}/test.exe" &>/dev/null +"$CXX" -O1 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null +if [[ ("$?" -eq 0) ]]; then + HAVE_O1=1 + OPT_O1=-O1 else - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -xO1 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_O1=1 - OPT_O1=-xO1 - fi + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -xO1 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_O1=1 + OPT_O1=-xO1 + fi fi # https://github.com/weidai11/cryptopp/issues/588 OPT_O2= -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -"$CXX" -DCRYPTOPP_ADHOC_MAIN -O2 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -if [[ ("$?" -eq "0") ]]; then - HAVE_O2=1 - OPT_O2=-O2 +rm -f "${TMPDIR}/test.exe" &>/dev/null +"$CXX" -O2 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null +if [[ ("$?" -eq 0) ]]; then + HAVE_O2=1 + OPT_O2=-O2 else - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -xO2 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_O2=1 - OPT_O2=-xO2 - fi + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -xO2 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_O2=1 + OPT_O2=-xO2 + fi fi # Use a fallback strategy so OPT_O3 can be used with RELEASE_CXXFLAGS OPT_O3= -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -"$CXX" -DCRYPTOPP_ADHOC_MAIN -O3 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -if [[ ("$?" -eq "0") ]]; then - HAVE_O3=1 - OPT_O3=-O3 +rm -f "${TMPDIR}/test.exe" &>/dev/null +"$CXX" -O3 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null +if [[ ("$?" -eq 0) ]]; then + HAVE_O3=1 + OPT_O3=-O3 else - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -xO3 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_O3=1 - OPT_O3=-xO3 - fi -fi - -# Hit or miss, mostly hit -if [[ ( (-z "$HAVE_O5") && ("$CLANG_COMPILER" -eq "0") ) ]]; then - HAVE_O5=0 - OPT_O5= - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -O5 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_O5=1 - OPT_O5=-O5 - else - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -xO5 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_O5=1 - OPT_O5=-xO5 - fi - fi + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -xO3 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_O3=1 + OPT_O3=-xO3 + fi fi # Hit or miss, mostly hit if [[ (-z "$HAVE_OS") ]]; then - HAVE_OS=0 - OPT_OS= - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -Os adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_OS=1 - OPT_OS=-Os - fi + HAVE_OS=0 + OPT_OS= + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -Os "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_OS=1 + OPT_OS=-Os + fi +fi + +# Hit or miss, mostly hit +if [[ (-z "$HAVE_OZ") ]]; then + HAVE_OZ=0 + OPT_OZ= + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -Oz "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_OZ=1 + OPT_OZ=-Oz + fi fi # Hit or miss, mostly hit if [[ (-z "$HAVE_OFAST") ]]; then - HAVE_OFAST=0 - OPT_OFAST= - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -Ofast adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_OFAST=1 - OPT_OFAST=-Ofast - fi + HAVE_OFAST=0 + OPT_OFAST= + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -Ofast "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_OFAST=1 + OPT_OFAST=-Ofast + fi fi # Use a fallback strategy so OPT_G2 can be used with RELEASE_CXXFLAGS OPT_G2= -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -"$CXX" -DCRYPTOPP_ADHOC_MAIN -g2 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -if [[ ("$?" -eq "0") ]]; then - OPT_G2=-g2 +rm -f "${TMPDIR}/test.exe" &>/dev/null +"$CXX" -g2 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null +if [[ ("$?" -eq 0) ]]; then + OPT_G2=-g2 else - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -g adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - OPT_G2=-g - fi + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -g "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + OPT_G2=-g + fi fi # Use a fallback strategy so OPT_G3 can be used with DEBUG_CXXFLAGS OPT_G3= -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -"$CXX" -DCRYPTOPP_ADHOC_MAIN -g3 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 -if [[ ("$?" -eq "0") ]]; then - OPT_G3=-g3 +rm -f "${TMPDIR}/test.exe" &>/dev/null +"$CXX" -g3 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null +if [[ ("$?" -eq 0) ]]; then + OPT_G3=-g3 else - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -g adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - OPT_G3=-g - fi + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -g "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + OPT_G3=-g + fi fi # Cygwin and noisy compiles OPT_PIC= -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_PIC") ]]; then - HAVE_PIC=0 - PIC_PROBLEMS=$("$CXX" -DCRYPTOPP_ADHOC_MAIN -fPIC adhoc.cpp -o "$TMPDIR/adhoc.exe" 2>&1 | "$GREP" -i -c -E '(warning|error)') - if [[ "$PIC_PROBLEMS" -eq "0" ]]; then - HAVE_PIC=1 - OPT_PIC=-fPIC - if [[ ("$XLC_COMPILER" -eq "1") ]]; then - OPT_PIC=-qpic - fi - fi + HAVE_PIC=0 + PIC_PROBLEMS=$("$CXX" -fPIC "$test_prog" -o "${TMPDIR}/test.exe" 2>&1 | "$GREP" -i -c -E '(warning|error)') + if [[ "$PIC_PROBLEMS" -eq 0 ]]; then + HAVE_PIC=1 + OPT_PIC=-fPIC + if [[ ("$XLC_COMPILER" -eq 1) ]]; then + OPT_PIC=-qpic + fi + fi fi # GCC 4.8; Clang 3.4 -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_UBSAN") ]]; then - HAVE_UBSAN=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -fsanitize=undefined adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_UBSAN=1 - fi - fi + HAVE_UBSAN=0 + "$CXX" -fsanitize=undefined "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_UBSAN=1 + fi + fi fi # GCC 4.8; Clang 3.4 -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_ASAN") ]]; then - HAVE_ASAN=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -fsanitize=address adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_ASAN=1 - fi - fi + HAVE_ASAN=0 + "$CXX" -fsanitize=address "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_ASAN=1 + fi + fi fi # GCC 6.0; maybe Clang -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_BSAN") ]]; then - HAVE_BSAN=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -fsanitize=bounds-strict adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_BSAN=1 - fi - fi + HAVE_BSAN=0 + "$CXX" -fsanitize=bounds-strict "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_BSAN=1 + fi + fi +fi + +# Analyzer available in GCC 10.0, but C++ is not planned until GCC 11. +# https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10/ +# and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95031#c2. +rm -f "${TMPDIR}/test.exe" &>/dev/null +if [[ (-z "$HAVE_ANALYZER") ]]; then + HAVE_ANALYZER=0 + "$CXX" -fanalyzer "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_ANALYZER=1 + fi + fi fi # GCC 8.0; maybe Clang? -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_CET") ]]; then - HAVE_CET=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -fcf-protection=full -mcet adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_CET=1 - fi - fi + HAVE_CET=0 + "$CXX" -fcf-protection=full -mcet "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_CET=1 + fi + fi fi # Meltdown and Specter. This is the Reptoline fix -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_REPTOLINE") ]]; then - HAVE_REPTOLINE=0 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -mfunction-return=thunk -mindirect-branch=thunk adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_REPTOLINE=1 - fi - fi + HAVE_REPTOLINE=0 + "$CXX" -mfunction-return=thunk -mindirect-branch=thunk "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_REPTOLINE=1 + fi + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_OMP") ]]; then - HAVE_OMP=0 - if [[ "$GCC_COMPILER" -ne "0" ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -fopenmp -O3 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_OMP=1 - OMP_FLAGS=(-fopenmp -O3) - fi - elif [[ "$INTEL_COMPILER" -ne "0" ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -openmp -O3 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_OMP=1 - OMP_FLAGS=(-openmp -O3) - fi - elif [[ "$CLANG_COMPILER" -ne "0" ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -fopenmp=libomp -O3 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_OMP=1 - OMP_FLAGS=(-fopenmp=libomp -O3) - fi - elif [[ "$SUN_COMPILER" -ne "0" ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -xopenmp=parallel -xO3 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_OMP=1 - OMP_FLAGS=(-xopenmp=parallel -xO3) - fi - fi + HAVE_OMP=0 + if [[ "$GCC_COMPILER" -ne 0 ]]; then + "$CXX" -fopenmp -O3 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_OMP=1 + OMP_FLAGS=("-fopenmp" "-O3") + fi + elif [[ "$INTEL_COMPILER" -ne 0 ]]; then + "$CXX" -openmp -O3 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_OMP=1 + OMP_FLAGS=("-openmp" "-O3") + fi + elif [[ "$CLANG_COMPILER" -ne 0 ]]; then + "$CXX" -fopenmp=libomp -O3 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_OMP=1 + OMP_FLAGS=("-fopenmp=libomp" "-O3") + fi + elif [[ "$SUN_COMPILER" -ne 0 ]]; then + "$CXX" -xopenmp=parallel -xO3 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_OMP=1 + OMP_FLAGS=("-xopenmp=parallel" "-xO3") + fi + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_INTEL_MULTIARCH") ]]; then - HAVE_INTEL_MULTIARCH=0 - if [[ ("$IS_DARWIN" -ne "0") && ("$IS_X86" -ne "0" || "$IS_X64" -ne "0") ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -arch i386 -arch x86_64 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_INTEL_MULTIARCH=1 - fi - fi + HAVE_INTEL_MULTIARCH=0 + if [[ ("$IS_DARWIN" -ne 0) && ("$IS_X86" -ne 0 || "$IS_X64" -ne 0) ]]; then + "$CXX" -arch i386 -arch x86_64 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_INTEL_MULTIARCH=1 + fi + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_PPC_MULTIARCH") ]]; then - HAVE_PPC_MULTIARCH=0 - if [[ ("$IS_DARWIN" -ne "0") && ("$IS_PPC32" -ne "0" || "$IS_PPC64" -ne "0") ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -arch ppc -arch ppc64 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_PPC_MULTIARCH=1 - fi - fi + HAVE_PPC_MULTIARCH=0 + if [[ ("$IS_DARWIN" -ne 0) && ("$IS_PPC32" -ne 0 || "$IS_PPC64" -ne 0) ]]; then + "$CXX" -arch ppc -arch ppc64 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_PPC_MULTIARCH=1 + fi + fi fi -rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 +rm -f "${TMPDIR}/test.exe" &>/dev/null if [[ (-z "$HAVE_X32") ]]; then - HAVE_X32=0 - if [[ "$IS_X32" -ne "0" ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -mx32 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_X32=1 - fi - fi + HAVE_X32=0 + if [[ "$IS_X32" -ne 0 ]]; then + "$CXX" -mx32 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_X32=1 + fi + fi fi # Hit or miss, mostly hit if [[ (-z "$HAVE_NATIVE_ARCH") ]]; then - HAVE_NATIVE_ARCH=0 - rm -f "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - "$CXX" -DCRYPTOPP_ADHOC_MAIN -march=native adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ ("$?" -eq "0") ]]; then - HAVE_NATIVE_ARCH=1 - fi + HAVE_NATIVE_ARCH=0 + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -march=native "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ ("$?" -eq 0) ]]; then + HAVE_NATIVE_ARCH=1 + fi fi # ld-gold linker testing if [[ (-z "$HAVE_LDGOLD") ]]; then - HAVE_LDGOLD=0 - LD_GOLD=$(command -v ld.gold 2>/dev/null) - ELF_FILE=$(command -v file 2>/dev/null) - if [[ (! -z "$LD_GOLD") && (! -z "$ELF_FILE") ]]; then - LD_GOLD=$(file "$LD_GOLD" | cut -d":" -f 2 | "$GREP" -i -c "elf") - if [[ ("$LD_GOLD" -ne "0") ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -fuse-ld=gold adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_LDGOLD=1 - fi - fi - fi + HAVE_LDGOLD=0 + LD_GOLD=$(command -v ld.gold 2>/dev/null) + ELF_FILE=$(command -v file 2>/dev/null) + if [[ (-n "$LD_GOLD") && (-n "$ELF_FILE") ]]; then + LD_GOLD=$(file "$LD_GOLD" | cut -d":" -f 2 | "$GREP" -i -c "elf") + if [[ ("$LD_GOLD" -ne 0) ]]; then + "$CXX" -fuse-ld=gold "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_LDGOLD=1 + fi + fi + fi fi # ARMv7 and ARMv8, including NEON, CRC32 and Crypto extensions -if [[ ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0") ]]; then +if [[ ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0) ]]; then - if [[ (-z "$HAVE_ARMV7A" && "$IS_ARM32" -ne "0") ]]; then - HAVE_ARMV7A=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'neon') - if [[ ("$HAVE_ARMV7A" -gt "0") ]]; then HAVE_ARMV7A=1; fi - fi + if [[ (-z "$HAVE_ARMV7A" && "$IS_ARM32" -ne 0) ]]; then + HAVE_ARMV7A=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'neon') + if [[ ("$HAVE_ARMV7A" -gt 0) ]]; then HAVE_ARMV7A=1; fi + fi - if [[ (-z "$HAVE_ARMV8A" && ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0")) ]]; then - HAVE_ARMV8A=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c -E '(asimd|crc|crypto)') - if [[ ("$HAVE_ARMV8A" -gt "0") ]]; then HAVE_ARMV8A=1; fi - fi + if [[ (-z "$HAVE_ARMV8A" && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; then + HAVE_ARMV8A=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c -E '(asimd|crc|crypto)') + if [[ ("$HAVE_ARMV8A" -gt 0) ]]; then HAVE_ARMV8A=1; fi + fi - if [[ (-z "$HAVE_ARM_VFPV3") ]]; then - HAVE_ARM_VFPV3=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'vfpv3') - if [[ ("$HAVE_ARM_VFPV3" -gt "0") ]]; then HAVE_ARM_VFPV3=1; fi - fi + if [[ (-z "$HAVE_ARM_VFPV3") ]]; then + HAVE_ARM_VFPV3=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'vfpv3') + if [[ ("$HAVE_ARM_VFPV3" -gt 0) ]]; then HAVE_ARM_VFPV3=1; fi + fi - if [[ (-z "$HAVE_ARM_VFPV4") ]]; then - HAVE_ARM_VFPV4=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'vfpv4') - if [[ ("$HAVE_ARM_VFPV4" -gt "0") ]]; then HAVE_ARM_VFPV4=1; fi - fi + if [[ (-z "$HAVE_ARM_VFPV4") ]]; then + HAVE_ARM_VFPV4=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'vfpv4') + if [[ ("$HAVE_ARM_VFPV4" -gt 0) ]]; then HAVE_ARM_VFPV4=1; fi + fi - if [[ (-z "$HAVE_ARM_VFPV5") ]]; then - HAVE_ARM_VFPV5=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'fpv5') - if [[ ("$HAVE_ARM_VFPV5" -gt "0") ]]; then HAVE_ARM_VFPV5=1; fi - fi + if [[ (-z "$HAVE_ARM_VFPV5") ]]; then + HAVE_ARM_VFPV5=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'fpv5') + if [[ ("$HAVE_ARM_VFPV5" -gt 0) ]]; then HAVE_ARM_VFPV5=1; fi + fi - if [[ (-z "$HAVE_ARM_VFPD32") ]]; then - HAVE_ARM_VFPD32=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'vfpd32') - if [[ ("$HAVE_ARM_VFPD32" -gt "0") ]]; then HAVE_ARM_VFPD32=1; fi - fi + if [[ (-z "$HAVE_ARM_VFPD32") ]]; then + HAVE_ARM_VFPD32=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'vfpd32') + if [[ ("$HAVE_ARM_VFPD32" -gt 0) ]]; then HAVE_ARM_VFPD32=1; fi + fi - if [[ (-z "$HAVE_ARM_NEON") ]]; then - HAVE_ARM_NEON=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'neon') - if [[ ("$HAVE_ARM_NEON" -gt "0") ]]; then HAVE_ARM_NEON=1; fi - fi + if [[ (-z "$HAVE_ARM_NEON") ]]; then + HAVE_ARM_NEON=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'neon') + if [[ ("$HAVE_ARM_NEON" -gt 0) ]]; then HAVE_ARM_NEON=1; fi + fi - if [[ (-z "$HAVE_ARM_CRYPTO") ]]; then - HAVE_ARM_CRYPTO=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c -E '(aes|pmull|sha1|sha2)') - if [[ ("$HAVE_ARM_CRYPTO" -gt "0") ]]; then HAVE_ARM_CRYPTO=1; fi - fi + if [[ (-z "$HAVE_ARM_CRYPTO") ]]; then + HAVE_ARM_CRYPTO=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c -E '(aes|pmull|sha1|sha2)') + if [[ ("$HAVE_ARM_CRYPTO" -gt 0) ]]; then HAVE_ARM_CRYPTO=1; fi + fi - if [[ (-z "$HAVE_ARM_CRC") ]]; then - HAVE_ARM_CRC=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'crc32') - if [[ ("$HAVE_ARM_CRC" -gt "0") ]]; then HAVE_ARM_CRC=1; fi - fi + if [[ (-z "$HAVE_ARM_CRC") ]]; then + HAVE_ARM_CRC=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'crc32') + if [[ ("$HAVE_ARM_CRC" -gt 0) ]]; then HAVE_ARM_CRC=1; fi + fi fi # Valgrind testing of C++03, C++11, C++14 and C++17 binaries. Valgrind tests take a long time... if [[ (-z "$HAVE_VALGRIND") ]]; then - if [[ $(command -v valgrind 2>/dev/null) ]]; then - HAVE_VALGRIND=1 - fi + if [[ $(command -v valgrind 2>/dev/null) ]]; then + HAVE_VALGRIND=1 + fi fi # Try to find a symbolizer for Asan -if [[ (-z "$HAVE_SYMBOLIZE") && (! -z "$ASAN_SYMBOLIZER_PATH") ]]; then - # Sets default value - if [[ $(command -v asan_symbolize 2>/dev/null) ]]; then - HAVE_SYMBOLIZE=1 - fi - if [[ (("$HAVE_SYMBOLIZE" -ne "0") && (-z "$ASAN_SYMBOLIZE")) ]]; then - ASAN_SYMBOLIZE=asan_symbolize - fi +if [[ (-z "$HAVE_SYMBOLIZE") && (-n "$ASAN_SYMBOLIZER_PATH") ]]; then + # Sets default value + if [[ $(command -v asan_symbolize 2>/dev/null) ]]; then + HAVE_SYMBOLIZE=1 + fi + if [[ (("$HAVE_SYMBOLIZE" -ne 0) && (-z "$ASAN_SYMBOLIZE")) ]]; then + ASAN_SYMBOLIZE=asan_symbolize + fi - # Clang implicitly uses ASAN_SYMBOLIZER_PATH; set it if its not set. - if [[ (-z "$ASAN_SYMBOLIZER_PATH") ]]; then - if [[ $(command -v llvm-symbolizer 2>/dev/null) ]]; then - LLVM_SYMBOLIZER_FOUND=1; - fi - if [[ ("$LLVM_SYMBOLIZER_FOUND" -ne "0") ]]; then - ASAN_SYMBOLIZER_PATH=$(command -v llvm-symbolizer) - export ASAN_SYMBOLIZER_PATH - fi - fi + # Clang implicitly uses ASAN_SYMBOLIZER_PATH; set it if its not set. + if [[ (-z "$ASAN_SYMBOLIZER_PATH") ]]; then + if [[ $(command -v llvm-symbolizer 2>/dev/null) ]]; then + LLVM_SYMBOLIZER_FOUND=1; + fi + if [[ ("$LLVM_SYMBOLIZER_FOUND" -ne 0) ]]; then + ASAN_SYMBOLIZER_PATH=$(command -v llvm-symbolizer) + export ASAN_SYMBOLIZER_PATH + fi + fi fi # Used to disassemble object modules so we can verify some aspects of code generation if [[ (-z "$HAVE_DISASS") ]]; then - echo "int main(int argc, char* argv[]) {return 0;}" > "$TMPDIR/test.cc" - "$CXX" "$TMPDIR/test.cc" -o "$TMPDIR/test.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - "$DISASS" "${DISASSARGS[@]}" "$TMPDIR/test.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - HAVE_DISASS=1 - else - HAVE_DISASS=0 - fi - fi + echo "int main(int argc, char* argv[]) {return 0;}" > "${TMPDIR}/test.cc" + "$CXX" "${TMPDIR}/test.cc" -o "${TMPDIR}/testest.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + "$DISASS" "${DISASSARGS[@]}" "${TMPDIR}/testest.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + HAVE_DISASS=1 + else + HAVE_DISASS=0 + fi + fi fi # LD_LIBRARY_PATH and DYLD_LIBRARY_PATH -if [[ "$IS_LINUX" -ne "0" || "$IS_SOLARIS" -ne "0" || "$IS_BSD" -ne "0" ]]; then +if [[ "$IS_LINUX" -ne 0 || "$IS_SOLARIS" -ne 0 || "$IS_BSD" -ne 0 ]]; then HAVE_LD_LIBRARY_PATH=1 fi -if [[ "$IS_DARWIN" -ne "0" ]]; then +if [[ "$IS_DARWIN" -ne 0 ]]; then HAVE_DYLD_LIBRARY_PATH=1 fi # Fixup... GCC 4.8 ASAN produces false positives under ARM -if [[ ( ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0") && "$GCC_48_COMPILER" -ne "0") ]]; then - HAVE_ASAN=0 +if [[ ( ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0) && "$GCC_4_8" -ne 0) ]]; then + HAVE_ASAN=0 fi # Benchmarks take a long time... if [[ (-z "$WANT_BENCHMARKS") ]]; then - WANT_BENCHMARKS=1 + WANT_BENCHMARKS=1 fi # IBM XL C/C++ compiler fixups. Not sure why it fails to return non-0 on failure... -if [[ "$XLC_COMPILER" -ne "0" ]]; then - HAVE_CXX03=0 - HAVE_GNU03=0 - HAVE_CXX11=0 - HAVE_GNU11=0 - HAVE_CXX14=0 - HAVE_GNU14=0 - HAVE_CXX17=0 - HAVE_GNU17=0 - HAVE_CXX20=0 - HAVE_GNU20=0 - HAVE_OMP=0 - HAVE_CET=0 - HAVE_REPTOLINE=0 - HAVE_ASAN=0 - HAVE_BSAN=0 - HAVE_UBSAN=0 - HAVE_LDGOLD=0 +if [[ "$XLC_COMPILER" -ne 0 ]]; then + HAVE_CXX03=0 + HAVE_GNU03=0 + HAVE_CXX11=0 + HAVE_GNU11=0 + HAVE_CXX14=0 + HAVE_GNU14=0 + HAVE_CXX17=0 + HAVE_GNU17=0 + HAVE_CXX20=0 + HAVE_GNU20=0 + HAVE_OMP=0 + HAVE_CET=0 + HAVE_REPTOLINE=0 + HAVE_ASAN=0 + HAVE_BSAN=0 + HAVE_UBSAN=0 + HAVE_ANALYZER=0 + HAVE_LDGOLD=0 fi ############################################ # System information -echo | tee -a "$TEST_RESULTS" -if [[ "$IS_LINUX" -ne "0" ]]; then - echo "IS_LINUX: $IS_LINUX" | tee -a "$TEST_RESULTS" -elif [[ "$IS_CYGWIN" -ne "0" ]]; then - echo "IS_CYGWIN: $IS_CYGWIN" | tee -a "$TEST_RESULTS" -elif [[ "$IS_MINGW" -ne "0" ]]; then - echo "IS_MINGW: $IS_MINGW" | tee -a "$TEST_RESULTS" -elif [[ "$IS_SOLARIS" -ne "0" ]]; then - echo "IS_SOLARIS: $IS_SOLARIS" | tee -a "$TEST_RESULTS" -elif [[ "$IS_DARWIN" -ne "0" ]]; then - echo "IS_DARWIN: $IS_DARWIN" | tee -a "$TEST_RESULTS" -elif [[ "$IS_AIX" -ne "0" ]]; then - echo "IS_AIX: $IS_AIX" | tee -a "$TEST_RESULTS" +echo "" | tee -a "$TEST_RESULTS" +if [[ "$IS_LINUX" -ne 0 ]]; then + echo "IS_LINUX: $IS_LINUX" | tee -a "$TEST_RESULTS" +elif [[ "$IS_CYGWIN" -ne 0 ]]; then + echo "IS_CYGWIN: $IS_CYGWIN" | tee -a "$TEST_RESULTS" +elif [[ "$IS_MINGW" -ne 0 ]]; then + echo "IS_MINGW: $IS_MINGW" | tee -a "$TEST_RESULTS" +elif [[ "$IS_SOLARIS" -ne 0 ]]; then + echo "IS_SOLARIS: $IS_SOLARIS" | tee -a "$TEST_RESULTS" +elif [[ "$IS_DARWIN" -ne 0 ]]; then + echo "IS_DARWIN: $IS_DARWIN" | tee -a "$TEST_RESULTS" +elif [[ "$IS_AIX" -ne 0 ]]; then + echo "IS_AIX: $IS_AIX" | tee -a "$TEST_RESULTS" fi -if [[ "$IS_PPC64" -ne "0" ]]; then - echo "IS_PPC64: $IS_PPC64" | tee -a "$TEST_RESULTS" -elif [[ "$IS_PPC32" -ne "0" ]]; then - echo "IS_PPC32: $IS_PPC32" | tee -a "$TEST_RESULTS" +if [[ "$IS_PPC64" -ne 0 ]]; then + echo "IS_PPC64: $IS_PPC64" | tee -a "$TEST_RESULTS" +elif [[ "$IS_PPC32" -ne 0 ]]; then + echo "IS_PPC32: $IS_PPC32" | tee -a "$TEST_RESULTS" fi -if [[ "$IS_ARM64" -ne "0" ]]; then - echo "IS_ARM64: $IS_ARM64" | tee -a "$TEST_RESULTS" -elif [[ "$IS_ARM32" -ne "0" ]]; then - echo "IS_ARM32: $IS_ARM32" | tee -a "$TEST_RESULTS" +if [[ "$IS_ARM64" -ne 0 ]]; then + echo "IS_ARM64: $IS_ARM64" | tee -a "$TEST_RESULTS" +elif [[ "$IS_ARM32" -ne 0 ]]; then + echo "IS_ARM32: $IS_ARM32" | tee -a "$TEST_RESULTS" fi -if [[ "$HAVE_ARMV7A" -ne "0" ]]; then - echo "HAVE_ARMV7A: $HAVE_ARMV7A" | tee -a "$TEST_RESULTS" -elif [[ "$HAVE_ARMV8A" -ne "0" ]]; then - echo "HAVE_ARMV8A: $HAVE_ARMV8A" | tee -a "$TEST_RESULTS" +if [[ "$HAVE_ARMV7A" -ne 0 ]]; then + echo "HAVE_ARMV7A: $HAVE_ARMV7A" | tee -a "$TEST_RESULTS" +elif [[ "$HAVE_ARMV8A" -ne 0 ]]; then + echo "HAVE_ARMV8A: $HAVE_ARMV8A" | tee -a "$TEST_RESULTS" fi -if [[ "$HAVE_ARM_NEON" -ne "0" ]]; then - echo "HAVE_ARM_NEON: $HAVE_ARM_NEON" | tee -a "$TEST_RESULTS" +if [[ "$HAVE_ARM_NEON" -ne 0 ]]; then + echo "HAVE_ARM_NEON: $HAVE_ARM_NEON" | tee -a "$TEST_RESULTS" fi -if [[ "$HAVE_ARM_VFPD32" -ne "0" ]]; then - echo "HAVE_ARM_VFPD32: $HAVE_ARM_VFPD32" | tee -a "$TEST_RESULTS" +if [[ "$HAVE_ARM_VFPD32" -ne 0 ]]; then + echo "HAVE_ARM_VFPD32: $HAVE_ARM_VFPD32" | tee -a "$TEST_RESULTS" fi -if [[ "$HAVE_ARM_VFPV3" -ne "0" ]]; then - echo "HAVE_ARM_VFPV3: $HAVE_ARM_VFPV3" | tee -a "$TEST_RESULTS" +if [[ "$HAVE_ARM_VFPV3" -ne 0 ]]; then + echo "HAVE_ARM_VFPV3: $HAVE_ARM_VFPV3" | tee -a "$TEST_RESULTS" fi -if [[ "$HAVE_ARM_VFPV4" -ne "0" ]]; then - echo "HAVE_ARM_VFPV4: $HAVE_ARM_VFPV4" | tee -a "$TEST_RESULTS" +if [[ "$HAVE_ARM_VFPV4" -ne 0 ]]; then + echo "HAVE_ARM_VFPV4: $HAVE_ARM_VFPV4" | tee -a "$TEST_RESULTS" fi -if [[ "$HAVE_ARM_CRC" -ne "0" ]]; then - echo "HAVE_ARM_CRC: $HAVE_ARM_CRC" | tee -a "$TEST_RESULTS" +if [[ "$HAVE_ARM_CRC" -ne 0 ]]; then + echo "HAVE_ARM_CRC: $HAVE_ARM_CRC" | tee -a "$TEST_RESULTS" fi -if [[ "$HAVE_ARM_CRYPTO" -ne "0" ]]; then - echo "HAVE_ARM_CRYPTO: $HAVE_ARM_CRYPTO" | tee -a "$TEST_RESULTS" +if [[ "$HAVE_ARM_CRYPTO" -ne 0 ]]; then + echo "HAVE_ARM_CRYPTO: $HAVE_ARM_CRYPTO" | tee -a "$TEST_RESULTS" fi -if [[ "$IS_X32" -ne "0" ]]; then +if [[ "$IS_X32" -ne 0 ]]; then echo "IS_X32: $IS_X32" | tee -a "$TEST_RESULTS" -elif [[ "$IS_X64" -ne "0" ]]; then - echo "IS_X64: $IS_X64" | tee -a "$TEST_RESULTS" -elif [[ "$IS_X86" -ne "0" ]]; then - echo "IS_X86: $IS_X86" | tee -a "$TEST_RESULTS" +elif [[ "$IS_X64" -ne 0 ]]; then + echo "IS_X64: $IS_X64" | tee -a "$TEST_RESULTS" +elif [[ "$IS_X86" -ne 0 ]]; then + echo "IS_X86: $IS_X86" | tee -a "$TEST_RESULTS" fi -if [[ "$IS_S390" -ne "0" ]]; then +if [[ "$IS_S390" -ne 0 ]]; then echo "IS_S390: $IS_S390" | tee -a "$TEST_RESULTS" fi # C++03, C++11, C++14 and C++17 -echo | tee -a "$TEST_RESULTS" +echo "" | tee -a "$TEST_RESULTS" echo "HAVE_CXX03: $HAVE_CXX03" | tee -a "$TEST_RESULTS" echo "HAVE_GNU03: $HAVE_GNU03" | tee -a "$TEST_RESULTS" echo "HAVE_CXX11: $HAVE_CXX11" | tee -a "$TEST_RESULTS" echo "HAVE_GNU11: $HAVE_GNU11" | tee -a "$TEST_RESULTS" -if [[ ("$HAVE_CXX14" -ne "0" || "$HAVE_CXX17" -ne "0" || "$HAVE_CXX20" -ne "0" || "$HAVE_GNU14" -ne "0" || "$HAVE_GNU17" -ne "0" || "$HAVE_GNU20" -ne "0") ]]; then - echo "HAVE_CXX14: $HAVE_CXX14" | tee -a "$TEST_RESULTS" - echo "HAVE_GNU14: $HAVE_GNU14" | tee -a "$TEST_RESULTS" - echo "HAVE_CXX17: $HAVE_CXX17" | tee -a "$TEST_RESULTS" - echo "HAVE_GNU17: $HAVE_GNU17" | tee -a "$TEST_RESULTS" - echo "HAVE_CXX20: $HAVE_CXX20" | tee -a "$TEST_RESULTS" - echo "HAVE_GNU20: $HAVE_GNU20" | tee -a "$TEST_RESULTS" -fi -if [[ "$HAVE_LDGOLD" -ne "0" ]]; then - echo "HAVE_LDGOLD: $HAVE_LDGOLD" | tee -a "$TEST_RESULTS" -fi -if [[ "$HAVE_UNIFIED_ASM" -ne "0" ]]; then - echo "HAVE_UNIFIED_ASM: $HAVE_UNIFIED_ASM" | tee -a "$TEST_RESULTS" +echo "HAVE_CXX14: $HAVE_CXX14" | tee -a "$TEST_RESULTS" +echo "HAVE_GNU14: $HAVE_GNU14" | tee -a "$TEST_RESULTS" +echo "HAVE_CXX17: $HAVE_CXX17" | tee -a "$TEST_RESULTS" +echo "HAVE_GNU17: $HAVE_GNU17" | tee -a "$TEST_RESULTS" +echo "HAVE_CXX20: $HAVE_CXX20" | tee -a "$TEST_RESULTS" +echo "HAVE_GNU20: $HAVE_GNU20" | tee -a "$TEST_RESULTS" + +if [[ "$HAVE_LDGOLD" -ne 0 ]]; then + echo "HAVE_LDGOLD: $HAVE_LDGOLD" | tee -a "$TEST_RESULTS" fi -# -O3, -O5 and -Os -echo | tee -a "$TEST_RESULTS" +# -O2, -O3, -Os and -Ofast +echo "" | tee -a "$TEST_RESULTS" echo "OPT_O2: $OPT_O2" | tee -a "$TEST_RESULTS" echo "OPT_O3: $OPT_O3" | tee -a "$TEST_RESULTS" -if [[ (! -z "$OPT_O5") || (! -z "$OPT_OS") || (! -z "$OPT_OFAST") ]]; then - echo "OPT_O5: $OPT_O5" | tee -a "$TEST_RESULTS" - echo "OPT_OS: $OPT_OS" | tee -a "$TEST_RESULTS" - echo "OPT_OFAST: $OPT_OFAST" | tee -a "$TEST_RESULTS" +if [[ ("$HAVE_OS" -eq 1) ]]; then + echo "OPT_OS: $OPT_OS" | tee -a "$TEST_RESULTS" +fi +if [[ ("$HAVE_OZ" -eq 1) ]]; then + echo "OPT_OZ: $OPT_OZ" | tee -a "$TEST_RESULTS" +fi +if [[ ("$HAVE_OFAST" -eq 1) ]]; then + echo "OPT_OFAST: $OPT_OFAST" | tee -a "$TEST_RESULTS" fi # Tools available for testing -echo | tee -a "$TEST_RESULTS" -if [[ ((! -z "$HAVE_OMP") && ("$HAVE_OMP" -ne "0")) ]]; then echo "HAVE_OMP: $HAVE_OMP" | tee -a "$TEST_RESULTS"; fi +echo "" | tee -a "$TEST_RESULTS" +if [[ ((-n "$HAVE_OMP") && ("$HAVE_OMP" -ne 0)) ]]; then echo "HAVE_OMP: $HAVE_OMP" | tee -a "$TEST_RESULTS"; fi echo "HAVE_ASAN: $HAVE_ASAN" | tee -a "$TEST_RESULTS" -if [[ ("$HAVE_ASAN" -ne "0") && (! -z "$ASAN_SYMBOLIZE") ]]; then echo "ASAN_SYMBOLIZE: $ASAN_SYMBOLIZE" | tee -a "$TEST_RESULTS"; fi +if [[ ("$HAVE_ASAN" -ne 0) && (-n "$ASAN_SYMBOLIZE") ]]; then echo "ASAN_SYMBOLIZE: $ASAN_SYMBOLIZE" | tee -a "$TEST_RESULTS"; fi echo "HAVE_UBSAN: $HAVE_UBSAN" | tee -a "$TEST_RESULTS" echo "HAVE_BSAN: $HAVE_BSAN" | tee -a "$TEST_RESULTS" echo "HAVE_CET: $HAVE_CET" | tee -a "$TEST_RESULTS" +echo "HAVE_ANALYZER: $HAVE_ANALYZER" | tee -a "$TEST_RESULTS" echo "HAVE_REPTOLINE: $HAVE_REPTOLINE" | tee -a "$TEST_RESULTS" echo "HAVE_VALGRIND: $HAVE_VALGRIND" | tee -a "$TEST_RESULTS" # HAVE_REPTOLINE is for Meltdown and Spectre option testing, called Reptoline (play on trampoline) -if [[ "$HAVE_INTEL_MULTIARCH" -ne "0" ]]; then - echo "HAVE_INTEL_MULTIARCH: $HAVE_INTEL_MULTIARCH" | tee -a "$TEST_RESULTS" +if [[ "$HAVE_INTEL_MULTIARCH" -ne 0 ]]; then + echo "HAVE_INTEL_MULTIARCH: $HAVE_INTEL_MULTIARCH" | tee -a "$TEST_RESULTS" fi -if [[ "$HAVE_PPC_MULTIARCH" -ne "0" ]]; then - echo "HAVE_PPC_MULTIARCH: $HAVE_PPC_MULTIARCH" | tee -a "$TEST_RESULTS" +if [[ "$HAVE_PPC_MULTIARCH" -ne 0 ]]; then + echo "HAVE_PPC_MULTIARCH: $HAVE_PPC_MULTIARCH" | tee -a "$TEST_RESULTS" fi ############################################ @@ -915,94 +955,111 @@ fi CPU_COUNT=1 MEM_SIZE=512 -if [[ ("$IS_SPARC" -ne "0") && ("$IS_LINUX" -ne "0") ]]; then - CPU_COUNT="$($GREP -E 'CPU.*' /proc/cpuinfo | cut -f 1 -d ':' | $SED 's|CPU||g' | sort -n | tail -1)" - MEM_SIZE="$($GREP "MemTotal" < /proc/meminfo | $AWK '{print int($2/1024)}')" +if [[ ("$IS_SPARC" -ne 0) && ("$IS_LINUX" -ne 0) ]]; then + CPU_COUNT="$($GREP -E 'CPU.*' /proc/cpuinfo | cut -f 1 -d ':' | $SED 's|CPU||g' | sort -n | tail -1)" + MEM_SIZE="$($GREP "MemTotal" < /proc/meminfo | $AWK '{print int($2/1024)}')" elif [[ (-e "/proc/cpuinfo") && (-e "/proc/meminfo") ]]; then - CPU_COUNT="$($GREP -c -E "^processor" < /proc/cpuinfo)" - MEM_SIZE="$($GREP "MemTotal" < /proc/meminfo | $AWK '{print int($2/1024)}')" -elif [[ "$IS_DARWIN" -ne "0" ]]; then - CPU_COUNT="$(sysctl -a 2>&1 | $GREP "hw.availcpu" | $AWK '{print $3; exit}')" - MEM_SIZE="$(sysctl -a 2>&1 | $GREP "hw.memsize" | $AWK '{print int($3/1024/1024); exit;}')" -elif [[ "$IS_SOLARIS" -ne "0" ]]; then - CPU_COUNT="$(psrinfo 2>/dev/null | wc -l | $AWK '{print $1}')" - MEM_SIZE="$(prtconf 2>/dev/null | $GREP "Memory" | $AWK '{print int($3)}')" -elif [[ "$IS_AIX" -ne "0" ]]; then - CPU_COUNT="$(bindprocessor -q 2>/dev/null | cut -f 2 -d ":" | wc -w | $AWK '{print $1}')" - MEM_SIZE="$(prtconf -m 2>/dev/null | $GREP "MB" | $AWK '{print int($3); exit;}')" + CPU_COUNT="$($GREP -c -E "^processor" < /proc/cpuinfo)" + MEM_SIZE="$($GREP "MemTotal" < /proc/meminfo | $AWK '{print int($2/1024)}')" +elif [[ "$IS_DARWIN" -ne 0 ]]; then + CPU_COUNT="$(sysctl -a 2>&1 | $GREP "hw.availcpu" | $AWK '{print $3; exit}')" + MEM_SIZE="$(sysctl -a 2>&1 | $GREP "hw.memsize" | $AWK '{print int($3/1024/1024); exit;}')" +elif [[ "$IS_SOLARIS" -ne 0 ]]; then + CPU_COUNT="$(psrinfo 2>/dev/null | wc -l | $AWK '{print $1}')" + MEM_SIZE="$(prtconf 2>/dev/null | $GREP "Memory" | $AWK '{print int($3)}')" +elif [[ "$IS_AIX" -ne 0 ]]; then + CPU_COUNT="$(bindprocessor -q 2>/dev/null | cut -f 2 -d ":" | wc -w | $AWK '{print $1}')" + MEM_SIZE="$(prtconf -m 2>/dev/null | $GREP "MB" | $AWK '{print int($3); exit;}')" fi # Benchmarks expect frequency in GiHz. CPU_FREQ=0.5 if [[ (-e "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq") ]]; then - CPU_FREQ="$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)" - CPU_FREQ="$(echo $CPU_FREQ | $AWK '{print $0/1024/1024; exit}')" + CPU_FREQ="$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)" + CPU_FREQ="$(echo "$CPU_FREQ" | $AWK '{print $0/1024/1024; exit}')" elif [[ (-e "/proc/cpuinfo") ]]; then - CPU_FREQ="$($GREP 'MHz' < /proc/cpuinfo | $AWK '{print $4; exit}')" - if [[ -z "$CPU_FREQ" ]]; then CPU_FREQ=512; fi - CPU_FREQ="$(echo $CPU_FREQ | $AWK '{print $0/1024}')" -elif [[ "$IS_DARWIN" -ne "0" ]]; then - CPU_FREQ="$(sysctl -a 2>&1 | $GREP "hw.cpufrequency" | $AWK '{print ($3); exit;}')" - CPU_FREQ="$(echo $CPU_FREQ | $AWK '{print $0/1024/1024/1024}')" -elif [[ "$IS_SOLARIS" -ne "0" ]]; then - CPU_FREQ="$(psrinfo -v 2>/dev/null | $GREP "MHz" | $AWK '{print $6; exit;}')" - CPU_FREQ="$(echo $CPU_FREQ | $AWK '{print $0/1024}')" -elif [[ "$IS_AIX" -ne "0" ]]; then - CPU_FREQ="$(prtconf -s 2>/dev/null | $GREP "MHz" | $AWK '{print $4; exit;}')" - CPU_FREQ="$(echo $CPU_FREQ | $AWK '{print $0/1024}')" + CPU_FREQ="$($GREP 'MHz' < /proc/cpuinfo | $AWK '{print $4; exit}')" + if [[ -z "$CPU_FREQ" ]]; then CPU_FREQ=512; fi + CPU_FREQ="$(echo "$CPU_FREQ" | $AWK '{print $0/1024}')" +elif [[ "$IS_DARWIN" -ne 0 ]]; then + CPU_FREQ="$(sysctl -a 2>&1 | $GREP "hw.cpufrequency" | $AWK '{print int($3); exit;}')" + CPU_FREQ="$(echo "$CPU_FREQ" | $AWK '{print int($0/1024/1024/1024)}')" +elif [[ "$IS_SOLARIS" -ne 0 ]]; then + CPU_FREQ="$(psrinfo -v 2>/dev/null | $GREP "MHz" | $AWK '{print $6; exit;}')" + CPU_FREQ="$(echo "$CPU_FREQ" | $AWK '{print $0/1024}')" +elif [[ "$IS_AIX" -ne 0 ]]; then + CPU_FREQ="$(prtconf -s 2>/dev/null | $GREP "MHz" | $AWK '{print $4; exit;}')" + CPU_FREQ="$(echo "$CPU_FREQ" | $AWK '{print $0/1024}')" +fi + +# Fixups for later versions of OS X +if [[ "$IS_DARWIN" -ne 0 ]]; then + if [[ (-z "$CPU_COUNT") || ("$CPU_COUNT" -eq 0) ]]; then + CPU_COUNT="$(sysctl -a 2>&1 | $GREP "hw.activecpu" | $AWK '{print $2; exit}')" + fi + if [[ (-z "$MEM_SIZE") || ("$MEM_SIZE" -eq 0) ]]; then + MEM_SIZE="$(sysctl -a 2>&1 | $GREP "hw.memsize" | $AWK '{print int($2/1024/1024); exit;}')" + fi + if [[ (-z "$CPU_FREQ") || ("$CPU_FREQ" -eq 0) ]]; then + CPU_FREQ="$(sysctl -a 2>&1 | $GREP "hw.cpufrequency" | $AWK '{print int($2); exit;}')" + CPU_FREQ="$(echo "$CPU_FREQ" | $AWK '{print int($0/1024/1024/1024)}')" + fi fi # Some ARM devboards cannot use 'make -j N', even with multiple cores and RAM # An 8-core Cubietruck Plus with 2GB RAM experiences OOM kills with '-j 2'. HAVE_SWAP=1 -if [[ "$IS_LINUX" -ne "0" ]]; then - if [[ (-e "/proc/meminfo") ]]; then - SWAP_SIZE="$($GREP 'SwapTotal' < /proc/meminfo | "$AWK" '{print $2}')" - if [[ "$SWAP_SIZE" -eq "0" ]]; then - HAVE_SWAP=0 - fi - else - HAVE_SWAP=0 - fi +if [[ "$IS_LINUX" -ne 0 ]]; then + # If memory is small, then ensure swap space exists + if [[ "$MEM_SIZE" -lt 4096 ]]; then + if [[ (-e "/proc/meminfo") ]]; then + SWAP_SIZE="$($GREP 'SwapTotal' < /proc/meminfo | "$AWK" '{print $2}')" + if [[ "$SWAP_SIZE" -eq 0 ]]; then + HAVE_SWAP=0 + fi + else + HAVE_SWAP=0 + fi + fi fi -echo | tee -a "$TEST_RESULTS" +echo "" | tee -a "$TEST_RESULTS" echo "CPU: $CPU_COUNT logical" | tee -a "$TEST_RESULTS" echo "FREQ: $CPU_FREQ GHz" | tee -a "$TEST_RESULTS" echo "MEM: $MEM_SIZE MB" | tee -a "$TEST_RESULTS" -if [[ ("$CPU_COUNT" -ge "2" && "$MEM_SIZE" -ge "1280" && "$HAVE_SWAP" -ne "0") ]]; then - if [[ ("$WANT_NICE" -eq "1") ]]; then - CPU_COUNT=$(echo -n "$CPU_COUNT 2" | "$AWK" '{print int($1/$2)}') - fi - MAKEARGS=(-j "$CPU_COUNT") - echo "Using $MAKE -j $CPU_COUNT" +if [[ ("$CPU_COUNT" -ge 2 && "$MEM_SIZE" -ge 1280 && "$HAVE_SWAP" -ne 0) ]]; then + if [[ ("$WANT_NICE" -eq 1) ]]; then + CPU_COUNT=$(echo -n "$CPU_COUNT 2" | "$AWK" '{print int($1/$2)}') + fi + MAKEARGS=(-j "$CPU_COUNT") + echo "Using $MAKE -j $CPU_COUNT" fi ############################################ GIT_REPO=$(git branch 2>&1 | "$GREP" -v "fatal" | wc -l | "$AWK" '{print $1; exit;}') -if [[ "$GIT_REPO" -ne "0" ]]; then - GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) - GIT_HASH=$(git rev-parse HEAD 2>/dev/null | cut -c 1-16) +if [[ "$GIT_REPO" -ne 0 ]]; then + GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) + GIT_HASH=$(git rev-parse HEAD 2>/dev/null | cut -c 1-16) fi -echo | tee -a "$TEST_RESULTS" -if [[ ! -z "$GIT_BRANCH" ]]; then - echo "Git branch: $GIT_BRANCH (commit $GIT_HASH)" | tee -a "$TEST_RESULTS" +echo "" | tee -a "$TEST_RESULTS" +if [[ -n "$GIT_BRANCH" ]]; then + echo "Git branch: $GIT_BRANCH (commit $GIT_HASH)" | tee -a "$TEST_RESULTS" fi -if [[ ("$SUN_COMPILER" -ne "0") ]]; then - "$CXX" -V 2>&1 | "$SED" 's|CC:|Compiler:|g' | head -1 | tee -a "$TEST_RESULTS" -elif [[ ("$XLC_COMPILER" -ne "0") ]]; then - echo "Compiler: $($CXX -qversion | head -1)" | tee -a "$TEST_RESULTS" +if [[ ("$SUN_COMPILER" -ne 0) ]]; then + "$CXX" -V 2>&1 | "$SED" 's|CC:|Compiler:|g' | head -1 | tee -a "$TEST_RESULTS" +elif [[ ("$XLC_COMPILER" -ne 0) ]]; then + echo "Compiler: $($CXX -qversion | head -1)" | tee -a "$TEST_RESULTS" else - echo "Compiler: $($CXX --version | head -1)" | tee -a "$TEST_RESULTS" + echo "Compiler: $($CXX --version | head -1)" | tee -a "$TEST_RESULTS" fi CXX_PATH=$(command -v "$CXX" 2>/dev/null) CXX_SYMLINK=$(ls -l "$CXX_PATH" 2>/dev/null | "$GREP" -c '\->' | "$AWK" '{print $1}') -if [[ ("$CXX_SYMLINK" -ne "0") ]]; then CXX_PATH="$CXX_PATH (symlinked)"; fi +if [[ ("$CXX_SYMLINK" -ne 0) ]]; then CXX_PATH="$CXX_PATH (symlinked)"; fi echo "Pathname: $CXX_PATH" | tee -a "$TEST_RESULTS" ############################################ @@ -1013,23 +1070,23 @@ RELEASE_CXXFLAGS="-DNDEBUG $OPT_G2 $OPT_O3" VALGRIND_CXXFLAGS="-DNDEBUG $OPT_G3 $OPT_O1" WARNING_CXXFLAGS=() -if [[ ("$GCC_COMPILER" -ne "0" || "$CLANG_COMPILER" -ne "0") ]]; then - WARNING_CXXFLAGS+=("-Wall" "-Wextra" "-Wno-unknown-pragmas" "-Wstrict-overflow") - WARNING_CXXFLAGS+=("-Wcast-align" "-Wwrite-strings" "-Wformat=2" "-Wformat-security") +if [[ ("$GCC_COMPILER" -ne 0 || "$CLANG_COMPILER" -ne 0) ]]; then + WARNING_CXXFLAGS+=("-Wall" "-Wextra" "-Wno-unknown-pragmas" "-Wstrict-overflow") + WARNING_CXXFLAGS+=("-Wcast-align" "-Wwrite-strings" "-Wformat=2" "-Wformat-security") fi # On PowerPC we test the original Altivec load and store with unaligned data. # Modern compilers generate a warning and recommend the new loads and stores. -if [[ ("$GCC_COMPILER" -ne "0" && ("$IS_PPC32" -ne "0" || "$IS_PPC64" -ne "0") ) ]]; then - WARNING_CXXFLAGS+=("-Wno-deprecated") +if [[ ("$GCC_COMPILER" -ne 0 && ("$IS_PPC32" -ne 0 || "$IS_PPC64" -ne 0) ) ]]; then + WARNING_CXXFLAGS+=("-Wno-deprecated") fi -echo | tee -a "$TEST_RESULTS" +echo "" | tee -a "$TEST_RESULTS" echo "DEBUG_CXXFLAGS: $DEBUG_CXXFLAGS" | tee -a "$TEST_RESULTS" echo "RELEASE_CXXFLAGS: $RELEASE_CXXFLAGS" | tee -a "$TEST_RESULTS" echo "VALGRIND_CXXFLAGS: $VALGRIND_CXXFLAGS" | tee -a "$TEST_RESULTS" -if [[ (! -z "$USER_CXXFLAGS") ]]; then - echo "USER_CXXFLAGS: $USER_CXXFLAGS" | tee -a "$TEST_RESULTS" +if [[ (-n "$USER_CXXFLAGS") ]]; then + echo "USER_CXXFLAGS: $USER_CXXFLAGS" | tee -a "$TEST_RESULTS" fi ############################################# @@ -1039,45 +1096,45 @@ fi ############################################# TEST_BEGIN=$(date) -echo | tee -a "$TEST_RESULTS" +echo "" | tee -a "$TEST_RESULTS" echo "Start time: $TEST_BEGIN" | tee -a "$TEST_RESULTS" ############################################ # Posix NDEBUG and assert if true; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: No Posix NDEBUG or assert" | tee -a "$TEST_RESULTS" - echo + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: No Posix NDEBUG or assert" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("No Posix NDEBUG or assert") - FAILED=0 + TEST_LIST+=("No Posix NDEBUG or assert") + FAILED=0 - # Filter out C++ and Doxygen comments. - COUNT=$(cat ./*.h ./*.cpp | "$GREP" -v '//' | "$GREP" -c -E '(assert.h|cassert)') - if [[ "$COUNT" -ne "0" ]]; then - FAILED=1 - echo "FAILED: found Posix assert headers" | tee -a "$TEST_RESULTS" - fi + # Search for headers. Filter out C++ abd Doxygen comments. + COUNT=$(cat ./*.h ./*.cpp | "$GREP" -v '//' | "$GREP" -c -E '(assert.h|cassert)') + if [[ "$COUNT" -ne 0 ]]; then + FAILED=1 + echo "FAILED: found Posix assert headers" | tee -a "$TEST_RESULTS" + fi - # Filter out C++ and Doxygen comments. - COUNT=$(cat ./*.h ./*.cpp | "$GREP" -v '//' | "$GREP" -c -E 'assert[[:space:]]*\(') - if [[ "$COUNT" -ne "0" ]]; then - FAILED=1 - echo "FAILED: found use of Posix assert" | tee -a "$TEST_RESULTS" - fi + # Search for asserts. Filter out C++, Doxygen comments and static_assert. + COUNT=$(cat ./*.h ./*.cpp | "$GREP" -v -E '//|_assert' | "$GREP" -c -E 'assert[[:space:]]*\(') + if [[ "$COUNT" -ne 0 ]]; then + FAILED=1 + echo "FAILED: found use of Posix assert" | tee -a "$TEST_RESULTS" + fi - # Filter out C++ and Doxygen comments. - COUNT=$(cat ./*.h ./*.cpp | "$GREP" -v '//' | "$GREP" -c 'NDEBUG') - if [[ "$COUNT" -ne "0" ]]; then - FAILED=1 - echo "FAILED: found use of Posix NDEBUG" | tee -a "$TEST_RESULTS" - fi + # Filter out C++ and Doxygen comments. + COUNT=$(cat ./*.h ./*.cpp | "$GREP" -v '//' | "$GREP" -c 'NDEBUG') + if [[ "$COUNT" -ne 0 ]]; then + FAILED=1 + echo "FAILED: found use of Posix NDEBUG" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified no Posix NDEBUG or assert" | tee -a "$TEST_RESULTS" - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified no Posix NDEBUG or assert" | tee -a "$TEST_RESULTS" + fi fi ############################################ @@ -1085,4423 +1142,4533 @@ fi # This is due to Windows.h and NOMINMAX. Linux test fine, while Windows breaks. if true; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: C++ std::min and std::max" | tee -a "$TEST_RESULTS" - echo + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: C++ std::min and std::max" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("C++ std::min and std::max") - FAILED=0 + TEST_LIST+=("C++ std::min and std::max") + FAILED=0 - # If this fires, then use the library's STDMIN(a,b) or (std::min)(a, b); - COUNT=$(cat ./*.h ./*.cpp | "$GREP" -v '//' | "$GREP" -c -E 'std::min[[:space:]]*\(') - if [[ "$COUNT" -ne "0" ]]; then - FAILED=1 - echo "FAILED: found std::min" | tee -a "$TEST_RESULTS" - fi + # If this fires, then use the library's STDMIN(a,b) or (std::min)(a, b); + COUNT=$(cat ./*.h ./*.cpp | "$GREP" -v '//' | "$GREP" -c -E 'std::min[[:space:]]*\(') + if [[ "$COUNT" -ne 0 ]]; then + FAILED=1 + echo "FAILED: found std::min" | tee -a "$TEST_RESULTS" + fi - # If this fires, then use the library's STDMAX(a,b) or (std::max)(a, b); - COUNT=$(cat ./*.h ./*.cpp | "$GREP" -v '//' | "$GREP" -c -E 'std::max[[:space:]]*\(') - if [[ "$COUNT" -ne "0" ]]; then - FAILED=1 - echo "FAILED: found std::max" | tee -a "$TEST_RESULTS" - fi + # If this fires, then use the library's STDMAX(a,b) or (std::max)(a, b); + COUNT=$(cat ./*.h ./*.cpp | "$GREP" -v '//' | "$GREP" -c -E 'std::max[[:space:]]*\(') + if [[ "$COUNT" -ne 0 ]]; then + FAILED=1 + echo "FAILED: found std::max" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified std::min and std::max" | tee -a "$TEST_RESULTS" - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified std::min and std::max" | tee -a "$TEST_RESULTS" + fi fi ############################################ # X86 code generation tests -if [[ ("$HAVE_DISASS" -ne "0" && ("$IS_X86" -ne "0" || "$IS_X64" -ne "0")) ]]; then +if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_X86" -ne 0 || "$IS_X64" -ne 0)) ]]; then - ############################################ - # X86 rotate immediate code generation + ############################################ + # X86 rotate immediate code generation - X86_ROTATE_IMM=1 - if [[ ("$X86_ROTATE_IMM" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: X86 rotate immediate code generation" | tee -a "$TEST_RESULTS" - echo + X86_ROTATE_IMM=1 + if [[ ("$X86_ROTATE_IMM" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: X86 rotate immediate code generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("X86 rotate immediate code generation") + TEST_LIST+=("X86 rotate immediate code generation") - OBJFILE=sha.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=sha.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - X86_SSE2=$(echo -n "$X86_CPU_FLAGS" | "$GREP" -i -c sse2) - X86_SHA256_HASH_BLOCKS=$(echo -n "$DISASS_TEXT" | "$GREP" -c 'SHA256_HashMultipleBlocks_SSE2') - if [[ ("$X86_SHA256_HASH_BLOCKS" -ne "0") ]]; then - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E '(rol.*0x|ror.*0x)') - if [[ ("$COUNT" -le "250") ]]; then - FAILED=1 - echo "ERROR: failed to generate rotate immediate instruction (SHA256_HashMultipleBlocks_SSE2)" | tee -a "$TEST_RESULTS" - fi - else - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E '(rol.*0x|ror.*0x)') - if [[ ("$COUNT" -le "500") ]]; then - FAILED=1 - echo "ERROR: failed to generate rotate immediate instruction" | tee -a "$TEST_RESULTS" - fi - fi + X86_SSE2=$(echo -n "$X86_CPU_FLAGS" | "$GREP" -i -c sse2) + X86_SHA256_HASH_BLOCKS=$(echo -n "$DISASS_TEXT" | "$GREP" -c 'SHA256_HashMultipleBlocks_SSE2') + if [[ ("$X86_SHA256_HASH_BLOCKS" -ne 0) ]]; then + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E '(rol.*0x|ror.*0x)') + if [[ ("$COUNT" -le 250) ]]; then + FAILED=1 + echo "ERROR: failed to generate rotate immediate instruction (SHA256_HashMultipleBlocks_SSE2)" | tee -a "$TEST_RESULTS" + fi + else + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E '(rol.*0x|ror.*0x)') + if [[ ("$COUNT" -le 500) ]]; then + FAILED=1 + echo "ERROR: failed to generate rotate immediate instruction" | tee -a "$TEST_RESULTS" + fi + fi - if [[ ("$X86_SSE2" -ne "0" && "$X86_SHA256_HASH_BLOCKS" -eq "0") ]]; then - echo "ERROR: failed to use SHA256_HashMultipleBlocks_SSE2" | tee -a "$TEST_RESULTS" - fi + if [[ ("$X86_SSE2" -ne 0 && "$X86_SHA256_HASH_BLOCKS" -eq 0) ]]; then + echo "ERROR: failed to use SHA256_HashMultipleBlocks_SSE2" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0" && "$X86_SHA256_HASH_BLOCKS" -ne "0") ]]; then - echo "Verified rotate immediate machine instructions (SHA256_HashMultipleBlocks_SSE2)" | tee -a "$TEST_RESULTS" - elif [[ ("$FAILED" -eq "0") ]]; then - echo "Verified rotate immediate machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0 && "$X86_SHA256_HASH_BLOCKS" -ne 0) ]]; then + echo "Verified rotate immediate machine instructions (SHA256_HashMultipleBlocks_SSE2)" | tee -a "$TEST_RESULTS" + elif [[ ("$FAILED" -eq 0) ]]; then + echo "Verified rotate immediate machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # Test CRC-32C code generation + ############################################ + # Test CRC-32C code generation - "$CXX" -DCRYPTOPP_ADHOC_MAIN -msse4.2 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - X86_CRC32=1 - fi + "$CXX" -msse4.2 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + X86_CRC32=1 + fi - if [[ ("$X86_CRC32" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: X86 CRC32 code generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$X86_CRC32" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: X86 CRC32 code generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("X86 CRC32 code generation") + TEST_LIST+=("X86 CRC32 code generation") - OBJFILE=crc_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=crc_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32b) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate crc32b instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32b) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate crc32b instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32l) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate crc32l instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32l) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate crc32l instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified crc32b and crc32l machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified crc32b and crc32l machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # Test AES-NI code generation + ############################################ + # Test AES-NI code generation - "$CXX" -DCRYPTOPP_ADHOC_MAIN -maes adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - X86_AESNI=1 - fi + "$CXX" -maes "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + X86_AESNI=1 + fi - if [[ ("$X86_AESNI" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: X86 AES-NI code generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$X86_AESNI" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: X86 AES-NI code generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("X86 AES-NI code generation") + TEST_LIST+=("X86 AES-NI code generation") - OBJFILE=rijndael_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=rijndael_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesenc) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate aesenc instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesenc) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate aesenc instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesenclast) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate aesenclast instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesenclast) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate aesenclast instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesdec) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate aesdec instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesdec) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate aesdec instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesdeclast) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate aesdeclast instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesdeclast) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate aesdeclast instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesimc) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate aesimc instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesimc) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate aesimc instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aeskeygenassist) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate aeskeygenassist instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aeskeygenassist) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate aeskeygenassist instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified aesenc, aesenclast, aesdec, aesdeclast, aesimc, aeskeygenassist machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified aesenc, aesenclast, aesdec, aesdeclast, aesimc, aeskeygenassist machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # X86 carryless multiply code generation + ############################################ + # X86 carryless multiply code generation - "$CXX" -DCRYPTOPP_ADHOC_MAIN -mpclmul adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - X86_PCLMUL=1 - fi + "$CXX" -mpclmul "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + X86_PCLMUL=1 + fi - if [[ ("$X86_PCLMUL" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: X86 carryless multiply code generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$X86_PCLMUL" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: X86 carryless multiply code generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("X86 carryless multiply code generation") + TEST_LIST+=("X86 carryless multiply code generation") - OBJFILE=gcm_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=gcm_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E '(pclmulqdq|pclmullqhq|vpclmulqdq)') - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate pclmullqhq instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E '(pclmulqdq|pclmullqhq|vpclmulqdq)') + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate pclmullqhq instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E '(pclmulqdq|pclmullqlq|vpclmulqdq)') - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate pclmullqlq instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E '(pclmulqdq|pclmullqlq|vpclmulqdq)') + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate pclmullqlq instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified pclmullqhq and pclmullqlq machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified pclmullqhq and pclmullqlq machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # Test RDRAND and RDSEED code generation + ############################################ + # Test RDRAND and RDSEED code generation - "$CXX" -DCRYPTOPP_ADHOC_MAIN -mrdrnd adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - X86_RDRAND=1 - fi - "$CXX" -DCRYPTOPP_ADHOC_MAIN -mrdseed adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - X86_RDSEED=1 - fi + "$CXX" -mrdrnd "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + X86_RDRAND=1 + fi + "$CXX" -mrdseed "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + X86_RDSEED=1 + fi - if [[ ("$X86_RDRAND" -ne "0" || "$X86_RDSEED" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: X86 RDRAND and RDSEED code generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$X86_RDRAND" -ne 0 || "$X86_RDSEED" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: X86 RDRAND and RDSEED code generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("X86 RDRAND and RDSEED code generation") + TEST_LIST+=("X86 RDRAND and RDSEED code generation") - OBJFILE=rdrand.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=rdrand.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - if [[ "$X86_RDRAND" -ne "0" ]]; then - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c rdrand) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate rdrand instruction" | tee -a "$TEST_RESULTS" - fi - fi + if [[ "$X86_RDRAND" -ne 0 ]]; then + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c rdrand) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate rdrand instruction" | tee -a "$TEST_RESULTS" + fi + fi - if [[ "$X86_RDSEED" -ne "0" ]]; then - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c rdseed) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate rdseed instruction" | tee -a "$TEST_RESULTS" - fi - fi + if [[ "$X86_RDSEED" -ne 0 ]]; then + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c rdseed) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate rdseed instruction" | tee -a "$TEST_RESULTS" + fi + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified rdrand and rdseed machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified rdrand and rdseed machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # X86 SHA code generation + ############################################ + # X86 SHA code generation - "$CXX" -DCRYPTOPP_ADHOC_MAIN -msha adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - X86_SHA=1 - fi + "$CXX" -msha "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + X86_SHA=1 + fi - if [[ ("$X86_SHA" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: X86 SHA code generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$X86_SHA" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: X86 SHA code generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("X86 SHA code generation") + TEST_LIST+=("X86 SHA code generation") - OBJFILE=sha_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=sha_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1rnds4) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha1rnds4 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1rnds4) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha1rnds4 instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1nexte) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha1nexte instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1nexte) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha1nexte instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1msg1) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha1msg1 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1msg1) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha1msg1 instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1msg2) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha1msg2 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1msg2) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha1msg2 instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256rnds2) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha256rnds2 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256rnds2) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha256rnds2 instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256msg1) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha256msg1 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256msg1) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha256msg1 instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256msg2) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha256msg2 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256msg2) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha256msg2 instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified sha1rnds4, sha1nexte, sha1msg1, sha1msg2, sha256rnds2, sha256msg1 and sha256msg2 machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified sha1rnds4, sha1nexte, sha1msg1, sha1msg2, sha256rnds2, sha256msg1 and sha256msg2 machine instructions" | tee -a "$TEST_RESULTS" + fi + fi fi ############################################ # ARM code generation tests -if [[ ("$HAVE_DISASS" -ne "0" && ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0")) ]]; then +if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; then - ############################################ - # ARM NEON code generation + ############################################ + # ARM NEON code generation - ARM_NEON=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c -E '(neon|asimd)') - if [[ ("$ARM_NEON" -ne "0" || "$HAVE_ARM_NEON" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: ARM NEON code generation" | tee -a "$TEST_RESULTS" - echo + ARM_NEON=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c -E '(neon|asimd)') + if [[ ("$ARM_NEON" -ne 0 || "$HAVE_ARM_NEON" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: ARM NEON code generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("ARM NEON code generation") + TEST_LIST+=("ARM NEON code generation") - OBJFILE=aria_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=aria_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - if [[ ("$HAVE_ARMV8A" -ne "0") ]]; then - # ARIA::UncheckedKeySet: 4 ldr q{N} - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'ldr[[:space:]]*q') - if [[ ("$COUNT" -lt "4") ]]; then - FAILED=1 - echo "ERROR: failed to generate NEON load instructions" | tee -a "$TEST_RESULTS" - fi - else # ARMv7 - # ARIA::UncheckedKeySet: 4 vld1.32 {d1,d2} - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vld1.32[[:space:]]*{') - if [[ ("$COUNT" -lt "4") ]]; then - FAILED=1 - echo "ERROR: failed to generate NEON load instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$HAVE_ARMV8A" -ne 0) ]]; then + # ARIA::UncheckedKeySet: 4 ldr q{N} + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'ldr[[:space:]]*q') + if [[ ("$COUNT" -lt 4) ]]; then + FAILED=1 + echo "ERROR: failed to generate NEON load instructions" | tee -a "$TEST_RESULTS" + fi + else # ARMv7 + # ARIA::UncheckedKeySet: 4 vld1.32 {d1,d2} + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vld1.32[[:space:]]*{') + if [[ ("$COUNT" -lt 4) ]]; then + FAILED=1 + echo "ERROR: failed to generate NEON load instructions" | tee -a "$TEST_RESULTS" + fi + fi - if [[ ("$HAVE_ARMV8A" -ne "0") ]]; then - # ARIA::UncheckedKeySet: 17 str q{N} - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'str[[:space:]]*q') - if [[ ("$COUNT" -lt "16") ]]; then - FAILED=1 - echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS" - fi - else - # ARIA::UncheckedKeySet: 17 vstr1.32 {d1,d2} - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vst1.32[[:space:]]*{') - if [[ ("$COUNT" -lt "16") ]]; then - FAILED=1 - echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$HAVE_ARMV8A" -ne 0) ]]; then + # ARIA::UncheckedKeySet: 17 str q{N} + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'str[[:space:]]*q') + if [[ ("$COUNT" -lt 16) ]]; then + FAILED=1 + echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS" + fi + else + # ARIA::UncheckedKeySet: 17 vstr1.32 {d1,d2} + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vst1.32[[:space:]]*{') + if [[ ("$COUNT" -lt 16) ]]; then + FAILED=1 + echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS" + fi + fi - if [[ ("$HAVE_ARMV8A" -ne "0") ]]; then - # ARIA::UncheckedKeySet: 17 shl v{N} - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'shl[[:space:]]*v') - if [[ ("$COUNT" -lt "16") ]]; then - FAILED=1 - echo "ERROR: failed to generate NEON shift left instructions" | tee -a "$TEST_RESULTS" - fi - else - # ARIA::UncheckedKeySet: 17 vshl - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vshl') - if [[ ("$COUNT" -lt "16") ]]; then - FAILED=1 - echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$HAVE_ARMV8A" -ne 0) ]]; then + # ARIA::UncheckedKeySet: 17 shl v{N} + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'shl[[:space:]]*v') + if [[ ("$COUNT" -lt 16) ]]; then + FAILED=1 + echo "ERROR: failed to generate NEON shift left instructions" | tee -a "$TEST_RESULTS" + fi + else + # ARIA::UncheckedKeySet: 17 vshl + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vshl') + if [[ ("$COUNT" -lt 16) ]]; then + FAILED=1 + echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS" + fi + fi - if [[ ("$HAVE_ARMV8A" -ne "0") ]]; then - # ARIA::UncheckedKeySet: 17 shr v{N} - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'shr[[:space:]]*v') - if [[ ("$COUNT" -lt "16") ]]; then - FAILED=1 - echo "ERROR: failed to generate NEON shift left instructions" | tee -a "$TEST_RESULTS" - fi - else - # ARIA::UncheckedKeySet: 17 vshr - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vshr') - if [[ ("$COUNT" -lt "16") ]]; then - FAILED=1 - echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$HAVE_ARMV8A" -ne 0) ]]; then + # ARIA::UncheckedKeySet: 17 shr v{N} + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'shr[[:space:]]*v') + if [[ ("$COUNT" -lt 16) ]]; then + FAILED=1 + echo "ERROR: failed to generate NEON shift left instructions" | tee -a "$TEST_RESULTS" + fi + else + # ARIA::UncheckedKeySet: 17 vshr + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vshr') + if [[ ("$COUNT" -lt 16) ]]; then + FAILED=1 + echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS" + fi + fi - if [[ ("$HAVE_ARMV8A" -ne "0") ]]; then - # ARIA::UncheckedKeySet: 12 ext v{N} - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'ext[[:space:]]*v') - if [[ ("$COUNT" -lt "12") ]]; then - FAILED=1 - echo "ERROR: failed to generate NEON extract instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$HAVE_ARMV8A" -ne 0) ]]; then + # ARIA::UncheckedKeySet: 12 ext v{N} + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'ext[[:space:]]*v') + if [[ ("$COUNT" -lt 12) ]]; then + FAILED=1 + echo "ERROR: failed to generate NEON extract instructions" | tee -a "$TEST_RESULTS" + fi + fi - # ARIA::UncheckedKeySet: 17 veor - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'eor.*v|veor') - if [[ ("$COUNT" -lt "16") ]]; then - FAILED=1 - echo "ERROR: failed to generate NEON xor instructions" | tee -a "$TEST_RESULTS" - fi + # ARIA::UncheckedKeySet: 17 veor + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'eor.*v|veor') + if [[ ("$COUNT" -lt 16) ]]; then + FAILED=1 + echo "ERROR: failed to generate NEON xor instructions" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified NEON load, store, shfit left, shift right, xor machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified NEON load, store, shfit left, shift right, xor machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # ARM CRC32 code generation + ############################################ + # ARM CRC32 code generation - "$CXX" -DCRYPTOPP_ADHOC_MAIN -march=armv8-a+crc adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - ARM_CRC32=1 - fi + "$CXX" -march=armv8-a+crc "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + ARM_CRC32=1 + fi - if [[ ("$HAVE_ARMV8A" -ne "0" && "$ARM_CRC32" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: ARM CRC32 code generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$HAVE_ARMV8A" -ne 0 && "$ARM_CRC32" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: ARM CRC32 code generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("ARM CRC32 code generation") + TEST_LIST+=("ARM CRC32 code generation") - OBJFILE=crc_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=crc_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32cb) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate crc32cb instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32cb) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate crc32cb instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32cw) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate crc32cw instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32cw) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate crc32cw instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32b) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate crc32b instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32b) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate crc32b instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32w) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate crc32w instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c crc32w) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate crc32w instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified crc32cb, crc32cw, crc32b and crc32w machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified crc32cb, crc32cw, crc32b and crc32w machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # ARM carryless multiply code generation + ############################################ + # ARM carryless multiply code generation - "$CXX" -DCRYPTOPP_ADHOC_MAIN -march=armv8-a+crypto adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - ARM_PMULL=1 - fi + "$CXX" -march=armv8-a+crypto "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + ARM_PMULL=1 + fi - if [[ ("$HAVE_ARMV8A" -ne "0" && "$ARM_PMULL" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: ARM carryless multiply code generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$HAVE_ARMV8A" -ne 0 && "$ARM_PMULL" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: ARM carryless multiply code generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("ARM carryless multiply code generation") + TEST_LIST+=("ARM carryless multiply code generation") - OBJFILE=gcm_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=gcm_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -v pmull2 | "$GREP" -i -c pmull) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate pmull instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -v pmull2 | "$GREP" -i -c pmull) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate pmull instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c pmull2) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate pmull2 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c pmull2) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate pmull2 instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified pmull and pmull2 machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified pmull and pmull2 machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # ARM AES code generation + ############################################ + # ARM AES code generation - "$CXX" -DCRYPTOPP_ADHOC_MAIN -march=armv8-a+crypto adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - ARM_AES=1 - fi + "$CXX" -march=armv8-a+crypto "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + ARM_AES=1 + fi - if [[ ("$HAVE_ARMV8A" -ne "0" && "$ARM_AES" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: ARM AES generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$HAVE_ARMV8A" -ne 0 && "$ARM_AES" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: ARM AES generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("ARM AES generation") + TEST_LIST+=("ARM AES generation") - OBJFILE=rijndael_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=rijndael_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aese) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate aese instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aese) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate aese instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesmc) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate aesmc instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesmc) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate aesmc instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesd) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate aesd instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesd) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate aesd instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesimc) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate aesimc instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c aesimc) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate aesimc instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified aese, aesd, aesmc, aesimc machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified aese, aesd, aesmc, aesimc machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # ARM SHA code generation + ############################################ + # ARM SHA code generation - "$CXX" -DCRYPTOPP_ADHOC_MAIN -march=armv8-a+crypto adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - ARM_SHA=1 - fi + "$CXX" -march=armv8-a+crypto "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + ARM_SHA=1 + fi - if [[ ("$HAVE_ARMV8A" -ne "0" && "$ARM_SHA" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: ARM SHA generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$HAVE_ARMV8A" -ne 0 && "$ARM_SHA" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: ARM SHA generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("ARM SHA generation") + TEST_LIST+=("ARM SHA generation") - OBJFILE=sha_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=sha_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1c) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha1c instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1c) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha1c instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1m) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha1m instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1m) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha1m instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1p) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha1p instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1p) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha1p instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1h) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha1h instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1h) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha1h instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1su0) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha1su0 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1su0) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha1su0 instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1su1) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha1su1 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha1su1) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha1su1 instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -v sha256h2 | "$GREP" -i -c sha256h) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha256h instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -v sha256h2 | "$GREP" -i -c sha256h) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha256h instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256h2) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha256h2 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256h2) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha256h2 instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256su0) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha256su0 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256su0) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha256su0 instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256su1) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate sha256su1 instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c sha256su1) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate sha256su1 instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified sha1c, sha1m, sha1p, sha1su0, sha1su1, sha256h, sha256h2, sha256su0, sha256su1 machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified sha1c, sha1m, sha1p, sha1su0, sha1su1, sha256h, sha256h2, sha256su0, sha256su1 machine instructions" | tee -a "$TEST_RESULTS" + fi + fi fi ############################################ # Power8 code generation tests -if [[ ("$HAVE_DISASS" -ne "0" && ("$IS_PPC32" -ne "0" || "$IS_PPC64" -ne "0")) ]]; then +if [[ ("$HAVE_DISASS" -ne 0 && "$GCC_4_8_OR_ABOVE" -ne 0 && ("$IS_PPC32" -ne 0 || "$IS_PPC64" -ne 0)) ]]; then - ############################################ - # Power8 AES + ############################################ + # Power8 AES - PPC_AES=0 - if [[ ("$PPC_AES" -eq "0") ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -mcpu=power8 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - PPC_AES=1 - PPC_AES_FLAGS="-mcpu=power8" - fi - fi - if [[ ("$PPC_AES" -eq "0") ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -qarch=pwr8 -qaltivec adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - PPC_AES=1 - PPC_AES_FLAGS="-qarch=pwr8 -qaltivec" - fi - fi + PPC_AES=0 + if [[ ("$PPC_AES" -eq 0) ]]; then + "$CXX" -mcpu=power8 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + PPC_AES=1 + PPC_AES_FLAGS="-mcpu=power8" + fi + fi + if [[ ("$PPC_AES" -eq 0) ]]; then + "$CXX" -qarch=pwr8 -qaltivec "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + PPC_AES=1 + PPC_AES_FLAGS="-qarch=pwr8 -qaltivec" + fi + fi - if [[ ("$PPC_AES" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Power8 AES generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$PPC_AES" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Power8 AES generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Power8 AES generation") + TEST_LIST+=("Power8 AES generation") - OBJFILE=rijndael_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS $PPC_AES_FLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=rijndael_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS $PPC_AES_FLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -v vcipherlast | "$GREP" -i -c vcipher) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate vcipher instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -v vcipherlast | "$GREP" -i -c vcipher) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate vcipher instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vcipherlast) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate vcipherlast instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vcipherlast) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate vcipherlast instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -v vncipherlast | "$GREP" -i -c vncipher) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate vncipher instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -v vncipherlast | "$GREP" -i -c vncipher) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate vncipher instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vncipherlast) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate vncipherlast instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vncipherlast) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate vncipherlast instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified vcipher, vcipherlast,vncipher, vncipherlast machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified vcipher, vcipherlast,vncipher, vncipherlast machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # Power8 SHA + ############################################ + # Power8 SHA - PPC_SHA=0 - if [[ ("$PPC_SHA" -eq "0") ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -mcpu=power8 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - PPC_SHA=1 - PPC_SHA_FLAGS="-mcpu=power8" - fi - fi - if [[ ("$PPC_SHA" -eq "0") ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -qarch=pwr8 -qaltivec adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - PPC_SHA=1 - PPC_SHA_FLAGS="-qarch=pwr8 -qaltivec" - fi - fi + PPC_SHA=0 + if [[ ("$PPC_SHA" -eq 0) ]]; then + "$CXX" -mcpu=power8 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + PPC_SHA=1 + PPC_SHA_FLAGS="-mcpu=power8" + fi + fi + if [[ ("$PPC_SHA" -eq 0) ]]; then + "$CXX" -qarch=pwr8 -qaltivec "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + PPC_SHA=1 + PPC_SHA_FLAGS="-qarch=pwr8 -qaltivec" + fi + fi - if [[ ("$PPC_SHA" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Power8 SHA generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$PPC_SHA" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Power8 SHA generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Power8 SHA generation") + TEST_LIST+=("Power8 SHA generation") - OBJFILE=sha_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS $PPC_SHA_FLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=sha_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS $PPC_SHA_FLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vshasigmaw) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate vshasigmaw instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vshasigmaw) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate vshasigmaw instruction" | tee -a "$TEST_RESULTS" + fi - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vshasigmad) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate vshasigmad instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vshasigmad) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate vshasigmad instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified vshasigmaw and vshasigmad machine instructions" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified vshasigmaw and vshasigmad machine instructions" | tee -a "$TEST_RESULTS" + fi + fi - ############################################ - # Power8 VMULL + ############################################ + # Power8 VMULL - PPC_VMULL=0 - if [[ ("$PPC_VMULL" -eq "0") ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -mcpu=power8 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - PPC_VMULL=1 - PPC_VMULL_FLAGS="-mcpu=power8" - fi - fi - if [[ ("$PPC_VMULL" -eq "0") ]]; then - "$CXX" -DCRYPTOPP_ADHOC_MAIN -qarch=pwr8 adhoc.cpp -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then - PPC_VMULL=1 - PPC_VMULL_FLAGS="-qarch=pwr8" - fi - fi + PPC_VMULL=0 + if [[ ("$PPC_VMULL" -eq 0) ]]; then + "$CXX" -mcpu=power8 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + PPC_VMULL=1 + PPC_VMULL_FLAGS="-mcpu=power8" + fi + fi + if [[ ("$PPC_VMULL" -eq 0) ]]; then + "$CXX" -qarch=pwr8 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + PPC_VMULL=1 + PPC_VMULL_FLAGS="-qarch=pwr8" + fi + fi - if [[ ("$PPC_VMULL" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Power8 carryless multiply generation" | tee -a "$TEST_RESULTS" - echo + if [[ ("$PPC_VMULL" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Power8 carryless multiply generation" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Power8 carryless multiply generation") + TEST_LIST+=("Power8 carryless multiply generation") - OBJFILE=gcm_simd.o; rm -f "$OBJFILE" 2>/dev/null - CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS $PPC_VMULL_FLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" + OBJFILE=gcm_simd.o; rm -f "$OBJFILE" 2>/dev/null + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS $PPC_VMULL_FLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS" - COUNT=0 - FAILED=0 - DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) + COUNT=0 + FAILED=0 + DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null) - COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vpmsum) - if [[ ("$COUNT" -eq "0") ]]; then - FAILED=1 - echo "ERROR: failed to generate vpmsum instruction" | tee -a "$TEST_RESULTS" - fi + COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vpmsum) + if [[ ("$COUNT" -eq 0) ]]; then + FAILED=1 + echo "ERROR: failed to generate vpmsum instruction" | tee -a "$TEST_RESULTS" + fi - if [[ ("$FAILED" -eq "0") ]]; then - echo "Verified vpmsum machine instruction" | tee -a "$TEST_RESULTS" - fi - fi + if [[ ("$FAILED" -eq 0) ]]; then + echo "Verified vpmsum machine instruction" | tee -a "$TEST_RESULTS" + fi + fi fi ############################################ # Default CXXFLAGS if true; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, default CXXFLAGS" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, default CXXFLAGS" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, default CXXFLAGS") + TEST_LIST+=("Debug, default CXXFLAGS") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_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" - # Stop now if things are broke - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 - 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" - # Stop now if things are broke - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 - 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" - # Stop now if things are broke - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 - fi - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + exit 1 + 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" + # Stop now if things are broke + exit 1 + 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" + # Stop now if things are broke + exit 1 + fi + fi - ############################################ - # Release build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, default CXXFLAGS" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, default CXXFLAGS" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, default CXXFLAGS") + TEST_LIST+=("Release, default CXXFLAGS") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_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" - # Stop now if things are broke - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 - 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" - # Stop now if things are broke - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 - 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" - # Stop now if things are broke - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 - fi - echo - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + # Stop now if things are broke + exit 1 + 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" + # Stop now if things are broke + exit 1 + 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" + # Stop now if things are broke + exit 1 + fi + echo + fi fi ############################################ # Shared Objects -if [[ "$HAVE_LD_LIBRARY_PATH" -ne "0" ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, shared object" | tee -a "$TEST_RESULTS" - echo +if [[ "$HAVE_LD_LIBRARY_PATH" -ne 0 ]]; then + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, shared object" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, shared object") + TEST_LIST+=("Debug, shared object") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - # Create a new makefile based on the old one - "$SED" -e 's|\./libcryptopp.a|\./libcryptopp.so|g' -e 's|cryptest.exe: libcryptopp.a|cryptest.exe: libcryptopp.so|g' GNUmakefile > GNUmakefile.shared + CXX="$CXX" CXXFLAGS="$DEBUG_CXXFLAGS" LINK_LIBRARY=libcryptopp.so \ + "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - CXXFLAGS="$DEBUG_CXXFLAGS" - DYN_MAKEARGS=("-f" "GNUmakefile.shared" "HAS_SOLIB_VERSION=0" "${MAKEARGS[@]}") - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${DYN_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 + LD_LIBRARY_PATH="." ./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 + LD_LIBRARY_PATH="." ./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 - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - LD_LIBRARY_PATH="." ./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 - LD_LIBRARY_PATH="." ./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 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, shared object" | tee -a "$TEST_RESULTS" + echo - ############################################ - # Release build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, shared object" | tee -a "$TEST_RESULTS" - echo + TEST_LIST+=("Release, shared object") - TEST_LIST+=("Release, shared object") + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" LINK_LIBRARY=libcryptopp.so \ + "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - CXXFLAGS="$RELEASE_CXXFLAGS" - DYN_MAKEARGS=("-f" "GNUmakefile.shared" "HAS_SOLIB_VERSION=0" "${MAKEARGS[@]}") - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${DYN_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 - LD_LIBRARY_PATH="." ./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 - LD_LIBRARY_PATH="." ./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 - echo - fi - - rm -f GNUmakefile.shared > /dev/null 2>&1 + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + LD_LIBRARY_PATH="." ./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 + LD_LIBRARY_PATH="." ./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 + echo + fi fi ############################################ # Dynamic Objects on Darwin -if [[ "$HAVE_DYLD_LIBRARY_PATH" -ne "0" ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, dynamic library" | tee -a "$TEST_RESULTS" - echo +if [[ "$HAVE_DYLD_LIBRARY_PATH" -ne 0 ]]; then + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, dynamic library" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, dynamic library") + TEST_LIST+=("Debug, dynamic library") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - # Create a new makefile based on the old one - "$SED" -e 's|\./libcryptopp.a|\./libcryptopp.dylib|g' -e 's|cryptest.exe: libcryptopp.a|cryptest.exe: libcryptopp.dylib|g' GNUmakefile > GNUmakefile.shared + CXX="$CXX" CXXFLAGS="$DEBUG_CXXFLAGS" LINK_LIBRARY=libcryptopp.dylib \ + "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - CXXFLAGS="$DEBUG_CXXFLAGS" - DYN_MAKEARGS=("-f" "GNUmakefile.shared" "HAS_SOLIB_VERSION=0" "${MAKEARGS[@]}") - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${DYN_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 + DYLD_LIBRARY_PATH="." ./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 + DYLD_LIBRARY_PATH="." ./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 - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - DYLD_LIBRARY_PATH="." ./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 - DYLD_LIBRARY_PATH="." ./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 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, dynamic library" | tee -a "$TEST_RESULTS" + echo - ############################################ - # Release build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, dynamic library" | tee -a "$TEST_RESULTS" - echo + TEST_LIST+=("Release, dynamic library") - TEST_LIST+=("Release, dynamic library") + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" LINK_LIBRARY=libcryptopp.dylib \ + "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" - CXXFLAGS="$RELEASE_CXXFLAGS" - DYN_MAKEARGS=("-f" "GNUmakefile.shared" "HAS_SOLIB_VERSION=0" "${MAKEARGS[@]}") - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${DYN_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 - DYLD_LIBRARY_PATH="." ./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 - DYLD_LIBRARY_PATH="." ./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 - echo - fi - - rm -f GNUmakefile.shared > /dev/null 2>&1 + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + DYLD_LIBRARY_PATH="." ./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 + DYLD_LIBRARY_PATH="." ./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 + echo + fi fi ############################################ # Debian specific. -if [[ ("$IS_DEBIAN" -ne "0" || "$IS_UBUNTU" -ne "0") ]]; then +if [[ ("$IS_DEBIAN" -ne 0 || "$IS_UBUNTU" -ne 0) ]]; then - # Flags taken from Debian's build logs - # https://buildd.debian.org/status/fetch.php?pkg=libcrypto%2b%2b&arch=i386&ver=5.6.4-6 - # https://buildd.debian.org/status/fetch.php?pkg=libcrypto%2b%2b&arch=kfreebsd-amd64&ver=5.6.4-6&stamp=1482663138 + # Flags taken from Debian's build logs + # https://buildd.debian.org/status/fetch.php?pkg=libcrypto%2b%2b&arch=i386&ver=5.6.4-6 + # https://buildd.debian.org/status/fetch.php?pkg=libcrypto%2b%2b&arch=kfreebsd-amd64&ver=5.6.4-6&stamp=1482663138 - DEBIAN_FLAGS=("-DHAVE_CONFIG_H" "-I." "-Wdate-time" "-D_FORTIFY_SOURCE=2" "-g" "-O2" - "-fstack-protector-strong" "-Wformat -Werror=format-security" "-DCRYPTOPP_INIT_PRIORITY=250" - "-DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS" "-DNDEBUG" "-fPIC" "-DPIC") + DEBIAN_FLAGS=("-DHAVE_CONFIG_H" "-I." "-Wdate-time" "-D_FORTIFY_SOURCE=2" "-g" "-O2" + "-fstack-protector-strong" "-Wformat -Werror=format-security" "-DCRYPTOPP_INIT_PRIORITY=250" + "-DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS" "-DNDEBUG" "-fPIC" "-DPIC") - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debian standard build" | tee -a "$TEST_RESULTS" - echo + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debian standard build" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debian standard build") + TEST_LIST+=("Debian standard build") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXX="g++" "$MAKE" "${MAKEARGS[@]}" CXXFLAGS="${DEBIAN_FLAGS[*]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXX="g++" "$MAKE" "${MAKEARGS[@]}" CXXFLAGS="${DEBIAN_FLAGS[*]}" 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 + 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 fi ############################################ # Fedora specific. -if [[ ("$IS_FEDORA" -ne "0") ]]; then +if [[ ("$IS_FEDORA" -ne 0) ]]; then - # Flags taken from Fedora's build logs - # https://kojipkgs.fedoraproject.org//packages/cryptopp/5.6.3/8.fc27/data/logs/i686/build.log - # https://kojipkgs.fedoraproject.org//packages/cryptopp/5.6.3/8.fc27/data/logs/x86_64/build.log - if [[ ("$IS_X86" -ne "0") ]]; then - MARCH_OPT=(-m32 -march=i686) - elif [[ ("$IS_X64" -ne "0") ]]; then - MARCH_OPT=(-m64 -mtune=generic) - fi + # Flags taken from Fedora's build logs + # https://kojipkgs.fedoraproject.org//packages/cryptopp/5.6.3/8.fc27/data/logs/i686/build.log + # https://kojipkgs.fedoraproject.org//packages/cryptopp/5.6.3/8.fc27/data/logs/x86_64/build.log + if [[ ("$IS_X86" -ne 0) ]]; then + MARCH_OPT=("-m32" "-march=i686") + elif [[ ("$IS_X64" -ne 0) ]]; then + MARCH_OPT=("-m64" "-mtune=generic") + fi - FEDORA_FLAGS=("-DHAVE_CONFIG_H" "-I." "-O2" "-g" "-pipe" "-Wall" "-Werror=format-security" "-fPIC" "-DPIC" - "-Wp,-D_FORTIFY_SOURCE=2" "-fexceptions" "-fstack-protector-strong" "--param=ssp-buffer-size=4" - "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1" "${MARCH_OPT[@]}" "-fasynchronous-unwind-tables") + FEDORA_FLAGS=("-DHAVE_CONFIG_H" "-I." "-O2" "-g" "-pipe" "-Wall" "-Werror=format-security" "-fPIC" "-DPIC" + "-Wp,-D_FORTIFY_SOURCE=2" "-fexceptions" "-fstack-protector-strong" "--param=ssp-buffer-size=4" + "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1" "${MARCH_OPT[@]}" "-fasynchronous-unwind-tables") - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Fedora standard build" | tee -a "$TEST_RESULTS" - echo + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Fedora standard build" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Fedora standard build") + TEST_LIST+=("Fedora standard build") - if [[ ! -f /usr/lib/rpm/redhat/redhat-hardened-cc1 ]]; then - echo "ERROR: please install redhat-rpm-config package" - else - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + if [[ ! -f /usr/lib/rpm/redhat/redhat-hardened-cc1 ]]; then + echo "ERROR: please install redhat-rpm-config package" + else + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXX="g++" "$MAKE" "${MAKEARGS[@]}" CXXFLAGS="${FEDORA_FLAGS[*]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXX="g++" "$MAKE" "${MAKEARGS[@]}" CXXFLAGS="${FEDORA_FLAGS[*]}" 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 - fi + 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 + fi +fi + +############################################ +# openSUSE specific. +if [[ ("$IS_SUSE" -ne 0) ]]; then + + # Flags taken from openSUSE's build logs + # http://susepaste.org/view//9613298 + + SUSE_FLAGS=("-DNDEBUG" "-g" "-O2" + "-D_FORTIFY_SOURCE=2" + "-funwind-tables" + "-fpic" "-fPIC" + "-pthread" "-fopenmp") + + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -fstack-protector-strong "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + SUSE_FLAGS+=("-fstack-protector-strong") + fi + + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -fasynchronous-unwind-tables "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + SUSE_FLAGS+=("-fasynchronous-unwind-tables") + fi + + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -fstack-clash-protection "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + SUSE_FLAGS+=("-fstack-clash-protection") + fi + + rm -f "${TMPDIR}/test.exe" &>/dev/null + "$CXX" -flto=6 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then + SUSE_FLAGS+=("-flto=6") + fi + + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: openSUSE standard build" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("openSUSE standard build") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXX="g++" "$MAKE" "${MAKEARGS[@]}" CXXFLAGS="${SUSE_FLAGS[*]}" 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 fi ############################################ # Minimum platform -if [[ ("$GCC_COMPILER" -ne "0" || "$CLANG_COMPILER" -ne "0" || "$INTEL_COMPILER" -ne "0") ]]; then +if [[ ("$GCC_COMPILER" -ne 0 || "$CLANG_COMPILER" -ne 0 || "$INTEL_COMPILER" -ne 0) ]]; then - # i686 (lacks MMX, SSE and SSE2) - if [[ "$IS_X86" -ne "0" ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, i686 minimum arch CXXFLAGS" | tee -a "$TEST_RESULTS" - echo + # i686 (lacks MMX, SSE and SSE2) + if [[ "$IS_X86" -ne 0 ]]; then + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, i686 minimum arch CXXFLAGS" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, i686 minimum arch CXXFLAGS") + TEST_LIST+=("Debug, i686 minimum arch CXXFLAGS") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -march=i686 $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -march=i686 $OPT_PIC" + 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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, i686 minimum arch CXXFLAGS" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, i686 minimum arch CXXFLAGS" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, i686 minimum arch CXXFLAGS") + TEST_LIST+=("Release, i686 minimum arch CXXFLAGS") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -march=i686 $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -march=i686 $OPT_PIC" + 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 - fi + 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 + fi - # x86_64 - if [[ "$IS_X64" -ne "0" ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, x86_64 minimum arch CXXFLAGS" | tee -a "$TEST_RESULTS" - echo + # x86_64 + if [[ "$IS_X64" -ne 0 ]]; then + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, x86_64 minimum arch CXXFLAGS" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, x86_64 minimum arch CXXFLAGS") + TEST_LIST+=("Debug, x86_64 minimum arch CXXFLAGS") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -march=x86-64 $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -march=x86-64 $OPT_PIC" + 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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, x86_64 minimum arch CXXFLAGS" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, x86_64 minimum arch CXXFLAGS" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, x86_64 minimum arch CXXFLAGS") + TEST_LIST+=("Release, x86_64 minimum arch CXXFLAGS") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -march=x86-64 $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -march=x86-64 $OPT_PIC" + 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 - fi + 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 + fi fi ############################################ # Mismatched arch capabilities -if [[ ( ("$IS_X86" -ne "0" || "$IS_X32" -ne "0" || "$IS_X64" -ne "0") && "$HAVE_NATIVE_ARCH" -ne "0") ]]; then +if [[ ( ("$IS_X86" -ne 0 || "$IS_X32" -ne 0 || "$IS_X64" -ne 0) && "$HAVE_NATIVE_ARCH" -ne 0) ]]; then - # i686 (lacks MMX, SSE and SSE2) - if [[ "$IS_X86" -ne "0" ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, mismatched arch capabilities" | tee -a "$TEST_RESULTS" - echo + # i686 (lacks MMX, SSE and SSE2) + if [[ "$IS_X86" -ne 0 ]]; then + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, mismatched arch capabilities" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, mismatched arch capabilities") + TEST_LIST+=("Debug, mismatched arch capabilities") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -march=i686 $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -march=i686 $OPT_PIC" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 2>&1 | tee -a "$TEST_RESULTS" - # The makefile may add -DCRYPTOPP_DISABLE_XXX, so we can't add -march=native - CXXFLAGS="$DEBUG_CXXFLAGS $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + # The makefile may add -DCRYPTOPP_DISABLE_XXX, so we can't add -march=native + CXXFLAGS="$DEBUG_CXXFLAGS $OPT_PIC" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" 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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, mismatched arch capabilities" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, mismatched arch capabilities" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, mismatched arch capabilities") + TEST_LIST+=("Release, mismatched arch capabilities") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -march=i686 $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -march=i686 $OPT_PIC" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 2>&1 | tee -a "$TEST_RESULTS" - # The makefile may add -DCRYPTOPP_DISABLE_XXX, so we can't add -march=native - CXXFLAGS="$RELEASE_CXXFLAGS $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + # The makefile may add -DCRYPTOPP_DISABLE_XXX, so we can't add -march=native + CXXFLAGS="$RELEASE_CXXFLAGS $OPT_PIC" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" 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 - fi + 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 + fi - # x86-64 - if [[ "$IS_X64" -ne "0" ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, mismatched arch capabilities" | tee -a "$TEST_RESULTS" - echo + # x86-64 + if [[ "$IS_X64" -ne 0 ]]; then + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, mismatched arch capabilities" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, mismatched arch capabilities") + TEST_LIST+=("Debug, mismatched arch capabilities") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -march=x86-64 $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -march=x86-64 $OPT_PIC" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 2>&1 | tee -a "$TEST_RESULTS" - # The makefile may add -DCRYPTOPP_DISABLE_XXX, so we can't add -march=native - CXXFLAGS="$DEBUG_CXXFLAGS $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + # The makefile may add -DCRYPTOPP_DISABLE_XXX, so we can't add -march=native + CXXFLAGS="$DEBUG_CXXFLAGS $OPT_PIC" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" 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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, mismatched arch capabilities" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, mismatched arch capabilities" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, mismatched arch capabilities") + TEST_LIST+=("Release, mismatched arch capabilities") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -march=x86-64 $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -march=x86-64 $OPT_PIC" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 2>&1 | tee -a "$TEST_RESULTS" - # The makefile may add -DCRYPTOPP_DISABLE_XXX, so we can't add -march=native - CXXFLAGS="$RELEASE_CXXFLAGS $OPT_PIC" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + # The makefile may add -DCRYPTOPP_DISABLE_XXX, so we can't add -march=native + CXXFLAGS="$RELEASE_CXXFLAGS $OPT_PIC" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" 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 - fi + 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 + fi fi ############################################ # Debug build, DISABLE_ASM if true; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, DISABLE_ASM" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, DISABLE_ASM" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, DISABLE_ASM") + TEST_LIST+=("Debug, DISABLE_ASM") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_DISABLE_ASM" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_DISABLE_ASM" + 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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, DISABLE_ASM" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, DISABLE_ASM" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, DISABLE_ASM") + TEST_LIST+=("Release, DISABLE_ASM") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_DISABLE_ASM" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_DISABLE_ASM" + 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 + 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 fi ############################################ # Debug build, NO_CPU_FEATURE_PROBES if true; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, NO_CPU_FEATURE_PROBES" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, NO_CPU_FEATURE_PROBES" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, NO_CPU_FEATURE_PROBES") + TEST_LIST+=("Debug, NO_CPU_FEATURE_PROBES") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_NO_CPU_FEATURE_PROBES=1" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_NO_CPU_FEATURE_PROBES=1" + 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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, NO_CPU_FEATURE_PROBES" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, NO_CPU_FEATURE_PROBES" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, NO_CPU_FEATURE_PROBES") + TEST_LIST+=("Release, NO_CPU_FEATURE_PROBES") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_NO_CPU_FEATURE_PROBES=1" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_NO_CPU_FEATURE_PROBES=1" + 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 + 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 fi ############################################ # Debug build, CRYPTOPP_NO_CXX11 -if [[ "$HAVE_CXX11" -ne "0" ]] || [[ "$HAVE_GNU11" -ne "0" ]]; then +if [[ "$HAVE_CXX11" -ne 0 ]] || [[ "$HAVE_GNU11" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, CRYPTOPP_NO_CXX11" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, CRYPTOPP_NO_CXX11" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, CRYPTOPP_NO_CXX11") + TEST_LIST+=("Debug, CRYPTOPP_NO_CXX11") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_CRYPTOPP_NO_CXX11=1" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_NO_CXX11=1" + 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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, CRYPTOPP_NO_CXX11" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, CRYPTOPP_NO_CXX11" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, CRYPTOPP_NO_CXX11") + TEST_LIST+=("Release, CRYPTOPP_NO_CXX11") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_CRYPTOPP_NO_CXX11=1" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_NO_CXX11=1" + 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 + 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 fi ############################################ # c++03 debug and release build -if [[ "$HAVE_CXX03" -ne "0" ]]; then +if [[ "$HAVE_CXX03" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++03" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++03" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++03") + TEST_LIST+=("Debug, c++03") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++03" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++03" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++03") + TEST_LIST+=("Release, c++03") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $USER_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 + 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 fi ############################################ # gnu++03 debug and release build -if [[ "$HAVE_GNU03" -ne "0" ]]; then +if [[ "$HAVE_GNU03" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, gnu++03" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, gnu++03" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, gnu++03") + TEST_LIST+=("Debug, gnu++03") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++03 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, gnu++03" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, gnu++03" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, gnu++03") + TEST_LIST+=("Release, gnu++03") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++03 $USER_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 + 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 fi ############################################ # c++11 debug and release build -if [[ "$HAVE_CXX11" -ne "0" ]]; then +if [[ "$HAVE_CXX11" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++11" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++11" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++11") + TEST_LIST+=("Debug, c++11") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++11" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++11" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++11") + TEST_LIST+=("Release, c++11") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 $USER_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 + 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 fi ############################################ # gnu++11 debug and release build -if [[ "$HAVE_GNU11" -ne "0" ]]; then +if [[ "$HAVE_GNU11" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, gnu++11" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, gnu++11" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, gnu++11") + TEST_LIST+=("Debug, gnu++11") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++11 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, gnu++11" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, gnu++11" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, gnu++11") + TEST_LIST+=("Release, gnu++11") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++11 $USER_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 + 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 fi ############################################ # c++14 debug and release build -if [[ "$HAVE_CXX14" -ne "0" ]]; then +if [[ "$HAVE_CXX14" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++14" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++14" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++14") + TEST_LIST+=("Debug, c++14") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++14 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++14 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++14" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++14" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++14") + TEST_LIST+=("Release, c++14") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 $USER_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 + 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 fi ############################################ # gnu++14 debug and release build -if [[ "$HAVE_GNU14" -ne "0" ]]; then +if [[ "$HAVE_GNU14" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, gnu++14" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, gnu++14" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, gnu++14") + TEST_LIST+=("Debug, gnu++14") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++14 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++14 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, gnu++14" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, gnu++14" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, gnu++14") + TEST_LIST+=("Release, gnu++14") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++14 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++14 $USER_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 + 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 fi ############################################ # c++17 debug and release build -if [[ "$HAVE_CXX17" -ne "0" ]]; then +if [[ "$HAVE_CXX17" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++17" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++17" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++17") + TEST_LIST+=("Debug, c++17") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++17 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++17 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++17" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++17" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++17") + TEST_LIST+=("Release, c++17") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 $USER_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 + 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 fi ############################################ # gnu++17 debug and release build -if [[ "$HAVE_GNU17" -ne "0" ]]; then +if [[ "$HAVE_GNU17" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, gnu++17" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, gnu++17" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, gnu++17") + TEST_LIST+=("Debug, gnu++17") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++17 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++17 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, gnu++17" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, gnu++17" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, gnu++17") + TEST_LIST+=("Release, gnu++17") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++17 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++17 $USER_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 + 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 fi ############################################ # c++20 debug and release build -if [[ "$HAVE_CXX20" -ne "0" ]]; then +if [[ "$HAVE_CXX20" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++20" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++20" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++20") + TEST_LIST+=("Debug, c++20") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++20 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++20 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++20" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++20" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++20") + TEST_LIST+=("Release, c++20") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 $USER_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 + 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 fi ############################################ # gnu++20 debug and release build -if [[ "$HAVE_GNU20" -ne "0" ]]; then +if [[ "$HAVE_GNU20" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, gnu++20" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, gnu++20" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, gnu++20") + TEST_LIST+=("Debug, gnu++20") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++20 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=gnu++20 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, gnu++20" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, gnu++20" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, gnu++20") + TEST_LIST+=("Release, gnu++20") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++20 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=gnu++20 $USER_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 + 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 fi ############################################ # X32 debug and release build -if [[ "$HAVE_X32" -ne "0" ]]; then +if [[ "$HAVE_X32" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, X32" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, X32" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, X32") + TEST_LIST+=("Debug, X32") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -mx32 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -mx32 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, X32" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, X32" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, X32") + TEST_LIST+=("Release, X32") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -mx32 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -mx32 $USER_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 + 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 fi ############################################ # init_priority if true; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, INIT_PRIORITY (0)" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, INIT_PRIORITY (0)" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, INIT_PRIORITY (0)") + TEST_LIST+=("Debug, INIT_PRIORITY (0)") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_INIT_PRIORITY=0 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_INIT_PRIORITY=0 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, INIT_PRIORITY (0)" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, INIT_PRIORITY (0)" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, INIT_PRIORITY (0)") + TEST_LIST+=("Release, INIT_PRIORITY (0)") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_INIT_PRIORITY=0 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_INIT_PRIORITY=0 $USER_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 + 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 fi ############################################ # OS Independence if true; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, NO_OS_DEPENDENCE" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, NO_OS_DEPENDENCE" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, NO_OS_DEPENDENCE") + TEST_LIST+=("Debug, NO_OS_DEPENDENCE") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -DNO_OS_DEPENDENCE $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -DNO_OS_DEPENDENCE $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, NO_OS_DEPENDENCE" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, NO_OS_DEPENDENCE" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, NO_OS_DEPENDENCE") + TEST_LIST+=("Release, NO_OS_DEPENDENCE") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -DNO_OS_DEPENDENCE $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -DNO_OS_DEPENDENCE $USER_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 + 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 fi ############################################ # Build with LD-Gold -if [[ "$HAVE_LDGOLD" -ne "0" ]]; then +if [[ "$HAVE_LDGOLD" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, ld-gold linker" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, ld-gold linker" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, ld-gold linker") + TEST_LIST+=("Debug, ld-gold linker") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" LD="ld.gold" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" LD="ld.gold" "$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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, ld-gold linker" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, ld-gold linker" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, ld-gold linker") + TEST_LIST+=("Release, ld-gold linker") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" LD="ld.gold" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" LD="ld.gold" "$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 + 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 fi ############################################ # Build at -O2 -if [[ "$HAVE_O2" -ne "0" ]]; then +if [[ "$HAVE_O2" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, -O2 optimizations" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, -O2 optimizations" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, -O2 optimizations") + TEST_LIST+=("Debug, -O2 optimizations") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DDEBUG $OPT_O2 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="-DDEBUG $OPT_O2 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, -O2 optimizations" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, -O2 optimizations" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, -O2 optimizations") + TEST_LIST+=("Release, -O2 optimizations") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG $OPT_O2 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="-DNDEBUG $OPT_O2 $USER_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 + 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 fi ############################################ # Build at -O3 -if [[ "$HAVE_O3" -ne "0" ]]; then +if [[ "$HAVE_O3" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, -O3 optimizations" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, -O3 optimizations" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, -O3 optimizations") + TEST_LIST+=("Debug, -O3 optimizations") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DDEBUG $OPT_O3 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="-DDEBUG $OPT_O3 $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, -O3 optimizations" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, -O3 optimizations" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, -O3 optimizations") + TEST_LIST+=("Release, -O3 optimizations") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG $OPT_O3 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="-DNDEBUG $OPT_O3 $USER_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 -fi - -############################################ -# Build at -O5 -if [[ "$HAVE_O5" -ne "0" ]]; then - - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, -O5 optimizations" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Debug, -O5 optimizations") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DDEBUG $OPT_O5 $USER_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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, -O5 optimizations" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Release, -O5 optimizations") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DNDEBUG $OPT_O5 $USER_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 + 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 fi ############################################ # Build at -Os -if [[ "$HAVE_OS" -ne "0" ]]; then +if [[ "$HAVE_OS" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, -Os optimizations" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, -Os optimizations" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, -Os optimizations") + TEST_LIST+=("Debug, -Os optimizations") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DDEBUG $OPT_OS $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="-DDEBUG $OPT_OS $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, -Os optimizations" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, -Os optimizations" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, -Os optimizations") + TEST_LIST+=("Release, -Os optimizations") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG $OPT_OS $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="-DNDEBUG $OPT_OS $USER_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 + 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 +fi + +############################################ +# Build at -Oz +if [[ "$HAVE_OZ" -ne 0 ]]; then + + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, -Oz optimizations" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Debug, -Oz optimizations") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DDEBUG $OPT_OZ $USER_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 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, -Oz optimizations" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Release, -Oz optimizations") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DNDEBUG $OPT_OZ $USER_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 fi ############################################ # Build at -Ofast -if [[ "$HAVE_OFAST" -ne "0" ]]; then +if [[ "$HAVE_OFAST" -ne 0 ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, -Ofast optimizations" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, -Ofast optimizations" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, -Ofast optimizations") + TEST_LIST+=("Debug, -Ofast optimizations") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DDEBUG $OPT_OFAST $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="-DDEBUG $OPT_OFAST $USER_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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, -Ofast optimizations" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, -Ofast optimizations" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, -Ofast optimizations") + TEST_LIST+=("Release, -Ofast optimizations") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG $OPT_OFAST $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="-DNDEBUG $OPT_OFAST $USER_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 + 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 fi ############################################ # Dead code stripping -if [[ ("$GNU_LINKER" -eq "1") ]]; then +if [[ ("$GNU_LINKER" -eq 1) ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, dead code strip" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, dead code strip" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, dead code strip") + TEST_LIST+=("Debug, dead code strip") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" lean 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" lean 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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, dead code strip" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, dead code strip" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, dead code strip") + TEST_LIST+=("Release, dead code strip") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" lean 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" lean 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 + 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 fi ############################################ # OpenMP -if [[ ("$HAVE_OMP" -ne "0") ]]; then +if [[ ("$HAVE_OMP" -ne 0) ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, OpenMP" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, OpenMP" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, OpenMP") + TEST_LIST+=("Debug, OpenMP") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DDEBUG ${OMP_FLAGS[*]} $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="-DDEBUG ${OMP_FLAGS[*]} $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, OpenMP" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, OpenMP" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, OpenMP") + TEST_LIST+=("Release, OpenMP") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG ${OMP_FLAGS[*]} $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="-DNDEBUG ${OMP_FLAGS[*]} $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # UBSan, c++03 -if [[ ("$HAVE_CXX03" -ne "0" && "$HAVE_UBSAN" -ne "0") ]]; then +if [[ ("$HAVE_CXX03" -ne 0 && "$HAVE_UBSAN" -ne 0) ]]; then - ############################################ - # Debug build, UBSan, c++03 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++03, UBsan" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build, UBSan, c++03 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++03, UBsan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++03, UBsan") + TEST_LIST+=("Debug, c++03, UBsan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | 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 + 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, UBSan, c++03 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++03, UBsan" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build, UBSan, c++03 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++03, UBsan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++03, UBsan") + TEST_LIST+=("Release, c++03, UBsan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | 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 + 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 fi ############################################ # Asan, c++03 -if [[ ("$HAVE_CXX03" -ne "0" && "$HAVE_ASAN" -ne "0") ]]; then +if [[ ("$HAVE_CXX03" -ne 0 && "$HAVE_ASAN" -ne 0) ]]; then - ############################################ - # Debug build, Asan, c++03 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++03, Asan" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build, Asan, c++03 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++03, Asan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++03, Asan") + TEST_LIST+=("Debug, c++03, Asan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 - fi + fi - ############################################ - # Release build, Asan, c++03 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++03, Asan" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build, Asan, c++03 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++03, Asan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++03, Asan") + TEST_LIST+=("Release, c++03, Asan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 + fi fi ############################################ # Bounds Sanitizer, c++03 -if [[ ("$HAVE_CXX03" -ne "0" && "$HAVE_BSAN" -ne "0") ]]; then +if [[ ("$HAVE_CXX03" -ne 0 && "$HAVE_BSAN" -ne 0) ]]; then - ############################################ - # Debug build, Bounds Sanitizer, c++03 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++03, Bounds Sanitizer" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build, Bounds Sanitizer, c++03 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++03, Bounds Sanitizer" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++03, Bounds Sanitizer") + TEST_LIST+=("Debug, c++03, Bounds Sanitizer") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 -fsanitize=bounds-strict $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 -fsanitize=bounds-strict $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 - fi + fi - ############################################ - # Release build, Bounds Sanitizer, c++03 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++03, Bounds Sanitizer" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build, Bounds Sanitizer, c++03 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++03, Bounds Sanitizer" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++03, Bounds Sanitizer") + TEST_LIST+=("Release, c++03, Bounds Sanitizer") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -fsanitize=bounds-strict $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -fsanitize=bounds-strict $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 + fi fi ############################################ # Control-flow Enforcement Technology (CET), c++03 -if [[ ("$HAVE_CXX11" -ne "0" && "$HAVE_CET" -ne "0") ]]; then +if [[ ("$HAVE_CXX11" -ne 0 && "$HAVE_CET" -ne 0) ]]; then - ############################################ - # Debug build, CET, c++03 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++03, CET" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build, CET, c++03 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++03, CET" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++03, CET") + TEST_LIST+=("Debug, c++03, CET") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 -fcf-protection=full -mcet $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 -fcf-protection=full -mcet $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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, CET, c++03 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++03, CET" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build, CET, c++03 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++03, CET" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++03, CET") + TEST_LIST+=("Release, c++03, CET") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -fcf-protection=full -mcet $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -fcf-protection=full -mcet $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Specter, c++03 -if [[ ("$HAVE_CXX11" -ne "0" && "$HAVE_REPTOLINE" -ne "0") ]]; then +if [[ ("$HAVE_CXX11" -ne 0 && "$HAVE_REPTOLINE" -ne 0) ]]; then - ############################################ - # Debug build, Specter, c++03 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++03, Specter" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build, Specter, c++03 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++03, Specter" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++03, Specter") + TEST_LIST+=("Debug, c++03, Specter") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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, Specter, c++03 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++03, Specter" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build, Specter, c++03 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++03, Specter" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++03, Specter") + TEST_LIST+=("Release, c++03, Specter") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # UBSan, c++11 -if [[ ("$HAVE_CXX11" -ne "0" && "$HAVE_UBSAN" -ne "0") ]]; then +if [[ ("$HAVE_CXX11" -ne 0 && "$HAVE_UBSAN" -ne 0) ]]; then - ############################################ - # Debug build, UBSan, c++11 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++11, UBsan" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build, UBSan, c++11 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++11, UBsan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++11, UBsan") + TEST_LIST+=("Debug, c++11, UBsan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | 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 + 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, UBSan, c++11 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++11, UBsan" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build, UBSan, c++11 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++11, UBsan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++11, UBsan") + TEST_LIST+=("Release, c++11, UBsan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | 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 + 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 fi ############################################ # Asan, c++11 -if [[ ("$HAVE_CXX11" -ne "0" && "$HAVE_ASAN" -ne "0") ]]; then +if [[ ("$HAVE_CXX11" -ne 0 && "$HAVE_ASAN" -ne 0) ]]; then - ############################################ - # Debug build, Asan, c++11 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++11, Asan" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build, Asan, c++11 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++11, Asan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++11, Asan") + TEST_LIST+=("Debug, c++11, Asan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 - fi + fi - ############################################ - # Release build, Asan, c++11 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++11, Asan" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build, Asan, c++11 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++11, Asan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++11, Asan") + TEST_LIST+=("Release, c++11, Asan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 + fi fi ############################################ # Bounds Sanitizer, c++11 -if [[ ("$HAVE_CXX11" -ne "0" && "$HAVE_BSAN" -ne "0") ]]; then +if [[ ("$HAVE_CXX11" -ne 0 && "$HAVE_BSAN" -ne 0) ]]; then - ############################################ - # Debug build, Bounds Sanitizer, c++11 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++11, Bounds Sanitizer" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build, Bounds Sanitizer, c++11 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++11, Bounds Sanitizer" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++11, Bounds Sanitizer") + TEST_LIST+=("Debug, c++11, Bounds Sanitizer") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 -fsanitize=bounds-strict $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 -fsanitize=bounds-strict $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 - fi + fi - ############################################ - # Release build, Bounds Sanitizer, c++11 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++11, Bounds Sanitizer" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build, Bounds Sanitizer, c++11 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++11, Bounds Sanitizer" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++11, Bounds Sanitizer") + TEST_LIST+=("Release, c++11, Bounds Sanitizer") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 -fsanitize=bounds-strict $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 -fsanitize=bounds-strict $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 + fi fi ############################################ # Control-flow Enforcement Technology (CET), c++11 -if [[ ("$HAVE_CXX11" -ne "0" && "$HAVE_CET" -ne "0") ]]; then +if [[ ("$HAVE_CXX11" -ne 0 && "$HAVE_CET" -ne 0) ]]; then - ############################################ - # Debug build, CET, c++11 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++11, CET" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build, CET, c++11 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++11, CET" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++11, CET") + TEST_LIST+=("Debug, c++11, CET") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 -fcf-protection=full -mcet $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 -fcf-protection=full -mcet $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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, CET, c++11 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++11, CET" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build, CET, c++11 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++11, CET" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++11, CET") + TEST_LIST+=("Release, c++11, CET") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 -fcf-protection=full -mcet $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 -fcf-protection=full -mcet $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Specter, c++11 -if [[ ("$HAVE_CXX11" -ne "0" && "$HAVE_REPTOLINE" -ne "0") ]]; then +if [[ ("$HAVE_CXX11" -ne 0 && "$HAVE_REPTOLINE" -ne 0) ]]; then - ############################################ - # Debug build, Specter, c++11 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Debug, c++11, Specter" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Debug build, Specter, c++11 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, c++11, Specter" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Debug, c++11, Specter") + TEST_LIST+=("Debug, c++11, Specter") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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, Specter, c++11 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++11, Specter" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Release build, Specter, c++11 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++11, Specter" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++11, Specter") + TEST_LIST+=("Release, c++11, Specter") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Release build, UBSan, c++14 -if [[ ("$HAVE_CXX14" -ne "0" && "$HAVE_UBSAN" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++14, UBsan" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX14" -ne 0 && "$HAVE_UBSAN" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++14, UBsan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++14, UBsan") + TEST_LIST+=("Release, c++14, UBsan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | 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 + 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 fi ############################################ # Release build, Asan, c++14 -if [[ ("$HAVE_CXX14" -ne "0" && "$HAVE_ASAN" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++14, Asan" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX14" -ne 0 && "$HAVE_ASAN" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++14, Asan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++14, Asan") + TEST_LIST+=("Release, c++14, Asan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 + fi fi ############################################ # Release build, Bounds Sanitizer, c++14 -if [[ ("$HAVE_CXX14" -ne "0" && "$HAVE_BSAN" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++14, Bounds Sanitizer" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX14" -ne 0 && "$HAVE_BSAN" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++14, Bounds Sanitizer" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++14, Bounds Sanitizer") + TEST_LIST+=("Release, c++14, Bounds Sanitizer") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 -fsanitize=bounds-strict $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 -fsanitize=bounds-strict $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Release build, Control-flow Enforcement Technology (CET), c++14 -if [[ ("$HAVE_CXX14" -ne "0" && "$HAVE_CET" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++14, CET" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX14" -ne 0 && "$HAVE_CET" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++14, CET" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++14, CET") + TEST_LIST+=("Release, c++14, CET") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 -fcf-protection=full -mcet $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 -fcf-protection=full -mcet $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Release build, Specter, c++14 -if [[ ("$HAVE_CXX14" -ne "0" && "$HAVE_REPTOLINE" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++14, Specter" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX14" -ne 0 && "$HAVE_REPTOLINE" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++14, Specter" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++14, Specter") + TEST_LIST+=("Release, c++14, Specter") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Release build, UBSan, c++17 -if [[ ("$HAVE_CXX17" -ne "0" && "$HAVE_UBSAN" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++17, UBsan" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX17" -ne 0 && "$HAVE_UBSAN" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++17, UBsan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++17, UBsan") + TEST_LIST+=("Release, c++17, UBsan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | 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 + 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 fi ############################################ # Release build, Asan, c++17 -if [[ ("$HAVE_CXX17" -ne "0" && "$HAVE_ASAN" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++17, Asan" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX17" -ne 0 && "$HAVE_ASAN" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++17, Asan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++17, Asan") + TEST_LIST+=("Release, c++17, Asan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 + fi fi ############################################ # Release build, Bounds Sanitizer, c++17 -if [[ ("$HAVE_CXX17" -ne "0" && "$HAVE_BSAN" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++17, Bounds Sanitizer" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX17" -ne 0 && "$HAVE_BSAN" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++17, Bounds Sanitizer" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++17, Bounds Sanitizer") + TEST_LIST+=("Release, c++17, Bounds Sanitizer") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 -fsanitize=bounds-strict $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 -fsanitize=bounds-strict $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Release build, Control-flow Enforcement Technology (CET), c++17 -if [[ ("$HAVE_CXX17" -ne "0" && "$HAVE_CET" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++17, CET" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX17" -ne 0 && "$HAVE_CET" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++17, CET" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++17, CET") + TEST_LIST+=("Release, c++17, CET") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 -fcf-protection=full -mcet $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 -fcf-protection=full -mcet $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Release build, Specter, c++17 -if [[ ("$HAVE_CXX17" -ne "0" && "$HAVE_REPTOLINE" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++17, Specter" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX17" -ne 0 && "$HAVE_REPTOLINE" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++17, Specter" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++17, Specter") + TEST_LIST+=("Release, c++17, Specter") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Release build, UBSan, c++20 -if [[ ("$HAVE_CXX20" -ne "0" && "$HAVE_UBSAN" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++20, UBsan" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX20" -ne 0 && "$HAVE_UBSAN" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++20, UBsan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++20, UBsan") + TEST_LIST+=("Release, c++20, UBsan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" ubsan | 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 + 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 fi ############################################ # Release build, Asan, c++20 -if [[ ("$HAVE_CXX20" -ne "0" && "$HAVE_ASAN" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++20, Asan" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX20" -ne 0 && "$HAVE_ASAN" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++20, Asan" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++20, Asan") + TEST_LIST+=("Release, c++20, Asan") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" asan | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" - else - if [[ ("$HAVE_SYMBOLIZE" -ne "0") ]]; then - ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" - fi - 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 - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + if [[ ("$HAVE_SYMBOLIZE" -ne 0) ]]; then + ./cryptest.exe v 2>&1 | "$ASAN_SYMBOLIZE" 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 | "$ASAN_SYMBOLIZE" 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + 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 + fi fi ############################################ # Release build, Bounds Sanitizer, c++20 -if [[ ("$HAVE_CXX20" -ne "0" && "$HAVE_BSAN" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++20, Bounds Sanitizer" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX20" -ne 0 && "$HAVE_BSAN" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++20, Bounds Sanitizer" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++20, Bounds Sanitizer") + TEST_LIST+=("Release, c++20, Bounds Sanitizer") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 -fsanitize=bounds-strict $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 -fsanitize=bounds-strict $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Release build, Control-flow Enforcement Technology (CET), c++20 -if [[ ("$HAVE_CXX20" -ne "0" && "$HAVE_CET" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++20, CET" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX20" -ne 0 && "$HAVE_CET" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++20, CET" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++20, CET") + TEST_LIST+=("Release, c++20, CET") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 -fcf-protection=full -mcet $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 -fcf-protection=full -mcet $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 fi ############################################ # Release build, Specter, c++20 -if [[ ("$HAVE_CXX20" -ne "0" && "$HAVE_REPTOLINE" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Release, c++20, Specter" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_CXX20" -ne 0 && "$HAVE_REPTOLINE" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, c++20, Specter" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Release, c++20, Specter") + TEST_LIST+=("Release, c++20, Specter") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 -mfunction-return=thunk -mindirect-branch=thunk $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" | 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 + 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 +fi + +############################################ +# Analyze debug and release build +if [[ "$HAVE_ANALYZER" -ne 0 ]]; then + + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Debug, Analyze" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Debug, Analyze") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="$DEBUG_CXXFLAGS -fanalyzer $USER_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 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Release, Analyze" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Release, Analyze") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="$RELEASE_CXXFLAGS -fanalyzer $USER_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 fi ############################################ # For Solaris, test under Sun Studio 12.2 - 12.5 -if [[ "$IS_SOLARIS" -ne "0" ]]; then - - ############################################ - # Sun Studio 12.2/SunCC 5.11 - if [[ (-e "/opt/solstudio12.2/bin/CC") ]]; then - - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Sun Studio 12.2, debug, platform CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Sun Studio 12.2, debug, platform CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DDEBUG -g -xO0" - CXX="/opt/solstudio12.2/bin/CC" 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Sun Studio 12.2, release, platform CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Testing: Sun Studio 12.2, release, platform CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DNDEBUG -g -xO2" - CXX="/opt/solstudio12.2/bin/CC" 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 - fi - - ############################################ - # Sun Studio 12.3/SunCC 5.12 - if [[ (-e "/opt/solarisstudio12.3/bin/CC") ]]; then - - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Sun Studio 12.3, debug, platform CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Sun Studio 12.3, debug, platform CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DDEBUG -g3 -xO0" - CXX=/opt/solarisstudio12.3/bin/CC 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Sun Studio 12.3, release, platform CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Sun Studio 12.3, release, platform CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DNDEBUG -g3 -xO2" - CXX=/opt/solarisstudio12.3/bin/CC 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 - fi - - ############################################ - # Sun Studio 12.4/SunCC 5.13 - if [[ (-e "/opt/solarisstudio12.4/bin/CC") ]]; then - - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Sun Studio 12.4, debug, platform CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Sun Studio 12.4, debug, platform CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DDEBUG -g3 -xO0" - CXX=/opt/solarisstudio12.4/bin/CC 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Sun Studio 12.4, release, platform CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Sun Studio 12.4, release, platform CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DNDEBUG -g2 -xO2" - CXX=/opt/solarisstudio12.4/bin/CC 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 - fi - - ############################################ - # Sun Studio 12.5/SunCC 5.14 - if [[ (-e "/opt/developerstudio12.5/bin/CC") ]]; then - - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Sun Studio 12.5, debug, platform CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Sun Studio 12.5, debug, platform CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DDEBUG -g3 -xO1" - CXX=/opt/developerstudio12.5/bin/CC 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Sun Studio 12.5, release, platform CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Sun Studio 12.5, release, platform CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DNDEBUG -g2 -xO2" - CXX=/opt/developerstudio12.5/bin/CC 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 - fi - - ############################################ - # Sun Studio 12.6/SunCC 5.15 - if [[ (-e "/opt/developerstudio12.6/bin/CC") ]]; then - - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Sun Studio 12.6, debug, platform CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Sun Studio 12.6, debug, platform CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DDEBUG -g3 -xO1" - CXX=/opt/developerstudio12.6/bin/CC 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Sun Studio 12.6, release, platform CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Sun Studio 12.6, release, platform CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DNDEBUG -g2 -xO2" - CXX=/opt/developerstudio12.6/bin/CC 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 - fi - - ############################################ - # GCC on Solaris - if [[ (-e "/bin/g++") ]]; then - - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Solaris GCC, debug, default CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Solaris GCC, debug, default CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DDEBUG -g3 -O0" - CXX="/bin/g++" 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 - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Soalris GCC, release, default CXXFLAGS" | tee -a "$TEST_RESULTS" - echo - - TEST_LIST+=("Soalris GCC, release, default CXXFLAGS") - - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 - - CXXFLAGS="-DNDEBUG -g2 -O3" - CXX="/bin/g++" 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 - fi +if [[ "$IS_SOLARIS" -ne 0 ]]; then + + ############################################ + # Sun Studio 12.2/SunCC 5.11 + if [[ (-e "/opt/solstudio12.2/bin/CC") ]]; then + + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Sun Studio 12.2, debug, platform CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Sun Studio 12.2, debug, platform CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DDEBUG -g -xO0" + CXX="/opt/solstudio12.2/bin/CC" 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 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Sun Studio 12.2, release, platform CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Testing: Sun Studio 12.2, release, platform CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DNDEBUG -g -xO2" + CXX="/opt/solstudio12.2/bin/CC" 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 + fi + + ############################################ + # Sun Studio 12.3/SunCC 5.12 + if [[ (-e "/opt/solarisstudio12.3/bin/CC") ]]; then + + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Sun Studio 12.3, debug, platform CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Sun Studio 12.3, debug, platform CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DDEBUG -g3 -xO0" + CXX=/opt/solarisstudio12.3/bin/CC 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 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Sun Studio 12.3, release, platform CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Sun Studio 12.3, release, platform CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DNDEBUG -g3 -xO2" + CXX=/opt/solarisstudio12.3/bin/CC 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 + fi + + ############################################ + # Sun Studio 12.4/SunCC 5.13 + if [[ (-e "/opt/solarisstudio12.4/bin/CC") ]]; then + + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Sun Studio 12.4, debug, platform CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Sun Studio 12.4, debug, platform CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DDEBUG -g3 -xO0" + CXX=/opt/solarisstudio12.4/bin/CC 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 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Sun Studio 12.4, release, platform CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Sun Studio 12.4, release, platform CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DNDEBUG -g2 -xO2" + CXX=/opt/solarisstudio12.4/bin/CC 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 + fi + + ############################################ + # Sun Studio 12.5/SunCC 5.14 + if [[ (-e "/opt/developerstudio12.5/bin/CC") ]]; then + + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Sun Studio 12.5, debug, platform CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Sun Studio 12.5, debug, platform CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DDEBUG -g3 -xO1" + CXX=/opt/developerstudio12.5/bin/CC 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 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Sun Studio 12.5, release, platform CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Sun Studio 12.5, release, platform CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DNDEBUG -g2 -xO2" + CXX=/opt/developerstudio12.5/bin/CC 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 + fi + + ############################################ + # Sun Studio 12.6/SunCC 5.15 + if [[ (-e "/opt/developerstudio12.6/bin/CC") ]]; then + + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Sun Studio 12.6, debug, platform CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Sun Studio 12.6, debug, platform CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DDEBUG -g3 -xO1" + CXX=/opt/developerstudio12.6/bin/CC 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 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Sun Studio 12.6, release, platform CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Sun Studio 12.6, release, platform CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DNDEBUG -g2 -xO2" + CXX=/opt/developerstudio12.6/bin/CC 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 + fi + + ############################################ + # GCC on Solaris + if [[ (-e "/bin/g++") ]]; then + + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Solaris GCC, debug, default CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Solaris GCC, debug, default CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DDEBUG -g3 -O0" + CXX="/bin/g++" 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 + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Soalris GCC, release, default CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + TEST_LIST+=("Soalris GCC, release, default CXXFLAGS") + + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null + + CXXFLAGS="-DNDEBUG -g2 -O3" + CXX="/bin/g++" 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 + fi fi # For Darwin, we need to test both -stdlib=libstdc++ (GNU) and @@ -5509,677 +5676,677 @@ fi ############################################ # Darwin, c++03, libc++ -if [[ ("$IS_DARWIN" -ne "0") && ("$HAVE_CXX03" -ne "0" && "$CLANG_COMPILER" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++03, libc++ (LLVM)" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0) && ("$HAVE_CXX03" -ne 0 && "$CLANG_COMPILER" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++03, libc++ (LLVM)" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++03, libc++ (LLVM)") + TEST_LIST+=("Darwin, c++03, libc++ (LLVM)") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -stdlib=libc++ $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -stdlib=libc++ $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 + 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 fi ############################################ # Darwin, c++03, libstdc++ -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX03" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++03, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX03" -ne 0) && ("$HAVE_LIBSTDCXX" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++03, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++03, libstdc++ (GNU)") + TEST_LIST+=("Darwin, c++03, libstdc++ (GNU)") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -stdlib=libstdc++ $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 -stdlib=libstdc++ $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 + 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 fi ############################################ # Darwin, c++11, libc++ -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX11" -ne "0" && "$CLANG_COMPILER" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++11, libc++ (LLVM)" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX11" -ne 0 && "$CLANG_COMPILER" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++11, libc++ (LLVM)" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++11, libc++ (LLVM)") + TEST_LIST+=("Darwin, c++11, libc++ (LLVM)") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 -stdlib=libc++ $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 -stdlib=libc++ $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 + 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 fi ############################################ # Darwin, c++11, libstdc++ -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX11" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++11, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX11" -ne 0) && ("$HAVE_LIBSTDCXX" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++11, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++11, libstdc++ (GNU)") + TEST_LIST+=("Darwin, c++11, libstdc++ (GNU)") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 -stdlib=libstdc++ $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 -stdlib=libstdc++ $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 + 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 fi ############################################ # Darwin, c++14, libc++ -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX14" -ne "0" && "$CLANG_COMPILER" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++14, libc++ (LLVM)" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX14" -ne 0 && "$CLANG_COMPILER" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++14, libc++ (LLVM)" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++14, libc++ (LLVM)") + TEST_LIST+=("Darwin, c++14, libc++ (LLVM)") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 -stdlib=libc++ $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 -stdlib=libc++ $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 + 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 fi ############################################ # Darwin, c++14, libstdc++ -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX14" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++14, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX14" -ne 0) && ("$HAVE_LIBSTDCXX" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++14, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++14, libstdc++ (GNU)") + TEST_LIST+=("Darwin, c++14, libstdc++ (GNU)") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 -stdlib=libstdc++ $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 -stdlib=libstdc++ $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 + 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 fi ############################################ # Darwin, c++17, libc++ -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX17" -ne "0" && "$CLANG_COMPILER" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++17, libc++ (LLVM)" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX17" -ne 0 && "$CLANG_COMPILER" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++17, libc++ (LLVM)" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++17, libc++ (LLVM)") + TEST_LIST+=("Darwin, c++17, libc++ (LLVM)") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 -stdlib=libc++ $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 -stdlib=libc++ $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 + 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 fi ############################################ # Darwin, c++17, libstdc++ -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX17" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++17, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX17" -ne 0) && ("$HAVE_LIBSTDCXX" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++17, libstdc++ (GNU)" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++17, libstdc++ (GNU)") + TEST_LIST+=("Darwin, c++17, libstdc++ (GNU)") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 -stdlib=libstdc++ $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 -stdlib=libstdc++ $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 + 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 fi ############################################ # Darwin, Intel multiarch, c++03 -if [[ "$IS_DARWIN" -ne "0" && "$HAVE_INTEL_MULTIARCH" -ne "0" && "$HAVE_CXX03" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, Intel multiarch, c++03" | tee -a "$TEST_RESULTS" - echo +if [[ "$IS_DARWIN" -ne 0 && "$HAVE_INTEL_MULTIARCH" -ne 0 && "$HAVE_CXX03" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, Intel multiarch, c++03" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, Intel multiarch, c++03") + TEST_LIST+=("Darwin, Intel multiarch, c++03") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -arch i386 -arch x86_64 -std=c++03 -DCRYPTOPP_DISABLE_ASM $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -arch i386 -arch x86_64 -std=c++03 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - echo "Running i386 version..." - arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" - fi - arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + echo "Running i386 version..." + arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" + fi + arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" + fi - echo "Running x86_64 version..." - arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" - fi - arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" - fi - fi + echo "Running x86_64 version..." + arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" + fi + arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" + fi + fi fi ############################################ # Darwin, Intel multiarch, c++11 -if [[ "$IS_DARWIN" -ne "0" && "$HAVE_INTEL_MULTIARCH" -ne "0" && "$HAVE_CXX11" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, Intel multiarch, c++11" | tee -a "$TEST_RESULTS" - echo +if [[ "$IS_DARWIN" -ne 0 && "$HAVE_INTEL_MULTIARCH" -ne 0 && "$HAVE_CXX11" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, Intel multiarch, c++11" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, Intel multiarch, c++11") + TEST_LIST+=("Darwin, Intel multiarch, c++11") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -arch i386 -arch x86_64 -std=c++11 -DCRYPTOPP_DISABLE_ASM $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -arch i386 -arch x86_64 -std=c++11 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - echo "Running i386 version..." - arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" - fi - arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + echo "Running i386 version..." + arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" + fi + arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" + fi - echo "Running x86_64 version..." - arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" - fi - arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" - fi - fi + echo "Running x86_64 version..." + arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" + fi + arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" + fi + fi fi ############################################ # Darwin, Intel multiarch, c++14 -if [[ "$IS_DARWIN" -ne "0" && "$HAVE_INTEL_MULTIARCH" -ne "0" && "$HAVE_CXX14" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, Intel multiarch, c++14" | tee -a "$TEST_RESULTS" - echo +if [[ "$IS_DARWIN" -ne 0 && "$HAVE_INTEL_MULTIARCH" -ne 0 && "$HAVE_CXX14" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, Intel multiarch, c++14" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, Intel multiarch, c++14") + TEST_LIST+=("Darwin, Intel multiarch, c++14") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -arch i386 -arch x86_64 -std=c++14 -DCRYPTOPP_DISABLE_ASM $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -arch i386 -arch x86_64 -std=c++14 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - echo "Running i386 version..." - arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" - fi - arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + echo "Running i386 version..." + arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" + fi + arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" + fi - echo "Running x86_64 version..." - arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" - fi - arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" - fi - fi + echo "Running x86_64 version..." + arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" + fi + arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" + fi + fi fi ############################################ # Darwin, Intel multiarch, c++17 -if [[ "$IS_DARWIN" -ne "0" && "$HAVE_INTEL_MULTIARCH" -ne "0" && "$HAVE_CXX17" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, Intel multiarch, c++17" | tee -a "$TEST_RESULTS" - echo +if [[ "$IS_DARWIN" -ne 0 && "$HAVE_INTEL_MULTIARCH" -ne 0 && "$HAVE_CXX17" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, Intel multiarch, c++17" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, Intel multiarch, c++17") + TEST_LIST+=("Darwin, Intel multiarch, c++17") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -arch i386 -arch x86_64 -std=c++17 -DCRYPTOPP_DISABLE_ASM $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -arch i386 -arch x86_64 -std=c++17 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - echo "Running i386 version..." - arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" - fi - arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + echo "Running i386 version..." + arch -i386 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite (i386)" | tee -a "$TEST_RESULTS" + fi + arch -i386 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors (i386)" | tee -a "$TEST_RESULTS" + fi - echo "Running x86_64 version..." - arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" - fi - arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" - fi - fi + echo "Running x86_64 version..." + arch -x86_64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite (x86_64)" | tee -a "$TEST_RESULTS" + fi + arch -x86_64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors (x86_64)" | tee -a "$TEST_RESULTS" + fi + fi fi ############################################ # Darwin, PowerPC multiarch -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_PPC_MULTIARCH" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, PowerPC multiarch" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_PPC_MULTIARCH" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, PowerPC multiarch" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, PowerPC multiarch") + TEST_LIST+=("Darwin, PowerPC multiarch") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -arch ppc -arch ppc64 -DCRYPTOPP_DISABLE_ASM $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -arch ppc -arch ppc64 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - echo "Running PPC version..." - arch -ppc ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite (PPC)" | tee -a "$TEST_RESULTS" - fi - arch -ppc ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors (PPC)" | tee -a "$TEST_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + echo "Running PPC version..." + arch -ppc ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite (PPC)" | tee -a "$TEST_RESULTS" + fi + arch -ppc ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors (PPC)" | tee -a "$TEST_RESULTS" + fi - echo "Running PPC64 version..." - arch -ppc64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite (PPC64)" | tee -a "$TEST_RESULTS" - fi - arch -ppc64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors (PPC64)" | tee -a "$TEST_RESULTS" - fi - fi + echo "Running PPC64 version..." + arch -ppc64 ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite (PPC64)" | tee -a "$TEST_RESULTS" + fi + arch -ppc64 ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors (PPC64)" | tee -a "$TEST_RESULTS" + fi + fi fi ############################################ # Darwin, c++03, Malloc Guards -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX03" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++03, Malloc Guards" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX03" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++03, Malloc Guards" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++03, Malloc Guards") + TEST_LIST+=("Darwin, c++03, Malloc Guards") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - export MallocScribble=1 - export MallocPreScribble=1 - export MallocGuardEdges=1 + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + export MallocScribble=1 + export MallocPreScribble=1 + export MallocGuardEdges=1 - ./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 + ./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 - unset MallocScribble MallocPreScribble MallocGuardEdges - fi + unset MallocScribble MallocPreScribble MallocGuardEdges + fi fi ############################################ # Darwin, c++11, Malloc Guards -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX11" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++11, Malloc Guards" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX11" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++11, Malloc Guards" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++11, Malloc Guards") + TEST_LIST+=("Darwin, c++11, Malloc Guards") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - export MallocScribble=1 - export MallocPreScribble=1 - export MallocGuardEdges=1 + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + export MallocScribble=1 + export MallocPreScribble=1 + export MallocGuardEdges=1 - ./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 + ./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 - unset MallocScribble MallocPreScribble MallocGuardEdges - fi + unset MallocScribble MallocPreScribble MallocGuardEdges + fi fi ############################################ # Darwin, c++14, Malloc Guards -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX14" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++14, Malloc Guards" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX14" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++14, Malloc Guards" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++14, Malloc Guards") + TEST_LIST+=("Darwin, c++14, Malloc Guards") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - export MallocScribble=1 - export MallocPreScribble=1 - export MallocGuardEdges=1 + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + export MallocScribble=1 + export MallocPreScribble=1 + export MallocGuardEdges=1 - ./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 + ./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 - unset MallocScribble MallocPreScribble MallocGuardEdges - fi + unset MallocScribble MallocPreScribble MallocGuardEdges + fi fi ############################################ # Darwin, c++17, Malloc Guards -if [[ ("$IS_DARWIN" -ne "0" && "$HAVE_CXX17" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Darwin, c++17, Malloc Guards" | tee -a "$TEST_RESULTS" - echo +if [[ ("$IS_DARWIN" -ne 0 && "$HAVE_CXX17" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Darwin, c++17, Malloc Guards" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Darwin, c++17, Malloc Guards") + TEST_LIST+=("Darwin, c++17, Malloc Guards") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - export MallocScribble=1 - export MallocPreScribble=1 - export MallocGuardEdges=1 + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + export MallocScribble=1 + export MallocPreScribble=1 + export MallocGuardEdges=1 - ./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 + ./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 - unset MallocScribble MallocPreScribble MallocGuardEdges - fi + unset MallocScribble MallocPreScribble MallocGuardEdges + fi fi ############################################ # Benchmarks -if [[ "$WANT_BENCHMARKS" -ne "0" ]]; then +if [[ "$WANT_BENCHMARKS" -ne 0 ]]; then - ############################################ - # Benchmarks, c++03 - if [[ "$HAVE_CXX03" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Benchmarks, c++03" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Benchmarks, c++03 + if [[ "$HAVE_CXX03" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Benchmarks, c++03" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Testing: Benchmarks, c++03") + TEST_LIST+=("Testing: Benchmarks, c++03") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - echo "**************************************" >> "$BENCHMARK_RESULTS" - ./cryptest.exe b 3 "$CPU_FREQ" 2>&1 | tee -a "$BENCHMARK_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute benchmarks" | tee -a "$BENCHMARK_RESULTS" - fi - fi - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + echo "**************************************" >> "$BENCHMARK_RESULTS" + ./cryptest.exe b 3 "$CPU_FREQ" 2>&1 | tee -a "$BENCHMARK_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute benchmarks" | tee -a "$BENCHMARK_RESULTS" + fi + fi + fi - ############################################ - # Benchmarks, c++11 - if [[ "$HAVE_CXX11" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Benchmarks, c++11" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Benchmarks, c++11 + if [[ "$HAVE_CXX11" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Benchmarks, c++11" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Testing: Benchmarks, c++11") + TEST_LIST+=("Testing: Benchmarks, c++11") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - echo "**************************************" >> "$BENCHMARK_RESULTS" - ./cryptest.exe b 3 "$CPU_FREQ" 2>&1 | tee -a "$BENCHMARK_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute benchmarks" | tee -a "$BENCHMARK_RESULTS" - fi - fi - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + echo "**************************************" >> "$BENCHMARK_RESULTS" + ./cryptest.exe b 3 "$CPU_FREQ" 2>&1 | tee -a "$BENCHMARK_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute benchmarks" | tee -a "$BENCHMARK_RESULTS" + fi + fi + fi - ############################################ - # Benchmarks, c++14 - if [[ "$HAVE_CXX14" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Benchmarks, c++14" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Benchmarks, c++14 + if [[ "$HAVE_CXX14" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Benchmarks, c++14" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Benchmarks, c++14") + TEST_LIST+=("Benchmarks, c++14") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - echo "**************************************" >> "$BENCHMARK_RESULTS" - ./cryptest.exe b 3 "$CPU_FREQ" 2>&1 | tee -a "$BENCHMARK_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute benchmarks" | tee -a "$BENCHMARK_RESULTS" - fi - fi - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + echo "**************************************" >> "$BENCHMARK_RESULTS" + ./cryptest.exe b 3 "$CPU_FREQ" 2>&1 | tee -a "$BENCHMARK_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute benchmarks" | tee -a "$BENCHMARK_RESULTS" + fi + fi + fi fi # For Cygwin, we need to test both PREFER_BERKELEY_STYLE_SOCKETS @@ -6187,915 +6354,915 @@ fi ############################################ # MinGW and PREFER_BERKELEY_STYLE_SOCKETS -if [[ "$IS_MINGW" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: MinGW, PREFER_BERKELEY_STYLE_SOCKETS" | tee -a "$TEST_RESULTS" - echo +if [[ "$IS_MINGW" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MinGW, PREFER_BERKELEY_STYLE_SOCKETS" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("MinGW, PREFER_BERKELEY_STYLE_SOCKETS") + TEST_LIST+=("MinGW, PREFER_BERKELEY_STYLE_SOCKETS") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -DPREFER_BERKELEY_STYLE_SOCKETS -DNO_WINDOWS_STYLE_SOCKETS $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -DPREFER_BERKELEY_STYLE_SOCKETS -DNO_WINDOWS_STYLE_SOCKETS $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 + 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 fi ############################################ # MinGW and PREFER_WINDOWS_STYLE_SOCKETS -if [[ "$IS_MINGW" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: MinGW, PREFER_WINDOWS_STYLE_SOCKETS" | tee -a "$TEST_RESULTS" - echo +if [[ "$IS_MINGW" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MinGW, PREFER_WINDOWS_STYLE_SOCKETS" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("MinGW, PREFER_WINDOWS_STYLE_SOCKETS") + TEST_LIST+=("MinGW, PREFER_WINDOWS_STYLE_SOCKETS") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -DPREFER_WINDOWS_STYLE_SOCKETS -DNO_BERKELEY_STYLE_SOCKETS $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -DPREFER_WINDOWS_STYLE_SOCKETS -DNO_BERKELEY_STYLE_SOCKETS $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 + 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 fi ############################################ # Valgrind, c++03. Requires -O1 for accurate results -if [[ "$HAVE_CXX03" -ne "0" && "$HAVE_VALGRIND" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Valgrind, c++03" | tee -a "$TEST_RESULTS" - echo +if [[ "$HAVE_CXX03" -ne 0 && "$HAVE_VALGRIND" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Valgrind, c++03" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Valgrind, c++03") + TEST_LIST+=("Valgrind, c++03") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++03 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++03 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + fi fi ############################################ # Valgrind, c++11. Requires -O1 for accurate results -if [[ ("$HAVE_VALGRIND" -ne "0" && "$HAVE_CXX11" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Valgrind, c++11" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_VALGRIND" -ne 0 && "$HAVE_CXX11" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Valgrind, c++11" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Valgrind, c++11") + TEST_LIST+=("Valgrind, c++11") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++11 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++11 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + fi fi ############################################ # Valgrind, c++14. Requires -O1 for accurate results -if [[ ("$HAVE_VALGRIND" -ne "0" && "$HAVE_CXX14" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Valgrind, c++14" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_VALGRIND" -ne 0 && "$HAVE_CXX14" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Valgrind, c++14" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Valgrind, c++14") + TEST_LIST+=("Valgrind, c++14") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++14 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++14 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + fi fi ############################################ # Valgrind, c++17. Requires -O1 for accurate results -if [[ ("$HAVE_VALGRIND" -ne "0" && "$HAVE_CXX17" -ne "0") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Valgrind, c++17" | tee -a "$TEST_RESULTS" - echo +if [[ ("$HAVE_VALGRIND" -ne 0 && "$HAVE_CXX17" -ne 0) ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Valgrind, c++17" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Valgrind, c++17") + TEST_LIST+=("Valgrind, c++17") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++17 $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="$VALGRIND_CXXFLAGS -std=c++17 $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" - valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + valgrind --track-origins=yes --suppressions=cryptopp.supp ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + fi fi ############################################ # C++03 with elevated warnings -if [[ ("$HAVE_CXX03" -ne "0" && ("$GCC_COMPILER" -ne "0" || "$CLANG_COMPILER" -ne "0")) ]]; then +if [[ ("$HAVE_CXX03" -ne 0 && ("$GCC_COMPILER" -ne 0 || "$CLANG_COMPILER" -ne 0)) ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$WARN_RESULTS" - echo "Testing: Debug, c++03, elevated warnings" | tee -a "$WARN_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$WARN_RESULTS" + echo "Testing: Debug, c++03, elevated warnings" | tee -a "$WARN_RESULTS" + echo - TEST_LIST+=("Debug, c++03, elevated warnings") + TEST_LIST+=("Debug, c++03, elevated warnings") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 ${WARNING_CXXFLAGS[@]}" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++03 ${WARNING_CXXFLAGS[*]}" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" + fi - ############################################ - # Release build - echo - echo "************************************" | tee -a "$WARN_RESULTS" - echo "Testing: Release, c++03, elevated warnings" | tee -a "$WARN_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$WARN_RESULTS" + echo "Testing: Release, c++03, elevated warnings" | tee -a "$WARN_RESULTS" + echo - TEST_LIST+=("Release, c++03, elevated warnings") + TEST_LIST+=("Release, c++03, elevated warnings") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 ${WARNING_CXXFLAGS[@]}" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [[ "$?" -ne "0" ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" - fi + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++03 ${WARNING_CXXFLAGS[*]}" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" + if [[ "$?" -ne 0 ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" + fi fi ############################################ # C++11 with elevated warnings -if [[ ("$HAVE_CXX11" -ne "0" && ("$GCC_COMPILER" -ne "0" || "$CLANG_COMPILER" -ne "0")) ]]; then +if [[ ("$HAVE_CXX11" -ne 0 && ("$GCC_COMPILER" -ne 0 || "$CLANG_COMPILER" -ne 0)) ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$WARN_RESULTS" - echo "Testing: Debug, c++11, elevated warnings" | tee -a "$WARN_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$WARN_RESULTS" + echo "Testing: Debug, c++11, elevated warnings" | tee -a "$WARN_RESULTS" + echo - TEST_LIST+=("Debug, c++11, elevated warnings") + TEST_LIST+=("Debug, c++11, elevated warnings") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 ${WARNING_CXXFLAGS[@]}" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++11 ${WARNING_CXXFLAGS[*]}" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" + fi - ############################################ - # Release build - echo - echo "************************************" | tee -a "$WARN_RESULTS" - echo "Testing: Release, c++11, elevated warnings" | tee -a "$WARN_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$WARN_RESULTS" + echo "Testing: Release, c++11, elevated warnings" | tee -a "$WARN_RESULTS" + echo - TEST_LIST+=("Release, c++11, elevated warnings") + TEST_LIST+=("Release, c++11, elevated warnings") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 ${WARNING_CXXFLAGS[@]}" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [[ "$?" -ne "0" ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" - fi + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++11 ${WARNING_CXXFLAGS[*]}" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" + if [[ "$?" -ne 0 ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" + fi fi ############################################ # C++14 with elevated warnings -if [[ ("$HAVE_CXX14" -ne "0" && ("$GCC_COMPILER" -ne "0" || "$CLANG_COMPILER" -ne "0")) ]]; then +if [[ ("$HAVE_CXX14" -ne 0 && ("$GCC_COMPILER" -ne 0 || "$CLANG_COMPILER" -ne 0)) ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$WARN_RESULTS" - echo "Testing: Debug, c++14, elevated warnings" | tee -a "$WARN_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$WARN_RESULTS" + echo "Testing: Debug, c++14, elevated warnings" | tee -a "$WARN_RESULTS" + echo - TEST_LIST+=("Debug, c++14, elevated warnings") + TEST_LIST+=("Debug, c++14, elevated warnings") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++14 ${WARNING_CXXFLAGS[@]}" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++14 ${WARNING_CXXFLAGS[*]}" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" + fi - ############################################ - # Release build - echo - echo "************************************" | tee -a "$WARN_RESULTS" - echo "Testing: Release, c++14, elevated warnings" | tee -a "$WARN_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$WARN_RESULTS" + echo "Testing: Release, c++14, elevated warnings" | tee -a "$WARN_RESULTS" + echo - TEST_LIST+=("Release, c++14, elevated warnings") + TEST_LIST+=("Release, c++14, elevated warnings") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 ${WARNING_CXXFLAGS[@]}" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [[ "$?" -ne "0" ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" - fi + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++14 ${WARNING_CXXFLAGS[*]}" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" + if [[ "$?" -ne 0 ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" + fi fi ############################################ # C++17 with elevated warnings -if [[ ("$HAVE_CXX17" -ne "0" && ("$GCC_COMPILER" -ne "0" || "$CLANG_COMPILER" -ne "0")) ]]; then +if [[ ("$HAVE_CXX17" -ne 0 && ("$GCC_COMPILER" -ne 0 || "$CLANG_COMPILER" -ne 0)) ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$WARN_RESULTS" - echo "Testing: Debug, c++17, elevated warnings" | tee -a "$WARN_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$WARN_RESULTS" + echo "Testing: Debug, c++17, elevated warnings" | tee -a "$WARN_RESULTS" + echo - TEST_LIST+=("Debug, c++17, elevated warnings") + TEST_LIST+=("Debug, c++17, elevated warnings") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++17 ${WARNING_CXXFLAGS[@]}" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++17 ${WARNING_CXXFLAGS[*]}" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" + fi - ############################################ - # Release build - echo - echo "************************************" | tee -a "$WARN_RESULTS" - echo "Testing: Release, c++17, elevated warnings" | tee -a "$WARN_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$WARN_RESULTS" + echo "Testing: Release, c++17, elevated warnings" | tee -a "$WARN_RESULTS" + echo - TEST_LIST+=("Release, c++17, elevated warnings") + TEST_LIST+=("Release, c++17, elevated warnings") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 ${WARNING_CXXFLAGS[@]}" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++17 ${WARNING_CXXFLAGS[*]}" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [[ "$?" -ne "0" ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" - fi + if [[ "$?" -ne 0 ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" + fi fi ############################################ # C++20 with elevated warnings -if [[ ("$HAVE_CXX20" -ne "0" && ("$GCC_COMPILER" -ne "0" || "$CLANG_COMPILER" -ne "0")) ]]; then +if [[ ("$HAVE_CXX20" -ne 0 && ("$GCC_COMPILER" -ne 0 || "$CLANG_COMPILER" -ne 0)) ]]; then - ############################################ - # Debug build - echo - echo "************************************" | tee -a "$WARN_RESULTS" - echo "Testing: Debug, c++20, elevated warnings" | tee -a "$WARN_RESULTS" - echo + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$WARN_RESULTS" + echo "Testing: Debug, c++20, elevated warnings" | tee -a "$WARN_RESULTS" + echo - TEST_LIST+=("Debug, c++20, elevated warnings") + TEST_LIST+=("Debug, c++20, elevated warnings") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$DEBUG_CXXFLAGS -std=c++20 ${WARNING_CXXFLAGS[@]}" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" + CXXFLAGS="$DEBUG_CXXFLAGS -std=c++20 ${WARNING_CXXFLAGS[*]}" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" - fi + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" + fi - ############################################ - # Release build - echo - echo "************************************" | tee -a "$WARN_RESULTS" - echo "Testing: Release, c++20, elevated warnings" | tee -a "$WARN_RESULTS" - echo + ############################################ + # Release build + echo + echo "************************************" | tee -a "$WARN_RESULTS" + echo "Testing: Release, c++20, elevated warnings" | tee -a "$WARN_RESULTS" + echo - TEST_LIST+=("Release, c++20, elevated warnings") + TEST_LIST+=("Release, c++20, elevated warnings") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 ${WARNING_CXXFLAGS[@]}" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -std=c++20 ${WARNING_CXXFLAGS[*]}" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$WARN_RESULTS" - if [[ "$?" -ne "0" ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" - fi + if [[ "$?" -ne 0 ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$WARN_RESULTS" + fi fi ############################################ # Perform a quick check with Clang, if available. # This check was added after testing on Ubuntu 14.04 with Clang 3.4. -if [[ ("$CLANG_COMPILER" -eq "0") ]]; then +if [[ ("$CLANG_COMPILER" -eq 0) ]]; then - CLANG_CXX=$(command -v clang++ 2>/dev/null) - "$CLANG_CXX" -x c++ -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + CLANG_CXX=$(command -v clang++ 2>/dev/null) + "$CLANG_CXX" -x c++ -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # Clang build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Clang compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Clang build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Clang compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Clang compiler") + TEST_LIST+=("Clang compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG -g2 -O3" - CXX="$CLANG_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 - fi + CXXFLAGS="-DNDEBUG -g2 -O3" + CXX="$CLANG_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 + fi fi ############################################ # Perform a quick check with GCC, if available. -if [[ ("$GCC_COMPILER" -eq "0") ]]; then +if [[ ("$GCC_COMPILER" -eq 0) ]]; then - GCC_CXX=$(command -v g++ 2>/dev/null) - "$GCC_CXX" -x c++ -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + GCC_CXX=$(command -v g++ 2>/dev/null) + "$GCC_CXX" -x c++ -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # GCC build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: GCC compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # GCC build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: GCC compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("GCC compiler") + TEST_LIST+=("GCC compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG -g2 -O3" - CXX="$GCC_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 - fi + CXXFLAGS="-DNDEBUG -g2 -O3" + CXX="$GCC_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 + fi fi ############################################ # Perform a quick check with Intel ICPC, if available. -if [[ ("$INTEL_COMPILER" -eq "0") ]]; then +if [[ ("$INTEL_COMPILER" -eq 0) ]]; then - INTEL_CXX=$(command -v icpc 2>/dev/null) - if [[ (-z "$INTEL_CXX") ]]; then - INTEL_CXX=$(find /opt/intel -name icpc 2>/dev/null | "$GREP" -iv composer | head -1) - fi - "$INTEL_CXX" -x c++ -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + INTEL_CXX=$(command -v icpc 2>/dev/null) + if [[ (-z "$INTEL_CXX") ]]; then + INTEL_CXX=$(find /opt/intel -name icpc 2>/dev/null | "$GREP" -iv composer | head -1) + fi + "$INTEL_CXX" -x c++ -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # Intel build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Intel compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # Intel build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Intel compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Intel compiler") + TEST_LIST+=("Intel compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG -g2 -O3" - CXX="$INTEL_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 - fi + CXXFLAGS="-DNDEBUG -g2 -O3" + CXX="$INTEL_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 + fi fi ############################################ # Perform a quick check with MacPorts compilers, if available. -if [[ ("$IS_DARWIN" -ne "0" && "$MACPORTS_COMPILER" -eq "0") ]]; then +if [[ ("$IS_DARWIN" -ne 0 && "$MACPORTS_COMPILER" -eq 0) ]]; then - MACPORTS_CXX=$(find /opt/local/bin -name 'g++-mp-4*' 2>/dev/null | head -1) - if [[ (! -z "$MACPORTS_CXX") ]]; then - "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + MACPORTS_CXX=$(find /opt/local/bin -name 'g++-mp-4*' 2>/dev/null | head -1) + if [[ (-n "$MACPORTS_CXX") ]]; then + "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # MacPorts GCC 4.x build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: MacPorts 4.x GCC compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # MacPorts GCC 4.x build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MacPorts 4.x GCC compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("MacPorts 4.x GCC compiler") + TEST_LIST+=("MacPorts 4.x GCC compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - # We want to use -stdlib=libstdc++ below, but it causes a compile error. Maybe MacPorts hardwired libc++. - CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" - CXX="$MACPORTS_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 - fi - fi + # We want to use -stdlib=libstdc++ below, but it causes a compile error. Maybe MacPorts hardwired libc++. + CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" + CXX="$MACPORTS_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 + fi + fi - MACPORTS_CXX=$(find /opt/local/bin -name 'g++-mp-5*' 2>/dev/null | head -1) - if [[ (! -z "$MACPORTS_CXX") ]]; then - "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + MACPORTS_CXX=$(find /opt/local/bin -name 'g++-mp-5*' 2>/dev/null | head -1) + if [[ (-n "$MACPORTS_CXX") ]]; then + "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # MacPorts GCC 5.x build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: MacPorts 5.x GCC compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # MacPorts GCC 5.x build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MacPorts 5.x GCC compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("MacPorts 5.x GCC compiler") + TEST_LIST+=("MacPorts 5.x GCC compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - # We want to use -stdlib=libstdc++ below, but it causes a compile error. Maybe MacPorts hardwired libc++. - CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" - CXX="$MACPORTS_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 - fi - fi + # We want to use -stdlib=libstdc++ below, but it causes a compile error. Maybe MacPorts hardwired libc++. + CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" + CXX="$MACPORTS_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 + fi + fi - MACPORTS_CXX=$(find /opt/local/bin -name 'g++-mp-6*' 2>/dev/null | head -1) - if [[ (! -z "$MACPORTS_CXX") ]]; then - "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + MACPORTS_CXX=$(find /opt/local/bin -name 'g++-mp-6*' 2>/dev/null | head -1) + if [[ (-n "$MACPORTS_CXX") ]]; then + "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # MacPorts GCC 6.x build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: MacPorts 6.x GCC compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # MacPorts GCC 6.x build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MacPorts 6.x GCC compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("MacPorts 6.x GCC compiler") + TEST_LIST+=("MacPorts 6.x GCC compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - # We want to use -stdlib=libstdc++ below, but it causes a compile error. Maybe MacPorts hardwired libc++. - CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" - CXX="$MACPORTS_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 - fi - fi + # We want to use -stdlib=libstdc++ below, but it causes a compile error. Maybe MacPorts hardwired libc++. + CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" + CXX="$MACPORTS_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 + fi + fi - MACPORTS_CXX=$(find /opt/local/bin -name 'g++-mp-7*' 2>/dev/null | head -1) - if [[ (! -z "$MACPORTS_CXX") ]]; then - "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + MACPORTS_CXX=$(find /opt/local/bin -name 'g++-mp-7*' 2>/dev/null | head -1) + if [[ (-n "$MACPORTS_CXX") ]]; then + "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # MacPorts GCC 7.x build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: MacPorts 7.x GCC compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # MacPorts GCC 7.x build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MacPorts 7.x GCC compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("MacPorts 7.x GCC compiler") + TEST_LIST+=("MacPorts 7.x GCC compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - # We want to use -stdlib=libstdc++ below, but it causes a compile error. Maybe MacPorts hardwired libc++. - CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" - CXX="$MACPORTS_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 - fi - fi + # We want to use -stdlib=libstdc++ below, but it causes a compile error. Maybe MacPorts hardwired libc++. + CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11" + CXX="$MACPORTS_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 + fi + fi - MACPORTS_CXX=$(find /opt/local/bin -name 'clang++-mp-3.7*' 2>/dev/null | head -1) - if [[ (! -z "$MACPORTS_CXX") ]]; then - "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + MACPORTS_CXX=$(find /opt/local/bin -name 'clang++-mp-3.7*' 2>/dev/null | head -1) + if [[ (-n "$MACPORTS_CXX") ]]; then + "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # MacPorts 3.7 Clang build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: MacPorts 3.7 Clang compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # MacPorts 3.7 Clang build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MacPorts 3.7 Clang compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("MacPorts 3.7 Clang compiler") + TEST_LIST+=("MacPorts 3.7 Clang compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11 -stdlib=libc++" - CXX="$MACPORTS_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 - fi - fi + CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11 -stdlib=libc++" + CXX="$MACPORTS_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 + fi + fi - MACPORTS_CXX=$(find /opt/local/bin -name 'clang++-mp-3.8*' 2>/dev/null | head -1) - if [[ (! -z "$MACPORTS_CXX") ]]; then - "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + MACPORTS_CXX=$(find /opt/local/bin -name 'clang++-mp-3.8*' 2>/dev/null | head -1) + if [[ (-n "$MACPORTS_CXX") ]]; then + "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # MacPorts 3.8 Clang build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: MacPorts 3.8 Clang compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # MacPorts 3.8 Clang build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MacPorts 3.8 Clang compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("MacPorts 3.8 Clang compiler") + TEST_LIST+=("MacPorts 3.8 Clang compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11 -stdlib=libc++" - CXX="$MACPORTS_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 - fi - fi + CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11 -stdlib=libc++" + CXX="$MACPORTS_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 + fi + fi - MACPORTS_CXX=$(find /opt/local/bin -name 'clang++-mp-3.9*' 2>/dev/null | head -1) - if [[ (! -z "$MACPORTS_CXX") ]]; then - "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + MACPORTS_CXX=$(find /opt/local/bin -name 'clang++-mp-3.9*' 2>/dev/null | head -1) + if [[ (-n "$MACPORTS_CXX") ]]; then + "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # MacPorts 3.9 Clang build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: MacPorts 3.9 Clang compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # MacPorts 3.9 Clang build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MacPorts 3.9 Clang compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("MacPorts 3.9 Clang compiler") + TEST_LIST+=("MacPorts 3.9 Clang compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11 -stdlib=libc++" - CXX="$MACPORTS_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 - fi - fi + CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11 -stdlib=libc++" + CXX="$MACPORTS_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 + fi + fi - MACPORTS_CXX=$(find /opt/local/bin -name 'clang++-mp-4*' 2>/dev/null | head -1) - if [[ (! -z "$MACPORTS_CXX") ]]; then - "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN adhoc.cpp.proto -o "$TMPDIR/adhoc.exe" > /dev/null 2>&1 - if [[ "$?" -eq "0" ]]; then + MACPORTS_CXX=$(find /opt/local/bin -name 'clang++-mp-4*' 2>/dev/null | head -1) + if [[ (-n "$MACPORTS_CXX") ]]; then + "$MACPORTS_CXX" -x c++ -std=c++11 -DCRYPTOPP_ADHOC_MAIN "$test_prog".proto -o "${TMPDIR}/test.exe" &>/dev/null + if [[ "$?" -eq 0 ]]; then - ############################################ - # MacPorts 4.x Clang build - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: MacPorts 4.x Clang compiler" | tee -a "$TEST_RESULTS" - echo + ############################################ + # MacPorts 4.x Clang build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: MacPorts 4.x Clang compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("MacPorts 4.x Clang compiler") + TEST_LIST+=("MacPorts 4.x Clang compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11 -stdlib=libc++" - CXX="$MACPORTS_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 - fi - fi + CXXFLAGS="-DNDEBUG -g2 -O3 -std=c++11 -stdlib=libc++" + CXX="$MACPORTS_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 + fi + fi fi ############################################ # Perform a quick check with Xcode compiler, if available. -if [[ "$IS_DARWIN" -ne "0" ]]; then - XCODE_CXX=$(find /Applications/Xcode*.app/Contents/Developer -name clang++ 2>/dev/null | head -1) - if [[ (-z "$XCODE_CXX") ]]; then - XCODE_CXX=$(find /Developer/Applications/Xcode.app -name clang++ 2>/dev/null | head -1) - fi +if [[ "$IS_DARWIN" -ne 0 ]]; then + XCODE_CXX=$(find /Applications/Xcode*.app/Contents/Developer -name clang++ 2>/dev/null | head -1) + if [[ (-z "$XCODE_CXX") ]]; then + XCODE_CXX=$(find /Developer/Applications/Xcode.app -name clang++ 2>/dev/null | head -1) + fi - if [[ ! (-z "$XCODE_CXX") ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" - echo "Testing: Xcode Clang compiler" | tee -a "$TEST_RESULTS" - echo + if [[ ! (-z "$XCODE_CXX") ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: Xcode Clang compiler" | tee -a "$TEST_RESULTS" + echo - TEST_LIST+=("Xcode Clang compiler") + TEST_LIST+=("Xcode Clang compiler") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - CXXFLAGS="-DNDEBUG -g2 -O3" - CXX="$XCODE_CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + CXXFLAGS="-DNDEBUG -g2 -O3" + CXX="$XCODE_CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static 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 - fi + 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 + fi fi ############################################ # Test an install with CRYPTOPP_DATA_DIR -if [[ ("$IS_CYGWIN" -eq "0") && ("$IS_MINGW" -eq "0") ]]; then +if [[ ("$IS_CYGWIN" -eq 0) && ("$IS_MINGW" -eq 0) ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo "Testing: Install with data directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo + echo + echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo "Testing: Install with data directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo - TEST_LIST+=("Install with data directory") + TEST_LIST+=("Install with data directory") - "$MAKE" clean > /dev/null 2>&1 - rm -f adhoc.cpp > /dev/null 2>&1 + "$MAKE" clean &>/dev/null + rm -f "${TMPDIR}/test.exe" &>/dev/null - INSTALL_DIR="$TMPDIR/cryptopp_test" - rm -rf "$INSTALL_DIR" > /dev/null 2>&1 + INSTALL_DIR="${TMPDIR}/cryptopp_test" + rm -rf "$INSTALL_DIR" &>/dev/null - CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_DATA_DIR='\"$INSTALL_DIR/share/cryptopp/\"' $USER_CXXFLAGS" - CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_DATA_DIR='\"$INSTALL_DIR/share/cryptopp/\"' $USER_CXXFLAGS" + CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - else - OLD_DIR=$(pwd) - "$MAKE" "${MAKEARGS[@]}" install PREFIX="$INSTALL_DIR" 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - cd "$INSTALL_DIR/bin" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + else + OLD_DIR=$(pwd) + "$MAKE" "${MAKEARGS[@]}" install PREFIX="$INSTALL_DIR" 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + cd "$INSTALL_DIR/bin" - echo - echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo "Testing: Install (validation suite)" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo - ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi + echo + echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo "Testing: Install (validation suite)" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo + ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi - echo - echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo "Testing: Install (test vectors)" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo - ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi + echo + echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo "Testing: Install (test vectors)" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo + ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi - if [[ "$WANT_BENCHMARKS" -ne "0" ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo "Testing: Install (benchmarks)" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo - ./cryptest.exe b 1 "$CPU_FREQ" 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to execute benchmarks" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi - fi + if [[ "$WANT_BENCHMARKS" -ne 0 ]]; then + echo + echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo "Testing: Install (benchmarks)" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo + ./cryptest.exe b 1 "$CPU_FREQ" 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to execute benchmarks" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi + fi - echo - echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo "Testing: Install (help file)" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo - ./cryptest.exe h 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "1") ]]; then - echo "ERROR: failed to provide help" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi + echo + echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo "Testing: Install (help file)" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo + ./cryptest.exe h 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 1) ]]; then + echo "ERROR: failed to provide help" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi - # Restore original PWD - cd "$OLD_DIR" - fi + # Restore original PWD + cd "$OLD_DIR" + fi fi ############################################ # Test a remove with CRYPTOPP_DATA_DIR -if [[ ("$IS_CYGWIN" -eq "0" && "$IS_MINGW" -eq "0") ]]; then +if [[ ("$IS_CYGWIN" -eq 0 && "$IS_MINGW" -eq 0) ]]; then - echo - echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo "Testing: Remove with data directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - echo + echo + echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo "Testing: Remove with data directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + echo - TEST_LIST+=("Remove with data directory") + TEST_LIST+=("Remove with data directory") - "$MAKE" "${MAKEARGS[@]}" remove PREFIX="$INSTALL_DIR" 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then - echo "ERROR: failed to make remove" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - else - # Test for complete removal - if [[ (-d "$INSTALL_DIR/include/cryptopp") ]]; then - echo "ERROR: failed to remove cryptopp include directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi - if [[ (-d "$INSTALL_DIR/share/cryptopp") ]]; then - echo "ERROR: failed to remove cryptopp share directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi - if [[ (-d "$INSTALL_DIR/share/cryptopp/TestData") ]]; then - echo "ERROR: failed to remove cryptopp test data directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi - if [[ (-d "$INSTALL_DIR/share/cryptopp/TestVector") ]]; then - echo "ERROR: failed to remove cryptopp test vector directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi - if [[ (-e "$INSTALL_DIR/bin/cryptest.exe") ]]; then - echo "ERROR: failed to remove cryptest.exe program" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi - if [[ (-e "$INSTALL_DIR/lib/libcryptopp.a") ]]; then - echo "ERROR: failed to remove libcryptopp.a static library" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi - if [[ "$IS_DARWIN" -ne "0" && (-e "$INSTALL_DIR/lib/libcryptopp.dylib") ]]; then - echo "ERROR: failed to remove libcryptopp.dylib dynamic library" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - elif [[ (-e "$INSTALL_DIR/lib/libcryptopp.so") ]]; then - echo "ERROR: failed to remove libcryptopp.so dynamic library" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" - fi - fi + "$MAKE" "${MAKEARGS[@]}" remove PREFIX="$INSTALL_DIR" 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then + echo "ERROR: failed to make remove" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + else + # Test for complete removal + if [[ (-d "$INSTALL_DIR/include/cryptopp") ]]; then + echo "ERROR: failed to remove cryptopp include directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi + if [[ (-d "$INSTALL_DIR/share/cryptopp") ]]; then + echo "ERROR: failed to remove cryptopp share directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi + if [[ (-d "$INSTALL_DIR/share/cryptopp/TestData") ]]; then + echo "ERROR: failed to remove cryptopp test data directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi + if [[ (-d "$INSTALL_DIR/share/cryptopp/TestVector") ]]; then + echo "ERROR: failed to remove cryptopp test vector directory" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi + if [[ (-e "$INSTALL_DIR/bin/cryptest.exe") ]]; then + echo "ERROR: failed to remove cryptest.exe program" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi + if [[ (-e "$INSTALL_DIR/lib/libcryptopp.a") ]]; then + echo "ERROR: failed to remove libcryptopp.a static library" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi + if [[ "$IS_DARWIN" -ne 0 && (-e "$INSTALL_DIR/lib/libcryptopp.dylib") ]]; then + echo "ERROR: failed to remove libcryptopp.dylib dynamic library" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + elif [[ (-e "$INSTALL_DIR/lib/libcryptopp.so") ]]; then + echo "ERROR: failed to remove libcryptopp.so dynamic library" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS" + fi + fi fi ############################################# @@ -7108,8 +7275,8 @@ TEST_END=$(date) ############################################ # Cleanup, but leave output files -"$MAKE" clean > /dev/null 2>&1 -rm -f adhoc.cpp > /dev/null 2>&1 +"$MAKE" clean &>/dev/null +rm -f "${TMPDIR}/test.exe" &>/dev/null ############################################ # Report tests performed @@ -7117,26 +7284,26 @@ rm -f adhoc.cpp > /dev/null 2>&1 echo echo "************************************************" | tee -a "$TEST_RESULTS" echo "************************************************" | tee -a "$TEST_RESULTS" -echo | tee -a "$TEST_RESULTS" +echo "" | tee -a "$TEST_RESULTS" COUNT="${#TEST_LIST[@]}" if (( "$COUNT" == "0" )); then - echo "No configurations tested" | tee -a "$TEST_RESULTS" + echo "No configurations tested" | tee -a "$TEST_RESULTS" else - echo "$COUNT configurations tested" | tee -a "$TEST_RESULTS" - for TEST in "${TEST_LIST[@]}" - do - echo " - $TEST" | tee -a "$TEST_RESULTS" - done + echo "$COUNT configurations tested" | tee -a "$TEST_RESULTS" + for TEST in "${TEST_LIST[@]}" + do + echo " - $TEST" | tee -a "$TEST_RESULTS" + done fi -echo | tee -a "$TEST_RESULTS" +echo "" | tee -a "$TEST_RESULTS" ############################################ # Report errors echo echo "************************************************" | tee -a "$TEST_RESULTS" -echo | tee -a "$TEST_RESULTS" +echo "" | tee -a "$TEST_RESULTS" # "FAILED" and "Exception" are from Crypto++ # "ERROR" is from this script @@ -7145,12 +7312,12 @@ echo | tee -a "$TEST_RESULTS" # "Illegal", "Conditional", "0 errors" and "suppressed errors" are from Valgrind. ECOUNT=$("$GREP" -E '(Error|ERROR|error|FAILED|Illegal|Conditional|CryptoPP::Exception)' $TEST_RESULTS | "$GREP" -v -E '( 0 errors|suppressed errors|error detector|format-security)' | wc -l | "$AWK" '{print $1}') if (( "$ECOUNT" == "0" )); then - echo "No failures detected" | tee -a "$TEST_RESULTS" + echo "No failures detected" | tee -a "$TEST_RESULTS" else - echo "$ECOUNT errors detected. See $TEST_RESULTS for details" | tee -a "$TEST_RESULTS" - if (( "$ECOUNT" < 16 )); then - "$GREP" -n -E '(Error|ERROR|error|FAILED|Illegal|Conditional|CryptoPP::Exception)' "$TEST_RESULTS" | "$GREP" -v -E '( 0 errors|suppressed errors|error detector|Assertion|format-security)' - fi + echo "$ECOUNT errors detected. See $TEST_RESULTS for details" | tee -a "$TEST_RESULTS" + if (( "$ECOUNT" < 16 )); then + "$GREP" -n -E '(Error|ERROR|error|FAILED|Illegal|Conditional|CryptoPP::Exception)' "$TEST_RESULTS" | "$GREP" -v -E '( 0 errors|suppressed errors|error detector|Assertion|format-security)' + fi fi ############################################ @@ -7158,14 +7325,14 @@ fi echo echo "************************************************" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" -echo | tee -a "$TEST_RESULTS" "$WARN_RESULTS" +echo "" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" WCOUNT=$("$GREP" -E '(warning:)' $WARN_RESULTS | wc -l | "$AWK" '{print $1}') if (( "$WCOUNT" == "0" )); then - echo "No warnings detected" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" + echo "No warnings detected" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" else - echo "$WCOUNT warnings detected. See $WARN_RESULTS for details" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" - # "$GREP" -n -E '(warning:)' $WARN_RESULTS | "$GREP" -v 'deprecated-declarations' + echo "$WCOUNT warnings detected. See $WARN_RESULTS for details" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" + # "$GREP" -n -E '(warning:)' $WARN_RESULTS | "$GREP" -v 'deprecated-declarations' fi ############################################ @@ -7173,7 +7340,7 @@ fi echo echo "************************************************" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" -echo | tee -a "$TEST_RESULTS" "$WARN_RESULTS" +echo "" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" echo "Testing started: $TEST_BEGIN" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" echo "Testing finished: $TEST_END" | tee -a "$TEST_RESULTS" "$WARN_RESULTS" @@ -7182,7 +7349,7 @@ echo ############################################ # http://tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF if (( "$ECOUNT" == "0" )); then - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0 + exit 0 else - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 + exit 1 fi diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/governor.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/governor.sh index a1f571d0..8b4783ca 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/governor.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/governor.sh @@ -1,25 +1,37 @@ #!/usr/bin/env bash +############################################################################# +# # This scripts queries and modifies CPU scaling frequencies to produce more -# accurate benchmark results. To move from a low energy state C-state to a -# higher one, run 'governor.sh performance'. To move back to a low power state -# run 'governor.sh powersave' or reboot. The script is based on code by -# Andy Polyakov, http://www.openssl.org/~appro/cryptogams/. +# accurate benchmark results. To move from a low power state to a higher +# one, run 'governor.sh performance'. To move back to a low power state +# run 'governor.sh powersave' or 'governor.sh ondemand' or reboot. +# +# Written and placed in public domain by Jeffrey Walton. The script based on +# code by Andy Polyakov, http://www.openssl.org/~appro/cryptogams/. +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +# See https://www.cryptopp.com/wiki/Benchmarks for more details +# +############################################################################# # Fixup ancient Bash # https://unix.stackexchange.com/q/468579/56041 -if [[ -z "$BASH_SOURCE" ]]; then +if [[ -z "${BASH_SOURCE[0]}" ]]; then BASH_SOURCE="$0" fi if [[ "$EUID" -ne 0 ]]; then echo "This script must be run as root" - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi if [ "x$1" = "x" ]; then echo "usage: $0 on[demand]|pe[rformance]|po[wersave]|us[erspace]?" - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi # "on demand" may result in a "invalid write argument" or similar @@ -27,40 +39,41 @@ case $1 in on*|de*) governor="ondemand";; po*|pw*) governor="powersave";; pe*) governor="performance";; + co*) governor="conservative";; us*) governor="userspace";; \?) ;; *) echo "$1: unrecognized governor";; esac if [ -z "$governor" ]; then - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi cpus=$(ls /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor 2>/dev/null) if [ -z "$cpus" ]; then echo "Failed to read CPU system device tree" - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 + [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 fi echo "Current CPU governor scaling settings:" count=0 for cpu in $cpus; do - echo " CPU $count:" $(cat "$cpu") + echo " CPU $count: $(cat "$cpu")" ((count++)) done if [ "x$governor" != "x" ]; then for cpu in $cpus; do - echo $governor > $cpu + echo "$governor" > "$cpu" done fi echo "New CPU governor scaling settings:" count=0 for cpu in $cpus; do - echo " CPU $count:" $(cat "$cpu") + echo " CPU $count: $(cat "$cpu")" ((count++)) done -[[ "$0" = "$BASH_SOURCE" ]] && exit 0 || return 0 +[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/install-android.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/install-android.sh deleted file mode 100755 index 43919e3d..00000000 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/install-android.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -e - -# install android deps -sudo apt-get -qq update -sudo apt-get -qq install --no-install-recommends openjdk-8-jdk unzip - -# android skd/ndk -curl -Lo /tmp/android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -unzip -qq /tmp/android-sdk.zip -d "$ANDROID_SDK" -rm -f /tmp/android-sdk.zip -echo y | "$ANDROID_SDK/tools/bin/sdkmanager" --update > /dev/null -for package in "ndk-bundle"; do - echo install android $package - echo y | "$ANDROID_SDK/tools/bin/sdkmanager" "$package" > /dev/null -done diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/install-ndk.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/install-ndk.sh new file mode 100755 index 00000000..0885f002 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/install-ndk.sh @@ -0,0 +1,207 @@ +#!/usr/bin/env bash + +############################################################################# +# Tests Android cross-compiles +# +# This script installs a SDK and NDK to test Android cross-compiles. +# +# Written and placed in public domain by Jeffrey Walton +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +# See http://www.cryptopp.com/wiki/Android_(Command_Line) for more details +############################################################################# + +# NDK-r19: https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip +# SDK for r19: https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip +# SDK for Mac: https://dl.google.com/android/repository/sdk-tools-mac-4333796.zip + +# NDK-r20: https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip +# SDK for r20: https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip +# SDK for Mac: https://dl.google.com/android/repository/commandlinetools-mac-6200805_latest.zip + +# NDK-r21: https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip +# SDK for r21: https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip +# SDK for Mac: https://dl.google.com/android/repository/commandlinetools-mac-6200805_latest.zip + +# NDK-r22: https://dl.google.com/android/repository/android-ndk-r22-linux-x86_64.zip +# SDK for r22: https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip +# SDK for Mac: https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip + +# Platform tools +# Linux: https://dl.google.com/android/repository/platform-tools-latest-linux.zip +# Mac: https://dl.google.com/android/repository/platform-tools-latest-darwin.zip +# Windows: https://dl.google.com/android/repository/platform-tools-latest-windows.zip + +function cleanup { + # Cleanup downloads + rm -f android-sdk.zip android-ndk.zip platform-tools.zip +} +trap cleanup EXIT + +if [ -z "${ANDROID_SDK_ROOT}" ]; then + echo "ERROR: ANDROID_SDK_ROOT is not set for ${USER}. Please set it." + exit 1 +fi + +if [ -z "${ANDROID_NDK_ROOT}" ]; then + echo "ERROR: ANDROID_NDK_ROOT is not set for ${USER}. Please set it." + exit 1 +fi + +# Temp directory +if [[ -z "${TMPDIR}" ]]; then + TMPDIR="$HOME/tmp" + mkdir -p "${TMPDIR}" + if [ -n "${SUDO_USER}" ]; then + chown -R "${SUDO_USER}" "${TMPDIR}" + fi +fi + +# Install Android deps +if [[ -z "$(command -v java 2>/dev/null)" && -n "$(command -v apt-get 2>/dev/null)" ]]; then + apt-get -qq update 2>/dev/null || true + apt-get -qq install --no-install-recommends unzip curl wget 2>/dev/null || true + + if [[ -n "$(apt-cache search openjdk-13-jdk 2>/dev/null | head -n 1)" ]]; then + apt-get -qq install --no-install-recommends openjdk-13-jdk 2>/dev/null || true + elif [[ -n "$(apt-cache search openjdk-8-jdk 2>/dev/null | head -n 1)" ]]; then + apt-get -qq install --no-install-recommends openjdk-8-jdk 2>/dev/null || true + fi +elif [[ -z "$(command -v java 2>/dev/null)" && -n "$(command -v dnf 2>/dev/null)" ]]; then + dnf update 2>/dev/null || true + dnf install unzip curl wget 2>/dev/null || true + + if [[ -n "$(dnf search java-latest-openjdk-devel 2>/dev/null | head -n 1)" ]]; then + dnf install java-latest-openjdk-devel 2>/dev/null || true + elif [[ -n "$(dnf search java-11-openjdk-devel 2>/dev/null | head -n 1)" ]]; then + dnf install java-11-openjdk-devel 2>/dev/null || true + fi +elif [[ -z "$(command -v java 2>/dev/null)" && -n "$(command -v yum 2>/dev/null)" ]]; then + yum update 2>/dev/null || true + yum install unzip curl wget 2>/dev/null || true + + if [[ -n "$(yum search java-latest-openjdk-devel 2>/dev/null | head -n 1)" ]]; then + yum install java-latest-openjdk-devel 2>/dev/null || true + elif [[ -n "$(yum search java-11-openjdk-devel 2>/dev/null | head -n 1)" ]]; then + yum install java-11-openjdk-devel 2>/dev/null || true + fi +fi + +# User feedback +#echo "ANDROID_NDK_ROOT is '${ANDROID_NDK_ROOT}'" +#echo "ANDROID_SDK_ROOT is '${ANDROID_SDK_ROOT}'" + +IS_DARWIN=$(uname -s 2>/dev/null | grep -i -c darwin) +IS_LINUX=$(uname -s 2>/dev/null | grep -i -c linux) + +# Change NDK_NAME as required +NDK_NAME=android-ndk-r20b +NDK_TOP=$(dirname "${ANDROID_NDK_ROOT}") + +# Keep this in sync with the move at the end. +if [ "$IS_LINUX" -eq 1 ]; then + NDK_URL=https://dl.google.com/android/repository/${NDK_NAME}-linux-x86_64.zip + SDK_URL=https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip + TOOLS_URL=https://dl.google.com/android/repository/platform-tools-latest-linux.zip +elif [ "$IS_DARWIN" -eq 1 ]; then + NDK_URL=https://dl.google.com/android/repository/${NDK_NAME}-darwin-x86_64.zip + SDK_URL=https://dl.google.com/android/repository/commandlinetools-mac-6200805_latest.zip + TOOLS_URL=https://dl.google.com/android/repository/platform-tools-latest-darwin.zip +else + echo "Unknown platform: \"$(uname -s 2>/dev/null)\". Please fix this script." +fi + +echo "Downloading SDK" +if ! curl -L -s -o android-sdk.zip "${SDK_URL}"; +then + echo "Failed to download SDK" + exit 1 +fi + +echo "Downloading NDK" +if ! curl -L -s -o android-ndk.zip "${NDK_URL}"; +then + echo "Failed to download NDK" + exit 1 +fi + +echo "Downloading Platform Tools" +if ! curl -L -s -o platform-tools.zip "${TOOLS_URL}"; +then + echo "Failed to download Platform Tools" + exit 1 +fi + +# Android SDK does not include a top level directory +echo "Unpacking SDK to ${ANDROID_SDK_ROOT}" +if ! unzip -u -qq android-sdk.zip -d "${ANDROID_SDK_ROOT}"; +then + echo "Failed to unpack SDK" + exit 1 +fi + +# Android NDK includes top level NDK_NAME directory +echo "Unpacking NDK to ${NDK_TOP}/${NDK_NAME}" +if ! unzip -u -qq android-ndk.zip -d "${NDK_TOP}"; +then + echo "Failed to unpack NDK" + exit 1 +fi + +echo "Unpacking Platform Tools to ${ANDROID_SDK_ROOT}" +if ! unzip -u -qq platform-tools.zip -d "${ANDROID_SDK_ROOT}"; +then + echo "Failed to unpack Platform Tools" + exit 1 +fi + +# Unlink as needed +if [[ -e "${ANDROID_NDK_ROOT}" ]]; then + ls_output=$(ls -l "${ANDROID_NDK_ROOT}" 2>/dev/null | head -n 1) + # Only remove soft links + if [[ ${ls_output:0:1} == "l" ]]; then + unlink "${ANDROID_NDK_ROOT}" + fi +fi + +# Create softlink +( + echo "Symlinking ${NDK_NAME} to android-ndk" + cd ${NDK_TOP} || exit 1 + if ! ln -s "${NDK_NAME}" android-ndk; then + echo "Failed to link ${NDK_NAME} to android-ndk" + fi +) + +# We don't set ANDROID_HOME to ANDROID_SDK_ROOT. +# https://stackoverflow.com/a/47028911/608639 +touch "${ANDROID_SDK_ROOT}/repositories.cfg" + +# And https://stackoverflow.com/q/43433542 +mkdir -p "${HOME}/.android" +touch "${HOME}/.android/repositories.cfg" + +if [[ -n "${SUDO_USER}" ]]; then + chown -R "${SUDO_USER}" "${HOME}/.android" +fi + +count=$(ls -1 "${ANDROID_SDK_ROOT}" 2>/dev/null | wc -l) +if [[ "${count}" -lt 2 ]]; then + echo "ANDROID_SDK_ROOT appears empty. The contents are listed." + echo "$(ls "${ANDROID_SDK_ROOT}")" + exit 1 +fi + +count=$(ls -1 "${ANDROID_NDK_ROOT}" 2>/dev/null | wc -l) +if [[ "${count}" -lt 2 ]]; then + echo "ANDROID_NDK_ROOT appears empty. The contents are listed." + echo "$(ls "${ANDROID_NDK_ROOT}")" + exit 1 +fi + +echo "Finished installing SDK and NDK" + +exit 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/make-benchmarks.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/make-benchmarks.sh index 71b4331e..6d522aa6 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/make-benchmarks.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/make-benchmarks.sh @@ -1,14 +1,21 @@ #!/usr/bin/env bash -# make-benchmarks - Scan build submission instructions for Unix and Linux. -# Written and placed in public domain by Jeffrey Walton and Uri Blumenthal. -# Copyright assigned to Crypto++ project. +############################################################################# # -# The following builds the benchmarks under 5.6.2, 5.6.4 and Master. The results can then be -# compared to ensure an speed penalty is not inadvertently taken. Crypto++ 5.6.2 is significant -# because its the last version Wei worked on before turning the library over to the community. - -############################################################################### +# The following builds the benchmarks under 5.6.2, 5.6.4 and Master. The +# results can then be compared to ensure an speed penalty is not inadvertently +# taken. Crypto++ 5.6.2 is significant because its the last version Wei worked +# on before turning the library over to the community. +# +# Written and placed in public domain by Jeffrey Walton. +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +# See https://www.cryptopp.com/wiki/Benchmarks for more details +# +############################################################################# # Set to suite your taste. Speed is in GiHz @@ -25,16 +32,16 @@ echo "Using CPU frequency of $CPU_FREQ GiHz." echo "Please modify this script if its not correct" echo -############################################################################### +############################################################################# current=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) git fetch --all &>/dev/null &>/dev/null if [[ "$?" -ne "0" ]]; then echo "$PWD does not appear to be a Git repository" - [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 + exit 1 fi -############################################################################### +############################################################################# # Try to find a fast option OPT= @@ -79,7 +86,7 @@ if [[ -z "$OPT" ]]; then fi fi -################################################################## +############################################################################# echo "***************************************************" echo "**************** Crypto++ 5.6.2 *******************" @@ -105,7 +112,7 @@ else fi fi -################################################################## +############################################################################# echo "***************************************************" echo "**************** Crypto++ 5.6.4 *******************" @@ -131,7 +138,7 @@ else fi fi -################################################################## +############################################################################# echo "***************************************************" echo "*************** Crypto++ Master *******************" @@ -157,10 +164,10 @@ else fi fi -################################################################## +############################################################################# if [[ ! -z "$current" ]]; then git checkout -f "$current" fi -[[ "$0" = "$BASH_SOURCE" ]] && exit 0 || return 0 +exit 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/reset-fork.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/reset-fork.sh index ab25b9fe..17bb925c 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/reset-fork.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/reset-fork.sh @@ -2,6 +2,13 @@ # Use this script to reset a fork to Wei Dai's master # https://stackoverflow.com/questions/9646167/clean-up-a-fork-and-restart-it-from-the-upstream +# +# Written and placed in public domain by Jeffrey Walton +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# git remote add upstream https://github.com/weidai11/cryptopp 2>/dev/null git fetch upstream diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android-gcc.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android-gcc.sh deleted file mode 100755 index 69fb2f72..00000000 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android-gcc.sh +++ /dev/null @@ -1,449 +0,0 @@ -#!/usr/bin/env bash - -# ==================================================================== -# Sets the cross compile environment for Android -# Based upon OpenSSL's setenv-android.sh (by TH, JW, and SM). -# Updated by Skycoder42 to the latest NDK. -# These changes are based on the current recommendations for Android -# for their "Unified Headers". Details can be found at: -# https://android.googlesource.com/platform/ndk.git/+/HEAD/docs/UnifiedHeaders.md -# https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md -# -# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) -# licensed under the Boost Software License 1.0, while the individual files -# in the compilation are all public domain. -# -# See http://www.cryptopp.com/wiki/Android_(Command_Line) for more details -# ==================================================================== - -# set -eu - -unset IS_CROSS_COMPILE - -unset IS_IOS -unset IS_ANDROID -unset IS_ARM_EMBEDDED - -# Variables used in GNUmakefile-cross -unset AOSP_FLAGS -unset AOSP_SYSROOT -unset AOSP_LD_SYSROOT -unset AOSP_SYS_ARCH_INC -unset AOSP_STL_INC -unset AOSP_STL_LIB -unset AOSP_BITS_INC - -# Tools set by this script -unset CPP CC CXX LD AS AR RANLIB STRIP - -# Similar to a "make clean" -if [ x"${1-}" = "xunset" ]; then - echo "Unsetting script variables. PATH may remain tainted" - [ "$0" = "$BASH_SOURCE" ] && exit 0 || return 0 -fi - -# Set AOSP_TOOLCHAIN_SUFFIX to your preference of tools and STL library. -# Note: 4.9 is required for the latest architectures, like ARM64/AARCH64. -# AOSP_TOOLCHAIN_SUFFIX=4.8 -# AOSP_TOOLCHAIN_SUFFIX=4.9 -if [ -z "${AOSP_TOOLCHAIN_SUFFIX-}" ]; then - AOSP_TOOLCHAIN_SUFFIX=4.9 -fi - -# Set AOSP_API_VERSION to the API you want to use. 'armeabi' and 'armeabi-v7a' need -# API 3 (or above), 'mips' and 'x86' need API 9 (or above), etc. -# AOSP_API_VERSION="3" # Android 1.5 and above -# AOSP_API_VERSION="4" # Android 1.6 and above -# AOSP_API_VERSION="5" # Android 2.0 and above -# AOSP_API_VERSION="8" # Android 2.2 and above -# AOSP_API_VERSION="9" # Android 2.3 and above -# AOSP_API_VERSION="14" # Android 4.0 and above -# AOSP_API_VERSION="18" # Android 4.3 and above -# AOSP_API_VERSION="19" # Android 4.4 and above -# AOSP_API_VERSION="21" # Android 5.0 and above -# AOSP_API_VERSION="23" # Android 6.0 and above -if [ -z "${AOSP_API_VERSION-}" ]; then - AOSP_API_VERSION="21" -fi - -if [ -z "${AOSP_API-}" ]; then - AOSP_API="android-${AOSP_API_VERSION}" -else - echo "WARNING: Using AOSP_API has been deprecated. Please use AOSP_API_VERSION instead." - echo "If you set for example AOSP_API=android-23 then now instead set AOSP_API_VERSION=23" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -##################################################################### - -# ANDROID_NDK_ROOT should always be set by the user (even when not running this script) -# http://groups.google.com/group/android-ndk/browse_thread/thread/a998e139aca71d77. -# If the user did not specify the NDK location, try and pick it up. We expect something -# like ANDROID_NDK_ROOT=/opt/android-ndk-r10e or ANDROID_NDK_ROOT=/usr/local/android-ndk-r10e. - -if [ -z "${ANDROID_NDK_ROOT-}" ]; then - ANDROID_NDK_ROOT=$(find /opt -maxdepth 1 -type d -name android-ndk* 2>/dev/null | tail -1) - - if [ -z "$ANDROID_NDK_ROOT" ]; then - ANDROID_NDK_ROOT=$(find /usr/local -maxdepth 1 -type d -name android-ndk* 2>/dev/null | tail -1) - fi - if [ -z "$ANDROID_NDK_ROOT" ]; then - ANDROID_NDK_ROOT=$(find $HOME -maxdepth 1 -type d -name android-ndk* 2>/dev/null | tail -1) - fi - if [ -d "$HOME/Library/Android/sdk/ndk-bundle" ]; then - ANDROID_NDK_ROOT="$HOME/Library/Android/sdk/ndk-bundle" - fi -fi - -# Error checking -if [ ! -d "$ANDROID_NDK_ROOT/toolchains" ]; then - echo "ERROR: ANDROID_NDK_ROOT is not a valid path. Please set it." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -##################################################################### - -if [ "$#" -lt 1 ]; then - THE_ARCH=armv7a-neon -else - THE_ARCH=$(tr [A-Z] [a-z] <<< "$1") -fi - -# https://developer.android.com/ndk/guides/abis.html -case "$THE_ARCH" in - arm|armv5|armv6|armv7|armeabi) - TOOLCHAIN_ARCH="arm-linux-androideabi" - TOOLCHAIN_NAME="arm-linux-androideabi" - AOSP_ABI="armeabi" - AOSP_ARCH="arch-arm" - AOSP_FLAGS="-march=armv5te -mtune=xscale -mthumb -msoft-float -DCRYPTOPP_DISABLE_ASM -funwind-tables -fexceptions -frtti" - ;; - armv7a|armv7-a|armeabi-v7a) - TOOLCHAIN_ARCH="arm-linux-androideabi" - TOOLCHAIN_NAME="arm-linux-androideabi" - AOSP_ABI="armeabi-v7a" - AOSP_ARCH="arch-arm" - AOSP_FLAGS="-march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -DCRYPTOPP_DISABLE_ASM -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti" - ;; - hard|armv7a-hard|armeabi-v7a-hard) - echo hard, armv7a-hard and armeabi-v7a-hard are not supported, as android uses softfloats - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 - #TOOLCHAIN_ARCH="arm-linux-androideabi" - #TOOLCHAIN_NAME="arm-linux-androideabi" - #AOSP_ABI="armeabi-v7a" - #AOSP_ARCH="arch-arm" - #AOSP_FLAGS="-mhard-float -D_NDK_MATH_NO_SOFTFP=1 -march=armv7-a -mfpu=vfpv3-d16 -DCRYPTOPP_DISABLE_ASM -mfloat-abi=softfp -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti -Wl,--no-warn-mismatch -Wl,-lm_hard" - ;; - neon|armv7a-neon) - TOOLCHAIN_ARCH="arm-linux-androideabi" - TOOLCHAIN_NAME="arm-linux-androideabi" - AOSP_ABI="armeabi-v7a" - AOSP_ARCH="arch-arm" - AOSP_FLAGS="-march=armv7-a -mfpu=neon -mfloat-abi=softfp -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti" - ;; - armv8|armv8a|aarch64|arm64|arm64-v8a) - TOOLCHAIN_ARCH="aarch64-linux-android" - TOOLCHAIN_NAME="aarch64-linux-android" - AOSP_ABI="arm64-v8a" - AOSP_ARCH="arch-arm64" - AOSP_FLAGS="-funwind-tables -fexceptions -frtti" - ;; - mips|mipsel) - TOOLCHAIN_ARCH="mipsel-linux-android" - TOOLCHAIN_NAME="mipsel-linux-android" - AOSP_ABI="mips" - AOSP_ARCH="arch-mips" - AOSP_FLAGS="-funwind-tables -fexceptions -frtti" - ;; - mips64|mipsel64|mips64el) - TOOLCHAIN_ARCH="mips64el-linux-android" - TOOLCHAIN_NAME="mips64el-linux-android" - AOSP_ABI="mips64" - AOSP_ARCH="arch-mips64" - AOSP_FLAGS="-funwind-tables -fexceptions -frtti" - ;; - x86) - TOOLCHAIN_ARCH="x86" - TOOLCHAIN_NAME="i686-linux-android" - AOSP_ABI="x86" - AOSP_ARCH="arch-x86" - AOSP_FLAGS="-mtune=intel -mssse3 -mfpmath=sse -funwind-tables -fexceptions -frtti" - ;; - x86_64|x64) - TOOLCHAIN_ARCH="x86_64" - TOOLCHAIN_NAME="x86_64-linux-android" - AOSP_ABI="x86_64" - AOSP_ARCH="arch-x86_64" - AOSP_FLAGS="-march=x86-64 -msse4.2 -mpopcnt -mtune=intel -funwind-tables -fexceptions -frtti" - ;; - *) - echo "ERROR: Unknown architecture $1" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 - ;; -esac - -##################################################################### - -# add missing android API version flag as of https://android.googlesource.com/platform/ndk.git/+/HEAD/docs/UnifiedHeaders.md -AOSP_FLAGS="-D__ANDROID_API__=$AOSP_API_VERSION $AOSP_FLAGS" - -# GNUmakefile-cross expects these to be set. They are also used in the tests below. -export IS_ANDROID=1 -export AOSP_FLAGS - -export CPP="$TOOLCHAIN_NAME-cpp" -export CC="$TOOLCHAIN_NAME-gcc" -export CXX="$TOOLCHAIN_NAME-g++" -export LD="$TOOLCHAIN_NAME-ld" -export AS="$TOOLCHAIN_NAME-as" -export AR="$TOOLCHAIN_NAME-ar" -export RANLIB="$TOOLCHAIN_NAME-ranlib" -export STRIP="$TOOLCHAIN_NAME-strip" -export AOSP_SYS_ARCH_INC="$ANDROID_NDK_ROOT/sysroot/usr/include/$TOOLCHAIN_NAME" - -##################################################################### - -# Based on ANDROID_NDK_ROOT, try and pick up the path for the tools. We expect something -# like /opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin -# Once we locate the tools, we add it to the PATH. -AOSP_TOOLCHAIN_PATH="" -for host in "linux-x86_64" "darwin-x86_64" "linux-x86" "darwin-x86" -do - if [ -d "$ANDROID_NDK_ROOT/toolchains/$TOOLCHAIN_ARCH-$AOSP_TOOLCHAIN_SUFFIX/prebuilt/$host/bin" ]; then - AOSP_TOOLCHAIN_PATH="$ANDROID_NDK_ROOT/toolchains/$TOOLCHAIN_ARCH-$AOSP_TOOLCHAIN_SUFFIX/prebuilt/$host/bin" - break - fi -done - -# Error checking -if [ -z "$AOSP_TOOLCHAIN_PATH" ] || [ ! -d "$AOSP_TOOLCHAIN_PATH" ]; then - echo "ERROR: AOSP_TOOLCHAIN_PATH is not valid. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$CPP" ]; then - echo "ERROR: Failed to find Android cpp. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$CC" ]; then - echo "ERROR: Failed to find Android gcc. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$CXX" ]; then - echo "ERROR: Failed to find Android g++. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$RANLIB" ]; then - echo "ERROR: Failed to find Android ranlib. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$AR" ]; then - echo "ERROR: Failed to find Android ar. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$AS" ]; then - echo "ERROR: Failed to find Android as. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$LD" ]; then - echo "ERROR: Failed to find Android ld. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Only modify/export PATH if AOSP_TOOLCHAIN_PATH good -if [ -d "$AOSP_TOOLCHAIN_PATH" ]; then - - # And only modify PATH if AOSP_TOOLCHAIN_PATH is not present - LEN=${#AOSP_TOOLCHAIN_PATH} - SUBSTR=${PATH:0:$LEN} - if [ "$SUBSTR" != "$AOSP_TOOLCHAIN_PATH" ]; then - export PATH="$AOSP_TOOLCHAIN_PATH":"$PATH" - fi -fi - -##################################################################### - -# Error checking -if [ ! -d "$ANDROID_NDK_ROOT/platforms/$AOSP_API" ]; then - echo "ERROR: AOSP_API is not valid. Does the NDK support the API? Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -elif [ ! -d "$ANDROID_NDK_ROOT/platforms/$AOSP_API/$AOSP_ARCH" ]; then - echo "ERROR: AOSP_ARCH is not valid. Does the NDK support the architecture? Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Android SYSROOT. It will be used on the command line with --sysroot -# http://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html -export AOSP_SYSROOT="$ANDROID_NDK_ROOT/sysroot" -export AOSP_LD_SYSROOT="$ANDROID_NDK_ROOT/platforms/$AOSP_API/$AOSP_ARCH" - -##################################################################### - -# Android STL. We support GNU, LLVM and STLport out of the box. - -if [ "$#" -lt 2 ]; then - THE_STL=gnu-shared -else - THE_STL=$(tr [A-Z] [a-z] <<< "$2") -fi - -# LLVM include directory may be different depending on NDK version. Default to new location (latest NDK checked: r16beta1). -LLVM_INCLUDE_DIR="$ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/include" -if [ ! -d "$LLVM_INCLUDE_DIR" ]; then - LLVM_INCLUDE_DIR="$ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/libcxx/include" -fi - -case "$THE_STL" in - stlport-static) - AOSP_STL_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/stlport/" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/libs/$AOSP_ABI/libstlport_static.a" - ;; - stlport|stlport-shared) - AOSP_STL_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/stlport/" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/libs/$AOSP_ABI/libstlport_shared.so" - ;; - gabi++-static|gnu-static) - AOSP_STL_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/include" - AOSP_BITS_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/libs/$AOSP_ABI/include" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/libs/$AOSP_ABI/libgnustl_static.a" - ;; - gnu|gabi++|gnu-shared|gabi++-shared) - AOSP_STL_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/include" - AOSP_BITS_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/libs/$AOSP_ABI/include" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/libs/$AOSP_ABI/libgnustl_shared.so" - ;; - llvm-static) - echo WARNING: llvm is still in experimental state and migth not work as expected - if [ ! -d "$LLVM_INCLUDE_DIR" ]; then - echo "ERROR: Unable to locate include LLVM directory at $LLVM_INCLUDE_DIR -- has it moved since NDK r16beta1?" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 - fi - AOSP_STL_INC="$LLVM_INCLUDE_DIR" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$AOSP_ABI/libc++_static.a" - ;; - llvm|llvm-shared) - echo WARNING: llvm is still in experimental state and migth not work as expected - if [ ! -d "$LLVM_INCLUDE_DIR" ]; then - echo "ERROR: Unable to locate LLVM include directory at $LLVM_INCLUDE_DIR -- has it moved since NDK r16beta1?" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 - fi - AOSP_STL_INC="$LLVM_INCLUDE_DIR" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$AOSP_ABI/libc++_shared.so" - ;; - *) - echo "ERROR: Unknown STL library $2" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -esac - -# Error checking -if [ ! -d "$AOSP_STL_INC" ] || [ ! -e "$AOSP_STL_INC/memory" ]; then - echo "ERROR: AOSP_STL_INC is not valid. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_STL_LIB" ]; then - echo "ERROR: AOSP_STL_LIB is not valid. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -export AOSP_STL_INC -export AOSP_STL_LIB - -if [ ! -z "$AOSP_BITS_INC" ]; then - export AOSP_BITS_INC -fi - -# Now that we are using cpu-features from Android rather than CPU probing, we -# need to copy cpu-features.h and cpu-features.c from the NDK into our source -# directory and then build it. - -if [[ ! -e "$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.h" ]]; then - echo "ERROR: Unable to locate cpu-features.h" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi -cp "$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.h" . - -if [[ ! -e "$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.c" ]]; then - echo "ERROR: Unable to locate cpu-features.c" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi -cp "$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.c" . - -##################################################################### - -VERBOSE=1 -if [ ! -z "$VERBOSE" ] && [ "$VERBOSE" != "0" ]; then - echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT" - echo "AOSP_TOOLCHAIN_PATH: $AOSP_TOOLCHAIN_PATH" - echo "AOSP_ABI: $AOSP_ABI" - echo "AOSP_API: $AOSP_API" - echo "AOSP_SYSROOT: $AOSP_SYSROOT" - echo "AOSP_LD_SYSROOT: $AOSP_LD_SYSROOT" - echo "AOSP_FLAGS: $AOSP_FLAGS" - echo "AOSP_SYS_ARCH_INC: $AOSP_SYS_ARCH_INC" - echo "AOSP_STL_INC: $AOSP_STL_INC" - echo "AOSP_STL_LIB: $AOSP_STL_LIB" - if [ ! -z "$AOSP_BITS_INC" ]; then - echo "AOSP_BITS_INC: $AOSP_BITS_INC" - fi - - if [ -e "cpu-features.h" ] && [ -e "cpu-features.c" ]; then - echo "CPU FEATURES: cpu-features.h and cpu-features.c are present" - fi -fi - -##################################################################### - -COUNT=$(echo -n "$AOSP_STL_LIB" | egrep -i -c 'libstdc\+\+') -if [[ ("$COUNT" -ne "0") ]]; then - echo - echo "*******************************************************************************" - echo "You are using GNU's runtime and STL library. Please ensure the resulting" - echo "binary meets licensing requirements. If you can't use GNU's runtime" - echo "and STL library, then reconfigure with stlport or llvm. Also see" - echo "http://code.google.com/p/android/issues/detail?id=216331" - echo "*******************************************************************************" -fi - -COUNT=$(echo -n "$AOSP_STL_LIB" | grep -i -c 'libstlport') -if [[ ("$COUNT" -ne "0") ]]; then - echo - echo "*******************************************************************************" - echo "You are using STLport's runtime and STL library. STLport could cause problems" - echo "if the resulting binary is used in other environments, like a QT project." - echo "Also see http://code.google.com/p/android/issues/detail?id=216331" - echo "*******************************************************************************" -fi - -COUNT=$(echo -n "$AOSP_STL_LIB" | egrep -i -c 'libc\+\+') -if [[ ("$COUNT" -ne "0") ]]; then - echo - echo "*******************************************************************************" - echo "You are using LLVM's runtime and STL library. LLVM could cause problems" - echo "if the resulting binary is used in other environments, like a QT project." - echo "Also see http://code.google.com/p/android/issues/detail?id=216331" - echo "*******************************************************************************" -fi - -echo -echo "*******************************************************************************" -echo "It looks the the environment is set correctly. Your next step is build" -echo "the library with 'make -f GNUmakefile-cross'. You can create a versioned" -echo "shared object using 'HAS_SOLIB_VERSION=1 make -f GNUmakefile-cross'" -echo "*******************************************************************************" -echo - -[ "$0" = "$BASH_SOURCE" ] && exit 0 || return 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android-old.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android-old.sh deleted file mode 100755 index d93b568d..00000000 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android-old.sh +++ /dev/null @@ -1,430 +0,0 @@ -#!/usr/bin/env bash - -# ==================================================================== -# Sets the cross compile environment for Android -# Based upon OpenSSL's setenv-android.sh (by TH, JW, and SM). -# -# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) -# licensed under the Boost Software License 1.0, while the individual files -# in the compilation are all public domain. -# -# This script is the one used from about 2012 until late 2017. Sometime in -# 2017 AOSP made some NDK changes that were incompatible with the original -# script. The original setenv-android.sh was renamed to setenv-android-old.sh, -# and it can be used on older NDKs like r9 or r13. setenv-android.sh was then -# reworked for newer NDKs, like r16. setenv-android.sh effectively supports -# the latest NDKs. Also see https://github.com/weidai11/cryptopp/pull/546. -# -# See http://www.cryptopp.com/wiki/Android_(Command_Line) for more details -# ==================================================================== - -# set -eu - -unset IS_CROSS_COMPILE - -unset IS_IOS -unset IS_ANDROID -unset IS_ARM_EMBEDDED - -# Variables used in GNUmakefile-cross -unset AOSP_FLAGS -unset AOSP_SYSROOT -unset AOSP_STL_INC -unset AOSP_STL_LIB -unset AOSP_BITS_INC - -# Tools set by this script -unset CPP CC CXX LD AS AR RANLIB STRIP - -# Similar to a "make clean" -if [ x"${1-}" = "xunset" ]; then - echo "Unsetting script variables. PATH may remain tainted" - [ "$0" = "$BASH_SOURCE" ] && exit 0 || return 0 -fi - -# Set AOSP_TOOLCHAIN_SUFFIX to your preference of tools and STL library. -# Note: 4.9 is required for the latest architectures, like ARM64/AARCH64. -# AOSP_TOOLCHAIN_SUFFIX=4.8 -# AOSP_TOOLCHAIN_SUFFIX=4.9 -if [ -z "${AOSP_TOOLCHAIN_SUFFIX-}" ]; then - AOSP_TOOLCHAIN_SUFFIX=4.9 -fi - -# Set AOSP_API to the API you want to use. 'armeabi' and 'armeabi-v7a' need -# API 3 (or above), 'mips' and 'x86' need API 9 (or above), etc. -# AOSP_API="android-3" # Android 1.5 and above -# AOSP_API="android-4" # Android 1.6 and above -# AOSP_API="android-5" # Android 2.0 and above -# AOSP_API="android-8" # Android 2.2 and above -# AOSP_API="android-9" # Android 2.3 and above -# AOSP_API="android-14" # Android 4.0 and above -# AOSP_API="android-18" # Android 4.3 and above -# AOSP_API="android-19" # Android 4.4 and above -# AOSP_API="android-21" # Android 5.0 and above -# AOSP_API="android-23" # Android 6.0 and above -if [ -z "${AOSP_API-}" ]; then - AOSP_API="android-21" -fi - -##################################################################### - -# ANDROID_NDK_ROOT should always be set by the user (even when not running this script) -# http://groups.google.com/group/android-ndk/browse_thread/thread/a998e139aca71d77. -# If the user did not specify the NDK location, try and pick it up. We expect something -# like ANDROID_NDK_ROOT=/opt/android-ndk-r10e or ANDROID_NDK_ROOT=/usr/local/android-ndk-r10e. - -if [ -z "${ANDROID_NDK_ROOT-}" ]; then - ANDROID_NDK_ROOT=$(find /opt -maxdepth 1 -type d -name android-ndk* 2>/dev/null | tail -1) - - if [ -z "$ANDROID_NDK_ROOT" ]; then - ANDROID_NDK_ROOT=$(find /usr/local -maxdepth 1 -type d -name android-ndk* 2>/dev/null | tail -1) - fi - if [ -z "$ANDROID_NDK_ROOT" ]; then - ANDROID_NDK_ROOT=$(find $HOME -maxdepth 1 -type d -name android-ndk* 2>/dev/null | tail -1) - fi - if [ -d "$HOME/Library/Android/sdk/ndk-bundle" ]; then - ANDROID_NDK_ROOT="$HOME/Library/Android/sdk/ndk-bundle" - fi -fi - -# Error checking -if [ ! -d "$ANDROID_NDK_ROOT/toolchains" ]; then - echo "ERROR: ANDROID_NDK_ROOT is not a valid path. Please set it." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -##################################################################### - -if [ "$#" -lt 1 ]; then - THE_ARCH=armv7a-neon -else - THE_ARCH=$(tr [A-Z] [a-z] <<< "$1") -fi - -# https://developer.android.com/ndk/guides/abis.html -case "$THE_ARCH" in - arm|armv5|armv6|armv7|armeabi) - TOOLCHAIN_ARCH="arm-linux-androideabi" - TOOLCHAIN_NAME="arm-linux-androideabi" - AOSP_ABI="armeabi" - AOSP_ARCH="arch-arm" - AOSP_FLAGS="-march=armv5te -mtune=xscale -mthumb -msoft-float -DCRYPTOPP_DISABLE_ASM -funwind-tables -fexceptions -frtti" - ;; - armv7a|armv7-a|armeabi-v7a) - TOOLCHAIN_ARCH="arm-linux-androideabi" - TOOLCHAIN_NAME="arm-linux-androideabi" - AOSP_ABI="armeabi-v7a" - AOSP_ARCH="arch-arm" - AOSP_FLAGS="-march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -DCRYPTOPP_DISABLE_ASM -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti" - ;; - hard|armv7a-hard|armeabi-v7a-hard) - TOOLCHAIN_ARCH="arm-linux-androideabi" - TOOLCHAIN_NAME="arm-linux-androideabi" - AOSP_ABI="armeabi-v7a" - AOSP_ARCH="arch-arm" - AOSP_FLAGS="-mhard-float -D_NDK_MATH_NO_SOFTFP=1 -march=armv7-a -mfpu=vfpv3-d16 -DCRYPTOPP_DISABLE_ASM -mfloat-abi=softfp -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti -Wl,--no-warn-mismatch -Wl,-lm_hard" - ;; - neon|armv7a-neon) - TOOLCHAIN_ARCH="arm-linux-androideabi" - TOOLCHAIN_NAME="arm-linux-androideabi" - AOSP_ABI="armeabi-v7a" - AOSP_ARCH="arch-arm" - AOSP_FLAGS="-march=armv7-a -mfpu=neon -mfloat-abi=softfp -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti" - ;; - armv8|armv8a|aarch64|arm64|arm64-v8a) - TOOLCHAIN_ARCH="aarch64-linux-android" - TOOLCHAIN_NAME="aarch64-linux-android" - AOSP_ABI="arm64-v8a" - AOSP_ARCH="arch-arm64" - AOSP_FLAGS="-funwind-tables -fexceptions -frtti" - ;; - mips|mipsel) - TOOLCHAIN_ARCH="mipsel-linux-android" - TOOLCHAIN_NAME="mipsel-linux-android" - AOSP_ABI="mips" - AOSP_ARCH="arch-mips" - AOSP_FLAGS="-funwind-tables -fexceptions -frtti" - ;; - mips64|mipsel64|mips64el) - TOOLCHAIN_ARCH="mips64el-linux-android" - TOOLCHAIN_NAME="mips64el-linux-android" - AOSP_ABI="mips64" - AOSP_ARCH="arch-mips64" - AOSP_FLAGS="-funwind-tables -fexceptions -frtti" - ;; - x86) - TOOLCHAIN_ARCH="x86" - TOOLCHAIN_NAME="i686-linux-android" - AOSP_ABI="x86" - AOSP_ARCH="arch-x86" - AOSP_FLAGS="-mtune=intel -mssse3 -mfpmath=sse -funwind-tables -fexceptions -frtti" - ;; - x86_64|x64) - TOOLCHAIN_ARCH="x86_64" - TOOLCHAIN_NAME="x86_64-linux-android" - AOSP_ABI="x86_64" - AOSP_ARCH="arch-x86_64" - AOSP_FLAGS="-march=x86-64 -msse4.2 -mpopcnt -mtune=intel -funwind-tables -fexceptions -frtti" - ;; - *) - echo "ERROR: Unknown architecture $1" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 - ;; -esac - -##################################################################### - -# GNUmakefile-cross expects these to be set. They are also used in the tests below. -export IS_ANDROID=1 -export AOSP_FLAGS - -export CPP="$TOOLCHAIN_NAME-cpp" -export CC="$TOOLCHAIN_NAME-gcc" -export CXX="$TOOLCHAIN_NAME-g++" -export LD="$TOOLCHAIN_NAME-ld" -export AS="$TOOLCHAIN_NAME-as" -export AR="$TOOLCHAIN_NAME-ar" -export RANLIB="$TOOLCHAIN_NAME-ranlib" -export STRIP="$TOOLCHAIN_NAME-strip" - -##################################################################### - -# Based on ANDROID_NDK_ROOT, try and pick up the path for the tools. We expect something -# like /opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin -# Once we locate the tools, we add it to the PATH. -AOSP_TOOLCHAIN_PATH="" -for host in "linux-x86_64" "darwin-x86_64" "linux-x86" "darwin-x86" -do - if [ -d "$ANDROID_NDK_ROOT/toolchains/$TOOLCHAIN_ARCH-$AOSP_TOOLCHAIN_SUFFIX/prebuilt/$host/bin" ]; then - AOSP_TOOLCHAIN_PATH="$ANDROID_NDK_ROOT/toolchains/$TOOLCHAIN_ARCH-$AOSP_TOOLCHAIN_SUFFIX/prebuilt/$host/bin" - break - fi -done - -# Error checking -if [ -z "$AOSP_TOOLCHAIN_PATH" ] || [ ! -d "$AOSP_TOOLCHAIN_PATH" ]; then - echo "ERROR: AOSP_TOOLCHAIN_PATH is not valid. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$CPP" ]; then - echo "ERROR: Failed to find Android cpp. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$CC" ]; then - echo "ERROR: Failed to find Android gcc. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$CXX" ]; then - echo "ERROR: Failed to find Android g++. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$RANLIB" ]; then - echo "ERROR: Failed to find Android ranlib. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$AR" ]; then - echo "ERROR: Failed to find Android ar. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$AS" ]; then - echo "ERROR: Failed to find Android as. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_TOOLCHAIN_PATH/$LD" ]; then - echo "ERROR: Failed to find Android ld. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Only modify/export PATH if AOSP_TOOLCHAIN_PATH good -if [ -d "$AOSP_TOOLCHAIN_PATH" ]; then - - # And only modify PATH if AOSP_TOOLCHAIN_PATH is not present - LEN=${#AOSP_TOOLCHAIN_PATH} - SUBSTR=${PATH:0:$LEN} - if [ "$SUBSTR" != "$AOSP_TOOLCHAIN_PATH" ]; then - export PATH="$AOSP_TOOLCHAIN_PATH":"$PATH" - fi -fi - -##################################################################### - -# Error checking -if [ ! -d "$ANDROID_NDK_ROOT/platforms/$AOSP_API" ]; then - echo "ERROR: AOSP_API is not valid. Does the NDK support the API? Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -elif [ ! -d "$ANDROID_NDK_ROOT/platforms/$AOSP_API/$AOSP_ARCH" ]; then - echo "ERROR: AOSP_ARCH is not valid. Does the NDK support the architecture? Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Android SYSROOT. It will be used on the command line with --sysroot -# http://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html -export AOSP_SYSROOT="$ANDROID_NDK_ROOT/platforms/$AOSP_API/$AOSP_ARCH" - -##################################################################### - -# Android STL. We support GNU, LLVM and STLport out of the box. - -if [ "$#" -lt 2 ]; then - THE_STL=gnu-shared -else - THE_STL=$(tr [A-Z] [a-z] <<< "$2") -fi - -# LLVM include directory may be different depending on NDK version. Default to new location (latest NDK checked: r16beta1). -LLVM_INCLUDE_DIR="$ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/include" -if [ ! -d "$LLVM_INCLUDE_DIR" ]; then - LLVM_INCLUDE_DIR="$ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/libcxx/include" -fi - -case "$THE_STL" in - stlport-static) - AOSP_STL_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/stlport/" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/libs/$AOSP_ABI/libstlport_static.a" - ;; - stlport|stlport-shared) - AOSP_STL_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/stlport/" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/stlport/libs/$AOSP_ABI/libstlport_shared.so" - ;; - gabi++-static|gnu-static) - AOSP_STL_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/include" - AOSP_BITS_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/libs/$AOSP_ABI/include" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/libs/$AOSP_ABI/libgnustl_static.a" - ;; - gnu|gabi++|gnu-shared|gabi++-shared) - AOSP_STL_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/include" - AOSP_BITS_INC="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/libs/$AOSP_ABI/include" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$AOSP_TOOLCHAIN_SUFFIX/libs/$AOSP_ABI/libgnustl_shared.so" - ;; - llvm-static) - if [ ! -d "$LLVM_INCLUDE_DIR" ]; then - echo "ERROR: Unable to locate include LLVM directory at $LLVM_INCLUDE_DIR -- has it moved since NDK r16beta1?" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 - fi - AOSP_STL_INC="$LLVM_INCLUDE_DIR" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$AOSP_ABI/libc++_static.a" - ;; - llvm|llvm-shared) - if [ ! -d "$LLVM_INCLUDE_DIR" ]; then - echo "ERROR: Unable to locate LLVM include directory at $LLVM_INCLUDE_DIR -- has it moved since NDK r16beta1?" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 - fi - AOSP_STL_INC="$LLVM_INCLUDE_DIR" - AOSP_STL_LIB="$ANDROID_NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$AOSP_ABI/libc++_shared.so" - ;; - *) - echo "ERROR: Unknown STL library $2" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -esac - -# Error checking -if [ ! -d "$AOSP_STL_INC" ] || [ ! -e "$AOSP_STL_INC/memory" ]; then - echo "ERROR: AOSP_STL_INC is not valid. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$AOSP_STL_LIB" ]; then - echo "ERROR: AOSP_STL_LIB is not valid. Please edit this script." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -export AOSP_STL_INC -export AOSP_STL_LIB - -if [ ! -z "$AOSP_BITS_INC" ]; then - export AOSP_BITS_INC -fi - -# Now that we are using cpu-features from Android rather than CPU probing, we -# need to copy cpu-features.h and cpu-features.c from the NDK into our source -# directory and then build it. - -if [[ ! -e "$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.h" ]]; then - echo "ERROR: Unable to locate cpu-features.h" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi -cp "$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.h" . - -if [[ ! -e "$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.c" ]]; then - echo "ERROR: Unable to locate cpu-features.c" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi -cp "$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.c" . - -##################################################################### - -VERBOSE=1 -if [ ! -z "$VERBOSE" ] && [ "$VERBOSE" != "0" ]; then - echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT" - echo "AOSP_TOOLCHAIN_PATH: $AOSP_TOOLCHAIN_PATH" - echo "AOSP_ABI: $AOSP_ABI" - echo "AOSP_API: $AOSP_API" - echo "AOSP_SYSROOT: $AOSP_SYSROOT" - echo "AOSP_FLAGS: $AOSP_FLAGS" - echo "AOSP_STL_INC: $AOSP_STL_INC" - echo "AOSP_STL_LIB: $AOSP_STL_LIB" - if [ ! -z "$AOSP_BITS_INC" ]; then - echo "AOSP_BITS_INC: $AOSP_BITS_INC" - fi - - if [ -e "cpu-features.h" ] && [ -e "cpu-features.c" ]; then - echo "CPU FEATURES: cpu-features.h and cpu-features.c are present" - fi -fi - -##################################################################### - -COUNT=$(echo -n "$AOSP_STL_LIB" | egrep -i -c 'libstdc\+\+') -if [[ ("$COUNT" -ne "0") ]]; then - echo - echo "*******************************************************************************" - echo "You are using GNU's runtime and STL library. Please ensure the resulting" - echo "binary meets licensing requirements. If you can't use GNU's runtime" - echo "and STL library, then reconfigure with stlport or llvm. Also see" - echo "http://code.google.com/p/android/issues/detail?id=216331" - echo "*******************************************************************************" -fi - -COUNT=$(echo -n "$AOSP_STL_LIB" | grep -i -c 'libstlport') -if [[ ("$COUNT" -ne "0") ]]; then - echo - echo "*******************************************************************************" - echo "You are using STLport's runtime and STL library. STLport could cause problems" - echo "if the resulting binary is used in other environments, like a QT project." - echo "Also see http://code.google.com/p/android/issues/detail?id=216331" - echo "*******************************************************************************" -fi - -COUNT=$(echo -n "$AOSP_STL_LIB" | egrep -i -c 'libc\+\+') -if [[ ("$COUNT" -ne "0") ]]; then - echo - echo "*******************************************************************************" - echo "You are using LLVM's runtime and STL library. LLVM could cause problems" - echo "if the resulting binary is used in other environments, like a QT project." - echo "Also see http://code.google.com/p/android/issues/detail?id=216331" - echo "*******************************************************************************" -fi - -echo -echo "*******************************************************************************" -echo "It looks the the environment is set correctly. Your next step is build" -echo "the library with 'make -f GNUmakefile-cross'. You can create a versioned" -echo "shared object using 'HAS_SOLIB_VERSION=1 make -f GNUmakefile-cross'" -echo "*******************************************************************************" -echo - -[ "$0" = "$BASH_SOURCE" ] && exit 0 || return 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android.sh new file mode 100755 index 00000000..7a3a6bef --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-android.sh @@ -0,0 +1,364 @@ +#!/usr/bin/env bash + +############################################################################# +# +# This script sets the cross-compile environment for Android. +# +# Based upon OpenSSL's setenv-android.sh by TH, JW, and SM. +# Heavily modified by JWW for Crypto++. +# Modified by Skycoder42 Android NDK-r19 and above. +# +# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) +# licensed under the Boost Software License 1.0, while the individual files +# in the compilation are all public domain. +# +# Also see: +# https://android.googlesource.com/platform/ndk.git/+/HEAD/docs/UnifiedHeaders.md +# https://android.googlesource.com/platform/ndk/+/master/docs/PlatformApis.md +# https://developer.android.com/ndk/guides/abis.html and +# https://developer.android.com/ndk/guides/cpp-support. +# +# See http://www.cryptopp.com/wiki/Android_(Command_Line) for more details +############################################################################# + +######################################### +##### Some validation ##### +######################################### + +# cryptest-android.sh may run this script without sourcing. +if [ "$0" = "${BASH_SOURCE[0]}" ]; then + echo "setenv-android.sh is usually sourced, but not this time." +fi + +# This supports both 'source setenv-android.sh 21 arm64' and +# 'source setenv-android.sh ANDROID_API=21 ANDROID_CPU=arm64' +if [[ -n "$1" ]] +then + arg1=$(echo "$1" | cut -f 1 -d '=') + arg2=$(echo "$1" | cut -f 2 -d '=') + if [[ -n "${arg2}" ]]; then + ANDROID_API="${arg2}" + else + ANDROID_API="${arg1}" + fi + printf "Using positional arg, ANDROID_API=%s\n" "${ANDROID_API}" +fi + +# This supports both 'source setenv-android.sh 21 arm64' and +# 'source setenv-android.sh ANDROID_API=21 ANDROID_CPU=arm64' +if [[ -n "$2" ]] +then + arg1=$(echo "$2" | cut -f 1 -d '=') + arg2=$(echo "$2" | cut -f 2 -d '=') + if [[ -n "${arg2}" ]]; then + ANDROID_CPU="${arg2}" + else + ANDROID_CPU="${arg1}" + fi + printf "Using positional arg, ANDROID_CPU=%s\n" "${ANDROID_CPU}" +fi + +if [ -z "${ANDROID_API}" ]; then + echo "ANDROID_API is not set. Please set it" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +if [ -z "${ANDROID_CPU}" ]; then + echo "ANDROID_CPU is not set. Please set it" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +######################################### +##### Clear old options ##### +######################################### + +unset IS_IOS +unset IS_ANDROID +unset IS_ARM_EMBEDDED + +unset ANDROID_CPPFLAGS +unset ANDROID_CXXFLAGS +unset ANDROID_LDFLAGS +unset ANDROID_SYSROOT + +##################################################################### + +# ANDROID_NDK_ROOT should always be set by the user (even when not running this script) +# http://groups.google.com/group/android-ndk/browse_thread/thread/a998e139aca71d77. +# If the user did not specify the NDK location, try and pick it up. Something like +# ANDROID_NDK_ROOT=/opt/android-ndk-r19c or ANDROID_NDK_ROOT=/usr/local/android-ndk-r20. + +if [ -n "${ANDROID_NDK_ROOT}" ]; then + echo "ANDROID_NDK_ROOT is ${ANDROID_NDK_ROOT}" +else + echo "ANDROID_NDK_ROOT is empty. Searching for the NDK" + ANDROID_NDK_ROOT=$(find /opt -maxdepth 1 -type d -name "android-ndk*" 2>/dev/null | tail -n -1) + + if [ -z "${ANDROID_NDK_ROOT}" ]; then + ANDROID_NDK_ROOT=$(find /usr/local -maxdepth 1 -type d -name "android-ndk*" 2>/dev/null | tail -n -1) + fi + if [ -z "${ANDROID_NDK_ROOT}" ]; then + ANDROID_NDK_ROOT=$(find "$HOME" -maxdepth 1 -type d -name "android-ndk*" 2>/dev/null | tail -n -1) + fi + if [ -d "$HOME/Library/Android/sdk/ndk-bundle" ]; then + ANDROID_NDK_ROOT="$HOME/Library/Android/sdk/ndk-bundle" + fi +fi + +# Error checking +if [ ! -d "${ANDROID_NDK_ROOT}" ]; then + echo "ERROR: ANDROID_NDK_ROOT is not a valid path for ${USER}. Please set it." + echo "ANDROID_NDK_ROOT is '${ANDROID_NDK_ROOT}'" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +# Error checking +if [ ! -d "${ANDROID_SDK_ROOT}" ]; then + echo "ERROR: ANDROID_SDK_ROOT is not a valid path for ${USER}. Please set it." + echo "ANDROID_SDK_ROOT is '${ANDROID_SDK_ROOT}'" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +# User feedback +#echo "ANDROID_NDK_ROOT is '${ANDROID_NDK_ROOT}'" +#echo "ANDROID_SDK_ROOT is '${ANDROID_SDK_ROOT}'" + +##################################################################### + +# Need to set HOST_TAG to darwin-x86_64, linux-x86_64, +# windows, or windows-x86_64 + +if [[ "$(uname -s | grep -i -c darwin)" -ne 0 ]]; then + HOST_TAG=darwin-x86_64 +elif [[ "$(uname -s | grep -i -c linux)" -ne 0 ]]; then + HOST_TAG=linux-x86_64 +else + echo "ERROR: Unknown host" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +ANDROID_TOOLCHAIN="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${HOST_TAG}/bin" +ANDROID_SYSROOT="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${HOST_TAG}/sysroot" + +# Error checking +if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then + echo "ERROR: ANDROID_TOOLCHAIN is not a valid path. Please set it." + echo "ANDROID_TOOLCHAIN is '${ANDROID_TOOLCHAIN}'" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +# Error checking +if [ ! -d "${ANDROID_SYSROOT}" ]; then + echo "ERROR: ANDROID_SYSROOT is not a valid path. Please set it." + echo "ANDROID_SYSROOT is '${ANDROID_SYSROOT}'" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +##################################################################### + +THE_ARCH=$(tr '[:upper:]' '[:lower:]' <<< "${ANDROID_CPU}") + +# https://developer.android.com/ndk/guides/abis.html and +# https://developer.android.com/ndk/guides/cpp-support. +# Since NDK r16 the only STL available is libc++, so we +# add -std=c++11 -stdlib=libc++ to CXXFLAGS. This is +# consistent with Android.mk and 'APP_STL := c++_shared'. +case "$THE_ARCH" in + armv7*|armeabi*) + CC="armv7a-linux-androideabi${ANDROID_API}-clang" + CXX="armv7a-linux-androideabi${ANDROID_API}-clang++" + LD="arm-linux-androideabi-ld" + AS="arm-linux-androideabi-as" + AR="arm-linux-androideabi-ar" + RANLIB="arm-linux-androideabi-ranlib" + STRIP="arm-linux-androideabi-strip" + + # You may need this on older NDKs + # ANDROID_CPPFLAGS="-D__ANDROID__=${ANDROID_API}" + + # Android NDK r19 and r20 no longer use -mfloat-abi=softfp. Add it as required. + ANDROID_CXXFLAGS="-target armv7-none-linux-androideabi${ANDROID_API} -std=c++11 -stdlib=libc++" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -march=armv7-a -mthumb" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fno-addrsig -fno-experimental-isel" + ;; + armv8*|aarch64|arm64*) + CC="aarch64-linux-android${ANDROID_API}-clang" + CXX="aarch64-linux-android${ANDROID_API}-clang++" + LD="aarch64-linux-android-ld" + AS="aarch64-linux-android-as" + AR="aarch64-linux-android-ar" + RANLIB="aarch64-linux-android-ranlib" + STRIP="aarch64-linux-android-strip" + + # You may need this on older NDKs + # ANDROID_CPPFLAGS="-D__ANDROID__=${ANDROID_API}" + + ANDROID_CXXFLAGS="-target aarch64-none-linux-android${ANDROID_API}" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -std=c++11 -stdlib=libc++" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fno-addrsig -fno-experimental-isel" + ;; + i686|x86) + CC="i686-linux-android${ANDROID_API}-clang" + CXX="i686-linux-android${ANDROID_API}-clang++" + LD="i686-linux-android-ld" + AS="i686-linux-android-as" + AR="i686-linux-android-ar" + RANLIB="i686-linux-android-ranlib" + STRIP="i686-linux-android-strip" + + # You may need this on older NDKs + # ANDROID_CPPFLAGS="-D__ANDROID__=${ANDROID_API}" + + ANDROID_CXXFLAGS="-target i686-none-linux-android${ANDROID_API}" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -std=c++11 -stdlib=libc++" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -mtune=intel -mssse3 -mfpmath=sse" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fno-addrsig -fno-experimental-isel" + ;; + x86_64|x64) + CC="x86_64-linux-android${ANDROID_API}-clang" + CXX="x86_64-linux-android${ANDROID_API}-clang++" + LD="x86_64-linux-android-ld" + AS="x86_64-linux-android-as" + AR="x86_64-linux-android-ar" + RANLIB="x86_64-linux-android-ranlib" + STRIP="x86_64-linux-android-strip" + + # You may need this on older NDKs + # ANDROID_CPPFLAGS="-D__ANDROID__=${ANDROID_API}" + + ANDROID_CXXFLAGS="-target x86_64-none-linux-android${ANDROID_API}" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -std=c++11 -stdlib=libc++" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -march=x86-64 -msse4.2 -mpopcnt -mtune=intel" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti" + ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fno-addrsig -fno-experimental-isel" + ;; + *) + echo "ERROR: Unknown architecture ${ANDROID_CPU}" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 + ;; +esac + +##################################################################### + +# GNUmakefile-cross and Autotools expect these to be set. +# They are also used in the tests below. +export IS_ANDROID=1 + +export CPP CC CXX LD AS AR RANLIB STRIP +export ANDROID_CPPFLAGS ANDROID_CXXFLAGS ANDROID_LDFLAGS +export ANDROID_API ANDROID_CPU ANDROID_SYSROOT + +# Do NOT use ANDROID_SYSROOT_INC or ANDROID_SYSROOT_LD +# https://github.com/android/ndk/issues/894#issuecomment-470837964 + +##################################################################### + +# Error checking +if [ ! -e "${ANDROID_TOOLCHAIN}/$CC" ]; then + echo "ERROR: Failed to find Android clang. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +# Error checking +if [ ! -e "${ANDROID_TOOLCHAIN}/$CXX" ]; then + echo "ERROR: Failed to find Android clang++. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +# Error checking +if [ ! -e "${ANDROID_TOOLCHAIN}/$RANLIB" ]; then + echo "ERROR: Failed to find Android ranlib. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +# Error checking +if [ ! -e "${ANDROID_TOOLCHAIN}/$AR" ]; then + echo "ERROR: Failed to find Android ar. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +# Error checking +if [ ! -e "${ANDROID_TOOLCHAIN}/$AS" ]; then + echo "ERROR: Failed to find Android as. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +# Error checking +if [ ! -e "${ANDROID_TOOLCHAIN}/$LD" ]; then + echo "ERROR: Failed to find Android ld. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +##################################################################### + +# Add tools to head of path, if not present already +LENGTH=${#ANDROID_TOOLCHAIN} +SUBSTR=${PATH:0:$LENGTH} +if [ "$SUBSTR" != "${ANDROID_TOOLCHAIN}" ]; then + export PATH="${ANDROID_TOOLCHAIN}:$PATH" +fi + +##################################################################### + +# Now that we are using cpu-features from Android rather than +# CPU probing, we need to copy cpu-features.h and cpu-features.c +# from the NDK into our source directory and then build it. + +if [[ ! -e "${ANDROID_NDK_ROOT}/sources/android/cpufeatures/cpu-features.h" ]]; then + echo "ERROR: Unable to locate cpu-features.h" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +if [[ ! -e "${ANDROID_NDK_ROOT}/sources/android/cpufeatures/cpu-features.c" ]]; then + echo "ERROR: Unable to locate cpu-features.c" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +cp "${ANDROID_NDK_ROOT}/sources/android/cpufeatures/cpu-features.h" . +cp "${ANDROID_NDK_ROOT}/sources/android/cpufeatures/cpu-features.c" . + +# Cleanup the sources for the C++ compiler +# https://github.com/weidai11/cryptopp/issues/926 + +sed -e 's/= memmem/= (const char*)memmem/g' \ + -e 's/= memchr/= (const char*)memchr/g' \ + -e 's/= malloc/= (char*)malloc/g' \ + cpu-features.c > cpu-features.c.fixed +mv cpu-features.c.fixed cpu-features.c + +# Fix permissions. For some reason cpu-features.h is +x. +chmod u=rw,go=r cpu-features.h cpu-features.c + +##################################################################### + +VERBOSE=${VERBOSE:-1} +if [ "$VERBOSE" -gt 0 ]; then + echo "ANDROID_TOOLCHAIN: ${ANDROID_TOOLCHAIN}" + echo "ANDROID_API: ${ANDROID_API}" + echo "ANDROID_CPU: ${ANDROID_CPU}" + echo "ANDROID_SYSROOT: ${ANDROID_SYSROOT}" + if [ -n "${ANDROID_CPPFLAGS}" ]; then + echo "ANDROID_CPPFLAGS: ${ANDROID_CPPFLAGS}" + fi + echo "ANDROID_CXXFLAGS: ${ANDROID_CXXFLAGS}" + if [ -n "${ANDROID_LDFLAGS}" ]; then + echo "ANDROID_LDFLAGS: ${ANDROID_LDFLAGS}" + fi + if [ -e "cpu-features.h" ] && [ -e "cpu-features.c" ]; then + echo "CPU FEATURES: cpu-features.h and cpu-features.c are present" + fi +fi + +##################################################################### + +echo +echo "*******************************************************************************" +echo "It looks the the environment is set correctly. Your next step is build" +echo "the library with 'make -f GNUmakefile-cross'." +echo "*******************************************************************************" +echo + +[ "$0" = "${BASH_SOURCE[0]}" ] && exit 0 || return 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-embedded.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-embedded.sh index 7e743ab8..80e209ee 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-embedded.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-embedded.sh @@ -1,19 +1,23 @@ #!/usr/bin/env bash -# ==================================================================== -# Sets the cross compile environment for ARM Embedded +############################################################################# # -# Written by Jeffrey Walton, noloader gmail account +# This script sets the cross-compile environment for ARM embedded. +# +# Based upon OpenSSL's setenv-android.sh by TH, JW, and SM. +# Heavily modified by JWW for Crypto++. # # Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) # licensed under the Boost Software License 1.0, while the individual files # in the compilation are all public domain. # -# This script only supports Ubuntu at the moment. It does not support Fedora. # See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line) for details. -# ==================================================================== +############################################################################# -# set -eu +# cryptest-embedded.sh may run this script without sourcing. +if [ "$0" = "${BASH_SOURCE[0]}" ]; then + echo "setenv-embedded.sh is usually sourced, but not this time." +fi # Unset old options @@ -24,12 +28,12 @@ unset IS_ANDROID unset IS_ARM_EMBEDDED if [ -z "${ARM_EMBEDDED_TOOLCHAIN-}" ]; then - ARM_EMBEDDED_TOOLCHAIN="/usr/bin" + ARM_EMBEDDED_TOOLCHAIN="/usr/bin" fi if [ ! -d "$ARM_EMBEDDED_TOOLCHAIN" ]; then - echo "ARM_EMBEDDED_TOOLCHAIN is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + echo "ARM_EMBEDDED_TOOLCHAIN is not valid" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi # Fedora @@ -50,37 +54,37 @@ export RANLIB="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-ranlib" # Test a few of the tools if [ ! -e "$CPP" ]; then echo "ERROR: CPP is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi if [ ! -e "$CC" ]; then echo "ERROR: CC is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi if [ ! -e "$CXX" ]; then echo "ERROR: CXX is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi if [ ! -e "$AR" ]; then echo "ERROR: AR is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi if [ ! -e "$AS" ]; then echo "ERROR: AS is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi if [ ! -e "$RANLIB" ]; then echo "ERROR: RANLIB is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi if [ ! -e "$LD" ]; then echo "ERROR: LD is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi # The Crypto++ Makefile uses these to disable host settings like @@ -94,7 +98,7 @@ fi if [ ! -d "$ARM_EMBEDDED_SYSROOT" ]; then echo "ERROR: ARM_EMBEDDED_SYSROOT is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi # Fix C++ header paths for Ubuntu @@ -104,12 +108,12 @@ ARM_EMBEDDED_CXX_HEADERS="$ARM_EMBEDDED_SYSROOT/include/c++/$ARM_EMBEDDED_TOOLCH if [ ! -d "$ARM_EMBEDDED_CXX_HEADERS" ]; then echo "ERROR: ARM_EMBEDDED_CXX_HEADERS is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi if [ ! -d "$ARM_EMBEDDED_CXX_HEADERS/arm-linux-gnueabi" ]; then echo "ERROR: ARM_EMBEDDED_CXX_HEADERS is not valid" - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi # Finally, the flags... @@ -121,8 +125,8 @@ if [ -z "$ARM_EMBEDDED_FLAGS" ]; then fi # And print stuff to wow the user... -VERBOSE=1 -if [ ! -z "$VERBOSE" ] && [ "$VERBOSE" -ne 0 ]; then +VERBOSE=${VERBOSE:-1} +if [ "$VERBOSE" -gt 0 ]; then echo "CPP: $CPP" echo "CXX: $CXX" echo "AR: $AR" @@ -137,9 +141,8 @@ fi echo echo "*******************************************************************************" echo "It looks the the environment is set correctly. Your next step is build" -echo "the library with 'make -f GNUmakefile-cross'. You can create a versioned" -echo "shared object using 'HAS_SOLIB_VERSION=1 make -f GNUmakefile-cross'" +echo "the library with 'make -f GNUmakefile-cross'." echo "*******************************************************************************" echo -[ "$0" = "$BASH_SOURCE" ] && exit 0 || return 0 +[ "$0" = "${BASH_SOURCE[0]}" ] && exit 0 || return 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-ios.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-ios.sh index efd6a8b5..eec605e3 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-ios.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-ios.sh @@ -1,332 +1,330 @@ #!/usr/bin/env bash -# ==================================================================== -# Sets the cross compile environment for Xcode/iOS -# Based upon OpenSSL's setenv-ios.sh (by TH, JW, and SM). +############################################################################# +# +# This script sets the cross-compile environment for Xcode/iOS. +# +# Based upon OpenSSL's setenv-android.sh by TH, JW, and SM. +# Heavily modified by JWW for Crypto++. # # Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) # licensed under the Boost Software License 1.0, while the individual files # in the compilation are all public domain. # # See http://www.cryptopp.com/wiki/iOS_(Command_Line) for more details -# ==================================================================== +############################################################################# -# set -eu +######################################### +##### Some validation ##### +######################################### + +# In the past we could mostly infer arch or cpu from the SDK (and mostly +# vice-versa). Nowadays we need the user to set it for us because Apple +# platforms have both 32-bit or 64-bit variations. + +# cryptest-ios.sh may run this script without sourcing. +if [ "$0" = "${BASH_SOURCE[0]}" ]; then + echo "setenv-ios.sh is usually sourced, but not this time." +fi + +# This supports 'source setenv-ios.sh iPhone arm64' and +# 'source setenv-ios.sh IOS_SDK=iPhone IOS_CPU=arm64' +if [[ -n "$1" ]] +then + arg1=$(echo "$1" | cut -f 1 -d '=') + arg2=$(echo "$1" | cut -f 2 -d '=') + if [[ -n "${arg2}" ]]; then + IOS_SDK="${arg2}" + else + IOS_SDK="${arg1}" + fi + printf "Using positional arg, IOS_SDK=%s\n" "${IOS_SDK}" +fi + +# This supports 'source setenv-ios.sh iPhone arm64' and +# 'source setenv-ios.sh IOS_SDK=iPhone IOS_CPU=arm64' +if [[ -n "$2" ]] +then + arg1=$(echo "$2" | cut -f 1 -d '=') + arg2=$(echo "$2" | cut -f 2 -d '=') + if [[ -n "${arg2}" ]]; then + IOS_CPU="${arg2}" + else + IOS_CPU="${arg1}" + fi + printf "Using positional arg, IOS_CPU=%s\n" "${IOS_CPU}" +fi + +if [ -z "$IOS_SDK" ]; then + echo "IOS_SDK is not set. Please set it" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +if [ -z "$IOS_CPU" ]; then + echo "IOS_CPU is not set. Please set it" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi ######################################### ##### Clear old options ##### ######################################### -unset IS_CROSS_COMPILE - unset IS_IOS unset IS_ANDROID unset IS_ARM_EMBEDDED -unset IOS_ARCH -unset IOS_FLAGS +unset IOS_CXXFLAGS unset IOS_SYSROOT ######################################### -##### User configurable options ##### +##### Small Fixups, if needed ##### ######################################### -# Define SETENV_VERBOSE=1 to print the configuration, including exported variables. -SETENV_VERBOSE=1 - -# For various SDKs, see https://groups.google.com/d/msg/cryptopp-users/8Z0qfwAjSbA/nKYbhTNBBgAJ - -######################################## -##### Command line ##### -######################################## - -APPLE_SDK= -IOS_ARCH= -BACK_ARCH= - -for ARG in "$@" -do - CL=$(echo $ARG | tr '[A-Z]' '[a-z]') - - # i386 (simulator) - if [ "$CL" == "i386" ]; then - BACK_ARCH=i386 - APPLE_SDK=iPhoneSimulator - fi - - # x86_64 (simulator) - if [ "$CL" == "x86_64" ]; then - BACK_ARCH=x86_64 - APPLE_SDK=iPhoneSimulator - fi - - # ARMv5 - if [ "$CL" == "armv5" ]; then - BACK_ARCH=armv5 - APPLE_SDK=iPhoneOS - fi - - # ARMv6 - if [ "$CL" == "armv6" ]; then - BACK_ARCH=armv6 - APPLE_SDK=iPhoneOS - fi - - # ARMv7 - if [ "$CL" == "armv7" ]; then - BACK_ARCH=armv7 - APPLE_SDK=iPhoneOS - fi - - # ARMv7s - if [ "$CL" == "armv7s" ]; then - BACK_ARCH=armv7s - APPLE_SDK=iPhoneOS - fi - - # ARM64 - if [[ ("$CL" == "arm64" || "$CL" == "armv8" || "$CL" == "aarch64") ]]; then - BACK_ARCH=arm64 - APPLE_SDK=iPhoneOS - fi - - # iPhone - if [[ ("$CL" == "iphone" || "$CL" == "iphoneos") ]]; then - BACK_ARCH=armv7 - APPLE_SDK=iPhoneOS - fi - - # iPhone Simulator - if [[ ("$CL" == "simulator" || "$CL" == "iphonesimulator") ]]; then - BACK_ARCH=i386 - APPLE_SDK=iPhoneSimulator - fi - - # Watch - if [[ ("$CL" == "watch" || "$CL" == "watchos" || "$CL" == "applewatch") ]]; then - BACK_ARCH=armv7 - APPLE_SDK=WatchOS - fi - - # Watch Simulator - if [ "$CL" == "watchsimulator" ]; then - BACK_ARCH=i386 - APPLE_SDK=WatchSimulator - fi - - # Apple TV - if [[ ("$CL" == "tv" || "$CL" == "appletv" || "$CL" == "appletvos") ]]; then - BACK_ARCH=arm64 - APPLE_SDK=AppleTVOS - fi - - # Apple TV Simulator - if [[ ("$CL" == "tvsimulator" || "$CL" == "appletvsimulator") ]]; then - BACK_ARCH=x86_64 - APPLE_SDK=AppleTVSimulator - fi - -done - -# Defaults if not set -if [ -z "$APPLE_SDK" ]; then - BACK_ARCH=armv7 - APPLE_SDK=iPhoneOS +if [[ "$IOS_SDK" == "iPhone" ]]; then + IOS_SDK=iPhoneOS fi -# Defaults if not set -if [ -z "$IOS_ARCH" ]; then - IOS_ARCH="$BACK_ARCH" +if [[ "$IOS_SDK" == "iPhoneOSSimulator" ]]; then + IOS_SDK=iPhoneSimulator fi +if [[ "$IOS_SDK" == "TV" || "$IOS_SDK" == "AppleTV" ]]; then + IOS_SDK=AppleTVOS +fi + +if [[ "$IOS_SDK" == "Watch" || "$IOS_SDK" == "AppleWatch" ]]; then + IOS_SDK=WatchOS +fi + +if [[ "$IOS_CPU" == "aarch64" || "$IOS_CPU" == "arm64"* || "$IOS_CPU" == "armv8"* ]] ; then + IOS_CPU=arm64 +fi + +######################################## +##### Environment ##### +######################################## + +# The flags below were tested with Xcode 8 on Travis. If +# you use downlevel versions of Xcode, then you can push +# xxx-version-min=n lower. For example, Xcode 7 can use +# -miphoneos-version-min=5. However, Xcode 7 lacks +# AppleTVOS and WatchOS support. + +# iPhones can be either 32-bit or 64-bit +if [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "armv7"* ]]; then + MIN_VER=-miphoneos-version-min=6 +elif [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "arm64" ]]; then + MIN_VER=-miphoneos-version-min=6 + +# Fixups for convenience +elif [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "i386" ]]; then + IOS_SDK=iPhoneSimulator + # MIN_VER=-miphoneos-version-min=6 + MIN_VER=-miphonesimulator-version-min=6 +elif [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "x86_64" ]]; then + IOS_SDK=iPhoneSimulator + # MIN_VER=-miphoneos-version-min=6 + MIN_VER=-miphonesimulator-version-min=6 + +# Simulator builds +elif [[ "$IOS_SDK" == "iPhoneSimulator" && "$IOS_CPU" == "i386" ]]; then + MIN_VER=-miphonesimulator-version-min=6 +elif [[ "$IOS_SDK" == "iPhoneSimulator" && "$IOS_CPU" == "x86_64" ]]; then + MIN_VER=-miphonesimulator-version-min=6 + +# Apple TV can be 32-bit Intel (1st gen), 32-bit ARM (2nd, 3rd gen) or 64-bit ARM (4th gen) +elif [[ "$IOS_SDK" == "AppleTVOS" && "$IOS_CPU" == "i386" ]]; then + MIN_VER=-mappletvos-version-min=6 +elif [[ "$IOS_SDK" == "AppleTVOS" && "$IOS_CPU" == "armv7"* ]]; then + MIN_VER=-mappletvos-version-min=6 +elif [[ "$IOS_SDK" == "AppleTVOS" && "$IOS_CPU" == "arm64" ]]; then + MIN_VER=-mappletvos-version-min=6 + +# Simulator builds +elif [[ "$IOS_SDK" == "AppleTVSimulator" && "$IOS_CPU" == "i386" ]]; then + MIN_VER=-mappletvsimulator-version-min=6 +elif [[ "$IOS_SDK" == "AppleTVSimulator" && "$IOS_CPU" == "x86_64" ]]; then + MIN_VER=-mappletvsimulator-version-min=6 + +# Watch can be either 32-bit or 64-bit ARM. TODO: figure out which +# -mwatchos-version-min=n is needed for arm64. 9 is not enough. +elif [[ "$IOS_SDK" == "WatchOS" && "$IOS_CPU" == "armv7"* ]]; then + MIN_VER=-mwatchos-version-min=6 +elif [[ "$IOS_SDK" == "WatchOS" && "$IOS_CPU" == "arm64" ]]; then + MIN_VER=-mwatchos-version-min=10 + +# Simulator builds. TODO: figure out which -watchos-version-min=n +# is needed for arm64. 6 compiles and links, but is it correct? +elif [[ "$IOS_SDK" == "WatchSimulator" && "$IOS_CPU" == "i386" ]]; then + MIN_VER=-mwatchsimulator-version-min=6 +elif [[ "$IOS_SDK" == "WatchSimulator" && "$IOS_CPU" == "x86_64" ]]; then + MIN_VER=-mwatchsimulator-version-min=6 + +# And the final catch-all +else + echo "IOS_SDK and IOS_CPU are not valid. Please fix them" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 +fi + +##################################################################### + +# Xcode 6 and below cannot handle -miphonesimulator-version-min +# Fix it so the simulator will compile as expected. This trick +# may work on other platforms, but it was not tested. + +if [ -n "$(command -v xcodebuild 2>/dev/null)" ]; then + # Output of xcodebuild is similar to "Xcode 6.2". The first cut gets + # the dotted decimal value. The second cut gets the major version. + XCODE_VERSION=$(xcodebuild -version 2>/dev/null | head -n 1 | cut -f2 -d" " | cut -f1 -d".") + if [ -z "$XCODE_VERSION" ]; then XCODE_VERSION=100; fi + + if [ "$XCODE_VERSION" -le 6 ]; then + MIN_VER="${MIN_VER//iphonesimulator/iphoneos}" + fi +fi + +##################################################################### + # Allow a user override? I think we should be doing this. The use case is: # move /Applications/Xcode somewhere else for a side-by-side installation. -# These sorts of tricks are a required procedure on Apple's gear: -# http://stackoverflow.com/questions/11651773/install-simulator-sdk-4-3-to-xcode-4-4-on-mountain-lion if [ -z "${XCODE_DEVELOPER-}" ]; then XCODE_DEVELOPER=$(xcode-select -print-path 2>/dev/null) fi if [ ! -d "$XCODE_DEVELOPER" ]; then echo "ERROR: unable to find XCODE_DEVELOPER directory." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi -# Default toolchain location -XCODE_TOOLCHAIN="$XCODE_DEVELOPER/usr/bin" +# XCODE_DEVELOPER_SDK is the SDK location. +XCODE_DEVELOPER_SDK="$XCODE_DEVELOPER/Platforms/$IOS_SDK.platform" -if [ ! -d "$XCODE_TOOLCHAIN" ]; then - echo "ERROR: unable to find XCODE_TOOLCHAIN directory." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 +if [ ! -d "$XCODE_DEVELOPER_SDK" ]; then + echo "ERROR: unable to find XCODE_DEVELOPER_SDK directory." + echo " Is the SDK supported by Xcode and installed?" + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi -# XCODE_DEVELOPER_TOP is the top of the development tools tree -XCODE_DEVELOPER_TOP="$XCODE_DEVELOPER/Platforms/$APPLE_SDK.platform/Developer" - -if [ ! -d "$XCODE_DEVELOPER_TOP" ]; then - echo "ERROR: unable to find XCODE_DEVELOPER_TOP directory." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# IOS_TOOLCHAIN is the location of the actual compiler tools. +# XCODE_TOOLCHAIN is the location of the actual compiler tools. if [ -d "$XCODE_DEVELOPER/Toolchains/XcodeDefault.xctoolchain/usr/bin/" ]; then - IOS_TOOLCHAIN="$XCODE_DEVELOPER/Toolchains/XcodeDefault.xctoolchain/usr/bin/" -elif [ -d "$XCODE_DEVELOPER_TOP/usr/bin/" ]; then - IOS_TOOLCHAIN="$XCODE_DEVELOPER_TOP/usr/bin/" + XCODE_TOOLCHAIN="$XCODE_DEVELOPER/Toolchains/XcodeDefault.xctoolchain/usr/bin/" +elif [ -d "$XCODE_DEVELOPER_SDK/Developer/usr/bin/" ]; then + XCODE_TOOLCHAIN="$XCODE_DEVELOPER_SDK/Developer/usr/bin/" fi -if [ -z "$IOS_TOOLCHAIN" ] || [ ! -d "$IOS_TOOLCHAIN" ]; then +if [ -z "$XCODE_TOOLCHAIN" ] || [ ! -d "$XCODE_TOOLCHAIN" ]; then echo "ERROR: unable to find Xcode cross-compiler tools." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi -# # XCODE_SDK is the SDK name/version being used - adjust the list as appropriate. # For example, remove 4.3, 6.2, and 6.1 if they are not installed. We go back to # the 1.0 SDKs because Apple WatchOS uses low numbers, like 2.0 and 2.1. -unset XCODE_SDK -for i in $(seq -f "%.1f" 20.0 -0.1 1.0) +XCODE_SDK="" +for i in $(seq -f "%.1f" 30.0 -0.1 1.0) do - if [ -d "$XCODE_DEVELOPER/Platforms/$APPLE_SDK.platform/Developer/SDKs/$APPLE_SDK$i.sdk" ]; then - XCODE_SDK="$APPLE_SDK$i.sdk" - break - fi + if [ -d "$XCODE_DEVELOPER_SDK/Developer/SDKs/$IOS_SDK$i.sdk" ]; then + XCODE_SDK="$IOS_SDK$i.sdk" + break + fi done # Error checking if [ -z "$XCODE_SDK" ]; then echo "ERROR: unable to find a SDK." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi +IOS_CXXFLAGS="-arch $IOS_CPU $MIN_VER" + +# The simulators need to disable ASM. They don't receive arch flags. # https://github.com/weidai11/cryptopp/issues/635 -if [ "$APPLE_SDK" == "iPhoneSimulator" ]; then - IOS_FLAGS="$IOS_FLAGS -DCRYPTOPP_DISABLE_ASM" +if [[ "$IOS_SDK" == "iPhoneSimulator" || "$IOS_SDK" == "AppleTVSimulator" || "$IOS_SDK" == "WatchSimulator" ]]; then + IOS_CXXFLAGS="$IOS_CXXFLAGS -DCRYPTOPP_DISABLE_ASM" fi -# Simulator fixup. LD fails to link dylib. -if [ "$APPLE_SDK" == "iPhoneSimulator" ] && [ "$IOS_ARCH" == "i386" ]; then - IOS_FLAGS="$IOS_FLAGS -miphoneos-version-min=5" +echo "Configuring for $IOS_SDK ($IOS_CPU)" + +IS_IOS=1 +IOS_SYSROOT="$XCODE_DEVELOPER_SDK/Developer/SDKs/$XCODE_SDK" + +##################################################################### + +CPP=cpp; CC=clang; CXX=clang++; LD=ld +AS=as; AR=libtool; RANLIB=ranlib; STRIP=strip + +# Error checking +if [ ! -e "$XCODE_TOOLCHAIN/$CC" ]; then + echo "ERROR: Failed to find iOS clang. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi -# ARMv7s fixup. Xcode 4/iOS 6 -if [ "$IOS_ARCH" == "armv7s" ]; then - IOS_FLAGS="$IOS_FLAGS -miphoneos-version-min=6" +# Error checking +if [ ! -e "$XCODE_TOOLCHAIN/$CXX" ]; then + echo "ERROR: Failed to find iOS clang++. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi -# ARM64 fixup. Xcode 5/iOS 7 -if [ "$IOS_ARCH" == "arm64" ]; then - IOS_FLAGS="$IOS_FLAGS -miphoneos-version-min=7" +# Error checking +if [ ! -e "$XCODE_TOOLCHAIN/$RANLIB" ]; then + echo "ERROR: Failed to find iOS ranlib. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi -# Yet another ARM64 fixup. -if [ "$APPLE_SDK" == "AppleTVOS" ]; then - IOS_FLAGS="" +# Error checking +if [ ! -e "$XCODE_TOOLCHAIN/$AR" ]; then + echo "ERROR: Failed to find iOS ar. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi -# Disable ASM for simulator. We are failing on Travis due to missing _start. -# We may need to link against crt1.o for simulator builds. Also see -# https://stackoverflow.com/q/24841283/608639 -# -watchos_simulator_version_min does not work though it is in LLVM sources. -if [ "$APPLE_SDK" == "WatchSimulator" ]; then - IOS_FLAGS="$IOS_FLAGS -DCRYPTOPP_DISABLE_ASM" +# Error checking +if [ ! -e "$XCODE_TOOLCHAIN/$AS" ]; then + echo "ERROR: Failed to find iOS as. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi -# Disable ASM for simulator. We are failing on Travis due to missing _start. -# We may need to link against crt1.o for simulator builds. Also see -# https://stackoverflow.com/q/24841283/608639 -# -tvos_simulator_version_min does not work though it is in LLVM sources. -if [ "$APPLE_SDK" == "AppleTVSimulator" ]; then - IOS_FLAGS="$IOS_FLAGS -tvos_simulator_version_min -DCRYPTOPP_DISABLE_ASM" +# Error checking +if [ ! -e "$XCODE_TOOLCHAIN/$LD" ]; then + echo "ERROR: Failed to find iOS ld. Please edit this script." + [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 fi -# Simulator uses i386 or x86_64, Device uses ARMv5, ARMv6, ARMv7, ARMv7s or ARMv8 -# -# Apple deprecated ARMv5 at iOS 4.0, and ARMv6 at iOS 5.0 -# http://stackoverflow.com/questions/7488657/how-to-build-for-armv6-and-armv7-architectures-with-ios-5 +##################################################################### -echo "Configuring for $APPLE_SDK ($IOS_ARCH)" +# Add tools to head of path, if not present already +LENGTH=${#XCODE_TOOLCHAIN} +SUBSTR=${PATH:0:$LENGTH} +if [ "$SUBSTR" != "$XCODE_TOOLCHAIN" ]; then + export PATH="$XCODE_TOOLCHAIN:$PATH" +fi -# Used by the GNUmakefile-cross +##################################################################### + +# GNUmakefile-cross and Autotools expect these to be set. +# They are also used in the tests below. export IS_IOS=1 -export IOS_ARCH -export IOS_FLAGS -export IOS_SYSROOT="$XCODE_DEVELOPER_TOP/SDKs/$XCODE_SDK" -####################################### -##### Verbose ##### -####################################### +export CPP CC CXX LD AS AR RANLIB STRIP +export IOS_CXXFLAGS IOS_SDK IOS_CPU IOS_SYSROOT -if [ "$SETENV_VERBOSE" == "1" ]; then +##################################################################### - echo "XCODE_SDK:" $XCODE_SDK - echo "XCODE_DEVELOPER: $XCODE_DEVELOPER" +VERBOSE=${VERBOSE:-1} +if [ "$VERBOSE" -gt 0 ]; then echo "XCODE_TOOLCHAIN: $XCODE_TOOLCHAIN" - echo "XCODE_DEVELOPER_TOP: $XCODE_DEVELOPER_TOP" - echo "IOS_ARCH: $IOS_ARCH" - echo "IOS_TOOLCHAIN: $IOS_TOOLCHAIN" - echo "IOS_FLAGS: ${IOS_FLAGS-}" - echo "IOS_SYSROOT: ${IOS_SYSROOT-}" + echo "IOS_SDK: $IOS_SDK" + echo "IOS_CPU: $IOS_CPU" + echo "IOS_SYSROOT: $IOS_SYSROOT" + echo "IOS_CXXFLAGS: $IOS_CXXFLAGS" fi -######################################## -##### Path with Toolchains ##### -######################################## - -# Only modify/export PATH if IOS_TOOLCHAIN good -if [ ! -z "$IOS_TOOLCHAIN" ] && [ ! -z "$XCODE_TOOLCHAIN" ]; then - - # And only modify PATH if IOS_TOOLCHAIN is not present - TOOL_PATH="$IOS_TOOLCHAIN:$XCODE_TOOLCHAIN" - LEN=${#TOOL_PATH} - SUBSTR=${PATH:0:$LEN} - if [ "$SUBSTR" != "$TOOL_PATH" ]; then - export PATH="$TOOL_PATH":"$PATH" - fi -else - echo "ERROR: unable to set new PATH." - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -######################################## -##### Tool Test Time ##### -######################################## - -# Test for various tools needed during cross compilation. -# FOUND_ALL starts high, and pushes low on failure -FOUND_ALL=1 - -# Apple's embedded g++ cannot compile integer.cpp -TOOLS=(clang clang++ libtool ld) -for tool in ${TOOLS[@]} -do - if [ ! -e "$IOS_TOOLCHAIN/$tool" ] && [ ! -e "$XCODE_TOOLCHAIN/$tool" ]; then - echo "ERROR: unable to find $tool at IOS_TOOLCHAIN or XCODE_TOOLCHAIN" - FOUND_ALL=0 - fi -done - -if [ "$FOUND_ALL" -eq "0" ]; then - [ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1 -fi - -# Exports added for Autotools. GNUmakefile-cross does not use them. -# What to do for AR=libtool and ARFLAGS? -export CPP="$IOS_TOOLCHAIN/cpp" -export CC="$IOS_TOOLCHAIN/clang" -export CXX="$IOS_TOOLCHAIN/clang++" -export LD="$IOS_TOOLCHAIN/ld" -export AS="$IOS_TOOLCHAIN/as" -export AR="$IOS_TOOLCHAIN/ar" -export RANLIB="$IOS_TOOLCHAIN/ranlib" -export STRIP="$IOS_TOOLCHAIN/strip" +##################################################################### echo echo "*******************************************************************************" echo "It looks the the environment is set correctly. Your next step is build" -echo "the library with 'make -f GNUmakefile-cross'. You can create a versioned" -echo "shared object using 'HAS_SOLIB_VERSION=1 make -f GNUmakefile-cross'" +echo "the library with 'make -f GNUmakefile-cross'." echo "*******************************************************************************" echo -[ "$0" = "$BASH_SOURCE" ] && exit 0 || return 0 +[ "$0" = "${BASH_SOURCE[0]}" ] && exit 0 || return 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-travis.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-travis.sh deleted file mode 100755 index 43920fb6..00000000 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/setenv-travis.sh +++ /dev/null @@ -1,18 +0,0 @@ -#/usr/bin/env bash - -# This file should be source'd when required. - -export ANDROID_HOME="$HOME/.android" -export ANDROID_SDK="$HOME/android/sdk/" -export ANDROID_NDK="$HOME/android/sdk/ndk-bundle" -export ANDROID_SDK_ROOT="$ANDROID_SDK" -export ANDROID_NDK_ROOT="$ANDROID_NDK" - -mkdir -p "$ANDROID_HOME" -mkdir -p "$ANDROID_SDK_ROOT" -mkdir -p "$ANDROID_NDK_ROOT" - -# https://stackoverflow.com/a/47028911/608639 -touch "$ANDROID_HOME/repositories.cfg" - -[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0 diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/tweetnacl.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/tweetnacl.sh deleted file mode 100755 index 824ed214..00000000 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/tweetnacl.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# Written and placed in public domain by Jeffrey Walton -# -# This script fetches TweetNaCl from Bernstein's site, and then -# prepares it for use in Crypto++ by applying tweetnacl.patch. -# The script should be run from the Crypto++ root directory on a -# Unix machine because of the use of Unix tools like wget. - -curl https://tweetnacl.cr.yp.to/20140427/tweetnacl.h > tweetnacl.h -curl https://tweetnacl.cr.yp.to/20140427/tweetnacl.c > tweetnacl.c - -# Fix whitespace -sed -e 's/[[:space:]]*$//' tweetnacl.h > tweetnacl.h.fixed -mv tweetnacl.h.fixed tweetnacl.h -sed -e 's/[[:space:]]*$//' tweetnacl.c > tweetnacl.c.fixed -mv tweetnacl.c.fixed tweetnacl.c - -if [[ -e "TestScripts/tweetnacl.patch" ]]; then - cp "TestScripts/tweetnacl.patch" . -fi - -if [[ ! -e "tweetnacl.patch" ]]; then - echo "Cannot find tweetnacl.patch. Please make sure it exists in the root directory." - echo "It can be created with 'diff -u tweetnacl.c tweetnacl.cpp > tweetnacl.patch'" - [[ "$0" = "$BASH_SOURCE" ]] && exit 0 || return 0 -fi - -# Normalize line endings -dos2unix tweetnacl.h tweetnacl.cpp tweetnacl.patch - -# Apply patch -patch --unified --binary -p0 < tweetnacl.patch -mv tweetnacl.c tweetnacl.cpp - -# Place things where they belong in source control -cp tweetnacl.sh TestScripts/ -cp tweetnacl.patch TestScripts/ - -# Fix whitespace -sed -e 's/[[:space:]]*$//' tweetnacl.h > tweetnacl.h.fixed -mv tweetnacl.h.fixed tweetnacl.h -sed -e 's/[[:space:]]*$//' tweetnacl.cpp > tweetnacl.cpp.fixed -mv tweetnacl.cpp.fixed tweetnacl.cpp - -# Convert to MS DOS for source control -unix2dos tweetnacl.h tweetnacl.cpp diff --git a/vendor/cryptopp/vendor_cryptopp/TestVectors/aes.txt b/vendor/cryptopp/vendor_cryptopp/TestVectors/aes.txt index f037c3fe..fbba5488 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestVectors/aes.txt +++ b/vendor/cryptopp/vendor_cryptopp/TestVectors/aes.txt @@ -239,3 +239,109 @@ Plaintext: r11 006bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5 Key: 2b7e151628aed2a6abf7158809cf4f3c Ciphertext: ECE71ECD7A4E3C2F643B2B0BFBED32F31C8551B6306D52CF843EC0B85015DC203B1C0B643E2A6BABAF5133DA0EA06616076AA6BBB52ED75DC3A71A9A6E8AC7C9A00D2C39AA68BF4E6FFED9AAEE5AD6914FB3EA77C7B61FF6BF564F2F1225ACB4B5889CB1559888A5817849C382E168482F75381F63868C468E4D1583B1FE71DD808CB94D8150AAB9D530A0FC17CDE748E95545D8A033B2F61F1954D0C0226168022E1CD7E031C57D048AC560F152960F47705E174D956D4BB53AE80BFFCD1BD569ED8EFFA223C00558B702405F33E6E0EDB2D9B0C148A1441CC80D6ABBCE785AA1B9DAB7CB8832F1B12D2EE60EE2DFCA37942CA1724E5602B7B70525AC9662028A22DB234676615DB474538CBC8D197F38C88BCC4F9E8D207538CA18DE5F095420A2E4D5868CEBB8B34A9377DC52D119790B65210F1B346F5E00D9BD00A8847048913D80726B9B745D565E6284B986DBAEA997FFC5A0DE5051527D44B2C1266DBC9130A6EB15F37A0F00B6286D6678CA651C07743BD37F2E8F6A94F5ED8C63428AE4883A9695183807E104BC335C64FEAAC40A605913DF98FF44E0801B31A968CCE5DCAFADE1E017FA711E05FF5A54BFA1999C2C463F97A3A66B30211BD306C8911C98F8EE5EF47A54746A4D16B7C7424A6954B4FC3BCF1A41BDE8A19CE1027AE86A320D0E5E7D3C7E50CFD0C4665B811D86C313F09ADE5B4DBE017231859881E5873E9EDB2011CF5920D2F7277C4DE1AC430A1849F0B870A69ABE701B6D0B5123E5FF53395409177CF84BF41EC33C5E4BCC2CF29258DC7C260471AABDA49FDE62915758EE4E578D0F7698E6456BC144573739D5D508CC76B389359D2A0ECB5B7EE5FCB4C3151D5AF7C71819EA3DD5F36C7B27E551FD2373D07FFDC76A13FC4B10A6F29A83D6F465ACB6960671EACF21A3E1CB4411C4DAA0C2A87DAED28AEE60B7EC0258A9AF125F2DDC80B9877EFE0F372D9B832C786770A84EA1A07CB6E1A9907D651BBD0EFDEF2AFFC3 Test: Encrypt + +AlgorithmType: SymmetricCipher +Name: AES/XTS +# +Source: P1619-2007, Appendix B +Comment: Vector 1, XTS-AES applied for a data unit of 32 bytes, 32 bytes key material. +Key: 00000000000000000000000000000000 \ + 00000000000000000000000000000000 +IV: 00000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 917cf69ebd68b2ec9b9fe9a3eadda692cd43d2f59598ed858c02c2652fbf922e +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 2, XTS-AES applied for a data unit of 32 bytes, 32 bytes key material. +Key: 11111111111111111111111111111111 \ + 22222222222222222222222222222222 +IV: 33333333330000000000000000000000 +Plaintext: 4444444444444444444444444444444444444444444444444444444444444444 +Ciphertext: c454185e6a16936e39334038acef838bfb186fff7480adc4289382ecd6d394f0 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 3, XTS-AES applied for a data unit of 32 bytes, 32 bytes key material. +Key: fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0 \ + 22222222222222222222222222222222 +IV: 33333333330000000000000000000000 +Plaintext: 4444444444444444444444444444444444444444444444444444444444444444 +Ciphertext: af85336b597afc1a900b2eb21ec949d292df4c047e0b21532186a5971a227a89 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 15, XTS-AES-128 applied for a data unit that is not a multiple of 16 bytes. +Key: fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0 \ + bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0 +IV: 9a785634120000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f10 +Ciphertext: 6c1625db4671522d3d7599601de7ca09ed +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 16, XTS-AES-128 applied for a data unit that is not a multiple of 16 bytes. +Key: fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0 \ + bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0 +IV: 9a785634120000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f1011 +Ciphertext: d069444b7a7e0cab09e24447d24deb1fedbf +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 17, XTS-AES-128 applied for a data unit that is not a multiple of 16 bytes. +Key: fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0 \ + bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0 +IV: 9a785634120000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f101112 +Ciphertext: e5df1351c0544ba1350b3363cd8ef4beedbf9d +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 18, XTS-AES-128 applied for a data unit that is not a multiple of 16 bytes. +Key: fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0 \ + bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0 +IV: 9a785634120000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f10111213 +Ciphertext: 9d84c813f719aa2c7be3f66171c7c5c2edbf9dac +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 19, XTS-AES-128 applied for a data unit that is not a multiple of 16 bytes. +Key: e0e1e2e3e4e5e6e7e8e9eaebecedeeef \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecf +IV: 21436587a90000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff \ + 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Ciphertext: 38b45812ef43a05bd957e545907e223b954ab4aaf088303ad910eadf14b42be6 \ + 8b2461149d8c8ba85f992be970bc621f1b06573f63e867bf5875acafa04e42cc \ + bd7bd3c2a0fb1fff791ec5ec36c66ae4ac1e806d81fbf709dbe29e471fad3854 \ + 9c8e66f5345d7c1eb94f405d1ec785cc6f6a68f6254dd8339f9d84057e01a177 \ + 41990482999516b5611a38f41bb6478e6f173f320805dd71b1932fc333cb9ee3 \ + 9936beea9ad96fa10fb4112b901734ddad40bc1878995f8e11aee7d141a2f5d4 \ + 8b7a4e1e7f0b2c04830e69a4fd1378411c2f287edf48c6c4e5c247a19680f7fe \ + 41cefbd49b582106e3616cbbe4dfb2344b2ae9519391f3e0fb4922254b1d6d2d \ + 19c6d4d537b3a26f3bcc51588b32f3eca0829b6a5ac72578fb814fb43cf80d64 \ + a233e3f997a3f02683342f2b33d25b492536b93becb2f5e1a8b82f5b88334272 \ + 9e8ae09d16938841a21a97fb543eea3bbff59f13c1a18449e398701c1ad51648 \ + 346cbc04c27bb2da3b93a1372ccae548fb53bee476f9e9c91773b1bb19828394 \ + d55d3e1a20ed69113a860b6829ffa847224604435070221b257e8dff783615d2 \ + cae4803a93aa4334ab482a0afac9c0aeda70b45a481df5dec5df8cc0f423c77a \ + 5fd46cd312021d4b438862419a791be03bb4d97c0e59578542531ba466a83baf \ + 92cefc151b5cc1611a167893819b63fb8a6b18e86de60290fa72b797b0ce59f3 +Test: Encrypt + diff --git a/vendor/cryptopp/vendor_cryptopp/TestVectors/all.txt b/vendor/cryptopp/vendor_cryptopp/TestVectors/all.txt index f60a9f4e..2614d7ef 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestVectors/all.txt +++ b/vendor/cryptopp/vendor_cryptopp/TestVectors/all.txt @@ -60,3 +60,5 @@ Test: TestVectors/ttmac.txt Test: TestVectors/vmac.txt Test: TestVectors/wake.txt Test: TestVectors/whrlpool.txt +Test: TestVectors/xts.txt + diff --git a/vendor/cryptopp/vendor_cryptopp/TestVectors/blake2b.txt b/vendor/cryptopp/vendor_cryptopp/TestVectors/blake2b.txt index ec5167c7..68ed80b7 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestVectors/blake2b.txt +++ b/vendor/cryptopp/vendor_cryptopp/TestVectors/blake2b.txt @@ -436,4 +436,3 @@ Test: Verify Message: "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789" Digest: FFD4A61F80D55FFA83BA8D2BD62DCFC33148ADE507A8F7F85A5AF2C619E126FF11E9284F12BF3EE6A2B5CBC711FA84C37DA343AB7D29BCDF722DF0171E41297A Test: Verify - diff --git a/vendor/cryptopp/vendor_cryptopp/TestVectors/xts.txt b/vendor/cryptopp/vendor_cryptopp/TestVectors/xts.txt new file mode 100644 index 00000000..fa79a472 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestVectors/xts.txt @@ -0,0 +1,8228 @@ +# These test vectors were gathered from P1619-2007, +# http://libeccio.di.unisa.it/Crypto14/Lab/p1619.pdf, +# and generated from the IEEE reference implementation. + +# The "Data Unit Sequence number", which is a 64-bit value, +# was converted to a little-endian byte array for the IV. + +AlgorithmType: SymmetricCipher +Name: AES/XTS +# +Source: P1619-2007, Appendix B +Comment: Vector 1, XTS-AES applied for a data unit of 32 bytes, 32 bytes key material. +Key: 00000000000000000000000000000000 \ + 00000000000000000000000000000000 +IV: 00000000000000000000000000000000 +Plaintext: 0000000000000000000000000000000000000000000000000000000000000000 +Ciphertext: 917cf69ebd68b2ec9b9fe9a3eadda692cd43d2f59598ed858c02c2652fbf922e +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 2, XTS-AES applied for a data unit of 32 bytes, 32 bytes key material. +Key: 11111111111111111111111111111111 \ + 22222222222222222222222222222222 +IV: 33333333330000000000000000000000 +Plaintext: 4444444444444444444444444444444444444444444444444444444444444444 +Ciphertext: c454185e6a16936e39334038acef838bfb186fff7480adc4289382ecd6d394f0 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 3, XTS-AES applied for a data unit of 32 bytes, 32 bytes key material. +Key: fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0 \ + 22222222222222222222222222222222 +IV: 33333333330000000000000000000000 +Plaintext: 4444444444444444444444444444444444444444444444444444444444444444 +Ciphertext: af85336b597afc1a900b2eb21ec949d292df4c047e0b21532186a5971a227a89 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 4, XTS-AES-128 applied for a data unit of 512 bytes. +Key: 27182818284590452353602874713526 \ + 31415926535897932384626433832795 +IV: 00000000000000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff \ + 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Ciphertext: 27a7479befa1d476489f308cd4cfa6e2a96e4bbe3208ff25287dd3819616e89c \ + c78cf7f5e543445f8333d8fa7f56000005279fa5d8b5e4ad40e736ddb4d35412 \ + 328063fd2aab53e5ea1e0a9f332500a5df9487d07a5c92cc512c8866c7e860ce \ + 93fdf166a24912b422976146ae20ce846bb7dc9ba94a767aaef20c0d61ad0265 \ + 5ea92dc4c4e41a8952c651d33174be51a10c421110e6d81588ede82103a252d8 \ + a750e8768defffed9122810aaeb99f9172af82b604dc4b8e51bcb08235a6f434 \ + 1332e4ca60482a4ba1a03b3e65008fc5da76b70bf1690db4eae29c5f1badd03c \ + 5ccf2a55d705ddcd86d449511ceb7ec30bf12b1fa35b913f9f747a8afd1b130e \ + 94bff94effd01a91735ca1726acd0b197c4e5b03393697e126826fb6bbde8ecc \ + 1e08298516e2c9ed03ff3c1b7860f6de76d4cecd94c8119855ef5297ca67e9f3 \ + e7ff72b1e99785ca0a7e7720c5b36dc6d72cac9574c8cbbc2f801e23e56fd344 \ + b07f22154beba0f08ce8891e643ed995c94d9a69c9f1b5f499027a78572aeebd \ + 74d20cc39881c213ee770b1010e4bea718846977ae119f7a023ab58cca0ad752 \ + afe656bb3c17256a9f6e9bf19fdd5a38fc82bbe872c5539edb609ef4f79c203e \ + bb140f2e583cb2ad15b4aa5b655016a8449277dbd477ef2c8d6c017db738b18d \ + eb4a427d1923ce3ff262735779a418f20a282df920147beabe421ee5319d0568 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 5, XTS-AES-128 applied for a data unit of 512 bytes. +Key: 27182818284590452353602874713526 \ + 31415926535897932384626433832795 +IV: 01000000000000000000000000000000 +Plaintext: 27a7479befa1d476489f308cd4cfa6e2a96e4bbe3208ff25287dd3819616e89c \ + c78cf7f5e543445f8333d8fa7f56000005279fa5d8b5e4ad40e736ddb4d35412 \ + 328063fd2aab53e5ea1e0a9f332500a5df9487d07a5c92cc512c8866c7e860ce \ + 93fdf166a24912b422976146ae20ce846bb7dc9ba94a767aaef20c0d61ad0265 \ + 5ea92dc4c4e41a8952c651d33174be51a10c421110e6d81588ede82103a252d8 \ + a750e8768defffed9122810aaeb99f9172af82b604dc4b8e51bcb08235a6f434 \ + 1332e4ca60482a4ba1a03b3e65008fc5da76b70bf1690db4eae29c5f1badd03c \ + 5ccf2a55d705ddcd86d449511ceb7ec30bf12b1fa35b913f9f747a8afd1b130e \ + 94bff94effd01a91735ca1726acd0b197c4e5b03393697e126826fb6bbde8ecc \ + 1e08298516e2c9ed03ff3c1b7860f6de76d4cecd94c8119855ef5297ca67e9f3 \ + e7ff72b1e99785ca0a7e7720c5b36dc6d72cac9574c8cbbc2f801e23e56fd344 \ + b07f22154beba0f08ce8891e643ed995c94d9a69c9f1b5f499027a78572aeebd \ + 74d20cc39881c213ee770b1010e4bea718846977ae119f7a023ab58cca0ad752 \ + afe656bb3c17256a9f6e9bf19fdd5a38fc82bbe872c5539edb609ef4f79c203e \ + bb140f2e583cb2ad15b4aa5b655016a8449277dbd477ef2c8d6c017db738b18d \ + eb4a427d1923ce3ff262735779a418f20a282df920147beabe421ee5319d0568 +Ciphertext: 264d3ca8512194fec312c8c9891f279fefdd608d0c027b60483a3fa811d65ee5 \ + 9d52d9e40ec5672d81532b38b6b089ce951f0f9c35590b8b978d175213f329bb \ + 1c2fd30f2f7f30492a61a532a79f51d36f5e31a7c9a12c286082ff7d2394d18f \ + 783e1a8e72c722caaaa52d8f065657d2631fd25bfd8e5baad6e527d763517501 \ + c68c5edc3cdd55435c532d7125c8614deed9adaa3acade5888b87bef641c4c99 \ + 4c8091b5bcd387f3963fb5bc37aa922fbfe3df4e5b915e6eb514717bdd2a7407 \ + 9a5073f5c4bfd46adf7d282e7a393a52579d11a028da4d9cd9c77124f9648ee3 \ + 83b1ac763930e7162a8d37f350b2f74b8472cf09902063c6b32e8c2d9290cefb \ + d7346d1c779a0df50edcde4531da07b099c638e83a755944df2aef1aa31752fd \ + 323dcb710fb4bfbb9d22b925bc3577e1b8949e729a90bbafeacf7f7879e7b114 \ + 7e28ba0bae940db795a61b15ecf4df8db07b824bb062802cc98a9545bb2aaeed \ + 77cb3fc6db15dcd7d80d7d5bc406c4970a3478ada8899b329198eb61c193fb62 \ + 75aa8ca340344a75a862aebe92eee1ce032fd950b47d7704a3876923b4ad6284 \ + 4bf4a09c4dbe8b4397184b7471360c9564880aedddb9baa4af2e75394b08cd32 \ + ff479c57a07d3eab5d54de5f9738b8d27f27a9f0ab11799d7b7ffefb2704c95c \ + 6ad12c39f1e867a4b7b1d7818a4b753dfd2a89ccb45e001a03a867b187f225dd +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 6, XTS-AES-128 applied for a data unit of 512 bytes. +Key: 27182818284590452353602874713526 \ + 31415926535897932384626433832795 +IV: 02000000000000000000000000000000 +Plaintext: 264d3ca8512194fec312c8c9891f279fefdd608d0c027b60483a3fa811d65ee5 \ + 9d52d9e40ec5672d81532b38b6b089ce951f0f9c35590b8b978d175213f329bb \ + 1c2fd30f2f7f30492a61a532a79f51d36f5e31a7c9a12c286082ff7d2394d18f \ + 783e1a8e72c722caaaa52d8f065657d2631fd25bfd8e5baad6e527d763517501 \ + c68c5edc3cdd55435c532d7125c8614deed9adaa3acade5888b87bef641c4c99 \ + 4c8091b5bcd387f3963fb5bc37aa922fbfe3df4e5b915e6eb514717bdd2a7407 \ + 9a5073f5c4bfd46adf7d282e7a393a52579d11a028da4d9cd9c77124f9648ee3 \ + 83b1ac763930e7162a8d37f350b2f74b8472cf09902063c6b32e8c2d9290cefb \ + d7346d1c779a0df50edcde4531da07b099c638e83a755944df2aef1aa31752fd \ + 323dcb710fb4bfbb9d22b925bc3577e1b8949e729a90bbafeacf7f7879e7b114 \ + 7e28ba0bae940db795a61b15ecf4df8db07b824bb062802cc98a9545bb2aaeed \ + 77cb3fc6db15dcd7d80d7d5bc406c4970a3478ada8899b329198eb61c193fb62 \ + 75aa8ca340344a75a862aebe92eee1ce032fd950b47d7704a3876923b4ad6284 \ + 4bf4a09c4dbe8b4397184b7471360c9564880aedddb9baa4af2e75394b08cd32 \ + ff479c57a07d3eab5d54de5f9738b8d27f27a9f0ab11799d7b7ffefb2704c95c \ + 6ad12c39f1e867a4b7b1d7818a4b753dfd2a89ccb45e001a03a867b187f225dd +Ciphertext: fa762a3680b76007928ed4a4f49a9456031b704782e65e16cecb54ed7d017b5e \ + 18abd67b338e81078f21edb7868d901ebe9c731a7c18b5e6dec1d6a72e078ac9 \ + a4262f860beefa14f4e821018272e411a951502b6e79066e84252c3346f3aa62 \ + 344351a291d4bedc7a07618bdea2af63145cc7a4b8d4070691ae890cd65733e7 \ + 946e9021a1dffc4c59f159425ee6d50ca9b135fa6162cea18a939838dc000fb3 \ + 86fad086acce5ac07cb2ece7fd580b00cfa5e98589631dc25e8e2a3daf2ffdec \ + 26531659912c9d8f7a15e5865ea8fb5816d6207052bd7128cd743c12c8118791 \ + a4736811935eb982a532349e31dd401e0b660a568cb1a4711f552f55ded59f1f \ + 15bf7196b3ca12a91e488ef59d64f3a02bf45239499ac6176ae321c4a211ec54 \ + 5365971c5d3f4f09d4eb139bfdf2073d33180b21002b65cc9865e76cb24cd92c \ + 874c24c18350399a936ab3637079295d76c417776b94efce3a0ef7206b151105 \ + 19655c956cbd8b2489405ee2b09a6b6eebe0c53790a12a8998378b33a5b71159 \ + 625f4ba49d2a2fdba59fbf0897bc7aabd8d707dc140a80f0f309f835d3da54ab \ + 584e501dfa0ee977fec543f74186a802b9a37adb3e8291eca04d66520d229e60 \ + 401e7282bef486ae059aa70696e0e305d777140a7a883ecdcb69b9ff938e8a42 \ + 31864c69ca2c2043bed007ff3e605e014bcf518138dc3a25c5e236171a2d01d6 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 7, XTS-AES-128 applied for a data unit of 512 bytes. +Key: 27182818284590452353602874713526 \ + 31415926535897932384626433832795 +IV: fd000000000000000000000000000000 +Plaintext: 8e41b78c390b5af9d758bb214a67e9f6bf7727b09ac6124084c37611398fa45d \ + aad94868600ed391fb1acd4857a95b466e62ef9f4b377244d1c152e7b30d731a \ + ad30c716d214b707aed99eb5b5e580b3e887cf7497465651d4b60e6042051da3 \ + 693c3b78c14489543be8b6ad0ba629565bba202313ba7b0d0c94a3252b676f46 \ + cc02ce0f8a7d34c0ed229129673c1f61aed579d08a9203a25aac3a77e9db6026 \ + 7996db38df637356d9dcd1632e369939f2a29d89345c66e05066f1a3677aef18 \ + dea4113faeb629e46721a66d0a7e785d3e29af2594eb67dfa982affe0aac058f \ + 6e15864269b135418261fc3afb089472cf68c45dd7f231c6249ba0255e1e0338 \ + 33fc4d00a3fe02132d7bc3873614b8aee34273581ea0325c81f0270affa13641 \ + d052d36f0757d484014354d02d6883ca15c24d8c3956b1bd027bcf41f151fd80 \ + 23c5340e5606f37e90fdb87c86fb4fa634b3718a30bace06a66eaf8f63c4aa3b \ + 637826a87fe8cfa44282e92cb1615af3a28e53bc74c7cba1a0977be9065d0c1a \ + 5dec6c54ae38d37f37aa35283e048e5530a85c4e7a29d7b92ec0c3169cdf2a80 \ + 5c7604bce60049b9fb7b8eaac10f51ae23794ceba68bb58112e293b9b692ca72 \ + 1b37c662f8574ed4dba6f88e170881c82cddc1034a0ca7e284bf0962b6b26292 \ + d836fa9f73c1ac770eef0f2d3a1eaf61d3e03555fd424eedd67e18a18094f888 +Ciphertext: d55f684f81f4426e9fde92a5ff02df2ac896af63962888a97910c1379e20b0a3 \ + b1db613fb7fe2e07004329ea5c22bfd33e3dbe4cf58cc608c2c26c19a2e2fe22 \ + f98732c2b5cb844cc6c0702d91e1d50fc4382a7eba5635cd602432a2306ac4ce \ + 82f8d70c8d9bc15f918fe71e74c622d5cf71178bf6e0b9cc9f2b41dd8dbe441c \ + 41cd0c73a6dc47a348f6702f9d0e9b1b1431e948e299b9ec2272ab2c5f0c7be8 \ + 6affa5dec87a0bee81d3d50007edaa2bcfccb35605155ff36ed8edd4a40dcd4b \ + 243acd11b2b987bdbfaf91a7cac27e9c5aea525ee53de7b2d3332c8644402b82 \ + 3e94a7db26276d2d23aa07180f76b4fd29b9c0823099c9d62c519880aee7e969 \ + 7617c1497d47bf3e571950311421b6b734d38b0db91eb85331b91ea9f61530f5 \ + 4512a5a52a4bad589eb69781d537f23297bb459bdad2948a29e1550bf4787e0b \ + e95bb173cf5fab17dab7a13a052a63453d97ccec1a321954886b7a1299faaeec \ + ae35c6eaaca753b041b5e5f093bf83397fd21dd6b3012066fcc058cc32c3b09d \ + 7562dee29509b5839392c9ff05f51f3166aaac4ac5f238038a3045e6f72e48ef \ + 0fe8bc675e82c318a268e43970271bf119b81bf6a982746554f84e72b9f00280 \ + a320a08142923c23c883423ff949827f29bbacdc1ccdb04938ce6098c95ba6b3 \ + 2528f4ef78eed778b2e122ddfd1cbdd11d1c0a6783e011fc536d63d053260637 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 8, XTS-AES-128 applied for a data unit of 512 bytes. +Key: 27182818284590452353602874713526 \ + 31415926535897932384626433832795 +IV: fe000000000000000000000000000000 +Plaintext: d55f684f81f4426e9fde92a5ff02df2ac896af63962888a97910c1379e20b0a3 \ + b1db613fb7fe2e07004329ea5c22bfd33e3dbe4cf58cc608c2c26c19a2e2fe22 \ + f98732c2b5cb844cc6c0702d91e1d50fc4382a7eba5635cd602432a2306ac4ce \ + 82f8d70c8d9bc15f918fe71e74c622d5cf71178bf6e0b9cc9f2b41dd8dbe441c \ + 41cd0c73a6dc47a348f6702f9d0e9b1b1431e948e299b9ec2272ab2c5f0c7be8 \ + 6affa5dec87a0bee81d3d50007edaa2bcfccb35605155ff36ed8edd4a40dcd4b \ + 243acd11b2b987bdbfaf91a7cac27e9c5aea525ee53de7b2d3332c8644402b82 \ + 3e94a7db26276d2d23aa07180f76b4fd29b9c0823099c9d62c519880aee7e969 \ + 7617c1497d47bf3e571950311421b6b734d38b0db91eb85331b91ea9f61530f5 \ + 4512a5a52a4bad589eb69781d537f23297bb459bdad2948a29e1550bf4787e0b \ + e95bb173cf5fab17dab7a13a052a63453d97ccec1a321954886b7a1299faaeec \ + ae35c6eaaca753b041b5e5f093bf83397fd21dd6b3012066fcc058cc32c3b09d \ + 7562dee29509b5839392c9ff05f51f3166aaac4ac5f238038a3045e6f72e48ef \ + 0fe8bc675e82c318a268e43970271bf119b81bf6a982746554f84e72b9f00280 \ + a320a08142923c23c883423ff949827f29bbacdc1ccdb04938ce6098c95ba6b3 \ + 2528f4ef78eed778b2e122ddfd1cbdd11d1c0a6783e011fc536d63d053260637 +Ciphertext: 72efc1ebfe1ee25975a6eb3aa8589dda2b261f1c85bdab442a9e5b2dd1d7c395 \ + 7a16fc08e526d4b1223f1b1232a11af274c3d70dac57f83e0983c498f1a6f1ae \ + cb021c3e70085a1e527f1ce41ee5911a82020161529cd82773762daf5459de94 \ + a0a82adae7e1703c808543c29ed6fb32d9e004327c1355180c995a07741493a0 \ + 9c21ba01a387882da4f62534b87bb15d60d197201c0fd3bf30c1500a3ecfecdd \ + 66d8721f90bcc4c17ee925c61b0a03727a9c0d5f5ca462fbfa0af1c2513a9d9d \ + 4b5345bd27a5f6e653f751693e6b6a2b8ead57d511e00e58c45b7b8d005af792 \ + 88f5c7c22fd4f1bf7a898b03a5634c6a1ae3f9fae5de4f296a2896b23e7ed43e \ + d14fa5a2803f4d28f0d3ffcf24757677aebdb47bb388378708948a8d4126ed18 \ + 39e0da29a537a8c198b3c66ab00712dd261674bf45a73d67f76914f830ca014b \ + 65596f27e4cf62de66125a5566df9975155628b400fbfb3a29040ed50faffdbb \ + 18aece7c5c44693260aab386c0a37b11b114f1c415aebb653be468179428d43a \ + 4d8bc3ec38813eca30a13cf1bb18d524f1992d44d8b1a42ea30b22e6c95b199d \ + 8d182f8840b09d059585c31ad691fa0619ff038aca2c39a943421157361717c4 \ + 9d322028a74648113bd8c9d7ec77cf3c89c1ec8718ceff8516d96b34c3c614f1 \ + 0699c9abc4ed0411506223bea16af35c883accdbe1104eef0cfdb54e12fb230a +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 9, XTS-AES-128 applied for a data unit of 512 bytes. +Key: 27182818284590452353602874713526 \ + 31415926535897932384626433832795 +IV: ff000000000000000000000000000000 +Plaintext: 72efc1ebfe1ee25975a6eb3aa8589dda2b261f1c85bdab442a9e5b2dd1d7c395 \ + 7a16fc08e526d4b1223f1b1232a11af274c3d70dac57f83e0983c498f1a6f1ae \ + cb021c3e70085a1e527f1ce41ee5911a82020161529cd82773762daf5459de94 \ + a0a82adae7e1703c808543c29ed6fb32d9e004327c1355180c995a07741493a0 \ + 9c21ba01a387882da4f62534b87bb15d60d197201c0fd3bf30c1500a3ecfecdd \ + 66d8721f90bcc4c17ee925c61b0a03727a9c0d5f5ca462fbfa0af1c2513a9d9d \ + 4b5345bd27a5f6e653f751693e6b6a2b8ead57d511e00e58c45b7b8d005af792 \ + 88f5c7c22fd4f1bf7a898b03a5634c6a1ae3f9fae5de4f296a2896b23e7ed43e \ + d14fa5a2803f4d28f0d3ffcf24757677aebdb47bb388378708948a8d4126ed18 \ + 39e0da29a537a8c198b3c66ab00712dd261674bf45a73d67f76914f830ca014b \ + 65596f27e4cf62de66125a5566df9975155628b400fbfb3a29040ed50faffdbb \ + 18aece7c5c44693260aab386c0a37b11b114f1c415aebb653be468179428d43a \ + 4d8bc3ec38813eca30a13cf1bb18d524f1992d44d8b1a42ea30b22e6c95b199d \ + 8d182f8840b09d059585c31ad691fa0619ff038aca2c39a943421157361717c4 \ + 9d322028a74648113bd8c9d7ec77cf3c89c1ec8718ceff8516d96b34c3c614f1 \ + 0699c9abc4ed0411506223bea16af35c883accdbe1104eef0cfdb54e12fb230a +Ciphertext: 3260ae8dad1f4a32c5cafe3ab0eb95549d461a67ceb9e5aa2d3afb62dece0553 \ + 193ba50c75be251e08d1d08f1088576c7efdfaaf3f459559571e12511753b07a \ + f073f35da06af0ce0bbf6b8f5ccc5cea500ec1b211bd51f63b606bf6528796ca \ + 12173ba39b8935ee44ccce646f90a45bf9ccc567f0ace13dc2d53ebeedc81f58 \ + b2e41179dddf0d5a5c42f5d8506c1a5d2f8f59f3ea873cbcd0eec19acbf32542 \ + 3bd3dcb8c2b1bf1d1eaed0eba7f0698e4314fbeb2f1566d1b9253008cbccf45a \ + 2b0d9c5c9c21474f4076e02be26050b99dee4fd68a4cf890e496e4fcae7b70f9 \ + 4ea5a9062da0daeba1993d2ccd1dd3c244b8428801495a58b216547e7e847c46 \ + d1d756377b6242d2e5fb83bf752b54e0df71e889f3a2bb0f4c10805bf3c59037 \ + 6e3c24e22ff57f7fa965577375325cea5d920db94b9c336b455f6e894c01866f \ + e9fbb8c8d3f70a2957285f6dfb5dcd8cbf54782f8fe7766d4723819913ac7734 \ + 21e3a31095866bad22c86a6036b2518b2059b4229d18c8c2ccbdf906c6cc6e82 \ + 464ee57bddb0bebcb1dc645325bfb3e665ef7251082c88ebb1cf203bd779fdd3 \ + 8675713c8daadd17e1cabee432b09787b6ddf3304e38b731b45df5df51b78fcf \ + b3d32466028d0ba36555e7e11ab0ee0666061d1645d962444bc47a38188930a8 \ + 4b4d561395c73c087021927ca638b7afc8a8679ccb84c26555440ec7f10445cd +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 10, XTS-AES-256 applied for a data unit of 512 bytes. +Key: 2718281828459045235360287471352662497757247093699959574966967627 \ + 3141592653589793238462643383279502884197169399375105820974944592 +IV: ff000000000000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff \ + 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Ciphertext: 1c3b3a102f770386e4836c99e370cf9bea00803f5e482357a4ae12d414a3e63b \ + 5d31e276f8fe4a8d66b317f9ac683f44680a86ac35adfc3345befecb4bb188fd \ + 5776926c49a3095eb108fd1098baec70aaa66999a72a82f27d848b21d4a741b0 \ + c5cd4d5fff9dac89aeba122961d03a757123e9870f8acf1000020887891429ca \ + 2a3e7a7d7df7b10355165c8b9a6d0a7de8b062c4500dc4cd120c0f7418dae3d0 \ + b5781c34803fa75421c790dfe1de1834f280d7667b327f6c8cd7557e12ac3a0f \ + 93ec05c52e0493ef31a12d3d9260f79a289d6a379bc70c50841473d1a8cc81ec \ + 583e9645e07b8d9670655ba5bbcfecc6dc3966380ad8fecb17b6ba02469a020a \ + 84e18e8f84252070c13e9f1f289be54fbc481457778f616015e1327a02b140f1 \ + 505eb309326d68378f8374595c849d84f4c333ec4423885143cb47bd71c5edae \ + 9be69a2ffeceb1bec9de244fbe15992b11b77c040f12bd8f6a975a44a0f90c29 \ + a9abc3d4d893927284c58754cce294529f8614dcd2aba991925fedc4ae74ffac \ + 6e333b93eb4aff0479da9a410e4450e0dd7ae4c6e2910900575da401fc07059f \ + 645e8b7e9bfdef33943054ff84011493c27b3429eaedb4ed5376441a77ed4385 \ + 1ad77f16f541dfd269d50d6a5f14fb0aab1cbb4c1550be97f7ab4066193c4caa \ + 773dad38014bd2092fa755c824bb5e54c4f36ffda9fcea70b9c6e693e148c151 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 11, XTS-AES-256 applied for a data unit of 512 bytes. +Key: 2718281828459045235360287471352662497757247093699959574966967627 \ + 3141592653589793238462643383279502884197169399375105820974944592 +IV: ffff0000000000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff \ + 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Ciphertext: 77a31251618a15e6b92d1d66dffe7b50b50bad552305ba0217a610688eff7e11 \ + e1d0225438e093242d6db274fde801d4cae06f2092c728b2478559df58e837c2 \ + 469ee4a4fa794e4bbc7f39bc026e3cb72c33b0888f25b4acf56a2a9804f1ce6d \ + 3d6e1dc6ca181d4b546179d55544aa7760c40d06741539c7e3cd9d2f6650b201 \ + 3fd0eeb8c2b8e3d8d240ccae2d4c98320a7442e1c8d75a42d6e6cfa4c2eca179 \ + 8d158c7aecdf82490f24bb9b38e108bcda12c3faf9a21141c3613b58367f922a \ + aa26cd22f23d708dae699ad7cb40a8ad0b6e2784973dcb605684c08b8d6998c6 \ + 9aac049921871ebb65301a4619ca80ecb485a31d744223ce8ddc2394828d6a80 \ + 470c092f5ba413c3378fa6054255c6f9df4495862bbb3287681f931b687c888a \ + bf844dfc8fc28331e579928cd12bd2390ae123cf03818d14dedde5c0c24c8ab0 \ + 18bfca75ca096f2d531f3d1619e785f1ada437cab92e980558b3dce1474afb75 \ + bfedbf8ff54cb2618e0244c9ac0d3c66fb51598cd2db11f9be39791abe447c63 \ + 094f7c453b7ff87cb5bb36b7c79efb0872d17058b83b15ab0866ad8a58656c5a \ + 7e20dbdf308b2461d97c0ec0024a2715055249cf3b478ddd4740de654f75ca68 \ + 6e0d7345c69ed50cdc2a8b332b1f8824108ac937eb050585608ee734097fc090 \ + 54fbff89eeaeea791f4a7ab1f9868294a4f9e27b42af8100cb9d59cef9645803 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 12, XTS-AES-256 applied for a data unit of 512 bytes. +Key: 2718281828459045235360287471352662497757247093699959574966967627 \ + 3141592653589793238462643383279502884197169399375105820974944592 +IV: ffffff00000000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff \ + 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Ciphertext: e387aaa58ba483afa7e8eb469778317ecf4cf573aa9d4eac23f2cdf914e4e200 \ + a8b490e42ee646802dc6ee2b471b278195d60918ececb44bf79966f83faba049 \ + 9298ebc699c0c8634715a320bb4f075d622e74c8c932004f25b41e361025b5a8 \ + 7815391f6108fc4afa6a05d9303c6ba68a128a55705d415985832fdeaae6c8e1 \ + 9110e84d1b1f199a2692119edc96132658f09da7c623efcec712537a3d94c0bf \ + 5d7e352ec94ae5797fdb377dc1551150721adf15bd26a8efc2fcaad56881fa9e \ + 62462c28f30ae1ceaca93c345cf243b73f542e2074a705bd2643bb9f7cc79bb6 \ + e7091ea6e232df0f9ad0d6cf502327876d82207abf2115cdacf6d5a48f6c1879 \ + a65b115f0f8b3cb3c59d15dd8c769bc014795a1837f3901b5845eb491adfefe0 \ + 97b1fa30a12fc1f65ba22905031539971a10f2f36c321bb51331cdefb39e3964 \ + c7ef079994f5b69b2edd83a71ef549971ee93f44eac3938fcdd61d01fa71799d \ + a3a8091c4c48aa9ed263ff0749df95d44fef6a0bb578ec69456aa5408ae32c7a \ + f08ad7ba8921287e3bbee31b767be06a0e705c864a769137df28292283ea81a2 \ + 480241b44d9921cdbec1bc28dc1fda114bd8e5217ac9d8ebafa720e9da4f9ace \ + 231cc949e5b96fe76ffc21063fddc83a6b8679c00d35e09576a875305bed5f36 \ + ed242c8900dd1fa965bc950dfce09b132263a1eef52dd6888c309f5a7d712826 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 13, XTS-AES-256 applied for a data unit of 512 bytes. +Key: 2718281828459045235360287471352662497757247093699959574966967627 \ + 3141592653589793238462643383279502884197169399375105820974944592 +IV: ffffffff000000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff \ + 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Ciphertext: bf53d2dade78e822a4d949a9bc6766b01b06a8ef70d26748c6a7fc36d80ae4c5 \ + 520f7c4ab0ac8544424fa405162fef5a6b7f229498063618d39f0003cb5fb8d1 \ + c86b643497da1ff945c8d3bedeca4f479702a7a735f043ddb1d6aaade3c4a0ac \ + 7ca7f3fa5279bef56f82cd7a2f38672e824814e10700300a055e1630b8f1cb0e \ + 919f5e942010a416e2bf48cb46993d3cb6a51c19bacf864785a00bc2ecff15d3 \ + 50875b246ed53e68be6f55bd7e05cfc2b2ed6432198a6444b6d8c247fab941f5 \ + 69768b5c429366f1d3f00f0345b96123d56204c01c63b22ce78baf116e525ed9 \ + 0fdea39fa469494d3866c31e05f295ff21fea8d4e6e13d67e47ce722e9698a1c \ + 1048d68ebcde76b86fcf976eab8aa9790268b7068e017a8b9b749409514f1053 \ + 027fd16c3786ea1bac5f15cb79711ee2abe82f5cf8b13ae73030ef5b9e4457e7 \ + 5d1304f988d62dd6fc4b94ed38ba831da4b7634971b6cd8ec325d9c61c00f1df \ + 73627ed3745a5e8489f3a95c69639c32cd6e1d537a85f75cc844726e8a72fc00 \ + 77ad22000f1d5078f6b866318c668f1ad03d5a5fced5219f2eabbd0aa5c0f460 \ + d183f04404a0d6f469558e81fab24a167905ab4c7878502ad3e38fdbe62a4155 \ + 6cec37325759533ce8f25f367c87bb5578d667ae93f9e2fd99bcbc5f2fbba88c \ + f6516139420fcff3b7361d86322c4bd84c82f335abb152c4a93411373aaa8220 +Test: Encrypt +# +Source: P1619-2007, Appendix B +Comment: Vector 14, XTS-AES-256 applied for a data unit of 512 bytes. +Key: 2718281828459045235360287471352662497757247093699959574966967627 \ + 3141592653589793238462643383279502884197169399375105820974944592 +IV: ffffffffff0000000000000000000000 +Plaintext: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff \ + 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ + 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f \ + 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f \ + 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f \ + 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f \ + a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf \ + c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf \ + e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff +Ciphertext: 64497e5a831e4a932c09be3e5393376daa599548b816031d224bbf50a818ed23 \ + 50eae7e96087c8a0db51ad290bd00c1ac1620857635bf246c176ab463be30b80 \ + 8da548081ac847b158e1264be25bb0910bbc92647108089415d45fab1b3d2604 \ + e8a8eff1ae4020cfa39936b66827b23f371b92200be90251e6d73c5f86de5fd4 \ + a950781933d79a28272b782a2ec313efdfcc0628f43d744c2dc2ff3dcb66999b \ + 50c7ca895b0c64791eeaa5f2949