issue_owner_repo
listlengths
2
2
issue_body
stringlengths
0
261k
issue_title
stringlengths
1
925
issue_comments_url
stringlengths
56
81
issue_comments_count
int64
0
2.5k
issue_created_at
stringlengths
20
20
issue_updated_at
stringlengths
20
20
issue_html_url
stringlengths
37
62
issue_github_id
int64
387k
2.46B
issue_number
int64
1
127k
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report When I use VS to compile a library, it throws me a breakpoint error. * OS: Windows 10 x64 Professional * Crypto++ version: Latest(8.8.0) * I am using Visual Studio 2022 Error: A breakpoint instruction (__debugbreak() statement or a similar call) was executed in cryptest.exe.
Library building error
https://api.github.com/repos/weidai11/cryptopp/issues/1223/comments
0
2023-07-10T14:16:17Z
2023-07-10T14:39:43Z
https://github.com/weidai11/cryptopp/issues/1223
1,796,882,074
1,223
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report I'm trying to build Crypto++ with `make cryptopp.dll` on a Windows host and it fails with the following errors: ``` x86_64-w64-mingw32-g++ -DNDEBUG -D_WIN32_WINNT=0x0501 -DCRYPTOPP_EXPORTS -g2 -O3 -pipe -c aria_simd.cpp -o aria_simd.export.o In file included from aria_simd.cpp:14: /gnu/store/dsy1v48inzkwngvjrkr2sm4i1d3ianbm-gcc-cross-x86_64-w64-mingw32-11.3.0-lib/lib/gcc/x86_64-w64-mingw32/11.3.0/include/tmmintrin.h: In function ?void CryptoPP::ARIA_ProcessAndXorBlock_SSSE3(const byte*, CryptoPP::byte*, const byte*, CryptoPP::word32*)?: /gnu/store/dsy1v48inzkwngvjrkr2sm4i1d3ianbm-gcc-cross-x86_64-w64-mingw32-11.3.0-lib/lib/gcc/x86_64-w64-mingw32/11.3.0/include/tmmintrin.h:136:1: error: inlining failed in call to ?always_inline? ?__m128i _mm_shuffle_epi8(__m128i, __m128i)?: target specific option mismatch 136 | _mm_shuffle_epi8 (__m128i __X, __m128i __Y) | ^~~~~~~~~~~~~~~~ aria_simd.cpp:176:33: note: called from here 176 | _mm_storeu_si128(M128_CAST(outBlock), | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ 177 | _mm_xor_si128( | ~~~~~~~~~~~~~~ 178 | _mm_loadu_si128(CONST_M128_CAST(xorBlock)), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 179 | _mm_xor_si128( | ~~~~~~~~~~~~~~ 180 | _mm_loadu_si128(CONST_M128_CAST(outBlock)), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | _mm_shuffle_epi8(_mm_load_si128(CONST_M128_CAST(rk)), MASK))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 182 | ); ``` It seems that on: https://github.com/weidai11/cryptopp/blob/6ecc789df1cea7640f54ddc2aed149c6b188891f/GNUmakefile#L1788 The SSE flags aren't passed to the compiler when compiling the `_simd.cpp` files. * GNU Guix. * Crypto++ 8.8.0. * Using GNUmakefile. * `x86_64-w64-mingw32-g++ -DNDEBUG -D_WIN32_WINNT=0x0501 -c cryptlib.cpp` * Does not reach the link stage
MinGW cross-compilation does not work
https://api.github.com/repos/weidai11/cryptopp/issues/1222/comments
4
2023-07-10T11:52:15Z
2023-07-14T12:48:29Z
https://github.com/weidai11/cryptopp/issues/1222
1,796,607,161
1,222
[ "weidai11", "cryptopp" ]
The file says: This source file uses intrinsics to gain access to SSE and NEON instructions. But it seems all the code is only for `CRYPTOPP_SSSE3_AVAILABLE` being defined. * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc) Master
keccak_simd.cpp: no NEON code
https://api.github.com/repos/weidai11/cryptopp/issues/1221/comments
0
2023-07-05T08:23:37Z
2023-07-05T08:43:04Z
https://github.com/weidai11/cryptopp/issues/1221
1,789,042,275
1,221
[ "weidai11", "cryptopp" ]
The file says: This source file uses intrinsics to gain access to SSE and NEON instructions. But it seems all the code is only for `CRYPTOPP_SSSE3_AVAILABLE` being defined.
keccak_simd.cpp: no NEON code
https://api.github.com/repos/weidai11/cryptopp/issues/1220/comments
0
2023-07-05T06:30:05Z
2023-07-05T08:43:19Z
https://github.com/weidai11/cryptopp/issues/1220
1,788,863,362
1,220
[ "weidai11", "cryptopp" ]
I would like to build openssl for ARM, ARM64 windows plaform. Is it supported? Building and assembling rdrand.asm fail, 'ml64.exe' is not an internal or external command, nor is it a runnable program
How to build cryptoppfor ARM, ARM64 windows platforms?
https://api.github.com/repos/weidai11/cryptopp/issues/1219/comments
0
2023-07-04T13:01:30Z
2023-07-05T08:44:31Z
https://github.com/weidai11/cryptopp/issues/1219
1,787,891,886
1,219
[ "weidai11", "cryptopp" ]
I'm building CryptoPP 8.8.0 with CMake on Windows 10 and I see a lot of warnings (summarized below), while 8.7.0 build produces no warnings. ``` cpu.cpp:96:14: warning: unused function 'SigIllHandler' [-Wunused-function] aria_simd.cpp:46:13: warning: unused function 'ARIA_BRF' [-Wunused-function] chacha.cpp:86:13: warning: unused function 'MultiBlockSafe' [-Wunused-function] eccrypto.cpp:58:16: warning: unused function 'ConvertToInteger' [-Wunused-function] eccrypto.cpp:71:13: warning: function 'CheckMOVCondition' is not needed and will not be emitted [-Wunneeded-internal-declaration] eccrypto.cpp:147:13: warning: unused function 'GetRecommendedParameters' [-Wunused-function] donna_64.cpp:1013:1: warning: unused function 'expand_raw256_modm' [-Wunused-function] donna_64.cpp:1279:1: warning: unused function 'ge25519_add' [-Wunused-function] ecp.cpp:44:16: warning: unused function 'IdentityToInteger' [-Wunused-function] lea_simd.cpp:314:16: warning: unused function 'RotateLeft<8U>' [-Wunused-function] lea_simd.cpp:326:16: warning: unused function 'RotateRight<8U>' [-Wunused-function] lsh256.cpp:177:13: warning: unused function 'LSH_IS_LSH512' [-Wunused-function] lsh256.cpp:197:9: warning: unused function 'ROTL' [-Wunused-function] rijndael.cpp:157:20: warning: unused function 'AliasedWithTable' [-Wunused-function] lsh256_sse.cpp:160:16: warning: unused function 'loadLE32' [-Wunused-function] lsh512_sse.cpp:166:16: warning: unused function 'loadLE64' [-Wunused-function] lsh512_sse.cpp:170:9: warning: unused function 'ROTL64' [-Wunused-function] simon128_simd.cpp:344:9: warning: unused function 'RotateRight64<8U>' [-Wunused-function] xts.cpp:47:6: warning: unused function 'Modes_TestInstantiations' [-Wunused-function] rijndael.cpp:157:20: warning: unused function 'AliasedWithTable' [-Wunused-function] sm4_simd.cpp:162:16: warning: unused function 'UnpackXMM<0U>' [-Wunused-function] sm4_simd.cpp:282:13: warning: unused function 'SM4_Dec_4_Blocks' [-Wunused-function] sm4_simd.cpp:298:13: warning: unused function 'SM4_Dec_Block' [-Wunused-function] sharkbox.cpp:50:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:307:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:564:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:821:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:1078:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:1335:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:1592:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:1849:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:2109:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:2366:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:2623:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:2880:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:3137:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:3394:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:3651:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] sharkbox.cpp:3908:1: warning: suggest braces around initialization of subobject [-Wmissing-braces] tftables.cpp:63:2: warning: suggest braces around initialization of subobject [-Wmissing-braces] tftables.cpp:128:2: warning: suggest braces around initialization of subobject [-Wmissing-braces] tftables.cpp:193:2: warning: suggest braces around initialization of subobject [-Wmissing-braces] tftables.cpp:258:2: warning: suggest braces around initialization of subobject [-Wmissing-braces] ```
8.8.0 compilation warnings
https://api.github.com/repos/weidai11/cryptopp/issues/1217/comments
5
2023-06-26T09:45:54Z
2023-09-25T20:22:00Z
https://github.com/weidai11/cryptopp/issues/1217
1,774,368,298
1,217
[ "weidai11", "cryptopp" ]
null
Why many issues are closed without any replies? Hard to understand status.
https://api.github.com/repos/weidai11/cryptopp/issues/1216/comments
1
2023-06-24T08:41:11Z
2023-07-05T08:44:43Z
https://github.com/weidai11/cryptopp/issues/1216
1,772,539,735
1,216
[ "weidai11", "cryptopp" ]
`emplace_*` methods are more efficient when adding new objects, but might require C++11. Does it make sense to add code for this? Tests run successfully for the branch https://github.com/irwir/cryptopp/tree/use_emplace
Using emplace_* instead of push_*
https://api.github.com/repos/weidai11/cryptopp/issues/1215/comments
4
2023-06-24T08:14:07Z
2023-10-01T13:16:34Z
https://github.com/weidai11/cryptopp/issues/1215
1,772,528,654
1,215
[ "weidai11", "cryptopp" ]
This file is silently creataed by VS. In most cases such automatically generated files could be safely removed. Stackoverflow [discussion ](https://stackoverflow.com/questions/13015265/vcxproj-in-source-control#13015434) includes MSDN link.
Elimination of cryptest.vcxproj.user
https://api.github.com/repos/weidai11/cryptopp/issues/1213/comments
3
2023-06-23T10:58:46Z
2023-06-25T04:31:56Z
https://github.com/weidai11/cryptopp/issues/1213
1,771,256,196
1,213
[ "weidai11", "cryptopp" ]
cmake/TargetArch.cmake:66 should be able to accept Xcode macros. This is useful when the cryptopp library is getting built as a dependency of an Xcode project. So that the target architechture can be specified in the Xcode project settings, which is most of the times a macro like $(ARCHS_STANDARD) I am currently getting an error when trying to configure cryptopp as a part of my Xcode project ``` => Module : cryptopp -- [cryptopp] CMake version 3.25.2 -- [cryptopp] System iOS -- [cryptopp] Processor arm64 -- [cryptopp] CMAKE_OSX_ARCHITECTURES : $(ARCHS_STANDARD) -- [cryptopp] CMAKE_HOST_SYSTEM_PROCESSOR : arm64 -- [cryptopp] CMAKE_SYSTEM_PROCESSOR : arm64 CMake Error at cryptlib/cmake/TargetArch.cmake:67 (message): Invalid OS X arch name: $(ARCHS_STANDARD) Call Stack (most recent call first): cryptlib/cryptopp/CMakeLists.txt:186 (target_architecture) cryptlib/cryptopp/CMakeLists.txt:214 (check_target_architecture) ```
cmake/TargetArch.cmake:66 should be able to accept Xcode macros
https://api.github.com/repos/weidai11/cryptopp/issues/1211/comments
1
2023-06-09T14:05:53Z
2023-06-25T04:31:43Z
https://github.com/weidai11/cryptopp/issues/1211
1,749,965,214
1,211
[ "weidai11", "cryptopp" ]
Hello there, A small warning with that file with g++-13.1. Just in the unlikely case it points at something serious: ``` /usr/local/gcc-13.1/bin/g++-13.1 -g2 -pipe -std=c++20 -pedantic -Wall -DNDEBUG -O3 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pthread -c nbtheory.cpp nbtheory.cpp: In function ‘const CryptoPP::word16* CryptoPP::GetPrimeTable(unsigned int&)’: nbtheory.cpp:55:36: warning: possibly dangling reference to a temporary [-Wdangling-reference] 55 | const std::vector<word16> &primeTable = Singleton<std::vector<word16>, NewPrimeTable>().Ref(); | ^~~~~~~~~~ nbtheory.cpp:55:100: note: the temporary was destroyed at the end of the full expression ‘CryptoPP::Singleton<std::vector<short unsigned int>, CryptoPP::NewPrimeTable>((CryptoPP::NewPrimeTable(), CryptoPP::NewPrimeTable())).CryptoPP::Singleton<std::vector<short unsigned int>, CryptoPP::NewPrimeTable>::Ref()’ 55 | const std::vector<word16> &primeTable = Singleton<std::vector<word16>, NewPrimeTable>().Ref(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ ``` Thanks!
nbtheory.cpp: warning: possibly dangling reference to a temporary
https://api.github.com/repos/weidai11/cryptopp/issues/1210/comments
2
2023-06-05T17:03:32Z
2023-06-26T13:58:35Z
https://github.com/weidai11/cryptopp/issues/1210
1,742,183,470
1,210
[ "weidai11", "cryptopp" ]
I am using CentOS-5.11, GCC-v12.3.0 cryptopp-v8.7 I tried building using the command `make static dynamic cryptest.exe`, and i got this error : ``` `/opt/gcc-12.3.0/bin/c++ -DNDEBUG -g2 -O3 -fPIC -pthread -pipe -c zlib.cpp ar r libcryptopp.a cryptlib.o cpu.o integer.o 3way.o adler32.o algebra.o algparam.o allocate.o arc4.o aria.o aria_simd.o ariatab.o asn.o authenc.o base32.o base64.o basecode.o bfinit.o blake2.o blake2b_simd.o blake2s_simd.o blowfish.o blumshub.o camellia.o cast.o casts.o cbcmac.o ccm.o chacha.o chacha_avx.o chacha_simd.o chachapoly.o cham.o cham_simd.o channels.o cmac.o crc.o crc_simd.o darn.o default.o des.o dessp.o dh.o dh2.o dll.o donna_32.o donna_64.o donna_sse.o dsa.o eax.o ec2n.o eccrypto.o ecp.o elgamal.o emsa2.o eprecomp.o esign.o files.o filters.o fips140.o fipstest.o gcm.o gcm_simd.o gf256.o gf2_32.o gf2n.o gf2n_simd.o gfpcrypt.o gost.o gzip.o hc128.o hc256.o hex.o hight.o hmac.o hrtimer.o ida.o idea.o iterhash.o kalyna.o kalynatab.o keccak.o keccak_core.o keccak_simd.o lea.o lea_simd.o lsh256.o lsh256_avx.o lsh256_sse.o lsh512.o lsh512_avx.o lsh512_sse.o luc.o mars.o marss.o md2.o md4.o md5.o misc.o modes.o mqueue.o mqv.o nbtheory.o oaep.o osrng.o padlkrng.o panama.o pkcspad.o poly1305.o polynomi.o ppc_simd.o pssr.o pubkey.o queue.o rabbit.o rabin.o randpool.o rc2.o rc5.o rc6.o rdrand.o rdtables.o rijndael.o rijndael_simd.o ripemd.o rng.o rsa.o rw.o safer.o salsa.o scrypt.o seal.o seed.o serpent.o sha.o sha3.o sha_simd.o shacal2.o shacal2_simd.o shake.o shark.o sharkbox.o simeck.o simon.o simon128_simd.o skipjack.o sm3.o sm4.o sm4_simd.o sosemanuk.o speck.o speck128_simd.o square.o squaretb.o sse_simd.o strciphr.o tea.o tftables.o threefish.o tiger.o tigertab.o ttmac.o tweetnacl.o twofish.o vmac.o wake.o whrlpool.o xed25519.o xtr.o xtrcrypt.o xts.o zdeflate.o zinflate.o zlib.o ar: creating libcryptopp.a ranlib libcryptopp.a /opt/gcc-12.3.0/bin/c++ -shared -Wl,-soname,libcryptopp.so.8 -o libcryptopp.so.8.7.0 -g2 -O3 -fPIC -pthread -pipe cryptlib.o cpu.o integer.o 3way.o adler32.o algebra.o algparam.o allocate.o arc4.o aria.o aria_simd.o ariatab.o asn.o authenc.o base32.o base64.o basecode.o bfinit.o blake2.o blake2b_simd.o blake2s_simd.o blowfish.o blumshub.o camellia.o cast.o casts.o cbcmac.o ccm.o chacha.o chacha_avx.o chacha_simd.o chachapoly.o cham.o cham_simd.o channels.o cmac.o crc.o crc_simd.o darn.o default.o des.o dessp.o dh.o dh2.o dll.o donna_32.o donna_64.o donna_sse.o dsa.o eax.o ec2n.o eccrypto.o ecp.o elgamal.o emsa2.o eprecomp.o esign.o files.o filters.o fips140.o fipstest.o gcm.o gcm_simd.o gf256.o gf2_32.o gf2n.o gf2n_simd.o gfpcrypt.o gost.o gzip.o hc128.o hc256.o hex.o hight.o hmac.o hrtimer.o ida.o idea.o iterhash.o kalyna.o kalynatab.o keccak.o keccak_core.o keccak_simd.o lea.o lea_simd.o lsh256.o lsh256_avx.o lsh256_sse.o lsh512.o lsh512_avx.o lsh512_sse.o luc.o mars.o marss.o md2.o md4.o md5.o misc.o modes.o mqueue.o mqv.o nbtheory.o oaep.o osrng.o padlkrng.o panama.o pkcspad.o poly1305.o polynomi.o ppc_simd.o pssr.o pubkey.o queue.o rabbit.o rabin.o randpool.o rc2.o rc5.o rc6.o rdrand.o rdtables.o rijndael.o rijndael_simd.o ripemd.o rng.o rsa.o rw.o safer.o salsa.o scrypt.o seal.o seed.o serpent.o sha.o sha3.o sha_simd.o shacal2.o shacal2_simd.o shake.o shark.o sharkbox.o simeck.o simon.o simon128_simd.o skipjack.o sm3.o sm4.o sm4_simd.o sosemanuk.o speck.o speck128_simd.o square.o squaretb.o sse_simd.o strciphr.o tea.o tftables.o threefish.o tiger.o tigertab.o ttmac.o tweetnacl.o twofish.o vmac.o wake.o whrlpool.o xed25519.o xtr.o xtrcrypt.o xts.o zdeflate.o zinflate.o zlib.o /usr/bin/ld: BFD 2.17.50.0.6-26.el5 20061020 internal error, aborting at ../../bfd/reloc.c line 445 in bfd_get_reloc_size /usr/bin/ld: Please report this bug. collect2: error: ld returned 1 exit status make: *** [libcryptopp.so.8.7.0] Error 1` ``` Looks like the issue is while creating the shared library file. Any suggestions appreciated!
usr/bin/ld: BFD 2.17.50.0.6-26.el5 20061020 internal error
https://api.github.com/repos/weidai11/cryptopp/issues/1209/comments
1
2023-05-26T05:15:09Z
2023-06-25T07:16:03Z
https://github.com/weidai11/cryptopp/issues/1209
1,726,920,720
1,209
[ "weidai11", "cryptopp" ]
Both the last released version 8.7 and the current master branch (2038ab1) have an incorrect order of the release fence and pointer store operations when creating the object. The current current code is ``` T *newObject = m_objectFactory(); s_pObject.store(newObject, std::memory_order_relaxed); std::atomic_thread_fence(std::memory_order_release); ``` however the correct sequence, which is also described in the article linked from the function documentation, should be ``` T *newObject = m_objectFactory(); std::atomic_thread_fence(std::memory_order_release); s_pObject.store(newObject, std::memory_order_relaxed); ``` Otherwise there is no guarantee that the object content will be already fully stored in the memory when another thread might see the pointer and attempt to access it.
Incorrect use of the release fence in Singleton::Ref
https://api.github.com/repos/weidai11/cryptopp/issues/1208/comments
1
2023-05-10T22:42:38Z
2023-06-25T20:59:19Z
https://github.com/weidai11/cryptopp/issues/1208
1,704,717,053
1,208
[ "weidai11", "cryptopp" ]
https://github.com/weidai11/cryptopp/blob/899dea907103075cf7e68b16dc81aadd4ce83749/integer.cpp#L3525 By definition `nbytes` should be 1 or greater.
Randomize() calls Crop(), though it may not be needed
https://api.github.com/repos/weidai11/cryptopp/issues/1206/comments
7
2023-04-30T17:21:19Z
2023-10-01T16:10:17Z
https://github.com/weidai11/cryptopp/issues/1206
1,690,003,719
1,206
[ "weidai11", "cryptopp" ]
I have an application written in C++ using CryptoPP is trying to communicate with Python. If Python generates the Key, CryptoPP won't import it and gives a BER Decode Error, and also if I generate the key in CryptoPP it won't import in Python. This may also need to be used on Android, IoS, and Java. So I need a method that can work across platforms. In python I use the rsa module pip install rsa I am using size as 4096 bits import rsa def generate_keys(name,size): (pub, priv) = rsa.newkeys(size) with open(name + 'pub_key.pem', 'wb') as p: p.write(pub.save_pkcs1('PEM')) with open(name + 'priv_key.pem', 'wb') as p: p.write(priv.save_pkcs1('PEM')) def load_keys(name): with open(name + 'pub_key.pem', 'rb') as p: pub = rsa.PublicKey.load_pkcs1(p.read()) with open(name + 'priv_key.pem', 'rb') as p: priv = rsa.PrivateKey.load_pkcs1(p.read()) return priv, pub In CryptoPP I compiled with the PEM Pack and try to load the certificate: CryptoPP:RSA::PublicKey publicKey1; CryptoPP::FileSource publicKeySource(publicKeyFileName.c_str(), true); CryptoPP::PEM_Load(publicKeySource, publicKey1); This throws the BER Decode Error. If instead I generate the keys in CryptoPP and try to use them in Python: void generate_keys(std::string name) { try{ std::string privateKeyFileName = name+"privatekey.pem"; std::string publicKeyFileName = name+"publickey.pem"; // Generate private key CryptoPP::AutoSeededRandomPool rng; CryptoPP::InvertibleRSAFunction params; params.GenerateRandomWithKeySize(rng, 4096); CryptoPP::RSA::PrivateKey privateKey1(params); // Save private key to PEM file CryptoPP::FileSink privateKeyFile(privateKeyFileName.c_str()); CryptoPP::PEM_Save(privateKeyFile, privateKey1); // Extract public key from private key CryptoPP::RSA::PublicKey publicKey1(privateKey1); // Save public key to PEM file CryptoPP::FileSink publicKeyFile(publicKeyFileName.c_str()); CryptoPP::PEM_Save(publicKeyFile, publicKey1); } catch(...) { std::cout<<"Error generating PEM keys"; } } Traceback (most recent call last): File "pytest.py", line 280, in <module> TEST_PRIV_KEY, TEST_PUB_KEY = load_keys('test') File "pysec.py", line 25, in load_keys pub = rsa.PublicKey.load_pkcs1(p.read()) File "Python\Python39\lib\site-packages\rsa\key.py", line 124, in load_pkcs1 return method(keyfile) File "Python39\lib\site-packages\rsa\key.py", line 330, in _load_pkcs1_pem return cls._load_pkcs1_der(der) File "Python\Python39\lib\site-packages\rsa\key.py", line 297, in _load_pkcs1_der (priv, _) = decoder.decode(keyfile, asn1Spec=AsnPubKey()) File "Python\Python39\lib\site-packages\pyasn1\codec\ber\decoder.py", line 1581, in __call__ value, substrate = concreteDecoder.valueDecoder( File "Python\Python39\lib\site-packages\pyasn1\codec\ber\decoder.py", line 609, in valueDecoder component, head = decodeFun(head, componentType, **options) File "Python\Python39\lib\site-packages\pyasn1\codec\ber\decoder.py", line 1618, in __call__ raise error.PyAsn1Error( pyasn1.error.PyAsn1Error: <TagSet object, tags 0:32:16> not in asn1Spec: <Integer schema object, tagSet <TagSet object, tags 0:0:2>>
Reading RSA keys across platforms between CryptoPP and Python, not in asn1Spec
https://api.github.com/repos/weidai11/cryptopp/issues/1205/comments
1
2023-04-19T14:02:23Z
2023-10-01T16:07:19Z
https://github.com/weidai11/cryptopp/issues/1205
1,674,972,666
1,205
[ "weidai11", "cryptopp" ]
I was learning how to use this library,but something went wrong.My version is 5.6.5.I also tried 8.7.0 in a Qt project,but it throws "__crtisvalidheappointer(block)". `#include <dll.h>` `#include <cryptlib.h>` `#include <base64.h>` `int main(int argc, char* argv[])` `{` ` string result;` ` StringSink ssi(result);` ` Base64Encoder base64encoder(&ssi);` ` return 0;` `}` It always break at "return 0;".I would really appreciate it if you can help me figure out what goes wrong.I am working on my graduation project,so hope you can give me a hand.
need help,it always enables breakpoints when exiting the block
https://api.github.com/repos/weidai11/cryptopp/issues/1203/comments
0
2023-04-13T03:20:40Z
2023-07-05T08:45:28Z
https://github.com/weidai11/cryptopp/issues/1203
1,665,620,094
1,203
[ "weidai11", "cryptopp" ]
hi, the x86-64 provides crc32q instruction (aka _mm_crc32_u64) which consumes 8 bytes at once. with this opcode CRC32C_Update_SSE42() works ~2x faster on my machine (amd ryzen7 1700 3GHz).
improve CRC32C_Update_SSE42 for x86-64.
https://api.github.com/repos/weidai11/cryptopp/issues/1202/comments
15
2023-04-12T19:24:50Z
2023-04-14T18:29:04Z
https://github.com/weidai11/cryptopp/issues/1202
1,665,118,246
1,202
[ "weidai11", "cryptopp" ]
https://github.com/weidai11/cryptopp/blob/a21bab3255dd3c7708d8af4cc065e3e2464db48a/cpu.cpp#L1140 Hi, I'm running a raspberry pi 4B 8GB version. When I run the program normally it runs without issue, but when I load it through gdb it crushes when running ``CPU_ProbePMULL(), CPU_ProbeAES() CPU_ProbeSHA1() CPU_ProbeSHA256() `` . I had to comment out those functions for debugging to be possible. Cryptopp is built into a shared library which my app loads on demand.
Crush on RPI Only when we are using gdb to debug
https://api.github.com/repos/weidai11/cryptopp/issues/1201/comments
1
2023-04-11T01:13:59Z
2023-07-05T08:45:48Z
https://github.com/weidai11/cryptopp/issues/1201
1,661,621,396
1,201
[ "weidai11", "cryptopp" ]
Thanks for your library, I like the architecture. Triple DES is a useful cipher, based on the ancient DES which is good thing for ciphers. It is used in the payments industry https://en.wikipedia.org/wiki/EMV . Presently it is difficult to find “3DES” in your library. Please have a 3des.h with class TDES commented as “3DES” that supports 128 bit or 192 bit keys (2 key or 3 key versions) * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc) 8.7.0
Make 3des
https://api.github.com/repos/weidai11/cryptopp/issues/1200/comments
2
2023-04-10T12:40:33Z
2023-07-05T08:46:14Z
https://github.com/weidai11/cryptopp/issues/1200
1,660,731,039
1,200
[ "weidai11", "cryptopp" ]
The webserver's Mediawiki database backup is failing. It looks like the failures started in February 2023. I think it is due to Ubuntu's release of MySQL 8.0.32. It looks like 8.0.33 should be Ok. Also see https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/2003866 . Adding a bug so it does not fall off the radar.
Mediawiki database backup failures
https://api.github.com/repos/weidai11/cryptopp/issues/1199/comments
1
2023-03-31T03:35:01Z
2023-04-14T14:01:37Z
https://github.com/weidai11/cryptopp/issues/1199
1,648,613,785
1,199
[ "weidai11", "cryptopp" ]
OS: Windows 11 x64 Cryptopp version : Last vcpkg available version 8.7.0#3 Build: Last MSVC (2022 17.5) x64 Error : `\include\cryptopp\misc.h(83): fatal error C1083: Cannot open include file: 'x86intrin.h': No such file or directory` issue with this: ``` #if defined(__BMI__) # include <x86intrin.h> # include <immintrin.h> #endif // GCC and BMI ``` The x86intrin.h header is not provided by MSVC. The `_BMI_ `variable is not specific to GCC because the qsimd.h header file on MSVC defines this: ``` # ifdef __AVX2__ // MSVC defines __AVX2__ with /arch:AVX2 # define __F16C__ 1 # define __RDRND__ 1 # define __FMA__ 1 # define __BMI__ 1 **>> Here its set to 1** # define __BMI2__ 1 # define __MOVBE__ 1 # define __LZCNT__ 1 # endif ``` Fix : ``` #if defined(__BMI__) #if defined(__GNUC__) # include <x86intrin.h> #endif # include <immintrin.h> #endif // GCC and BMI ```
Fatal Error compiling under MSVC with avx2 enabled (/arch:AVX2)
https://api.github.com/repos/weidai11/cryptopp/issues/1198/comments
2
2023-03-23T09:30:40Z
2023-04-15T22:23:45Z
https://github.com/weidai11/cryptopp/issues/1198
1,637,158,691
1,198
[ "weidai11", "cryptopp" ]
That's it.
SSL/TLS certificate for cryptopp.com expired on 15/03
https://api.github.com/repos/weidai11/cryptopp/issues/1197/comments
1
2023-03-16T11:52:48Z
2023-03-16T13:07:33Z
https://github.com/weidai11/cryptopp/issues/1197
1,627,315,240
1,197
[ "weidai11", "cryptopp" ]
Hi everyone. I am using crypto++ and I want to perform homomorphic operations with the ElGamal algorithm. ElGamal is partially homomorphic as it allows to perform multiplication of encrypted numbers. This is my code: ``` #include <iostream> #include <string> #include <cryptopp/cryptlib.h> #include <cryptopp/elgamal.h> #include <cryptopp/osrng.h> using namespace CryptoPP; int main() { AutoSeededRandomPool rng; // Key Generation ElGamalKeys::PrivateKey privateKey; privateKey.GenerateRandomWithKeySize(rng, 1024); ElGamalKeys::PublicKey publicKey; privateKey.MakePublicKey(publicKey); // Integers to be encrypted Integer a(4); Integer b(3); // Encryptor generation ElGamal::Encryptor encryptor(publicKey); size_t ciphertextLength = encryptor.FixedCiphertextLength(); SecByteBlock cA(ciphertextLength), cB(ciphertextLength); encryptor.Encrypt(rng, (const byte*)&a, sizeof(a), cA); encryptor.Encrypt(rng, (const byte*)&b, sizeof(b), cB); // Convert ciphertexts to Integer objects Integer cA_int, cB_int; cA_int.Decode(cA.BytePtr(), cA.SizeInBytes()); cB_int.Decode(cB.BytePtr(), cB.SizeInBytes()); // Perform homomorphic multiplication Integer c_int = cA_int * cB_int; size_t encodedSize = c_int.MinEncodedSize(); SecByteBlock cC(encodedSize); c_int.Encode(cC.BytePtr(), encodedSize); ElGamal::Decryptor decryptor(privateKey); size_t maxPlaintextLength = decryptor.FixedMaxPlaintextLength(); SecByteBlock plaintext(maxPlaintextLength); decryptor.Decrypt(rng, cC, maxPlaintextLength, plaintext); // Convert plain text from SecByteBlock to Integer Integer d; d.Decode(plaintext.BytePtr(), plaintext.SizeInBytes()); std::cout << "Result: " << d << std::endl; return 0; } ``` It is not possible to perform a multiplication operation directly on an object of type SecByteBlock, so I transform it to Integer. Then I transform that Integer resulting from the multiplication to SecByteBlock again to be able to perform the decryption. But the result is not as expected: ``` Resultado: 6572542917472774608382513568834410162264727377934020617765694936645066385167133740454762877696206395258184095730713170221027471130699023727953324305437694949176326086512309951748266792467002364743251219060740803489028914257686331972414715950498994982718110805408070136337150258922387413393882346422272. ``` Can someone help me or give me some advice on how to perform the homomorphic operation?
Doubt about El Gamal and homomorphic encryption
https://api.github.com/repos/weidai11/cryptopp/issues/1196/comments
0
2023-03-09T13:23:23Z
2023-07-05T08:46:40Z
https://github.com/weidai11/cryptopp/issues/1196
1,617,248,242
1,196
[ "weidai11", "cryptopp" ]
Hi everyone, I'm new in cryptopp and i'm trying to run a small example using ElGamal. Code: ``` #include <iostream> using std::cout; using std::cerr; using std::endl; #include <cryptopp/osrng.h> using CryptoPP::AutoSeededRandomPool; #include <cryptopp/secblock.h> using CryptoPP::SecByteBlock; #include <cryptopp/elgamal.h> using CryptoPP::ElGamal; using CryptoPP::ElGamalKeys; #include <cryptopp/cryptlib.h> using CryptoPP::DecodingResult; #include <cryptopp/integer.h> using CryptoPP::Integer; int main(int argc, char* argv[]) { //////////////////////////////////////////////// // Generate keys AutoSeededRandomPool rng; cout << "Generating private key. This may take some time..." << endl; ElGamal::Decryptor decryptor; decryptor.AccessKey().GenerateRandomWithKeySize(rng, 512); const ElGamalKeys::PrivateKey& privateKey = decryptor.AccessKey(); ElGamal::Encryptor encryptor(decryptor); const ElGamalKeys::PublicKey& publicKey = encryptor.AccessKey(); //////////////////////////////////////////////// // Secret to protect static const int SECRET_SIZE = 16; SecByteBlock plaintext( SECRET_SIZE ); memset( plaintext, 'A', SECRET_SIZE ); //////////////////////////////////////////////// // Encrypt // Create cipher text space size_t ecl = encryptor.CiphertextLength( plaintext.size() ); SecByteBlock ciphertext( ecl ); encryptor.Encrypt( rng, plaintext, plaintext.size(), ciphertext ); return 0; } ``` I compile the code as follow: `g++ -DNDEBUG -g3 -O2 -Wall -Wextra -o elgamal elgamal.cpp -l:libcryptopp.a` The output obtained is: ``` /usr/bin/ld: /tmp/cccnj6vm.o: en la función `CryptoPP::ModularArithmetic::ModularArithmetic(CryptoPP::ModularArithmetic const&)': /usr/local/include/cryptopp/modarith.h:60: referencia a `CryptoPP::Integer::Integer(unsigned long, unsigned long)' sin definir /usr/bin/ld: /tmp/cccnj6vm.o:(.data.rel.ro._ZTVN8CryptoPP20AutoSeededRandomPoolE[_ZTVN8CryptoPP20AutoSeededRandomPoolE]+0x68): referencia a `CryptoPP::RandomPool::GenerateIntoBufferedTransformation(CryptoPP::BufferedTransformation&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)' sin definir collect2: error: ld returned 1 exit status ``` Thank you!
Error trying to run a example with ElGamal
https://api.github.com/repos/weidai11/cryptopp/issues/1195/comments
1
2023-03-02T15:38:51Z
2023-07-05T08:46:57Z
https://github.com/weidai11/cryptopp/issues/1195
1,607,034,732
1,195
[ "weidai11", "cryptopp" ]
There are two related problems concerning these files and their using with Visual CPP: - files `base64.h` and `base64.cpp` are missing in `cryptdll.vcxproj` - classes within these files (`Base64Encoder`, `Base64Decoder`) are not attributed with `CRYPTOPP_DLL` in contrast to other classes within cryptopp. So if linking a built cryptopp.dll in other solutions (project [gdal](https://github.com/OSGeo/gdal), file [port/cpl_sha256.cpp](https://github.com/OSGeo/gdal/blob/a632e3093d6dd34cdcf979a5b2a20529fe2df943/port/cpl_sha256.cpp) e.g. ) this will fail because of not exported symbols.
base64.h and base64.cpp missing in cryptdll.vcxproj
https://api.github.com/repos/weidai11/cryptopp/issues/1194/comments
0
2023-02-28T13:54:01Z
2023-07-05T08:47:11Z
https://github.com/weidai11/cryptopp/issues/1194
1,603,119,196
1,194
[ "weidai11", "cryptopp" ]
Can you help debug problem with failed test after build 8.7.0 on Fedora Rawhide? Build is OK but one test fail and only on s390x architecture. ``` ed25519 validation suite running... passed signature key validation FAILED signature and verification passed checking invalid signature FAILED verification check against test vector ``` Full build log https://kojipkgs.fedoraproject.org//work/tasks/4369/97754369/build.log Packages used for build https://kojipkgs.fedoraproject.org//work/tasks/4369/97754369/root.log Builds for other arches https://koji.fedoraproject.org/koji/taskinfo?taskID=97754270
8.7.0 fail test on Fedora Rawhide s390x
https://api.github.com/repos/weidai11/cryptopp/issues/1193/comments
8
2023-02-20T12:14:56Z
2023-09-25T20:22:29Z
https://github.com/weidai11/cryptopp/issues/1193
1,591,747,924
1,193
[ "weidai11", "cryptopp" ]
On wiki it says that on Windows, clang is not officially supported ([source](https://www.cryptopp.com/wiki/Compilers)). Still, I am curious if there are some unofficial ways of making it compilable with clang-cl? Thanks.
Anyone had success compiling the library with clang-cl?
https://api.github.com/repos/weidai11/cryptopp/issues/1192/comments
3
2023-02-17T09:28:13Z
2024-03-07T15:00:48Z
https://github.com/weidai11/cryptopp/issues/1192
1,589,031,026
1,192
[ "weidai11", "cryptopp" ]
The following code ends with `Segmentation fault`, at least on x86/Freebsd/v8.7.0 and x64/Arch/c364032d4c(current master). ``` #!/usr/bin/env bash set -euxo pipefail dir=$PWD/classlayout mkdir -p $dir make clean make CRYPTOPP_CPPFLAGS='-DNDEBUG -DCRYPTOPP_DISABLE_ASM' PREFIX=$dir dynamic libcryptopp.pc make CRYPTOPP_CPPFLAGS='-DNDEBUG -DCRYPTOPP_DISABLE_ASM' PREFIX=$dir install-lib cat > $dir/main.cc <<EOF #include <cryptopp/osrng.h> #include <cryptopp/sha.h> int main(){ CryptoPP::AutoSeededRandomPool asrp; CryptoPP::SHA256 sha256; return 0; } EOF c++ -o $dir/main $dir/main.cc $(PKG_CONFIG_LIBDIR=$dir/lib/pkgconfig pkgconf --cflags --libs libcryptopp) LD_LIBRARY_PATH=$dir/lib $dir/main ``` In the dynamic library, define `CRYPTOPP_DISABLE_ASM` will also make `CRYPTOPP_BOOL_ALIGN16` defined to 0. In the app main, `CRYPTOPP_DISABLE_ASM` is not defined, `CRYPTOPP_BOOL_ALIGN16` is 1 on x86/x64. The different `CRYPTOPP_BOOL_ALIGN16` value will result in different class size and layout of `FixedSizeAllocatorWithCleanup<T, S, A, true>`, which is nested in `SHA256`. However, the template class `FixedSizeAllocatorWithCleanup` is also instantiated in app main exported(I reckon crash only happens to PIE code, non-PIE will not export symbols automatically.). The whole binding process of dynamic symbols is fairly complicated, unfortunately I don't fully understand it. The observed behavior is some symbols in libcryptopp.so are binding to main, so two different class layouts are used by libcryptopp.so, and crash ensued. There are three probable solutions: - Add `CRYPTOPP_DISABLE_ASM` to `cflags` in `libcryptopp.pc`, if defined. - Make class `FixedSizeAllocatorWithCleanup` layout independent to `CRYPTOPP_DISABLE_ASM`. - Mark template classes as invisible to other DSOs in installed header files. The first one seems the simplest and most straightforward.
using dynamic library built with `CRYPTOPP_DISABLE_ASM` can cause SEGV.
https://api.github.com/repos/weidai11/cryptopp/issues/1191/comments
1
2023-02-14T17:19:13Z
2023-06-25T07:17:57Z
https://github.com/weidai11/cryptopp/issues/1191
1,584,545,977
1,191
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report Thanks for taking the time to report an issue. Reporting issues helps us improve stability and reliability for all users, so it is a valuable contribution. Please do not ask questions in the bug tracker. Please ask questions on the Crypto++ Users List at http://groups.google.com/forum/#!forum/cryptopp-users. Please do not ask questions about unsupported build systems, like Autotools, CMake, Conan and NuGet. They are other people's projects. We don't know anything about them. Please do not ask questions at Stack Overflow. We do not patrol Stack Overflow. We will not be able to answer your question. There is a wiki page with information on filing useful bug reports. If you have some time please visit http://www.cryptopp.com/wiki/Bug_Report on the wiki. The executive summary is: The bug report pertains to the Documentation on the wiki on the Modes of operation page. https://cryptopp.com/wiki/Modes_of_Operation We can see a repetition of the EAX documentation mode of operation in the GCM case below. EAX EAX mode uses an initialization vector. You should use SetKeyWithIV instead of SetKey. For more details on the mode see [CCM](https://cryptopp.com/wiki/CCM) on the wiki. SecByteBlock key(AES::DEFAULT_KEYLENGTH), iv(AES::BLOCKSIZE); std::memset(key, 0, key.size()); std::memset(iv, 0, iv.size()); CCM<AES>::Encryption encryptor; encryptor.SetKeyWithIV(key, key.size(), iv); GCM EAX mode uses an initialization vector. You should use SetKeyWithIV instead of SetKey. For more details on the mode see [CCM](https://cryptopp.com/wiki/CCM) on the wiki. SecByteBlock key(AES::DEFAULT_KEYLENGTH), iv(AES::BLOCKSIZE); std::memset(key, 0, key.size()); std::memset(iv, 0, iv.size()); CCM<AES>::Encryption encryptor; encryptor.SetKeyWithIV(key, key.size(), iv);
Documentation bug
https://api.github.com/repos/weidai11/cryptopp/issues/1188/comments
1
2023-01-24T14:24:22Z
2023-01-24T14:48:49Z
https://github.com/weidai11/cryptopp/issues/1188
1,555,084,871
1,188
[ "weidai11", "cryptopp" ]
Cryptopp master branch, Visual Studio 2022. There were multiple warning when compilng a project with cryptopp library: > Warning C5264 'CryptoPP::INFINITE_TIME': 'const' variable is not used \cryptopp\cryptlib.h 130 This is because the variable gets defined every time the header was included, A simple fix is to move the definition of `CryptoPP::INFINITE_TIME` to cryptlib.cpp while the header file has only this declaration: `extern const unsigned long INFINITE_TIME;`
'Variable is not used' warnings in VS 2022
https://api.github.com/repos/weidai11/cryptopp/issues/1185/comments
9
2023-01-12T12:35:06Z
2023-01-17T02:54:48Z
https://github.com/weidai11/cryptopp/issues/1185
1,530,638,813
1,185
[ "weidai11", "cryptopp" ]
the byte order of crc32 does not match。 CRC32 crc32; StringSource(plain, true, new HashFilter(crc32, new HexEncoder(new StringSink(dst)))); The general result is 6D8A7EF2,but F2A78E6D. void CRC32::TruncatedFinal(byte *hash, size_t size) { ThrowIfInvalidTruncatedSize(size); m_crc ^= CRC32_NEGL; for (size_t i=0; i<size; i++) hash[i] = GetCrcByte(i); Reset(); }
byte order of crc32
https://api.github.com/repos/weidai11/cryptopp/issues/1184/comments
2
2023-01-10T01:28:37Z
2023-07-05T08:47:53Z
https://github.com/weidai11/cryptopp/issues/1184
1,526,608,320
1,184
[ "weidai11", "cryptopp" ]
Crypto++ XChaCha20 implementation cannot decrypt data that both `libsodium` and Go's ` golang.org/x/crypto` decrypt correctly. Do I need to do it differently with Crypto++? I couldn't find a way to make it work. Below is a proof of concept program that uses `libsodium` to encrypt and Crypto++ to decrypt, which doesn't work as expected: Crypto++ version: 8.6.0-2ubuntu1 Operating system: Ubuntu 22.04 x86_64 ``` #include <cryptopp/chacha.h> #include <cryptopp/cryptlib.h> #include <sodium.h> #include <array> #include <cstdint> #include <iostream> int main(int argc, char *argv[]) { using namespace CryptoPP; const size_t keySize = 32; const size_t ivSize = 24; const uint8_t key[keySize + 1] = "12345678901234567890123456789012"; const uint8_t iv[ivSize + 1] = "123456789012345678901234"; std::array<byte, 4> origin = {'t', 'e', 's', 't'}; std::array<byte, origin.size()> encrypted; crypto_stream_xchacha20_xor(encrypted.data(), origin.data(), origin.size(), iv, key); std::array<byte, encrypted.size()> decrypted; XChaCha20::Decryption dec; dec.SetKeyWithIV(key, keySize, iv, ivSize); dec.ProcessData(decrypted.data(), encrypted.data(), encrypted.size()); for (byte b : decrypted) { std::cout << b; } std::cout << std::endl; return 0; } ``` Build: `g++ -o test test.cpp -lsodium -lcrypto++`
xchacha20 incompatible with libsodium and golang.org/x/crypto
https://api.github.com/repos/weidai11/cryptopp/issues/1183/comments
1
2022-12-26T11:04:55Z
2023-07-05T08:48:06Z
https://github.com/weidai11/cryptopp/issues/1183
1,510,854,024
1,183
[ "weidai11", "cryptopp" ]
Hello, I downloaded the Crypto++8.7 project from the official website. I used the cryptdll project to generate cryptopp.dll and cryptopp.lib. I added them to my project, but the following problem occurred in the compilation project? How to solve this problem? ![image](https://user-images.githubusercontent.com/106065825/207555121-41493b86-20f1-4c8c-bcc3-9798046678c8.png)
Crypto++8.7 Unable to link normally after generating dynamic library
https://api.github.com/repos/weidai11/cryptopp/issues/1182/comments
0
2022-12-14T09:16:06Z
2023-07-05T08:48:41Z
https://github.com/weidai11/cryptopp/issues/1182
1,496,140,741
1,182
[ "weidai11", "cryptopp" ]
[RSAPrivKeys.zip](https://github.com/weidai11/cryptopp/files/10176002/RSAPrivKeys.zip) When importing RSA private key files as attached, Crypto++ seems to support structures containing the OID for "rsaEncryption" (1 2 840 113549 1 1 1) only. Whenever a private key file is presented indicating the OID for "rsaPSS" (1 2 840 113549 1 1 10), the Load() function throws a "BERDecode error" exception. Sample code: ```c++ CryptoPP::InvertibleRSAFunction rsa; CryptoPP::FileSource fs("privKey.pkcs8", true); rsa.Load(fs); ``` The same behaviour applies to: ```c++ rsa.BERDecode(fs); ``` Why is it not possible to import key files with "rsaPSS" OID included?
Loading RSA private key file containing OID "rsaPSS" throws BERDecode error
https://api.github.com/repos/weidai11/cryptopp/issues/1181/comments
1
2022-12-07T12:39:51Z
2023-10-02T09:38:44Z
https://github.com/weidai11/cryptopp/issues/1181
1,481,827,756
1,181
[ "weidai11", "cryptopp" ]
I used the command "mingw32-make -f GNUmakefile", it doesnt work. pls guide how to complie with TDM-GCC 9.2
pls guide how to complie with TDM-GCC 9.2
https://api.github.com/repos/weidai11/cryptopp/issues/1180/comments
0
2022-12-02T15:32:09Z
2023-07-05T08:48:54Z
https://github.com/weidai11/cryptopp/issues/1180
1,473,051,491
1,180
[ "weidai11", "cryptopp" ]
I am looking for an algorithm in your library that can give me fast results on a Quest 2. I have built a .dll of the library using CMake and am using Unity to call the functions. I can encrypt decrypt a smaller video of 100 mb in about a second and a half. However, it takes me about 4 minutes to encrypt and 3 minutes to decrypt a video of 6600 MB. I would like it to be much faster than this, as I have heard this library is capable of. Here is my c++ code in the dll. > void EncryptFile(byte* inFile, byte* outFile) { > > std::string inputFile = (reinterpret_cast<char*>(inFile)); > std::string outputFile = (reinterpret_cast<char*>(outFile)); > > ECB_Mode<AES>::Encryption E; > E.SetKey(derived, 16); > //originalFile.clear(); > //originalFile.insert(originalFile.begin(), inputFile.begin(), inputFile.end()); > std::ifstream in(inputFile, std::ios::binary); > std::ofstream out(outputFile, std::ios::binary); > FileSource(in, true, new StreamTransformationFilter(E, new FileSink(out))); > } > > void DecryptFile(byte* inFile, byte* outFile) { > > std::string inputFile = (reinterpret_cast<char*>(inFile)); > std::string outputFile = (reinterpret_cast<char*>(outFile)); > > ECB_Mode<AES>::Decryption D; > D.SetKey(derived, 16); > encryptedFile.clear(); > encryptedFile.insert(encryptedFile.begin(), inputFile.begin(), inputFile.end()); > std::ifstream in(inputFile, std::ios::binary); > std::ofstream out(outputFile, std::ios::binary); > > FileSource(in, true, new StreamTransformationFilter(D, new FileSink(out))); > } > Here is my code in c# on the unity side > async void EDCrypto() > { > Debug.Log("Start Encryption"); > await EncryptVideo(); > Debug.Log("Start Decryption"); > await DecryptVideo(); > } > async Task EncryptVideo() > { > timer.Start(); > > await Task.Run(() => > { > FileSecurityIN.EncryptFile(OfilePathInBytes, EfilePathInBytes); > }); > timer.Stop(); > Debug.Log("Total ECB Encryption Time " + timer.ElapsedMilliseconds); > timer.Reset(); > } > async Task DecryptVideo() > { > > timer.Start(); > await Task.Run(() => > { > FileSecurityIN.DecryptFile(EfilePathInBytes, DfilePathInBytes); > }); > timer.Stop(); > Debug.Log("Total ECB Decryption Time " + timer.ElapsedMilliseconds); > timer.Reset(); > } > [DllImport(name)] > public static extern void EncryptFile(byte[] fileIn, byte[] fileOut); > > [DllImport(name)] > public static extern void DecryptFile(byte[] fileIn, byte[] fileOut); Operating System: Windows 11 Home 64-bit (10.0, Build 22621) (22621.ni_release.220506-1250) Language: English (Regional Setting: English) System Manufacturer: Gigabyte Technology Co., Ltd. System Model: B550M DS3H AC BIOS: F10 (type: UEFI) Processor: AMD Ryzen 5 5600X 6-Core Processor (12 CPUs), ~3.7GHz Memory: 32768MB RAM Available OS Memory: 32692MB RAM
Best Encryption Type for Fast Decryption
https://api.github.com/repos/weidai11/cryptopp/issues/1179/comments
0
2022-11-29T22:59:08Z
2023-07-05T08:49:06Z
https://github.com/weidai11/cryptopp/issues/1179
1,468,808,385
1,179
[ "weidai11", "cryptopp" ]
The documentation for IsolatedFlush in BufferedTransformation states that IsolatedFlush should return true on success. The FileSink code returns false on success: ``` bool FileSink::IsolatedFlush(bool hardFlush, bool blocking) { CRYPTOPP_UNUSED(hardFlush), CRYPTOPP_UNUSED(blocking); if (!m_stream) throw Err("FileSink: output stream not opened"); m_stream->flush(); if (!m_stream->good()) throw WriteErr(); return false; } ``` The only place where this has a consequence in the library is in FIlter::Flush, where there may be an unintended fallthrough: ``` bool Filter::Flush(bool hardFlush, int propagation, bool blocking) { switch (m_continueAt) { case 0: if (IsolatedFlush(hardFlush, blocking)) return true; // fall through case 1: if (OutputFlush(1, hardFlush, propagation, blocking)) return true; // fall through default: ; } return false; } ```
FileSink::IsolatedFlush returns false on success
https://api.github.com/repos/weidai11/cryptopp/issues/1178/comments
2
2022-11-23T16:19:58Z
2022-11-29T13:22:29Z
https://github.com/weidai11/cryptopp/issues/1178
1,462,046,441
1,178
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report * State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) MacOS 10.15.7 intel cpu Windows 10 intel cpu * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc) Built from master branch: e9cbc4698a6b3ed067910862ad1355069f348d2b * State how you built the library (Visual Studio, Makefile, distro provided, etc) built using makefile Here is the function I'm running, which is to test out the BlowFish encryption/decryption within a `juce` project: ``` void MainComponent::cryptoPPtest() { using namespace CryptoPP; CryptoPP::AutoSeededRandomPool prng; SecByteBlock key(Blowfish::DEFAULT_KEYLENGTH); prng.GenerateBlock(key, key.size()); byte iv[Blowfish::BLOCKSIZE]; prng.GenerateBlock(iv, sizeof(iv)); std::string plain = "CBC Mode Test"; std::string cipher, encoded, recovered; try { DBG("plain text: " << plain); CBC_Mode< Blowfish >::Encryption e; e.SetKeyWithIV(key, key.size(), iv); // The StreamTransformationFilter adds padding // as required. ECB and CBC Mode must be padded // to the block size of the cipher. StringSource s1(plain, true, new StreamTransformationFilter(e, new StringSink(cipher) ) // StreamTransformationFilter ); // StringSource } catch(const CryptoPP::Exception& e) { DBG("error: " << e.what()); return; } // Pretty print StringSource s2(cipher, true, new HexEncoder( new StringSink(encoded) ) // HexEncoder ); // StringSource DBG( "cipher text: " << encoded ); try { CBC_Mode< Blowfish >::Decryption d; d.SetKeyWithIV(key, key.size(), iv); // The StreamTransformationFilter removes // padding as required. StringSource s3(cipher, true, new StreamTransformationFilter(d, new StringSink(recovered) ) // StreamTransformationFilter ); // StringSource DBG( "recovered text: " << recovered ); } catch(const CryptoPP::Exception& e) { DBG("error: " << e.what()); return; } DBG( "test completed ok"); } ``` This is taken from this page and modified slightly to use the `juce` framework's `DBG()` macro instead of `std::cout` The crash happens here in `smartptr.h`, when the function exits: ``` template <class T> member_ptr<T>::~member_ptr() {delete m_p;} ``` Stack trace is: ``` #0 0x0000000100009a25 in CryptoPP::member_ptr<CryptoPP::BlockCipher>::~member_ptr() at /Volumes/Thunderbay/MyBook2/Programming/Mitchco/Encryptor/cryptopp/smartptr.h:69 #1 0x0000000100009995 in CryptoPP::member_ptr<CryptoPP::BlockCipher>::~member_ptr() at /Volumes/Thunderbay/MyBook2/Programming/Mitchco/Encryptor/cryptopp/smartptr.h:69 #2 0x00000001000097d5 in CryptoPP::RandomPool::~RandomPool() at /Volumes/Thunderbay/MyBook2/Programming/Mitchco/Encryptor/cryptopp/randpool.h:43 #3 0x0000000100012778 in CryptoPP::AutoSeededRandomPool::~AutoSeededRandomPool() at /Volumes/Thunderbay/MyBook2/Programming/Mitchco/Encryptor/cryptopp/osrng.h:163 #4 0x0000000100007485 in CryptoPP::AutoSeededRandomPool::~AutoSeededRandomPool() at /Volumes/Thunderbay/MyBook2/Programming/Mitchco/Encryptor/cryptopp/osrng.h:163 #5 0x00000001000059a2 in MainComponent::cryptoPPtest() at /Volumes/Thunderbay/MyBook2/Programming/Mitchco/Encryptor/Source/MainComponent.cpp:441 ```
Double Delete from BlowFish example on exit
https://api.github.com/repos/weidai11/cryptopp/issues/1176/comments
5
2022-11-10T07:32:59Z
2023-07-05T08:49:44Z
https://github.com/weidai11/cryptopp/issues/1176
1,443,399,301
1,176
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report operating system and version - macOS 12.2.1, m1 chip CryptoPP 8.7 Using Xcode I Downloaded the library and included it into my project, as described In the WIKI page, I didn't use the make file or built the library myself. when trying to run my code, I get a lot of Undefined symbol errors, even tough I defined what was needed for the pre processor. also, I have added DCRYPTOPP_DISABLE_ARM_CRC32 to my cpp flags using the serene-macos.sh file from the library. this is the way I defined for the pre processor (within the main) #define CRYPTOPP_DISABLE_MIXED_ASM #define CRYPTOPP_DISABLE_ASM the code I'm trying to run is just an example code to see if the library run and uses pretty basic functions from the library. I had been trying to figure it out for a while but hadn't mad progress, and would really appreciate some help, thank you!
Can't run the library on XCODE
https://api.github.com/repos/weidai11/cryptopp/issues/1175/comments
0
2022-10-31T17:31:02Z
2023-07-05T08:49:58Z
https://github.com/weidai11/cryptopp/issues/1175
1,430,218,464
1,175
[ "weidai11", "cryptopp" ]
https://github.com/weidai11/cryptopp/pull/1171 breaks Clang build: ```sh $ make clang++-14 -DNDEBUG -g2 -O3 -fPIC -pthread -pipe -c cryptlib.cpp In file included from cryptlib.cpp:19: In file included from ./filters.h:21: ./queue.h:265:24: error: exception specification in declaration does not match previous declaration template<> inline void swap(CryptoPP::ByteQueue &a, CryptoPP::ByteQueue &b) CRYPTOPP_NO_THROW ^ ./queue.h:265:24: note: previous declaration is here 1 error generated. make: *** [GNUmakefile:1806: cryptlib.o] Error 1 ``` Tested on cryptopp master branch, Linux x64, clang 14.
Clang build is broken
https://api.github.com/repos/weidai11/cryptopp/issues/1174/comments
3
2022-10-29T01:51:15Z
2022-10-29T12:22:22Z
https://github.com/weidai11/cryptopp/issues/1174
1,428,015,734
1,174
[ "weidai11", "cryptopp" ]
My goal is to convert a rawRepresentation of a P521-PrivateKey to a `ECDSA<ECP, SHA256>::PrivateKey` object. What i mean with rawRepresentation: ``` ECPrivateKey ::= SEQUENCE { version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1), privateKey OCTET STRING, <------------------------- rawRepresentation parameters [0] ECParameters {{ NamedCurve }} OPTIONAL, publicKey [1] BIT STRING OPTIONAL } ``` ### Example I have this private key (secp521r1) as [rawRepresentation](https://developer.apple.com/documentation/cryptokit/p521/signing/privatekey/3237782-rawrepresentation) (shown below as hex): **00aabaf31ecb761d2c8e17a93dcf42c372b07c3221dfe00bf5991923380634f5d63ea5793451624d555c567114a53d2b4b53255557550abfe886afba802f9bddacf4** DER-Format would be: 3081ee020100301006072a8648ce3d020106052b810400230481d63081d30201010442**00aabaf31ecb761d2c8e17a93dcf42c372b07c3221dfe00bf5991923380634f5d63ea5793451624d555c567114a53d2b4b53255557550abfe886afba802f9bddacf4**a18189038186000401cb6eb020cc339e90daf8611d19a978e6e736bc08edeed515013f5f7445845893e2756f41b4b812da9c3de3eb5d6c7b821af1ca7080a654071a237b8d268c084b8800d35a8bf51682814ef4747fdafd46ad925b20003b026619871812de4979711d65f43501850f166223f43804a07ee3a440543e2fb587b5e401ac75d652f8614d9f2b Is that somehow possible currently?
Import PrivateKey from Raw Format
https://api.github.com/repos/weidai11/cryptopp/issues/1169/comments
0
2022-10-09T15:21:20Z
2023-07-05T08:50:36Z
https://github.com/weidai11/cryptopp/issues/1169
1,402,306,949
1,169
[ "weidai11", "cryptopp" ]
Hi, I'm trying to use the elliptic curve Diffie-Hellman class (`ECDH<ECP>`) in a program compiled without RTTI. This results in a compiler warning when using MSVC (full program and output at the end of the issue): ``` cryptopp\8.7.0\include\cryptopp\pubkey.h(1658): warning C4541: 'dynamic_cast' used on polymorphic type 'CryptoPP::DL_ElgamalLikeSignatureAlgorithm<T>' with /GR-; unpredictable behavior may result ``` I looked into that a bit and saw that in [`pubkey.h:1658`](https://github.com/weidai11/cryptopp/blob/CRYPTOPP_8_7_0/pubkey.h#L1658) the `DL_SignerBase::SignAndRestart` method uses a `dynamic_cast` to crosscast a `DL_ElgamalLikeSignatureAlgorithm` pointer to a `DeterministicSignatureAlgorithm` pointer. A cast like that is as far as I know not possible at all without RTTI. Is making this work without RTTI something you would consider? ## Possible Solution For my use-case I patched CryptoPP by adding a virtual method to the `DL_ElgamalLikeSignatureAlgorithm` class to return a pointer to itself as a `DeterministicSignatureAlgorithm`. It returns a `nullptr` if the conversion wouldn't be possible. This is also the default, just like `IsDeterministic` returns `false` by default: ```cpp /// \brief DeterministicSignatureAlgorithm instance, if applicable /// \return A pointer to this object as DeterministicSignatureAlgorithm if the signature scheme is deterministic, null otherwise virtual const DeterministicSignatureAlgorithm * GetDeterministic() const {return nullptr;} ``` This can then be overridden in `DL_Algorithm_DSA_RFC6979`, which is the only class I found where `IsDeterministic` returned `true`: ```cpp const DeterministicSignatureAlgorithm * GetDeterministic() const {return this;} ``` Since the correct pointer is now determined statically this solves my issue. I attached my complete changes as patch, if this approach is something you would be interested in I would also be happy to create a PR for further discussion 🙂. <details><summary>Full Patch</summary> ```diff diff --git a/gfpcrypt.h b/gfpcrypt.h index f8fc3c5e..ee570f62 100644 --- a/gfpcrypt.h +++ b/gfpcrypt.h @@ -354,6 +354,8 @@ public: {return false;} bool IsDeterministic() const {return true;} + const DeterministicSignatureAlgorithm * GetDeterministic() const + {return this;} // Deterministic K Integer GenerateRandom(const Integer &x, const Integer &q, const Integer &e) const diff --git a/pubkey.h b/pubkey.h index efa607b6..09035930 100644 --- a/pubkey.h +++ b/pubkey.h @@ -1399,6 +1399,9 @@ private: template<class GP> DL_PublicKeyImpl<GP>::~DL_PublicKeyImpl() {} +// Forward declaration because it's used in DL_ElgamalLikeSignatureAlgorithm +class DeterministicSignatureAlgorithm; + /// \brief Interface for Elgamal-like signature algorithms /// \tparam T Field element type or class /// \details Field element <tt>T</tt> can be Integer, ECP or EC2N. @@ -1452,6 +1455,11 @@ public: /// \details IsDeterministic() is provided for DL signers. It is used by RFC 6979 signature schemes. virtual bool IsDeterministic() const {return false;} + + /// \brief DeterministicSignatureAlgorithm instance, if applicable + /// \return A pointer to this object as DeterministicSignatureAlgorithm if the signature scheme is deterministic, null otherwise + virtual const DeterministicSignatureAlgorithm * GetDeterministic() const + {return nullptr;} }; /// \brief Interface for deterministic signers @@ -1586,6 +1594,7 @@ protected: // true if the scheme conforms to RFC 6979 virtual bool IsDeterministic() const {return false;} + virtual const DeterministicSignatureAlgorithm * GetDeterministic() const {return nullptr;} virtual const DL_ElgamalLikeSignatureAlgorithm<typename KEY_INTFACE::Element> & GetSignatureAlgorithm() const =0; virtual const PK_SignatureMessageEncodingMethod & GetMessageEncodingInterface() const =0; @@ -1655,8 +1664,8 @@ public: if (alg.IsDeterministic()) { const Integer& x = key.GetPrivateExponent(); - const DeterministicSignatureAlgorithm& det = dynamic_cast<const DeterministicSignatureAlgorithm&>(alg); - k = det.GenerateRandom(x, q, e); + const DeterministicSignatureAlgorithm* det = alg.GetDeterministic(); + k = det->GenerateRandom(x, q, e); } else { ``` </details> ## Minimal Program I tried this with the Visual Studio 2022 (Compiler Version 19.33) and using CryptoPP 8.7.0 (retrieved via Conan, paths shortened for clarity). #### Code ```cpp #include <cryptopp/eccrypto.h> #include <cryptopp/oids.h> #include <cryptopp/osrng.h> int main() { CryptoPP::ECDH<CryptoPP::ECP>::Domain ecdh(CryptoPP::ASN1::secp521r1()); CryptoPP::AutoSeededRandomPool rng; CryptoPP::SecByteBlock sk(ecdh.PrivateKeyLength()); CryptoPP::SecByteBlock pk(ecdh.PublicKeyLength()); ecdh.GenerateKeyPair(rng, sk, pk); return 0; } ``` </details> #### Compiler Invocation ``` cl /c /W4 /WX /GR- /I "cryptopp\8.7.0\include" "main.cpp" ``` #### Compiler Output <details><summary>Full Output</summary> ``` cryptopp\8.7.0\include\cryptopp\queue.h(222): error C2220: the following warning is treated as an error cryptopp\8.7.0\include\cryptopp\queue.h(222): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc cryptopp\8.7.0\include\cryptopp\pubkey.h(1658): warning C4541: 'dynamic_cast' used on polymorphic type 'CryptoPP::DL_ElgamalLikeSignatureAlgorithm<T>' with /GR-; unpredictable behavior may result with [ T=CryptoPP::Integer ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1631): note: while compiling class template member function 'size_t CryptoPP::DL_SignerBase<CryptoPP::Integer>::SignAndRestart(CryptoPP::RandomNumberGenerator &,CryptoPP::PK_MessageAccumulator &,CryptoPP::byte *,bool) const' cryptopp\8.7.0\include\cryptopp\simple.h(40): note: see reference to class template instantiation 'CryptoPP::DL_SignerBase<CryptoPP::Integer>' being compiled cryptopp\8.7.0\include\cryptopp\pubkey.h(1957): note: see reference to class template instantiation 'CryptoPP::AlgorithmImpl<BASE,CryptoPP::DSA2<CryptoPP::SHA1>>' being compiled with [ BASE=CryptoPP::DL_SignerBase<CryptoPP::Integer> ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1997): note: see reference to class template instantiation 'CryptoPP::DL_ObjectImplBase<BASE,SCHEME_OPTIONS,KEY>' being compiled with [ BASE=CryptoPP::DL_SignerBase<CryptoPP::Integer>, SCHEME_OPTIONS=CryptoPP::DL_SignatureSchemeOptions<CryptoPP::DSA2<CryptoPP::SHA1>,CryptoPP::DL_Keys_DSA,CryptoPP::DL_Algorithm_GDSA<CryptoPP::Integer>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA1>, KEY=CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_GFP<CryptoPP::DL_GroupParameters_DSA>,CryptoPP::DSA2<CryptoPP::SHA1>> ] cryptopp\8.7.0\include\cryptopp\pubkey.h(2022): note: see reference to class template instantiation 'CryptoPP::DL_ObjectImpl<CryptoPP::DL_SignerBase<CryptoPP::Integer>,SCHEME_OPTIONS,CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_GFP<CryptoPP::DL_GroupParameters_DSA>,CryptoPP::DSA2<CryptoPP::SHA1>>>' being compiled with [ SCHEME_OPTIONS=CryptoPP::DL_SignatureSchemeOptions<CryptoPP::DSA2<CryptoPP::SHA1>,CryptoPP::DL_Keys_DSA,CryptoPP::DL_Algorithm_GDSA<CryptoPP::Integer>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA1> ] cryptopp\8.7.0\include\cryptopp\pubkey.h(2198): note: see reference to class template instantiation 'CryptoPP::DL_SignerImpl<CryptoPP::DL_SignatureSchemeOptions<ALG_INFO,KEYS,SA,MEM,H>>' being compiled with [ ALG_INFO=CryptoPP::DSA2<CryptoPP::SHA1>, KEYS=CryptoPP::DL_Keys_DSA, SA=CryptoPP::DL_Algorithm_GDSA<CryptoPP::Integer>, MEM=CryptoPP::DL_SignatureMessageEncodingMethod_DSA, H=CryptoPP::SHA1 ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1325): note: see reference to class template instantiation 'CryptoPP::PK_FinalTemplate<CryptoPP::DL_SignerImpl<CryptoPP::DL_SignatureSchemeOptions<ALG_INFO,KEYS,SA,MEM,H>>>' being compiled with [ ALG_INFO=CryptoPP::DSA2<CryptoPP::SHA1>, KEYS=CryptoPP::DL_Keys_DSA, SA=CryptoPP::DL_Algorithm_GDSA<CryptoPP::Integer>, MEM=CryptoPP::DL_SignatureMessageEncodingMethod_DSA, H=CryptoPP::SHA1 ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1320): note: while compiling class template member function 'void CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_GFP<CryptoPP::DL_GroupParameters_DSA>,CryptoPP::DSA2<CryptoPP::SHA1>>::GenerateRandom(CryptoPP::RandomNumberGenerator &,const CryptoPP::NameValuePairs &)' cryptopp\8.7.0\include\cryptopp\gfpcrypt.h(855): note: see reference to class template instantiation 'CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_GFP<CryptoPP::DL_GroupParameters_DSA>,CryptoPP::DSA2<CryptoPP::SHA1>>' being compiled cryptopp\8.7.0\include\cryptopp\pubkey.h(1658): warning C4541: 'dynamic_cast' used on polymorphic type 'CryptoPP::DL_ElgamalLikeSignatureAlgorithm<T>' with /GR-; unpredictable behavior may result with [ T=CryptoPP::ECP::Point ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1631): note: while compiling class template member function 'size_t CryptoPP::DL_SignerBase<CryptoPP::ECPPoint>::SignAndRestart(CryptoPP::RandomNumberGenerator &,CryptoPP::PK_MessageAccumulator &,CryptoPP::byte *,bool) const' cryptopp\8.7.0\include\cryptopp\simple.h(40): note: see reference to class template instantiation 'CryptoPP::DL_SignerBase<CryptoPP::ECPPoint>' being compiled cryptopp\8.7.0\include\cryptopp\pubkey.h(1957): note: see reference to class template instantiation 'CryptoPP::AlgorithmImpl<BASE,CryptoPP::DL_SS<KEYS,SA,MEM,H,int>>' being compiled with [ BASE=CryptoPP::DL_SignerBase<CryptoPP::ECPPoint>, KEYS=CryptoPP::DL_Keys_ECDSA<CryptoPP::ECP>, SA=CryptoPP::DL_Algorithm_ECDSA<CryptoPP::ECP>, MEM=CryptoPP::DL_SignatureMessageEncodingMethod_DSA, H=CryptoPP::SHA256 ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1997): note: see reference to class template instantiation 'CryptoPP::DL_ObjectImplBase<BASE,SCHEME_OPTIONS,KEY>' being compiled with [ BASE=CryptoPP::DL_SignerBase<CryptoPP::ECPPoint>, SCHEME_OPTIONS=CryptoPP::DL_SignatureSchemeOptions<CryptoPP::DL_SS<CryptoPP::DL_Keys_ECDSA<CryptoPP::ECP>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::ECP>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256,int>,CryptoPP::DL_Keys_ECDSA<CryptoPP::ECP>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::ECP>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256>, KEY=CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_EC<CryptoPP::ECP>,CryptoPP::ECDSA<CryptoPP::ECP,CryptoPP::SHA256>> ] cryptopp\8.7.0\include\cryptopp\pubkey.h(2022): note: see reference to class template instantiation 'CryptoPP::DL_ObjectImpl<CryptoPP::DL_SignerBase<CryptoPP::ECPPoint>,SCHEME_OPTIONS,CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_EC<CryptoPP::ECP>,CryptoPP::ECDSA<CryptoPP::ECP,CryptoPP::SHA256>>>' being compiled with [ SCHEME_OPTIONS=CryptoPP::DL_SignatureSchemeOptions<CryptoPP::DL_SS<CryptoPP::DL_Keys_ECDSA<CryptoPP::ECP>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::ECP>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256,int>,CryptoPP::DL_Keys_ECDSA<CryptoPP::ECP>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::ECP>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256> ] cryptopp\8.7.0\include\cryptopp\pubkey.h(2198): note: see reference to class template instantiation 'CryptoPP::DL_SignerImpl<CryptoPP::DL_SignatureSchemeOptions<ALG_INFO,KEYS,SA,MEM,H>>' being compiled with [ ALG_INFO=CryptoPP::DL_SS<CryptoPP::DL_Keys_ECDSA<CryptoPP::ECP>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::ECP>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256,int>, KEYS=CryptoPP::DL_Keys_ECDSA<CryptoPP::ECP>, SA=CryptoPP::DL_Algorithm_ECDSA<CryptoPP::ECP>, MEM=CryptoPP::DL_SignatureMessageEncodingMethod_DSA, H=CryptoPP::SHA256 ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1325): note: see reference to class template instantiation 'CryptoPP::PK_FinalTemplate<CryptoPP::DL_SignerImpl<CryptoPP::DL_SignatureSchemeOptions<ALG_INFO,KEYS,SA,MEM,H>>>' being compiled with [ ALG_INFO=CryptoPP::DL_SS<CryptoPP::DL_Keys_ECDSA<CryptoPP::ECP>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::ECP>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256,int>, KEYS=CryptoPP::DL_Keys_ECDSA<CryptoPP::ECP>, SA=CryptoPP::DL_Algorithm_ECDSA<CryptoPP::ECP>, MEM=CryptoPP::DL_SignatureMessageEncodingMethod_DSA, H=CryptoPP::SHA256 ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1320): note: while compiling class template member function 'void CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_EC<CryptoPP::ECP>,CryptoPP::ECDSA<CryptoPP::ECP,CryptoPP::SHA256>>::GenerateRandom(CryptoPP::RandomNumberGenerator &,const CryptoPP::NameValuePairs &)' cryptopp/8.7.0/include\cryptopp/eccrypto.h(677): note: see reference to class template instantiation 'CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_EC<CryptoPP::ECP>,CryptoPP::ECDSA<CryptoPP::ECP,CryptoPP::SHA256>>' being compiled cryptopp\8.7.0\include\cryptopp\pubkey.h(1658): warning C4541: 'dynamic_cast' used on polymorphic type 'CryptoPP::DL_ElgamalLikeSignatureAlgorithm<T>' with /GR-; unpredictable behavior may result with [ T=CryptoPP::EC2N::Point ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1631): note: while compiling class template member function 'size_t CryptoPP::DL_SignerBase<CryptoPP::EC2NPoint>::SignAndRestart(CryptoPP::RandomNumberGenerator &,CryptoPP::PK_MessageAccumulator &,CryptoPP::byte *,bool) const' cryptopp\8.7.0\include\cryptopp\simple.h(40): note: see reference to class template instantiation 'CryptoPP::DL_SignerBase<CryptoPP::EC2NPoint>' being compiled cryptopp\8.7.0\include\cryptopp\pubkey.h(1957): note: see reference to class template instantiation 'CryptoPP::AlgorithmImpl<BASE,CryptoPP::DL_SS<KEYS,SA,MEM,H,int>>' being compiled with [ BASE=CryptoPP::DL_SignerBase<CryptoPP::EC2NPoint>, KEYS=CryptoPP::DL_Keys_ECDSA<CryptoPP::EC2N>, SA=CryptoPP::DL_Algorithm_ECDSA<CryptoPP::EC2N>, MEM=CryptoPP::DL_SignatureMessageEncodingMethod_DSA, H=CryptoPP::SHA256 ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1997): note: see reference to class template instantiation 'CryptoPP::DL_ObjectImplBase<BASE,SCHEME_OPTIONS,KEY>' being compiled with [ BASE=CryptoPP::DL_SignerBase<CryptoPP::EC2NPoint>, SCHEME_OPTIONS=CryptoPP::DL_SignatureSchemeOptions<CryptoPP::DL_SS<CryptoPP::DL_Keys_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256,int>,CryptoPP::DL_Keys_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256>, KEY=CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_EC<CryptoPP::EC2N>,CryptoPP::ECDSA<CryptoPP::EC2N,CryptoPP::SHA256>> ] cryptopp\8.7.0\include\cryptopp\pubkey.h(2022): note: see reference to class template instantiation 'CryptoPP::DL_ObjectImpl<CryptoPP::DL_SignerBase<CryptoPP::EC2NPoint>,SCHEME_OPTIONS,CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_EC<CryptoPP::EC2N>,CryptoPP::ECDSA<CryptoPP::EC2N,CryptoPP::SHA256>>>' being compiled with [ SCHEME_OPTIONS=CryptoPP::DL_SignatureSchemeOptions<CryptoPP::DL_SS<CryptoPP::DL_Keys_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256,int>,CryptoPP::DL_Keys_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256> ] cryptopp\8.7.0\include\cryptopp\pubkey.h(2198): note: see reference to class template instantiation 'CryptoPP::DL_SignerImpl<CryptoPP::DL_SignatureSchemeOptions<ALG_INFO,KEYS,SA,MEM,H>>' being compiled with [ ALG_INFO=CryptoPP::DL_SS<CryptoPP::DL_Keys_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256,int>, KEYS=CryptoPP::DL_Keys_ECDSA<CryptoPP::EC2N>, SA=CryptoPP::DL_Algorithm_ECDSA<CryptoPP::EC2N>, MEM=CryptoPP::DL_SignatureMessageEncodingMethod_DSA, H=CryptoPP::SHA256 ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1325): note: see reference to class template instantiation 'CryptoPP::PK_FinalTemplate<CryptoPP::DL_SignerImpl<CryptoPP::DL_SignatureSchemeOptions<ALG_INFO,KEYS,SA,MEM,H>>>' being compiled with [ ALG_INFO=CryptoPP::DL_SS<CryptoPP::DL_Keys_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_Algorithm_ECDSA<CryptoPP::EC2N>,CryptoPP::DL_SignatureMessageEncodingMethod_DSA,CryptoPP::SHA256,int>, KEYS=CryptoPP::DL_Keys_ECDSA<CryptoPP::EC2N>, SA=CryptoPP::DL_Algorithm_ECDSA<CryptoPP::EC2N>, MEM=CryptoPP::DL_SignatureMessageEncodingMethod_DSA, H=CryptoPP::SHA256 ] cryptopp\8.7.0\include\cryptopp\pubkey.h(1320): note: while compiling class template member function 'void CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_EC<CryptoPP::EC2N>,CryptoPP::ECDSA<CryptoPP::EC2N,CryptoPP::SHA256>>::GenerateRandom(CryptoPP::RandomNumberGenerator &,const CryptoPP::NameValuePairs &)' cryptopp/8.7.0/include\cryptopp/eccrypto.h(678): note: see reference to class template instantiation 'CryptoPP::DL_PrivateKey_WithSignaturePairwiseConsistencyTest<CryptoPP::DL_PrivateKey_EC<CryptoPP::EC2N>,CryptoPP::ECDSA<CryptoPP::EC2N,CryptoPP::SHA256>>' being compiled ``` </details>
Using elliptic curve Diffie-Hellman without RTTI
https://api.github.com/repos/weidai11/cryptopp/issues/1168/comments
3
2022-10-05T14:45:20Z
2023-07-05T08:50:57Z
https://github.com/weidai11/cryptopp/issues/1168
1,397,916,070
1,168
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report I am getting link errors when building on a CentOS 7 based Docker container using `devtoolset-11` i.e. `gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)` with Crytpo++ version 8.7.0 The application builds and links fine on Ubuntu 22.04 with compiler: `gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0` The same application builds fine within the Docker image using Crytpo++ 8.6.0 I am using Conan and building Crypto++ from source so I am using the same compiler for the library and the application. I don't think this is a Conan issue since the same code works fine on Ubuntu with `cryptopp/8.6.0` and `cryptopp/8.7.0` and crytpopp/8.6.0 works fine on CentOS 7. I am also using Qt in the application. I have seen SO threads that mention problems when using Qt, but it doesn't appear to be those issues. Besides, it works in the scenarios stated above. This is not critical for me since I can fall back to version 8.6.0. Here are the link errors ``` /opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: CMakeFiles/connection-manager.dir/sources/demangle.cpp.o: in function `AESDecrypt(std::string const&, unsigned char const*)': /root/code/sources/demangle.cpp:61: undefined reference to `CryptoPP::StringSinkTemplate<std::string>::StringSinkTemplate(std::string&)' /opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: CMakeFiles/connection-manager.dir/sources/demangle.cpp.o:(.data.rel.ro._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEE[_ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEE]+0xa0): undefined reference to `CryptoPP::Rijndael::Base::AlgorithmProvider() const' /opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: CMakeFiles/connection-manager.dir/sources/demangle.cpp.o:(.data.rel.ro._ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEE[_ZTVN8CryptoPP16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEE]+0x100): undefined reference to `non-virtual thunk to CryptoPP::Rijndael::Base::AlgorithmProvider() const' /opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: CMakeFiles/connection-manager.dir/sources/demangle.cpp.o:(.data.rel.ro._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEES4_EE[_ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEES4_EE]+0xa0): undefined reference to `CryptoPP::Rijndael::Base::AlgorithmProvider() const' /opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: CMakeFiles/connection-manager.dir/sources/demangle.cpp.o:(.data.rel.ro._ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEES4_EE[_ZTVN8CryptoPP12ClonableImplINS_16BlockCipherFinalILNS_9CipherDirE1ENS_8Rijndael3DecEEES4_EE]+0xf8): undefined reference to `non-virtual thunk to CryptoPP::Rijndael::Base::AlgorithmProvider() const' collect2: error: ld returned 1 exit status ```
Failure to link version 8.7.0 on Centos 7
https://api.github.com/repos/weidai11/cryptopp/issues/1166/comments
2
2022-10-03T16:30:04Z
2023-06-25T07:20:50Z
https://github.com/weidai11/cryptopp/issues/1166
1,395,009,843
1,166
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report Crupto++ 8.7.0 In the GNUMakefile: ``` # SSE, NEON or POWER7 available blake2s_simd.o : blake2s_simd.cpp $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $< # SSE, NEON or POWER8 available blake2b_simd.o : blake2s_simd.cpp $(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $< ``` `blake2b_simd.o` should depend on `blake2b_simd.cpp`
In `GNUMakefile`, wrong dependency for `blake2b_simd.o`
https://api.github.com/repos/weidai11/cryptopp/issues/1164/comments
2
2022-09-27T13:05:53Z
2022-09-27T23:51:47Z
https://github.com/weidai11/cryptopp/issues/1164
1,387,730,976
1,164
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report Crypto++ 8.7.0 In GNUMakefile, `SSE3_FLAG` is used but it was never being tested for with the test program to check if it is available or not, unlike sse2 and ssse3. ``` /cryptopp-cmake/_build/_deps/cryptopp # grep -n -A 5 [^S]SSE3_FLAG GNUmakefile 250: SSE3_FLAG = -xarch=sse3 251- SSSE3_FLAG = -xarch=ssse3 252- SSE41_FLAG = -xarch=sse4_1 253- SSE42_FLAG = -xarch=sse4_2 254- CLMUL_FLAG = -xarch=aes 255- AESNI_FLAG = -xarch=aes -- 261: SSE3_FLAG = -msse3 262- SSSE3_FLAG = -mssse3 263- SSE41_FLAG = -msse4.1 264- SSE42_FLAG = -msse4.2 265- CLMUL_FLAG = -mpclmul 266- AESNI_FLAG = -maes -- 409: ifeq ($(SSE3_FLAG),) 410- CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SSE3 411- else ifeq ($(SSSE3_FLAG),) 412- CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SSSE3 413- else ifeq ($(SSE41_FLAG),) 414- CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SSE4 ```
SSE3_FLAG used but not not tested for
https://api.github.com/repos/weidai11/cryptopp/issues/1163/comments
4
2022-09-27T12:12:57Z
2022-10-01T16:43:38Z
https://github.com/weidai11/cryptopp/issues/1163
1,387,655,837
1,163
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report * State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) This issue is reported and reproduced easily on Windows with MSVC, however, the fact that it works on other compilers / systems is completely not guaranteed * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc) 8.7.0 * State how you built the library (Visual Studio, Makefile, distro provided, etc) CMake (cryptopp-cmake), but the issue is not related to cmake. * Show a typical command line (the output of the compiler for cryptlib.cpp) ``` .... EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\dlltest.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\dlltest.cpp [build] [159/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat0.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat0.cpp [build] [160/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat1.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat1.cpp [build] [161/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat2.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat2.cpp [build] [162/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat3.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat3.cpp [build] [163/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat4.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat4.cpp [build] [164/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat5.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat5.cpp [build] [165/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat6.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat6.cpp [build] [166/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat7.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat7.cpp [build] [167/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat8.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat8.cpp [build] [168/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat10.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat10.cpp [build] [169/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat9.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\validat9.cpp [build] [170/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest1.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\regtest1.cpp [build] [171/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest2.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\regtest2.cpp [build] [172/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest3.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\regtest3.cpp [build] [173/174] D:\dev\ccache-4.6-windows-64\ccache.exe C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -DCRYPTOPP_DATA_DIR=\"D:/dev/projects/cryptopp-cmake/out/build/dev-windows/_deps/cryptopp\" -DCRYPTOPP_DISABLE_ASM=1 -D_WIN32_WINNT=0x0A00 -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp -ID:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps /DWIN32 /D_WINDOWS /EHsc /Z7 /Ob0 /Od /RTC1 -MDd /GR /MP /showIncludes /Focryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest4.cpp.obj /Fdcryptopp\CMakeFiles\cryptest.dir\ /FS -c D:\dev\projects\cryptopp-cmake\out\build\dev-windows\_deps\cryptopp\regtest4.cpp [build] [174/174] cmd.exe /C "cd . && D:\dev\cmake\bin\cmake.exe -E vs_link_exe --intdir=cryptopp\CMakeFiles\cryptest.dir --rc="E:\Windows Kits\10\bin\10.0.22621.0\x64\rc.exe" --mt="E:\Windows Kits\10\bin\10.0.22621.0\x64\mt.exe" --manifests -- C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\link.exe /nologo cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\test.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\bench1.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\bench2.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\bench3.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\datatest.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\dlltest.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\fipsalgt.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat0.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat1.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat2.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat3.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat4.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat5.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat6.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat7.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat8.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat9.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat10.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest1.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest2.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest3.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest4.cpp.obj /out:cryptopp\cryptest.exe /implib:cryptopp\cryptest.lib /pdb:cryptopp\cryptest.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console cryptopp\cryptopp.lib kernel32.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." [build] FAILED: cryptopp/cryptest.exe [build] cmd.exe /C "cd . && D:\dev\cmake\bin\cmake.exe -E vs_link_exe --intdir=cryptopp\CMakeFiles\cryptest.dir --rc="E:\Windows Kits\10\bin\10.0.22621.0\x64\rc.exe" --mt="E:\Windows Kits\10\bin\10.0.22621.0\x64\mt.exe" --manifests -- C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\link.exe /nologo cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\test.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\bench1.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\bench2.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\bench3.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\datatest.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\dlltest.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\fipsalgt.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat0.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat1.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat2.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat3.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat4.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat5.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat6.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat7.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat8.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat9.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat10.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest1.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest2.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest3.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest4.cpp.obj /out:cryptopp\cryptest.exe /implib:cryptopp\cryptest.lib /pdb:cryptopp\cryptest.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console cryptopp\cryptopp.lib kernel32.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ." [build] LINK Pass 1: command "C:\PROGRA~1\MIB055~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\link.exe /nologo cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\test.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\bench1.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\bench2.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\bench3.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\datatest.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\dlltest.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\fipsalgt.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat0.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat1.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat2.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat3.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat4.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat5.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat6.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat7.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat8.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat9.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\validat10.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest1.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest2.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest3.cpp.obj cryptopp\CMakeFiles\cryptest.dir\__\_deps\cryptopp\regtest4.cpp.obj /out:cryptopp\cryptest.exe /implib:cryptopp\cryptest.lib /pdb:cryptopp\cryptest.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console cryptopp\cryptopp.lib kernel32.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:cryptopp\CMakeFiles\cryptest.dir/intermediate.manifest cryptopp\CMakeFiles\cryptest.dir/manifest.res" failed (exit code 1120) with the following output: [build] cryptopp.lib(cpu.cpp.obj) : error LNK2019: unresolved external symbol "bool __cdecl CryptoPP::CPU_ProbeSSE2(void)" (?CPU_ProbeSSE2@CryptoPP@@YA_NXZ) referenced in function "void __cdecl CryptoPP::DetectX86Features(void)" (?DetectX86Features@CryptoPP@@YAXXZ) [build] cryptopp\cryptest.exe : fatal error LNK1120: 1 unresolved externals [build] ninja: build stopped: subcommand failed. [proc] The command: D:\dev\cmake\bin\cmake.EXE --build d:/dev/projects/cryptopp-cmake/out/build/dev-windows --parallel 4 --verbose --target all exited with code: 1 and signal: null [build] Build finished with exit code 1 ``` ## The issue In `cpu.cpp`, `void DetectX86Features()`, the function implementation uses a `goto:` to skip all things if `CRYPTOPP_DISABLE_ASM` is defined. However, that gito does not necessarily result in the code being completely dropped by the compiler. While it works fine with gcc (debug build), it does not with MSVC. It results on a linker undefined symbol due toi the code between the `goto` and the `done:`.
`-DCRYPTOPP_DISABLE_ASM=1` not fully honored by the library on MSVC
https://api.github.com/repos/weidai11/cryptopp/issues/1162/comments
1
2022-09-27T10:36:03Z
2023-06-25T21:10:38Z
https://github.com/weidai11/cryptopp/issues/1162
1,387,523,472
1,162
[ "weidai11", "cryptopp" ]
Hello, the AES provided sample code on crypto++ website gives me Unhandled exception at 0x00007FF9DCF1AC87 (ucrtbased.dll) in sadnibbahours.exe: 0xC0000005: Access violation reading location 0x0000012D00000001 in the delete_scalar.cpp file. My guess is it has something with the StringSource destructor or StrinkSink i'm not sure tho, if any one faced this problem. Thanks in advance
StringSource destructor
https://api.github.com/repos/weidai11/cryptopp/issues/1161/comments
0
2022-09-27T06:07:58Z
2022-09-27T14:04:54Z
https://github.com/weidai11/cryptopp/issues/1161
1,387,161,049
1,161
[ "weidai11", "cryptopp" ]
OS: iOS Simulator (x86_64) Version: 8.5.0 Built: via setenv-ios.sh, then make -f GNUmakefile-cross. I removed optimizations and added ASAN, etc during debugging this issue. ``` IOS_SDK=iPhoneSimulator IOS_CPU=x86_64 source ./setenv-ios.sh Configuring for iPhoneSimulator (x86_64) XCODE_TOOLCHAIN: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ IOS_SDK: iPhoneSimulator IOS_CPU: x86_64 IOS_CPPFLAGS: -DCRYPTOPP_DISABLE_ASM IOS_CFLAGS: -arch x86_64 -miphonesimulator-version-min=6 -fno-common IOS_CXXFLAGS: -arch x86_64 -miphonesimulator-version-min=6 -stdlib=libc++ -fno-common IOS_SYSROOT: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.5.sdk ******************************************************************************* It looks the the environment is set correctly. Your next step is build the library with 'make -f GNUmakefile-cross'. ******************************************************************************* ``` ``` Here's what we found... IS_X86: 0, IS_X64: 1, IS_ARM32: 0, IS_ARMV8: 0 clang++ -DCRYPTOPP_DISABLE_ASM -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.5.sdk -Wall -g2 -O0 -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -fPIC -arch x86_64 -miphonesimulator-version-min=9 -stdlib=libc++ -fno-common --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.5.sd -Wall -stdlib=libc++ --sysroot "" -c cryptlib.cpp ``` My code: ``` #include <cryptopp/osrng.h> uint32_t randomNum() { uint32_t output; qDebug() << 0; CryptoPP::AutoSeededRandomPool rng; qDebug() << 1; rng.GenerateBlock(reinterpret_cast<CryptoPP::byte*>(&output), sizeof(uint32_t)); return output; } int main(int argc, char *argv[]) { ... const auto test = randomNum(); qDebug() << test; ... } ``` ASAN: ``` ==78152==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x00030f9347f8 at pc 0x000102e3a87b bp 0x00030f9345a0 sp 0x00030f934598 READ of size 8 at 0x00030f9347f8 thread T0 #0 0x102e3a87a in CryptoPP::member_ptr<CryptoPP::BlockCipher>::~member_ptr() smartptr.h:69 #1 0x102e3a6a8 in CryptoPP::member_ptr<CryptoPP::BlockCipher>::~member_ptr() smartptr.h:69 #2 0x102e3a1d6 in CryptoPP::RandomPool::~RandomPool() randpool.h:43 #3 0x102e3c218 in CryptoPP::AutoSeededRandomPool::~AutoSeededRandomPool() osrng.h:163 #4 0x102e37bd8 in CryptoPP::AutoSeededRandomPool::~AutoSeededRandomPool() osrng.h:163 #5 0x102e37729 in randomNum() main.cpp:67 #6 0x102e388b9 in main main.cpp:103 #7 0x102ede4ee in user_main_trampoline() qioseventdispatcher.mm:273 #8 0x102ede140 in +[QIOSApplicationStateTracker applicationDidFinishLaunching:] qioseventdispatcher.mm:373 Address 0x00030f9347f8 is located in stack of thread T0 at offset 376 in frame #0 0x102e3744f in randomNum() main.cpp:59 This frame has 6 object(s): [32, 36) 'output' (line 60) [48, 56) 'ref.tmp' (line 61) [80, 112) 'ref.tmp1' (line 61) [144, 296) 'rng' (line 62) [368, 376) 'ref.tmp2' (line 63) <== Memory access at offset 376 overflows this variable [400, 432) 'ref.tmp3' (line 63) HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow smartptr.h:69 in CryptoPP::member_ptr<CryptoPP::BlockCipher>::~member_ptr() Shadow bytes around the buggy address: 0x007061f2e8a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x007061f2e8b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x007061f2e8c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x007061f2e8d0: f1 f1 f1 f1 04 f2 f8 f2 f2 f2 f8 f8 f8 f8 f2 f2 0x007061f2e8e0: f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x007061f2e8f0: 00 00 00 00 00 f2 f2 f2 f2 f2 f2 f2 f2 f2 f8[f2] 0x007061f2e900: f2 f2 f8 f8 f8 f8 f3 f3 f3 f3 f3 f3 00 00 00 00 0x007061f2e910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x007061f2e920: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 04 f2 00 00 0x007061f2e930: f2 f2 f8 f8 f8 f2 f2 f2 f2 f2 f8 f8 f8 f2 f2 f2 0x007061f2e940: f2 f2 f8 f8 f8 f2 f2 f2 f2 f2 f8 f2 f2 f2 f8 f8 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==78152==ABORTING ```
AddressSanitizer: stack-buffer-overflow (segfault) on iOS Simulator x86_64 8.5.0
https://api.github.com/repos/weidai11/cryptopp/issues/1160/comments
3
2022-09-22T13:03:39Z
2022-09-27T14:04:45Z
https://github.com/weidai11/cryptopp/issues/1160
1,382,418,576
1,160
[ "weidai11", "cryptopp" ]
`ld.lld: error: undefined symbol: android_getCpuFeatures` `ld.lld: error: undefined symbol: android_getCpuFamily` Help wanted ![IMG_20220922_150128](https://user-images.githubusercontent.com/72664192/191717544-34c934e2-daac-4e3b-a157-0692e33aaeeb.jpg)
Cryptopp compilation error in Android termux
https://api.github.com/repos/weidai11/cryptopp/issues/1159/comments
0
2022-09-22T09:56:58Z
2022-09-27T14:05:10Z
https://github.com/weidai11/cryptopp/issues/1159
1,382,171,150
1,159
[ "weidai11", "cryptopp" ]
LE certificate is expired at Tue, 13 Sep 2022 01:38:45 GMT https://www.cryptopp.com Please update it.
Expired SSL certificatte for cryptopp.com
https://api.github.com/repos/weidai11/cryptopp/issues/1158/comments
1
2022-09-19T07:16:13Z
2022-09-19T14:00:40Z
https://github.com/weidai11/cryptopp/issues/1158
1,377,511,636
1,158
[ "weidai11", "cryptopp" ]
I'm not sure if the github issue tracker is the place to report this, but there's a typo in ed25519 wiki page, under the Message Verification section. ``` StringSource(signature+message, true, new SignatureVerificationFilter(verifier, NULLPTR, THROW_EXCPETION))); ``` where `THROW_EXCPETION` should be `THROW_EXCEPTION`. This may be a non-issue, but I'm not sure where else to report this.
Possible Typo in Ed25519 Wiki Page
https://api.github.com/repos/weidai11/cryptopp/issues/1157/comments
1
2022-09-16T16:21:49Z
2022-09-16T16:46:34Z
https://github.com/weidai11/cryptopp/issues/1157
1,376,161,392
1,157
[ "weidai11", "cryptopp" ]
## Operating system and version Windows 11, Version 21H2 (OS Build 22000.978) ## Compiler Visual Studio 2022 Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31630 for x64 ## Crypto++ library v8.7.0 ## How you built the library CMake (https://github.com/abdes/cryptopp-cmake) Please note that the base `cryptopp` project provided .sln file does not have the option to cross-build for ARM64 on WIN32 using MSVC. Make sure you have installed the ARM and ARM64 build tools for Visual Studio. ``` git clone https://github.com/abdes/cryptopp-cmake cd cryptopp-cmake mkdir cmake-build-arm64 cd cmake-build-arm64 cmake -G "Visual Studio 17 2022" -A ARM64 .. cmake --build . ``` ## Compiler output ``` MSBuild version 17.3.1+2badb37d1 for .NET Framework crc_simd.cpp D:\dev\projects\cryptopp-cmake\cmake-build-arm64\_deps\cryptopp\arm_simd.h(323,1): error C2057: expected constant expression (compiling source file D:\dev\projects\cryptopp-cmake\cmak e-build-arm64\_deps\cryptopp\crc_simd.cpp) [D:\dev\projects\cryptopp-cmake\cmake-build-arm64\cryptopp\cryptopp.vcxproj] gcm_simd.cpp D:\dev\projects\cryptopp-cmake\cmake-build-arm64\_deps\cryptopp\arm_simd.h(323,1): error C2057: expected constant expression (compiling source file D:\dev\projects\cryptopp-cmake\cmak e-build-arm64\_deps\cryptopp\gcm_simd.cpp) [D:\dev\projects\cryptopp-cmake\cmake-build-arm64\cryptopp\cryptopp.vcxproj] gf2n_simd.cpp D:\dev\projects\cryptopp-cmake\cmake-build-arm64\_deps\cryptopp\arm_simd.h(323,1): error C2057: expected constant expression (compiling source file D:\dev\projects\cryptopp-cmake\cmak e-build-arm64\_deps\cryptopp\gf2n_simd.cpp) [D:\dev\projects\cryptopp-cmake\cmake-build-arm64\cryptopp\cryptopp.vcxproj] ``` To do the same for ARM32, just change the commands to: ``` mkdir cmake-build-arm32 cd cmake-build-arm32 cmake -G "Visual Studio 17 2022" -A ARM .. cmake --build . ``` ## Clearly state the undesired behavior (and state the expected behavior) The same build for ARM32 does not generate errors but for ARM64 it does. Expected: both work.
MSVC compiler error when building for ARM64 with Visual Studio 2022
https://api.github.com/repos/weidai11/cryptopp/issues/1156/comments
1
2022-09-16T09:21:20Z
2022-09-16T09:55:12Z
https://github.com/weidai11/cryptopp/issues/1156
1,375,674,800
1,156
[ "weidai11", "cryptopp" ]
I use CryptoPP 8.7.0, Microsoft Visual Studio 2022, Windows SDK 10.0.19041.0. Steps to reproduce: 1. Open cryptest.sln. 2. Switch to ARM or ARM64. 3. Right click cryptlib. Go to Properties > Librarian > General. Change "Target Machine" to MachineARM or MachineARM64. 4. Exclude all .asm files. 5. Build cryptlib. <details> <summary>Build log</summary> ``` 1>------ Build started: Project: cryptlib, Configuration: Debug ARM64 ------ 1>Performing Custom Build Tools 1>pch.cpp 1>cryptlib.cpp 1>cpu.cpp 1>integer.cpp 1>3way.cpp 1>adler32.cpp 1>algebra.cpp 1>algparam.cpp 1>allocate.cpp 1>arc4.cpp 1>aria.cpp 1>aria_simd.cpp 1>ariatab.cpp 1>asn.cpp 1>authenc.cpp 1>base32.cpp 1>base64.cpp 1>basecode.cpp 1>bfinit.cpp 1>blake2.cpp 1>blake2s_simd.cpp 1>Generating Code... 1>...\cpu.cpp(854): warning C4702: unreachable code 1>Compiling... 1>blake2b_simd.cpp 1>blowfish.cpp 1>blumshub.cpp 1>camellia.cpp 1>cast.cpp 1>casts.cpp 1>cbcmac.cpp 1>ccm.cpp 1>chacha.cpp 1>chacha_simd.cpp 1>chachapoly.cpp 1>cham.cpp 1>cham_simd.cpp 1>channels.cpp 1>cmac.cpp 1>crc.cpp 1>crc_simd.cpp 1>...\arm_simd.h(323,1): error C2057: expected constant expression 1>darn.cpp 1>default.cpp 1>des.cpp 1>Generating Code... 1>Compiling... 1>dessp.cpp 1>dh.cpp 1>dh2.cpp 1>donna_32.cpp 1>donna_64.cpp 1>donna_sse.cpp 1>dsa.cpp 1>eax.cpp 1>ec2n.cpp 1>ecp.cpp 1>elgamal.cpp 1>emsa2.cpp 1>esign.cpp 1>files.cpp 1>filters.cpp 1>fips140.cpp 1>fipstest.cpp 1>gcm.cpp 1>gcm_simd.cpp 1>...\arm_simd.h(323,1): error C2057: expected constant expression 1>gf256.cpp 1>Generating Code... 1>Compiling... 1>gf2_32.cpp 1>gf2n.cpp 1>gf2n_simd.cpp 1>...\arm_simd.h(323,1): error C2057: expected constant expression 1>gfpcrypt.cpp 1>gost.cpp 1>gzip.cpp 1>hc128.cpp 1>hc256.cpp 1>hex.cpp 1>hight.cpp 1>hmac.cpp 1>hrtimer.cpp 1>ida.cpp 1>idea.cpp 1>kalyna.cpp 1>kalynatab.cpp 1>keccak.cpp 1>keccak_core.cpp 1>keccak_simd.cpp 1>lea.cpp 1>Generating Code... 1>Compiling... 1>lea_simd.cpp 1>lsh256.cpp 1>lsh256_sse.cpp 1>lsh256_avx.cpp 1>lsh512.cpp 1>lsh512_sse.cpp 1>lsh512_avx.cpp 1>luc.cpp 1>mars.cpp 1>marss.cpp 1>md2.cpp 1>md4.cpp 1>md5.cpp 1>misc.cpp 1>modes.cpp 1>mqueue.cpp 1>mqv.cpp 1>nbtheory.cpp 1>oaep.cpp 1>osrng.cpp 1>Generating Code... 1>Compiling... 1>padlkrng.cpp 1>panama.cpp 1>pkcspad.cpp 1>poly1305.cpp 1>polynomi.cpp 1>pssr.cpp 1>pubkey.cpp 1>queue.cpp 1>rabin.cpp 1>randpool.cpp 1>rabbit.cpp 1>rc2.cpp 1>rc5.cpp 1>rc6.cpp 1>rdrand.cpp 1>rdtables.cpp 1>rijndael.cpp 1>rijndael_simd.cpp 1>ripemd.cpp 1>rng.cpp 1>Generating Code... 1>Compiling... 1>rsa.cpp 1>rw.cpp 1>safer.cpp 1>salsa.cpp 1>scrypt.cpp 1>seal.cpp 1>seed.cpp 1>serpent.cpp 1>sha.cpp 1>sha_simd.cpp 1>sha3.cpp 1>shacal2.cpp 1>shacal2_simd.cpp 1>shake.cpp 1>shark.cpp 1>sharkbox.cpp 1>simeck.cpp 1>simon.cpp 1>simon128_simd.cpp 1>simple.cpp 1>Generating Code... 1>Compiling... 1>skipjack.cpp 1>sm3.cpp 1>sm4.cpp 1>sm4_simd.cpp 1>sosemanuk.cpp 1>speck.cpp 1>speck128_simd.cpp 1>square.cpp 1>squaretb.cpp 1>sse_simd.cpp 1>strciphr.cpp 1>tea.cpp 1>tftables.cpp 1>threefish.cpp 1>tiger.cpp 1>tigertab.cpp 1>ttmac.cpp 1>tweetnacl.cpp 1>twofish.cpp 1>vmac.cpp 1>Generating Code... 1>Compiling... 1>wake.cpp 1>whrlpool.cpp 1>xed25519.cpp 1>xtr.cpp 1>xtrcrypt.cpp 1>xts.cpp 1>zdeflate.cpp 1>zinflate.cpp 1>zlib.cpp 1>Generating Code... 1>Done building project "cryptlib.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 skipped ========== ``` </details>
Compile error when building for Windows ARM
https://api.github.com/repos/weidai11/cryptopp/issues/1155/comments
3
2022-09-15T14:15:23Z
2022-09-16T09:54:57Z
https://github.com/weidai11/cryptopp/issues/1155
1,374,603,642
1,155
[ "weidai11", "cryptopp" ]
Hi all, We are using a CryptoPP 64-bit Dll version 8.7.0 built with VS 2022. The dll works fine in debug and release build as long as no debugger is attached. But with an debugger attached, during the `DoDllPowerUpSelfTest()` in `fipstest.cpp` the function `bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModuleMac, SecByteBlock *pActualMac, unsigned long *pMacFileLocation)` fails and as a result the exception `Cryptographic algorithms are disabled after a power-up self test failed.` is thrown when using a cryptographic function. We guess that something similar to the lines 406 - 416 might solve the problem: ``` #if (_MSC_VER >= 1400 && _MSC_VER < 1920) && (defined(_M_IX86) || defined(_M_X64)) // first byte of _CRT_DEBUGGER_HOOK gets modified in memory by the debugger invisibly, so read it from file if (IsDebuggerPresent()) { if (subSectionMemStart <= (byte *)&_CRT_DEBUGGER_HOOK && (byte *)&_CRT_DEBUGGER_HOOK < subSectionMemStart + subSectionSize) { subSectionSize = (byte *)&_CRT_DEBUGGER_HOOK - subSectionMemStart; nextSubSectionStart = (byte *)&_CRT_DEBUGGER_HOOK - sectionMemStart + 1; } } #endif ``` We circumvented the problem by changing the return value as follows without really solving the problem. ``` #if defined(_MSC_VER) && (_MSC_VER >= 1400) && (defined(_M_IX86) || defined(_M_X64)) if (IsDebuggerPresent()) { OutputDebugStringA("Crypto++ DLL integrity check failure ignored due to attached debugger.\n"); return true; } #endif ``` We would appreciate if the problem could be solved. At least, if there is no better solution than our hack. 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: * Windows 10 Professional 64-bit * Crypto++ 8.7.0 * Visual Studio 2022, using provided project files * compiler command line ``` /Yu"pch.h" /ifcOutput "x64\cryptdll\Release\" /GS /W4 /wd"4231" /wd"4251" /wd"4275" /wd"4355" /wd"4505" /Gy /Zc:wchar_t /Zi /Gm- /O2 /Ob2 /Fd"x64\cryptdll\Release\vc143.pdb" /Zc:inline /fp:precise /D "NDEBUG" /D "CRYPTOPP_EXPORTS" /D "CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2=1" /D "USE_PRECOMPILED_HEADERS" /D "_WINDLL" /errorReport:none /GF /WX- /Zc:forScope /Gd /Oy /Oi /MT /FC /Fa"x64\cryptdll\Release\" /EHsc /nologo /Fo"x64\cryptdll\Release\" /Fp"x64\cryptdll\Release\cryptopp.pch" /diagnostics:column ``` * linker command line ``` /OUT:"x64\DLL_Output\Release\\cryptopp.dll" /ALLOWBIND /MANIFEST /NXCOMPAT /PDB:"x64\DLL_Output\Release\\cryptopp.pdb" /DYNAMICBASE:NO "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /IMPLIB:"C:\Develop\CSB-Image-Meater\thirdParty\CryptoPP\x64\DLL_Output\Release\\cryptopp.lib" /DEBUG /DLL /BASE:"0x42900000" /MACHINE:X64 /OPT:REF /PGD:"x64\DLL_Output\Release\cryptopp.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\cryptdll\Release\cryptopp.dll.intermediate.manifest" /LTCGOUT:"x64\cryptdll\Release\cryptopp.iobj" /OPT:ICF /ERRORREPORT:PROMPT /ILK:"x64\cryptdll\Release\cryptopp.ilk" /NOLOGO /TLBID:1 ```
Power-up self test failed and exception thrown with attached debugger
https://api.github.com/repos/weidai11/cryptopp/issues/1153/comments
1
2022-09-12T13:52:29Z
2023-07-05T08:53:36Z
https://github.com/weidai11/cryptopp/issues/1153
1,369,950,528
1,153
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report Thanks for taking the time to report an issue. Reporting issues helps us improve stability and reliability for all users, so it is a valuable contribution. I am using Ubuntu 18.04. I am trying to build Crypto 5.6.4. I am using GNUmakefile with Yocto. I get the following error. The error is actually longer, but I was able to share this much because that much is listed in the terminal. Error Output: [https://gist.github.com/TYeniyayla/a48c1a284df68c502751c9f9bbdc1ad4](url)
Error during cryptopp 5.6.4 build
https://api.github.com/repos/weidai11/cryptopp/issues/1152/comments
0
2022-09-07T08:12:59Z
2023-07-05T08:53:56Z
https://github.com/weidai11/cryptopp/issues/1152
1,364,270,970
1,152
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report * State the operating system and version (macOS monterrey: 12.5.1, chip Apple M1 Max) * State the version of the Crypto++ library (master) * State how you built the library (makefile) Hello `setenv-ios.sh` script fails if we use `IOS_SDK` `iPhoneSimulator` and `IOS_CPU` `arm64` ``` % source TestScripts/setenv-ios.sh iPhoneSimulator arm64 Using positional arg, IOS_SDK=iPhoneSimulator Using positional arg, IOS_CPU=arm64 Configuring for iPhoneSimulator (arm64) IOS_SDK and IOS_CPU are not valid. Please fix them ```
Can't build Crypto++ for arm64 iphone simulator
https://api.github.com/repos/weidai11/cryptopp/issues/1151/comments
1
2022-09-06T13:06:08Z
2022-09-06T14:25:00Z
https://github.com/weidai11/cryptopp/issues/1151
1,363,258,881
1,151
[ "weidai11", "cryptopp" ]
secblock.h template <typename T, size_t S, typename A> class FixedSizeAllocatorWithCleanup<T, S, A, true> : public AllocatorBase<T> { error C2065: “T” error C2065: “S” error C2065: “A”
Compile error when compiling in vc70 mode on MSVC
https://api.github.com/repos/weidai11/cryptopp/issues/1149/comments
0
2022-09-06T09:51:25Z
2022-09-16T16:47:46Z
https://github.com/weidai11/cryptopp/issues/1149
1,363,018,431
1,149
[ "weidai11", "cryptopp" ]
The new in a Singleton has no complementary delete which causes still reachable bytes in memcheck. (misc.h line 258 and 346) Code snippet to reproduce (FixedMaxPlaintextLength is the trigger here): ``` CryptoPP::RSA::PublicKey publicKey{}; .... CryptoPP::RSAES<CryptoPP::OAEP<CryptoPP::SHA256>>::Encryptor encryptor(publicKey); if (mSessionData.size() > encryptor.FixedMaxPlaintextLength()) ... ``` Environment: Ubuntu 20.04, Crypto++ 8.7.0, gcc 11.1.0, Valgrind 3.15.0 Command line: `valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all ..........` Expected output: No leaks at all Current output: ``` ==2901338== Memcheck, a memory error detector ==2901338== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==2901338== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info ==2901338== Command: .......... ==2901338== .... OK (4) ==2901338== ==2901338== HEAP SUMMARY: ==2901338== in use at exit: 8 bytes in 1 blocks ==2901338== total heap usage: 2,491,956 allocs, 2,491,955 frees, 96,789,772 bytes allocated ==2901338== ==2901338== 8 bytes in 1 blocks are still reachable in loss record 1 of 1 ==2901338== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==2901338== by 0x1E27CC: CryptoPP::NewObject<CryptoPP::OAEP<CryptoPP::SHA256, CryptoPP::P1363_MGF1> >::operator()() const (misc.h:258) ==2901338== by 0x1E241D: CryptoPP::Singleton<CryptoPP::OAEP<CryptoPP::SHA256, CryptoPP::P1363_MGF1>, CryptoPP::NewObject<CryptoPP::OAEP<CryptoPP::SHA256, CryptoPP::P1363_MGF1> >, 0>::Ref() const (misc.h:346) ==2901338== by 0x1E209C: CryptoPP::TF_ObjectImplBase<CryptoPP::TF_EncryptorBase, CryptoPP::TF_CryptoSchemeOptions<CryptoPP::TF_ES<CryptoPP::RSA, CryptoPP::OAEP<CryptoPP::SHA256, CryptoPP::P1363_MGF1>, int>, CryptoPP::RSA, CryptoPP::OAEP<CryptoPP::SHA256, CryptoPP::P1363_MGF1> >, CryptoPP::RSAFunction>::GetMessageEncodingInterface() const (pubkey.h:594) ==2901338== by 0x1E05D8: CryptoPP::TF_CryptoSystemBase<CryptoPP::PK_Encryptor, CryptoPP::TF_Base<CryptoPP::RandomizedTrapdoorFunction, CryptoPP::PK_EncryptionMessageEncodingMethod> >::FixedMaxPlaintextLength() const (pubkey.h:273) ==2901338== .......... ==2901338== ==2901338== LEAK SUMMARY: ==2901338== definitely lost: 0 bytes in 0 blocks ==2901338== indirectly lost: 0 bytes in 0 blocks ==2901338== possibly lost: 0 bytes in 0 blocks ==2901338== still reachable: 8 bytes in 1 blocks ==2901338== suppressed: 0 bytes in 0 blocks ==2901338== ==2901338== For lists of detected and suppressed errors, rerun with: -s ==2901338== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ```
Valgrind memcheck: still reachable bytes in Singleton
https://api.github.com/repos/weidai11/cryptopp/issues/1145/comments
2
2022-08-19T08:44:34Z
2023-10-15T15:23:29Z
https://github.com/weidai11/cryptopp/issues/1145
1,344,140,246
1,145
[ "weidai11", "cryptopp" ]
Hello everyone, a question when I try to use the package and compile it in shared form (.so) and I want to read it I get this: undefined symbol: _ZN8CryptoPP21SimpleKeyingInterface6SetKeyEPKhmRKNS_14NameValuePairsE in which I investigate and it says that I have to compile it in such a way that the symbols must be together with the compiled one, I have tried everything to compile it according to the forums and documentations with the command "-g" or "-O2" but I still cannot read the file My build commands are these: `g++ -DNDEBUG -g -O2 -Wall -Wextra -o node.o node.cpp -l:libcryptopp.a` `g++ -shared -o node.so node.o` I would be very grateful for your great help. Versions install: libcrypto++6 libcrypto++-utils libcrypto++-dev libcrypto++-doc libcrypto++6-dbg My code: File name: node.cpp ` #include "iostream" // I write it like this since it is not shown on this page #include "string" // I write it like this since it is not shown on this page #include "cryptopp/modes.h" #include "cryptopp/aes.h" #include "cryptopp/filters.h" #include "cryptopp/hex.h" using namespace std; using namespace CryptoPP; string node (string text){ string plain = params; // Our input: // Note: the input was previously generated by the same cipher string keyImput = "ABCDEF"; string ivImput = "ABCDF"; string cadenaInput = plain; byte iv_[CryptoPP::AES::BLOCKSIZE] = {}; // this decoder would transform our std::string into raw hex: CryptoPP::HexDecoder decoder; decoder.Put((byte*)ivImput.data(), ivImput.size()); decoder.MessageEnd(); decoder.Get(iv_, sizeof(iv_)); std::string cadenaInput_raw; { CryptoPP::HexDecoder decoder; decoder.Put((byte*)cadenaInput.data(), cadenaInput.size()); decoder.MessageEnd(); long long size = decoder.MaxRetrievable(); cadenaInput_raw.resize(size); decoder.Get((byte*)cadenaInput_raw.data(), cadenaInput_raw.size()); } byte key_[CryptoPP::AES::DEFAULT_KEYLENGTH]; { CryptoPP::HexDecoder decoder; decoder.Put((byte*)keyImput.data(), keyImput.size()); decoder.MessageEnd(); decoder.Get(key_, sizeof(key_)); } string decrypted_text; try { CBC_Mode<AES>::Decryption d; d.SetKeyWithIV(key_, sizeof(key_), iv_); StringSource s(cadenaInput_raw, true, new StreamTransformationFilter( d, new StringSink(decrypted_text) ) // StreamTransformationFilter ); // StringSource return decrypted_text; } catch( CryptoPP::Exception& e ) { std::cerr << e.what() << std::endl; exit(1); } } extern "C" string dencrypnode (string params){ return node(params); } int main (){ string keyImput; string retorno; std::cout << "\nIngrese llave key : "; std::cin >> keyImput; retorno = dencrypnode(keyImput); std::cout << retorno << std::endl; return 0; } `
Failed to compile shared with error: undefined symbol: _ZN8CryptoPP21SimpleKeyingInterface6SetKeyEPKhmRKNS_14NameValuePairsE
https://api.github.com/repos/weidai11/cryptopp/issues/1144/comments
0
2022-08-16T16:55:30Z
2023-07-05T08:54:48Z
https://github.com/weidai11/cryptopp/issues/1144
1,340,632,051
1,144
[ "weidai11", "cryptopp" ]
hello im clone cryptopp from your github and make that with "make cryptest.exe". but when include that in my project and run my project whit "python waf build" (my project is in kodo)show this message: "examples/encode_decode_simple/encode_decode_simple.cpp.1.o: In function `crc::crc32(std::vector<unsigned char, std::allocator<unsigned char> >&)': encode_decode_simple.cpp:(.text+0x29d): undefined reference to `CryptoPP::CRC32::CRC32()' collect2: error: ld returned 1 exit status Waf: Leaving directory `/home/Desktop/tKodo/kodo-rlnc/build/linux' Build failed -> task in 'encode_decode_simple' failed with exit status 1 (run with -v to display more information) " please help me to solve this problem.
link cryptopp with my project
https://api.github.com/repos/weidai11/cryptopp/issues/1143/comments
0
2022-08-13T13:42:58Z
2023-07-05T08:55:06Z
https://github.com/weidai11/cryptopp/issues/1143
1,337,968,237
1,143
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report * State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc): Alpine linux edge * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc): 8.7 release * State how you built the library (Makefile, Cmake, distro, etc): makefile, gcc11 8.7 fails to build `make dynamic libcryptopp.pc` on 32-bit x86: ``` g++ -DNDEBUG -Os -fomit-frame-pointer -g2 -pthread -pipe -Os -fomit-frame-pointer -c poly1305.cpp gcm.cpp: In member function 'virtual size_t CryptoPP::GCM_Base::AuthenticateBlocks(const byte*, size_t)': gcm.cpp:566:13: error: the register '%xmm5' cannot be clobbered in 'asm' for the current target 566 | __asm__ __volatile__ | ^~~~~~~ gcm.cpp:745:13: error: the register '%xmm1' cannot be clobbered in 'asm' for the current target 745 | __asm__ __volatile__ | ^~~~~~~ g++ -DNDEBUG -Os -fomit-frame-pointer -g2 -pthread -pipe -Os -fomit-frame-pointer -c polynomi.cpp make: *** [GNUmakefile:1792: gcm.o] Error 1 ```
fails to build on 32-bit x86
https://api.github.com/repos/weidai11/cryptopp/issues/1142/comments
2
2022-08-10T15:31:35Z
2022-08-25T17:20:11Z
https://github.com/weidai11/cryptopp/issues/1142
1,334,807,693
1,142
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report * State the operating system and version: Gentoo, amd64 * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc): crypto++-8.7.0 * State how you built the library (Makefile, Cmake, distro, etc): Makefile via distribution (Gentoo ebuild, I'm its maintainer) 8.7.0 fails tests with a segfault. 8.6.0 passes fine. The full build log is available here: [build.log](https://github.com/weidai11/cryptopp/files/9278861/build.log) ``` $ ./cryptest.exe -v [...] Legacy ECIES EC2N validation suite running... passed cryptosystem key validation passed encryption and decryption passed decryption known answer ECDSA validation suite running... passed signature check against test vector passed verification check against test vector passed signature key validation passed signature and verification passed checking invalid signature RFC6979 deterministic ECDSA validation suite running... passed deterministic k generation against test vector ECGDSA validation suite running... Aborted (core dumped) ``` Note that this is with debugging symbols on for everything: ``` > bt #0 0x00007ffff7b1bbbc in ?? () from /usr/lib64/libc.so.6 #1 0x00007ffff7ac9e16 in raise () from /usr/lib64/libc.so.6 #2 0x00007ffff7ab37fc in abort () from /usr/lib64/libc.so.6 #3 0x00007ffff7c716aa in _Unwind_Resume (exc=0x555555b3b070) at /usr/src/debug/sys-devel/gcc-12.1.1_p20220806/gcc-12-20220806/libgcc/unwind.inc:246 #4 0x000055555557d581 in CryptoPP::Test::scoped_main (argc=<optimized out>, argv=<optimized out>) at test.cpp:442 #5 0x00007ffff7ab4690 in ?? () from /usr/lib64/libc.so.6 #6 0x00007ffff7ab4749 in __libc_start_main () from /usr/lib64/libc.so.6 #7 0x00005555555acc95 in _start () ``` System information: ``` Portage 3.0.34 (python 3.11.0-beta-5, default/linux/amd64/17.1/hardened, gcc-12.1.1, glibc-2.36, 5.15.58-gentoo-dist-hardened x86_64) ================================================================= System uname: Linux-5.15.58-gentoo-dist-hardened-x86_64-AMD_Ryzen_9_3950X_16-Core_Processor-with-glibc2.36 KiB Mem: 65765032 total, 10138424 free KiB Swap: 8290300 total, 5525500 free Timestamp of repository gentoo: Mon, 08 Aug 2022 02:17:01 +0000 Head commit of repository gentoo: 239fcd40d4ab4d7d0320e1b55d784cc3a1ea6466 Timestamp of repository kde: Sun, 07 Aug 2022 21:46:56 +0000 Head commit of repository kde: 998800cd9d1e14c2a7c533de37cc6f3b8b5d73fa Timestamp of repository qt: Sun, 07 Aug 2022 21:46:50 +0000 Head commit of repository qt: bf8fb8d5966ea04ee67eeba39ca3ea4166125185 Timestamp of repository sam_c: Sun, 07 Aug 2022 21:47:00 +0000 Head commit of repository sam_c: 6947c3b83a06a4432cd48381c0dbc0f3f7811e1d Timestamp of repository steam-overlay: Sun, 07 Aug 2022 21:46:52 +0000 Head commit of repository steam-overlay: 084da06a9ce5d6bf957bc1f67c238113d5d247bb sh dash 0.5.11.5 ld GNU ld (Gentoo 2.39 p2) 2.39.0 ccache version 4.6.1 [disabled] app-misc/pax-utils: 1.3.5::gentoo app-shells/bash: 5.2_rc2-r1::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.36.0::gentoo dev-lang/python: 2.7.18_p15::gentoo, 3.8.13_p4::gentoo, 3.9.13_p1::gentoo, 3.10.6::gentoo, 3.11.0_beta5-r1::gentoo dev-lang/rust: 1.62.1::gentoo dev-util/ccache: 4.6.1::gentoo dev-util/cmake: 3.24.0::gentoo dev-util/meson: 0.63.0::gentoo sys-apps/baselayout: 2.8-r2::gentoo sys-apps/sandbox: 2.29::gentoo sys-apps/systemd: 251.3::gentoo sys-devel/autoconf: 2.13-r2::gentoo, 2.71-r1::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.39::gentoo sys-devel/binutils-config: 5.4.1::gentoo sys-devel/clang: 14.0.6-r1::gentoo sys-devel/gcc: 11.3.1_p20220805::gentoo, 12.1.1_p20220806::gentoo sys-devel/gcc-config: 2.5-r1::gentoo sys-devel/libtool: 2.4.7::gentoo sys-devel/lld: 14.0.6::gentoo sys-devel/llvm: 14.0.6-r2::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.19::gentoo (virtual/os-headers) sys-libs/glibc: 2.36::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo.git priority: -1000 sync-git-verify-commit-signature: yes sync-git-clone-extra-opts: -b stable -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 -c gc.rerereunresolved=0 -c gc.pruneExpire=now crossdev location: /var/db/repos/crossdev masters: gentoo kde location: /var/db/repos/kde sync-type: git sync-uri: https://github.com/gentoo-mirror/kde.git masters: gentoo qt location: /var/db/repos/qt sync-type: git sync-uri: https://github.com/gentoo-mirror/qt.git masters: gentoo sam_c location: /var/db/repos/sam_c sync-type: git sync-uri: https://github.com/gentoo-mirror/sam_c.git masters: gentoo steam-overlay location: /var/db/repos/steam-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/steam-overlay.git masters: gentoo test location: /var/db/repos/test masters: gentoo ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -D_GLIBCXX_ASSERTIONS" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS="--keep-going --with-bdeps=y --complete-graph --deep --dynamic-deps=n --changed-deps=n --usepkg-exclude sys-fs/zfs --usepkg-exclude sys-fs/zfs-kmod --usepkg=y --implicit-system-deps=n --jobs=4 --load-average 32" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR" FCFLAGS="-O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg cgroup clean-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox mount-sandbox multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches" GENTOO_MIRRORS="http://mirror.bytemark.co.uk/gentoo/ http://www.mirrorservice.org/sites/distfiles.gentoo.org/ http://mirrors.soeasyto.com/distfiles.gentoo.org/" LANG="en_GB.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs" LINGUAS="en en_GB" PKGDIR="/var/cache/binpkgs" PORTAGE_COMPRESS="pzstd" PORTAGE_COMPRESS_FLAGS="-9 --rm -q" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" RUSTFLAGS="-C target-cpu=native" SHELL="/bin/bash" USE="PIC X a52 aac acl acpi activities aes alsa amd64 avx avx2 bash-completion bluetooth branding bzip2 cairo caps cdda cdr clang crypt dbus declarative dist-kernel dri dts dvd dvdr emacs encode exif f16c filecaps firewalld flac fma3 freetype gif gmp gpm graphite gtk gui hardened harfbuzz hunspell iconv icu ipv6 jit jpeg kde kdesu kwallet lcms libglvnd libnotify libtirpc llvm-libunwind lto mad mmx mmxext mng mp3 mp4 mpeg multilib ncurses nftables nls nptl ogg opengl openmp pam pango pclmul pcre pdf pgo pie pipewire plasma png policykit popcnt ppds pulseaudio qml qt5 rdrand readline screencast sdl seccomp semantic-desktop sha spell sse sse2 sse3 sse4_1 sse4_2 sse4a ssl ssp ssse3 startup-notification svg system-av1 system-binutils system-boost system-bootstrap system-cairo system-clang system-digest system-ffmpeg system-harfbuzz system-heimdal system-icu system-jpeg system-leveldb system-libevent system-libs system-libvpx system-libyaml system-lz4 system-mitkrb5 system-sqlite system-ssl system-tbb system-uulib system-webp system-zlib systemd threads tiff truetype udev udisks unicode upower usb verify-sig vorbis vulkan wayland widgets x264 xattr xcb xml xtpax xv xvid zfs zlib zsh-completion" ABI_X86="32 64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AArch64 AMDGPU ARM AVR BPF Hexagon Lanai MSP430 Mips NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10 pypy3 python3_11 python3_8 python3_9" QEMU_USER_TARGETS="aarch64 aarch64_be alpha armeb hppa m68k ppc64le sparc64" RUBY_TARGETS="ruby31" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS ``` Let me know if you need more from me.
`make check` fails with 8.7.0
https://api.github.com/repos/weidai11/cryptopp/issues/1141/comments
33
2022-08-08T05:09:42Z
2022-09-16T16:48:33Z
https://github.com/weidai11/cryptopp/issues/1141
1,331,336,506
1,141
[ "weidai11", "cryptopp" ]
This is expected behavior. If you want initialized memory, then use one of the `SecByteBlock` overloads. See https://www.cryptopp.com/wiki/SecBlock . _Originally posted by @noloader in https://github.com/weidai11/cryptopp/issues/1138#issuecomment-1206486308_
This is expected behavior. If you want initialized memory, then use one of the `SecByteBlock` overloads. See https://www.cryptopp.com/wiki/SecBlock .
https://api.github.com/repos/weidai11/cryptopp/issues/1140/comments
0
2022-08-06T11:26:24Z
2023-07-05T08:55:27Z
https://github.com/weidai11/cryptopp/issues/1140
1,330,727,570
1,140
[ "weidai11", "cryptopp" ]
When the SecByteBlock is created but the memory is never initialized, the comparison works correctly but the assertion is raised OS: `Windows 10 x64 Home 21H2` Version: `Crypto++ 8.6.0` Build: `Visual Studio 2015` Configuration: `Debug x64` Runtime library: `Multi-threaded Debug (/MTd)` Test application: Simply added the Win32 console project to the `crypttest` solution and add the `cryptlib.lib` library as a dependency. Then build and run. Test case: ``` #include <iostream> #include "secblock.h" int main() { CryptoPP::SecByteBlock b1, b2; std::cout << "EQ: " << ( b1 == b2 ) << std::endl; return 0; } ``` Output: ``` Assertion failed: misc.cpp(220): CryptoPP::VerifyBufsEqual Assertion failed: misc.cpp(221): CryptoPP::VerifyBufsEqual EQ: 1 Press any key to continue . . . ```
Comparison of uninitialized SecByteBlock raises an assertion
https://api.github.com/repos/weidai11/cryptopp/issues/1138/comments
2
2022-08-05T13:11:49Z
2023-07-05T08:55:46Z
https://github.com/weidai11/cryptopp/issues/1138
1,329,923,516
1,138
[ "weidai11", "cryptopp" ]
The RSA with key size 16 may provide an invalid key randomly. The generation itself does not report any errors but validation fails due to an invalid state. Worth to say I don't need such small-sized keys in production and this was revealed just while testing our integration. OS: `Windows 10 x64 Home 21H2` Version: `Crypto++ 8.6.0` Build: `Visual Studio 2015` Configuration: `Debug x64` Runtime library: `Multi-threaded Debug (/MTd)` Test application: Simply added the Win32 console project to the `crypttest` solution and add the `cryptlib.lib` library as a dependency. Then build and run. Test case: ``` #include <iostream> #include "osrng.h" #include "pssr.h" #include "rsa.h" int main() { CryptoPP::RSA::PrivateKey privateKey; CryptoPP::AutoSeededRandomPool random; privateKey.GenerateRandomWithKeySize( random, 16 ); const CryptoPP::Integer & value1{ privateKey.GetModulus() }; const CryptoPP::Integer & value2{ privateKey.GetPublicExponent() }; const CryptoPP::Integer & value3{ privateKey.GetPrivateExponent() }; const CryptoPP::Integer & value4{ privateKey.GetPrime1() }; const CryptoPP::Integer & value5{ privateKey.GetPrime2() }; const CryptoPP::Integer & value6{ privateKey.GetModPrime1PrivateExponent() }; const CryptoPP::Integer & value7{ privateKey.GetModPrime2PrivateExponent() }; const CryptoPP::Integer & value8{ privateKey.GetMultiplicativeInverseOfPrime2ModPrime1() }; auto pretty = []( const CryptoPP::Integer & i ) { std::stringstream ss; ss << i; return ss.str(); }; std::cout << "value1: " << pretty( value1 ) << std::endl; std::cout << "value2: " << pretty( value2 ) << std::endl; std::cout << "value3: " << pretty( value3 ) << std::endl; std::cout << "value4: " << pretty( value4 ) << std::endl; std::cout << "value5: " << pretty( value5 ) << std::endl; std::cout << "value6: " << pretty( value6 ) << std::endl; std::cout << "value7: " << pretty( value7 ) << std::endl; std::cout << "value8: " << pretty( value8 ) << std::endl; std::cout << "Validation: " << privateKey.Validate( random, 3 ) << std::endl; return 0; } ``` Possible output: ``` value1: 63001. value2: 17. value3: 103. value4: 251. value5: 251. value6: 103. value7: 103. value8: 0. Assertion failed: rsa.cpp(270): CryptoPP::InvertibleRSAFunction::Validate Assertion failed: rsa.cpp(274): CryptoPP::InvertibleRSAFunction::Validate Assertion failed: rsa.cpp(276): CryptoPP::InvertibleRSAFunction::Validate Assertion failed: rsa.cpp(278): CryptoPP::InvertibleRSAFunction::Validate Assertion failed: rsa.cpp(280): CryptoPP::InvertibleRSAFunction::Validate Assertion failed: rsa.cpp(285): CryptoPP::InvertibleRSAFunction::Validate Validation: 0 Press any key to continue . . . ``` Tests are passed: ``` .\cryptest.exe v All tests passed! Seed used was 1659696024 Test started at Fri Aug 5 13:40:24 2022 Test ended at Fri Aug 5 13:43:21 2022 ``` and ``` .\cryptest.exe tv all Tests complete. Total tests = 17549. Failed tests = 0. ```
The RSA with key size 16 may provide an invalid key randomly
https://api.github.com/repos/weidai11/cryptopp/issues/1136/comments
2
2022-08-05T11:09:33Z
2022-08-05T12:54:28Z
https://github.com/weidai11/cryptopp/issues/1136
1,329,795,991
1,136
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report When I build cryptopp 8.6.0 for Fedora 37 x86_64 and run tests it use RIPEMD-160 and falls into an endless loop: ``` passed brainpoolP192r1 using RIPEMD-160 passed signature key validation passed signature and verification passed checking invalid signature passed brainpoolP256r1 using RIPEMD-160 passed signature key validation passed signature and verification passed checking invalid signature passed brainpoolP320r1 using RIPEMD-160 passed signature key validation passed signature and verification passed checking invalid signature ``` Full build and tests run log https://kojipkgs.fedoraproject.org//work/tasks/6424/90386424/build.log All used libraries and compiler you can see here https://kojipkgs.fedoraproject.org//work/tasks/6424/90386424/root.log As I see for other arches (not x86_64) used other SHA algorithms and no endless loop: ``` passed brainpoolP192r1 using SHA-1 passed signature key validation passed signature and verification passed checking invalid signature passed brainpoolP320r1 using SHA-224 passed signature key validation passed signature and verification passed checking invalid signature passed brainpoolP320r1 using SHA-256 passed signature key validation passed signature and verification passed checking invalid signature passed brainpoolP512r1 using SHA-384 passed signature key validation passed signature and verification passed checking invalid signature passed brainpoolP512r1 using SHA-512 passed signature key validation passed signature and verification passed checking invalid signature ``` Help me please to find what's wrong and how break endless loop.
Endless loop at running ECGDSA/RIPEMD tests for Crypto++ 8.6.0
https://api.github.com/repos/weidai11/cryptopp/issues/1134/comments
17
2022-08-02T07:04:20Z
2022-08-08T21:24:08Z
https://github.com/weidai11/cryptopp/issues/1134
1,325,383,184
1,134
[ "weidai11", "cryptopp" ]
OS: Ubuntu 20.04 LTS Version: master@9ea66ce4d97d59d61e49c93f5af191107ebd1925 CPU: amd64 without CLMUL support Compiler: GCC 11.1.0 How I built the library: `make -j8 static` ## How to reproduce * `git checkout --depth=1 https://github.com/weidai11/cryptopp.git` * Get a computer with an amd64 CPU without CLMUL support or apply the following patch to disable it on any modern amd64 CPU (Haswell or later; AES-NI, SSE3/4, AVX can stay enabled): ```diff diff --git a/cpu.cpp b/cpu.cpp index ec107db..084566d 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -721,6 +721,7 @@ void DetectX86Features() g_hasAVX2 &= g_hasAVX; done: + g_hasCLMUL &= 0; #if defined(_SC_LEVEL1_DCACHE_LINESIZE) // Glibc does not implement on some platforms. The runtime returns 0 instead of error. ``` * Build: `make -j8 static` * Run tests: `make check` ## Expected behaviour `make check` passes ## Actual behaviour `make check` fails multiple AES-GCM test vectors. In many cases, there is garbage added to the ciphertext: >2K tables: >Testing AuthenticatedSymmetricCipher algorithm AES/GCM. >... >incorrectly encrypted: >42831EC2217774244B7221B784D0D49CE3AA212F2C02A4E035C17E2329ACA12E21D514B25466931C7D8F6A5AAC84AA051BA30B396A0AAC973D58E091473F5985**4F0F49EB03A109A614FEC26D366402C7** > >AlgorithmType: AuthenticatedSymmetricCipher >Ciphertext: 42831ec2217774244b7221b784d0d49ce3aa212f2c02a4e035c17e2329aca12e 21d514b25466931c7d8f6a5aac84aa051ba30b396a0aac973d58e091473f5985 In contrast, 64k AES/GCM tables always succeed. Please find the raw output of a failing `make check` attached. ## Further details I had these tests **fail** on VMs with the following CPU flags: * `hasSSE2 == 1, hasSSSE3 == 0, hasSSE4.1 == 0, hasSSE4.2 == 0, hasAVX == 0, hasAVX2 == 0, hasAESNI == 0, hasCLMUL == 0, hasRDRAND == 0, hasRDSEED == 0, hasSHA == 0, isP4 == 1` * `hasSSE2 == 1, hasSSSE3 == 1, hasSSE4.1 == 1, hasSSE4.2 == 1, hasAVX == 1, hasAVX2 == 1, hasAESNI == 1, hasCLMUL == 0, hasRDRAND == 1, hasRDSEED == 1, hasSHA == 0, isP4 == 0` I had these tests **succeed** on VMs with the following CPU flags: * `hasSSE2 == 1, hasSSSE3 == 0, hasSSE4.1 == 0, hasSSE4.2 == 0, hasAVX == 0, hasAVX2 == 0, hasAESNI == 0, hasCLMUL == 1, hasRDRAND == 0, hasRDSEED == 0, hasSHA == 0, isP4 == 0` * `hasSSE2 == 1, hasSSSE3 == 1, hasSSE4.1 == 1, hasSSE4.2 == 1, hasAVX == 1, hasAVX2 == 1, hasAESNI == 1, hasCLMUL == 1, hasRDRAND == 1, hasRDSEED == 1, hasSHA == 0, isP4 == 0` Further observations: * clang 13.0.1 works * gcc 9 works * gcc 10 works * gcc 11 works if `g++ … -O0 gcm.cpp` is used * gcc 11 `g++ … -O1 gcm.cpp` makes the tests fail * gcc11 works if in addition to CLMUL=0, SSE2 support is disabled, too * gcc11 works if SSE2 support is only disabled in gcm.cpp:414 (`switch(2*(m_buffer.size()>=64*1024)+ HasSSE2() …)`) → It's probably the "SSE2 and 2K tables" case that's broken in gcm.cpp's `AuthenticateBlocks()` (or GCC 11 miscompiles it)
GCC 11: AES-GCM: make check fails on amd64 without CLMUL support
https://api.github.com/repos/weidai11/cryptopp/issues/1132/comments
3
2022-07-28T18:43:49Z
2022-07-29T08:24:03Z
https://github.com/weidai11/cryptopp/issues/1132
1,321,343,466
1,132
[ "weidai11", "cryptopp" ]
OS: CentOS release 6.8 Crypto version: cryptopp_8.2.0 Currently, I use below code to deal with hex string input to get sha3-256 output ``` std::string my_hash_function(const std::string& hexInput) { // convert heximal string input to text string std::string decoded = ""; StringSource(hexInput, true, new HexDecoder(new StringSink(decoded))); // get hash output based on a text string input SHA3_256 sha256; std::string hash = ""; StringSource(decoded, true, new HashFilter(sha256, new HexEncoder(new StringSink(hash), false))); return hash; } ``` And in this case, odd number of heximal input will be incorrect. It seems to drop last char. ``` e.g. my_hash_function(4'h048b) = 1f73f9a3c025885ba2cfab356a7ffba1731423018b6eea5ab6be7693d369fa3e e.g. my_hash_function(5'h048be) = 1f73f9a3c025885ba2cfab356a7ffba1731423018b6eea5ab6be7693d369fa3e ``` They will get the same result. I would like to know how to get correct hash result based on hex string input instead of converting it to text string in advance? thanks
Hex input type with odd char for sha3_256
https://api.github.com/repos/weidai11/cryptopp/issues/1130/comments
1
2022-06-30T09:20:05Z
2023-07-05T08:56:18Z
https://github.com/weidai11/cryptopp/issues/1130
1,289,845,175
1,130
[ "weidai11", "cryptopp" ]
First of all, thanks a lot for building this extensive, high-quality library! It's great to have so many algorithms supported. However, usually only one or a few specific functions/algorithms are needed by a particular application. Of course, one can statically link to Crypto++ and rely on the linker to only include necessary code in the application binary. But still, one has to compile the whole library even if only a small part is needed. Therefore, I suggest to add optional build flags to customize which algorithms to include. By default, the library could include everything but advanced users could use the build flags to narrow down the set of files needed to build, to speed up the compilation process and also to reduce the binary size when building as a shared library. Such flags are also well supported by package managers like Conan and vcpkg, and today's packages would become smaller and faster to build if dependent applications could specify which parts of Crypto++ they need.
Allow to build only a subset of the library
https://api.github.com/repos/weidai11/cryptopp/issues/1129/comments
1
2022-06-18T16:07:14Z
2023-06-25T07:20:26Z
https://github.com/weidai11/cryptopp/issues/1129
1,275,825,090
1,129
[ "weidai11", "cryptopp" ]
* State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc): Windows 10 * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc): 5.6.2 There is a bug when doing upper_bound search with ```distance``` equal to 0: https://github.com/weidai11/cryptopp/blob/0a7a16472643597b415f017b3e53f68168217542/zdeflate.cpp#L581 This expression results in ```(unsigned int)(0-1)``` and so later segfault happens when trying to access distanceBases
bug in upper_bound search
https://api.github.com/repos/weidai11/cryptopp/issues/1128/comments
2
2022-06-16T13:29:36Z
2022-09-30T10:11:26Z
https://github.com/weidai11/cryptopp/issues/1128
1,273,568,708
1,128
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report Hi, I was working with `hmac` and `base64` encoding and I found a bug. When encoding in base64 a binary string the encoding fails when it reaches the binary values. POC: ```C++ std::string key = "a"; CryptoPP::SecByteBlock session_key; session_key.resize(key.length()); for (int i = 0; i < key.length(); i++) { session_key[i] = key[i]; } std::cout << encode_base64(hmac(session_key, encode_base64("TVPpbxksCpv3FOF6dyRW+A==♥↑PhtULS05v7EzLCC2TKm/sw=="))); ``` `encode_base64` ```C++ std::string encode_base64(const std::string& text) { std::string encoded; Base64Encoder encoder(new StringSink(encoded), false); StringSource pip(text, true, new Redirector(encoder)); return encoded; } ``` `hmac` ```C++ std::string hmac(CryptoPP::SecByteBlock key, std::string message) { std::string mac; std::cout << "message: " << message << std::endl; HMAC< SHA256 > hmac(key, key.size()); StringSource ss(message, true, new HashFilter(hmac, new StringSink(mac) ) // HashFilter ); // StringSource return mac; } ```
Base64 byte encoding
https://api.github.com/repos/weidai11/cryptopp/issues/1127/comments
0
2022-06-14T08:08:15Z
2023-07-05T08:57:09Z
https://github.com/weidai11/cryptopp/issues/1127
1,270,420,687
1,127
[ "weidai11", "cryptopp" ]
Hi there! OS: Ubuntu 20.04 LTS Crypto++ ver 8.6 Built the library using the provided Makefile There are two parts to my program (1.Encrypt 2.decrypt I encrypted and encoded contents from a text file and stored the encoded content in another file. I extracted that content from the file and decoded it with checks in place to ensure the text and keys were the same and nothing had changed. During the decryption part, after sending it to stringstream, it returns a null string. ` Encryption part ECIES<ECP>::Decryptor d0(prng, ASN1::secp256r1()); PrintPrivateKey(d0.GetKey()); ECIES<ECP>::Encryptor e0(d0); PrintPublicKey(e0.GetKey()); SavePrivateKey(d0.GetPrivateKey()); SavePublicKey(e0.GetPublicKey()); ifstream infile; ofstream outfile; string sen,sen1,line,enc; sen.clear(); line.clear(); enc.clear(); infile.open("Me/text.txt"); if(infile.is_open()){ while(!infile.eof()){ getline(infile,line); sen1 = sen1 + line; } } StringSource ss1(sen,true,new PK_EncryptorFilter(prng,e0,new StringSink(enc))); cout<<"Encrypted:"<<endl<<enc<<endl; infile.close(); string encoded; StringSource ss3(enc, true, new HexEncoder(new StringSink(encoded))); outfile.open("Me/e1nc_text.txt"); outfile<<encoded; outfile.close(); cout<<"Encoded: "<< encoded<<endl;` ` Decryption part ECIES<ECP>::Decryptor d1; ECIES<ECP>::Decryptor d0(prng, ASN1::secp256r1()); LoadPrivateKey(d1.AccessPrivateKey()); d1.GetPrivateKey().ThrowIfInvalid(prng, 3); ECIES<ECP>::Encryptor e1; LoadPublicKey(e1.AccessPublicKey()); e1.GetPublicKey(). ThrowIfInvalid(prng, 3); PrintPrivateKey(d1.GetKey()); PrintPublicKey(e1.GetKey()); ifstream file; string sen,line,dec,decoded; sen.clear(); line.clear(); file.open("Me/e1nc_text.txt"); if(file.is_open()){ while(!file.eof()){ getline(file,line); sen = sen + line; } } StringSource ss7 (sen,true, new HexDecoder(new StringSink(decoded))); cout<<"Decoded"<<endl<<decoded; StringSource ss8 (decoded,true,new PK_DecryptorFilter(prng,d1,new StringSink(dec))); cout<<endl<<"Decrypted:"<<endl; cout<<dec; ofstream outfile("Me/decrypt.txt"); outfile<<dec;` IN THE OUTPUT WE CAN SEE IT IS RETURNING NULL STRING ![image](https://user-images.githubusercontent.com/63083760/173231900-8a878746-e75d-4936-9d83-7e0e28398ce2.png)
NULL STRING RETURNED IN ECIES
https://api.github.com/repos/weidai11/cryptopp/issues/1126/comments
0
2022-06-12T11:55:13Z
2023-07-05T08:57:30Z
https://github.com/weidai11/cryptopp/issues/1126
1,268,557,948
1,126
[ "weidai11", "cryptopp" ]
I have to add crypto++ as dll into our project. The project is using several functions of crypto++ but a few used give an "unresolved extern symbol" linking error: CryptoPP::DSAConvertSignatureFormat CryptoPP::Base64Encoder::IsolatedInitialize CryptoPP::Base64Decoder::GetDecodingLookupArray Clearly, this can't work because non of those functions have CRYPTOPP_DLL set. Is this by intention? * Compiled crypto++ on Windows 11 64-bit, Visual Studio 2017 Tooling 141, 64 bit as Release DLL-Import * Version 8.6 * Visual Studio 2017 Tooling 141 ` 1>kkrypt.obj : error LNK2019: unresolved external symbol "unsigned __int64 __cdecl CryptoPP::DSAConvertSignatureFormat(unsigned char *,unsigned __int64,enum CryptoPP::DSASignatureFormat,unsigned char const *,unsigned __int64,enum CryptoPP::DSASignatureFormat)" (?DSAConvertSignatureFormat@CryptoPP@@YA_KPEAE_KW4DSASignatureFormat@1@PEBE12@Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class KKrypt::kKryptAllocator<char> > __cdecl KKrypt::CreateSignedApplicationResponse(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?CreateSignedApplicationResponse@KKrypt@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$kKryptAllocator@D@KKrypt@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@00@Z) 1>kkrypt.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl CryptoPP::Base64Encoder::IsolatedInitialize(class CryptoPP::NameValuePairs const &)" (?IsolatedInitialize@Base64Encoder@CryptoPP@@UEAAXAEBVNameValuePairs@2@@Z) referenced in function "public: __cdecl CryptoPP::Base64Encoder::Base64Encoder(class CryptoPP::BufferedTransformation *,bool,int)" (??0Base64Encoder@CryptoPP@@QEAA@PEAVBufferedTransformation@1@_NH@Z) 1>kkrypt.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl CryptoPP::Base64Decoder::IsolatedInitialize(class CryptoPP::NameValuePairs const &)" (?IsolatedInitialize@Base64Decoder@CryptoPP@@UEAAXAEBVNameValuePairs@2@@Z) 1>kkrypt.obj : error LNK2019: unresolved external symbol "private: static int const * __cdecl CryptoPP::Base64Decoder::GetDecodingLookupArray(void)" (?GetDecodingLookupArray@Base64Decoder@CryptoPP@@CAPEBHXZ) referenced in function "public: __cdecl CryptoPP::Base64Decoder::Base64Decoder(class CryptoPP::BufferedTransformation *)" (??0Base64Decoder@CryptoPP@@QEAA@PEAVBufferedTransformation@1@@Z) `
Unresolved external symbol using crypto++ as dll
https://api.github.com/repos/weidai11/cryptopp/issues/1125/comments
0
2022-06-08T09:24:26Z
2023-07-05T08:57:49Z
https://github.com/weidai11/cryptopp/issues/1125
1,264,453,448
1,125
[ "weidai11", "cryptopp" ]
In seal.h file there is this function for generating a stream: ` void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);` How many iterations should be used?
How many iterations should be used in SEAL 3.0?
https://api.github.com/repos/weidai11/cryptopp/issues/1124/comments
1
2022-06-02T23:28:49Z
2023-07-05T08:57:40Z
https://github.com/weidai11/cryptopp/issues/1124
1,258,962,768
1,124
[ "weidai11", "cryptopp" ]
Hey im using crypto++ 8.6 which i installed with apt on Debian. I wrote a program that encrypts files using AES 256 bit in GCM mode. when I try compiling the program always tells me that GCM_Mode is not a part of CryptoPP but other modes like CBC, CFB, CTR etc. work though. The weird thing is that yesterday I was able to compile and execute it and everything worked. But now I compiled with the same compiler command and without changing the code and it throws this error. ``` g++ -DNDEBUG -g3 -O2 -Wall -Wextra -o test test.cpp -l:libcryptopp.a ``` ``` #include <cryptopp/files.h> // to encryt files (for FileSink and stuff like that) #include <cryptopp/modes.h> // different AES modes (GCM is used here) #include <cryptopp/osrng.h> // random key and iv gneration #include <fstream> // library to convert file to binary #include <iostream> // self explanitory using aes_key_t = std::array<CryptoPP::byte, 32>; // keysize definition (AES-256bit here) using aes_iv_t = std::array<CryptoPP::byte, CryptoPP::AES::BLOCKSIZE>; // block size definition (16 bytes) void encrypt(const aes_key_t &key, const aes_iv_t &iv, const std::string &filename_in, const std::string &filename_out) { CryptoPP::GCM_Mode<CryptoPP::AES>::Encryption cipher{}; cipher.SetKeyWithIV(key.data(), key.size(), iv.data()); std::ifstream in{filename_in, std::ios::binary}; // open the inputfile in binary mode std::ofstream out{filename_out, std::ios::binary}; // open the outputfile in binary mode CryptoPP::FileSource{in, /*pumpAll=*/true, new CryptoPP::StreamTransformationFilter{ cipher, new CryptoPP::FileSink{out}}}; } void decrypt(const aes_key_t &key, const aes_iv_t &iv,const std::string &filename_in, const std::string &filename_out) { CryptoPP::GCM_Mode<CryptoPP::AES>::Decryption cipher{}; cipher.SetKeyWithIV(key.data(), key.size(), iv.data()); std::ifstream in{filename_in, std::ios::binary}; std::ofstream out{filename_out, std::ios::binary}; CryptoPP::FileSource{in, /*pumpAll=*/true, new CryptoPP::StreamTransformationFilter{ cipher, new CryptoPP::FileSink{out}}}; } int main(int argc, char **argv) { // prints block size std::cout << CryptoPP::AES::BLOCKSIZE << std::endl; CryptoPP::AutoSeededRandomPool rng{}; // Generate a random key aes_key_t key{}; rng.GenerateBlock(key.data(), key.size()); // Generate a random IV aes_iv_t iv{}; rng.GenerateBlock(iv.data(), iv.size()); // encrypt encrypt(key, iv, "notes.txt", "notes_encrypted"); // decrypt decrypt(key, iv, "notes_encrypted", "notes_decrypted.txt"); return 0; } ```
error: ‘GCM_Mode’ is not a member of ‘CryptoPP’; did you mean ‘ECB_Mode’?
https://api.github.com/repos/weidai11/cryptopp/issues/1123/comments
1
2022-05-25T14:35:03Z
2023-07-05T08:58:08Z
https://github.com/weidai11/cryptopp/issues/1123
1,248,194,680
1,123
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report Hello, please consider this configuration : * State the operating system and version (Windows 11 Pro) * State the version of the Crypto++ library (VCPKG DOWNLOAD at https://vcpkg.info/port/cryptopp for window-static 64 bit auto version) * State how you built the library (Cmake) Hi, I've recently an error about signature validation. I generate sig thought my function which is : ``` /** * Get a DER signature format. * @param privateKey a constant QByteArray reference argument. * @param message a constant QByteArray reference argument. */ QByteArray getDERSignature(const QByteArray& privateKey, const QByteArray& message) { AutoSeededRandomPool prng; /** Init the private key. */ ECDSA<ECP, SHA256>::PrivateKey privateKeyMaker; QByteArray const privateKeyByte { privateKey.toHex() }; HexDecoder decoder; decoder.Put((byte*)&privateKeyByte.constData()[0], privateKeyByte.size()); decoder.MessageEnd(); Integer x; x.Decode(decoder, decoder.MaxRetrievable()); privateKeyMaker.Initialize(ASN1::secp256k1(), x); /** Init the signer. */ ECDSA<ECP, SHA256>::Signer signer(privateKeyMaker); QByteArray signature; size_t siglenth { signer.SignatureLength() }; signature.resize(siglenth); siglenth = signer.SignMessage(prng, (const byte*) (message.constData()), message.length(), (byte*) (&signature.constData()[0])); signature.resize(siglenth); QByteArray derSign; derSign.resize(3+3+3+2+signature.size()); size_t converted_size = DSAConvertSignatureFormat( (byte*) (&derSign.constData()[0]), derSign.size(), DSA_DER, (const byte*) (signature.data()), signature.size(), DSA_P1363); derSign.resize(converted_size); return derSign; } ``` And my program crashs when I call the verify function : ``` /** * Verify a DER signature format. * @param publicKey a constant QByteArray reference argument. * @param message a constant QByteArray reference argument. * @param derSig a constant QByteArray reference argument. */ bool verifySignature(const QByteArray& publicKey, const QByteArray& message, const QByteArray& derSig) { /** Init the publicKey. */ ECDSA<ECP, SHA256>::PublicKey publicKeyMaker; publicKeyMaker.AccessGroupParameters().Initialize(ASN1::secp256k1()); StringSource ss(publicKey.toHex(), true, new CryptoPP::HexDecoder); ECP::Point point; publicKeyMaker.GetGroupParameters().GetCurve().DecodePoint(point, ss, ss.MaxRetrievable()); /** Init verifier. */ ECDSA<ECP, SHA256>::Verifier verifier(publicKeyMaker); /** Verify */ SecByteBlock signature(verifier.SignatureLength()); DSAConvertSignatureFormat(signature, signature.size(), DSA_P1363, (const byte*) derSig.data(), derSig.size(), DSA_DER); bool const okSafeMode { verifier.VerifyMessage((const byte*)&message.data()[0], message.size(), (const byte*)&signature[0], signature.size()) }; return okSafeMode; } ``` I'm doing currently my tests in my main : ``` QByteArray privTest { QByteArray::fromHex("E4A6CFB431471CFCAE491FD566D19C87082CF9FA7722D7FA24B2B3F5669DBEFB") }; QByteArray publicKeyTest { CryptoSecp256k1::getCompressedPublicKey(privTest) }; QByteArray testmsg { QCryptographicHash::hash("Do or do not. There is no try.", QCryptographicHash::Sha256) }; logPrint("DER SIG RESULT = 0x" + CryptoSecp256k1::getDERSignature(privTest, testmsg).toHex()); QByteArray derSigTest { QByteArray::fromHex("30450221009cfc808decd2fe0b568991724422561b97933cad7fed9e32a596cbd3a79c8be2022002d1eff5ea6b3035834f1fb1674e0554f13c3e4e6717485f52b19fc6fdaf0f55") }; // CRASH logPrint("isValid = " + QString::number(CryptoSecp256k1::verifySignature(publicKeyTest, testmsg, derSigTest))); ``` I have this output : ``` 2022-05-22 11:40:29 DER SIG RESULT = 0x30440220298fae13dd5d0eb42f70a850aad07536fb7daa8e9b65418a89ba970d9e1c1cb802201d1bd40f10cd0141ae0e353d2bbc787d0e91319d069f31f15260b6ce558e2d7b 11:40:30: test.exe exited with code -529697949 // CRASH ``` I watched the documentation here : https://www.cryptopp.com/wiki/Elliptic_Curve_Digital_Signature_Algorithm#Test_Program Moreover, I would like a low-s signature generation and verification. I don't know if the CRYPTO++ Secp256k1 implementation does it by default. ![image](https://user-images.githubusercontent.com/70860774/169689575-0e0ec607-ced3-483e-a164-a00d389c2739.png) I hope you'll be able to help me. Best regards, Loopite
ECDSA, Secp256k1 - LowS value & perform correct signature generation and validation.
https://api.github.com/repos/weidai11/cryptopp/issues/1122/comments
3
2022-05-22T09:52:06Z
2023-07-05T08:58:58Z
https://github.com/weidai11/cryptopp/issues/1122
1,244,204,972
1,122
[ "weidai11", "cryptopp" ]
Hi, I'm currently using the latest release of cryptopp (8.6.0) in react-native-cryptopp (see https://github.com/JiriHoffmann/react-native-cryptopp/issues/17). I need to make RSA-PSS-SHA256 signatures with a max salt length (which is the default in many libraries, for example in node.js https://nodejs.org/api/crypto.html#cryptosignalgorithm-data-key-callback). However, the only way to do it currently is through a template parameter of `PSSR_MEM`, which doesn't allow setting it at runtime. This is problematic as the max salt length varies with the key size and the hashing algorithm with the formula `keyModulusLengthInBytes - hashlength - 2`, which gives for `SHA256`: - for 1024 bits keys: 94 bytes - for 2048 bits keys: 222 bytes - for 3072 bits keys: 350 bytes - for 4096 bytes keys: 478 bytes - ... I found a question dating back from 2005 about this, which never got an answer: https://groups.google.com/g/cryptopp-users/c/UFVcV9Ml_Cs/m/NFYEfxhF0CEJ. Enumerating the possibilities of key sizes & hash lengths at compile time is quite tedious, passing the `saltLength` as an argument at runtime would be preferable.
Set salt length for RSA PSS signatures at run time
https://api.github.com/repos/weidai11/cryptopp/issues/1121/comments
10
2022-05-18T16:03:25Z
2022-07-22T13:53:53Z
https://github.com/weidai11/cryptopp/issues/1121
1,240,182,113
1,121
[ "weidai11", "cryptopp" ]
Hey, When compiling I get a bunch of Undefined symbols for architecture arm64: "CryptoPP: errors. I'm using xcode 13.3.1 on mac 12.3.1, using the latest 8.6 lib.
Undefined symbols for architecture arm64: "CryptoPP:
https://api.github.com/repos/weidai11/cryptopp/issues/1120/comments
2
2022-05-03T14:36:12Z
2024-03-20T14:24:03Z
https://github.com/weidai11/cryptopp/issues/1120
1,224,190,898
1,120
[ "weidai11", "cryptopp" ]
I believe EC private key decoding is currently broken, here is a code sample in which `BERDecode` throws an exception. The key was randomly generated using OpenSSL and so I believe it is valid: ```c++ uint8_t server_priv_key_[] = { 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0xf4, 0x0b, 0x3b, 0xdc, 0xf2, 0x97, 0x8d, 0x17, 0xde, 0x58, 0x75, 0xc1, 0xb4, 0x91, 0xe9, 0x2f, 0x3c, 0x68, 0x2b, 0x14, 0xbc, 0x9a, 0xfd, 0x47, 0x99, 0xf6, 0xa4, 0x0d, 0xc3, 0x6c, 0x3f, 0x7e, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xb3, 0xe9, 0xc3, 0xc9, 0xd9, 0x16, 0xe4, 0x5d, 0x3b, 0xc9, 0x93, 0xdb, 0xfd, 0xcd, 0x39, 0x4d, 0x28, 0xf3, 0x44, 0x95, 0xc2, 0xbc, 0x3f, 0x0d, 0x8b, 0xbe, 0xa9, 0xa5, 0xf5, 0x89, 0x14, 0xe1, 0x0e, 0x74, 0xcf, 0xd6, 0xb8, 0x75, 0x3a, 0xcc, 0x13, 0x1c, 0x74, 0x8c, 0xe8, 0x63, 0xe2, 0xee, 0xa9, 0xd6, 0x7c, 0x2e, 0x05, 0x65, 0x30, 0x1b, 0x27, 0xc7, 0xc3, 0x70, 0x36, 0xfb, 0xc5, 0x00, }; ArraySource server_priv_key_source { server_priv_key_, sizeof(server_priv_key_), true }; ECDSA<ECP, SHA256>::PrivateKey server_priv_key; server_priv_key.BERDecode(server_priv_key_source); ``` I'm compiling on Ubuntu 20.04 with gcc 9.4.0 and using Crypto++'s current master branch.
ECDSA private key: BERDecode broken?
https://api.github.com/repos/weidai11/cryptopp/issues/1118/comments
1
2022-04-24T11:37:21Z
2022-06-03T00:04:30Z
https://github.com/weidai11/cryptopp/issues/1118
1,213,629,367
1,118
[ "weidai11", "cryptopp" ]
### HexDecoder Bug (Crypto++ 8.6.0) According to this page: https://www.cryptopp.com/wiki/HexDecoder `HexDecoder`can parse the following formats: ``` "0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00" "0xFF 0xEE 0xDD 0xCC 0xBB 0xAA 0x99 0x88 0x77 0x66 0x55 0x44 0x33 0x22 0x11 0x00" ``` But the following code failed using `HexDecoder` class: ``` #include <cstddef> #include <string> #include <cryptopp/hex.h> using namespace std; using namespace CryptoPP; int main(int, char*[]) { string encoded = "0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00"; string decoded; HexDecoder decoder; decoder.Put( (byte*)encoded.data(), encoded.size() ); decoder.MessageEnd(); word64 size = decoder.MaxRetrievable(); if(size && size <= SIZE_MAX) { decoded.resize(size); decoder.Get((byte*)&decoded[0], decoded.size()); } // Expected decoded value: // [0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00] // Actual decoded value: // [0x0F, 0xF0, 0xEE, 0x0D, 0xD0, 0xCC, 0x0B, 0xB0, 0xAA, 0x09, 0x90, 0x88, 0x07, 0x70, 0x66, 0x05, 0x50, 0x44, 0x03, 0x30, 0x22, 0x01, 0x10, 0x00] return EXIT_SUCCESS; } ``` * OS: Ubuntu 20.04 * Crypto++ Version: 8.6.0 * GCC Version: 9.4.0
HexDecoder Bug
https://api.github.com/repos/weidai11/cryptopp/issues/1117/comments
3
2022-04-23T23:11:08Z
2022-06-03T00:04:49Z
https://github.com/weidai11/cryptopp/issues/1117
1,213,475,105
1,117
[ "weidai11", "cryptopp" ]
The [`CPUID64` function in `x64dll.asm`](https://github.com/weidai11/cryptopp/blob/master/x64dll.asm#L1999) modifies a nonvolatile register (`rbx`) but does not use `proc frame`. Sample fix: ``` CPUID64 PROC FRAME ;; preserve per ABI mov [rsp+8], rbx .savereg rbx, 8 .endprolog ;; eax = func mov rax, rcx ;; ecx = subfunc mov rcx, rdx ;; query cpuid ;; save mov [r8+0], eax mov [r8+4], ebx mov [r8+8], ecx mov [r8+12], edx ;; return value mov rax, 1 ;; restore mov rbx, [rsp+8] ret CPUID64 ENDP ```
CPUID64 assembly noncompliant with Windows x64 ABI
https://api.github.com/repos/weidai11/cryptopp/issues/1116/comments
5
2022-04-06T01:15:39Z
2023-06-25T20:50:25Z
https://github.com/weidai11/cryptopp/issues/1116
1,193,890,150
1,116
[ "weidai11", "cryptopp" ]
This is another new issue. Running the test suite on an old PowerMac with Debian Sid installed in a debug build: ``` (gdb) r v Starting program: /home/jwalton/cryptopp/cryptest.exe v [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/powerpc64-linux-gnu/libthread_db.so.1". ... Program received signal SIGILL, Illegal instruction. 0x00000001008fe278 in CryptoPP::CPU_ProbePower8 () at ppc_power8.cpp:70 70 word64 w1[2] = {x, x}, w2[2] = {4, 6}, w3[2]; (gdb) c Continuing. Program received signal SIGILL, Illegal instruction. 0x00000001008fe158 in CryptoPP::SigIllHandler () at ppc_power8.cpp:34 34 { (gdb) c Continuing. Program terminated with signal SIGILL, Illegal instruction. ``` The first `SIGILL` is expected since it is our probe. The second `SIGILL` is not. It looks like GCC is using POWER8 instructions without guarding them. Related issue for this platform and compiler are [GH #986](https://github.com/weidai11/cryptopp/issues/986) and [GH #1112](https://github.com/weidai11/cryptopp/issues/1112).
PowerMac and Illegal Instruction
https://api.github.com/repos/weidai11/cryptopp/issues/1115/comments
1
2022-03-29T23:04:03Z
2022-03-30T03:10:38Z
https://github.com/weidai11/cryptopp/issues/1115
1,185,566,260
1,115
[ "weidai11", "cryptopp" ]
I've been testing out the new clang++-14 compiler and gives a new warning in the RSA implementation (I'm using `-Werror` so it shows as an error): ``` rsa.cpp:162:20: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical] if (n.IsEven() || e.IsEven() | d.IsEven()) ^~~~~~~~~~~~~~~~~~~~~~~ || rsa.cpp:162:20: note: cast one or both operands to int to silence this warning ``` I'm building with an older cryptopp, but I see this line is unchanged in current `master` <https://github.com/weidai11/cryptopp/blob/6a3b34f555ebf29a46b6c143a0063f474a635ed7/rsa.cpp#L162>. The warning looks legit to me and that it's just a simple typo. Do you want a PR for this or just fix yourselves?
clang++-14 warning
https://api.github.com/repos/weidai11/cryptopp/issues/1114/comments
2
2022-03-26T12:52:07Z
2022-03-26T13:11:26Z
https://github.com/weidai11/cryptopp/issues/1114
1,181,742,127
1,114
[ "weidai11", "cryptopp" ]
### State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) `iPhone Simulator x86_64` Compiled on: `Intel Mac Pro and Intel MacBook Pro, macOS BigSur 11.6` ### State the version of the Crypto++ library (Crypto++ 7.0, Master, etc) Crypto++ 8.6, also tried master ### State how you built the library (Makefile, Cmake, distro, etc) ```bash IOS_SDK="iPhoneSimulator" IOS_CPU="x86_64" source setenv-ios.sh make -f GNUmakefile-cross static make install -f GNUmakefile-cross PREFIX="$TEMP_IOS" ``` When compiled with `iPhoneOS arm64` or even "x86_64" on Android, everything runs fine. It is just the simulator having issues. ### Clearly state the undesired behavior (and state the expected behavior) Whenever I use SHA256 anywhere the app instantly crashes due to a bad memory access error. ```cpp byte derived[SHA256::DIGESTSIZE]; std::string password = "password"; std::string salt = "salt"; int iterations = 1024; std::string hashResult; byte unused = 0; PKCS12_PBKDF<SHA256> pbkdf; pbkdf.DeriveKey(derived, sizeof(derived), unused, reinterpret_cast<const byte *>(password.data()), password.size(), reinterpret_cast<const byte *>(salt.data()), salt.size(), iterations, 0.0f); ``` Here is a screenshot of stack trace from Xcode ![Screen Shot 2022-03-24 at 4 29 23 PM](https://user-images.githubusercontent.com/37304278/160004881-6469b99b-546a-4d85-9155-d8e2eaebf00c.png) #### Another example: Simply creating `AutoSeededRandomPool` causes the same error. ![Screen Shot 2022-03-24 at 4 33 26 PM](https://user-images.githubusercontent.com/37304278/160005473-4a5be761-18dc-44c1-8471-adb24fdeb33d.png) Please let me know if you need more info, or you can try running the example from [react-native-cryptopp](https://github.com/JiriHoffmann/react-native-cryptopp).
SHA256 not working on x86_64 iPhone Simulator
https://api.github.com/repos/weidai11/cryptopp/issues/1113/comments
7
2022-03-24T20:43:16Z
2022-03-26T23:10:47Z
https://github.com/weidai11/cryptopp/issues/1113
1,180,034,527
1,113
[ "weidai11", "cryptopp" ]
This is a new break. Running the test suite on an old PowerMac with Debian Sid installed: ``` BLAKE2s validation suite running... passed algorithm name passed 65 hashes and keyed hashes BLAKE2b validation suite running... passed algorithm name Illegal instruction ``` Looking a bit further: ``` $ ./cryptest.exe v Using seed: 1647863056 Testing Settings... passed: Your machine is big endian. passed: Your machine is 64-bit. passed: sizeof(byte) == 1 passed: sizeof(word16) == 2 passed: sizeof(word32) == 4 passed: sizeof(word64) == 8 passed: sizeof(word128) == 16 passed: sizeof(hword) == 4, sizeof(word) == 8, sizeof(dword) == 16 passed: cacheLineSize == 128 passed: hasAltivec == 1, hasPower7 == 0, hasPower8 == 1, hasPower9 == 0, hasAES == 0, hasPMULL == 0, hasSHA256 == 0, hasSHA512 == 0, hasDARN == 0 ``` For some reason, we are detecting POWER8 is available. Related issue for this platform and compiler are [GH #986](https://github.com/weidai11/cryptopp/issues/986) and [GH #1115](https://github.com/weidai11/cryptopp/issues/1115).
PowerMac and Illegal Instruction
https://api.github.com/repos/weidai11/cryptopp/issues/1112/comments
2
2022-03-21T11:50:09Z
2022-03-30T02:51:48Z
https://github.com/weidai11/cryptopp/issues/1112
1,175,271,094
1,112
[ "weidai11", "cryptopp" ]
Hi, I'm trying to implement [CKM_RSA_PKCS_PSS from PKCS#11](https://www.cryptsoft.com/pkcs11doc/v220/group__SEC__12__1__10__PKCS____1__RSA__PSS.html) using Cryptopp 8.6 but it seems that there is not a signer implementation in Cryptopp than can do exactly this. Botan implemented this mechanism with the [PSSR_Raw](https://botan.randombit.net/doxygen/classBotan_1_1PSSR__Raw.html) PK_Signer class after an issue was opened ([see issue](https://github.com/randombit/botan/issues/1211)). The closest I've been able to get was using the following RSA signer template in cryptopp: `RSASS<PSS, SHA256>::Signer` which is the equivalent to the Botan [normal PSSR implementation](https://botan.randombit.net/doxygen/classBotan_1_1PSSR.html) without message recovery, and also seems to be following the mechanism [CKM_SHA256_RSA_PKCS_PSS from PKCS#11](https://www.cryptsoft.com/pkcs11doc/v230/group__SEC__11__1__17__PKCS____1__RSA__PSS__SIGNATURE__WITH__SHA__1____SHA__256____SHA__384__OR__SHA__512.html#CKM_SHA256_RSA_PKCS_PSS). The problem is that the _"PKCS #1 RSA PSS_" mechanism does not compute the hash over the given message, it assumes the input/message it's a **pre-hashed buffer**, but the signer in cryptopp always hashes the message. As stated in the mechanism definition: > _"The PKCS #1 RSA PSS mechanism, denoted [CKM_RSA_PKCS_PSS](https://www.cryptsoft.com/pkcs11doc/v220/group__SEC__12__1__9__PKCS____1__RSA__PSS__MECHANISM__PARAMETERS.html#CKM_RSA_PKCS_PSS), is a mechanism based on the RSA public-key cryptosystem and the PSS block format defined in PKCS #1. It supports single-part signature generation and verification without message recovery. This mechanism corresponds only to the part of PKCS #1 that involves block formatting and RSA, given a hash value; it does not compute a hash value on the message to be signed."_ And also Botan documentation states in the description of the PSSR_Raw class: > _"This accepts a pre-hashed buffer"_ Is there any way to implement this signature scheme with Cryptopp? Thanks, Christian
Implementation of PKCS #1 RSA PSS with Cryptopp
https://api.github.com/repos/weidai11/cryptopp/issues/1111/comments
1
2022-03-18T08:43:46Z
2022-06-03T00:09:23Z
https://github.com/weidai11/cryptopp/issues/1111
1,173,339,890
1,111
[ "weidai11", "cryptopp" ]
I am using TEA decryption. I want to change the iterating times, but cannot find details of its document.
TEA Doc Need
https://api.github.com/repos/weidai11/cryptopp/issues/1110/comments
0
2022-03-12T18:30:46Z
2022-03-26T23:11:39Z
https://github.com/weidai11/cryptopp/issues/1110
1,167,363,567
1,110
[ "weidai11", "cryptopp" ]
After cloning `2ef3254fe1b2f57d4833b2c1ddb100874b41f4a7` the library can not be built on Cygwin, (and likely WSL and other linux like environments) ``` osrng.cpp: In constructor ‘CryptoPP::BlockingRng::BlockingRng()’: osrng.cpp:256:36: error: ‘O_NOFOLLOW’ was not declared in this scope 256 | const int flags = O_RDONLY|O_NOFOLLOW; | ^~~~~~~~~~ make: *** [GNUmakefile:1801: osrng.o] Error 1 make: *** Waiting for unfinished jobs.... ``` ``` $ uname -a CYGWIN_NT-10.0 DESKTOP-0VCFDU8 3.3.4(0.341/5/3) 2022-01-31 19:35 x86_64 Cygwin ```
Builds on Cygwin are broken after 2ef3254fe1b2f57d4833b2c1ddb100874b41f4a7
https://api.github.com/repos/weidai11/cryptopp/issues/1109/comments
1
2022-02-27T19:39:03Z
2022-02-27T21:29:42Z
https://github.com/weidai11/cryptopp/issues/1109
1,153,371,536
1,109
[ "weidai11", "cryptopp" ]
I am developing the .so file in visual studio. when i am trying to build the project it’s give the error which is below. below is my output log. ``` Build started... 1>------ Build started: Project: SharedObject2, Configuration: Debug ARM ------ 1>ANDROID_HOME=C:\\Microsoft\AndroidSDK\25 1>ANT_HOME=C:\Program Files\Microsoft Visual Studio\2022\Community\Apps\apache-ant-1.9.3 1>JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 1>NDK_ROOT=C:\\Microsoft\AndroidNDK\android-ndk-r21e 1>pch.h 1>SharedObject2.cpp 1>clang: error: no such file or directory: 'cryptlib.lib' 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Application Type\Android\3.0\Android.Common.targets(119,5): error MSB6006: "clang.exe" exited with code 1. 1>Done building project "SharedObject2.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== ``` have put the folder of cryptopp library folder inside the project folder. and also i have added the > Additional Include Directories in the property>C/C++>General of project into visual studio project property. in this I have add the path of include header files. also add the Additional Library Directories > Additional Library Directories in the property>Linker>General of project into visual studio project property.in this i have add the .lib file path. and also add the Input > Additional Dependencies in the property>Linker>Input of project into visual studio project property. here i write the name of .lib file. which is “cryptlib.lib”. https://github.com/weidai11/cryptopp this is the link where i downloaded the crypto++ library. in this project there is one file which is “cryptlib.vcxproj” using this file i have build the .lib file. then this whole project folder i have put in my project and use this lib file in my project which is i have mention above. i am developing the dynamic shared library(android). can i use this cryptlib.lib file in the development of dynamic shared library(android) ? Please anyone help me to solve this error why i am getting clang error ? please help.
I phasing this "clang: error: no such file or directory: 'cryptlib.lib'" in visual studio.
https://api.github.com/repos/weidai11/cryptopp/issues/1108/comments
3
2022-02-25T12:36:14Z
2022-02-25T12:56:20Z
https://github.com/weidai11/cryptopp/issues/1108
1,150,396,832
1,108
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report * State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) OSX 12.1 * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc) 8.6.0 * State how you built the library (Makefile, Cmake, distro, etc) make ; sudo make install * Clearly state the undesired behavior (and state the expected behavior) I have a simple program that generates a keypair, then signs and subsequently verifies the message it just signed. The program in full is here on this gist: https://gist.github.com/sonnyparlin/745894f492b7471fe232e4b56ea17446 I'm getting intermittent errors where the message doesn't get verified and/or an exception is thrown with invalid materials inside verifyMessage(). Here is sample output: To recreate this output, compile the program and run it in a loop on the command line: while true do ./ecctest sleep 1 done Each iteration creates a new wallet, signs a message and attempts to verify that message. The expected behavior is consistent output. ``` It worked! All good! Failed to verify signature on message It worked! All good! It worked! All good! It worked! All good! libc++abi: terminating with uncaught exception of type CryptoPP::CryptoMaterial::InvalidMaterial: CryptoMaterial: this object contains invalid values It worked! All good! It worked! All good! It worked! All good! It worked! All good! It worked! All good! It worked! All good! It worked! All good! Failed to verify signature on message It worked! All good! It worked! All good! It worked! All good! libc++abi: terminating with uncaught exception of type CryptoPP::CryptoMaterial::InvalidMaterial: CryptoMaterial: this object contains invalid values It worked! All good! libc++abi: terminating with uncaught exception of type CryptoPP::CryptoMaterial::InvalidMaterial: CryptoMaterial: this object contains invalid values It worked! All good! It worked! All good! It worked! All good! It worked! All good! It worked! All good! It worked! All good! It worked! All good! libc++abi: terminating with uncaught exception of type CryptoPP::CryptoMaterial::InvalidMaterial: CryptoMaterial: this object contains invalid values It worked! All good! It worked! All good! It worked! All good! It worked! All good! It worked! All good! It worked! All good! It worked! All good! libc++abi: terminating with uncaught exception of type CryptoPP::CryptoMaterial::InvalidMaterial: CryptoMaterial: this object contains invalid values It worked! All good! libc++abi: terminating with uncaught exception of type CryptoPP::CryptoMaterial::InvalidMaterial: CryptoMaterial: this object contains invalid values It worked! All good! It worked! All good! It worked! All good! ```
Intermittent signature verification failure using ECC cryptography
https://api.github.com/repos/weidai11/cryptopp/issues/1107/comments
1
2022-02-18T22:19:31Z
2022-02-25T22:38:26Z
https://github.com/weidai11/cryptopp/issues/1107
1,143,858,266
1,107
[ "weidai11", "cryptopp" ]
Windows 10.0.19044 pro MSVC 2019 16.11.10 - IDE build WSDK 10.0.19041 cryptopp860 - static library target **problem: short CryptoPP::SipHash<> demo fails to compile** ``` #include <iostream> #include <cryptopp860/siphash.h> using SipHash64 = CryptoPP::SipHash<2, 4, false>; int main() { auto key = "12345678"; SipHash64 hash(reinterpret_cast<const CryptoPP::byte*>(key), 8); std::cout << "Hello World!\n"; } ``` **error message** ``` 1>cryptlib.vcxproj -> C:\Users\xxx\libs\cryptopp860\x64\Output\Debug\cryptlib.lib 2>------ Rebuild All started: Project: demo, Configuration: Debug x64 ------ 2>demo.cpp 2>C:\Users\xxx\libs\cryptopp860\siphash.h(39,43): error C2143: syntax error: missing ',' before '<' 2>C:\Users\xxx\libs\cryptopp860\siphash.h(44): message : see reference to class template instantiation 'CryptoPP::SipHash_Info<T_128bit>' being compiled 2>C:\Users\xxx\libs\cryptopp860\siphash.h(39,1): error C2504: 'FixedKeyLength': base class undefined 2>C:\Users\xxx\libs\cryptopp860\siphash.h(52): message : see reference to class template instantiation 'CryptoPP::SipHash_Info<false>' being compiled 2>C:\Users\xxx\cryptopp860\siphash.h(143): message : see reference to class template instantiation 'CryptoPP::SipHash_Base<2,4,false>' being compiled 2>C:\Users\xxx\demo.cpp(10): message : see reference to class template instantiation 'CryptoPP::SipHash<2,4,false>' being compiled 2>Done building project "demo.vcxproj" -- FAILED. ``` **possible solution** In siphash.h add missing #include to seckey.h, where FixedKeyLength is actually defined: ```diff #include "cryptlib.h" +#include "seckey.h" #include "secblock.h" ```
msvc build error: siphash.h missing #include for seckey.h
https://api.github.com/repos/weidai11/cryptopp/issues/1105/comments
3
2022-02-12T02:16:21Z
2022-02-12T02:37:46Z
https://github.com/weidai11/cryptopp/issues/1105
1,133,529,283
1,105
[ "weidai11", "cryptopp" ]
I have used the crypto++ library in my project. when i am trying to build the solution then visual studio is give me this below errors for the cryptolib.h file. Build started... 1>------ Build started: Project: SharedObject1, Configuration: Debug ARM ------ 1>ANDROID_HOME=C:\\Microsoft\AndroidSDK\25 1>ANT_HOME=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Apps\apache-ant-1.9.3 1>JAVA_HOME=C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25 1>NDK_ROOT=C:\\Microsoft\AndroidNDK64\android-ndk-r16b 1>cryptpp_decrypt.cpp 1>In file included from cryptpp_decrypt.cpp:5: 1>./cryptopp/cryptlib.h(359,47): error : cannot use typeid with -fno-rtti 1> return GetValue((std::string("ThisObject:")+typeid(T).name()).c_str(), object); 1> ^ 1>./cryptopp/cryptlib.h(368,50): error : cannot use typeid with -fno-rtti 1> return GetValue((std::string("ThisPointer:") + typeid(T).name()).c_str(), ptr); 1> ^ 1>./cryptopp/cryptlib.h(381,29): error : cannot use typeid with -fno-rtti 1> return GetVoidValue(name, typeid(T), &value); 1> ^ 1>./cryptopp/cryptlib.h(455,30): error : cannot use 'throw' with exceptions disabled 1> {if (stored != retrieving) throw ValueTypeMismatch(name, stored, retrieving);} 1> ^ 1>./cryptopp/cryptlib.h(471,4): error : cannot use 'throw' with exceptions disabled 1> throw InvalidArgument(std::string(className) + ": missing required parameter '" + name + "'"); 1> ^ 1>./cryptopp/cryptlib.h(486,4): error : cannot use 'throw' with exceptions disabled 1> throw InvalidArgument(std::string(className) + ": missing required parameter '" + name + "'"); 1> ^ 1>./cryptopp/cryptlib.h(594,35): error : cannot use 'throw' with exceptions disabled 1> virtual Clonable* Clone() const {throw NotImplemented("Clone() is not implemented yet.");} // TODO: make this =0 1> ^ 1>./cryptopp/cryptlib.h(762,4): error : cannot use 'throw' with exceptions disabled 1> {throw NotImplemented(GetAlgorithm().AlgorithmName() + ": this object doesn't support resynchronization");} 1> ^ 1>./cryptopp/cryptlib.h(785,3): error : cannot use 'throw' with exceptions disabled 1> throw NotImplemented(GetAlgorithm().AlgorithmName() + ": this object doesn't support resynchronization"); 1> ^ 1>./cryptopp/cryptlib.h(1090,3): error : cannot use 'throw' with exceptions disabled 1> throw NotImplemented("StreamTransformation: this object doesn't support random access"); 1> ^ 1>./cryptopp/cryptlib.h(1450,3): error : cannot use 'throw' with exceptions disabled 1> throw NotImplemented("RandomNumberGenerator: IncorporateEntropy not implemented"); 1> ^ 1>./cryptopp/cryptlib.h(1818,4): error : cannot use 'throw' with exceptions disabled 1> throw NotImplemented("BufferedTransformation: this object can't be reinitialized"); 1> ^ 1>./cryptopp/cryptlib.h(2358,4): error : cannot use 'throw' with exceptions disabled 1> throw NotImplemented("BufferedTransformation: this object is not attachable"); 1> ^ 1>./cryptopp/cryptlib.h(2428,31): error : cannot use 'throw' with exceptions disabled 1> {if (!Validate(rng, level)) throw InvalidMaterial("CryptoMaterial: this object contains invalid values");} 1> ^ 1>./cryptopp/cryptlib.h(2440,25): error : cannot use 'throw' with exceptions disabled 1> {CRYPTOPP_UNUSED(bt); throw NotImplemented("CryptoMaterial: this object does not support saving");} 1> ^ 1>./cryptopp/cryptlib.h(2457,25): error : cannot use 'throw' with exceptions disabled 1> {CRYPTOPP_UNUSED(bt); throw NotImplemented("CryptoMaterial: this object does not support loading");} 1> ^ 1>./cryptopp/cryptlib.h(2474,3): error : cannot use 'throw' with exceptions disabled 1> throw NotImplemented("CryptoMaterial: this object does not support precomputation"); 1> ^ 1>./cryptopp/cryptlib.h(2482,87): error : cannot use 'throw' with exceptions disabled 1> {CRYPTOPP_UNUSED(storedPrecomputation); CRYPTOPP_ASSERT(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");} 1> ^ 1>./cryptopp/cryptlib.h(2489,87): error : cannot use 'throw' with exceptions disabled 1> {CRYPTOPP_UNUSED(storedPrecomputation); CRYPTOPP_ASSERT(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");} 1> ^ 1>CLANGCOMPILE : fatal error : too many errors emitted, stopping now [-ferror-limit=] 1>20 errors generated. 1>Done building project "SharedObject1.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== please help if anybody know how can i solve this error?
I am phasing the error in cryptolib.h file which is part of crypto++ library.
https://api.github.com/repos/weidai11/cryptopp/issues/1104/comments
1
2022-02-09T07:59:38Z
2022-02-10T23:00:22Z
https://github.com/weidai11/cryptopp/issues/1104
1,128,178,175
1,104
[ "weidai11", "cryptopp" ]
This is probably not a major issue given it only occurs on a debug test on a depreciated function but I can't see it's been reported elsewhere Running Win10 64 pro Crypto latest (unmodified direct from git) = Library version (library): 870, header version (app): 870 Visual Studio 2022 *debug build* after opening via cryptest.sln NB the release build works fine using local windows debugger to run cryptest fails:- ``` pass=TestRandomPool() && pass; ``` at assert:- ``` // If this assert fires, then outString == inString. You could experience a // performance hit. Also see https://github.com/weidai11/cryptopp/issues/1088' CRYPTOPP_ASSERT(outString != inString); ``` with output:- ``` Testing OldRandomPool generator... Assertion failed: C:\Users\usr\source\repos\cryptopp\strciphr.cpp(249): CryptoPP::CFB_CipherTemplate<class CryptoPP::AbstractPolicyHolder<class CryptoPP::CFB_CipherAbstractPolicy,class CryptoPP::CFB_ModePolicy> >::ProcessData ``` This is the callstack at the point of assert failure:- ``` > KernelBase.dll!00007ff886af90d2() Unknown cryptest.exe!CryptoPP::CFB_CipherTemplate<CryptoPP::AbstractPolicyHolder<CryptoPP::CFB_CipherAbstractPolicy,CryptoPP::CFB_ModePolicy>>::ProcessData(unsigned char * outString, const unsigned char * inString, unsigned __int64 length) Line 249 C++ cryptest.exe!CryptoPP::StreamTransformation::ProcessString(unsigned char * inoutString, unsigned __int64 length) Line 1061 C++ cryptest.exe!CryptoPP::OldRandomPool::Stir() Line 138 C++ cryptest.exe!CryptoPP::OldRandomPool::GenerateIntoBufferedTransformation(CryptoPP::BufferedTransformation & target, const std::string & channel, unsigned __int64 size) Line 151 C++ cryptest.exe!CryptoPP::RandomNumberStore::TransferTo2(CryptoPP::BufferedTransformation & target, unsigned __int64 & transferBytes, const std::string & channel, bool blocking) Line 1241 C++ cryptest.exe!CryptoPP::BufferedTransformation::TransferMessagesTo2(CryptoPP::BufferedTransformation & target, unsigned int & messageCount, const std::string & channel, bool blocking) Line 656 C++ cryptest.exe!CryptoPP::BufferedTransformation::TransferAllTo2(CryptoPP::BufferedTransformation & target, const std::string & channel, bool blocking) Line 702 C++ cryptest.exe!CryptoPP::SourceTemplate<CryptoPP::RandomNumberStore>::PumpAll2(bool blocking) Line 1444 C++ cryptest.exe!CryptoPP::Source::PumpAll() Line 1383 C++ cryptest.exe!CryptoPP::Source::SourceInitialize(bool pumpAll, const CryptoPP::NameValuePairs & parameters) Line 1421 C++ cryptest.exe!CryptoPP::RandomNumberSource::RandomNumberSource(CryptoPP::RandomNumberGenerator & rng, int length, bool pumpAll, CryptoPP::BufferedTransformation * attachment) Line 1520 C++ cryptest.exe!CryptoPP::Test::Test_RandomNumberGenerator(CryptoPP::RandomNumberGenerator & prng, bool drain) Line 449 C++ cryptest.exe!CryptoPP::Test::TestRandomPool() Line 666 C++ cryptest.exe!CryptoPP::Test::ValidateAll(bool thorough) Line 45 C++ cryptest.exe!CryptoPP::Test::Validate(int alg, bool thorough) Line 943 C++ cryptest.exe!CryptoPP::Test::scoped_main(int argc, char * * argv) Line 401 C++ cryptest.exe!main(int argc, char * * argv) Line 1095 C++ [External Code] ```
TestRandomPool asserts on VS2022 with a debug build
https://api.github.com/repos/weidai11/cryptopp/issues/1103/comments
2
2022-01-19T07:47:06Z
2022-02-14T16:12:31Z
https://github.com/weidai11/cryptopp/issues/1103
1,107,765,325
1,103
[ "weidai11", "cryptopp" ]
Details: https://github.com/cryfs/cryfs/issues/408 Trying to build CryFS 0.11.0 and 0.11.1 (which uses CryptoPP 8.5 and 8.6 respectively) fails on armel while CryFS 0.10.x (which uses CryptoPP 8.2) works fine. The error message is ``` ... [ 3%] Building CXX object vendor/cryptopp/vendor_cryptopp/CMakeFiles/cryptopp-object.dir/aria_simd.cpp.o In file included from /<<PKGBUILDDIR>>/vendor/cryptopp/vendor_cryptopp/aria_simd.cpp:18: /usr/lib/gcc/arm-linux-gnueabi/11/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard" 31 | #error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard" | ^~~~~ /<<PKGBUILDDIR>>/vendor/cryptopp/vendor_cryptopp/aria_simd.cpp:67:34: error: ‘uint32x4_t’ does not name a type; did you mean ‘uint32_t’? 67 | inline void ARIA_GSRK_NEON(const uint32x4_t X, const uint32x4_t Y, byte RK[16]) | ^~~~~~~~~~ | uint32_t /<<PKGBUILDDIR>>/vendor/cryptopp/vendor_cryptopp/aria_simd.cpp:67:54: error: ‘uint32x4_t’ does not name a type; did you mean ‘uint32_t’? ... ``` This was reported by the maintainer of the CryFS debian packages, it fails while trying to build the packages for Debian APT. Any ideas on what could cause this?
NEON intrinsics not available with the soft-float ABI
https://api.github.com/repos/weidai11/cryptopp/issues/1100/comments
4
2022-01-06T01:16:59Z
2022-02-12T02:42:46Z
https://github.com/weidai11/cryptopp/issues/1100
1,094,876,856
1,100
[ "weidai11", "cryptopp" ]
At [Commit b41f1f033bba](https://github.com/weidai11/cryptopp/commit/b41f1f033bba) we added `O_NOFOLLOW` to `open(/dev/urandom, flags)` calls to harden the non-blocking RNG on Unix & Linux. FreeBSD softlinks `/dev/urandom` to `/dev/random`, so the `open` calls failed. On FreeBSD, `arc4random` (and friends) uses a ChaCha20-based prng. The functions are recommended for cryptographic quality random numbers. The functions can be used to build a mostly non-blocking generator. The generator is seeded using `/dev/random` so we can't completely avoid the blocking RNG. Also see the FreeBSD man page at [arc4random(3) man page](https://www.freebsd.org/cgi/man.cgi?query=arc4random). This bug report tracks cutting FreeBSD over to `arc4random_buf`.
FreeBSD link /dev/urandom → /dev/random
https://api.github.com/repos/weidai11/cryptopp/issues/1098/comments
1
2021-12-29T09:44:26Z
2021-12-31T14:21:45Z
https://github.com/weidai11/cryptopp/issues/1098
1,090,396,294
1,098
[ "weidai11", "cryptopp" ]
V8.6 of Cryptopp seems to be returning a wrong SHA1 value when used in release mode on ARM platforms on 64bit with Visual Studio. Speculation is that hardware acceleration on ARM is broken in some subtle way and hardware acceleration isn't used in debug mode. 32bit ARM compile is OK, Debug mode ARM compile is OK. x86 compile is OK in all permutations. Test code and example output is attached. Summary of output is also below ``` SHA-Test-x64-debug.exe Message: abc Digest: A9993E364706816ABA3E25717850C26C9CD0D89D Success Message: abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq Digest: 84983E441C3BD26EBAAE4AA1F95129E5E54670F1 Success SHA-Test-x64-release.exe Message: abc Digest: A9993E364706816ABA3E25717850C26C9CD0D89D Success Message: abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq Digest: 84983E441C3BD26EBAAE4AA1F95129E5E54670F1 Success SHA-Test-ARM64-release.exe Message: abc Digest: 54EC777E5DAB79DC6BD3C7CE43C289E19FEFFCEC Failed comparison, expected A9993E364706816ABA3E25717850C26C9CD0D89D Message: abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq Digest: 2810B286725876151057E5B3FACF3F1C0B8873FB Failed comparison, expected 84983E441C3BD26EBAAE4AA1F95129E5E54670F1 ``` [SHA-ARM64-Release-Fail.txt](https://github.com/weidai11/cryptopp/files/7772788/SHA-ARM64-Release-Fail.txt) [ConsoleApplication1.txt](https://github.com/weidai11/cryptopp/files/7772789/ConsoleApplication1.txt)
SHA1 returns wrong result on ARM release mode compile
https://api.github.com/repos/weidai11/cryptopp/issues/1096/comments
12
2021-12-24T05:36:50Z
2022-08-20T19:54:32Z
https://github.com/weidai11/cryptopp/issues/1096
1,088,162,832
1,096
[ "weidai11", "cryptopp" ]
Windows 10 Professional x64 Crypto++ 8.7.0 master Built using Visual Studio 2019 project "cryptdll" (part of the "crypttest" solution), debug & release After using the Visual Studio project to build the DLL, I then try to link to this Crypto++ DLL build in Qt Creator with: ``` cryptopp { DEFINES += USE_ENCRYPTION DEFINES += CRYPTOPP SOURCES += Crypto.cpp HEADERS += Crypto.h win32 { INCLUDEPATH += M:\Projects\cryptopp LIBS += -lcryptopp CONFIG(debug, debug|release) { LIBS += -LM:\Projects\cryptopp\x64\DLL_Output\Debug } else { LIBS += -LM:\Projects\cryptopp\x64\DLL_Output\Release } } } ``` This results in the following link error: ```Crypto.obj:-1: error: LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const CryptoPP::DEFAULT_CHANNEL" (?DEFAULT_CHANNEL@CryptoPP@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B)``` The link line being used in Qt Creator: ```link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:deploy\debug\ClipNet.exe @N:\Temp\ClipNet.exe.15540.2578.jom``` This error only appears when I declare CryptoPP::ArraySource in my code, with even just ```CryptoPP::ArraySource as;```. If I comment this out, all other Crypto++ code links without error. I also tried moving the project over to Visual Studio in hopes it might be a difference in the IDEs, but I received the same link error with DEFAULT_CHANNEL. Thanks for any help here.
Using CryptoPP::ArraySource results in missing symbol CryptoPP::DEFAULT_CHANNEL
https://api.github.com/repos/weidai11/cryptopp/issues/1095/comments
1
2021-12-21T20:39:59Z
2021-12-21T20:45:09Z
https://github.com/weidai11/cryptopp/issues/1095
1,086,214,359
1,095
[ "weidai11", "cryptopp" ]
OS is Linux, distribution is Ubuntu Jammy and Debian Sid. cryptopp is official 8.6.0 Build is tried with Debian packaging tools, below Makefile is used. Failing compiler invocation is the following. ``` g++ -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -pthread -g -O2 -ffile-prefix-map=/home/gcs/compile/libcrypto++-8.6.0=. -fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -march=armv7-a -Wa,--noexecstack -c aes_armv4.S cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU ``` It should build and provide the object file. CPU is 'ARMv7 Processor rev 2 (v7l)', gcc --version displays: gcc (Debian 11.2.0-13) 11.2.0 Proposed patch by Steve Langasek (steve.langasek@ubuntu.com) and confirmed fixing this issue on Debian/Sid: ``` --- a/GNUmakefile +++ b/GNUmakefile @@ -1174,11 +1174,11 @@ # Also see https://www.cryptopp.com/wiki/Cryptogams. ifeq ($(IS_ARM32)$(IS_LINUX),11) ifeq ($(CLANG_COMPILER),1) - CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack - CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -mthumb -Wa,--noexecstack + CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a+fp -Wa,--noexecstack + CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a+fp -mthumb -Wa,--noexecstack else - CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack - CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -Wa,--noexecstack + CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a+fp -Wa,--noexecstack + CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a+fp -Wa,--noexecstack endif SRCS += aes_armv4.S sha1_armv4.S sha256_armv4.S sha512_armv4.S endif
version 8.6.0 FTBFS on armhf
https://api.github.com/repos/weidai11/cryptopp/issues/1094/comments
11
2021-12-20T12:39:04Z
2022-02-12T03:16:20Z
https://github.com/weidai11/cryptopp/issues/1094
1,084,745,127
1,094
[ "weidai11", "cryptopp" ]
Executive Summary --- * OS - Windows 11 Home x64 * Version - Crypto++ 1.8.0#1 * Build - VCPKG * Error Message: ``` Unhandled exception at 0x7536EA32 in <name>.exe: Microsoft C++ exception: CryptoPP::FileStore::OpenErr at memory location 0x0058F83C. ``` --- Description --- This exception occurs in files.cpp after line 91: `m_stream = m_file.get()` This results in me being unable to create files using FileSource - in my case at least. The exception in question isn't captured by try/catch and instead just errors and crashes. My relevant code: ``` void dCrypto::RSAKeyPair::saveKeys() { CryptoPP::FileSource fspub("./ire.pub", true); CryptoPP::FileSource fspriv("./ire.priv", true); try { PEM_Save(fspub, this->publicKey); PEM_Save(fspriv, this->privateKey); } catch (CryptoPP::FileStore::OpenErr &e) { std::cout << strerror(errno) << "\n"; std::cout << e.what() << std::endl; exit(-1); } } ``` Stacktrace, line by line: * `dCrypto::RSAKeyPair::saveKeys` - line 20 - `CryptoPP::FileSource fspub("./ire.pub", true);` * [`files.h`](../blob/master/files.cpp#L109-L110) - line 109/110 - `FileSource(const char *filename, bool pumpAll, BufferedTransformation *attachment = NULLPTR, bool binary=true) : SourceTemplate<FileStore>(attachment) {SourceInitialize(pumpAll, MakeParameters(Name::InputFileName(), filename)(Name::InputBinaryMode(), binary));}` * [`filters.h`](../blob/master/filters.h#L1418) - line 1418 - `IsolatedInitialize(parameters);` * [`files.cpp`](../blob/master/files.cpp#L92) - line 92 - closes module `FIleStore::StoreInitialize` I have tried making the files one at a time and not initialising the FileSources until the other has completed, but neither works and still results in the same exception. I have also tried downgrading (through vcpkg) to 8.2.0-2 and 8.5.0, however neither solves the issue. --- I am unsure whether this is an issue with PEM-Pack or Crypto++, however all the files seem to be Crypto++ files and are not included with PEM-Pack, so I concluded (correct or not) that this is most likely a Crypto++ issue.
Unable to save file with PEM-Pack feature
https://api.github.com/repos/weidai11/cryptopp/issues/1089/comments
4
2021-11-28T00:09:31Z
2021-11-29T03:55:41Z
https://github.com/weidai11/cryptopp/issues/1089
1,065,147,440
1,089
[ "weidai11", "cryptopp" ]
Going from V7 to V8.6 resulted in a 36% loss of performance with AES. With an Intel Core i7-8700K, running 12 threads, performance was: * V7 of Crypto++: 4830 MB/sec * V8.6 of Crypto++: 3078 MB/sec This function was used: ```c++ CFB_Mode<AES>::Encryption cfbEncryption(AESKey, AESKey.size(), AESiv); cfbEncryption.ProcessData(AESData, AESData, AESData.size()); ``` We eventually tracked back the performance change to this code change https://github.com/weidai11/cryptopp/commit/71a812ed9e7cdaa9b93cdd1285930d459e8d4900#diff-2867583d2009b9c826fbac3a19ae0f72a110684052acd1800ab505e0d75b47ad The difference was not so noticeable with 1 thread. So the built in benchmarks don't highlight the problem very well. But with multiple threads the performance difference is dramatic. We presume this is because the code change above added a lot of overhead for memory buffer copying when the input and output buffer are the same. We even observed negative performance as more threads were added. (So 8 threads was significantly faster than 12 threads on a CPU with 12 virtual cores). The solution is fairly easy. Don't use the same input and output buffers (AESData). But I think using the same value, was suggested practice in the past. Lots of web sites still suggest this. So now the problem is that there are dozens of public code examples where the buffers are the same and I suspect the performance flaw is now in 100s of apps. Once different input and output buffers are used, performance was, V8.6 of Crypto++: 5055 MB/sec, or a 64% performance improvement. Might have been better just to immediately fail in `ProcessData()` if parameters are the same, then the user would be more aware of the problem.
36% loss of performance with AES
https://api.github.com/repos/weidai11/cryptopp/issues/1088/comments
7
2021-11-22T06:24:16Z
2022-02-14T16:11:27Z
https://github.com/weidai11/cryptopp/issues/1088
1,059,744,221
1,088