├── .appveyor.yml ├── .cirrus.yml ├── .gitattributes ├── .github ├── issue_template.md └── workflows │ └── c-cpp.yml ├── .gitignore ├── .travis.yml ├── 3way.cpp ├── 3way.h ├── Doxyfile ├── Filelist.txt ├── GNUmakefile ├── GNUmakefile-cross ├── History.txt ├── Install.txt ├── License.txt ├── Readme.txt ├── Security.md ├── TestData ├── 3desval.dat ├── 3wayval.dat ├── aria.dat ├── camellia.dat ├── cast128v.dat ├── cast256v.dat ├── defdmac1.bin ├── defdmac2.bin ├── descert.dat ├── dh1024.dat ├── dh2048.dat ├── dlie1024.dat ├── dlie2048.dat ├── dsa1024.dat ├── dsa1024b.dat ├── dsa512.dat ├── ecies_p160.dat ├── ecies_t163.dat ├── ed25519.dat ├── ed25519v0.dat ├── ed25519v1.dat ├── elgc1024.dat ├── esig1023.dat ├── esig1536.dat ├── esig2046.dat ├── fhmqv160.dat ├── fhmqv256.dat ├── fhmqv384.dat ├── fhmqv512.dat ├── gostval.dat ├── hmqv160.dat ├── hmqv256.dat ├── hmqv384.dat ├── hmqv512.dat ├── ideaval.dat ├── luc1024.dat ├── luc2048.dat ├── lucc1024.dat ├── lucc512.dat ├── lucd1024.dat ├── lucd512.dat ├── lucs1024.dat ├── lucs512.dat ├── marsval.dat ├── mqv1024.dat ├── mqv2048.dat ├── nr1024.dat ├── nr2048.dat ├── rabi1024.dat ├── rabi2048.dat ├── rc2val.dat ├── rc5val.dat ├── rc6val.dat ├── rijndael.dat ├── rsa1024.dat ├── rsa2048.dat ├── rsa2048a.dat ├── rsa400pb.dat ├── rsa400pv.dat ├── rsa512a.dat ├── rw1024.dat ├── rw2048.dat ├── saferval.dat ├── serpentv.dat ├── shacal2v.dat ├── sharkval.dat ├── skipjack.dat ├── squareva.dat ├── twofishv.dat ├── usage.dat ├── x25519.dat ├── x25519v0.dat ├── x25519v1.dat ├── xtrdh171.dat └── xtrdh342.dat ├── TestPrograms ├── dump2def.cpp ├── test_32bit.cpp ├── test_64bit.cpp ├── test_arm_acle_header.cpp ├── test_arm_aes.cpp ├── test_arm_armv7.cpp ├── test_arm_asimd.cpp ├── test_arm_crc.cpp ├── test_arm_neon.cpp ├── test_arm_neon_header.cpp ├── test_arm_pmull.cpp ├── test_arm_sha1.cpp ├── test_arm_sha256.cpp ├── test_arm_sha3.cpp ├── test_arm_sha512.cpp ├── test_arm_sm3.cpp ├── test_arm_sm4.cpp ├── test_asm_mixed.cpp ├── test_cxx.cpp ├── test_cxx11.cpp ├── test_cxx11_alignas.cpp ├── test_cxx11_alignof.cpp ├── test_cxx11_assert.cpp ├── test_cxx11_atomic.cpp ├── test_cxx11_auto.cpp ├── test_cxx11_constexpr.cpp ├── test_cxx11_deletefn.cpp ├── test_cxx11_enumtype.cpp ├── test_cxx11_initializer.cpp ├── test_cxx11_lambda.cpp ├── test_cxx11_noexcept.cpp ├── test_cxx11_nullptr.cpp ├── test_cxx11_staticinit.cpp ├── test_cxx11_sync.cpp ├── test_cxx11_vartemplates.cpp ├── test_cxx14.cpp ├── test_cxx17.cpp ├── test_cxx17_assert.cpp ├── test_cxx17_exceptions.cpp ├── test_cxx98_exception.cpp ├── test_glibc.cpp ├── test_newlib.cpp ├── test_nodevirtualize.cpp ├── test_ppc_aes.cpp ├── test_ppc_altivec.cpp ├── test_ppc_power7.cpp ├── test_ppc_power8.cpp ├── test_ppc_power9.cpp ├── test_ppc_sha.cpp ├── test_ppc_vmull.cpp ├── test_pthreads.cpp ├── test_x86_aes.cpp ├── test_x86_avx.cpp ├── test_x86_avx2.cpp ├── test_x86_avx512.cpp ├── test_x86_clmul.cpp ├── test_x86_cpuid.cpp ├── test_x86_rdrand.cpp ├── test_x86_rdseed.cpp ├── test_x86_sha.cpp ├── test_x86_sse2.cpp ├── test_x86_sse3.cpp ├── test_x86_sse41.cpp ├── test_x86_sse42.cpp ├── test_x86_ssse3.cpp ├── test_x86_via_aes.cpp ├── test_x86_via_rng.cpp └── test_x86_via_sha.cpp ├── TestScripts ├── change-version.sh ├── configure.sh ├── coverity-linux.txt ├── coverity-macosx.txt ├── coverity-windows.txt ├── cryptdll-windows.cmd ├── cryptest-android-mk.sh ├── cryptest-android.sh ├── cryptest-autotools.sh ├── cryptest-coverage.sh ├── cryptest-coverity.cpp ├── cryptest-ios.sh ├── cryptest-pem.sh ├── cryptest-symbols.sh ├── cryptest-tidy.sh ├── cryptest.sh ├── cryptopp-compiler.cpp ├── governor.sh ├── install-ndk.sh ├── make-benchmarks.sh ├── reset-fork.sh ├── setenv-android.sh ├── setenv-embedded.sh ├── setenv-ios.sh └── setenv-macos.sh ├── TestVectors ├── Readme.txt ├── aead.txt ├── aes.txt ├── all.txt ├── aria.txt ├── blake2.txt ├── blake2b.txt ├── blake2s.txt ├── camellia.txt ├── ccm.txt ├── chacha.txt ├── chacha20poly1305.txt ├── chacha_tls.txt ├── cham.txt ├── cmac.txt ├── dlies.txt ├── dsa.txt ├── dsa_1363.txt ├── dsa_rfc6979.txt ├── eax.txt ├── esign.txt ├── gcm.txt ├── hc128.txt ├── hc256.txt ├── hight.txt ├── hkdf.txt ├── hmac.txt ├── kalyna.txt ├── keccak.txt ├── lea.txt ├── lsh.txt ├── lsh256.txt ├── lsh512.txt ├── lsh512_256.txt ├── mars.txt ├── nr.txt ├── ocb.txt ├── panama.txt ├── poly1305_tls.txt ├── poly1305aes.txt ├── rabbit.txt ├── rsa_oaep.txt ├── rsa_pkcs1_1_5.txt ├── rsa_pss.txt ├── rw.txt ├── salsa.txt ├── seal.txt ├── seed.txt ├── sha.txt ├── sha1_160_fips_180.txt ├── sha1_fips_180.txt ├── sha2.txt ├── sha2_224_fips_180.txt ├── sha2_256_fips_180.txt ├── sha2_384_fips_180.txt ├── sha2_512_fips_180.txt ├── sha2_fips_180.txt ├── sha3.txt ├── sha3_224_fips_202.txt ├── sha3_256_fips_202.txt ├── sha3_384_fips_202.txt ├── sha3_512_fips_202.txt ├── sha3_fips_202.txt ├── shacal2.txt ├── shake.txt ├── simeck.txt ├── simon.txt ├── siphash.txt ├── skipjack.txt ├── sm3.txt ├── sm4.txt ├── sosemanuk.txt ├── speck.txt ├── tea.txt ├── threefish.txt ├── ttmac.txt ├── vmac.txt ├── wake.txt ├── whrlpool.txt ├── xchacha.txt └── xts.txt ├── adhoc.cpp.proto ├── adler32.cpp ├── adler32.h ├── adv_simd.h ├── aes.h ├── aes_armv4.S ├── aes_armv4.h ├── algebra.cpp ├── algebra.h ├── algparam.cpp ├── algparam.h ├── allocate.cpp ├── allocate.h ├── arc4.cpp ├── arc4.h ├── argnames.h ├── aria.cpp ├── aria.h ├── ariatab.cpp ├── arm_simd.h ├── asn.cpp ├── asn.h ├── authenc.cpp ├── authenc.h ├── base32.cpp ├── base32.h ├── base64.cpp ├── base64.h ├── basecode.cpp ├── basecode.h ├── bds10.zip ├── bench.h ├── bench1.cpp ├── bench2.cpp ├── bench3.cpp ├── bfinit.cpp ├── blake2.cpp ├── blake2.h ├── blake2b_simd.cpp ├── blake2s_simd.cpp ├── blowfish.cpp ├── blowfish.h ├── blumshub.cpp ├── blumshub.h ├── camellia.cpp ├── camellia.h ├── cast.cpp ├── cast.h ├── casts.cpp ├── cbcmac.cpp ├── cbcmac.h ├── ccm.cpp ├── ccm.h ├── chacha.cpp ├── chacha.h ├── chacha_avx.cpp ├── chacha_simd.cpp ├── chachapoly.cpp ├── chachapoly.h ├── cham.cpp ├── cham.h ├── cham_simd.cpp ├── channels.cpp ├── channels.h ├── cmac.cpp ├── cmac.h ├── config.h ├── config_align.h ├── config_asm.h ├── config_cpu.h ├── config_cxx.h ├── config_dll.h ├── config_int.h ├── config_misc.h ├── config_ns.h ├── config_os.h ├── config_ver.h ├── cpu.cpp ├── cpu.h ├── cpuid64.asm ├── crc.cpp ├── crc.h ├── crc_simd.cpp ├── cryptdll.vcxproj ├── cryptdll.vcxproj.filters ├── cryptest.nmake ├── cryptest.sln ├── cryptest.vcxproj ├── cryptest.vcxproj.filters ├── cryptest.vcxproj.user ├── cryptlib.cpp ├── cryptlib.h ├── cryptlib.vcxproj ├── cryptlib.vcxproj.filters ├── cryptopp.mapfile ├── cryptopp.rc ├── cryptopp.supp ├── darn.cpp ├── darn.h ├── datatest.cpp ├── default.cpp ├── default.h ├── des.cpp ├── des.h ├── dessp.cpp ├── dh.cpp ├── dh.h ├── dh2.cpp ├── dh2.h ├── dll.cpp ├── dll.h ├── dlltest.cpp ├── dlltest.vcxproj ├── dlltest.vcxproj.filters ├── dmac.h ├── donna.h ├── donna_32.cpp ├── donna_32.h ├── donna_64.cpp ├── donna_64.h ├── donna_sse.cpp ├── donna_sse.h ├── drbg.h ├── dsa.cpp ├── dsa.h ├── eax.cpp ├── eax.h ├── ec2n.cpp ├── ec2n.h ├── eccrypto.cpp ├── eccrypto.h ├── ecp.cpp ├── ecp.h ├── ecpoint.h ├── elgamal.cpp ├── elgamal.h ├── emsa2.cpp ├── emsa2.h ├── eprecomp.cpp ├── eprecomp.h ├── esign.cpp ├── esign.h ├── factory.h ├── fhmqv.h ├── files.cpp ├── files.h ├── filters.cpp ├── filters.h ├── fips140.cpp ├── fips140.h ├── fipsalgt.cpp ├── fipstest.cpp ├── fltrimpl.h ├── gcm.cpp ├── gcm.h ├── gcm_simd.cpp ├── gf256.cpp ├── gf256.h ├── gf2_32.cpp ├── gf2_32.h ├── gf2n.cpp ├── gf2n.h ├── gf2n_simd.cpp ├── gfpcrypt.cpp ├── gfpcrypt.h ├── gost.cpp ├── gost.h ├── gzip.cpp ├── gzip.h ├── hashfwd.h ├── hc128.cpp ├── hc128.h ├── hc256.cpp ├── hc256.h ├── hex.cpp ├── hex.h ├── hight.cpp ├── hight.h ├── hkdf.h ├── hmac.cpp ├── hmac.h ├── hmqv.h ├── hrtimer.cpp ├── hrtimer.h ├── ida.cpp ├── ida.h ├── idea.cpp ├── idea.h ├── integer.cpp ├── integer.h ├── iterhash.cpp ├── iterhash.h ├── kalyna.cpp ├── kalyna.h ├── kalynatab.cpp ├── keccak.cpp ├── keccak.h ├── keccak_core.cpp ├── keccak_simd.cpp ├── lea.cpp ├── lea.h ├── lea_simd.cpp ├── lsh.h ├── lsh256.cpp ├── lsh256_avx.cpp ├── lsh256_sse.cpp ├── lsh512.cpp ├── lsh512_avx.cpp ├── lsh512_sse.cpp ├── lubyrack.h ├── luc.cpp ├── luc.h ├── mars.cpp ├── mars.h ├── marss.cpp ├── md2.cpp ├── md2.h ├── md4.cpp ├── md4.h ├── md5.cpp ├── md5.h ├── mdc.h ├── mersenne.h ├── misc.cpp ├── misc.h ├── modarith.h ├── modes.cpp ├── modes.h ├── modexppc.h ├── mqueue.cpp ├── mqueue.h ├── mqv.cpp ├── mqv.h ├── naclite.h ├── nbtheory.cpp ├── nbtheory.h ├── neon_simd.cpp ├── nr.h ├── oaep.cpp ├── oaep.h ├── oids.h ├── osrng.cpp ├── osrng.h ├── ossig.h ├── padlkrng.cpp ├── padlkrng.h ├── panama.cpp ├── panama.h ├── pch.cpp ├── pch.h ├── pkcspad.cpp ├── pkcspad.h ├── poly1305.cpp ├── poly1305.h ├── polynomi.cpp ├── polynomi.h ├── power7_ppc.cpp ├── power8_ppc.cpp ├── power9_ppc.cpp ├── ppc_simd.cpp ├── ppc_simd.h ├── primetab.cpp ├── pssr.cpp ├── pssr.h ├── pubkey.cpp ├── pubkey.h ├── pwdbased.h ├── queue.cpp ├── queue.h ├── rabbit.cpp ├── rabbit.h ├── rabin.cpp ├── rabin.h ├── randpool.cpp ├── randpool.h ├── rc2.cpp ├── rc2.h ├── rc5.cpp ├── rc5.h ├── rc6.cpp ├── rc6.h ├── rdrand.asm ├── rdrand.cpp ├── rdrand.h ├── rdseed.asm ├── rdtables.cpp ├── regtest1.cpp ├── regtest2.cpp ├── regtest3.cpp ├── regtest4.cpp ├── resource.h ├── rijndael.cpp ├── rijndael.h ├── rijndael_simd.cpp ├── ripemd.cpp ├── ripemd.h ├── rng.cpp ├── rng.h ├── rsa.cpp ├── rsa.h ├── rw.cpp ├── rw.h ├── safer.cpp ├── safer.h ├── salsa.cpp ├── salsa.h ├── scrypt.cpp ├── scrypt.h ├── seal.cpp ├── seal.h ├── secblock.h ├── secblockfwd.h ├── seckey.h ├── seed.cpp ├── seed.h ├── serpent.cpp ├── serpent.h ├── serpentp.h ├── sha.cpp ├── sha.h ├── sha1_armv4.S ├── sha1_armv4.h ├── sha256_armv4.S ├── sha256_armv4.h ├── sha3.cpp ├── sha3.h ├── sha512_armv4.S ├── sha512_armv4.h ├── sha_simd.cpp ├── shacal2.cpp ├── shacal2.h ├── shacal2_simd.cpp ├── shake.cpp ├── shake.h ├── shark.cpp ├── shark.h ├── sharkbox.cpp ├── simeck.cpp ├── simeck.h ├── simon.cpp ├── simon.h ├── simon128_simd.cpp ├── simple.cpp ├── simple.h ├── siphash.h ├── skipjack.cpp ├── skipjack.h ├── sm3.cpp ├── sm3.h ├── sm4.cpp ├── sm4.h ├── sm4_simd.cpp ├── smartptr.h ├── sosemanuk.cpp ├── sosemanuk.h ├── speck.cpp ├── speck.h ├── speck128_simd.cpp ├── square.cpp ├── square.h ├── squaretb.cpp ├── sse_simd.cpp ├── stdcpp.h ├── strciphr.cpp ├── strciphr.h ├── tea.cpp ├── tea.h ├── test.cpp ├── tftables.cpp ├── threefish.cpp ├── threefish.h ├── tiger.cpp ├── tiger.h ├── tigertab.cpp ├── trap.h ├── trunhash.h ├── ttmac.cpp ├── ttmac.h ├── tweetnacl.cpp ├── tweetnacl.h ├── twofish.cpp ├── twofish.h ├── validat0.cpp ├── validat1.cpp ├── validat10.cpp ├── validat2.cpp ├── validat3.cpp ├── validat4.cpp ├── validat5.cpp ├── validat6.cpp ├── validat7.cpp ├── validat8.cpp ├── validat9.cpp ├── validate.h ├── vc60.zip ├── vmac.cpp ├── vmac.h ├── vs2005.zip ├── wake.cpp ├── wake.h ├── whrlpool.cpp ├── whrlpool.h ├── words.h ├── x64dll.asm ├── x64masm.asm ├── xed25519.cpp ├── xed25519.h ├── xtr.cpp ├── xtr.h ├── xtrcrypt.cpp ├── xtrcrypt.h ├── xts.cpp ├── xts.h ├── zdeflate.cpp ├── zdeflate.h ├── zinflate.cpp ├── zinflate.h ├── zlib.cpp └── zlib.h /.appveyor.yml: -------------------------------------------------------------------------------- 1 | # Appveyor's documentation is at https://www.appveyor.com/docs/build-phase/, 2 | # and a sample configuration file is at https://www.appveyor.com/docs/appveyor-yml/. 3 | # I have to admit its a bit complex and I don't fully understand it. 4 | 5 | version: 1.0.{build} 6 | clone_depth: 5 7 | skip_tags: true 8 | 9 | configuration: 10 | 11 | - Debug 12 | - Release 13 | 14 | platform: 15 | 16 | - Win32 17 | - x64 18 | 19 | image: 20 | 21 | - Visual Studio 2022 22 | - Visual Studio 2019 23 | - Visual Studio 2017 24 | - Visual Studio 2015 25 | - Visual Studio 2013 26 | 27 | environment: 28 | 29 | matrix: 30 | 31 | - BUILD_MODE: MSBuild 32 | 33 | # Disable build through solution file 34 | build: off 35 | 36 | # Build through commands in script below 37 | test_script: 38 | 39 | - ps: >- 40 | 41 | msbuild /t:Build /p:platform="$env:platform" /p:configuration="$env:configuration" cryptlib.vcxproj 42 | 43 | msbuild /t:Build /p:platform="$env:platform" /p:configuration="$env:configuration" cryptest.vcxproj 44 | 45 | msbuild /t:CopyCryptestToRoot cryptest.vcxproj 46 | 47 | .\cryptest.exe v 48 | 49 | .\cryptest.exe tv all 50 | 51 | notifications: 52 | - provider: Email 53 | to: 54 | - cryptopp-build@googlegroups.com 55 | on_build_success: true 56 | on_build_failure: true 57 | -------------------------------------------------------------------------------- /.cirrus.yml: -------------------------------------------------------------------------------- 1 | # https://cirrus-ci.org/examples/ 2 | # https://github.com/curl/curl/blob/master/.cirrus.yml 3 | 4 | # FreeBSD seems to have constant version problems, which requires IGNORE_OSVERSION. 5 | 6 | env: 7 | CIRRUS_CLONE_DEPTH: 5 8 | IGNORE_OSVERSION: yes 9 | 10 | task: 11 | matrix: 12 | - name: Debug build, FreeBSD 13.2 13 | freebsd_instance: 14 | image_family: freebsd-13-2 15 | pkginstall_script: 16 | - pkg update -f 17 | - pkg install -y gmake 18 | configure_script: 19 | compile_script: 20 | - CXXFLAGS="-DDEBUG -g3 -O0" gmake -j 3 21 | test_script: 22 | - ./cryptest.exe v 23 | - ./cryptest.exe tv all 24 | - name: Release build, FreeBSD 13.2 25 | freebsd_instance: 26 | image_family: freebsd-13-2 27 | pkginstall_script: 28 | - pkg update -f 29 | - pkg install -y gmake 30 | configure_script: 31 | compile_script: 32 | - gmake -j 3 33 | test_script: 34 | - ./cryptest.exe v 35 | - ./cryptest.exe tv all 36 | - name: Debug build, FreeBSD 14.0 (snap) 37 | freebsd_instance: 38 | image_family: freebsd-14-0-snap 39 | pkginstall_script: 40 | - pkg update -f 41 | - pkg install -y gmake 42 | configure_script: 43 | compile_script: 44 | - CXXFLAGS="-DDEBUG -g3 -O0" gmake -j 3 45 | test_script: 46 | - ./cryptest.exe v 47 | - ./cryptest.exe tv all 48 | - name: Release build, FreeBSD 14.0 (snap) 49 | freebsd_instance: 50 | image_family: freebsd-14-0-snap 51 | pkginstall_script: 52 | - pkg update -f 53 | - pkg install -y gmake 54 | configure_script: 55 | compile_script: 56 | - gmake -j 3 57 | test_script: 58 | - ./cryptest.exe v 59 | - ./cryptest.exe tv all 60 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh eol=lf 2 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | ### Crypto++ Issue Report 2 | 3 | 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. 4 | 5 | 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. 6 | 7 | Please do not ask questions about unsupported build systems, like Autotools, CMake, Conan and NuGet. They are other people's projects. We don't know anything about them. 8 | 9 | Please do not ask questions at Stack Overflow. We do not patrol Stack Overflow. We will not be able to answer your question. 10 | 11 | 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: 12 | 13 | * State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) 14 | * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc) 15 | * State how you built the library (Visual Studio, Makefile, distro provided, etc) 16 | * Show a typical command line (the output of the compiler for cryptlib.cpp) 17 | * Show the link command (the output of the linker for libcryptopp.so or cryptest.exe) 18 | * Show the exact error message you are receiving (copy and paste it); or 19 | * Clearly state the undesired behavior (and state the expected behavior) 20 | -------------------------------------------------------------------------------- /.github/workflows/c-cpp.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: make 17 | run: make all 18 | - name: make test 19 | run: make test 20 | -------------------------------------------------------------------------------- /3way.h: -------------------------------------------------------------------------------- 1 | // 3way.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file 3way.h 4 | /// \brief Classes for the 3-Way block cipher 5 | 6 | #ifndef CRYPTOPP_THREEWAY_H 7 | #define CRYPTOPP_THREEWAY_H 8 | 9 | #include "config.h" 10 | #include "seckey.h" 11 | #include "secblock.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief ThreeWay block cipher information 16 | struct ThreeWay_Info : public FixedBlockSize<12>, public FixedKeyLength<12>, public VariableRounds<11> 17 | { 18 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "3-Way";} 19 | }; 20 | 21 | /// \brief ThreeWay block cipher 22 | /// \sa 3-Way 23 | class ThreeWay : public ThreeWay_Info, public BlockCipherDocumentation 24 | { 25 | /// \brief Class specific implementation and overrides used to operate the cipher. 26 | /// \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions 27 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 28 | { 29 | public: 30 | void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); 31 | 32 | protected: 33 | unsigned int m_rounds; 34 | FixedSizeSecBlock m_k; 35 | }; 36 | 37 | /// \brief Class specific methods used to operate the cipher in the forward direction. 38 | /// \details Implementations and overrides in \p Enc apply to \p ENCRYPTION. 39 | class CRYPTOPP_NO_VTABLE Enc : public Base 40 | { 41 | public: 42 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 43 | }; 44 | 45 | /// \brief Class specific methods used to operate the cipher in the reverse direction. 46 | /// \details Implementations and overrides in \p Dec apply to \p DECRYPTION. 47 | class CRYPTOPP_NO_VTABLE Dec : public Base 48 | { 49 | public: 50 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 51 | }; 52 | 53 | public: 54 | typedef BlockCipherFinal Encryption; 55 | typedef BlockCipherFinal Decryption; 56 | }; 57 | 58 | typedef ThreeWay::Encryption ThreeWayEncryption; 59 | typedef ThreeWay::Decryption ThreeWayDecryption; 60 | 61 | NAMESPACE_END 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /Security.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | We support modern versions of the Crypto++ library. Modern versions include the tip of Master and the latest release. 6 | 7 | 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. 8 | 9 | ## Reporting a Vulnerability 10 | 11 | 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). 12 | 13 | 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. 14 | 15 | 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. 16 | -------------------------------------------------------------------------------- /TestData/3desval.dat: -------------------------------------------------------------------------------- 1 | 0123456789abcdeffedcba9876543210 0123456789abcde7 7f1d0a77826b8aff 2 | 0123456789abcdeffedcba987654321089abcdef01234567 0123456789abcde7 de0b7c06ae5e0ed5 3 | 0123456789ABCDEF01010101010101011011121314151617 94DBE082549A14EF 9011121314151617 4 | -------------------------------------------------------------------------------- /TestData/3wayval.dat: -------------------------------------------------------------------------------- 1 | 000000000000000000000000 000000010000000100000001 4059c76e83ae9dc4ad21ecf7 2 | 000000060000000500000004 000000030000000200000001 d2f05b5ed6144138cab920cd 3 | def01234456789abbcdef012 234567899abcdef001234567 0aa55dbb9cdddb6d7cdb76b2 4 | d2f05b5ed6144138cab920cd 4059c76e83ae9dc4ad21ecf7 478ea8716b13f17c15b155ed 5 | 6 | -------------------------------------------------------------------------------- /TestData/cast128v.dat: -------------------------------------------------------------------------------- 1 | 01 23 45 67 12 34 56 78 23 45 67 89 34 56 78 9A 2 | 01 23 45 67 89 AB CD EF 3 | 23 8B 4F E5 84 7E 44 B2 4 | 5 | 01 23 45 67 12 34 56 78 23 45 6 | 01 23 45 67 89 AB CD EF 7 | EB 6A 71 1A 2C 02 27 1B 8 | 9 | 01 23 45 67 12 10 | 01 23 45 67 89 AB CD EF 11 | 7A C8 16 D1 6E 9B 30 2E 12 | -------------------------------------------------------------------------------- /TestData/cast256v.dat: -------------------------------------------------------------------------------- 1 | 2342bb9efa38542c0af75647f29f615d 2 | 00000000000000000000000000000000 3 | c842a08972b43d20836c91d1b7530f6b 4 | 5 | 2342bb9efa38542cbed0ac83940ac298bac77a7717942863 6 | 00000000000000000000000000000000 7 | 1b386c0210dcadcbdd0e41aa08a7a7e8 8 | 9 | 2342bb9efa38542cbed0ac83940ac2988d7c47ce264908461cc1b5137ae6b604 10 | 00000000000000000000000000000000 11 | 4f6a2038286897b9c9870136553317fa 12 | -------------------------------------------------------------------------------- /TestData/defdmac1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noloader/cryptopp/1e20219ecddc64cf23e04f5cb990c49e1b0074c3/TestData/defdmac1.bin -------------------------------------------------------------------------------- /TestData/defdmac2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noloader/cryptopp/1e20219ecddc64cf23e04f5cb990c49e1b0074c3/TestData/defdmac2.bin -------------------------------------------------------------------------------- /TestData/dh1024.dat: -------------------------------------------------------------------------------- 1 | 30818702818100DA9A18547FF03B385CC16508C173A7EF4EB61CB40EF8FEF3B31F145051676166BCDC3FE6B799FC394D08C26385F9413F896E09117E46209D6923602683CEA100924A6EE695281775C619DAA94EA8CB3691B4275B0183F1D39639EBC92995FE645D6C1BC28D409E585549BBD2C5DCDD6C208B04EADD8B7A6D997F72CBAD88390F020102 2 | -------------------------------------------------------------------------------- /TestData/dh2048.dat: -------------------------------------------------------------------------------- 1 | 308201080282010100EB60DBD494AAFBCD2EAC6A36DB8E7DD4A2A64512A5BBB15B9BFB581C7C1CAFB647D4612973C3770C2166D75EEA695F67EA8261557591DB78BCF5A886AA5294F3AEE4D25B57C8EE8C7FE8DBF70C132CD7FFCB6F89426F807F552C5DAE2FB1F329E340094E4B30D8EF6265AB4D350E9837B151C86AC524DE4E1FC04746C668BE318275E420D51AEDDFBDF887D435CDEEF6AC81293DB45287132F8236A43AD8F4D6642D7CA6732DA06A1DE008259008C9D74403B68ADAC788CF8AB5BEFFC310DCCCD32901D1F290E5B7A993D2CF6A652AF81B6DA0FD2E70678D1AE086150E41444522F20621195AD2A1F0975652B4AF7DE5261A9FD46B9EA8B443641F3BBA695B9B020103 2 | -------------------------------------------------------------------------------- /TestData/dlie1024.dat: -------------------------------------------------------------------------------- 1 | 308201370201003082011706072A8648CE3804013082010A02818100D4EC6B7A18416519C76766726B3D2D5F054D107B30E97691B15EB0DCDF452B77F10E12C14450AB107BE349C2DF3A2DBD9D844A24ABA21B328D568E8EC6B959E70BADE5C49879AE4447F643360523469B55AFDC459B45634F657AA79918772F2BA9508ACD43C95C16650A1251B8173EBA1B9B59FE8C57F6240EA49A4FE8855CEF0281806A7635BD0C20B28CE3B3B339359E96AF82A6883D9874BB48D8AF586E6FA295BBF8870960A22855883DF1A4E16F9D16DECEC2251255D10D9946AB4747635CACF385D6F2E24C3CD72223FB219B0291A34DAAD7EE22CDA2B1A7B2BD53CC8C3B9795D4A84566A1E4AE0B32850928DC0B9F5D0DCDACFF462BFB1207524D27F442AE77020102041702150C9C14EEFA749DCE9A2A4B7065768767BA48BBB62F 2 | -------------------------------------------------------------------------------- /TestData/dlie2048.dat: -------------------------------------------------------------------------------- 1 | 308202410201003082021906072A8648CE3804013082020C0282010100A8E87254E7F56CB5857786364ACC39F2A0F79FFF8ED6C62C64EE45FC1C775CDDBFD9CBCEF8262DBD2CECE4E5AFECA239B9B4B7D3CBA228366500F5B2203CA6C0CB0AB6698F73921B4831BA598DFA8268A07368A64774C77808AB7CB7978F839304B10567F8C9C34F8DBDB66BB928EDE6327773AA6C20A8F4E9C2AE0C66A0516E057BBC87760CF39270726F1863260CD5ADDAF366318E7029851A6F85B2349DF29629319A3662354DBCAD0789D02AC6BD804C06523900166501041963BD7EFFE0069694A54F4542172A29B1F09D26E3F052AE5274A898058BE549650BC2066DDFDB84D582E6503AF42BCB2B674F2A2A77C54678FD622FFCA2D9718BF8B0525AEF028201005474392A73FAB65AC2BBC31B25661CF9507BCFFFC76B6316327722FE0E3BAE6EDFECE5E77C1316DE96767272D7F6511CDCDA5BE9E5D1141B32807AD9101E536065855B34C7B9C90DA418DD2CC6FD41345039B45323BA63BC0455BE5BCBC7C1C9825882B3FC64E1A7C6DEDB35DC9476F3193BB9D53610547A74E15706335028B702BDDE43BB0679C93839378C3193066AD6ED79B318C73814C28D37C2D91A4EF94B1498CD1B311AA6DE5683C4E815635EC02603291C800B3280820CB1DEBF7FF0034B4A52A7A2A10B9514D8F84E9371F82957293A544C02C5F2A4B285E10336EFEDC26AC173281D7A15E595B3A795153BE2A33C7EB117FE516CB8C5FC58292D77020102041F021D031D7EC405D3E11D031B7B66DF9EFFCC5173B9B1639E4EC920731484EE 2 | -------------------------------------------------------------------------------- /TestData/dsa1024.dat: -------------------------------------------------------------------------------- 1 | 3082014A0201003082012B06072A8648CE3804013082011E02818100F468699A6F6EBCC0120D3B34C8E007F125EC7D81F763B8D0F33869AE3BD6B9F2ECCC7DF34DF84C0307449E9B85D30D57194BCCEB310F48141914DD13A077AAF9B624A6CBE666BBA1D7EBEA95B5BA6F54417FD5D4E4220C601E071D316A24EA814E8B0122DBF47EE8AEEFD319EBB01DD95683F10DBB4FEB023F8262A07EAEB7FD02150082AD4E034DA6EEACDFDAE68C36F2BAD614F9E53B02818071AAF73361A26081529F7D84078ADAFCA48E031DB54AD57FB1A833ADBD8672328AABAA0C756247998D7A5B10DACA359D231332CE8120B483A784FE07D46EEBFF0D7D374A10691F78653E6DC29E27CCB1B174923960DFE5B959B919B2C3816C19251832AFD8E35D810E598F82877ABF7D40A041565168BD7F0E21E3FE2A8D8C1C0416021426EBA66E846E755169F84A1DA981D86502405DDF 2 | -------------------------------------------------------------------------------- /TestData/dsa1024b.dat: -------------------------------------------------------------------------------- 1 | 308201B73082012B06072A8648CE3804013082011E02818100F468699A6F6EBCC0120D3B34C8E007F125EC7D81F763B8D0F33869AE3BD6B9F2ECCC7DF34DF84C0307449E9B85D30D57194BCCEB310F48141914DD13A077AAF9B624A6CBE666BBA1D7EBEA95B5BA6F54417FD5D4E4220C601E071D316A24EA814E8B0122DBF47EE8AEEFD319EBB01DD95683F10DBB4FEB023F8262A07EAEB7FD02150082AD4E034DA6EEACDFDAE68C36F2BAD614F9E53B02818071AAF73361A26081529F7D84078ADAFCA48E031DB54AD57FB1A833ADBD8672328AABAA0C756247998D7A5B10DACA359D231332CE8120B483A784FE07D46EEBFF0D7D374A10691F78653E6DC29E27CCB1B174923960DFE5B959B919B2C3816C19251832AFD8E35D810E598F82877ABF7D40A041565168BD7F0E21E3FE2A8D8C1C0381850002818100D30312B7179661DA4691EDE39A71CB961199CD792C50AED6EA7E1A24C53590B6BCD92F26509D3372B2849A17C99C0962FBE4A2606CA37E6DF10244805363450FFAA24A7C274DF0B5D24AE7F31A8319FD2AA6E98AC6E7E3364E7AEDE575A9993609B0DFA387084141EA0B5B2D59B6DE718C0DAB4F86BC59F0DBE8602AED933494 2 | -------------------------------------------------------------------------------- /TestData/dsa512.dat: -------------------------------------------------------------------------------- 1 | 3081C60201003081A806072A8648CE38040130819C0241008DF2A494492276AA3D25759BB06869CBEAC0D83AFB8D0CF7CBB8324F0D7882E5D0762FC5B7210EAFC2E9ADAC32AB7AAC49693DFBF83724C2EC0736EE31C80291021500C773218C737EC8EE993B4F2DED30F48EDACE915F0240626D027839EA0A13413163A55B4CB500299D5522956CEFCB3BFF10F399CE2C2E71CB9DE5FA24BABF58E5B79521925C9CC42E9F6F464B088CC572AF53E6D78802041602142070B3223DBA372FDE1C0FFC7B2E3B498B260614 2 | -------------------------------------------------------------------------------- /TestData/ecies_p160.dat: -------------------------------------------------------------------------------- 1 | 3081C80201003081A406072A8648CE3D0201308198020101302006072A8648CE3D0101021500FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF302C0414FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC04141C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA450429044A96B5688EF573284664698968C38BB913CBFC8223A628553168947D59DCC912042351377AC5FB3202150100000000000000000001F4C8F927AED3CA752257020101041C301A02010104150023A68821ABB99DBB8429ED2320D61A8EA4C6D81B 2 | -------------------------------------------------------------------------------- /TestData/ecies_t163.dat: -------------------------------------------------------------------------------- 1 | 3081D10201003081AD06072A8648CE3D02013081A1020101302506072A8648CE3D0102301A020200A306092A8648CE3D010203033009020103020106020107302E041507B6882CAAEFA84F9554FF8428BD88E246D2782AE204150713612DCDDCB40AAB946BDA29CA91F73AF958AFD9042B040369979697AB43897789566789567F787A7876A65400435EDB42EFAFB2989D51FEFCE3C80988F41FF883021503FFFFFFFFFFFFFFFFFFFF48AAB689C29CA710279B020102041C301A02010104150003693AB4D83EE8B544548BE7647AEA0EA64E8211 2 | -------------------------------------------------------------------------------- /TestData/ed25519.dat: -------------------------------------------------------------------------------- 1 | 302E020100300506032B65700422042098C59D3F097FB23D44BA90791281B453258D691A55AF5CE4F1EE712FDF91AE6D -------------------------------------------------------------------------------- /TestData/ed25519v0.dat: -------------------------------------------------------------------------------- 1 | 302E020100300506032B65700422042030BF776A497D7F1E0E26AC4FB03F5BE7E187DDFEFB914CD292A6FEDB7F70CE6B -------------------------------------------------------------------------------- /TestData/ed25519v1.dat: -------------------------------------------------------------------------------- 1 | 3053020101300506032B6570042204206861FD53C7643DABDCDF4C3969CE44A156BAC261242A5AAEC140EDE510071C6CA12303210029CF90E6C1CF1ADC7105720303B2EE303412D2B682C6FEEF3D8736A286B2E27F -------------------------------------------------------------------------------- /TestData/elgc1024.dat: -------------------------------------------------------------------------------- 1 | 308201360201003082011606062B0E070201013082010A02818100D18892CC35AD9E532C53810019E525CDE08882E6344D6787C366B171D68948F53D74F7923B148E0A0B4C9B956D695384DE24AC3034000B3C4AD4C8226470BBD88B5B053BCCB01E608B1352D6ED16324745253BDB204308E065368CB9D75ACDB290E671BD4CA1608500BFACD758E6E9EFAC8CCBAD83BE7E397A62E4F55634FC3B02818068C449661AD6CF299629C0800CF292E6F04441731A26B3C3E1B358B8EB44A47A9EBA7BC91D8A470505A64DCAB6B4A9C26F1256181A00059E256A641132385DEC45AD829DE6580F304589A96B768B1923A2929DED90218470329B465CEBAD66D9487338DEA650B042805FD66BAC7374F7D64665D6C1DF3F1CBD31727AAB1A7E1D0201030417021504ED7AED68B1A5EFDE11262210D9F1121D4A119CE8 -------------------------------------------------------------------------------- /TestData/esig1023.dat: -------------------------------------------------------------------------------- 1 | 3081E00281807040653BA4FCD5C66E3318B31E82654C5A62957F68D2EE6AE10BD6678D7A14EEF8EBF0C85F28FE22056C12B2A2DD4E9C897EB2FF06D57DB03B872C049ED2806DC3E4D86F2947D134065AC642F233F95FBCB55C533274FA91FFDC0CEB9E71B8795B71A977C7956001FC19E28DE18A80B20E4AE8F775B952CEEA0DEFEAE8E93D7F020120022B1EC74E9FC5EEA090E8DDF4BDB64861C7DC3F8EC7E64286EC2FE39DA55B4763C582DB48146521BDEF0146D5022B1E559EB15755298408E4E4C6F4791BF075C7A8C9B3C7F5B7FA3E8C322BA0A160C09A9DB6BBC4974BE0F877 2 | -------------------------------------------------------------------------------- /TestData/esig1536.dat: -------------------------------------------------------------------------------- 1 | 3082014D0281C100E2A6788AB3CC986AEC06C51690143D3677141645D0628165EE924B9AFB7E6EDD52D90145B2F6031522C7A6CEC05E358F42B7837DACEA589F868F8DCA1C0F5FD8E5EDB8BBBAFCFF6D64CFCFBE68F46FBA6EFF45BC9D0CBB4F7F6075F5FFC2049C2F304B51C417764E18D182926E02D4116CE5C5C010E3D0AA6872A49B0D1FF4B37D54689C31F5821D04E9D4DB34D7536EE7F88B8C481B0EC1F93193A0B70567E6FD76E9FAC4F67BB47DACD356D0C8015261E068DDF8C34C0CAFCF3FA775577FEB020120024100FAF0F292EE96D4F449024F86C0A104E0633C722586EC00AD33E0234629825D2081BA337597889CAC55DC6BEBDD8F13FE3AA2133D6371601A37D195DA7BC45EF3024100EBE16F88887A425AA08E271467CC2220DC44012AB24ED4FF3512A96E8CB600C8BBCB771459FF0EE63D4B6786952A83A7143A775073F0A1D69B6D0B5817755673 2 | -------------------------------------------------------------------------------- /TestData/esig2046.dat: -------------------------------------------------------------------------------- 1 | 308201B70282010028B1F9CDF87EF6D74F3AC2EA83C17CE376215FB2B3B4817145F1A137FB86B0F7BF0F9BA1BDCF7CC15DF1884DD1B150A983279B90F7A1E4392CB3C16390771DA5668E68621C3898DF66BD254F3787ECFB64B3435E707D5C237A6C09F407D8CD618CC3BBFBAB3DEBA38A0D1A88B2A4E09AE32FF2064EF1896348D5B83047EC2E079D85662EED4A66FBB9C159A617EE3C333BAED66989740F54C3CB336C0EF71130786E70648F2698F4F4192DA06C1578FDB065F8E320EFB63049E4BA664F215924B3E89F69131C5987F357C54593BE173A7AED2D37BE69F90CB574EF83AD49145EB15950FADE9E848DA83BC2CACBEDCAFC4A3B31BFFBBFC4DD03B8E47A218A51410201200256033F9C3F8BDDC021503A687BEC90438F38FF9C0E4C050DD95E46BACA370F478B843611A94BC37B5E838AABFD4ECCCE757BAC967DF8A7DD219B3A71A4DA64D54AB367622B7EB9B4282E898755F02036E91D2A12C81F41025603DB3DE2AE2B52889148C98D68F2B7606B0E5112E60E6A6FF5FD98E5D74143C000B43BEC77082F17C1EF4C82127010B12438D498AAFE8521E21EE6391627D464B54D1BE31F57FFF18C27EC38F08093EA65139A61A2C1 2 | -------------------------------------------------------------------------------- /TestData/fhmqv160.dat: -------------------------------------------------------------------------------- 1 | 3081E0020101302C06072A8648CE3D0101022100FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF30440420FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC04205AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B0441046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5022100FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551020101 -------------------------------------------------------------------------------- /TestData/fhmqv256.dat: -------------------------------------------------------------------------------- 1 | 3081E0020101302C06072A8648CE3D0101022100FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF30440420FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC04205AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B0441046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5022100FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551020101 -------------------------------------------------------------------------------- /TestData/fhmqv384.dat: -------------------------------------------------------------------------------- 1 | 30820140020101303C06072A8648CE3D0101023100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF30640430FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC0430B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF046104AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB73617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F023100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973020101 -------------------------------------------------------------------------------- /TestData/fhmqv512.dat: -------------------------------------------------------------------------------- 1 | 308201AC020101304D06072A8648CE3D0101024201FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF308188044201FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC04420051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F000481850400C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650024201FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409020101 -------------------------------------------------------------------------------- /TestData/gostval.dat: -------------------------------------------------------------------------------- 1 | BE5EC2006CFF9DCF52354959F1FF0CBFE95061B5A648C10387069C25997C0672 2 | 0DF82802B741A292 07F9027DF7F7DF89 3 | 4 | B385272AC8D72A5A8B344BC80363AC4D09BF58F41F540624CBCB8FDCF55307D7 5 | 1354EE9C0A11CD4C 4FB50536F960A7B1 6 | 7 | AEE02F609A35660E4097E546FD3026B032CD107C7D459977ADF489BEF2652262 8 | 6693D492C4B0CC39 670034AC0FA811B5 9 | 10 | 320E9D8422165D58911DFC7D8BBB1F81B0ECD924023BF94D9DF7DCF7801240E0 11 | 99E2D13080928D79 8118FF9D3B3CFE7D 12 | 13 | C9F703BBBFC63691BFA3B7B87EA8FD5E8E8EF384EF733F1A61AEF68C8FFA265F 14 | D1E787749C72814C A083826A790D3E0C 15 | 16 | 728FEE32F04B4C654AD7F607D71C660C2C2670D7C999713233149A1C0C17A1F0 17 | D4C05323A4F7A7B5 4D1F2E6B0D9DE2CE 18 | 19 | 35FC96402209500FCFDEF5352D1ABB038FE33FC0D9D58512E56370B22BAA133B 20 | 8742D9A05F6A3AF6 2F3BB84879D11E52 21 | 22 | D416F630BE65B7FE150656183370E07018234EE5DA3D89C4CE9152A03E5BFB77 23 | F86506DA04E41CB8 96F0A5C77A04F5CE 24 | -------------------------------------------------------------------------------- /TestData/hmqv160.dat: -------------------------------------------------------------------------------- 1 | 3081E0020101302C06072A8648CE3D0101022100FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF30440420FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC04205AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B0441046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5022100FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551020101 -------------------------------------------------------------------------------- /TestData/hmqv256.dat: -------------------------------------------------------------------------------- 1 | 3081E0020101302C06072A8648CE3D0101022100FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF30440420FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC04205AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B0441046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5022100FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551020101 -------------------------------------------------------------------------------- /TestData/hmqv384.dat: -------------------------------------------------------------------------------- 1 | 30820140020101303C06072A8648CE3D0101023100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF30640430FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC0430B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF046104AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB73617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F023100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973020101 -------------------------------------------------------------------------------- /TestData/hmqv512.dat: -------------------------------------------------------------------------------- 1 | 308201AC020101304D06072A8648CE3D0101024201FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF308188044201FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC04420051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F000481850400C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650024201FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409020101 -------------------------------------------------------------------------------- /TestData/ideaval.dat: -------------------------------------------------------------------------------- 1 | 00010002000300040005000600070008 0000000100020003 11FBED2B01986DE5 2 | 00010002000300040005000600070008 0102030405060708 540E5FEA18C2F8B1 3 | 00010002000300040005000600070008 0019324B647D96AF 9F0A0AB6E10CED78 4 | 00010002000300040005000600070008 F5202D5B9C671B08 CF18FD7355E2C5C5 5 | 00010002000300040005000600070008 FAE6D2BEAA96826E 85DF52005608193D 6 | 00010002000300040005000600070008 0A141E28323C4650 2F7DE750212FB734 7 | 00010002000300040005000600070008 050A0F14191E2328 7B7314925DE59C09 8 | 0005000A000F00140019001E00230028 0102030405060708 3EC04780BEFF6E20 9 | 3A984E2000195DB32EE501C8C47CEA60 0102030405060708 97BCD8200780DA86 10 | 006400C8012C019001F4025802BC0320 05320A6414C819FA 65BE87E7A2538AED 11 | 9D4075C103BC322AFB03E7BE6AB30006 0808080808080808 F5DB1AC45E5EF9F9 12 | -------------------------------------------------------------------------------- /TestData/luc1024.dat: -------------------------------------------------------------------------------- 1 | 3082015202010002818100B7FE59813AF3A5DA48144EF03E5D229E3CFB55B0E3CEB63F9F973AC8655651409C3B36BBBE83698516F42A2E0FDC87DD83541697249D67FB5A91FA73470089C4997667811283CF22C74856F1E71129DB70FB23620A60E532B7931B7F93C0B9AA6B9D60E87529002BF2204B743773F501F6C370D067C7B22F6AD9DC07E8097347020111024100CFEA6177386C04D1668C984C39A7F889B36BB2B3BED2C7B83241D267F8D2038529AEB56D82CDE43264168873375C8D1F0897666CCC3F617C2F6B52E5143303C7024100E28BAB645993166EE1A984967AE8839EA41685F1E6392DBEB83EE6CA85A54396505DBD4E5C9024BAFCF27AD24D571DC6A3795CE7F0432669BCE742AF8FAF1481024078C6F402C266595B4F85098370528C2C0309BE93F6C45FC049F6AD987471A979FE215CC41455AA85F5A5B664F59E2F8E33C97C211698D14AD05FC65044F99510 2 | -------------------------------------------------------------------------------- /TestData/luc2048.dat: -------------------------------------------------------------------------------- 1 | 308202960201000282010100EF8E1C8C8FB330A26C2449F1A50F7BD457D131C66D3194ECA20CE06138CC95CBE32E1DF910E13FF2D74823363286E3461E4BA3037EA32D4728F262C2364692E5948B8577F651292D72EF42445C2AAF11A526D2235DCE172A6E762EB86178BB5B4A06B8736567DB1525C8BDEB7242C81CC9090F5EF7CFC193FABEA3E5B5407E7DFDDF2D557487C65302148969F28DEC68AC3166FD52D44F1DE2EA74451A4BA0508F09E2F4AB85D89E7D68EEE4E8F9BD5A4858BAE8BF36E3A31FF06DDECDD40AE70932ECD09B65617B3208FF203EFBB0D822CDC1887EF343EBECBB762FA9C5D9F9339C80C96D6F3D8E4F7298FF6C94581C3CBC21C8CA94015F2E48400C0556B70502011102818100FDAD5D856662FC0284BEEF8470DC328B3B853F5819F037EBC786EB0225FD5C45B5BF99073F6E6CE31E4D1BC31105A4BAABA3BEC3C28F40E5912E7D3D6E6BE6178164E52F615C65FED1AE61D9D8F858282AF3C59C25A650A9CA72DD2105D95219CFEFEDDEB067647FDBABB659FBF2FF82F33C1A3A8BA73FB5F3D0C5509DFD38FF02818100F1BFA4A7A9506E020F9A57019F4326AE3D974DE9CCEF9BCA284B313DE287378411BDF1C9A1859D9165604EFF2EB1C9A685C0B317A08CF50E5F45AF570EE2C79B35BEA60B38109B4A450E87811CB10D6873F50726248055FE645C5C74FD0482F22CB541D77ED93F8B44CA72C9F550331C516BD061816325F9EF543C4995832BFB0281805184D4DC8796329003CF0EDC79048A12C4C78A1F44D8DE37A5939776A4E19CAA1ADBC4B78BE72EF23F1A5EFFF7377439138ED19D166285D1325CE6C2A7CFA182BDD7B82B2AB63A041C80B17A4D78161C240EDB2D6A494BEB27D28168E02DAE83C50C01EE8384E31111B756DA9B5423A6817F9078E8A750D0DE2CE62CF223601D 2 | -------------------------------------------------------------------------------- /TestData/lucc1024.dat: -------------------------------------------------------------------------------- 1 | 3082013F0201003082011706072A8648CE3804013082010A02818100E16B572E39DB4D90689753D09CEA97B9CAE9C0AF04203AE5BC7FC985B85D5BB50B1EDEA30CAAD003B455640FEEA79E342F3E8CFF6761051B38D6931A2B0FD0DF8E2210E7DA74CAC5DC1A79D80CD8C0F9FC09D81BAEC94E2F3663F25B0140DF6B3D5AD04CBA27BCF24A92963319FB992E39544370FD28642FE07EB17EDA4D47B902818070B5AB971CEDA6C8344BA9E84E754BDCE574E05782101D72DE3FE4C2DC2EADDA858F6F5186556801DA2AB207F753CF1A179F467FB3B0828D9C6B498D1587E86FC7110873ED3A6562EE0D3CEC066C607CFE04EC0DD764A7179B31F92D80A06FB59EAD68265D13DE7925494B198CFDCC971CAA21B87E943217F03F58BF6D26A3DD020107041F021D03BDAFBB087B5A628730212217B01F15B303A0133D6AF4FC3CAF7286A8 2 | -------------------------------------------------------------------------------- /TestData/lucc512.dat: -------------------------------------------------------------------------------- 1 | 3081B302010030819406072A8648CE380401308188024100B89A4AD4826B8FDDBFE3A6C0F5C8F805B7093AFF9BB2BD697C7D113C236BAC99ABF69000E169575CA2A2DDCDD1C7D9D06C63DCCC880121D933DCF598DD85C52102405C4D256A4135C7EEDFF1D3607AE47C02DB849D7FCDD95EB4BE3E889E11B5D64CD5FB480070B4ABAE51516EE6E8E3ECE83631EE66440090EC99EE7ACC6EC2E291020107041702150268EA4C567B18D0E35B1DA9D517CE5D359CD06779 2 | -------------------------------------------------------------------------------- /TestData/lucd1024.dat: -------------------------------------------------------------------------------- 1 | 30818702818100EE9C91E2C1D8B0AB999B3F32B3115A36AA95A36B23CC8507D2340FA21EAAF6F6EB 2 | 1B900839CD9F8AFBFC155467F91FD8917DD46EAC55A266B246DFFFEDDDA79D674F77884D34709DB3 3 | 452C2C1E2578CCC0CCA91C504039C52762F23F2A391A58B2CAD2DB05666DDF5B9E3C1AC33DB487B7 4 | 70C82B7E7DCDEE4381562FCEE427FD02010A 5 | -------------------------------------------------------------------------------- /TestData/lucd512.dat: -------------------------------------------------------------------------------- 1 | 3046024100C339D027E5812ED5D9DE044F3697D0273625E5EA9EC4EF3FB89ADBFA9CD1FBF4D8C0EC 2 | 1118C44609F499EF644EEAECE2F38B3F67FAC81A075F31A60B5757A87D020109 3 | -------------------------------------------------------------------------------- /TestData/lucs1024.dat: -------------------------------------------------------------------------------- 1 | 3082015B0201003082013306072A8648CE3804013082012602818100D57B7B758DC8041CE6CFC57DFE0AAA33FC8FEC48BEEA37562AD13359236FFFF6EED3CEB3A7BBC4269A384ED9A296160F12BC666066548E28201CE293B1791F951C8D2C5965696D82B336EFADCF1E0D619EDA43DBB86415BF3EE6F721C0AB17E770EA7B2360A054D3E4E878647245FCF87B2335098303004CDDC2B9DCDA57DB51021D034E48F160EC5855CCCD9F995988AD1B554AD1B591E64283E91A07D151028180017324ADC1F93CF002FA2B0619C60F897CDED488E457685625E1565377483C0FA4A7FD1CAE848C727E76654434CE3CCAF81EC6E6AAA156EEBBEA095F642FD0DA2D043996ACC14A1B1A6110B19C094638E29890B89AF5812E97C5F96F33B1FD7415079947994442295CA34447807662FB70621F069A98AE274D01B2777BF4E97E041F021D00F9F02A2BC1930F1AC93198F3D532BC937941D7C9A1E16F0EB932476E 2 | -------------------------------------------------------------------------------- /TestData/lucs512.dat: -------------------------------------------------------------------------------- 1 | 3081C70201003081A806072A8648CE38040130819C024100E64283E91A07D10F557B7B758DC8041CE6CFC57DFE0AAA33FC8FEC48BEEA37562AD13359236FFFF6EED3FB921690D2FD1339F8E1DD406EED70D7EE3085E3AADD02150F4E48F160EC5855CCCD9F995988AD1B554AD1B5F3024062503DFB092F0FD0D8BBD90B50A834A6BD5B0995BCFC1CC8C8C83103AA6837F3FBFF3E042E1B25E36963DB2FCFD7AD24A6626E65A1F6EECBB399F5CE73659F29041702150450A037413E9A711E601318AF21D32A498C0C501E 2 | -------------------------------------------------------------------------------- /TestData/marsval.dat: -------------------------------------------------------------------------------- 1 | 00000000000000000000000000000000 00000000000000000000000000000000 DCC07B8DFB0738D6E30A22DFCF27E886 2 | 00000000000000000000000000000000 DCC07B8DFB0738D6E30A22DFCF27E886 33CAFFBDDC7F1DDA0F9C15FA2F30E2FF 3 | CB14A1776ABBC1CDAFE7243DEF2CEA02 F94512A9B42D034EC4792204D708A69B 225DA2CB64B73F79069F21A5E3CB8522 4 | 86EDF4DA31824CABEF6A4637C40B0BAB 4DF955AD5B398D66408D620A2B27E1A9 A4B737340AE6D2CAFD930BA97D86129F 5 | 000000000000000000000000000000000000000000000000 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 97778747D60E425C2B4202599DB856FB 6 | D158860838874D9500000000000000000000000000000000 93A953A82C10411DD158860838874D95 4FA0E5F64893131712F01408D233E9F7 7 | 791739A58B04581A93A953A82C10411DD158860838874D95 6761C42D3E6142D2A84FBFADB383158F F706BC0FD97E28B6F1AF4E17D8755FFF 8 | 0000000000000000000000000000000000000000000000000000000000000000 62E45B4CF3477F1DD65063729D9ABA8F 0F4B897EA014D21FBC20F1054A42F719 9 | FBA167983E7AEF22317CE28C02AAE1A3E8E5CC3CEDBEA82A99DBC39AD65E7227 1344ABA4D3C44708A8A72116D4F49384 458335D95EA42A9F4DCCD41AECC2390D 10 | -------------------------------------------------------------------------------- /TestData/mqv1024.dat: -------------------------------------------------------------------------------- 1 | 3082011E028181009A21FC66469293103CEF66960B17880F905C738DB692B7481922FC2D454D14067C6BFC158B93FCC1B8D128D4D86D893082F8A3592238EE8B693B6245F26F55968D7D13752D6BFBA271E8E36E11482815D887BB9F6B600E820E7E2AF2EE6ECDBC1CB35B12A4EF48A8907C090482DE7D49B751BB3A50F78BE29506114BC85D3A6102150C896422EC558A74B883BA85E2F10D4A58F28D2B09028180350C4BB19C0A9B224E5E1BACCC1B1952A97628021B4673831C851C3280F06D3EFA73DAE27E5D4E4A0499E0B2B9A369649E883A1F260EF250B5CCF3E3C922332B210EEA07D3BF92210BA7A7374A30DDDE3D1B3D575B77CD36B001EAE4A2A3BFAFF12FCE74F3330B30ACF6DCFF580ECBFB5B00FD5DD2B8EA9DB09C7E1C7100BD67 2 | -------------------------------------------------------------------------------- /TestData/mqv2048.dat: -------------------------------------------------------------------------------- 1 | 308202280282010100A5C07CE5BF0894C0BA8752F4D9A6D0BF6556D325B618A655CCFE3EEC85B56D47DBDF5A9A5C8588AE6F4C44BBCB339E869A21BE057A243DC797B912C547FBA359C4FC9965C72278370AB6C0DD246197A8D83A08C69425786482D1744C41FBB3C36BEA5963C05B0778AAEF9230C3E2E12072268038E5ADB6433542F94D8C25A6A1785E4D2D97AF119F2139E69AECA46F11B344785A0B1B280CF8D678AB9627780271A350A9B15B92E105F14733C5F15C1753F7C48A645FAAAC1BFA266B5AD6F7C46350465DA31150ABB10FF63FD6C01C849DFCD5645C5D1AF8B967372449DF90D02177E12439BD36A1EED1FAEDB8166927F755B71A5368CC27CD00AB5CF04601E7021D03134944D9AA15697107F48AC5621A1531649AD5EE8EEC1D1F282B5481028201003468652FBB1E3C7F2FBB99A89EA14FB9205F534943034CDE9D9CC57A790D9713EC7B21032EAA8ED2B24FFABD612EDADFC9265964C753AE276380294D4D16C63389A4C392A0058EF1549F6C0D13C4A09759C67650A51F7362B38C61AF2942A6004BB8C3CD4C489E66DE1567E2306821788A519727CD27945DBC5778AC6E8B1DFC05573D76DF9E9AA4F1CE657A2A07BEF833091614C0A6065507BD51099C54148327903626DE6D01FEC9A7F5F9A901C90E219D452C2E2A90AA2303A52776EF174CC85C1AA4F28924B1DFF3E3C5538D820A422374DCFB0D14D620AE282A72416C6506F02D3ED1E6208F66B9DB49294D8D605D7D146BB6A970211289B1BE7AB12531 2 | -------------------------------------------------------------------------------- /TestData/nr1024.dat: -------------------------------------------------------------------------------- 1 | 3082014C0201003082012C06072A8648CE3804013082011F02818100F89F4EBE58E222B517D218D615BDC00611501CD18417886BD3FCBD22578C4611B1E8C06EB0FE9D473A5589BC277AA58C1979DC2869B728D78EC38B4C044A790A60314E7BD3DFDC0BBD8B770A9271D7D048F3E13C73866D096C7304782125847C70EDD721B36F1C379CF7CCEE0A728DD66336ED5F93E8A1BD3EDB22C8761EB987021526A578AB11C3A0812A636D24D120BE544B7973E4D302818100BF927ACE4D175A44622494E37F9552E97B74303321FFEF9B76CDECB14F7D612608DDFEA77C04A8FCACCF7F16CB01AE05AD5EDB65C3B9A380D720F34C7D96C8817E2EFF7D0049EE149DF61C52D7C80271206155CDAEBC8A7F4A8DCE5196E3C18FD5EDF11A394C43A5D59BC65D976817438CA0A7F01713548F61355E976DE75E1E04170215247B2531CFF01D1B1665F0CFD2A836446798353330 2 | -------------------------------------------------------------------------------- /TestData/nr2048.dat: -------------------------------------------------------------------------------- 1 | 3082025D0201003082023506072A8648CE38040130820228028201010083C69F32A1F3A67B201D7A92BA204281681DAAD29F50BD866D70A2E01438653B18602AFE606AA925389381682EC0E2CE5D5D366793917879860799ECEDDB4831ED4A4E76D9C34FFDD0BC786588F00E8A19705B997C4298F9CAF9AEE46E0A5677AA1240DC141BD78A8720A829F64C912FA3D961ADE698C5344F18FE4CE70CF7B94F45258C6A9553830FFB80B6BB7E1C510D4526C1904C1D6E2F1B8C1CA6499DBD291438717131804FA2F5F42E5C06293D6DA493C88A38EBC6A6DCF40B2BAB0BF7C7FA0F9C070F1C48FD12CA2B7337E9C58EB9AFDAC6FEEAB0BD62415B26D405D6BF47F11D70B1740BC398A76BE70723A829082EB548D35F4D78E4E015DAD12D5B021D083118E4DC11622CB53E7E4D7634BFBDE45A2D8F8B097A251803505315028201005BAC6CBFE089F75274A532564735786477478F19BE099AB38E0F843393D6D81964CBCFF4B68C5DA2614F06BB844672288F0A65216954990051BA691CA6796AFAAE91A79350F53D9DF3CC688387306EFFDCEF70A14A672E2103B8C861523703157D05DF6EB42DCD81506C88300ED8D8ED40D41AB6D669D309C976B84D82C8D18747578358CBA1EF4B00118B0DEEF11409DD8CB0D83399A33E10C18249574FA2242AE4241CD789C891FEC1C63771EE4517274493240EDAAC44AEDC42F318A5122B052244DFA9A282B8D94BC4BAB360D44E4D0204F8D28817B5B6F808047C92032AA94926D697CFA2FC211FAAE26A5F1FC2B1EB03DA68AD5E01EAC489FB64A66EA3041F021D042ADA16929DA18A7A3C8FDCDD8FC46A6D8AAB79FF33D60E2BF09DEF4F 2 | -------------------------------------------------------------------------------- /TestData/rabi1024.dat: -------------------------------------------------------------------------------- 1 | 3082015202818100D132EDB1360E31D7B8DD84BB03111FDE0243FFE4031ED12B440E7FF36A634E57772EC81FFDC065607494717C6E16A5AB642283553442CC22569535C7A20E3D1C3E2B3747B26E9856D4A13D0325DC116DAAF8554B000321A753E5CFA730CA60F3E3FE2CA9750C6734A2A113AD4A76B6DAC5E199AB55F34CE6984BF56F6DFAC51D020105020102024100F90CBF726FA70ACB5074BD8E79932B74E9949057B627ABB29F41E5057AE699A03BC240EBB9637E956ABC0B6A20F633F78168A908086E2011FC5D030B9B94B51B024100D7097ACACD8BF8ED641A7D8A17A23F8FB385B92B760EEEB9A1233E1D25892F742315DE23DA0751F24EAE4C0C5B696D0AA0D16EAE94194193DC89D479A9626A2702403B5475CD2A7F519EF08433407826D89983C104AF1E74B44B79B31770149D224089300F828E0DF4CBC864BDB394C0F32CCF055F7B2B8872BF0B5F148020637B9C 2 | -------------------------------------------------------------------------------- /TestData/rabi2048.dat: -------------------------------------------------------------------------------- 1 | 308202970282010100B8F2A74040753A7706CB98B80DD9EE33FB7969FCA65A2025E96853267AEF80ABB184FE463B9475F5166307FAFA988F6CA4BBC7122E9555755191AA408BAF4464221394342104ED2762EEA4FED8B5CDB4234442AB979A487446AB37C4A4FD67C259EB942E28B50DD54F3AA14447931821291D4C21BB8BD58C41302F3E1D2E6FF84F84AACEC02196282C492E0354985A66EBA50B1903EDF70D98BD9837E694876505760C58C186F0B5F6500711500297956C9825EBDCCF90633239484F9A3572271D3CD585BFC195BED0D5FFCABE785B25BFF6ACFF2B7C125D54B26CFEF60B1B077B2F953960DAEB57F102B6A1E30AA88B643090BC4D8971077C1B54EA61E4E45102011302010D02818100D02603BBFDB55F1063DFCEBB4CA32F551330E0F2901D87DF2A395EF6AF340F6352CE3514FCE85705652DC6BD401CD0D5D13855B124DA172D5183A7474B85B683AA03382775F3D8DC600F33E696246F9F2134E2DA061923F47B85A923EBB375B07DE3B43EE4FD71D3E24B4B416DAE6E4C2B6D32A9B45BF04296AECAD60C33DA0702818100E3773B5D8B828BEA922392100C54CDF41D0CD26B4C34A64F483B7975AB35920DA0E3F6AE238E72E26F8A498D9AD0C4A75C52F25421E1E2E3865ADD1A0FCEA4DE932DBE6EBEFA689494855B11714B960F57C5102C0E8876D253ABA8C2D6A511DBC0F30589A0FBE66AD6BCEFDFC4F67F8347726A52736274B7F744ECACFF6198E702818100BF84B25DB607930F80ED57C7AF89E7604B7E8E0D341C9C4A0C94FFE6D4B38810553B1E92F7BF9651D3D0149A9188E1FFD1FB86753A327ABC6169AF92271E7204A2C76488FBC781984BA99C3C48C8A799054DA34A201743C3064B4609831B35FBA2B8B1BC67FFD0C685DBA92FE688AD51D1F161C06EC0B9E0D0E187863BFBBEC0 2 | -------------------------------------------------------------------------------- /TestData/rc2val.dat: -------------------------------------------------------------------------------- 1 | 08 2 | 3F 3 | 00000000 00000000 4 | 00000000 00000000 5 | ebb773f9 93278eff 6 | 7 | 08 8 | 40 9 | ffffffff ffffffff 10 | ffffffff ffffffff 11 | 278b27e4 2e2f0d49 12 | 13 | 08 14 | 40 15 | 30000000 00000000 16 | 10000000 00000001 17 | 30649edf 9be7d2c2 18 | 19 | 01 20 | 40 21 | 88 22 | 00000000 00000000 23 | 61a8a244 adacccf0 24 | 25 | 07 26 | 40 27 | 88bca90e 90875a 28 | 00000000 00000000 29 | 6ccf4308 974c267f 30 | 31 | 10 32 | 40 33 | 88bca90e 90875a7f 0f79c384 627bafb2 34 | 00000000 00000000 35 | 1a807d27 2bbe5db1 36 | 37 | 10 38 | 80 39 | 88bca90e 90875a7f 0f79c384 627bafb2 40 | 00000000 00000000 41 | 2269552a b0f85ca6 42 | 43 | 21 44 | 81 45 | 88bca90e 90875a7f 0f79c384 627bafb2 16f80a6f 85920584 46 | c42fceb0 be255daf 1e 47 | 00000000 00000000 48 | 5b78d3a4 3dfff1f1 49 | -------------------------------------------------------------------------------- /TestData/rc5val.dat: -------------------------------------------------------------------------------- 1 | 00000000000000000000000000000000 0000000000000000 21A5DBEE154B8F6D 2 | 915F4619BE41B2516355A50110A9CE91 21A5DBEE154B8F6D F7C013AC5B2B8952 3 | 783348E75AEB0F2FD7B169BB8DC16787 F7C013AC5B2B8952 2F42B3B70369FC92 4 | DC49DB1375A5584F6485B413B5F12BAF 2F42B3B70369FC92 65C178B284D197CC 5 | 5269F149D41BA0152497574D7F153125 65C178B284D197CC EB44E415DA319824 6 | -------------------------------------------------------------------------------- /TestData/rc6val.dat: -------------------------------------------------------------------------------- 1 | 00000000000000000000000000000000 2 | 00000000000000000000000000000000 8FC3A53656B1F778C129DF4E9848A41E 3 | 4 | 0123456789ABCDEF0112233445566778 5 | 02132435465768798A9BACBDCEDFE0F1 524E192F4715C6231F51F6367EA43F18 6 | 7 | 000000000000000000000000000000000000000000000000 8 | 00000000000000000000000000000000 6cd61bcb190b30384e8a3f168690ae82 9 | 10 | 0123456789abcdef0112233445566778899aabbccddeeff0 11 | 02132435465768798a9bacbdcedfe0f1 688329d019e505041e52e92af95291d4 12 | 13 | 0000000000000000000000000000000000000000000000000000000000000000 14 | 00000000000000000000000000000000 8f5fbd0510d15fa893fa3fda6e857ec2 15 | 16 | 0123456789abcdef0112233445566778899aabbccddeeff01032547698badcfe 17 | 02132435465768798a9bacbdcedfe0f1 c8241816f0d7e48920ad16a1674e5d48 18 | -------------------------------------------------------------------------------- /TestData/rijndael.dat: -------------------------------------------------------------------------------- 1 | 000102030405060708090A0B0C0D0E0F 000102030405060708090A0B0C0D0E0F 0A940BB5416EF045F1C39458C653EA5A 2 | 00010203050607080A0B0C0D0F101112 506812A45F08C889B97F5980038B8359 D8F532538289EF7D06B506A4FD5BE9C9 3 | 14151617191A1B1C1E1F202123242526 5C6D71CA30DE8B8B00549984D2EC7D4B 59AB30F4D4EE6E4FF9907EF65B1FB68C 4 | 28292A2B2D2E2F30323334353738393A 53F3F4C64F8616E4E7C56199F48F21F6 BF1ED2FCB2AF3FD41443B56D85025CB1 5 | 00010203050607080A0B0C0D0F10111214151617191A1B1C 2D33EEF2C0430A8A9EBF45E809C40BB6 DFF4945E0336DF4C1C56BC700EFF837F 6 | 1E1F20212324252628292A2B2D2E2F30323334353738393A 6AA375D1FA155A61FB72353E0A5A8756 B6FDDEF4752765E347D5D2DC196D1252 7 | 3C3D3E3F41424344464748494B4C4D4E5051525355565758 BC3736518B9490DCB8ED60EB26758ED4 D23684E3D963B3AFCF1A114ACA90CBD6 8 | 00010203050607080A0B0C0D0F10111214151617191A1B1C1E1F202123242526 834EADFCCAC7E1B30664B1ABA44815AB 1946DABF6A03A2A2C3D0B05080AED6FC 9 | 28292A2B2D2E2F30323334353738393A3C3D3E3F41424344464748494B4C4D4E D9DC4DBA3021B05D67C0518F72B62BF1 5ED301D747D3CC715445EBDEC62F2FB4 10 | -------------------------------------------------------------------------------- /TestData/rsa1024.dat: -------------------------------------------------------------------------------- 1 | 30820274020100300D06092A864886F70D010101 2 | 05000482025E3082025A02010002818100A39D4F 3 | 72D1BCFF65A47545C2897C0464CE9181E8703421 4 | 2EC04407C4C24D569AA20C58B8138C85E17510BC 5 | 6B861CADA9034C3ECE3B050B546E97D2BDC07A07 6 | CF8A612F7D3646739633041893EF18C411264E45 7 | C9E033A1BD5EE5FA02D95E9A9ADA2D0C6DF480E3 8 | 2FA3FCE02889798455CE53F084AAB4C5549266F7 9 | CE8C77DF1D0201110281800E6FC33ED64561D443 10 | 378627C0D63C9F7BA36D584622B7A23E241ECD98 11 | AC78952C6A804C7A320BD020EAE372E62FB4F853 12 | 1D50D5F6261796823A929845B06A19B35A5227CB 13 | C819852A9CBE588CC2D1CEE07F426D13C2BF2FCA 14 | 1C99FDEEFDFE387859E2B3F654E85A71481A71E9 15 | D5256583B1200F29C1AA0F437CFDC2AEAF218102 16 | 4100D5DDB104AD074F6C1B8192D9AC8AED4DE05C 17 | F5C6509490DA8CCFC91FDF7B3A1323E03894DCAA 18 | B2587716D652A56904F86244E10C1B8FA597C389 19 | 2591C55DBD65024100C3D930B583B8AD9A349218 20 | 795C988CF0004F09DA04FFEF6FDF7CB4FA654F74 21 | B262521FE185693CD6290A337589F62CDEECE24E 22 | CCB5E79865275540F3B603FB59024064A48F89BA 23 | D6437E2B0FCCA2AB8CABE86995285D5318BCA315 24 | 167CC3B47639726B3C56DCA41417B128FBB026E4 25 | 6DA7FC6A7AC441EEDA2FCEF29AE480D5594A1102 26 | 40228FBD4D355CD35772B05EAC014818DF0F1D01 27 | BD0FF0EE04AEF7E3B3B7867E015CA514AF53C746 28 | F89DD49FAB5494DABDED9159332F28DEA8705A56 29 | C198974A79024100D1DCA40FBD19036F0E2A9438 30 | 7D03C090DDF0A677CDE0B8634A81F247752A355E 31 | C1CEA2482A4887767145C2BA703C9C10228FDA1E 32 | BB2EBEA73D23AA9C34182179 33 | -------------------------------------------------------------------------------- /TestData/rsa400pb.dat: -------------------------------------------------------------------------------- 1 | 30 4c 30 0d 06 09 2a 86 2 | 48 86 f7 0d 01 01 01 05 3 | 00 03 3b 00 30 38 02 33 4 | 00 a3 07 9a 90 df 0d fd 5 | 72 ac 09 0c cc 2a 78 b8 6 | 74 13 13 3e 40 75 9c 98 7 | fa f8 20 4f 35 8a 0b 26 8 | 3c 67 70 e7 83 a9 3b 69 9 | 71 b7 37 79 d2 71 7b e8 10 | 34 77 cf 02 01 03 11 | -------------------------------------------------------------------------------- /TestData/rsa400pv.dat: -------------------------------------------------------------------------------- 1 | 30 81 fb 2 | 02 01 00 3 | 02 4 | 33 00 a3 07 9a 90 df 0d 5 | fd 72 ac 09 0c cc 2a 78 6 | b8 74 13 13 3e 40 75 9c 7 | 98 fa f8 20 4f 35 8a 0b 8 | 26 3c 67 70 e7 83 a9 3b 9 | 69 71 b7 37 79 d2 71 7b 10 | e8 34 77 cf 11 | 02 01 03 12 | 02 13 | 32 6c af bc 60 94 b3 fe 14 | 4c 72 b0 b3 32 c6 fb 25 15 | a2 b7 62 29 80 4e 68 65 16 | fc a4 5a 74 df 0f 8f b8 17 | 41 3b 52 c0 d0 e5 3d 9b 18 | 59 0f f1 9b e7 9f 49 dd 19 | 21 e5 eb 20 | 02 1a 00 cf 20 21 | 35 02 8b 9d 86 98 40 b4 22 | 16 66 b4 2e 92 ea 0d a3 23 | b4 32 04 b5 cf ce 91 24 | 02 25 | 1a 00 c9 7f b1 f0 27 f4 26 | 53 f6 34 12 33 ea aa d1 27 | d9 35 3f 6c 42 d0 88 66 28 | b1 d0 5f 29 | 02 1a 00 8a 15 30 | 78 ac 5d 13 af 10 2b 22 31 | b9 99 cd 74 61 f1 5e 6d 32 | 22 cc 03 23 df df 0b 33 | 02 34 | 1a 00 86 55 21 4a c5 4d 35 | 8d 4e cd 61 77 f1 c7 36 36 | 90 ce 2a 48 2c 8b 05 99 37 | cb e0 3f 38 | 02 1a 00 83 ef 39 | ef b8 a9 a4 0d 1d b6 ed 40 | 98 ad 84 ed 13 35 dc c1 41 | 08 f3 22 d0 57 cf 8d 42 | -------------------------------------------------------------------------------- /TestData/rsa512a.dat: -------------------------------------------------------------------------------- 1 | 30 82 01 50 2 | 02 01 00 3 | 30 0d 4 | 06 09 5 | 2a 86 48 86 f7 0d 01 01 01 6 | 05 00 7 | 04 82 01 3a 8 | 30 82 01 36 9 | 02 01 00 10 | 02 40 11 | 0a 66 79 1d c6 98 81 68 de 7a b7 74 19 bb 7f b0 12 | c0 01 c6 27 10 27 00 75 14 29 42 e1 9a 8d 8c 51 13 | d0 53 b3 e3 78 2a 1d e5 dc 5a f4 eb e9 94 68 17 14 | 01 14 a1 df e6 7c dc 9a 9a f5 5d 65 56 20 bb ab 15 | 02 03 01 00 01 16 | 02 40 17 | 01 23 c5 b6 1b a3 6e db 1d 36 79 90 41 99 a8 9e 18 | a8 0c 09 b9 12 2e 14 00 c0 9a dc f7 78 46 76 d0 19 | 1d 23 35 6a 7d 44 d6 bd 8b d5 0e 94 bf c7 23 fa 20 | 87 d8 86 2b 75 17 76 91 c1 1d 75 76 92 df 88 81 21 | 02 20 22 | 33 d4 84 45 c8 59 e5 23 40 de 70 4b cd da 06 5f 23 | bb 40 58 d7 40 bd 1d 67 d2 9e 9c 14 6c 11 cf 61 24 | 02 20 25 | 33 5e 84 08 86 6b 0f d3 8d c7 00 2d 3f 97 2c 67 26 | 38 9a 65 d5 d8 30 65 66 d5 c4 f2 a5 aa 52 62 8b 27 | 02 20 28 | 04 5e c9 00 71 52 53 25 d3 d4 6d b7 96 95 e9 af 29 | ac c4 52 39 64 36 0e 02 b1 19 ba a3 66 31 62 41 30 | 02 20 31 | 15 eb 32 73 60 c7 b6 0d 12 e5 e2 d1 6b dc d9 79 32 | 81 d1 7f ba 6b 70 db 13 b2 0b 43 6e 24 ea da 59 33 | 02 20 34 | 2c a6 36 6d 72 78 1d fa 24 d3 4a 9a 24 cb c2 ae 35 | 92 7a 99 58 af 42 65 63 ff 63 fb 11 65 8a 46 1d 36 | -------------------------------------------------------------------------------- /TestData/rw1024.dat: -------------------------------------------------------------------------------- 1 | 3082014D02818100BECF1F40456801F6965E603BEBB61F530F0B17BBCB00E3A8866EB9BC84AE3892A4CB040280F568FC650B1734014CA78A200D5E4AB394CBB75C0034DCC47643E6F576A39F850C5F4528048165B084C82E9BA6BA4CFBCB3980F1EB47EC2C348EF52A6225A85AF743DFCEF5CD4583EB0B9C0DA77ABEBEB5BCC513D81BD768B579AD024100F06CA9C1FBE20EE2440F3AB2F9A9787D820943EAF59B6B8D103CFAB1C2F595DDC99D05DC73F9D1DB780B6F8B26CF87E58EB870DD983A2515600DF80C3EBB7B1B024100CB2B9BDEB0D508E21E646C86D836442FC16910D68C8D1D18BB1327899A506C16C1162E93EA7C2CB576B750AEAB152255D5AB22632025CFFAD927A070CBAEA2D7024100C90A853BEC7C25D773FDDB95C11CEF9BB3F487953773F07E42DB9D011325AE2725663478FB7F0EC1A5608280D9656BF3B9F463FF8B23F1CA1B543508D51826E2 2 | -------------------------------------------------------------------------------- /TestData/rw2048.dat: -------------------------------------------------------------------------------- 1 | 3082029002820101008F2975B4DA54179A6C81764DB9E6B50AD925C91568DFE2C245DF9103AF39370BD5F25CD26BF6E41B6FEB0E24473BBFAE89343BC20743057B056BD2189C01258650567A3EC24040EED7EEAF94B77BDD39529807D1FCF5FF4A90E6B42BA58FF1FDCDACF981C641B8F077ABBB41BEFD53CCABF06745CD009A7F9DFAA61ED03F11466E4B5370DFA18C7DFEA1689B60F98012CDE9131FE86F74BFC6B93AC449DA73A2366EA2AE2233AFFBFF0CDE1899B1F852C179639B31CEE11991AA8D46DB5067B0C5FFB3D913612668F0C43CA134B11875F271C0BC8722AF4AD6CC93A43CE165EF31C1EB542ECC7CA1A38BFDF66F3A2175E4EA7159E168FFE3A549535B90C7BBDD02818100C5CEBA84E8B7C20BAA6F450000803F15C1160EB7E0875EBBC15F11DC7E3CAFE55973234FF4C74589406D2950B0C236ABE1B5A5B70D55C035F45D87AF089847C0E2A2DEF23EA4CC19FB5419DF43577523248BEF80B94C59F7342C717F12DE68FEEADAD97BA2DD436834D8559D0A7A31D6F9D9480F852C285EFC75BCA8AF32590302818100B947440D272629155C2B3E0E62B76124281155F7A189650D36C8F7D742F7DBC571ADDCC582ED2ED283C2E8A1CD8C996D3D8A50F33C56581285C5016A16DEDA533715DF519CAB7777F3DCB9F5335552F315B44FF8126DFDDF60B66850AA8FD108ED3A248D18E7473D7967F0F15C740C67476A75273DA254AE5C7B94FB059DD19F0281801EE99173837363981E0988DE22B2E36BFC9713EDC8454BF1CB764D767DFDA985B9DBAA346C0C39B1A9F83D849502AFDD80AE33F588C114BC4DE5FA949125FF56908F8C66CDFF6BF601F1CBF463B0C807DEABB1290C358FC0433ED74EBA074CB211C4D75538ED017F497C9722D8C3D3E082BB4A8A92D5768B5D5963BBDB1DB24D 2 | -------------------------------------------------------------------------------- /TestData/saferval.dat: -------------------------------------------------------------------------------- 1 | 0000000000000000 0000000000000000 032808C90EE7AB7F 2 | 0000000000000000 0102030405060708 7D28038633B92EB4 3 | 0102030405060708 1011121314151617 71E5CF7F083A59C5 4 | 0102030405060708 18191A1B1C1D1E1F 356F702CC7FA8161 5 | 08070605040302010807060504030201 5051525354555657 38E64DBF6E0F896E 6 | 08070605040302010807060504030201 58595A5B5C5D5E5F 7D8F014A902480FE 7 | 01020304050607080807060504030201 6061626364656667 113511C22E7936DF 8 | 01020304050607080807060504030201 68696A6B6C6D6E6F 9EEB2D17C0581437 9 | 0000000000000001 7071727374757677 9ABE2C85BE2D7614 10 | 0000000000000001 78797A7B7C7D7E7F EBC4A9C6C25CF215 11 | 0102030405060708 8081828384858687 54E72BA2D744C566 12 | 0102030405060708 88898A8B8C8D8E8F 57F55D0F7EB6F8FE 13 | 00000000000000010000000000000001 9091929394959697 9EAA4DF1E0EFF445 14 | 00000000000000010000000000000001 98999A9B9C9D9E9F 4CC14838399E532D 15 | 01020304050607080000000000000000 A0A1A2A3A4A5A6A7 41246B65F1DC6AFA 16 | 00000000000000000102030405060708 A0A1A2A3A4A5A6A7 5CBD77B03626FE3B 17 | -------------------------------------------------------------------------------- /TestData/serpentv.dat: -------------------------------------------------------------------------------- 1 | 00000000000000000000000000000000 d29d576fcea3a3a7ed9099f29273d78e b2288b968ae8b08648d1ce9606fd992d 2 | 00000000000000000000000000000000 d29d576fcea3a3a7ed9099f26d8c2871 563a8403ff5309d62370b1dcf5a11edd 3 | ffeeddccbbaa99887766554433221100 1032547698badcfeefcdab8967452301 d5baa00a4bb9d8a7c981c8dc90d89d92 4 | ffeeddccbbaa99887766554433221100 145f0b8b663176b95dcab7e9dcd5cc24 1032547698badcfeefcdab8967452301 5 | 80000000000000000000000000000000 00000000000000000000000000000000 264E5481EFF42A4606ABDA06C0BFDA3D 6 | 000000000000000000000000000000000000000000000000 d29d576fceaba3a7ed9899f2927bd78e 130e353e1037c22405e8faefb2c3c3e9 7 | 8899aabbccddeeffffeeddccbbaa99887766554433221100 1032547698badcfeefcdab8967452301 da860842b720802bf404a4c71034879a 8 | 8899aabbccddeeffffeeddccbbaa99887766554433221100 b2696bd0d98c17953e4239225d27202c 1032547698badcfeefcdab8967452301 9 | 000102030405060708090A0B0C0D0E0F1011121314151617 4528CACCB954D450655E8CFD71CBFAC7 00112233445566778899AABBCCDDEEFF 10 | 0000000000000000000000000000000000000000000000000000000000000000 92074732d84e1841a013a0034c52bf50 81c4eb7b8ad9a8d0f2aa5d7bd626b560 11 | 00112233445566778899aabbccddeeffffeeddccbbaa99887766554433221100 1032547698badcfeefcdab8967452301 93df9a3cafe387bd999eebe393a17fca 12 | 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F 3DA46FFA6F4D6F30CD258333E5A61369 00112233445566778899AABBCCDDEEFF 13 | -------------------------------------------------------------------------------- /TestData/sharkval.dat: -------------------------------------------------------------------------------- 1 | 00000000000000000000000000000000 0000000000000000 214BCF4E7716420A 2 | 000102030405060708090A0B0C0D0E0F 0000000000000000 C76C696289898137 3 | 000102030405060708090A0B0C0D0E0F C76C696289898137 077A4A59FAEEEA4D 4 | 915F4619BE41B2516355A50110A9CE91 21A5DBEE154B8F6D 6FF33B98F448E95A 5 | 783348E75AEB0F2FD7B169BB8DC16787 F7C013AC5B2B8952 E5E554ABE9CED2D2 6 | DC49DB1375A5584F6485B413B5F12BAF 2F42B3B70369FC92 9AE068313F343A7A 7 | 5269F149D41BA0152497574D7F153125 65C178B284D197CC D3F111A282F17F29 8 | -------------------------------------------------------------------------------- /TestData/skipjack.dat: -------------------------------------------------------------------------------- 1 | 11223344556677889900 aabbccdd00112233 00d3127ae2ca8725 2 | -------------------------------------------------------------------------------- /TestData/squareva.dat: -------------------------------------------------------------------------------- 1 | 00000000000000000000000000000000 00000000000000000000000000000000 3C00428F8ABBC0B84F057CC19C26F8CF 2 | 000102030405060708090A0B0C0D0E0F 00000000000000000000000000000000 FF596FA668BFC3014200AE01E2BBA0A0 3 | 000102030405060708090A0B0C0D0E0F 000102030405060708090A0B0C0D0E0F 7C3491D94994E70F0EC2E7A5CCB5A14F 4 | 000102030405060708090A0B0C0D0E0F C76C696289898137077A4A59FAEEEA4D 88C6FF4B92604C6E66656B02DDAF9F40 5 | 915F4619BE41B2516355A50110A9CE91 21A5DBEE154B8F6D6FF33B98F448E95A 3388801F66E7FCC0BCE522A23A4F0C7F 6 | 783348E75AEB0F2FD7B169BB8DC16787 F7C013AC5B2B8952E5E554ABE9CED2D2 A1C0E9215141343DEC2B556942C92BDE 7 | DC49DB1375A5584F6485B413B5F12BAF 2F42B3B70369FC929AE068313F343A7A 3FBE6811B998CDF3E50ABDE2F3C075E3 8 | 5269F149D41BA0152497574D7F153125 65C178B284D197CCD3F111A282F17F29 D7B7209E0879744C782809B6D2E0B1B0 9 | -------------------------------------------------------------------------------- /TestData/twofishv.dat: -------------------------------------------------------------------------------- 1 | 00000000000000000000000000000000 00000000000000000000000000000000 9F589F5CF6122C32B6BFEC2F2AE8C35A 2 | 00000000000000000000000000000000 9F589F5CF6122C32B6BFEC2F2AE8C35A D491DB16E7B1C39E86CB086B789F5419 3 | 9F589F5CF6122C32B6BFEC2F2AE8C35A D491DB16E7B1C39E86CB086B789F5419 019F9809DE1711858FAAC3A3BA20FBC3 4 | D491DB16E7B1C39E86CB086B789F5419 019F9809DE1711858FAAC3A3BA20FBC3 6363977DE839486297E661C6C9D668EB 5 | 000000000000000000000000000000000000000000000000 00000000000000000000000000000000 EFA71F788965BD4453F860178FC19101 6 | EFA71F788965BD4453F860178FC191010000000000000000 88B2B2706B105E36B446BB6D731A1E88 39DA69D6BA4997D585B6DC073CA341B2 7 | 88B2B2706B105E36B446BB6D731A1E88EFA71F788965BD44 39DA69D6BA4997D585B6DC073CA341B2 182B02D81497EA45F9DAACDC29193A65 8 | 0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000 57FF739D4DC92C1BD7FC01700CC8216F 9 | D43BB7556EA32E46F2A282B7D45B4E0D57FF739D4DC92C1BD7FC01700CC8216F 90AFE91BB288544F2C32DC239B2635E6 6CB4561C40BF0A9705931CB6D408E7FA 10 | -------------------------------------------------------------------------------- /TestData/x25519.dat: -------------------------------------------------------------------------------- 1 | 302E020100300506032B656E0422042030D407BB0CC97D0EC493BDB00A4A8EFA06A50D2388F5BA62947030E7D9873F49 -------------------------------------------------------------------------------- /TestData/x25519v0.dat: -------------------------------------------------------------------------------- 1 | 302E020100300506032B656E042204202818E54DE6B88EEF3E99E25042CB98E69373B222E4C1E8B3FB10AC9B26C1007B -------------------------------------------------------------------------------- /TestData/x25519v1.dat: -------------------------------------------------------------------------------- 1 | 3053020101300506032B656E04220420A00FADD6D29BE764B851F64F7620E80B700DF65914BED31E486362281BB5D061A123032100E9AD4CC54DAA36F312D98B253854F0076E2BC26FCE5802B3AC79A5B59B3D2C4F -------------------------------------------------------------------------------- /TestData/xtrdh171.dat: -------------------------------------------------------------------------------- 1 | 305F02160559DCD66A95A57249A15BAD6B431BF2CD58615B901D02153365CFA0D3B1B6577B2DB243 2 | DDE45EDB91C18B0F5F0216032F4EBA0911B3D0B14F6F1292A74DFFD4A8FCF22C1802160211CB3EDA 3 | 809FA0FF8C3A8AE691EC4C95A06A3395CF 4 | -------------------------------------------------------------------------------- /TestData/xtrdh342.dat: -------------------------------------------------------------------------------- 1 | 3081A6022B28E3FED51D3D861D962B0A16A92ACDB380ADAFB478CA555004C3AF387F853F9DE9921C 2 | 7DCB40098D25C757021D03094844F135A3A50049A848C3FC02412FCBED6040FB1BDE99A4D93E3B02 3 | 2B13F411960B85F9B031A247E072046892B1EE6C95A47242A839F8E24B96B88F37B4BDA2C6D253BC 4 | 0AAF29F1022B0D2AFE639D324E558B2B312E435E03957769D745C881D259DDFD2F48F9C08F82ECCF 5 | F4E7ADD47C705896D0 6 | -------------------------------------------------------------------------------- /TestPrograms/test_32bit.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | enum {N = (sizeof(std::size_t) == 4 ? 4 : -1)}; 5 | int x[N]; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /TestPrograms/test_64bit.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | enum {N = (sizeof(std::size_t) == 8 ? 8 : -1)}; 5 | int x[N]; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_acle_header.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char* argv[]) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_aes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | uint8x16_t x={0}; 9 | x=vaeseq_u8(x,x); 10 | x=vaesmcq_u8(x); 11 | x=vaesdq_u8(x,x); 12 | x=vaesimcq_u8(x); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_armv7.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char* argv[]) 4 | { 5 | #if __ARM_ARCH >= 7 6 | // Do nothing 7 | #elif __ARM_ARCH_7A__ 8 | // Do nothing 9 | #else 10 | int n[-1]; 11 | #endif 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_asimd.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | uint32x4_t x={0}; 9 | x=veorq_u32(x,x); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_crc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | #if (CRYPTOPP_ARM_ACLE_HEADER) 6 | # include 7 | # include 8 | #endif 9 | 10 | // Keep sync'd with arm_simd.h 11 | #include "arm_simd.h" 12 | 13 | int main(int argc, char* argv[]) 14 | { 15 | uint32_t w=0xffffffff; 16 | 17 | w = CRC32B(w,w); 18 | w = CRC32W(w,w); 19 | w = CRC32CB(w,w); 20 | w = CRC32CW(w,w); 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_neon.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | uint32x4_t x={0}; 9 | x=veorq_u32(x,x); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_neon_header.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char* argv[]) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_pmull.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | 6 | // Keep sync'd with arm_simd.h 7 | #include "arm_simd.h" 8 | 9 | int main(int argc, char* argv[]) 10 | { 11 | // Linaro is missing a lot of pmull gear. Also see http://github.com/weidai11/cryptopp/issues/233. 12 | const uint64_t wa1[]={0,0x9090909090909090}, wb1[]={0,0xb0b0b0b0b0b0b0b0}; 13 | const uint64x2_t a1=vld1q_u64(wa1), b1=vld1q_u64(wb1); 14 | 15 | const uint8_t wa2[]={0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 16 | 0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0}, 17 | wb2[]={0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, 18 | 0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0}; 19 | const uint8x16_t a2=vld1q_u8(wa2), b2=vld1q_u8(wb2); 20 | 21 | const uint64x2_t r1 = PMULL_00(a1, b1); 22 | const uint64x2_t r2 = PMULL_11(vreinterpretq_u64_u8(a2), 23 | vreinterpretq_u64_u8(b2)); 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_sha1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | uint32x4_t y = {0}; 9 | y=vsha1cq_u32(y,0,y); 10 | y=vsha1mq_u32(y,1,y); 11 | y=vsha1pq_u32(y,2,y); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_sha256.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | uint32x4_t y = {0}; 9 | y=vsha256hq_u32(y, y, y); 10 | y=vsha256h2q_u32(y, y, y); 11 | y=vsha256su1q_u32(y, y, y); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_sha3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | 6 | // Keep sync'd with arm_simd.h 7 | #include "arm_simd.h" 8 | 9 | int main(int argc, char* argv[]) 10 | { 11 | // SHA3 intrinsics are merely ARMv8.2 instructions. 12 | // https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics 13 | uint32x4_t x={0}, y={1}, z={2}; 14 | x=VEOR3(x,y,z); 15 | x=VXAR(y,z,6); 16 | x=VRAX1(y,z); 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_sha512.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | // SHA512 hash 9 | // https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=SHA512 10 | uint32x4_t w={0}, x={0}, y={0}, z={0}; 11 | w=vsha512hq_u64(x,y,z); 12 | w=vsha512h2q_u64(x,y); 13 | w=vsha512su0q_u64(x,y); 14 | w=vsha512su1q_u64 (x,y,z); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_sm3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | // SM3 hash 9 | // https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=SM3 10 | uint32x4_t x={1}, y={2}, z={3}; 11 | y=vsm3ss1q_u32(x,y,z); 12 | y=vsm3tt1aq_u32(x,y,z,3); 13 | y=vsm3tt1bq_u32(x,y,z,1); 14 | y=vsm3tt2aq_u32(x,y,z,2); 15 | y=vsm3tt2bq_u32(x,y,z,3); 16 | y=vsm3partw1q_u32(x,y,z); 17 | y=vsm3partw2q_u32(x,y,z); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /TestPrograms/test_arm_sm4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (CRYPTOPP_ARM_NEON_HEADER) 3 | # include 4 | #endif 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | // SM4 block cipher 9 | // https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=SM4 10 | uint32x4_t x={0}, y={1}, z={2}; 11 | x=vsm4ekeyq_u32(y,z); 12 | x=vsm4eq_u32(y,z); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /TestPrograms/test_asm_mixed.cpp: -------------------------------------------------------------------------------- 1 | // Most Clang cannot handle mixed asm with positional arguments, where the 2 | // body is Intel style with no prefix and the templates are AT&T style. 3 | // Also see https://bugs.llvm.org/show_bug.cgi?id=39895 . 4 | #include 5 | int main(int argc, char* argv[]) 6 | { 7 | size_t ret = 1, N = 1; 8 | asm __volatile__ 9 | ( 10 | #if defined(__amd64__) || defined(__x86_64__) 11 | ".intel_syntax noprefix ;\n" 12 | "xor rsi, rsi ;\n" 13 | "neg %1 ;\n" 14 | "inc %1 ;\n" 15 | "push %1 ;\n" 16 | "pop rax ;\n" 17 | ".att_syntax prefix ;\n" 18 | : "=a" (ret) : "c" (N) : "%rsi" 19 | #else 20 | ".intel_syntax noprefix ;\n" 21 | "xor esi, esi ;\n" 22 | "neg %1 ;\n" 23 | "inc %1 ;\n" 24 | "push %1 ;\n" 25 | "pop eax ;\n" 26 | ".att_syntax prefix ;\n" 27 | : "=a" (ret) : "c" (N) : "%esi" 28 | #endif 29 | ); 30 | return (int)ret; 31 | } 32 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | unsigned int x=0; 5 | return x; 6 | } 7 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11.cpp: -------------------------------------------------------------------------------- 1 | // Real C++11 libraries provide 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | #if __cplusplus >= 201103L 6 | std::forward_list x; 7 | #else 8 | int x[-1]; 9 | #endif 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_alignas.cpp: -------------------------------------------------------------------------------- 1 | int main(int argc, char* argv[]) 2 | { 3 | alignas(8) unsigned char x[16]; 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_alignof.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main (int argc, char* argv[]) 3 | { 4 | std::size_t n = alignof(int); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_assert.cpp: -------------------------------------------------------------------------------- 1 | // https://en.cppreference.com/w/cpp/feature_test 2 | int main(int argc, char* argv[]) 3 | { 4 | #if __cpp_static_assert >= 200410L 5 | int x[1]; 6 | #else 7 | int x[-1]; 8 | #endif 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_atomic.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | std::atomic_flag f = ATOMIC_FLAG_INIT; 5 | std::atomic g (false); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_auto.cpp: -------------------------------------------------------------------------------- 1 | int main(int argc, char* argv[]) 2 | { 3 | auto a = 1 + 2; 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_constexpr.cpp: -------------------------------------------------------------------------------- 1 | constexpr int fact(int n) 2 | { 3 | return n <= 1 ? 1 : (n * fact(n - 1)); 4 | } 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | fact(4); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_deletefn.cpp: -------------------------------------------------------------------------------- 1 | struct S { 2 | S() = delete; 3 | explicit S(int n) { } 4 | }; 5 | 6 | int main (int argc, char* rgv[]) 7 | { 8 | S s(1); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_enumtype.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | enum Size : std::size_t { Zero=0, One=1, Two=2 }; 5 | Size s(Size::Zero); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_initializer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | std::vector v{0,1,2,3,4}; 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_lambda.cpp: -------------------------------------------------------------------------------- 1 | // https://en.cppreference.com/w/cpp/feature_test 2 | int main(int argc, char* argv[]) 3 | { 4 | #if __cpp_lambdas >= 200907L 5 | int x[1]; 6 | #else 7 | int x[-1]; 8 | #endif 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_noexcept.cpp: -------------------------------------------------------------------------------- 1 | #if defined(__GNUC__) 2 | # define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10) 3 | #endif 4 | 5 | #if defined(__clang__) && defined(__apple_build_version__) 6 | # undef GNUC_VERSION 7 | # define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10) 8 | #elif defined(__clang__) 9 | # undef GNUC_VERSION 10 | # define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10) 11 | #endif 12 | 13 | #if (GNUC_VERSION >= 7030) 14 | # pragma GCC diagnostic ignored "-Wterminate" 15 | #endif 16 | 17 | #include 18 | 19 | void f(int n) noexcept(false) 20 | { 21 | if (n > 2) 22 | throw std::runtime_error("Oops"); 23 | } 24 | 25 | int main(int argc, char* argv[]) 26 | { 27 | f(argc); 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_nullptr.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | int* p = nullptr; 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_staticinit.cpp: -------------------------------------------------------------------------------- 1 | // https://en.cppreference.com/w/cpp/feature_test 2 | // Apple bug https://bugs.llvm.org/show_bug.cgi?id=47012. 3 | int main(int argc, char* argv[]) 4 | { 5 | #if __cpp_threadsafe_static_init >= 200806L 6 | int x[1]; 7 | #else 8 | int x[-1]; 9 | #endif 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_sync.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | std::mutex m; 5 | std::lock_guard l(m); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx11_vartemplates.cpp: -------------------------------------------------------------------------------- 1 | int main(int argc, char* argv[]) 2 | { 3 | #if __cpp_variadic_templates >= 200704L 4 | int x[1]; 5 | #else 6 | int x[-1]; 7 | #endif 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx14.cpp: -------------------------------------------------------------------------------- 1 | int main(int argc, char* argv[]) 2 | { 3 | #if __cplusplus >= 201402L 4 | int x[1]; 5 | #else 6 | int x[-1]; 7 | #endif 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx17.cpp: -------------------------------------------------------------------------------- 1 | int main(int argc, char* argv[]) 2 | { 3 | #if __cplusplus >= 201703L 4 | int x[1]; 5 | #else 6 | int x[-1]; 7 | #endif 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx17_assert.cpp: -------------------------------------------------------------------------------- 1 | // https://en.cppreference.com/w/cpp/feature_test 2 | int main(int argc, char* argv[]) 3 | { 4 | #if __cpp_static_assert >= 201411L 5 | int x[1]; 6 | #else 7 | int x[-1]; 8 | #endif 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx17_exceptions.cpp: -------------------------------------------------------------------------------- 1 | // https://en.cppreference.com/w/cpp/feature_test 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | #if __cpp_lib_uncaught_exceptions >= 201411L 6 | int x = std::uncaught_exceptions(); 7 | #else 8 | int x[-1]; 9 | #endif 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /TestPrograms/test_cxx98_exception.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | struct S { 3 | S() {} 4 | virtual ~S() { 5 | bool b = std::uncaught_exception(); 6 | } 7 | }; 8 | int main(int argc, char* argv[]) 9 | { 10 | S s; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /TestPrograms/test_glibc.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | #ifndef __GLIBCXX__ 5 | int x[-1]; 6 | #endif 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /TestPrograms/test_newlib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | #ifndef __NEWLIB__ 5 | int x[-1]; 6 | #endif 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /TestPrograms/test_nodevirtualize.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html 4 | #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | // GCC 12 is removing live code. We don't know why. 9 | // https://github.com/weidai11/cryptopp/issues/1134 and 10 | // https://github.com/weidai11/cryptopp/issues/1141 11 | #if defined(__linux__) && (GCC_VERSION >= 120000) 12 | // On successful compile -fno-devirtualize will be used 13 | // to work around the problem. 14 | ;; 15 | #else 16 | int x[-1]; 17 | #endif 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /TestPrograms/test_ppc_aes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | #if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__)) 5 | __vector unsigned char x = {1,2,3,4,5,6,7,8}; 6 | x=__vcipher(x,x); 7 | x=__vcipherlast(x,x); 8 | x=__vncipher(x,x); 9 | x=__vncipherlast(x,x); 10 | #elif defined(__clang__) 11 | __vector unsigned long long x = {1,2}; 12 | x=__builtin_altivec_crypto_vcipher(x,x); 13 | x=__builtin_altivec_crypto_vcipherlast(x,x); 14 | x=__builtin_altivec_crypto_vncipher(x,x); 15 | x=__builtin_altivec_crypto_vncipherlast(x,x); 16 | #elif defined(__GNUC__) 17 | __vector unsigned long long x = {1,2}; 18 | x=__builtin_crypto_vcipher(x,x); 19 | x=__builtin_crypto_vcipherlast(x,x); 20 | x=__builtin_crypto_vncipher(x,x); 21 | x=__builtin_crypto_vncipherlast(x,x); 22 | #else 23 | int XXX[-1]; 24 | #endif 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /TestPrograms/test_ppc_altivec.cpp: -------------------------------------------------------------------------------- 1 | #define GNUC_VERSION (__GNUC__*1000 + __GNUC_MAJOR__*10) 2 | #if (GNUC_VERSION >= 4060) || defined(__clang__) 3 | # pragma GCC diagnostic ignored "-Wdeprecated" 4 | #endif 5 | 6 | #include 7 | int main(int argc, char* argv[]) 8 | { 9 | __vector unsigned char x; 10 | x=vec_ld(0, (unsigned char*)argv[0]); 11 | x=vec_add(x,x); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /TestPrograms/test_ppc_power7.cpp: -------------------------------------------------------------------------------- 1 | #if defined(__GNUC__) 2 | # define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10) 3 | #endif 4 | 5 | #if defined(__clang__) && defined(__apple_build_version__) 6 | # undef GNUC_VERSION 7 | # define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10) 8 | #elif defined(__clang__) 9 | # undef GNUC_VERSION 10 | # define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10) 11 | #endif 12 | 13 | #if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000) 14 | # pragma GCC diagnostic ignored "-Wdeprecated" 15 | #endif 16 | 17 | // XL C++ on AIX does not define VSX and does not 18 | // provide an option to set it. We have to set it 19 | // for the code below. This define must stay in 20 | // sync with the define in test_ppc_power7.cpp. 21 | #if defined(_AIX) && defined(_ARCH_PWR7) && defined(__xlC__) 22 | # define __VSX__ 1 23 | #endif 24 | 25 | #include 26 | int main(int argc, char* argv[]) 27 | { 28 | #if defined(_ARCH_PWR7) && defined(__VSX__) 29 | // PWR7 30 | __vector unsigned int a = {1,2,3,4}; 31 | __vector unsigned int b = vec_ld(0, (unsigned int*)argv[0]); 32 | __vector unsigned int c = vec_xor(a, b); 33 | 34 | // VSX 35 | __vector unsigned int x = {5,6,7,8}; 36 | __vector unsigned int y = vec_xl(0, (unsigned int*)argv[0]); 37 | __vector unsigned int z = vec_xor(x, y); 38 | __vector unsigned long long xx = {1,2}; 39 | __vector unsigned long long yy = (__vector unsigned long long)y; 40 | #else 41 | int x[-1]; 42 | #endif 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /TestPrograms/test_ppc_power8.cpp: -------------------------------------------------------------------------------- 1 | #if defined(__GNUC__) 2 | # define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10) 3 | #endif 4 | 5 | #if defined(__clang__) && defined(__apple_build_version__) 6 | # undef GNUC_VERSION 7 | # define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10) 8 | #elif defined(__clang__) 9 | # undef GNUC_VERSION 10 | # define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10) 11 | #endif 12 | 13 | #if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000) 14 | # pragma GCC diagnostic ignored "-Wdeprecated" 15 | #endif 16 | 17 | // XL C++ on AIX does not define CRYPTO and does not 18 | // provide an option to set it. We have to set it 19 | // for the code below. This define must stay in 20 | // sync with the define in test_ppc_power8.cpp 21 | #if defined(_AIX) && defined(_ARCH_PWR8) && defined(__xlC__) 22 | # define __CRYPTO__ 1 23 | #endif 24 | 25 | #include 26 | int main(int argc, char* argv[]) 27 | { 28 | #if defined(_ARCH_PWR8) 29 | __vector unsigned long long r = {1, 2}; 30 | __vector unsigned int s = vec_xl(0, (unsigned int*)argv[0]); // Power7 31 | __vector unsigned long long w = (__vector unsigned long long)r; 32 | __vector unsigned long long x = (__vector unsigned long long)s; 33 | __vector unsigned long long y = vec_xor(w, x); 34 | __vector unsigned long long z = vec_add(y, vec_add(w, x)); 35 | # if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__)) 36 | __vector unsigned long long u = __vpmsumd (y, z); 37 | # elif defined(__clang__) 38 | __vector unsigned long long u = __builtin_altivec_crypto_vpmsumd (y, z); 39 | # else 40 | __vector unsigned long long u = __builtin_crypto_vpmsumd (y, z); 41 | # endif 42 | #else 43 | int x[-1]; 44 | #endif 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /TestPrograms/test_ppc_power9.cpp: -------------------------------------------------------------------------------- 1 | #if defined(__GNUC__) 2 | # define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10) 3 | #endif 4 | 5 | #if defined(__clang__) && defined(__apple_build_version__) 6 | # undef GNUC_VERSION 7 | # define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10) 8 | #elif defined(__clang__) 9 | # undef GNUC_VERSION 10 | # define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10) 11 | #endif 12 | 13 | #if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000) 14 | # pragma GCC diagnostic ignored "-Wdeprecated" 15 | #endif 16 | 17 | #include 18 | int main(int argc, char* argv[]) 19 | { 20 | #if defined(_ARCH_PWR9) 21 | __vector unsigned int v = vec_xl_be(0, (unsigned int*)argv[0]); 22 | #else 23 | int XXX[-1]; 24 | #endif 25 | 26 | #if defined(__GNUC__) || defined(__IBM_GCC_ASM) 27 | unsigned int y = __builtin_darn_32(); 28 | #else 29 | int XXX[-1]; 30 | #endif 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /TestPrograms/test_ppc_sha.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | #if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__)) 5 | __vector unsigned int x = {1,2,3,4}; 6 | x=__vshasigmaw(x, 0, 0); 7 | __vector unsigned long long y = {1,2}; 8 | y=__vshasigmad(y, 0, 0); 9 | #elif defined(__clang__) 10 | __vector unsigned int x = {1,2,3,4}; 11 | x=__builtin_altivec_crypto_vshasigmaw(x, 0, 0); 12 | __vector unsigned long long y = {1,2}; 13 | y=__builtin_altivec_crypto_vshasigmad(y, 0, 0); 14 | #elif defined(__GNUC__) 15 | __vector unsigned int x = {1,2,3,4}; 16 | x=__builtin_crypto_vshasigmaw(x, 0, 0); 17 | __vector unsigned long long y = {1,2}; 18 | y=__builtin_crypto_vshasigmad(y, 0, 0); 19 | #else 20 | int XXX[-1]; 21 | #endif 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /TestPrograms/test_ppc_vmull.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | __vector unsigned long long x = {1,2}; 5 | __vector unsigned long long y = {3,4}; 6 | 7 | #if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__)) 8 | __vector unsigned long long z=__vpmsumd(x,y); 9 | #elif defined(__clang__) 10 | __vector unsigned long long z=__builtin_altivec_crypto_vpmsumd(x,y); 11 | #elif defined(__GNUC__) 12 | __vector unsigned long long z=__builtin_crypto_vpmsumd(x,y); 13 | #else 14 | int XXX[-1]; 15 | #endif 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /TestPrograms/test_pthreads.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void* function(void *ptr) 5 | { 6 | return 0; 7 | } 8 | 9 | int main(int argc, char* argv[]) 10 | { 11 | pthread_t thread; 12 | int ret = pthread_create(&thread, NULL, function, (void*)0); 13 | pthread_join(thread, NULL); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_aes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | __m128i x = _mm_setzero_si128(); 6 | x=_mm_aesenc_si128(x,x); 7 | x=_mm_aesenclast_si128(x,x); 8 | x=_mm_aesdec_si128(x,x); 9 | x=_mm_aesdeclast_si128(x,x); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_avx.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | __m256d x = _mm256_setzero_pd(); 5 | x=_mm256_addsub_pd(x,x); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_avx2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | // _mm256_broadcastsi128_si256 due to Clang 5 | __m128i x = _mm_setzero_si128 (); 6 | __m256i y = _mm256_broadcastsi128_si256 (x); 7 | y = _mm256_add_epi64 (y,y); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_avx512.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | uint64_t x[8] = {0}; 6 | __m512i y = _mm512_loadu_si512((__m512i*)x); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_clmul.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | __m128i x = _mm_setzero_si128(); 6 | x=_mm_clmulepi64_si128(x,x,0x11); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_cpuid.cpp: -------------------------------------------------------------------------------- 1 | int main(int argc, char* argv[]) 2 | { 3 | unsigned int a, b, c, d; 4 | asm volatile ( "cpuid" : "+a"(a), "=b"(b), "+c"(c), "=d"(d) ); 5 | 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_rdrand.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) 3 | # include 4 | #endif 5 | int main(int argc, char* argv[]) 6 | { 7 | unsigned int x=0; 8 | (void)_rdrand32_step (&x); 9 | return x == 0 ? 0 : 0; 10 | } 11 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_rdseed.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) 3 | # include 4 | #endif 5 | int main(int argc, char* argv[]) 6 | { 7 | unsigned int x=0; 8 | (void)_rdseed32_step (&x); 9 | return x == 0 ? 0 : 0; 10 | } 11 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_sha.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | __m128i x = _mm_setzero_si128(); 6 | x=_mm_sha1msg1_epu32(x,x); 7 | x=_mm_sha1msg2_epu32(x,x); 8 | x=_mm_sha1nexte_epu32(x,x); 9 | x=_mm_sha1rnds4_epu32(x,x,0); 10 | x=_mm_sha256msg1_epu32(x,x); 11 | x=_mm_sha256msg2_epu32(x,x); 12 | x=_mm_sha256rnds2_epu32(x,x,x); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_sse2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | __m128i x = _mm_setzero_si128(); 5 | x=_mm_add_epi64(x,x); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_sse3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | __m128d x = _mm_setzero_pd(); 6 | x=_mm_addsub_pd(x,x); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_sse41.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | __m128i x = _mm_setzero_si128(); 6 | __m128i a = _mm_setzero_si128(); 7 | __m128i b = _mm_setzero_si128(); 8 | x=_mm_blend_epi16(a,b,4); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_sse42.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | unsigned int x=32; 5 | x=_mm_crc32_u8(x,4); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_ssse3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | __m128i x = _mm_setzero_si128(); 6 | x=_mm_alignr_epi8(x,x,2); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_via_aes.cpp: -------------------------------------------------------------------------------- 1 | // TODO: cut-in xcrypt-ecb 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | unsigned int msr=0; 6 | unsigned int divisor=2; 7 | unsigned int buffer; 8 | 9 | __asm__ __volatile__ 10 | ( 11 | #if defined(__x86_64__) || defined(__amd64__) 12 | "mov %1, %%rdi ;\n" 13 | "movl %2, %%edx ;\n" 14 | #else 15 | "mov %1, %%edi ;\n" 16 | "movl %2, %%edx ;\n" 17 | #endif 18 | 19 | // xstore-rng 20 | ".byte 0x0f, 0xa7, 0xc0 ;\n" 21 | 22 | #if defined(__x86_64__) || defined(__amd64__) 23 | "andq %%rax, 0x1f ;\n" 24 | "movl %%eax, %0 ;\n" 25 | #else 26 | "andl %%eax, 0x1f ;\n" 27 | "movl %%eax, %0 ;\n" 28 | #endif 29 | 30 | : "=g" (msr) : "g" (buffer), "g" (divisor) 31 | #if defined(__x86_64__) || defined(__amd64__) 32 | : "rax", "rdx", "rdi", "cc" 33 | #else 34 | : "eax", "edx", "edi", "cc" 35 | #endif 36 | ); 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_via_rng.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(int argc, char* argv[]) 3 | { 4 | unsigned int msr=0; 5 | unsigned int divisor=2; 6 | unsigned int buffer; 7 | 8 | __asm__ __volatile__ 9 | ( 10 | #if defined(__x86_64__) || defined(__amd64__) 11 | "mov %1, %%rdi ;\n" 12 | "movl %2, %%edx ;\n" 13 | #else 14 | "mov %1, %%edi ;\n" 15 | "movl %2, %%edx ;\n" 16 | #endif 17 | 18 | // xstore-rng 19 | ".byte 0x0f, 0xa7, 0xc0 ;\n" 20 | 21 | #if defined(__x86_64__) || defined(__amd64__) 22 | "andq %%rax, 0x1f ;\n" 23 | "movl %%eax, %0 ;\n" 24 | #else 25 | "andl %%eax, 0x1f ;\n" 26 | "movl %%eax, %0 ;\n" 27 | #endif 28 | 29 | : "=g" (msr) : "g" (buffer), "g" (divisor) 30 | #if defined(__x86_64__) || defined(__amd64__) 31 | : "rax", "rdx", "rdi", "cc" 32 | #else 33 | : "eax", "edx", "edi", "cc" 34 | #endif 35 | ); 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /TestPrograms/test_x86_via_sha.cpp: -------------------------------------------------------------------------------- 1 | // TODO: cut-in xsha1 2 | #include 3 | int main(int argc, char* argv[]) 4 | { 5 | unsigned int msr=0; 6 | unsigned int divisor=2; 7 | unsigned int buffer; 8 | 9 | __asm__ __volatile__ 10 | ( 11 | #if defined(__x86_64__) || defined(__amd64__) 12 | "mov %1, %%rdi ;\n" 13 | "movl %2, %%edx ;\n" 14 | #else 15 | "mov %1, %%edi ;\n" 16 | "movl %2, %%edx ;\n" 17 | #endif 18 | 19 | // xstore-rng 20 | ".byte 0x0f, 0xa7, 0xc0 ;\n" 21 | 22 | #if defined(__x86_64__) || defined(__amd64__) 23 | "andq %%rax, 0x1f ;\n" 24 | "movl %%eax, %0 ;\n" 25 | #else 26 | "andl %%eax, 0x1f ;\n" 27 | "movl %%eax, %0 ;\n" 28 | #endif 29 | 30 | : "=g" (msr) : "g" (buffer), "g" (divisor) 31 | #if defined(__x86_64__) || defined(__amd64__) 32 | : "rax", "rdx", "rdi", "cc" 33 | #else 34 | : "eax", "edx", "edi", "cc" 35 | #endif 36 | ); 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /TestScripts/change-version.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################# 4 | # 5 | # This script switches back to the previous Crypto++ version before 6 | # building the docs. Before running the script, copy it to the root 7 | # directory. After running this script, you can 'make docs' 8 | # 9 | # Written and placed in public domain by Jeffrey Walton. 10 | # 11 | # Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) 12 | # licensed under the Boost Software License 1.0, while the individual files 13 | # in the compilation are all public domain. 14 | # 15 | # See https://www.cryptopp.com/wiki/Release_Versioning for more details 16 | # 17 | ############################################################################# 18 | 19 | sed 's/Library 8.9 API/Library 8.8 API/g' cryptlib.h > cryptlib.h.new 20 | mv cryptlib.h.new cryptlib.h 21 | 22 | sed 's/= 8.9/= 8.8/g' Doxyfile > Doxyfile.new 23 | mv Doxyfile.new Doxyfile 24 | 25 | sed 's/CRYPTOPP_MINOR 9/CRYPTOPP_MINOR 8/g' config_ver.h > config_ver.h.new 26 | mv config_ver.h.new config_ver.h 27 | 28 | # sed 'CRYPTOPP_REVISION CRYPTOPP_REVISION 1/g' config_ver.h > config_ver.h.new 29 | # mv config_ver.h.new config_ver.h 30 | 31 | sed 's/CRYPTOPP_VERSION 890/CRYPTOPP_VERSION 880/g' config_ver.h > config_ver.h.new 32 | mv config_ver.h.new config_ver.h 33 | -------------------------------------------------------------------------------- /TestScripts/coverity-linux.txt: -------------------------------------------------------------------------------- 1 | # coverity-linux.txt - Scan build submission instructions for Unix and Linux. 2 | # Written and placed in public domain by Jeffrey Walton and Uri Blumenthal. 3 | # Copyright assigned to Crypto++ project. 4 | # 5 | # The following are copy/paste instructions for invoking cov-build, building the library and submitting the artifacts for a scan. 6 | # 7 | # For more information see http://cryptopp.com/wiki/Coverity_Scan. 8 | 9 | ################################################################## 10 | 11 | reset 12 | 13 | make distclean &>/dev/null 14 | 15 | # Usually we test with these flags 16 | # CXXFLAGS="-DNDEBUG -g3 -O2" 17 | cov-build --dir cov-int make -j 2 18 | 19 | tar czvf cryptopp.tgz cov-int 20 | 21 | CRYPTOPP_COVERITY_TOKEN=XXXXXXXXXXXXXXXX 22 | COVERITY_SCAN_NAME="Rijndael-AliasedTable-SSE2-Linux-i686" 23 | 24 | curl \ 25 | --form token="$CRYPTOPP_COVERITY_TOKEN" \ 26 | --form email=webmaster@cryptopp.com \ 27 | --form file=@cryptopp.tgz \ 28 | --form version="$COVERITY_SCAN_NAME" \ 29 | --form description="$COVERITY_SCAN_NAME" \ 30 | https://scan.coverity.com/builds?project=Cryptopp 31 | -------------------------------------------------------------------------------- /TestScripts/coverity-macosx.txt: -------------------------------------------------------------------------------- 1 | # coverity-linux.txt - Scan build submission instructions for Unix and Linux. 2 | # Written and placed in public domain by Jeffrey Walton and Uri Blumenthal. 3 | # Copyright assigned to Crypto++ project. 4 | # 5 | # The following are copy/paste instructions for invoking cov-build, building the library and submitting the artifacts for a scan. 6 | # 7 | # For more information see http://cryptopp.com/wiki/Coverity_Scan. 8 | 9 | ################################################################## 10 | 11 | reset 12 | 13 | make distclean &>/dev/null 14 | 15 | # Usually we test with these flags 16 | CXXFLAGS="-DNDEBUG -g3 -O2" cov-build --dir cov-int make -j 2 17 | 18 | # Sometimes we need these flags (add COVERITY_UNSUPPORTED) 19 | # COVERITY_UNSUPPORTED=1 CXXFLAGS="-DNDEBUG -g3 -O2" cov-build --dir cov-int make -j 2 20 | 21 | # Sometimes we need these flags (alternate compile, C++11) 22 | # CXX=/opt/local/bin/clang++-mp-3.7 COVERITY_UNSUPPORTED=1 CXXFLAGS="-DNDEBUG -g3 -O2 -std=c++11" cov-build --dir cov-int make -j 2 23 | 24 | 25 | tar czvf cryptopp.tgz cov-int 26 | 27 | CRYPTOPP_COVERITY_TOKEN=XXXXXXXXXXXXXXXX 28 | COVERITY_SCAN_NAME="Cryptopp-MacOSX-x86_64" 29 | 30 | curl 31 | --form token="$CRYPTOPP_COVERITY_TOKEN" \ 32 | --form email=webmaster@cryptopp.com \ 33 | --form file=@cryptopp.tgz \ 34 | --form version="$COVERITY_SCAN_NAME" \ 35 | --form description="$COVERITY_SCAN_NAME" \ 36 | https://scan.coverity.com/builds?project=Cryptopp 37 | -------------------------------------------------------------------------------- /TestScripts/coverity-windows.txt: -------------------------------------------------------------------------------- 1 | REM coverity-windows.txt - Scan build submission instructions for Windows using cryptest.nmake. 2 | REM Written and placed in public domain by Jeffrey Walton and Uri Blumenthal. 3 | REM Copyright assigned to Crypto++ project. 4 | REM 5 | REM The following are copy/paste instructions for invoking cov-build, building the library and 6 | REM submitting the artifacts for a scan. Also see http://cryptopp.com/wiki/Coverity_Scan. 7 | 8 | REM ################################################################ 9 | 10 | cls 11 | 12 | del /f cryptopp.zip 13 | rmdir /q /s cov-int 14 | nmake /f cryptest.nmake clean 15 | 16 | REM Uncomment CXXFLAGS in makefile. Pay attention to X86, X64 or ARM 17 | cov-build.exe --dir cov-int nmake /f cryptest.nmake 18 | 19 | 7z.exe a -r -tzip -mx=9 cryptopp.zip cov-int 20 | 21 | set CRYPTOPP_COVERITY_TOKEN=XXXXXXXXXXXXXXXX 22 | set COVERITY_SCAN_NAME=Rijndael-AliasedTable-SSE2-Windows-X64 23 | 24 | curl.exe ^ 25 | --form token="%CRYPTOPP_COVERITY_TOKEN%" ^ 26 | --form email=webmaster@cryptopp.com ^ 27 | --form file=@cryptopp.zip ^ 28 | --form version="%COVERITY_SCAN_NAME%" ^ 29 | --form description="%COVERITY_SCAN_NAME%" ^ 30 | https://scan.coverity.com/builds?project=Cryptopp 31 | -------------------------------------------------------------------------------- /TestScripts/cryptdll-windows.cmd: -------------------------------------------------------------------------------- 1 | REM cryptdll-windows.cmd - written and placed in public domain by Jeffrey Walton 2 | REM Copyright assigned to the Crypto++ project. 3 | REM 4 | REM For details see https://cryptopp.com/wiki/MSBuild_(Command_Line) 5 | REM 6 | 7 | REM Build the Win32/Debug cryptest.exe 8 | msbuild /t:Build /p:Configuration=Debug;Platform=Win32 cryptlib.vcxproj 9 | msbuild /t:Build /p:Configuration=Debug;Platform=Win32 cryptest.vcxproj 10 | 11 | REM Build the Win32/Release cryptopp.dll 12 | msbuild /t:Build /p:Configuration=Release;Platform=Win32 cryptdll.vcxproj 13 | 14 | REM Build the FIPS test driver 15 | msbuild /t:Build /p:Configuration=Release;Platform=Win32 dlltest.vcxproj 16 | 17 | REM Run the FIPS test driver 18 | .\Win32\DLL_Output\Release\dlltest.exe 19 | -------------------------------------------------------------------------------- /TestScripts/cryptest-coverity.cpp: -------------------------------------------------------------------------------- 1 | // cryptest-coverity.cpp - Coverity modeling file. 2 | // Written and placed in public domain by Jeffrey Walton and Uri Blumenthal. 3 | // 4 | // For more information see http://cryptopp.com/wiki/Coverity_Scan. 5 | // 6 | // Also see https://scan.coverity.com/tune#what-is-model 7 | 8 | /////////////////////////////////////////////////////////////////// 9 | 10 | void special_abort(const char* msg) { 11 | __coverity_panic__(); 12 | } 13 | -------------------------------------------------------------------------------- /TestScripts/cryptest-tidy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################# 4 | # 5 | # This script invokes clang-tidy on source files. 6 | # 7 | # Written and placed in public domain by Jeffrey Walton. 8 | # 9 | # Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) 10 | # licensed under the Boost Software License 1.0, while the individual files 11 | # in the compilation are all public domain. 12 | # 13 | ############################################################################# 14 | 15 | for file in $(find . -maxdepth 1 -type f -name '*.cpp'); do 16 | echo "Tidying $file" 17 | clang-tidy $file -checks=-clang-analyzer-optin.cplusplus.VirtualCall -- -std=c++03 18 | done 19 | -------------------------------------------------------------------------------- /TestScripts/cryptopp-compiler.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Compile with: 4 | // g++ cryptopp-compiler.cpp -o cryptopp-compiler.exe 5 | // Or: 6 | // cl.exe /EHs cryptopp-compiler.cpp /Fe:cryptopp-compiler.exe 7 | 8 | int main(int argc, char* argv[]) 9 | { 10 | #if defined (_MSC_VER) 11 | std::cout << "_MSC_VER is defined" << std::endl; 12 | #else 13 | std::cout << "_MSC_VER is not defined" << std::endl; 14 | #endif 15 | 16 | #if defined (__GNUC__) 17 | std::cout << "__GNUC__ is defined" << std::endl; 18 | #else 19 | std::cout << "__GNUC__ is not defined" << std::endl; 20 | #endif 21 | 22 | #if defined (__clang__) 23 | std::cout << "__clang__ is defined" << std::endl; 24 | #else 25 | std::cout << "__clang__ is not defined" << std::endl; 26 | #endif 27 | 28 | #if defined (__INTEL_COMPILER) 29 | std::cout << "__INTEL_COMPILER is defined" << std::endl; 30 | #else 31 | std::cout << "__INTEL_COMPILER is not defined" << std::endl; 32 | #endif 33 | 34 | #if defined (__xlC__) 35 | std::cout << "__xlC__ is defined" << std::endl; 36 | #else 37 | std::cout << "__xlC__ is not defined" << std::endl; 38 | #endif 39 | 40 | #if defined (__SUNPRO_CC) 41 | std::cout << "__SUNPRO_CC is defined" << std::endl; 42 | #else 43 | std::cout << "__SUNPRO_CC is not defined" << std::endl; 44 | #endif 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /TestScripts/reset-fork.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Use this script to reset a fork to Wei Dai's master 4 | # https://stackoverflow.com/questions/9646167/clean-up-a-fork-and-restart-it-from-the-upstream 5 | # 6 | # Written and placed in public domain by Jeffrey Walton 7 | # 8 | # Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2) 9 | # licensed under the Boost Software License 1.0, while the individual files 10 | # in the compilation are all public domain. 11 | # 12 | 13 | git remote add upstream https://github.com/weidai11/cryptopp 2>/dev/null 14 | git fetch upstream 15 | git checkout master 16 | git reset --hard upstream/master 17 | git push origin master --force 18 | -------------------------------------------------------------------------------- /TestVectors/aead.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: FileList 2 | Name: aead.txt collection 3 | Test: TestVectors/ccm.txt 4 | Test: TestVectors/eax.txt 5 | Test: TestVectors/gcm.txt 6 | Test: TestVectors/chacha20poly1305.txt 7 | -------------------------------------------------------------------------------- /TestVectors/all.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: FileList 2 | Name: all.txt collection 3 | Test: TestVectors/aes.txt 4 | Test: TestVectors/aria.txt 5 | Test: TestVectors/blake2b.txt 6 | Test: TestVectors/blake2s.txt 7 | Test: TestVectors/camellia.txt 8 | Test: TestVectors/ccm.txt 9 | Test: TestVectors/chacha_tls.txt 10 | Test: TestVectors/chacha20poly1305.txt 11 | Test: TestVectors/chacha.txt 12 | Test: TestVectors/xchacha.txt 13 | Test: TestVectors/cham.txt 14 | Test: TestVectors/cmac.txt 15 | Test: TestVectors/dlies.txt 16 | Test: TestVectors/dsa_1363.txt 17 | Test: TestVectors/dsa_rfc6979.txt 18 | Test: TestVectors/dsa.txt 19 | Test: TestVectors/eax.txt 20 | Test: TestVectors/esign.txt 21 | Test: TestVectors/gcm.txt 22 | Test: TestVectors/hc128.txt 23 | Test: TestVectors/hc256.txt 24 | Test: TestVectors/hight.txt 25 | Test: TestVectors/hkdf.txt 26 | Test: TestVectors/hmac.txt 27 | Test: TestVectors/kalyna.txt 28 | Test: TestVectors/keccak.txt 29 | Test: TestVectors/lea.txt 30 | Test: TestVectors/lsh256.txt 31 | Test: TestVectors/lsh512.txt 32 | Test: TestVectors/mars.txt 33 | Test: TestVectors/nr.txt 34 | Test: TestVectors/panama.txt 35 | Test: TestVectors/poly1305aes.txt 36 | Test: TestVectors/poly1305_tls.txt 37 | Test: TestVectors/rabbit.txt 38 | Test: TestVectors/rsa_oaep.txt 39 | Test: TestVectors/rsa_pkcs1_1_5.txt 40 | Test: TestVectors/rsa_pss.txt 41 | Test: TestVectors/rw.txt 42 | Test: TestVectors/salsa.txt 43 | Test: TestVectors/seal.txt 44 | Test: TestVectors/seed.txt 45 | Test: TestVectors/sha1_fips_180.txt 46 | Test: TestVectors/sha2_fips_180.txt 47 | Test: TestVectors/sha3_fips_202.txt 48 | Test: TestVectors/shake.txt 49 | Test: TestVectors/shacal2.txt 50 | Test: TestVectors/sha.txt 51 | Test: TestVectors/simeck.txt 52 | Test: TestVectors/simon.txt 53 | Test: TestVectors/siphash.txt 54 | Test: TestVectors/skipjack.txt 55 | Test: TestVectors/sm3.txt 56 | Test: TestVectors/sm4.txt 57 | Test: TestVectors/sosemanuk.txt 58 | Test: TestVectors/speck.txt 59 | Test: TestVectors/tea.txt 60 | Test: TestVectors/threefish.txt 61 | Test: TestVectors/ttmac.txt 62 | Test: TestVectors/vmac.txt 63 | Test: TestVectors/wake.txt 64 | Test: TestVectors/whrlpool.txt 65 | Test: TestVectors/xts.txt 66 | -------------------------------------------------------------------------------- /TestVectors/blake2.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: FileList 2 | Name: blake2.txt collection 3 | Test: TestVectors/blake2s.txt 4 | Test: TestVectors/blake2b.txt 5 | -------------------------------------------------------------------------------- /TestVectors/cmac.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: MAC 2 | Name: CMAC(AES) 3 | Source: RFC 4493 4 | Key: 2b7e1516 28aed2a6 abf71588 09cf4f3c 5 | Message: 6 | MAC: bb1d6929 e9593728 7fa37d12 9b756746 7 | Test: Verify 8 | Message: 6bc1bee2 2e409f96 e93d7e11 7393172a 9 | MAC: 070a16b4 6b4d4144 f79bdd9d d04a287c 10 | Test: Verify 11 | Message: 6bc1bee2 2e409f96 e93d7e11 7393172a ae2d8a57 1e03ac9c 9eb76fac 45af8e51 30c81c46 a35ce411 12 | MAC: dfa66747 de9ae630 30ca3261 1497c827 13 | Test: Verify 14 | Message: 6bc1bee2 2e409f96 e93d7e11 7393172a ae2d8a57 1e03ac9c 9eb76fac 45af8e51 30c81c46 a35ce411 e5fbc119 1a0a52ef f69f2445 df4f9b17 ad2b417b e66c3710 15 | MAC: 51f0bebf 7e3b9d92 fc497417 79363cfe 16 | Test: Verify 17 | MAC: 51f0bebf 7e3b9d92 fc497417 79363cff 18 | Test: NotVerify 19 | 20 | AlgorithmType: MAC 21 | Name: CMAC(DES-EDE3) 22 | Source: http://csrc.nist.gov/groups/STM/cavp/documents/mac/cmactestvectors.zip 23 | Key: f8fba7b9b3e9d68a 2f70bfd304d32a15 9e13453e0d16928a 24 | Message: 25 | MAC: eb61515b 26 | Test: VerifyTruncated 27 | Key: 344a6732dc5e5431 e98a4f7c323dc1c4 6b0275dc150e68e9 28 | Message: 25db0710fb165d316e7c32dd25648ed0 29 | MAC: 862f0e2b 30 | Test: VerifyTruncated 31 | Key: 20ae32c49bab3bf8 f86bb66173fb54d5 3e700868c46bc291 32 | Message: 582bd9c8c36ec815d0a9 33 | MAC: 0d62f14f 34 | Test: VerifyTruncated 35 | Key: 62232501b9e9c1b5 54209d7c075d2c31 73a2f289a84c49ce 36 | Message: adaf4bfffab79ffb60b94647faac634929c56e694052881881e60b1149b6 37 | MAC: a05674f2c905d153 38 | Test: Verify 39 | -------------------------------------------------------------------------------- /TestVectors/lsh.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: FileList 2 | Name: LSH test vectors 3 | Test: TestVectors/lsh256.txt 4 | Test: TestVectors/lsh512.txt 5 | Test: TestVectors/lsh512_256.txt 6 | -------------------------------------------------------------------------------- /TestVectors/seed.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: SymmetricCipher 2 | Name: SEED/ECB 3 | Source: RFC 4269 4 | Key: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5 | Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 6 | Ciphertext: 5E BA C6 E0 05 4E 16 68 19 AF F1 CC 6D 34 6C DB 7 | Test: Encrypt 8 | Key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 9 | Plaintext: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 | Ciphertext: C1 1F 22 F2 01 40 50 50 84 48 35 97 E4 37 0F 43 11 | Test: Encrypt 12 | Key: 47 06 48 08 51 E6 1B E8 5D 74 BF B3 FD 95 61 85 13 | Plaintext: 83 A2 F8 A2 88 64 1F B9 A4 E9 A5 CC 2F 13 1C 7D 14 | Ciphertext: EE 54 D1 3E BC AE 70 6D 22 6B C3 14 2C D4 0D 4A 15 | Test: Encrypt 16 | Key: 28 DB C3 BC 49 FF D8 7D CF A5 09 B1 1D 42 2B E7 17 | Plaintext: B4 1E 6B E2 EB A8 4A 14 8E 2E ED 84 59 3C 5E C7 18 | Ciphertext: 9B 9B 7B FC D1 81 3C B9 5D 0B 36 18 F4 0F 51 22 19 | Test: Encrypt 20 | -------------------------------------------------------------------------------- /TestVectors/sha1_fips_180.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: FileList 2 | Name: SHA1 FIPS 180 collection 3 | Test: TestVectors/sha1_160_fips_180.txt 4 | -------------------------------------------------------------------------------- /TestVectors/sha2.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: FileList 2 | Name: SHA2 FIPS 180 collection 3 | Test: TestVectors/sha2_224_fips_180.txt 4 | Test: TestVectors/sha2_256_fips_180.txt 5 | Test: TestVectors/sha2_384_fips_180.txt 6 | Test: TestVectors/sha2_512_fips_180.txt 7 | -------------------------------------------------------------------------------- /TestVectors/sha2_fips_180.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: FileList 2 | Name: SHA2 FIPS 180 collection 3 | Test: TestVectors/sha2_224_fips_180.txt 4 | Test: TestVectors/sha2_256_fips_180.txt 5 | Test: TestVectors/sha2_384_fips_180.txt 6 | Test: TestVectors/sha2_512_fips_180.txt 7 | -------------------------------------------------------------------------------- /TestVectors/sha3.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: FileList 2 | Name: SHA3 FIPS 202 collection 3 | Test: TestVectors/sha3_224_fips_202.txt 4 | Test: TestVectors/sha3_256_fips_202.txt 5 | Test: TestVectors/sha3_384_fips_202.txt 6 | Test: TestVectors/sha3_512_fips_202.txt 7 | -------------------------------------------------------------------------------- /TestVectors/sha3_fips_202.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: FileList 2 | Name: SHA3 FIPS 202 collection 3 | Test: TestVectors/sha3_224_fips_202.txt 4 | Test: TestVectors/sha3_256_fips_202.txt 5 | Test: TestVectors/sha3_384_fips_202.txt 6 | Test: TestVectors/sha3_512_fips_202.txt 7 | -------------------------------------------------------------------------------- /TestVectors/sosemanuk.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: SymmetricCipher 2 | Source: Sosemanuk reference implementation, compiled with -DSOSEMANUK_VECTOR 3 | Key: A7C083FEB7 4 | IV: 00112233445566778899AABBCCDDEEFF 5 | Name: Sosemanuk 6 | Plaintext: r160 00 7 | Ciphertext: \ 8 | FE 81 D2 16 2C 9A 10 0D 04 89 5C 45 4A 77 51 5B\ 9 | BE 6A 43 1A 93 5C B9 0E 22 21 EB B7 EF 50 23 28\ 10 | 94 35 39 49 2E FF 63 10 C8 71 05 4C 28 89 CC 72\ 11 | 8F 82 E8 6B 1A FF F4 33 4B 61 27 A1 3A 15 5C 75\ 12 | 15 16 30 BD 48 2E B6 73 FF 5D B4 77 FA 6C 53 EB\ 13 | E1 A4 EC 38 C2 3C 54 00 C3 15 45 5D 93 A2 AC ED\ 14 | 95 98 60 47 27 FA 34 0D 5F 2A 8B D7 57 B7 78 33\ 15 | F7 4B D2 BC 04 93 13 C8 06 16 B4 A0 62 68 AE 35\ 16 | 0D B9 2E EC 4F A5 6C 17 13 74 A6 7A 80 C0 06 D0\ 17 | EA D0 48 CE 7B 64 0F 17 D3 D5 A6 2D 1F 25 1C 21 18 | Test: Encrypt 19 | Source: http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/sosemanuk/unverified.test-vectors?rev=189&view=auto 20 | Comment: Set 6, vector# 3 21 | Key: 0F62B5085BAE0154A7FA4DA0F34699EC3F92E5388BDE3184D72A7DD02376C91C 22 | IV: 288FF65DC42B92F960C72E95FC63CA31 23 | Plaintext: r131072 00 24 | CiphertextXorDigest: CC09FB7405DD54BBF09407B1D2033FBBAC53F388DD387A46F2B8FCFF692A7838353523A621A55D08DA0CA5348AE96D8B0D6A028F309982EF6628054D01B9A368 25 | Test: EncryptXorDigest 26 | -------------------------------------------------------------------------------- /TestVectors/ttmac.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: MAC 2 | Name: Two-Track-MAC 3 | Source: NESSIE submission 4 | Comment: Key for all test cases 5 | Key: 00112233445566778899aabbccddeeff01234567 6 | Comment: Test Case 1 7 | Message: "" 8 | MAC: 2dec8ed4a0fd712ed9fbf2ab466ec2df21215e4a 9 | Test: Verify 10 | Comment: Test Case 2 11 | Message: "a" 12 | MAC: 5893e3e6e306704dd77ad6e6ed432cde321a7756 13 | Test: Verify 14 | Comment: Test Case 3 15 | Message: "abc" 16 | MAC: 70bfd1029797a5c16da5b557a1f0b2779b78497e 17 | Test: Verify 18 | Comment: Test Case 4 19 | Message: "message digest" 20 | MAC: 8289f4f19ffe4f2af737de4bd71c829d93a972fa 21 | Test: Verify 22 | Comment: Test Case 5 23 | Message: "abcdefghijklmnopqrstuvwxyz" 24 | MAC: 2186ca09c5533198b7371f245273504ca92bae60 25 | Test: Verify 26 | Comment: Test Case 6 27 | Message: "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" 28 | MAC: 8a7bf77aef62a2578497a27c0d6518a429e7c14d 29 | Test: Verify 30 | Comment: Test Case 7 31 | Message: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 32 | MAC: 54bac392a886806d169556fcbb6789b54fb364fb 33 | Test: Verify 34 | Comment: Test Case 8 35 | Message: r8 "1234567890" 36 | MAC: 0ced2c9f8f0d9d03981ab5c8184bac43dd54c484 37 | Test: Verify 38 | Comment: Test Case 9 39 | Message: r15625 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 40 | MAC: 27b3aedb5df8b629f0142194daa3846e1895f3d2 41 | -------------------------------------------------------------------------------- /TestVectors/vmac.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: MAC 2 | Name: VMAC(AES)-64 3 | Source: http://www.fastcrypto.org/vmac/draft-krovetz-vmac-01.txt 4 | Key: "abcdefghijklmnop" 5 | IV: "bcdefghi" 6 | Message: "" 7 | MAC: 2576BE1C56D8B81B 8 | Test: Verify 9 | Message: "abc" 10 | MAC: 2D376CF5B1813CE5 11 | Test: Verify 12 | Message: r16 "abc" 13 | MAC: E8421F61D573D298 14 | Test: Verify 15 | Message: r100 "abc" 16 | MAC: 4492DF6C5CAC1BBE 17 | Test: Verify 18 | Message: r1000000 "abc" 19 | MAC: 09BA597DD7601113 20 | Test: Verify 21 | Message: r42 "abc" "ab" 22 | MAC: D638B73921F184DE 23 | Test: Verify 24 | Message: r170 "abc" "ab" 25 | MAC: 9DA310281E6FD0A0 26 | Test: Verify 27 | Message: r65 "a" 28 | MAC: 90 ea 57 cb 51 bc 92 a3 29 | Test: Verify 30 | Message: r129 "a" 31 | MAC: 86 34 83 87 d1 3d 82 33 32 | Test: Verify 33 | Message: r65 "abc" 34 | MAC: E86A86EC77A8BF61 35 | Test: Verify 36 | Message: "abc" 37 | MAC: 2D376CF5B1813CE0 38 | Test: NotVerify 39 | 40 | AlgorithmType: MAC 41 | Name: VMAC(AES)-128 42 | Source: http://www.fastcrypto.org/vmac/draft-krovetz-vmac-01.txt 43 | Key: "abcdefghijklmnop" 44 | IV: "bcdefghi" 45 | Message: "" 46 | MAC: 472766C70F74ED23481D6D7DE4E80DAC 47 | Test: Verify 48 | Message: "abc" 49 | MAC: 4EE815A06A1D71EDD36FC75D51188A42 50 | Test: Verify 51 | Message: r16 "abc" 52 | MAC: 09F2C80C8E1007A0C12FAE19FE4504AE 53 | Test: Verify 54 | Message: r100 "abc" 55 | MAC: 66438817154850C61D8A412164803BCB 56 | Test: Verify 57 | Message: r1000000 "abc" 58 | MAC: 2B6B02288FFC461B75485DE893C629DC 59 | Test: Verify 60 | Message: r42 "abc" "ab" 61 | MAC: F7E95FE3DA8DB9E6BB973E65D0B4CEA5 62 | Test: Verify 63 | Message: r170 "abc" "ab" 64 | MAC: BF53B8D2D70C05A85880C2E21CAF1299 65 | Test: Verify 66 | Message: r65 "a" 67 | MAC: b2 9b 00 76 0a 58 c7 ab 92 d6 60 24 d6 9c 1b 92 68 | Test: Verify 69 | Message: r129 "a" 70 | MAC: a7 e5 2c 32 89 d9 b7 3b 53 57 6f 05 95 85 ee 79 71 | Test: Verify 72 | Message: r65 "abc" 73 | MAC: 0A1B2F973044F469F405917E45010334 74 | Test: Verify 75 | Message: "abc" 76 | MAC: 4EE815A06A1D71EDD36FC75D51188A40 77 | Test: NotVerify 78 | -------------------------------------------------------------------------------- /TestVectors/wake.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: SymmetricCipher 2 | Source: Generated by Crypto++ 5.6.1 3 | Key: r2 00112233445566778899AABBCCDDEEFF 4 | Plaintext: r80 00 r80 01 5 | Name: WAKE-OFB-LE 6 | Ciphertext: FFEEDDCCDF42B9D4939C351568AB4888BD9264CA66CF7F7885141F6934F3F390F1987B8609B733919DC5F73F7BED93ECDCD4F35FF32828553B8AFAD113DDA6565932553D9143AA886AE859167327F3C260434E6C90A0895FD33E6B6412526521FA0B12F4ECEE3E8F4F96DCF70907AAFB5E29C40FC10EB70A4970736E98DF98C615AC844A46FB8E4AEBBBF599DF7B73930B94776C6C8757BE51B34E71E9B514AE 7 | Test: Encrypt 8 | Name: WAKE-OFB-BE 9 | Ciphertext: CCDDEEFFD4B942DF15359C938848AB68CA6492BD787FCF66691F148590F3F334867B98F19133B7093FF7C59DEC93ED7B5FF3D4DC552828F3D1FA8A3B56A6DD133D55325988AA43911659E86AC2F327736C4E43605F89A090646B3ED321655212F4120BFA8F3EEEECF7DC964FFBAA07090FC4295E0AB70EC16E737049C698DF984A84AC154A8EFB4699F5BBEB93737BDF6C77940BBE57876C714EB351AE14B5E9 10 | Test: Encrypt 11 | -------------------------------------------------------------------------------- /TestVectors/whrlpool.txt: -------------------------------------------------------------------------------- 1 | AlgorithmType: MessageDigest 2 | Name: Whirlpool 3 | Source: ISO test vectors in http://planeta.terra.com.br/informatica/paulobarreto/whirlpool.zip 4 | Message: "" 5 | Digest: 19FA61D75522A466 9B44E39C1D2E1726 C530232130D407F8 9AFEE0964997F7A7\ 6 | 3E83BE698B288FEB CF88E3E03C4F0757 EA8964E59B63D937 08B138CC42A66EB3 7 | Test: Verify 8 | Message: "a" 9 | Digest: 8ACA2602792AEC6F 11A67206531FB7D7 F0DFF59413145E69 73C45001D0087B42\ 10 | D11BC645413AEFF6 3A42391A39145A59 1A92200D560195E5 3B478584FDAE231A 11 | Test: Verify 12 | Message: "abc" 13 | Digest: 4E2448A4C6F486BB 16B6562C73B4020B F3043E3A731BCE72 1AE1B303D97E6D4C\ 14 | 7181EEBDB6C57E27 7D0E34957114CBD6 C797FC9D95D8B582 D225292076D4EEF5 15 | Test: Verify 16 | Message: "message digest" 17 | Digest: 378C84A4126E2DC6 E56DCC7458377AAC 838D00032230F53C E1F5700C0FFB4D3B\ 18 | 8421557659EF55C1 06B4B52AC5A4AAA6 92ED920052838F33 62E86DBD37A8903E 19 | Test: Verify 20 | Message: "abcdefghijklmnopqrstuvwxyz" 21 | Digest: F1D754662636FFE9 2C82EBB9212A484A 8D38631EAD4238F5 442EE13B8054E41B\ 22 | 08BF2A9251C30B6A 0B8AAE86177AB4A6 F68F673E7207865D 5D9819A3DBA4EB3B 23 | Test: Verify 24 | Message: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 25 | Digest: DC37E008CF9EE69B F11F00ED9ABA2690 1DD7C28CDEC066CC 6AF42E40F82F3A1E\ 26 | 08EBA26629129D8F B7CB57211B9281A6 5517CC879D7B9621 42C65F5A7AF01467 27 | Test: Verify 28 | Message: r8 "1234567890" 29 | Digest: 466EF18BABB0154D 25B9D38A6414F5C0 8784372BCCB204D6 549C4AFADB601429\ 30 | 4D5BD8DF2A6C44E5 38CD047B2681A51A 2C60481E88C5A20B 2C2A80CF3A9A083B 31 | Test: Verify 32 | Message: "abcdbcdecdefdefgefghfghighijhijk" 33 | Digest: 2A987EA40F917061 F5D6F0A0E4644F48 8A7A5A52DEEE6562 07C562F988E95C69\ 34 | 16BDC8031BC5BE1B 7B947639FE050B56 939BAAA0ADFF9AE6 745B7B181C3BE3FD 35 | Test: Verify 36 | Message: r1000000 "a" 37 | Digest: 0C99005BEB57EFF5 0A7CF005560DDF5D 29057FD86B20BFD6 2DECA0F1CCEA4AF5\ 38 | 1FC15490EDDC47AF 32BB2B66C34FF9AD 8C6008AD677F7712 6953B226E4ED8B01 39 | Test: Verify 40 | -------------------------------------------------------------------------------- /adhoc.cpp.proto: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | 5 | #if CRYPTOPP_MSC_VERSION 6 | # pragma warning(disable: 4189 4996) 7 | #endif 8 | 9 | USING_NAMESPACE(CryptoPP) 10 | USING_NAMESPACE(std) 11 | 12 | #ifndef CRYPTOPP_UNUSED 13 | # define CRYPTOPP_UNUSED(x) (void(x)) 14 | #endif 15 | 16 | // Used for testing the compiler and linker in cryptest.sh 17 | #if defined(CRYPTOPP_ADHOC_MAIN) || defined(ADHOC_MAIN) 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | CRYPTOPP_UNUSED(argc), CRYPTOPP_UNUSED(argv); 22 | return 0; 23 | } 24 | 25 | // Classic use of adhoc to setup calling convention 26 | #else 27 | 28 | extern int (*AdhocTest)(int argc, char *argv[]); 29 | 30 | int MyAdhocTest(int argc, char *argv[]) 31 | { 32 | CRYPTOPP_UNUSED(argc), CRYPTOPP_UNUSED(argv); 33 | return 0; 34 | } 35 | 36 | static int s_i = (AdhocTest = &MyAdhocTest, 0); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /adler32.cpp: -------------------------------------------------------------------------------- 1 | // adler32.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | #include "adler32.h" 5 | 6 | NAMESPACE_BEGIN(CryptoPP) 7 | 8 | void Adler32::Update(const byte *input, size_t length) 9 | { 10 | const unsigned long BASE = 65521; 11 | 12 | unsigned long s1 = m_s1; 13 | unsigned long s2 = m_s2; 14 | 15 | if (length % 8 != 0) 16 | { 17 | do 18 | { 19 | s1 += *input++; 20 | s2 += s1; 21 | length--; 22 | } while (length % 8 != 0); 23 | 24 | if (s1 >= BASE) 25 | s1 -= BASE; 26 | s2 %= BASE; 27 | } 28 | 29 | while (length > 0) 30 | { 31 | s1 += input[0]; s2 += s1; 32 | s1 += input[1]; s2 += s1; 33 | s1 += input[2]; s2 += s1; 34 | s1 += input[3]; s2 += s1; 35 | s1 += input[4]; s2 += s1; 36 | s1 += input[5]; s2 += s1; 37 | s1 += input[6]; s2 += s1; 38 | s1 += input[7]; s2 += s1; 39 | 40 | length -= 8; 41 | input += 8; 42 | 43 | if (s1 >= BASE) 44 | s1 -= BASE; 45 | if (length % 0x8000 == 0) 46 | s2 %= BASE; 47 | } 48 | 49 | CRYPTOPP_ASSERT(s1 < BASE); 50 | CRYPTOPP_ASSERT(s2 < BASE); 51 | 52 | m_s1 = (word16)s1; 53 | m_s2 = (word16)s2; 54 | } 55 | 56 | void Adler32::TruncatedFinal(byte *hash, size_t size) 57 | { 58 | ThrowIfInvalidTruncatedSize(size); 59 | 60 | switch (size) 61 | { 62 | default: 63 | hash[3] = byte(m_s1); 64 | // fall through 65 | case 3: 66 | hash[2] = byte(m_s1 >> 8); 67 | // fall through 68 | case 2: 69 | hash[1] = byte(m_s2); 70 | // fall through 71 | case 1: 72 | hash[0] = byte(m_s2 >> 8); 73 | // fall through 74 | case 0: 75 | ; 76 | // fall through 77 | } 78 | 79 | Reset(); 80 | } 81 | 82 | NAMESPACE_END 83 | -------------------------------------------------------------------------------- /adler32.h: -------------------------------------------------------------------------------- 1 | // adler32.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file adler32.h 4 | /// \brief Class file for ADLER-32 checksum calculations 5 | 6 | #ifndef CRYPTOPP_ADLER32_H 7 | #define CRYPTOPP_ADLER32_H 8 | 9 | #include "cryptlib.h" 10 | 11 | NAMESPACE_BEGIN(CryptoPP) 12 | 13 | /// ADLER-32 checksum calculations 14 | class Adler32 : public HashTransformation 15 | { 16 | public: 17 | CRYPTOPP_CONSTANT(DIGESTSIZE = 4); 18 | Adler32() {Reset();} 19 | void Update(const byte *input, size_t length); 20 | void TruncatedFinal(byte *hash, size_t size); 21 | unsigned int DigestSize() const {return DIGESTSIZE;} 22 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Adler32";} 23 | std::string AlgorithmName() const {return StaticAlgorithmName();} 24 | 25 | private: 26 | void Reset() {m_s1 = 1; m_s2 = 0;} 27 | 28 | word16 m_s1, m_s2; 29 | }; 30 | 31 | NAMESPACE_END 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /aes.h: -------------------------------------------------------------------------------- 1 | // aes.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file 4 | /// \brief Class file for the AES cipher (Rijndael) 5 | /// \details AES is a typdef for Rijndael classes. All key sizes are supported. 6 | /// The library only provides Rijndael with 128-bit blocks, and not 192-bit or 256-bit blocks 7 | /// \since Rijndael since Crypto++ 3.1, Intel AES-NI since Crypto++ 5.6.1, ARMv8 AES since Crypto++ 6.0, 8 | /// Power8 AES since Crypto++ 6.0 9 | 10 | #ifndef CRYPTOPP_AES_H 11 | #define CRYPTOPP_AES_H 12 | 13 | #include "rijndael.h" 14 | 15 | NAMESPACE_BEGIN(CryptoPP) 16 | 17 | /// \brief AES block cipher (Rijndael) 18 | /// \details AES is a typdef for Rijndael classes. All key sizes are supported. 19 | /// The library only provides Rijndael with 128-bit blocks, and not 192-bit or 256-bit blocks 20 | /// \sa AES winner, announced on 10/2/2000 21 | /// \since Rijndael since Crypto++ 3.1, Intel AES-NI since Crypto++ 5.6.1, ARMv8 AES since Crypto++ 6.0, 22 | /// Power8 AES since Crypto++ 6.0 23 | DOCUMENTED_TYPEDEF(Rijndael, AES); 24 | 25 | typedef RijndaelEncryption AESEncryption; 26 | typedef RijndaelDecryption AESDecryption; 27 | 28 | NAMESPACE_END 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /aes_armv4.h: -------------------------------------------------------------------------------- 1 | /* Header file for use with Cryptogam's ARMv4 AES. */ 2 | /* Also see http://www.openssl.org/~appro/cryptogams/ and */ 3 | /* https://wiki.openssl.org/index.php?title=Cryptogams_AES */ 4 | 5 | #ifndef CRYPTOGAMS_AES_ARMV4_H 6 | #define CRYPTOGAMS_AES_ARMV4_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | //#define AES_MAXNR 14 13 | //typedef struct AES_KEY_st { 14 | // unsigned int rd_key[4 * (AES_MAXNR + 1)]; 15 | // int rounds; 16 | //} AES_KEY; 17 | 18 | // Instead of AES_KEY we use a 'word32 rkey[4*15+4]'. It has space for 19 | // both the AES_MAXNR round keys and the number of rounds in the tail. 20 | 21 | int cryptogams_AES_set_encrypt_key(const unsigned char *userKey, const int bits, unsigned int *rkey); 22 | int cryptogams_AES_set_decrypt_key(const unsigned char *userKey, const int bits, unsigned int *rkey); 23 | void cryptogams_AES_encrypt_block(const unsigned char *in, unsigned char *out, const unsigned int *rkey); 24 | void cryptogams_AES_decrypt_block(const unsigned char *in, unsigned char *out, const unsigned int *rkey); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif /* CRYPTOGAMS_AES_ARMV4_H */ 31 | -------------------------------------------------------------------------------- /bds10.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noloader/cryptopp/1e20219ecddc64cf23e04f5cb990c49e1b0074c3/bds10.zip -------------------------------------------------------------------------------- /blowfish.h: -------------------------------------------------------------------------------- 1 | // blowfish.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file blowfish.h 4 | /// \brief Classes for the Blowfish block cipher 5 | 6 | #ifndef CRYPTOPP_BLOWFISH_H 7 | #define CRYPTOPP_BLOWFISH_H 8 | 9 | #include "seckey.h" 10 | #include "secblock.h" 11 | 12 | NAMESPACE_BEGIN(CryptoPP) 13 | 14 | /// \brief Blowfish block cipher information 15 | struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 4, 56>, public FixedRounds<16> 16 | { 17 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Blowfish";} 18 | }; 19 | 20 | // Blowfish 21 | 22 | /// \brief Blowfish block cipher 23 | /// \since Crypto++ 1.0 24 | class Blowfish : public Blowfish_Info, public BlockCipherDocumentation 25 | { 26 | /// \brief Class specific implementation and overrides used to operate the cipher. 27 | /// \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions 28 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 29 | { 30 | public: 31 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 32 | void UncheckedSetKey(const byte *key_string, unsigned int keylength, const NameValuePairs ¶ms); 33 | 34 | private: 35 | void crypt_block(const word32 in[2], word32 out[2]) const; 36 | 37 | static const word32 p_init[ROUNDS+2]; 38 | static const word32 s_init[4*256]; 39 | 40 | FixedSizeSecBlock pbox; 41 | FixedSizeSecBlock sbox; 42 | }; 43 | 44 | public: 45 | typedef BlockCipherFinal Encryption; 46 | typedef BlockCipherFinal Decryption; 47 | }; 48 | 49 | typedef Blowfish::Encryption BlowfishEncryption; 50 | typedef Blowfish::Decryption BlowfishDecryption; 51 | 52 | NAMESPACE_END 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /blumshub.cpp: -------------------------------------------------------------------------------- 1 | // blumshub.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | #include "blumshub.h" 5 | #include "integer.h" 6 | 7 | NAMESPACE_BEGIN(CryptoPP) 8 | 9 | PublicBlumBlumShub::PublicBlumBlumShub(const Integer &n, const Integer &seed) 10 | : modn(n), 11 | current(modn.Square(modn.Square(seed))), 12 | maxBits(BitPrecision(n.BitCount())-1), 13 | bitsLeft(maxBits) 14 | { 15 | } 16 | 17 | unsigned int PublicBlumBlumShub::GenerateBit() 18 | { 19 | if (bitsLeft==0) 20 | { 21 | current = modn.Square(current); 22 | bitsLeft = maxBits; 23 | } 24 | 25 | return static_cast(current.GetBit(--bitsLeft)); 26 | } 27 | 28 | byte PublicBlumBlumShub::GenerateByte() 29 | { 30 | byte b=0; 31 | for (int i=0; i<8; i++) 32 | b = byte((b << 1) | PublicBlumBlumShub::GenerateBit()); 33 | return b; 34 | } 35 | 36 | void PublicBlumBlumShub::GenerateBlock(byte *output, size_t size) 37 | { 38 | while (size--) 39 | *output++ = PublicBlumBlumShub::GenerateByte(); 40 | } 41 | 42 | void PublicBlumBlumShub::ProcessData(byte *outString, const byte *inString, size_t length) 43 | { 44 | while (length--) 45 | *outString++ = *inString++ ^ PublicBlumBlumShub::GenerateByte(); 46 | } 47 | 48 | BlumBlumShub::BlumBlumShub(const Integer &p, const Integer &q, const Integer &seed) 49 | : PublicBlumBlumShub(p*q, seed), 50 | p(p), q(q), 51 | x0(modn.Square(seed)) 52 | { 53 | } 54 | 55 | void BlumBlumShub::Seek(lword index) 56 | { 57 | Integer i(Integer::POSITIVE, index); 58 | i *= 8; 59 | Integer e = a_exp_b_mod_c (2, i / maxBits + 1, (p-1)*(q-1)); 60 | current = modn.Exponentiate(x0, e); 61 | bitsLeft = maxBits - i % maxBits; 62 | } 63 | 64 | NAMESPACE_END 65 | -------------------------------------------------------------------------------- /blumshub.h: -------------------------------------------------------------------------------- 1 | // blumshub.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file blumshub.h 4 | /// \brief Classes for Blum Blum Shub generator 5 | 6 | #ifndef CRYPTOPP_BLUMSHUB_H 7 | #define CRYPTOPP_BLUMSHUB_H 8 | 9 | #include "cryptlib.h" 10 | #include "modarith.h" 11 | #include "integer.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief BlumBlumShub without factorization of the modulus 16 | /// \details You should reseed the generator after a fork() to avoid multiple generators 17 | /// with the same internal state. 18 | class PublicBlumBlumShub : public RandomNumberGenerator, 19 | public StreamTransformation 20 | { 21 | public: 22 | virtual ~PublicBlumBlumShub() {} 23 | 24 | /// \brief Construct a PublicBlumBlumShub 25 | /// \param n the modulus 26 | /// \param seed the seed for the generator 27 | /// \details seed is the secret key and should be about as large as n. 28 | PublicBlumBlumShub(const Integer &n, const Integer &seed); 29 | 30 | unsigned int GenerateBit(); 31 | byte GenerateByte(); 32 | void GenerateBlock(byte *output, size_t size); 33 | void ProcessData(byte *outString, const byte *inString, size_t length); 34 | 35 | bool IsSelfInverting() const {return true;} 36 | bool IsForwardTransformation() const {return true;} 37 | 38 | protected: 39 | ModularArithmetic modn; 40 | Integer current; 41 | word maxBits, bitsLeft; 42 | }; 43 | 44 | /// \brief BlumBlumShub with factorization of the modulus 45 | /// \details You should reseed the generator after a fork() to avoid multiple generators 46 | /// with the same internal state. 47 | class BlumBlumShub : public PublicBlumBlumShub 48 | { 49 | public: 50 | virtual ~BlumBlumShub() {} 51 | 52 | /// \brief Construct a BlumBlumShub 53 | /// \param p the first prime factor 54 | /// \param q the second prime factor 55 | /// \param seed the seed for the generator 56 | /// \details Esure p and q are both primes congruent to 3 mod 4 and at least 512 bits long. 57 | /// seed is the secret key and should be about as large as p*q. 58 | BlumBlumShub(const Integer &p, const Integer &q, const Integer &seed); 59 | 60 | bool IsRandomAccess() const {return true;} 61 | void Seek(lword index); 62 | 63 | protected: 64 | const Integer p, q; 65 | const Integer x0; 66 | }; 67 | 68 | NAMESPACE_END 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /camellia.h: -------------------------------------------------------------------------------- 1 | // camellia.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file camellia.h 4 | /// \brief Classes for the Camellia block cipher 5 | 6 | #ifndef CRYPTOPP_CAMELLIA_H 7 | #define CRYPTOPP_CAMELLIA_H 8 | 9 | #include "config.h" 10 | #include "seckey.h" 11 | #include "secblock.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief Camellia block cipher information 16 | struct Camellia_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8> 17 | { 18 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Camellia";} 19 | }; 20 | 21 | /// \brief Camellia block cipher 22 | /// \sa Camellia 23 | class Camellia : public Camellia_Info, public BlockCipherDocumentation 24 | { 25 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 26 | { 27 | public: 28 | void UncheckedSetKey(const byte *key, unsigned int keylen, const NameValuePairs ¶ms); 29 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 30 | 31 | protected: 32 | CRYPTOPP_ALIGN_DATA(4) static const byte s1[256]; 33 | static const word32 SP[4][256]; 34 | 35 | unsigned int m_rounds; 36 | SecBlock m_key; 37 | }; 38 | 39 | public: 40 | typedef BlockCipherFinal Encryption; 41 | typedef BlockCipherFinal Decryption; 42 | }; 43 | 44 | typedef Camellia::Encryption CamelliaEncryption; 45 | typedef Camellia::Decryption CamelliaDecryption; 46 | 47 | NAMESPACE_END 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /cbcmac.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | #ifndef CRYPTOPP_IMPORTS 4 | 5 | #include "cbcmac.h" 6 | 7 | NAMESPACE_BEGIN(CryptoPP) 8 | 9 | void CBC_MAC_Base::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) 10 | { 11 | AccessCipher().SetKey(key, length, params); 12 | m_reg.CleanNew(AccessCipher().BlockSize()); 13 | m_counter = 0; 14 | } 15 | 16 | void CBC_MAC_Base::Update(const byte *input, size_t length) 17 | { 18 | unsigned int blockSize = AccessCipher().BlockSize(); 19 | 20 | while (m_counter && length) 21 | { 22 | m_reg[m_counter++] ^= *input++; 23 | if (m_counter == blockSize) 24 | ProcessBuf(); 25 | length--; 26 | } 27 | 28 | if (length >= blockSize) 29 | { 30 | size_t leftOver = AccessCipher().AdvancedProcessBlocks(m_reg, input, m_reg, length, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput); 31 | input += (length - leftOver); 32 | length = leftOver; 33 | } 34 | 35 | while (length--) 36 | { 37 | m_reg[m_counter++] ^= *input++; 38 | if (m_counter == blockSize) 39 | ProcessBuf(); 40 | } 41 | } 42 | 43 | void CBC_MAC_Base::TruncatedFinal(byte *mac, size_t size) 44 | { 45 | ThrowIfInvalidTruncatedSize(size); 46 | 47 | if (m_counter) 48 | ProcessBuf(); 49 | 50 | std::memcpy(mac, m_reg, size); 51 | std::memset(m_reg, 0, AccessCipher().BlockSize()); 52 | } 53 | 54 | void CBC_MAC_Base::ProcessBuf() 55 | { 56 | AccessCipher().ProcessBlock(m_reg); 57 | m_counter = 0; 58 | } 59 | 60 | NAMESPACE_END 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /cbcmac.h: -------------------------------------------------------------------------------- 1 | // cbcmac.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file 4 | /// \brief Classes for CBC MAC 5 | /// \since Crypto++ 3.1 6 | 7 | #ifndef CRYPTOPP_CBCMAC_H 8 | #define CRYPTOPP_CBCMAC_H 9 | 10 | #include "seckey.h" 11 | #include "secblock.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief CBC-MAC base class 16 | /// \since Crypto++ 3.1 17 | class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_MAC_Base : public MessageAuthenticationCode 18 | { 19 | public: 20 | CBC_MAC_Base() : m_counter(0) {} 21 | 22 | void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); 23 | void Update(const byte *input, size_t length); 24 | void TruncatedFinal(byte *mac, size_t size); 25 | unsigned int DigestSize() const {return const_cast(this)->AccessCipher().BlockSize();} 26 | 27 | protected: 28 | virtual BlockCipher & AccessCipher() =0; 29 | 30 | private: 31 | void ProcessBuf(); 32 | SecByteBlock m_reg; 33 | unsigned int m_counter; 34 | }; 35 | 36 | /// \brief CBC-MAC 37 | /// \tparam T BlockCipherDocumentation derived class 38 | /// \details CBC-MAC is compatible with FIPS 113. The MAC is secure only for fixed 39 | /// length messages. For variable length messages use CMAC or DMAC. 40 | /// \sa CBC-MAC 41 | /// \since Crypto++ 3.1 42 | template 43 | class CBC_MAC : public MessageAuthenticationCodeImpl >, public SameKeyLengthAs 44 | { 45 | public: 46 | /// \brief Construct a CBC_MAC 47 | CBC_MAC() {} 48 | /// \brief Construct a CBC_MAC 49 | /// \param key a byte buffer used to key the cipher 50 | /// \param length the length of the byte buffer 51 | CBC_MAC(const byte *key, size_t length=SameKeyLengthAs::DEFAULT_KEYLENGTH) 52 | {this->SetKey(key, length);} 53 | 54 | static std::string StaticAlgorithmName() {return std::string("CBC-MAC(") + T::StaticAlgorithmName() + ")";} 55 | 56 | private: 57 | BlockCipher & AccessCipher() {return m_cipher;} 58 | typename T::Encryption m_cipher; 59 | }; 60 | 61 | NAMESPACE_END 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- 1 | // config.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file config.h 4 | /// \brief Library configuration file 5 | /// \details config.h was split into components in May 2019 to better 6 | /// integrate with Autoconf and its feature tests. The splitting occurred so 7 | /// users could continue to include config.h while allowing Autoconf 8 | /// to write new config_asm.h and new config_cxx.h using 9 | /// its feature tests. 10 | /// \sa Issue 835, 11 | /// Make config.h more autoconf friendly, 12 | /// Configure.sh script 13 | /// on the Crypto++ wiki 14 | /// \since Crypto++ 8.3 15 | 16 | /// \file config.h 17 | /// \brief Library configuration file 18 | 19 | #ifndef CRYPTOPP_CONFIG_H 20 | #define CRYPTOPP_CONFIG_H 21 | 22 | #include "config_align.h" 23 | #include "config_asm.h" 24 | #include "config_cpu.h" 25 | #include "config_cxx.h" 26 | #include "config_dll.h" 27 | #include "config_int.h" 28 | #include "config_misc.h" 29 | #include "config_ns.h" 30 | #include "config_os.h" 31 | #include "config_ver.h" 32 | 33 | #endif // CRYPTOPP_CONFIG_H 34 | -------------------------------------------------------------------------------- /cpuid64.asm: -------------------------------------------------------------------------------- 1 | ;; https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention 2 | ;; The first four integer arguments are passed in registers. 3 | ;; Integer values are passed in left-to-right order in RCX, 4 | ;; RDX, R8, and R9, respectively. Arguments five and higher 5 | ;; are passed on the stack. 6 | 7 | ;; The registers RAX, RCX, RDX, R8, R9, R10, R11, XMM0-5, 8 | ;; and the upper portions of YMM0-15 and ZMM0-15 are 9 | ;; considered volatile and must be considered destroyed on 10 | ;; function calls. 11 | 12 | .CODE 13 | 14 | TITLE CPU features source file 15 | SUBTITLE Microsoft specific ASM code to utilize CPUID and XGETBV64 for down level Microsoft toolchains 16 | 17 | ;; http://www.agner.org/optimize/vectorclass/read.php?i=65 18 | ;; word64 Xgetbv(word32 ctrl) 19 | ;; ctrl = rcx 20 | 21 | ALIGN 8 22 | XGETBV64 PROC FRAME 23 | .endprolog 24 | ;; query 25 | DB 0fh, 01h, 0d0h 26 | ;; xcr = (EDX << 32) | EAX 27 | and rax, 0ffffffffh 28 | shl rdx, 32 29 | or rax, rdx 30 | ret 31 | XGETBV64 ENDP 32 | 33 | ;; word64 CpuId(word32 func, word32 subfunc, word32 output[4]) 34 | ;; func = rcx 35 | ;; subfunc = rdx 36 | ;; output = r8 37 | 38 | ALIGN 8 39 | CPUID64 PROC FRAME 40 | ;; preserve per ABI 41 | mov [rsp+8], rbx 42 | .savereg rbx, 8 43 | .endprolog 44 | ;; eax = func 45 | mov rax, rcx 46 | ;; ecx = subfunc 47 | mov rcx, rdx 48 | ;; query 49 | cpuid 50 | ;; save 51 | mov [r8+0], eax 52 | mov [r8+4], ebx 53 | mov [r8+8], ecx 54 | mov [r8+12], edx 55 | ;; return value 56 | mov rax, 1 57 | ;; restore 58 | mov rbx, [rsp+8] 59 | ret 60 | CPUID64 ENDP 61 | 62 | _TEXT ENDS 63 | END 64 | -------------------------------------------------------------------------------- /cryptest.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | v 5 | 6 | -------------------------------------------------------------------------------- /cryptopp.mapfile: -------------------------------------------------------------------------------- 1 | # Solaris mapfile to override hardware caps to avoid load-time kills. Thanks to Andrew Henle 2 | # for the mapfile version 1 syntax. Also see https://stackoverflow.com/q/53210019/608639 and 3 | # https://www.oracle.com/technetwork/server-storage/solaris/hwcap-modification-139536.html 4 | 5 | # Use this if you need $mapfile_version 1. Unfortunately, it does 6 | # not work. The linker does not remove hwcap_2 capabilities. 7 | # hwcap_1 = SSE SSE2 OVERRIDE; 8 | # hwcap_2 = V0x0; 9 | 10 | # This will clear all caps, but it does not work on Solaris 9 11 | $mapfile_version 2 12 | CAPABILITY { 13 | HW_1 = ; 14 | HW_2 = ; 15 | }; 16 | -------------------------------------------------------------------------------- /cryptopp.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noloader/cryptopp/1e20219ecddc64cf23e04f5cb990c49e1b0074c3/cryptopp.rc -------------------------------------------------------------------------------- /cryptopp.supp: -------------------------------------------------------------------------------- 1 | # Valgrind suppression file 2 | 3 | { 4 | # https://github.com/weidai11/cryptopp/issues/543 5 | __memcmp_sse4_1 6 | Memcheck:Cond 7 | fun:__memcmp_sse4_1 8 | } 9 | -------------------------------------------------------------------------------- /dh.cpp: -------------------------------------------------------------------------------- 1 | // dh.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | 5 | #ifndef CRYPTOPP_IMPORTS 6 | 7 | #include "dh.h" 8 | 9 | NAMESPACE_BEGIN(CryptoPP) 10 | 11 | #if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 12 | void DH_TestInstantiations() 13 | { 14 | DH dh1; 15 | DH dh2(NullRNG(), 10); 16 | } 17 | #endif 18 | 19 | NAMESPACE_END 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /dll.h: -------------------------------------------------------------------------------- 1 | // dll.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file dll.h 4 | /// \brief Functions and definitions required for building the FIPS-140 DLL on Windows 5 | 6 | #ifndef CRYPTOPP_DLL_H 7 | #define CRYPTOPP_DLL_H 8 | 9 | #if !defined(CRYPTOPP_IMPORTS) && !defined(CRYPTOPP_EXPORTS) && !defined(CRYPTOPP_DEFAULT_NO_DLL) 10 | #ifdef CRYPTOPP_CONFIG_H 11 | #error To use the DLL version of Crypto++, this file must be included before any other Crypto++ header files. 12 | #endif 13 | #define CRYPTOPP_IMPORTS 14 | #endif 15 | 16 | #include "aes.h" 17 | #include "cbcmac.h" 18 | #include "ccm.h" 19 | #include "cmac.h" 20 | #include "channels.h" 21 | #include "des.h" 22 | #include "dh.h" 23 | #include "dsa.h" 24 | #include "ec2n.h" 25 | #include "eccrypto.h" 26 | #include "ecp.h" 27 | #include "files.h" 28 | #include "fips140.h" 29 | #include "gcm.h" 30 | #include "hex.h" 31 | #include "hmac.h" 32 | #include "modes.h" 33 | #include "mqueue.h" 34 | #include "nbtheory.h" 35 | #include "osrng.h" 36 | #include "pkcspad.h" 37 | #include "pssr.h" 38 | #include "randpool.h" 39 | #include "rsa.h" 40 | #include "rw.h" 41 | #include "sha.h" 42 | #include "skipjack.h" 43 | 44 | #ifdef CRYPTOPP_IMPORTS 45 | 46 | #ifdef _DLL 47 | // cause CRT DLL to be initialized before Crypto++ so that we can use malloc and free during DllMain() 48 | #ifdef CRYPTOPP_DEBUG 49 | # pragma comment(lib, "msvcrtd") 50 | # pragma comment(lib, "cryptopp") 51 | #else 52 | # pragma comment(lib, "msvcrt") 53 | # pragma comment(lib, "cryptopp") 54 | #endif 55 | #endif 56 | 57 | #endif // #ifdef CRYPTOPP_IMPORTS 58 | 59 | #include // for new_handler 60 | 61 | NAMESPACE_BEGIN(CryptoPP) 62 | 63 | typedef void * (CRYPTOPP_API * PNew)(size_t); 64 | typedef void (CRYPTOPP_API * PDelete)(void *); 65 | typedef void (CRYPTOPP_API * PGetNewAndDelete)(PNew &, PDelete &); 66 | typedef std::new_handler (CRYPTOPP_API * PSetNewHandler)(std::new_handler); 67 | typedef void (CRYPTOPP_API * PSetNewAndDelete)(PNew, PDelete, PSetNewHandler); 68 | 69 | NAMESPACE_END 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /dlltest.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {d7fe0401-fa2d-40cd-80b9-b91f937996a3} 6 | .cpp 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /dsa.cpp: -------------------------------------------------------------------------------- 1 | // dsa.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | 5 | #ifndef CRYPTOPP_IMPORTS 6 | 7 | #include "dsa.h" 8 | #include "asn.h" 9 | #include "integer.h" 10 | #include "filters.h" 11 | #include "nbtheory.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | size_t DSAConvertSignatureFormat(byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat) 16 | { 17 | Integer r, s; 18 | StringStore store(signature, signatureLen); 19 | ArraySink sink(buffer, bufferSize); 20 | 21 | switch (fromFormat) 22 | { 23 | case DSA_P1363: 24 | r.Decode(store, signatureLen/2); 25 | s.Decode(store, signatureLen/2); 26 | break; 27 | case DSA_DER: 28 | { 29 | BERSequenceDecoder seq(store); 30 | r.BERDecode(seq); 31 | s.BERDecode(seq); 32 | seq.MessageEnd(); 33 | break; 34 | } 35 | case DSA_OPENPGP: 36 | r.OpenPGPDecode(store); 37 | s.OpenPGPDecode(store); 38 | break; 39 | } 40 | 41 | switch (toFormat) 42 | { 43 | case DSA_P1363: 44 | r.Encode(sink, bufferSize/2); 45 | s.Encode(sink, bufferSize/2); 46 | break; 47 | case DSA_DER: 48 | { 49 | DERSequenceEncoder seq(sink); 50 | r.DEREncode(seq); 51 | s.DEREncode(seq); 52 | seq.MessageEnd(); 53 | break; 54 | } 55 | case DSA_OPENPGP: 56 | r.OpenPGPEncode(sink); 57 | s.OpenPGPEncode(sink); 58 | break; 59 | } 60 | 61 | return (size_t)sink.TotalPutLength(); 62 | } 63 | 64 | NAMESPACE_END 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /eax.cpp: -------------------------------------------------------------------------------- 1 | // eax.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | #include "eax.h" 5 | 6 | NAMESPACE_BEGIN(CryptoPP) 7 | 8 | void EAX_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms) 9 | { 10 | AccessMAC().SetKey(userKey, keylength, params); 11 | m_buffer.New(2*AccessMAC().TagSize()); 12 | } 13 | 14 | void EAX_Base::Resync(const byte *iv, size_t len) 15 | { 16 | MessageAuthenticationCode &mac = AccessMAC(); 17 | unsigned int blockSize = mac.TagSize(); 18 | 19 | std::memset(m_buffer, 0, blockSize); 20 | mac.Update(m_buffer, blockSize); 21 | mac.CalculateDigest(m_buffer+blockSize, iv, len); 22 | 23 | m_buffer[blockSize-1] = 1; 24 | mac.Update(m_buffer, blockSize); 25 | 26 | m_ctr.SetCipherWithIV(AccessMAC().AccessCipher(), m_buffer+blockSize, blockSize); 27 | } 28 | 29 | size_t EAX_Base::AuthenticateBlocks(const byte *data, size_t len) 30 | { 31 | AccessMAC().Update(data, len); 32 | return 0; 33 | } 34 | 35 | void EAX_Base::AuthenticateLastHeaderBlock() 36 | { 37 | CRYPTOPP_ASSERT(m_bufferedDataLength == 0); 38 | MessageAuthenticationCode &mac = AccessMAC(); 39 | const unsigned int blockSize = mac.TagSize(); 40 | 41 | mac.Final(m_buffer); 42 | xorbuf(m_buffer+blockSize, m_buffer, blockSize); 43 | 44 | std::memset(m_buffer, 0, blockSize); 45 | m_buffer[blockSize-1] = 2; 46 | mac.Update(m_buffer, blockSize); 47 | } 48 | 49 | void EAX_Base::AuthenticateLastFooterBlock(byte *tag, size_t macSize) 50 | { 51 | CRYPTOPP_ASSERT(m_bufferedDataLength == 0); 52 | MessageAuthenticationCode &mac = AccessMAC(); 53 | unsigned int blockSize = mac.TagSize(); 54 | 55 | mac.TruncatedFinal(m_buffer, macSize); 56 | xorbuf(tag, m_buffer, m_buffer+blockSize, macSize); 57 | } 58 | 59 | NAMESPACE_END 60 | -------------------------------------------------------------------------------- /elgamal.cpp: -------------------------------------------------------------------------------- 1 | // elgamal.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | #include "elgamal.h" 5 | #include "asn.h" 6 | #include "nbtheory.h" 7 | 8 | // Squash MS LNK4221 and libtool warnings 9 | extern const char ELGAMAL_FNAME[] = __FILE__; 10 | 11 | NAMESPACE_BEGIN(CryptoPP) 12 | 13 | #if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 14 | void ElGamal_TestInstantiations() 15 | { 16 | ElGamalEncryptor test1(1, 1, 1); 17 | ElGamalDecryptor test2(NullRNG(), 123); 18 | ElGamalEncryptor test3(test2); 19 | } 20 | #endif 21 | 22 | NAMESPACE_END 23 | -------------------------------------------------------------------------------- /emsa2.cpp: -------------------------------------------------------------------------------- 1 | // emsa2.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | #include "emsa2.h" 5 | 6 | #ifndef CRYPTOPP_IMPORTS 7 | 8 | NAMESPACE_BEGIN(CryptoPP) 9 | 10 | // Inclusion based on DLL due to Clang, http://github.com/weidai11/cryptopp/issues/300 11 | #ifndef CRYPTOPP_IS_DLL 12 | template<> const byte EMSA2HashId::id = 0x33; 13 | template<> const byte EMSA2HashId::id = 0x38; 14 | template<> const byte EMSA2HashId::id = 0x34; 15 | template<> const byte EMSA2HashId::id = 0x36; 16 | template<> const byte EMSA2HashId::id = 0x35; 17 | #endif 18 | 19 | void EMSA2Pad::ComputeMessageRepresentative(RandomNumberGenerator& /*rng*/, 20 | const byte* recoverableMessage, size_t recoverableMessageLength, 21 | HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty, 22 | byte *representative, size_t representativeBitLength) const 23 | { 24 | CRYPTOPP_UNUSED(recoverableMessage), CRYPTOPP_UNUSED(recoverableMessageLength), CRYPTOPP_UNUSED(representativeBitLength); 25 | CRYPTOPP_ASSERT(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize())); 26 | 27 | if (representativeBitLength % 8 != 7) 28 | throw PK_SignatureScheme::InvalidKeyLength("EMSA2: EMSA2 requires a key length that is a multiple of 8"); 29 | 30 | size_t digestSize = hash.DigestSize(); 31 | size_t representativeByteLength = BitsToBytes(representativeBitLength); 32 | 33 | representative[0] = messageEmpty ? 0x4b : 0x6b; 34 | std::memset(representative+1, 0xbb, representativeByteLength-digestSize-4); // pad with 0xbb 35 | byte *afterP2 = representative+representativeByteLength-digestSize-3; 36 | afterP2[0] = 0xba; 37 | hash.Final(afterP2+1); 38 | representative[representativeByteLength-2] = *hashIdentifier.first; 39 | representative[representativeByteLength-1] = 0xcc; 40 | } 41 | 42 | NAMESPACE_END 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /fltrimpl.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPTOPP_FLTRIMPL_H 2 | #define CRYPTOPP_FLTRIMPL_H 3 | 4 | #define FILTER_BEGIN \ 5 | switch (m_continueAt) \ 6 | { \ 7 | case 0: \ 8 | m_inputPosition = 0; 9 | 10 | #define FILTER_END_NO_MESSAGE_END_NO_RETURN \ 11 | break; \ 12 | default: \ 13 | CRYPTOPP_ASSERT(false); \ 14 | } 15 | 16 | #define FILTER_END_NO_MESSAGE_END \ 17 | FILTER_END_NO_MESSAGE_END_NO_RETURN \ 18 | return 0; 19 | 20 | /* 21 | #define FILTER_END \ 22 | case -1: \ 23 | if (messageEnd && Output(-1, NULLPTR, 0, messageEnd, blocking)) \ 24 | return 1; \ 25 | FILTER_END_NO_MESSAGE_END 26 | */ 27 | 28 | #define FILTER_OUTPUT3(site, statement, output, length, messageEnd, channel) \ 29 | {\ 30 | case site: \ 31 | (void) statement; \ 32 | if (Output(site, output, length, messageEnd, blocking, channel)) \ 33 | return STDMAX(size_t(1), length-m_inputPosition);\ 34 | } 35 | 36 | #define FILTER_OUTPUT2(site, statement, output, length, messageEnd) \ 37 | FILTER_OUTPUT3(site, statement, output, length, messageEnd, DEFAULT_CHANNEL) 38 | 39 | #define FILTER_OUTPUT(site, output, length, messageEnd) \ 40 | FILTER_OUTPUT2(site, 0, output, length, messageEnd) 41 | 42 | #define FILTER_OUTPUT_BYTE(site, output) \ 43 | FILTER_OUTPUT(site, &(const byte &)(byte)output, 1, 0) 44 | 45 | #define FILTER_OUTPUT2_MODIFIABLE(site, statement, output, length, messageEnd) \ 46 | {\ 47 | /* fall through */ \ 48 | case site: \ 49 | (void) statement; \ 50 | if (OutputModifiable(site, output, length, messageEnd, blocking)) \ 51 | return STDMAX(size_t(1), length-m_inputPosition);\ 52 | } 53 | 54 | #define FILTER_OUTPUT_MODIFIABLE(site, output, length, messageEnd) \ 55 | FILTER_OUTPUT2_MODIFIABLE(site, 0, output, length, messageEnd) 56 | 57 | #define FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, statement, output, length, messageEnd, modifiable) \ 58 | {\ 59 | /* fall through */ \ 60 | case site: \ 61 | (void) statement; \ 62 | if (modifiable ? OutputModifiable(site, output, length, messageEnd, blocking) : Output(site, output, length, messageEnd, blocking)) \ 63 | return STDMAX(size_t(1), length-m_inputPosition);\ 64 | } 65 | 66 | #define FILTER_OUTPUT_MAYBE_MODIFIABLE(site, output, length, messageEnd, modifiable) \ 67 | FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, 0, output, length, messageEnd, modifiable) 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /gf256.cpp: -------------------------------------------------------------------------------- 1 | // gf256.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | #include "gf256.h" 5 | 6 | NAMESPACE_BEGIN(CryptoPP) 7 | 8 | GF256::Element GF256::Multiply(Element a, Element b) const 9 | { 10 | word result = 0, t = b; 11 | 12 | for (unsigned int i=0; i<8; i++) 13 | { 14 | result <<= 1; 15 | if (result & 0x100) 16 | result ^= m_modulus; 17 | 18 | t <<= 1; 19 | if (t & 0x100) 20 | result ^= a; 21 | } 22 | 23 | return (GF256::Element) result; 24 | } 25 | 26 | GF256::Element GF256::MultiplicativeInverse(Element a) const 27 | { 28 | Element result = a; 29 | for (int i=1; i<7; i++) 30 | result = Multiply(Square(result), a); 31 | return Square(result); 32 | } 33 | 34 | NAMESPACE_END 35 | -------------------------------------------------------------------------------- /gf256.h: -------------------------------------------------------------------------------- 1 | // gf256.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file gf256.h 4 | /// \brief Classes and functions for schemes over GF(256) 5 | 6 | #ifndef CRYPTOPP_GF256_H 7 | #define CRYPTOPP_GF256_H 8 | 9 | #include "cryptlib.h" 10 | #include "misc.h" 11 | 12 | NAMESPACE_BEGIN(CryptoPP) 13 | 14 | /// \brief GF(256) with polynomial basis 15 | class GF256 16 | { 17 | public: 18 | typedef byte Element; 19 | typedef int RandomizationParameter; 20 | 21 | GF256(byte modulus) : m_modulus(modulus) {} 22 | 23 | Element RandomElement(RandomNumberGenerator &rng, int ignored = 0) const 24 | {CRYPTOPP_UNUSED(ignored); return rng.GenerateByte();} 25 | 26 | bool Equal(Element a, Element b) const 27 | {return a==b;} 28 | 29 | Element Zero() const 30 | {return 0;} 31 | 32 | Element Add(Element a, Element b) const 33 | {return a^b;} 34 | 35 | Element& Accumulate(Element &a, Element b) const 36 | {return a^=b;} 37 | 38 | Element Inverse(Element a) const 39 | {return a;} 40 | 41 | Element Subtract(Element a, Element b) const 42 | {return a^b;} 43 | 44 | Element& Reduce(Element &a, Element b) const 45 | {return a^=b;} 46 | 47 | Element Double(Element a) const 48 | {CRYPTOPP_UNUSED(a); return 0;} 49 | 50 | Element One() const 51 | {return 1;} 52 | 53 | Element Multiply(Element a, Element b) const; 54 | 55 | Element Square(Element a) const 56 | {return Multiply(a, a);} 57 | 58 | bool IsUnit(Element a) const 59 | {return a != 0;} 60 | 61 | Element MultiplicativeInverse(Element a) const; 62 | 63 | Element Divide(Element a, Element b) const 64 | {return Multiply(a, MultiplicativeInverse(b));} 65 | 66 | private: 67 | word m_modulus; 68 | }; 69 | 70 | NAMESPACE_END 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /gf2_32.cpp: -------------------------------------------------------------------------------- 1 | // gf2_32.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | #include "misc.h" 5 | #include "gf2_32.h" 6 | 7 | NAMESPACE_BEGIN(CryptoPP) 8 | 9 | GF2_32::Element GF2_32::Multiply(Element a, Element b) const 10 | { 11 | word32 table[4]; 12 | table[0] = 0; 13 | table[1] = m_modulus; 14 | if (a & 0x80000000) 15 | { 16 | table[2] = m_modulus ^ (a<<1); 17 | table[3] = a<<1; 18 | } 19 | else 20 | { 21 | table[2] = a<<1; 22 | table[3] = m_modulus ^ (a<<1); 23 | } 24 | 25 | #if CRYPTOPP_FAST_ROTATE(32) 26 | b = rotrConstant<30>(b); 27 | word32 result = table[b&2]; 28 | 29 | for (int i=29; i>=0; --i) 30 | { 31 | b = rotlConstant<1>(b); 32 | result = (result<<1) ^ table[(b&2) + (result>>31)]; 33 | } 34 | 35 | return (b&1) ? result ^ a : result; 36 | #else 37 | word32 result = table[(b>>30) & 2]; 38 | 39 | for (int i=29; i>=0; --i) 40 | result = (result<<1) ^ table[((b>>i)&2) + (result>>31)]; 41 | 42 | return (b&1) ? result ^ a : result; 43 | #endif 44 | } 45 | 46 | GF2_32::Element GF2_32::MultiplicativeInverse(Element a) const 47 | { 48 | if (a <= 1) // 1 is a special case 49 | return a; 50 | 51 | // warning - don't try to adapt this algorithm for another situation 52 | word32 g0=m_modulus, g1=a, g2=a; 53 | word32 v0=0, v1=1, v2=1; 54 | 55 | CRYPTOPP_ASSERT(g1); 56 | 57 | while (!(g2 & 0x80000000)) 58 | { 59 | g2 <<= 1; 60 | v2 <<= 1; 61 | } 62 | 63 | g2 <<= 1; 64 | v2 <<= 1; 65 | 66 | g0 ^= g2; 67 | v0 ^= v2; 68 | 69 | while (g0 != 1) 70 | { 71 | if (g1 < g0 || ((g0^g1) < g0 && (g0^g1) < g1)) 72 | { 73 | CRYPTOPP_ASSERT(BitPrecision(g1) <= BitPrecision(g0)); 74 | g2 = g1; 75 | v2 = v1; 76 | } 77 | else 78 | { 79 | CRYPTOPP_ASSERT(BitPrecision(g1) > BitPrecision(g0)); 80 | g2 = g0; g0 = g1; g1 = g2; 81 | v2 = v0; v0 = v1; v1 = v2; 82 | } 83 | 84 | while ((g0^g2) >= g2) 85 | { 86 | CRYPTOPP_ASSERT(BitPrecision(g0) > BitPrecision(g2)); 87 | g2 <<= 1; 88 | v2 <<= 1; 89 | } 90 | 91 | CRYPTOPP_ASSERT(BitPrecision(g0) == BitPrecision(g2)); 92 | g0 ^= g2; 93 | v0 ^= v2; 94 | } 95 | 96 | return v0; 97 | } 98 | 99 | NAMESPACE_END 100 | -------------------------------------------------------------------------------- /gf2_32.h: -------------------------------------------------------------------------------- 1 | // gf2_32.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file gf2_32.h 4 | /// \brief Classes and functions for schemes over GF(2^32) 5 | 6 | #ifndef CRYPTOPP_GF2_32_H 7 | #define CRYPTOPP_GF2_32_H 8 | 9 | #include "cryptlib.h" 10 | #include "secblock.h" 11 | #include "misc.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief GF(2^32) with polynomial basis 16 | class GF2_32 17 | { 18 | public: 19 | typedef word32 Element; 20 | typedef int RandomizationParameter; 21 | 22 | GF2_32(word32 modulus=0x0000008D) : m_modulus(modulus) {} 23 | 24 | Element RandomElement(RandomNumberGenerator &rng, int ignored = 0) const 25 | {CRYPTOPP_UNUSED(ignored); return rng.GenerateWord32();} 26 | 27 | bool Equal(Element a, Element b) const 28 | {return a==b;} 29 | 30 | Element Identity() const 31 | {return 0;} 32 | 33 | Element Add(Element a, Element b) const 34 | {return a^b;} 35 | 36 | Element& Accumulate(Element &a, Element b) const 37 | {return a^=b;} 38 | 39 | Element Inverse(Element a) const 40 | {return a;} 41 | 42 | Element Subtract(Element a, Element b) const 43 | {return a^b;} 44 | 45 | Element& Reduce(Element &a, Element b) const 46 | {return a^=b;} 47 | 48 | Element Double(Element a) const 49 | {CRYPTOPP_UNUSED(a); return 0;} 50 | 51 | Element MultiplicativeIdentity() const 52 | {return 1;} 53 | 54 | Element Multiply(Element a, Element b) const; 55 | 56 | Element Square(Element a) const 57 | {return Multiply(a, a);} 58 | 59 | bool IsUnit(Element a) const 60 | {return a != 0;} 61 | 62 | Element MultiplicativeInverse(Element a) const; 63 | 64 | Element Divide(Element a, Element b) const 65 | {return Multiply(a, MultiplicativeInverse(b));} 66 | 67 | private: 68 | word32 m_modulus; 69 | }; 70 | 71 | NAMESPACE_END 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /gost.h: -------------------------------------------------------------------------------- 1 | // gost.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file gost.h 4 | /// \brief Classes for the GIST block cipher 5 | 6 | #ifndef CRYPTOPP_GOST_H 7 | #define CRYPTOPP_GOST_H 8 | 9 | #include "seckey.h" 10 | #include "secblock.h" 11 | 12 | NAMESPACE_BEGIN(CryptoPP) 13 | 14 | /// \brief GOST block cipher information 15 | /// \since Crypto++ 2.1 16 | struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32> 17 | { 18 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "GOST";} 19 | }; 20 | 21 | /// \brief GOST block cipher 22 | /// \sa GOST 23 | /// \since Crypto++ 2.1 24 | class GOST : public GOST_Info, public BlockCipherDocumentation 25 | { 26 | /// \brief GOST block cipher default operation 27 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 28 | { 29 | public: 30 | void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); 31 | 32 | protected: 33 | static void PrecalculateSTable(); 34 | 35 | static const byte sBox[8][16]; 36 | static volatile bool sTableCalculated; 37 | static word32 sTable[4][256]; 38 | 39 | FixedSizeSecBlock m_key; 40 | }; 41 | 42 | /// \brief GOST block cipher encryption operation 43 | class CRYPTOPP_NO_VTABLE Enc : public Base 44 | { 45 | public: 46 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 47 | }; 48 | 49 | /// \brief GOST block cipher decryption operation 50 | class CRYPTOPP_NO_VTABLE Dec : public Base 51 | { 52 | public: 53 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 54 | }; 55 | 56 | public: 57 | typedef BlockCipherFinal Encryption; 58 | typedef BlockCipherFinal Decryption; 59 | }; 60 | 61 | typedef GOST::Encryption GOSTEncryption; 62 | typedef GOST::Decryption GOSTDecryption; 63 | 64 | NAMESPACE_END 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /hashfwd.h: -------------------------------------------------------------------------------- 1 | // hashfwd.h - written and placed in the public domain by Jeffrey Walton 2 | 3 | /// \file hashfwd.h 4 | /// \brief Forward declarations for hash functions used in signature encoding methods 5 | 6 | #ifndef CRYPTOPP_HASHFWD_H 7 | #define CRYPTOPP_HASHFWD_H 8 | 9 | #include "config.h" 10 | 11 | NAMESPACE_BEGIN(CryptoPP) 12 | 13 | class SHA1; 14 | class SHA224; 15 | class SHA256; 16 | class SHA384; 17 | class SHA512; 18 | 19 | class SHA3_256; 20 | class SHA3_384; 21 | class SHA3_512; 22 | 23 | class SHAKE128; 24 | class SHAKE256; 25 | 26 | class Tiger; 27 | class RIPEMD128; 28 | class RIPEMD160; 29 | class Whirlpool; 30 | 31 | namespace Weak1 { 32 | class MD2; 33 | class MD5; 34 | } 35 | 36 | NAMESPACE_END 37 | 38 | #endif // CRYPTOPP_HASHFWD_H 39 | -------------------------------------------------------------------------------- /hex.h: -------------------------------------------------------------------------------- 1 | // hex.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file hex.h 4 | /// \brief Classes for HexEncoder and HexDecoder 5 | 6 | #ifndef CRYPTOPP_HEX_H 7 | #define CRYPTOPP_HEX_H 8 | 9 | #include "cryptlib.h" 10 | #include "basecode.h" 11 | 12 | NAMESPACE_BEGIN(CryptoPP) 13 | 14 | /// \brief Converts given data to base 16 15 | class CRYPTOPP_DLL HexEncoder : public SimpleProxyFilter 16 | { 17 | public: 18 | /// \brief Construct a HexEncoder 19 | /// \param attachment a BufferedTrasformation to attach to this object 20 | /// \param uppercase a flag indicating uppercase output 21 | /// \param groupSize the size of the output grouping 22 | /// \param separator the separator to use between groups 23 | /// \param terminator the terminator append after processing 24 | HexEncoder(BufferedTransformation *attachment = NULLPTR, bool uppercase = true, int groupSize = 0, const std::string &separator = ":", const std::string &terminator = "") 25 | : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment) 26 | { 27 | IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), groupSize)(Name::Separator(), ConstByteArrayParameter(separator))(Name::Terminator(), ConstByteArrayParameter(terminator))); 28 | } 29 | 30 | void IsolatedInitialize(const NameValuePairs ¶meters); 31 | }; 32 | 33 | /// \brief Decode base 16 data back to bytes 34 | class CRYPTOPP_DLL HexDecoder : public BaseN_Decoder 35 | { 36 | public: 37 | /// \brief Construct a HexDecoder 38 | /// \param attachment a BufferedTrasformation to attach to this object 39 | HexDecoder(BufferedTransformation *attachment = NULLPTR) 40 | : BaseN_Decoder(GetDefaultDecodingLookupArray(), 4, attachment) {} 41 | 42 | void IsolatedInitialize(const NameValuePairs ¶meters); 43 | 44 | private: 45 | static const int * CRYPTOPP_API GetDefaultDecodingLookupArray(); 46 | }; 47 | 48 | NAMESPACE_END 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /idea.h: -------------------------------------------------------------------------------- 1 | // idea.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file idea.h 4 | /// \brief Classes for the IDEA block cipher 5 | 6 | #ifndef CRYPTOPP_IDEA_H 7 | #define CRYPTOPP_IDEA_H 8 | 9 | #include "seckey.h" 10 | #include "secblock.h" 11 | 12 | NAMESPACE_BEGIN(CryptoPP) 13 | 14 | /// \brief IDEA block cipher information 15 | /// \since Crypto++ 1.0 16 | struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<8> 17 | { 18 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "IDEA";} 19 | }; 20 | 21 | /// \brief IDEA block cipher 22 | /// \sa IDEA 23 | /// \since Crypto++ 1.0 24 | class IDEA : public IDEA_Info, public BlockCipherDocumentation 25 | { 26 | public: // made public for internal purposes 27 | #ifdef CRYPTOPP_NATIVE_DWORD_AVAILABLE 28 | typedef word Word; 29 | #else 30 | typedef hword Word; 31 | #endif 32 | 33 | private: 34 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 35 | { 36 | public: 37 | unsigned int OptimalDataAlignment() const {return 2;} 38 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 39 | 40 | void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); 41 | 42 | private: 43 | void EnKey(const byte *); 44 | void DeKey(); 45 | FixedSizeSecBlock m_key; 46 | 47 | #ifdef IDEA_LARGECACHE 48 | static inline void LookupMUL(word &a, word b); 49 | void LookupKeyLogs(); 50 | static void BuildLogTables(); 51 | static volatile bool tablesBuilt; 52 | static word16 log[0x10000], antilog[0x10000]; 53 | #endif 54 | }; 55 | 56 | public: 57 | typedef BlockCipherFinal Encryption; 58 | typedef BlockCipherFinal Decryption; 59 | }; 60 | 61 | typedef IDEA::Encryption IDEAEncryption; 62 | typedef IDEA::Decryption IDEADecryption; 63 | 64 | NAMESPACE_END 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /keccak.cpp: -------------------------------------------------------------------------------- 1 | // keccak.cpp - modified by Wei Dai from Ronny Van Keer's public domain 2 | // sha3-simple.c. All modifications here are placed in the 3 | // public domain by Wei Dai. 4 | // Keccack core function moved to keccakc.cpp in AUG 2018 5 | // by Jeffrey Walton. Separating the core file allows both 6 | // SHA3 and Keccack to share the core implementation. 7 | 8 | /* 9 | The Keccak sponge function, designed by Guido Bertoni, Joan Daemen, 10 | Michael Peeters and Gilles Van Assche. For more information, feedback or 11 | questions, please refer to our website: http://keccak.noekeon.org/ 12 | 13 | Implementation by Ronny Van Keer, hereby denoted as "the implementer". 14 | 15 | To the extent possible under law, the implementer has waived all copyright 16 | and related or neighboring rights to the source code in this file. 17 | http://creativecommons.org/publicdomain/zero/1.0/ 18 | */ 19 | 20 | #include "pch.h" 21 | #include "keccak.h" 22 | 23 | NAMESPACE_BEGIN(CryptoPP) 24 | 25 | // The Keccak core function 26 | extern void KeccakF1600(word64 *state); 27 | 28 | void Keccak::Update(const byte *input, size_t length) 29 | { 30 | CRYPTOPP_ASSERT(!(input == NULLPTR && length != 0)); 31 | if (length == 0) { return; } 32 | 33 | size_t spaceLeft; 34 | while (length >= (spaceLeft = r() - m_counter)) 35 | { 36 | if (spaceLeft) 37 | xorbuf(m_state.BytePtr() + m_counter, input, spaceLeft); 38 | KeccakF1600(m_state); 39 | input += spaceLeft; 40 | length -= spaceLeft; 41 | m_counter = 0; 42 | } 43 | 44 | if (length) 45 | xorbuf(m_state.BytePtr() + m_counter, input, length); 46 | m_counter += (unsigned int)length; 47 | } 48 | 49 | void Keccak::Restart() 50 | { 51 | std::memset(m_state, 0, m_state.SizeInBytes()); 52 | m_counter = 0; 53 | } 54 | 55 | void Keccak::TruncatedFinal(byte *hash, size_t size) 56 | { 57 | CRYPTOPP_ASSERT(hash != NULLPTR); 58 | ThrowIfInvalidTruncatedSize(size); 59 | 60 | m_state.BytePtr()[m_counter] ^= 0x01; 61 | m_state.BytePtr()[r()-1] ^= 0x80; 62 | KeccakF1600(m_state); 63 | std::memcpy(hash, m_state, size); 64 | Restart(); 65 | } 66 | 67 | NAMESPACE_END 68 | -------------------------------------------------------------------------------- /mars.h: -------------------------------------------------------------------------------- 1 | // mars.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file mars.h 4 | /// \brief Classes for the MARS block cipher (IBM AES submission) 5 | /// \since Crypto++ 3.0 6 | 7 | #ifndef CRYPTOPP_MARS_H 8 | #define CRYPTOPP_MARS_H 9 | 10 | #include "seckey.h" 11 | #include "secblock.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief MARS block cipher information 16 | /// \since Crypto++ 3.0 17 | struct MARS_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 56, 8> 18 | { 19 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "MARS";} 20 | }; 21 | 22 | /// \brief MARS block cipher 23 | /// \sa MARS 24 | /// \since Crypto++ 3.0 25 | class MARS : public MARS_Info, public BlockCipherDocumentation 26 | { 27 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 28 | { 29 | public: 30 | void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); 31 | 32 | protected: 33 | static const word32 Sbox[512]; 34 | 35 | FixedSizeSecBlock m_k; 36 | }; 37 | 38 | class CRYPTOPP_NO_VTABLE Enc : public Base 39 | { 40 | public: 41 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 42 | }; 43 | 44 | class CRYPTOPP_NO_VTABLE Dec : public Base 45 | { 46 | public: 47 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 48 | }; 49 | 50 | public: 51 | typedef BlockCipherFinal Encryption; 52 | typedef BlockCipherFinal Decryption; 53 | }; 54 | 55 | typedef MARS::Encryption MARSEncryption; 56 | typedef MARS::Decryption MARSDecryption; 57 | 58 | NAMESPACE_END 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /md2.h: -------------------------------------------------------------------------------- 1 | // md2.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file md2.h 4 | /// \brief Classes for the MD2 message digest 5 | /// \since Crypto++ 3.0 6 | 7 | #ifndef CRYPTOPP_MD2_H 8 | #define CRYPTOPP_MD2_H 9 | 10 | #include "cryptlib.h" 11 | #include "secblock.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | namespace Weak1 { 16 | 17 | /// \brief MD2 message digest 18 | /// \sa MD2 19 | /// \since Crypto++ 3.0 20 | class MD2 : public HashTransformation 21 | { 22 | public: 23 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "MD2";} 24 | 25 | MD2(); 26 | void Update(const byte *input, size_t length); 27 | void TruncatedFinal(byte *hash, size_t size); 28 | unsigned int DigestSize() const {return DIGESTSIZE;} 29 | unsigned int BlockSize() const {return BLOCKSIZE;} 30 | std::string AlgorithmName() const {return StaticAlgorithmName();} 31 | 32 | CRYPTOPP_CONSTANT(DIGESTSIZE = 16); 33 | CRYPTOPP_CONSTANT(BLOCKSIZE = 16); 34 | 35 | private: 36 | void Transform(); 37 | void Init(); 38 | SecByteBlock m_X, m_C, m_buf; 39 | unsigned int m_count; 40 | }; 41 | 42 | } 43 | #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 44 | namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak 45 | #else 46 | using namespace Weak1; // import Weak1 into CryptoPP with warning 47 | #ifdef __GNUC__ 48 | #warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." 49 | #else 50 | #pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") 51 | #endif 52 | #endif 53 | 54 | NAMESPACE_END 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /md4.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPTOPP_MD4_H 2 | #define CRYPTOPP_MD4_H 3 | 4 | #include "iterhash.h" 5 | 6 | NAMESPACE_BEGIN(CryptoPP) 7 | 8 | namespace Weak1 { 9 | 10 | /// MD4 11 | /*! \warning MD4 is considered insecure, and should not be used 12 | unless you absolutely need it for compatibility. */ 13 | class MD4 : public IteratedHashWithStaticTransform 14 | { 15 | public: 16 | static void InitState(HashWordType *state); 17 | static void Transform(word32 *digest, const word32 *data); 18 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "MD4";} 19 | }; 20 | 21 | } 22 | #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 23 | namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak 24 | #else 25 | using namespace Weak1; // import Weak1 into CryptoPP with warning 26 | #ifdef __GNUC__ 27 | #warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." 28 | #else 29 | #pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") 30 | #endif 31 | #endif 32 | 33 | NAMESPACE_END 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /md5.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPTOPP_MD5_H 2 | #define CRYPTOPP_MD5_H 3 | 4 | #include "iterhash.h" 5 | 6 | NAMESPACE_BEGIN(CryptoPP) 7 | 8 | namespace Weak1 { 9 | 10 | /// \brief MD5 message digest 11 | /// \sa MD5 12 | /// \since Crypto++ 1.0 13 | class MD5 : public IteratedHashWithStaticTransform 14 | { 15 | public: 16 | static void InitState(HashWordType *state); 17 | static void Transform(word32 *digest, const word32 *data); 18 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "MD5";} 19 | }; 20 | 21 | } 22 | #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 23 | namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak 24 | #else 25 | using namespace Weak1; // import Weak1 into CryptoPP with warning 26 | #ifdef __GNUC__ 27 | #warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." 28 | #else 29 | #pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") 30 | #endif 31 | #endif 32 | 33 | NAMESPACE_END 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /modexppc.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPTOPP_MODEXPPC_H 2 | #define CRYPTOPP_MODEXPPC_H 3 | 4 | #include "cryptlib.h" 5 | #include "modarith.h" 6 | #include "integer.h" 7 | #include "algebra.h" 8 | #include "eprecomp.h" 9 | #include "smartptr.h" 10 | #include "pubkey.h" 11 | 12 | #if CRYPTOPP_MSC_VERSION 13 | # pragma warning(push) 14 | # pragma warning(disable: 4231 4275) 15 | #endif 16 | 17 | NAMESPACE_BEGIN(CryptoPP) 18 | 19 | CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl; 20 | 21 | class ModExpPrecomputation : public DL_GroupPrecomputation 22 | { 23 | public: 24 | virtual ~ModExpPrecomputation() {} 25 | 26 | // DL_GroupPrecomputation 27 | bool NeedConversions() const {return true;} 28 | Element ConvertIn(const Element &v) const {return m_mr->ConvertIn(v);} 29 | virtual Element ConvertOut(const Element &v) const {return m_mr->ConvertOut(v);} 30 | const AbstractGroup & GetGroup() const {return m_mr->MultiplicativeGroup();} 31 | Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);} 32 | void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);} 33 | 34 | // non-inherited 35 | void SetModulus(const Integer &v) {m_mr.reset(new MontgomeryRepresentation(v));} 36 | const Integer & GetModulus() const {return m_mr->GetModulus();} 37 | 38 | private: 39 | value_ptr m_mr; 40 | }; 41 | 42 | NAMESPACE_END 43 | 44 | #if CRYPTOPP_MSC_VERSION 45 | # pragma warning(pop) 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /mqv.cpp: -------------------------------------------------------------------------------- 1 | // mqv.cpp - originally written and placed in the public domain by Wei Dai 2 | // HMQV provided by Jeffrey Walton, Ray Clayton and Uri Blumenthal. 3 | // FHMQV provided by Uri Blumenthal. 4 | 5 | #include "pch.h" 6 | #include "config.h" 7 | #include "mqv.h" 8 | #include "hmqv.h" 9 | #include "fhmqv.h" 10 | #include "eccrypto.h" 11 | 12 | // Squash MS LNK4221 and libtool warnings 13 | extern const char MQV_FNAME[] = __FILE__; 14 | 15 | NAMESPACE_BEGIN(CryptoPP) 16 | 17 | #if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 18 | void TestInstantiations_MQV() 19 | { 20 | MQV mqv; 21 | ECMQV ecmqv; 22 | 23 | CRYPTOPP_UNUSED(mqv); 24 | CRYPTOPP_UNUSED(ecmqv); 25 | } 26 | 27 | void TestInstantiations_HMQV() 28 | { 29 | HMQV hmqv; 30 | ECHMQV echmqv; 31 | 32 | CRYPTOPP_UNUSED(hmqv); 33 | CRYPTOPP_UNUSED(echmqv); 34 | } 35 | 36 | void TestInstantiations_FHMQV() 37 | { 38 | FHMQV fhmqv; 39 | ECFHMQV ecfhmqv; 40 | 41 | CRYPTOPP_UNUSED(fhmqv); 42 | CRYPTOPP_UNUSED(ecfhmqv); 43 | } 44 | #endif 45 | 46 | NAMESPACE_END 47 | -------------------------------------------------------------------------------- /nr.h: -------------------------------------------------------------------------------- 1 | // nr.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file nr.h 4 | /// \brief Classes for Nyberg-Rueppel signature scheme 5 | 6 | #ifndef CRYPTOPP_NR_H 7 | #define CRYPTOPP_NR_H 8 | 9 | #include "gfpcrypt.h" 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /oaep.h: -------------------------------------------------------------------------------- 1 | // oaep.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file oaep.h 4 | /// \brief Classes for optimal asymmetric encryption padding 5 | /// \since Crypto++ 2.1 6 | 7 | #ifndef CRYPTOPP_OAEP_H 8 | #define CRYPTOPP_OAEP_H 9 | 10 | #include "cryptlib.h" 11 | #include "pubkey.h" 12 | #include "sha.h" 13 | 14 | NAMESPACE_BEGIN(CryptoPP) 15 | 16 | /// \brief OAEP padding base class 17 | /// \since Crypto++ 2.1 18 | class CRYPTOPP_DLL OAEP_Base : public PK_EncryptionMessageEncodingMethod 19 | { 20 | public: 21 | bool ParameterSupported(const char *name) const {return strcmp(name, Name::EncodingParameters()) == 0;} 22 | size_t MaxUnpaddedLength(size_t paddedLength) const; 23 | void Pad(RandomNumberGenerator &rng, const byte *raw, size_t inputLength, byte *padded, size_t paddedLength, const NameValuePairs ¶meters) const; 24 | DecodingResult Unpad(const byte *padded, size_t paddedLength, byte *raw, const NameValuePairs ¶meters) const; 25 | 26 | protected: 27 | virtual unsigned int DigestSize() const =0; 28 | virtual HashTransformation * NewHash() const =0; 29 | virtual MaskGeneratingFunction * NewMGF() const =0; 30 | }; 31 | 32 | /// \brief OAEP padding 33 | /// \tparam H HashTransformation derived class 34 | /// \tparam MGF MaskGeneratingFunction derived class 35 | /// \sa EME-OAEP, for use with classes derived from TF_ES 36 | /// \since Crypto++ 2.1 37 | template 38 | class OAEP : public OAEP_Base, public EncryptionStandard 39 | { 40 | public: 41 | static std::string CRYPTOPP_API StaticAlgorithmName() {return std::string("OAEP-") + MGF::StaticAlgorithmName() + "(" + H::StaticAlgorithmName() + ")";} 42 | typedef OAEP EncryptionMessageEncodingMethod; 43 | 44 | protected: 45 | unsigned int DigestSize() const {return H::DIGESTSIZE;} 46 | HashTransformation * NewHash() const {return new H;} 47 | MaskGeneratingFunction * NewMGF() const {return new MGF;} 48 | }; 49 | 50 | CRYPTOPP_DLL_TEMPLATE_CLASS OAEP; 51 | 52 | NAMESPACE_END 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /pch.h: -------------------------------------------------------------------------------- 1 | // pch.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file pch.h 4 | /// \brief Precompiled header file 5 | /// \details The precompiled header files are used Windows. 6 | 7 | #ifndef CRYPTOPP_PCH_H 8 | #define CRYPTOPP_PCH_H 9 | 10 | # ifdef CRYPTOPP_GENERATE_X64_MASM 11 | #include "cpu.h" 12 | 13 | # else 14 | #include "config.h" 15 | 16 | #ifdef USE_PRECOMPILED_HEADERS 17 | #include "simple.h" 18 | #include "secblock.h" 19 | #include "misc.h" 20 | #include "smartptr.h" 21 | #include "stdcpp.h" 22 | #endif 23 | # endif 24 | 25 | // Enable file and line numbers, if available. 26 | // #if defined(_MSC_VER) && defined(_DEBUG) && defined(USE_PRECOMPILED_HEADERS) 27 | // # define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 28 | // # define new DEBUG_NEW 29 | // #endif 30 | 31 | #endif // CRYPTOPP_PCH_H 32 | -------------------------------------------------------------------------------- /rc5.cpp: -------------------------------------------------------------------------------- 1 | // rc5.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | #include "rc5.h" 5 | #include "misc.h" 6 | #include "secblock.h" 7 | 8 | NAMESPACE_BEGIN(CryptoPP) 9 | 10 | void RC5::Base::UncheckedSetKey(const byte *k, unsigned int keylen, const NameValuePairs ¶ms) 11 | { 12 | AssertValidKeyLength(keylen); 13 | 14 | r = GetRoundsAndThrowIfInvalid(params, this); 15 | sTable.New(2*(r+1)); 16 | 17 | static const RC5_WORD MAGIC_P = 0xb7e15163L; // magic constant P for wordsize 18 | static const RC5_WORD MAGIC_Q = 0x9e3779b9L; // magic constant Q for wordsize 19 | static const int U=sizeof(RC5_WORD); 20 | 21 | const unsigned int c = STDMAX((keylen+U-1)/U, 1U); // RC6 paper says c=1 if keylen==0 22 | SecBlock l(c); 23 | 24 | GetUserKey(LITTLE_ENDIAN_ORDER, l.begin(), c, k, keylen); 25 | 26 | sTable[0] = MAGIC_P; 27 | for (unsigned j=1; j((sTable[h % sTable.size()] + a + b)); 36 | b = l[h % c] = rotlMod((l[h % c] + a + b), (a+b)); 37 | } 38 | } 39 | 40 | typedef BlockGetAndPut Block; 41 | 42 | void RC5::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const 43 | { 44 | const RC5_WORD *sptr = sTable; 45 | RC5_WORD a, b; 46 | 47 | Block::Get(inBlock)(a)(b); 48 | a += sptr[0]; 49 | b += sptr[1]; 50 | sptr += 2; 51 | 52 | for(unsigned i=0; i, public VariableKeyLength<16, 0, 255>, public VariableRounds<16> 17 | { 18 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "RC5";} 19 | typedef word32 RC5_WORD; 20 | }; 21 | 22 | /// \brief RC5 block cipher 23 | /// \sa RC5 24 | /// \since Crypto++ 1.0 25 | class RC5 : public RC5_Info, public BlockCipherDocumentation 26 | { 27 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 28 | { 29 | public: 30 | void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); 31 | 32 | protected: 33 | unsigned int r; // number of rounds 34 | SecBlock sTable; // expanded key table 35 | }; 36 | 37 | class CRYPTOPP_NO_VTABLE Enc : public Base 38 | { 39 | public: 40 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 41 | }; 42 | 43 | class CRYPTOPP_NO_VTABLE Dec : public Base 44 | { 45 | public: 46 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 47 | }; 48 | 49 | public: 50 | typedef BlockCipherFinal Encryption; 51 | typedef BlockCipherFinal Decryption; 52 | }; 53 | 54 | typedef RC5::Encryption RC5Encryption; 55 | typedef RC5::Decryption RC5Decryption; 56 | 57 | NAMESPACE_END 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /rc6.h: -------------------------------------------------------------------------------- 1 | // rc6.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file rc6.h 4 | /// \brief Classes for the RC6 block cipher 5 | /// \since Crypto++ 3.0 6 | 7 | #ifndef CRYPTOPP_RC6_H 8 | #define CRYPTOPP_RC6_H 9 | 10 | #include "seckey.h" 11 | #include "secblock.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief RC6 block cipher information 16 | /// \since Crypto++ 3.0 17 | struct RC6_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>, public VariableRounds<20> 18 | { 19 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "RC6";} 20 | typedef word32 RC6_WORD; 21 | }; 22 | 23 | /// \brief RC6 block cipher 24 | /// \sa RC6 25 | /// \since Crypto++ 3.0 26 | class RC6 : public RC6_Info, public BlockCipherDocumentation 27 | { 28 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 29 | { 30 | public: 31 | void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); 32 | 33 | protected: 34 | unsigned int r; // number of rounds 35 | SecBlock sTable; // expanded key table 36 | }; 37 | 38 | class CRYPTOPP_NO_VTABLE Enc : public Base 39 | { 40 | public: 41 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 42 | }; 43 | 44 | class CRYPTOPP_NO_VTABLE Dec : public Base 45 | { 46 | public: 47 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 48 | }; 49 | 50 | public: 51 | typedef BlockCipherFinal Encryption; 52 | typedef BlockCipherFinal Decryption; 53 | }; 54 | 55 | typedef RC6::Encryption RC6Encryption; 56 | typedef RC6::Decryption RC6Decryption; 57 | 58 | NAMESPACE_END 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by cryptopp.rc 4 | // 5 | 6 | // Next default values for new objects 7 | // 8 | #ifdef APSTUDIO_INVOKED 9 | #ifndef APSTUDIO_READONLY_SYMBOLS 10 | #define _APS_NEXT_RESOURCE_VALUE 101 11 | #define _APS_NEXT_COMMAND_VALUE 40001 12 | #define _APS_NEXT_CONTROL_VALUE 1000 13 | #define _APS_NEXT_SYMED_VALUE 101 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /seal.h: -------------------------------------------------------------------------------- 1 | // seal.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file seal.h 4 | /// \brief Classes for SEAL stream cipher 5 | /// \since Crypto++ 2.2 6 | 7 | #ifndef CRYPTOPP_SEAL_H 8 | #define CRYPTOPP_SEAL_H 9 | 10 | #include "strciphr.h" 11 | #include "secblock.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief SEAL stream cipher information 16 | /// \tparam B Endianness of the stream cipher 17 | /// \since Crypto++ 2.2 18 | template 19 | struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4> 20 | { 21 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";} 22 | }; 23 | 24 | /// \brief SEAL stream cipher operation 25 | /// \tparam B Endianness of the stream cipher 26 | /// \since Crypto++ 2.2 27 | template 28 | class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy, public SEAL_Info 29 | { 30 | protected: 31 | void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); 32 | void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); 33 | void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length); 34 | bool CipherIsRandomAccess() const {return true;} 35 | void SeekToIteration(lword iterationCount); 36 | 37 | private: 38 | FixedSizeSecBlock m_T; 39 | FixedSizeSecBlock m_S; 40 | SecBlock m_R; 41 | 42 | word32 m_startCount, m_iterationsPerCount; 43 | word32 m_outsideCounter, m_insideCounter; 44 | }; 45 | 46 | /// \brief SEAL stream cipher 47 | /// \tparam B Endianness of the stream cipher 48 | /// \sa SEAL 49 | /// \since Crypto++ 2.2 50 | template 51 | struct SEAL : public SEAL_Info, public SymmetricCipherDocumentation 52 | { 53 | typedef SymmetricCipherFinal, AdditiveCipherTemplate<> >, SEAL_Info > Encryption; 54 | typedef Encryption Decryption; 55 | }; 56 | 57 | NAMESPACE_END 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /secblockfwd.h: -------------------------------------------------------------------------------- 1 | // secblockfwd.h - written and placed in the public domain by Jeffrey Walton 2 | 3 | /// \file secblockfwd.h 4 | /// \brief Forward declarations for SecBlock 5 | /// \details secblock.h and misc.h have a circular dependency. secblockfwd.h 6 | /// allows the library to sidestep the circular dependency, and reference 7 | /// SecBlock classes without the full implementation. 8 | /// \since Crypto++ 8.3 9 | 10 | #ifndef CRYPTOPP_SECBLOCKFWD_H 11 | #define CRYPTOPP_SECBLOCKFWD_H 12 | 13 | #include "config.h" 14 | 15 | NAMESPACE_BEGIN(CryptoPP) 16 | 17 | template 18 | class SecBlock; 19 | 20 | template 21 | class AllocatorWithCleanup; 22 | 23 | typedef SecBlock > SecByteBlock; 24 | typedef SecBlock > SecWordBlock; 25 | typedef SecBlock > AlignedSecByteBlock; 26 | 27 | NAMESPACE_END 28 | 29 | #endif // CRYPTOPP_SECBLOCKFWD_H 30 | -------------------------------------------------------------------------------- /seed.h: -------------------------------------------------------------------------------- 1 | // seed.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file seed.h 4 | /// \brief Classes for the SEED block cipher 5 | /// \since Crypto++ 5.6.0 6 | 7 | #ifndef CRYPTOPP_SEED_H 8 | #define CRYPTOPP_SEED_H 9 | 10 | #include "seckey.h" 11 | #include "secblock.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief SEED block cipher information 16 | /// \since Crypto++ 5.6.0 17 | struct SEED_Info : public FixedBlockSize<16>, public FixedKeyLength<16>, public FixedRounds<16> 18 | { 19 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "SEED";} 20 | }; 21 | 22 | /// \brief SEED block cipher 23 | /// \sa SEED 24 | /// \since Crypto++ 5.6.0 25 | class SEED : public SEED_Info, public BlockCipherDocumentation 26 | { 27 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 28 | { 29 | public: 30 | void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms); 31 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 32 | 33 | protected: 34 | FixedSizeSecBlock m_k; 35 | }; 36 | 37 | public: 38 | typedef BlockCipherFinal Encryption; 39 | typedef BlockCipherFinal Decryption; 40 | }; 41 | 42 | NAMESPACE_END 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /sha1_armv4.h: -------------------------------------------------------------------------------- 1 | /* Header file for use with Cryptogam's ARMv4 SHA1. */ 2 | /* Also see http://www.openssl.org/~appro/cryptogams/ */ 3 | /* https://wiki.openssl.org/index.php/Cryptogams_SHA. */ 4 | 5 | #ifndef CRYPTOGAMS_SHA1_ARMV4_H 6 | #define CRYPTOGAMS_SHA1_ARMV4_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* Crypto++ modified sha1_block_data_order to pass caps as a parameter. */ 13 | /* Also see https://github.com/weidai11/cryptopp/issues/846. */ 14 | void cryptogams_sha1_block_data_order(void *state, const void *data, size_t blocks); 15 | 16 | /* Cryptogams arm caps */ 17 | #define CRYPTOGAMS_ARMV7_NEON (1<<0) 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /* CRYPTOGAMS_SHA1_ARMV4_H */ 24 | -------------------------------------------------------------------------------- /sha256_armv4.h: -------------------------------------------------------------------------------- 1 | /* Header file for use with Cryptogam's ARMv4 SHA1. */ 2 | /* Also see http://www.openssl.org/~appro/cryptogams/ */ 3 | /* https://wiki.openssl.org/index.php/Cryptogams_SHA. */ 4 | 5 | #ifndef CRYPTOGAMS_SHA256_ARMV4_H 6 | #define CRYPTOGAMS_SHA256_ARMV4_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* Crypto++ modified cryptogams_sha256_block_data_order to pass caps as a parameter. */ 13 | /* Also see https://github.com/weidai11/cryptopp/issues/846. */ 14 | void cryptogams_sha256_block_data_order(void *state, const void *data, size_t blocks); 15 | 16 | /* Cryptogams arm caps */ 17 | #define CRYPTOGAMS_ARMV7_NEON (1<<0) 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /* CRYPTOGAMS_SHA256_ARMV4_H */ 24 | -------------------------------------------------------------------------------- /sha3.cpp: -------------------------------------------------------------------------------- 1 | // sha3.cpp - modified by Wei Dai from Ronny Van Keer's public domain 2 | // Keccak-simple.c. All modifications here are placed in the 3 | // public domain by Wei Dai. 4 | // Keccack core function moved to keccakc.cpp in AUG 2018 5 | // by Jeffrey Walton. Separating the core file allows both 6 | // SHA3 and Keccack to share the core implementation. 7 | 8 | /* 9 | The Keccak sponge function, designed by Guido Bertoni, Joan Daemen, 10 | Michael Peeters and Gilles Van Assche. For more information, feedback or 11 | questions, please refer to our website: http://keccak.noekeon.org/ 12 | 13 | Implementation by Ronny Van Keer, hereby denoted as "the implementer". 14 | 15 | To the extent possible under law, the implementer has waived all copyright 16 | and related or neighboring rights to the source code in this file. 17 | http://creativecommons.org/publicdomain/zero/1.0/ 18 | */ 19 | 20 | #include "pch.h" 21 | #include "sha3.h" 22 | 23 | NAMESPACE_BEGIN(CryptoPP) 24 | 25 | // The Keccak core function 26 | extern void KeccakF1600(word64 *state); 27 | 28 | NAMESPACE_END 29 | 30 | NAMESPACE_BEGIN(CryptoPP) 31 | 32 | void SHA3::Update(const byte *input, size_t length) 33 | { 34 | CRYPTOPP_ASSERT(!(input == NULLPTR && length != 0)); 35 | if (length == 0) { return; } 36 | 37 | size_t spaceLeft; 38 | while (length >= (spaceLeft = r() - m_counter)) 39 | { 40 | if (spaceLeft) 41 | xorbuf(m_state.BytePtr() + m_counter, input, spaceLeft); 42 | KeccakF1600(m_state); 43 | input += spaceLeft; 44 | length -= spaceLeft; 45 | m_counter = 0; 46 | } 47 | 48 | if (length) 49 | xorbuf(m_state.BytePtr() + m_counter, input, length); 50 | m_counter += (unsigned int)length; 51 | } 52 | 53 | void SHA3::Restart() 54 | { 55 | std::memset(m_state, 0, m_state.SizeInBytes()); 56 | m_counter = 0; 57 | } 58 | 59 | void SHA3::TruncatedFinal(byte *hash, size_t size) 60 | { 61 | CRYPTOPP_ASSERT(hash != NULLPTR); 62 | ThrowIfInvalidTruncatedSize(size); 63 | 64 | m_state.BytePtr()[m_counter] ^= 0x06; 65 | m_state.BytePtr()[r()-1] ^= 0x80; 66 | KeccakF1600(m_state); 67 | std::memcpy(hash, m_state, size); 68 | Restart(); 69 | } 70 | 71 | NAMESPACE_END 72 | -------------------------------------------------------------------------------- /sha512_armv4.h: -------------------------------------------------------------------------------- 1 | /* Header file for use with Cryptogam's ARMv4 SHA512. */ 2 | /* Also see http://www.openssl.org/~appro/cryptogams/ */ 3 | /* https://wiki.openssl.org/index.php/Cryptogams_SHA. */ 4 | 5 | #ifndef CRYPTOGAMS_SHA512_ARMV4_H 6 | #define CRYPTOGAMS_SHA512_ARMV4_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* Crypto++ modified cryptogams_sha512_block_data_order to pass caps as a parameter. */ 13 | /* Also see https://github.com/weidai11/cryptopp/issues/846. */ 14 | void cryptogams_sha512_block_data_order(void *state, const void *data, size_t blocks); 15 | 16 | /* Cryptogams arm caps */ 17 | #define CRYPTOGAMS_ARMV7_NEON (1<<0) 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /* CRYPTOGAMS_SHA512_ARMV4_H */ 24 | -------------------------------------------------------------------------------- /shacal2.h: -------------------------------------------------------------------------------- 1 | // shacal.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file shacal2.h 4 | /// \brief Classes for the SHACAL-2 block cipher 5 | /// \since Crypto++ 5.2, Intel SHA since Crypto++ 6.0 6 | 7 | #ifndef CRYPTOPP_SHACAL2_H 8 | #define CRYPTOPP_SHACAL2_H 9 | 10 | #include "seckey.h" 11 | #include "secblock.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief SHACAL2 block cipher information 16 | struct SHACAL2_Info : public FixedBlockSize<32>, public VariableKeyLength<16, 16, 64> 17 | { 18 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "SHACAL-2";} 19 | }; 20 | 21 | /// \brief SHACAL2 block cipher 22 | /// \since Crypto++ 5.2, Intel SHA since Crypto++ 6.0 23 | /// \sa SHACAL-2 24 | class SHACAL2 : public SHACAL2_Info, public BlockCipherDocumentation 25 | { 26 | /// \brief SHACAL2 block cipher transformation functions 27 | /// \details Provides implementation common to encryption and decryption 28 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 29 | { 30 | public: 31 | std::string AlgorithmProvider() const; 32 | void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); 33 | 34 | protected: 35 | FixedSizeAlignedSecBlock m_key; 36 | 37 | static const word32 K[64]; 38 | }; 39 | 40 | /// \brief SHACAL2 block cipher transformation functions 41 | /// \details Encryption transformation 42 | class CRYPTOPP_NO_VTABLE Enc : public Base 43 | { 44 | public: 45 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 46 | }; 47 | 48 | /// \brief SHACAL2 block cipher transformation functions 49 | /// \details Decryption transformation 50 | class CRYPTOPP_NO_VTABLE Dec : public Base 51 | { 52 | public: 53 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 54 | }; 55 | 56 | public: 57 | typedef BlockCipherFinal Encryption; 58 | typedef BlockCipherFinal Decryption; 59 | }; 60 | 61 | typedef SHACAL2::Encryption SHACAL2Encryption; 62 | typedef SHACAL2::Decryption SHACAL2Decryption; 63 | 64 | NAMESPACE_END 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /shark.h: -------------------------------------------------------------------------------- 1 | // shark.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file shark.h 4 | /// \brief Classes for the SHARK block cipher 5 | /// \since Crypto++ 2.1 6 | 7 | #ifndef CRYPTOPP_SHARK_H 8 | #define CRYPTOPP_SHARK_H 9 | 10 | #include "config.h" 11 | #include "seckey.h" 12 | #include "secblock.h" 13 | 14 | NAMESPACE_BEGIN(CryptoPP) 15 | 16 | /// \brief SHARK block cipher information 17 | /// \since Crypto++ 2.1 18 | struct SHARK_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<6, 2> 19 | { 20 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "SHARK-E";} 21 | }; 22 | 23 | /// \brief SHARK block cipher 24 | /// SHARK-E 25 | /// \since Crypto++ 2.1 26 | class SHARK : public SHARK_Info, public BlockCipherDocumentation 27 | { 28 | /// \brief SHARK block cipher default operation 29 | /// \since Crypto++ 2.1 30 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 31 | { 32 | public: 33 | void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶m); 34 | 35 | protected: 36 | unsigned int m_rounds; 37 | SecBlock m_roundKeys; 38 | }; 39 | 40 | /// \brief SHARK block cipher encryption operation 41 | /// \since Crypto++ 2.1 42 | class CRYPTOPP_NO_VTABLE Enc : public Base 43 | { 44 | public: 45 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 46 | 47 | // used by Base to do key setup 48 | void InitForKeySetup(); 49 | 50 | private: 51 | static const byte sbox[256]; 52 | static const word64 cbox[8][256]; 53 | }; 54 | 55 | /// \brief SHARK block cipher decryption operation 56 | /// \since Crypto++ 2.1 57 | class CRYPTOPP_NO_VTABLE Dec : public Base 58 | { 59 | public: 60 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 61 | 62 | private: 63 | static const byte sbox[256]; 64 | static const word64 cbox[8][256]; 65 | }; 66 | 67 | public: 68 | typedef BlockCipherFinal Encryption; 69 | typedef BlockCipherFinal Decryption; 70 | }; 71 | 72 | typedef SHARK::Encryption SHARKEncryption; 73 | typedef SHARK::Decryption SHARKDecryption; 74 | 75 | NAMESPACE_END 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /simple.cpp: -------------------------------------------------------------------------------- 1 | // simple.cpp - originally written and placed in the public domain by Wei Dai 2 | 3 | #include "pch.h" 4 | 5 | #ifndef CRYPTOPP_IMPORTS 6 | 7 | #include "simple.h" 8 | 9 | NAMESPACE_BEGIN(CryptoPP) 10 | 11 | NAMESPACE_END 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /square.h: -------------------------------------------------------------------------------- 1 | // square.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file square.h 4 | /// \brief Classes for the Square block cipher 5 | 6 | #ifndef CRYPTOPP_SQUARE_H 7 | #define CRYPTOPP_SQUARE_H 8 | 9 | #include "seckey.h" 10 | #include "secblock.h" 11 | 12 | NAMESPACE_BEGIN(CryptoPP) 13 | 14 | /// \brief Square block cipher information 15 | /// \since Crypto++ 2.2 16 | struct Square_Info : public FixedBlockSize<16>, public FixedKeyLength<16>, FixedRounds<8> 17 | { 18 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Square";} 19 | }; 20 | 21 | /// \brief Square block cipher 22 | /// \sa Square 23 | /// \since Crypto++ 2.2 24 | class Square : public Square_Info, public BlockCipherDocumentation 25 | { 26 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 27 | { 28 | public: 29 | void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); 30 | 31 | protected: 32 | FixedSizeSecBlock m_roundkeys; 33 | }; 34 | 35 | class CRYPTOPP_NO_VTABLE Enc : public Base 36 | { 37 | public: 38 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 39 | private: 40 | static const byte Se[256]; 41 | static const word32 Te[4][256]; 42 | }; 43 | 44 | class CRYPTOPP_NO_VTABLE Dec : public Base 45 | { 46 | public: 47 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 48 | private: 49 | static const byte Sd[256]; 50 | static const word32 Td[4][256]; 51 | }; 52 | 53 | public: 54 | typedef BlockCipherFinal Encryption; 55 | typedef BlockCipherFinal Decryption; 56 | }; 57 | 58 | typedef Square::Encryption SquareEncryption; 59 | typedef Square::Decryption SquareDecryption; 60 | 61 | NAMESPACE_END 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /trunhash.h: -------------------------------------------------------------------------------- 1 | // trunhash.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file trunhash.h 4 | /// \brief Classes for truncated hashes 5 | 6 | #ifndef CRYPTOPP_TRUNHASH_H 7 | #define CRYPTOPP_TRUNHASH_H 8 | 9 | #include "cryptlib.h" 10 | 11 | NAMESPACE_BEGIN(CryptoPP) 12 | 13 | /// \brief Null hash 14 | /// \details A null hash that conforms to HashTransformation interface 15 | class NullHash : public HashTransformation 16 | { 17 | public: 18 | void Update(const byte *input, size_t length) 19 | {CRYPTOPP_UNUSED(input);CRYPTOPP_UNUSED(length);} 20 | unsigned int DigestSize() const 21 | {return 0;} 22 | void TruncatedFinal(byte *digest, size_t digestSize) 23 | {CRYPTOPP_UNUSED(digest);CRYPTOPP_UNUSED(digestSize);} 24 | bool TruncatedVerify(const byte *digest, size_t digestLength) 25 | {CRYPTOPP_UNUSED(digest);CRYPTOPP_UNUSED(digestLength);return true;} 26 | }; 27 | 28 | /// \brief Construct new HashModule with smaller digest size from an existing one 29 | /// \tparam T HashTransformation derived class 30 | template 31 | class TruncatedHashTemplate : public HashTransformation 32 | { 33 | public: 34 | /// \brief Construct a TruncatedHashTemplate 35 | TruncatedHashTemplate(T hm, unsigned int digestSize) 36 | : m_hm(hm), m_digestSize(digestSize) {} 37 | /// \brief Construct a TruncatedHashTemplate 38 | TruncatedHashTemplate(const byte *key, size_t keyLength, unsigned int digestSize) 39 | : m_hm(key, keyLength), m_digestSize(digestSize) {} 40 | /// \brief Construct a TruncatedHashTemplate 41 | TruncatedHashTemplate(size_t digestSize) 42 | : m_digestSize(digestSize) {} 43 | 44 | void Restart() 45 | {m_hm.Restart();} 46 | void Update(const byte *input, size_t length) 47 | {m_hm.Update(input, length);} 48 | unsigned int DigestSize() const {return m_digestSize;} 49 | void TruncatedFinal(byte *digest, size_t digestSize) 50 | {m_hm.TruncatedFinal(digest, digestSize);} 51 | bool TruncatedVerify(const byte *digest, size_t digestLength) 52 | {return m_hm.TruncatedVerify(digest, digestLength);} 53 | 54 | private: 55 | T m_hm; 56 | unsigned int m_digestSize; 57 | }; 58 | 59 | typedef TruncatedHashTemplate TruncatedHashModule; 60 | 61 | NAMESPACE_END 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /ttmac.h: -------------------------------------------------------------------------------- 1 | // ttmac.h - written and placed in the public domain by Kevin Springle 2 | 3 | /// \file ttmac.h 4 | /// \brief Classes for the TTMAC message authentication code 5 | 6 | #ifndef CRYPTOPP_TTMAC_H 7 | #define CRYPTOPP_TTMAC_H 8 | 9 | #include "seckey.h" 10 | #include "iterhash.h" 11 | #include "secblock.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief TTMAC message authentication code information 16 | class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash 17 | { 18 | public: 19 | static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");} 20 | CRYPTOPP_CONSTANT(DIGESTSIZE=20); 21 | 22 | unsigned int DigestSize() const {return DIGESTSIZE;}; 23 | void UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs ¶ms); 24 | void TruncatedFinal(byte *mac, size_t size); 25 | 26 | protected: 27 | static void Transform (word32 *digest, const word32 *X, bool last); 28 | void HashEndianCorrectedBlock(const word32 *data) {Transform(m_digest, data, false);} 29 | void Init(); 30 | word32* StateBuf() {return m_digest;} 31 | 32 | FixedSizeSecBlock m_digest; 33 | FixedSizeSecBlock m_key; 34 | }; 35 | 36 | /// \brief Two-Track-MAC message authentication code 37 | /// \tparam T HashTransformation class 38 | /// \details 160-bit MAC with 160-bit key 39 | /// \sa MessageAuthenticationCode(), Two-Track-MAC 40 | DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal, TTMAC); 41 | 42 | NAMESPACE_END 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /twofish.h: -------------------------------------------------------------------------------- 1 | // twofish.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file twofish.h 4 | /// \brief Classes for the Twofish block cipher 5 | 6 | #ifndef CRYPTOPP_TWOFISH_H 7 | #define CRYPTOPP_TWOFISH_H 8 | 9 | #include "seckey.h" 10 | #include "secblock.h" 11 | 12 | NAMESPACE_BEGIN(CryptoPP) 13 | 14 | /// \brief Twofish block cipher information 15 | /// \since Crypto++ 3.1 16 | struct Twofish_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>, FixedRounds<16> 17 | { 18 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Twofish";} 19 | }; 20 | 21 | /// \brief Twofish block cipher 22 | /// \sa Twofish 23 | /// \since Crypto++ 3.1 24 | class Twofish : public Twofish_Info, public BlockCipherDocumentation 25 | { 26 | class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl 27 | { 28 | public: 29 | void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); 30 | 31 | protected: 32 | static word32 h0(word32 x, const word32 *key, unsigned int kLen); 33 | static word32 h(word32 x, const word32 *key, unsigned int kLen); 34 | 35 | static const byte q[2][256]; 36 | static const word32 mds[4][256]; 37 | 38 | FixedSizeSecBlock m_k; 39 | FixedSizeSecBlock m_s; 40 | }; 41 | 42 | class CRYPTOPP_NO_VTABLE Enc : public Base 43 | { 44 | public: 45 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 46 | }; 47 | 48 | class CRYPTOPP_NO_VTABLE Dec : public Base 49 | { 50 | public: 51 | void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; 52 | }; 53 | 54 | public: 55 | typedef BlockCipherFinal Encryption; 56 | typedef BlockCipherFinal Decryption; 57 | }; 58 | 59 | typedef Twofish::Encryption TwofishEncryption; 60 | typedef Twofish::Decryption TwofishDecryption; 61 | 62 | NAMESPACE_END 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /vc60.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noloader/cryptopp/1e20219ecddc64cf23e04f5cb990c49e1b0074c3/vc60.zip -------------------------------------------------------------------------------- /vs2005.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noloader/cryptopp/1e20219ecddc64cf23e04f5cb990c49e1b0074c3/vs2005.zip -------------------------------------------------------------------------------- /wake.h: -------------------------------------------------------------------------------- 1 | // wake.h - originally written and placed in the public domain by Wei Dai 2 | 3 | /// \file wake.h 4 | /// \brief Classes for WAKE stream cipher 5 | 6 | #ifndef CRYPTOPP_WAKE_H 7 | #define CRYPTOPP_WAKE_H 8 | 9 | #include "seckey.h" 10 | #include "secblock.h" 11 | #include "strciphr.h" 12 | 13 | NAMESPACE_BEGIN(CryptoPP) 14 | 15 | /// \brief WAKE stream cipher information 16 | /// \tparam B Endianness of the stream cipher 17 | /// \since Crypto++ 1.0 18 | template 19 | struct WAKE_OFB_Info : public FixedKeyLength<32> 20 | { 21 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";} 22 | }; 23 | 24 | class CRYPTOPP_NO_VTABLE WAKE_Base 25 | { 26 | protected: 27 | word32 M(word32 x, word32 y); 28 | void GenKey(word32 k0, word32 k1, word32 k2, word32 k3); 29 | 30 | word32 t[257]; 31 | word32 r3, r4, r5, r6; 32 | }; 33 | 34 | /// \brief WAKE stream cipher operation 35 | /// \tparam B Endianness of the stream cipher 36 | /// \since Crypto++ 1.0 37 | template 38 | class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy, protected WAKE_Base 39 | { 40 | protected: 41 | void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); 42 | // OFB 43 | void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); 44 | bool CipherIsRandomAccess() const {return false;} 45 | }; 46 | 47 | /// \brief WAKE stream cipher 48 | /// \tparam B Endianness of the stream cipher 49 | /// \since Crypto++ 1.0 50 | template 51 | struct WAKE_OFB : public WAKE_OFB_Info, public SymmetricCipherDocumentation 52 | { 53 | typedef SymmetricCipherFinal, AdditiveCipherTemplate<> >, WAKE_OFB_Info > Encryption; 54 | typedef Encryption Decryption; 55 | }; 56 | 57 | NAMESPACE_END 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /whrlpool.h: -------------------------------------------------------------------------------- 1 | // whrlpool.h - originally modified by Kevin Springle from Paulo Barreto and Vincent Rijmen's 2 | // public domain code, whirlpool.c. Updated to Whirlpool version 3.0, optimized 3 | // and SSE version added by WD. All modifications are placed in the public domain. 4 | 5 | #ifndef CRYPTOPP_WHIRLPOOL_H 6 | #define CRYPTOPP_WHIRLPOOL_H 7 | 8 | /// \file whrlpool.h 9 | /// \brief Classes for the Whirlpool message digest 10 | /// \details Crypto++ provides version 3.0 of the Whirlpool algorithm. 11 | /// This version of the algorithm was submitted for ISO standardization. 12 | 13 | #include "config.h" 14 | #include "iterhash.h" 15 | 16 | // Clang 3.3 integrated assembler crash on Linux. Clang 3.4 due to compiler 17 | // error with .intel_syntax, http://llvm.org/bugs/show_bug.cgi?id=24232 18 | #if CRYPTOPP_BOOL_X32 || defined(CRYPTOPP_DISABLE_MIXED_ASM) 19 | # define CRYPTOPP_DISABLE_WHIRLPOOL_ASM 1 20 | #endif 21 | 22 | NAMESPACE_BEGIN(CryptoPP) 23 | 24 | /// \brief Whirlpool message digest 25 | /// \details Crypto++ provides version 3.0 of the Whirlpool algorithm. 26 | /// This version of the algorithm was submitted for ISO standardization. 27 | /// \since Crypto++ 5.2 28 | /// \sa Whirlpool 29 | class Whirlpool : public IteratedHashWithStaticTransform 30 | { 31 | public: 32 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Whirlpool";} 33 | std::string AlgorithmProvider() const; 34 | 35 | static void InitState(HashWordType *state); 36 | static void Transform(word64 *digest, const word64 *data); 37 | void TruncatedFinal(byte *hash, size_t size); 38 | }; 39 | 40 | NAMESPACE_END 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /xtrcrypt.h: -------------------------------------------------------------------------------- 1 | #ifndef CRYPTOPP_XTRCRYPT_H 2 | #define CRYPTOPP_XTRCRYPT_H 3 | 4 | /// \file 5 | /// \brief XTR public key system 6 | /// \sa "The XTR public key system" by Arjen K. Lenstra and Eric R. Verheul 7 | 8 | #include "cryptlib.h" 9 | #include "xtr.h" 10 | #include "integer.h" 11 | 12 | NAMESPACE_BEGIN(CryptoPP) 13 | 14 | /// \brief XTR-DH with key validation 15 | class XTR_DH : public SimpleKeyAgreementDomain, public CryptoParameters 16 | { 17 | typedef XTR_DH ThisClass; 18 | 19 | public: 20 | XTR_DH(const Integer &p, const Integer &q, const GFP2Element &g); 21 | XTR_DH(RandomNumberGenerator &rng, unsigned int pbits, unsigned int qbits); 22 | XTR_DH(BufferedTransformation &domainParams); 23 | 24 | void DEREncode(BufferedTransformation &domainParams) const; 25 | 26 | bool Validate(RandomNumberGenerator &rng, unsigned int level) const; 27 | bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const; 28 | void AssignFrom(const NameValuePairs &source); 29 | CryptoParameters & AccessCryptoParameters() {return *this;} 30 | unsigned int AgreedValueLength() const {return 2*m_p.ByteCount();} 31 | unsigned int PrivateKeyLength() const {return m_q.ByteCount();} 32 | unsigned int PublicKeyLength() const {return 2*m_p.ByteCount();} 33 | 34 | void GeneratePrivateKey(RandomNumberGenerator &rng, byte *privateKey) const; 35 | void GeneratePublicKey(RandomNumberGenerator &rng, const byte *privateKey, byte *publicKey) const; 36 | bool Agree(byte *agreedValue, const byte *privateKey, const byte *otherPublicKey, bool validateOtherPublicKey=true) const; 37 | 38 | const Integer &GetModulus() const {return m_p;} 39 | const Integer &GetSubgroupOrder() const {return m_q;} 40 | const GFP2Element &GetSubgroupGenerator() const {return m_g;} 41 | 42 | void SetModulus(const Integer &p) {m_p = p;} 43 | void SetSubgroupOrder(const Integer &q) {m_q = q;} 44 | void SetSubgroupGenerator(const GFP2Element &g) {m_g = g;} 45 | 46 | private: 47 | unsigned int ExponentBitLength() const; 48 | 49 | Integer m_p, m_q; 50 | GFP2Element m_g; 51 | }; 52 | 53 | NAMESPACE_END 54 | 55 | #endif 56 | --------------------------------------------------------------------------------