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 * State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) Red Hat Enterprise Linux Server release 7.7 (Maipo) * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc) Master * State how you built the library (Makefile, Cmake, distro, etc) Building with CMake * Show a typical command line (the output of the compiler for cryptlib.cpp) `clang++ -std=c++17 -Og -ggdb -D_GLIBCXX_ASSERTIONS -fsanitize=address -DBOOST_USE_ASAN -fPIC -DCRYPTOPP_DISABLE_MIXED_ASM -MD -MT CMakeFiles/cryptopp-object.dir/eprecomp.cpp.o -MF CMakeFiles/cryptopp-object.dir/eprecomp.cpp.o.d -o CMakeFiles/cryptopp-object.dir/eprecomp.cpp.o -c /src/libs/CryptoPP/CryptoPP/eprecomp.cpp` `clang++ --version` `clang version 10.0.0` * Show the link command (the output of the linker for libcryptopp.so or cryptest.exe) N/A * Show the exact error message you are receiving (copy and paste it); or ``` src/libs/CryptoPP/CryptoPP/algparam.h:315:12: warning: 'uncaught_exception' is deprecated [-Wdeprecated-declarations] if (std::uncaught_exception() == false) ^ ``` * Clearly state the undesired behavior (and state the expected behavior) There is code in config_cxx.h that attempts to set the pre-processor symbol `CRYPTOPP_CXX17_EXCEPTIONS` for the various compilers. The section for clang looks like this: ``` #if defined(__clang__) # if __EXCEPTIONS && __has_feature(cxx_exceptions) # if __cpp_lib_uncaught_exceptions # define CRYPTOPP_CXX17_EXCEPTIONS 1 # endif ... ``` Unfortunately, `__cpp_lib_uncaught_exceptions` is only guaranteed to be defined if the header `<exception>` has been included, so `CRYPTOPP_CXX17_EXCEPTIONS ` is not being set (even though clang 10 does support this) - unless the source file happens to include `<exception>` before it includes `<config.h>`.
Failure to set CRYPTOPP_CXX17_EXCEPTIONS with clang
https://api.github.com/repos/weidai11/cryptopp/issues/960/comments
7
2020-07-21T10:55:46Z
2020-09-09T04:43:01Z
https://github.com/weidai11/cryptopp/issues/960
662,878,786
960
[ "weidai11", "cryptopp" ]
I tested ecies decrypt api 10000 times, Cryptopp(c++) takes about 10s, Bouncy Castle(java) takes about 3s, eciespy(python) takes about 3s I tested RSA decrypt api 10000 times, Cryptopp takes about 10s, Bouncy Castle takes about 10s Does the decrypt api of ecies can be optimized?
When using ECIES to decrypt, cryptopp takes longer to calculate than Bouncy Castle
https://api.github.com/repos/weidai11/cryptopp/issues/959/comments
1
2020-07-18T08:54:41Z
2020-07-18T16:22:27Z
https://github.com/weidai11/cryptopp/issues/959
660,017,751
959
[ "weidai11", "cryptopp" ]
Sample code: ``` std::string EncodeDesString(std::string plain) { BYTE desKey[] = { ... }; ECB_Mode<DES>::Encryption e; e.SetKey((const unsigned char *)desKey, DES::KEYLENGTH); std::string cipher; try { StringSource ss(plain, true, new CryptoPP::StreamTransformationFilter(e, new HexEncoder(new CryptoPP::StringSink(cipher), false), BlockPaddingSchemeDef::ZEROS_PADDING) ); } catch (const CryptoPP::Exception& e) { cipher.clear(); } return cipher; } std::string DecodeDesString(std::string cipher) { BYTE desKey[] = { ... }; ECB_Mode<DES>::Decryption d; d.SetKey((const unsigned char *)desKey, DES::KEYLENGTH); std::string plain; try { StringSource ss(cipher, true, new HexDecoder(new CryptoPP::StreamTransformationFilter(d, new CryptoPP::StringSink(plain), BlockPaddingSchemeDef::ZEROS_PADDING)) ); } catch (const CryptoPP::Exception& e) { plain.clear(); } return plain; } ``` ``` std::string test = "你好hi"; std::string cipher = EncodeDesString(test); std::string plain = DecodeDesString(cipher); qDebug() << test.size() << plain.size() << plain == test; bool x = plain == test; ``` Output:6 8 false VS2015 MD build with #include "dll.h" in my project. Test version:700 820
des enncode and decode is not equal
https://api.github.com/repos/weidai11/cryptopp/issues/958/comments
2
2020-07-11T07:06:45Z
2020-07-16T12:59:34Z
https://github.com/weidai11/cryptopp/issues/958
655,152,791
958
[ "weidai11", "cryptopp" ]
Hi, guys having a problem when cross-compiling for WindowsStore (UWP) ARM64. The compiler shows the error shown below. Even if I create an empty file, which only includes the `pch.h` and the `arm_simd.h` files - it fails. I tried moving the `VEXT_U8` function from the `arm_simd.h` to the empty source file (this time without including `arm_simd.h`) it also fails with the exact same error. Here is my computer info Windows 10 Enterprise 1909 Crypto++ 8.2.0 Visual Studio 2019 WinSDK 10.0.18362.0 The error message ``` 2>C:\.conan\2b5915\1\cryptopp-CRYPTOPP_8_2_0\arm_simd.h(155,1): error C2057: expected constant expression 2>C:\.conan\2b5915\1\cryptopp-CRYPTOPP_8_2_0\arm_simd.h(155,1): error C2057: vreinterpretq_u8_u64(a), vreinterpretq_u8_u64(b), c); 2>C:\.conan\2b5915\1\cryptopp-CRYPTOPP_8_2_0\arm_simd.h(155,1): error C2057: ^ ``` The list of project preprocessor definitions ``` _DEBUG _WINDOWS USE_PRECOMPILED_HEADERS WIN32 _WIN32_WINNT=0xA00 _WIN32_IE=0x0A00 WINAPI_FAMILY=WINAPI_FAMILY_APP __WRL_NO_DEFAULT_LIB__ _VC80_UPGRADE=0x0710 _ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 %(ClCompile.PreprocessorDefinitions) ```
[arm_simd.h] Failed to cross-compile from x64 to ARM64
https://api.github.com/repos/weidai11/cryptopp/issues/955/comments
2
2020-06-19T07:02:37Z
2021-02-03T18:19:43Z
https://github.com/weidai11/cryptopp/issues/955
641,754,356
955
[ "weidai11", "cryptopp" ]
The code below is essentially the same as the example at https://www.cryptopp.com/wiki/GCM_Mode#AEAD except that the tag size is configurable using a compiler define. The following anomalies were observed with fuzz testing: - Compile with ```-DTAG_SIZE=32``` to observe that encryption succeeds, but subsequent decryption does not - Compile with ```-DTAG_SIZE=200``` to observe out-of-bounds reads (use Valgrind or AddressSanitizer) ```cpp #include <cassert> #include <gcm.h> #include <aes.h> #include <iostream> #include <filters.h> using namespace std; using namespace CryptoPP; int main(void) { byte key[32]; memset( key, 0, sizeof(key) ); byte iv[12]; memset( iv, 0, sizeof(iv) ); string adata( 16, (char)0x00 ); string pdata( 16, (char)0x00 ); // Encrypted, with Tag string cipher, encoded; // Recovered (decrypted) string radata, rpdata; /*********************************\ \*********************************/ try { GCM< AES >::Encryption e; e.SetKeyWithIV( key, sizeof(key), iv, sizeof(iv) ); // AuthenticatedEncryptionFilter defines two // channels: DEFAULT_CHANNEL and AAD_CHANNEL // DEFAULT_CHANNEL is encrypted and authenticated // AAD_CHANNEL is authenticated AuthenticatedEncryptionFilter ef( e, new StringSink( cipher ), false, TAG_SIZE /* MAC_AT_END */ ); // AuthenticatedEncryptionFilter // Authenticated data *must* be pushed before // Confidential/Authenticated data. Otherwise // we must catch the BadState exception ef.ChannelPut( AAD_CHANNEL, (const unsigned char*)adata.data(), adata.size() ); ef.ChannelMessageEnd(AAD_CHANNEL); // Confidential data comes after authenticated data. // This is a limitation due to CCM mode, not GCM mode. ef.ChannelPut( DEFAULT_CHANNEL, (const unsigned char*)pdata.data(), pdata.size() ); ef.ChannelMessageEnd(DEFAULT_CHANNEL); printf("Encryption succeeded\n"); } catch( CryptoPP::Exception& e ) { cerr << "Caught Exception..." << endl; cerr << e.what() << endl; cerr << endl; return 0; } try { GCM< AES >::Decryption d; d.SetKeyWithIV( key, sizeof(key), iv, sizeof(iv) ); // Break the cipher text out into it's // components: Encrypted and MAC string enc = cipher.substr( 0, cipher.length()-TAG_SIZE ); string mac = cipher.substr( cipher.length()-TAG_SIZE ); // Sanity checks assert( cipher.size() == enc.size() + mac.size() ); assert( enc.size() == pdata.size() ); assert( TAG_SIZE == mac.size() ); // Not recovered - sent via clear channel radata = adata; // Object *will* throw an exception // during decryption\verification _if_ // verification fails. AuthenticatedDecryptionFilter df( d, NULL, AuthenticatedDecryptionFilter::MAC_AT_BEGIN | AuthenticatedDecryptionFilter::THROW_EXCEPTION, TAG_SIZE ); // The order of the following calls are important df.ChannelPut( DEFAULT_CHANNEL, (const unsigned char*)mac.data(), mac.size() ); df.ChannelPut( AAD_CHANNEL, (const unsigned char*)adata.data(), adata.size() ); df.ChannelPut( DEFAULT_CHANNEL, (const unsigned char*)enc.data(), enc.size() ); // If the object throws, it will most likely occur // during ChannelMessageEnd() df.ChannelMessageEnd( AAD_CHANNEL ); df.ChannelMessageEnd( DEFAULT_CHANNEL ); // If the object does not throw, here's the only // opportunity to check the data's integrity bool b = false; b = df.GetLastResult(); assert( true == b ); // Remove data from channel string retrieved; size_t n = (size_t)-1; // Plain text recovered from enc.data() df.SetRetrievalChannel( DEFAULT_CHANNEL ); n = (size_t)df.MaxRetrievable(); retrieved.resize( n ); if( n > 0 ) { df.Get( (byte*)retrieved.data(), n ); } rpdata = retrieved; assert( rpdata == pdata ); // All is well - work with data cout << "Decrypted and Verified data. Ready for use." << endl; cout << endl; cout << "adata length: " << adata.size() << endl; cout << "pdata length: " << pdata.size() << endl; cout << endl; cout << "recovered adata length: " << radata.size() << endl; cout << "recovered pdata length: " << rpdata.size() << endl; cout << endl; } catch( CryptoPP::Exception& e ) { cerr << "Caught Exception..." << endl; cerr << e.what() << endl; cerr << endl; return 0; } return 0; } ```
AES GCM encryption with large tag size results in incorrect output, out-of-bounds reads
https://api.github.com/repos/weidai11/cryptopp/issues/954/comments
2
2020-06-08T11:48:38Z
2020-12-20T00:53:20Z
https://github.com/weidai11/cryptopp/issues/954
634,540,201
954
[ "weidai11", "cryptopp" ]
VectorSource and/or VectorSink cannot compile when passed a vector that takes a custom allocator. In my case I have a codebase that uses a secure allocator for all sensitive information and have to re-implement parts of the cryptopp codebase due to VectorSource/VectorSink not taking an allocator. VectorSink is just a typedef so this is easily worked around in user code by just using `CryptoPP::StringSinkTemplate<MyType>` VectorSource is an actual class (though quite a simple one) so has to be 'duplicated' into my codebase e.g.: ``` template <typename T> class CryptoVectorSource : public CryptoPP::SourceTemplate<CryptoPP::StringStore> { public: CryptoVectorSource(BufferedTransformation *attachment = NULLPTR) : SourceTemplate<CryptoPP::StringStore>(attachment) {} CryptoVectorSource(const T &vec, bool pumpAll, BufferedTransformation *attachment = NULLPTR) : SourceTemplate<CryptoPP::StringStore>(attachment) {SourceInitialize(pumpAll, MakeParameters("InputBuffer", CryptoPP::ConstByteArrayParameter(vec)));} }; ``` This is not ideal, because I then have to check that this doesn't break for every library upgrade. It would be preferable if VectorSource were just templated inside cryptopp itself such that it can take any allocator. It would also be nice (but not as important) if VectorSink could do the same.
Custom allocators for VectorSink/VectorSource
https://api.github.com/repos/weidai11/cryptopp/issues/953/comments
2
2020-06-08T10:56:17Z
2020-07-13T12:20:31Z
https://github.com/weidai11/cryptopp/issues/953
634,507,505
953
[ "weidai11", "cryptopp" ]
I use Crypto++ to calculate HMAC-SHA256 signature. My code is similar to this one: ```cpp #include <string> #include <string_view> #include <cryptopp/filters.h> using CryptoPP::StringSink; using CryptoPP::StringSource; using CryptoPP::HashFilter; #include <cryptopp/hmac.h> using CryptoPP::HMAC; #include <cryptopp/sha.h> using CryptoPP::SHA256; std::string CalcHmacSHA256(std::string_view decodedSecretKey, std::string_view request) { // Calculate HMAC HMAC<SHA256> hmac(reinterpret_cast<CryptoPP::byte const*>(decodedSecretKey.data()), decodedSecretKey.size()); std::string calculated_hmac; auto sink = std::make_unique<StringSink>(calculated_hmac); auto filter = std::make_unique<HashFilter>(hmac, sink.get()); sink.release(); StringSource(reinterpret_cast<CryptoPP::byte const*>(request.data()), request.size(), true, filter.get()); // StringSource filter.release(); return calculated_hmac; } ``` In addition to code above I use Base 64 encoder/decoder from `cryptopp/base64.h` header file. I'd like to add your library to my solution as a subproject (static library) and keep only header and source files that are related to HMAC calculation. I keep original files. The only thing I change is Visual Studio project file. After few hours of investigation I've got following list of files that I'm not sure they have to be in the project. While from my point of view I do not need those files, I'm not able to compile project without adding those files because of "Unresolved symbol" linker errors. Could you take a look to verify, is there some unnecessary dependency introduced? I'm not good in cryptography, but why do I need keccak or des? ``` asn.cpp des.cpp dessp.cpp ec2n.cpp ecp.cpp eprecomp.cpp fips140.cpp fipsalgt.cpp hex.cpp keccak.cpp keccak_core.cpp keccak_simd.cpp modes.cpp neon_simd.cpp oaep.cpp osrng.cpp pkcspad.cpp pssr.cpp rijndael.cpp rijndael_simd.cpp rng.cpp rsa.cpp sha3.cpp sse_simd.cpp strciphr.cpp ```
Header and source files dependencies
https://api.github.com/repos/weidai11/cryptopp/issues/951/comments
2
2020-06-02T00:49:16Z
2020-12-17T19:38:35Z
https://github.com/weidai11/cryptopp/issues/951
628,820,089
951
[ "weidai11", "cryptopp" ]
Please, see https://github.com/cryfs/cryfs/issues/345
Can't compile on Android due to wrong evaluation of CRC support
https://api.github.com/repos/weidai11/cryptopp/issues/950/comments
24
2020-05-21T22:05:42Z
2021-06-11T13:25:51Z
https://github.com/weidai11/cryptopp/issues/950
622,819,469
950
[ "weidai11", "cryptopp" ]
- Cryptopp version 8.2.0 release version downloaded from github release - MAC OS: Catalina Version 10.15.4 Following the exact steps from documentation but end up having errors ![image](https://user-images.githubusercontent.com/57748006/81280753-8554c300-908b-11ea-8384-aaa56cb9911e.png) ![image](https://user-images.githubusercontent.com/57748006/81280876-b3d29e00-908b-11ea-814d-0e0c7ff6715f.png) and finally `fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *** [integer.o] Error 1`
Problem building cryptopp library for IOS
https://api.github.com/repos/weidai11/cryptopp/issues/948/comments
2
2020-05-07T09:57:33Z
2021-02-03T18:28:19Z
https://github.com/weidai11/cryptopp/issues/948
613,927,427
948
[ "weidai11", "cryptopp" ]
```cpp #include <seckey.h> #include <siphash.h> int main(void) { const uint8_t key[3] = { 0 }; ::CryptoPP::SipHash<2, 4, false> siphash(key, sizeof(key)); return 0; } ``` I think it would be more appropriate to throw an exception in this case?
Undersized SipHash key leads to buffer out-of-bounds read
https://api.github.com/repos/weidai11/cryptopp/issues/947/comments
2
2020-05-04T16:21:45Z
2020-12-20T00:55:37Z
https://github.com/weidai11/cryptopp/issues/947
612,001,592
947
[ "weidai11", "cryptopp" ]
The use of `std::uncaught_exception` has been deprecated in favour of `std::uncaught_exceptions` (note extra 's'). https://en.cppreference.com/w/cpp/error/uncaught_exception I can do a quick PR for this. I guess it would need to switch based on the C++ language version (17 and later using the new API). I've not looked at the code yet, just seen the deprecation warnings, but I assume this is going to be a rather straight forward fix.
Use of uncaught_exception
https://api.github.com/repos/weidai11/cryptopp/issues/946/comments
3
2020-04-26T06:21:54Z
2020-04-28T07:47:33Z
https://github.com/weidai11/cryptopp/issues/946
606,932,141
946
[ "weidai11", "cryptopp" ]
Reproducer: ```cpp #include <modes.h> #include <filters.h> #include <speck.h> #define CF_CHECK_EQ(expr, res) if ( (expr) != (res) ) { goto end; } std::vector<uint8_t> Encrypt(const std::vector<uint8_t>& key, const std::vector<uint8_t>& iv, const std::vector<std::vector<uint8_t>>& cleartext) { ::CryptoPP::OFB_Mode<::CryptoPP::SPECK64>::Encryption enc(key.data(), key.size(), iv.data()); ::CryptoPP::StreamTransformationFilter encryptor(enc, nullptr); for (const auto& part : cleartext) { encryptor.Put(part.data(), part.size()); } encryptor.MessageEnd(); std::vector<uint8_t> out(encryptor.MaxRetrievable()); encryptor.Get(out.data(), out.size()); return out; } std::vector<uint8_t> Decrypt(const std::vector<uint8_t>& key, const std::vector<uint8_t>& iv, const std::vector<uint8_t>& ciphertext) { ::CryptoPP::OFB_Mode<::CryptoPP::SPECK64>::Decryption dec(key.data(), key.size(), iv.data()); ::CryptoPP::StreamTransformationFilter decryptor(dec, nullptr); decryptor.Put(ciphertext.data(), ciphertext.size()); decryptor.MessageEnd(); std::vector<uint8_t> out(decryptor.MaxRetrievable()); decryptor.Get(out.data(), out.size()); return out; } int main(void) { const std::vector<std::vector<uint8_t>> cleartext{ #if !defined(CHUNKED) {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} #else {0x00}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, {0x00, 0x00, 0x00, 0x00, 0x00}, {0x00}, {0x00}, #endif }; const std::vector<uint8_t> key(16); const std::vector<uint8_t> iv(8); const auto ciphertext = Encrypt(key, iv, cleartext); const auto cleartext2 = Decrypt(key, iv, ciphertext); for (size_t i = 0; i < cleartext2.size(); i++) { printf("%02X ", cleartext2[i]); } printf("\n"); end: return 0; } ``` Compile this with and without ```-DCHUNKED```. Both should output: ``` 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ``` But when compiled with ```-DCHUNKED```, it outputs: ``` 00 00 00 00 00 00 00 00 BD DD D9 80 6A 84 CF 2A ``` Tested on Linux x64, Crypto++ recent master branch.
SPECK64 different output if input is passed in chunks
https://api.github.com/repos/weidai11/cryptopp/issues/945/comments
8
2020-04-22T23:12:05Z
2020-12-20T00:55:52Z
https://github.com/weidai11/cryptopp/issues/945
605,130,480
945
[ "weidai11", "cryptopp" ]
The executive summary is: * Ubuntu 18.04 * Current master from test fork * Autoconf ./configure --prefix='/home/sjmunroe/work/test/install' CFLAGS='-m64 -O3 -g0 -mcpu=power9' CXXFLAGS='-m64 -O3 -g0 -mcpu=power9' CPPFLAGS="-DNDEBUG" LDFLAGS='-m64 -Wl,-q' make The build configure is NOT cleanly propagating the -mcpu, For example: ``` /bin/bash ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -DNDEBUG -pipe **-mcpu=power8** -m64 -O3 -g0 **-mcpu=power9** -MT libblake2b_simd_la-blake2b_simd.lo -MD -MP -MF .deps/libblake2b_simd_la-blake2b_simd.Tpo -c -o libblake2b_simd_la-blake2b_simd.lo `test -f 'blake2b_simd.cpp' || echo './'`blake2b_simd.cpp libtool: compile: g++ -DHAVE_CONFIG_H -I. -DNDEBUG -pipe -mcpu=power8 -m64 -O3 -g0 -mcpu=power9 -MT libblake2b_simd_la-blake2b_simd.lo -MD -MP -MF .deps/libblake2b_simd_la-blake2b_simd.Tpo -c blake2b_simd.cpp -fPIC -DPIC -o .libs/libblake2b_simd_la-blake2b_simd.o ``` Which results in compiler errors: ``` In file included from blake2s_simd.cpp:68:0: ppc_simd.h: In function ‘CryptoPP::uint32x4_p CryptoPP::VecLoadBE(const byte*)’: ppc_simd.h:709:24: error: ‘vec_xl_be’ was not declared in this scope return (uint32x4_p)vec_xl_be(0, CONST_V8_CAST(src)); ^~~~~~~~~ ppc_simd.h:709:24: note: suggested alternative: ‘vec_xl_len’ return (uint32x4_p)vec_xl_be(0, CONST_V8_CAST(src)); ^~~~~~~~~ vec_xl_len ppc_simd.h: In function ‘CryptoPP::uint32x4_p CryptoPP::VecLoadBE(int, const byte*)’: ppc_simd.h:743:24: error: ‘vec_xl_be’ was not declared in this scope return (uint32x4_p)vec_xl_be(off, CONST_V8_CAST(src)); ^~~~~~~~~ ppc_simd.h:743:24: note: suggested alternative: ‘vec_xl_len’ return (uint32x4_p)vec_xl_be(off, CONST_V8_CAST(src)); ^~~~~~~~~ vec_xl_len ``` I should be able to compile specifically for power9.
Problems builing Crypto++ for POWER9
https://api.github.com/repos/weidai11/cryptopp/issues/944/comments
3
2020-04-21T00:11:50Z
2020-06-04T01:09:32Z
https://github.com/weidai11/cryptopp/issues/944
603,614,013
944
[ "weidai11", "cryptopp" ]
Debian reports self test failures for K233 on Power8. We can also duplicate it on GCC111 with XL C++ compiler. This appears to be related to polynomial multiply code. ``` Testing SEC 2 EC2N curves... passed 163 bits passed 163 bits passed 239 bits passed 113 bits passed 113 bits passed 163 bits passed 283 bits passed 283 bits passed 131 bits passed 131 bits passed 193 bits passed 193 bits FAILED 233 bits FAILED 233 bits passed 409 bits passed 409 bits passed 571 bits passed 571 bits ```
K233 failure on Power8
https://api.github.com/repos/weidai11/cryptopp/issues/943/comments
0
2020-04-10T18:44:30Z
2020-04-10T18:44:30Z
https://github.com/weidai11/cryptopp/issues/943
598,035,201
943
[ "weidai11", "cryptopp" ]
[Cirrus CI](https://cirrus-ci.org/) provides FreeBSD images for testing. This report will track the addition of Cirrus CI integration. The BSDs have a personality distinct from Linux. To date our testing is manual. On occasion we fire up our DragonFly, FreeBSD, NetBSD and OpenBSD virtual machines and test a build. It would be prudent to add some coverage for the BSDs. There are still differences among DragonFly, FreeBSD, NetBSD and OpenBSD, but at least we can have some coverage. ----- To use the Cirrus CI testing, go to GitHub marketplace, search for Cirrus, sign up for the free account, and enable GitHub integration. After enabling Cirrus, you may need to revisit Travis, open its settings, and save the Travis settings. Nothing changes on Travis. Travis just needs to be re-saved to ensure Travis continues to operate as expected.
Add Cirrus CI testing
https://api.github.com/repos/weidai11/cryptopp/issues/940/comments
1
2020-03-24T18:00:22Z
2020-12-20T00:56:10Z
https://github.com/weidai11/cryptopp/issues/940
587,169,851
940
[ "weidai11", "cryptopp" ]
As per 5.6.4 version Crypto++ supported CMake, however, in the current version CMakeLists.txt is not available. CMake is an industry standard, and most of build systems use it. The most excluding it affects solutions which attempt to upgrade to a newer version of Crypto++, causing deadlines delay and forcing to use older, potentially vulnerable versions of the library.
CMake-based build toolchain
https://api.github.com/repos/weidai11/cryptopp/issues/939/comments
2
2020-03-18T13:49:10Z
2024-03-28T22:04:53Z
https://github.com/weidai11/cryptopp/issues/939
583,741,981
939
[ "weidai11", "cryptopp" ]
Our scripts to build Android and iOS are stale. We need to update them. This issue report will track the changes.
Update Android and iOS builds
https://api.github.com/repos/weidai11/cryptopp/issues/936/comments
0
2020-03-09T13:56:11Z
2020-12-20T00:56:30Z
https://github.com/weidai11/cryptopp/issues/936
577,927,588
936
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report * The operating system and version (Centos7 x86_64, Windows 10 Professional x64, etc) * The version of the Crypto++ library (The latest Crypto++ 8.20) * How you built the library (Makefile, Cmake, Visual Studio 2017) I'd like to use Crypto++ in my project. And there will be two output related to Crypto++ in my project, one is static library (lib) and another is binary (exe). Both of the lib and the exe will reference Crypto++ functions. So, is there any document or link on how to create a new project (visual studio 2017 and Linux, need to cross platform) to reference the Crypto++ functions? I tried it myself and meet the error below: ![image](https://user-images.githubusercontent.com/8639363/75606421-81567300-5b27-11ea-8b5e-9856f76b5386.png) It seems that the Crypto++ project is different with other Visual project. Is there any useful suggestions or link for me?
Is there any document on how to use Crypto++ library ?
https://api.github.com/repos/weidai11/cryptopp/issues/935/comments
2
2020-02-29T11:15:23Z
2021-02-03T18:29:07Z
https://github.com/weidai11/cryptopp/issues/935
573,275,970
935
[ "weidai11", "cryptopp" ]
I am compiling CryptoPP with 3rd party library. And, it happens to have macro Divide, that is defined in CryptoPP as well. Fortunately, one had 4 parameters, other 5, and failing compile. Otherwise I would die to find what is wrong - code would compile but use wrong macro from another library. I have non-trivial imports of CryptoPP and 3rd party libraries, in h and cpp files. Though I managed to make it working, it is not trivial. Undefining macro from one library makes it not working for another, macros override each other etc. It is a BIG MESS, requiring unnecessary imports in one places and reordering of imports in another. I think it is not possible to make working in more complex cases. So... CryptoPP do use namespace CryptoPP to insulate from name conflicts. There are no namespaces for macros. Macros from all libraries are sharing same namespace. Direct answer to macros name conflict - prepend CryptoPP macro names with prefix, like "CryptoPP_". That will work similar to namespace for classes/functions etc. I can submit a PR, if you want. Changes are trivial.
Macro name conflict with 3rd party library
https://api.github.com/repos/weidai11/cryptopp/issues/934/comments
2
2020-02-28T16:53:47Z
2020-03-02T00:40:13Z
https://github.com/weidai11/cryptopp/issues/934
572,873,607
934
[ "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 at Stack Overflow. We may not be able to answer your question. There is a wiki page with information on filing useful bug reports. If you have some time please visit http://www.cryptopp.com/wiki/Bug_Report on the wiki. The executive summary is: * State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) iOS (Simulator) * State the version of the Crypto++ library (Crypto++ 7.0, Master, etc) master - https://github.com/weidai11/cryptopp/tree/5d688500414f138491f2ae0d298f9378656fde3c * State how you built the library (Makefile, Cmake, distro, etc) Cmake - https://github.com/noloader/cryptopp-cmake * Show a typical command line (the output of the compiler for cryptlib.cpp) * Show the link command (the output of the linker for libcryptopp.so or cryptest.exe) * Show the exact error message you are receiving (copy and paste it); or > /Users/tom/workspace/OpenDocument.ios/build/_deps/cryptopp-src/sm4_simd.cpp:246:13: error: always_inline function '_mm_aesenclast_si128' requires target feature 'aes', but would be inlined into function 'SM4_Encrypt' that is compiled without support for 'aes' <img width="1552" alt="Screenshot 2020-02-23 at 10 09 51" src="https://user-images.githubusercontent.com/128734/75109556-b5f89500-5624-11ea-9a00-3e27de5e17ca.png"> * Clearly state the undesired behavior (and state the expected behavior) I'm trying to build cryptopp on iOS using Cmake. It worked fine previously using this commit: https://github.com/weidai11/cryptopp/tree/6b1dd5f66d5aff84c303f0267bd201fb4c5c4176
Build fails for iOS
https://api.github.com/repos/weidai11/cryptopp/issues/933/comments
5
2020-02-23T09:36:32Z
2021-02-03T18:29:24Z
https://github.com/weidai11/cryptopp/issues/933
569,467,944
933
[ "weidai11", "cryptopp" ]
Hello, i am new to cryptopp and currently getting familiar with the lib. I am testing with the speck cipher and want to reproduce the example from the wiki shown here: https://www.cryptopp.com/wiki/SPECK I am refering to the following lines on the wiki: Key: F36D4289293A07A0C1E3D8EAFBF83C6F IV: 50650B834D62457D3D5CBFE9708EC927 plain text: CBC Mode Test Cipher text: 952FB25AF03C17F972BEB9357AA48719 recovered text: CBC Mode Test I started implementing with the code shown in the wiki and wanted to repoduce the test vector shown above. So see my example program: CryptoPP::AutoSeededRandomPool prng; //CryptoPP::SecByteBlock key(CryptoPP::SPECK128::DEFAULT_KEYLENGTH); //prng.GenerateBlock(key, key.size()); const string ivstr = "50650B834D62457D3D5CBFE9708EC927"; string ivdecoded; CryptoPP::StringSource ss(ivstr, true, new CryptoPP::HexDecoder( new CryptoPP::StringSink(ivdecoded) ) ); CryptoPP::SecByteBlock iv(reinterpret_cast<const CryptoPP::byte*>(&ivdecoded[0]), ivdecoded.size()); const string k = "F36D4289293A07A0C1E3D8EAFBF83C6F"; string decoded; CryptoPP::StringSource ss2(k, true, new CryptoPP::HexDecoder( new CryptoPP::StringSink(decoded) ) // HexDecoder ); // StringSource CryptoPP::SecByteBlock key(reinterpret_cast<const CryptoPP::byte*>(&decoded[0]), decoded.size()); std::cout << "Key: "; CryptoPP::StringSource(key, key.size(), true, new CryptoPP::HexEncoder(new CryptoPP::FileSink(std::cout))); std::cout << std::endl; std::cout << "IV: "; CryptoPP::StringSource(iv, sizeof(iv), true, new CryptoPP::HexEncoder(new CryptoPP::FileSink(std::cout))); std::cout << std::endl; string plain = "CBC Mode Test"; string cipher, encoded, recovered; /*********************************\ \*********************************/ try { std::cout << "plain text: " << plain << std::endl; CryptoPP::CBC_Mode<CryptoPP::SPECK128 >::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. CryptoPP::StringSource(plain, true, new CryptoPP::StreamTransformationFilter(e, new CryptoPP::StringSink(cipher), CryptoPP::BlockPaddingSchemeDef::DEFAULT_PADDING) // StreamTransformationFilter ); // StringSource } catch (const CryptoPP::Exception & e) { std::cerr << e.what() << std::endl; //exit(1); } /*********************************\ \*********************************/ // Pretty print std::cout << "Cipher text: "; CryptoPP::StringSource(cipher, true, new CryptoPP::HexEncoder(new CryptoPP::FileSink(std::cout))); std::cout << std::endl; /*********************************\ \*********************************/ try { CryptoPP::CBC_Mode<CryptoPP::SPECK128 >::Decryption d; d.SetKeyWithIV(key, key.size(), iv); // The StreamTransformationFilter removes // padding as required. CryptoPP::StringSource s(cipher, true, new CryptoPP::StreamTransformationFilter(d, new CryptoPP::StringSink(recovered), CryptoPP::BlockPaddingSchemeDef::DEFAULT_PADDING ) // StreamTransformationFilter ); // StringSource std::cout << "recovered text: " << recovered << std::endl; } catch (const CryptoPP::Exception & e) { cerr << e.what() << std::endl; //exit(1); } As a summary what my program does: I am using a fixed IV and key (with the values from the wiki) instead of randomly generated values. My expectation is, that the program produces as cipher text "952FB25AF03C17F972BEB9357AA48719" (value from the wiki). But it generetes the following cipher text instead: "D3937748C4A9D3B215E930F41C6AD76B" which differs from the value of the wiki. In my opinion there is an error in my implementation or the test vector is wrong. May be someone can help? OS: Windows 10 x64 with VS 2019 Crypto++ library: 8.2 Release from the website
Speck implemententation not matching test vector from wiki
https://api.github.com/repos/weidai11/cryptopp/issues/932/comments
4
2020-02-09T15:59:11Z
2020-12-20T00:57:51Z
https://github.com/weidai11/cryptopp/issues/932
562,197,861
932
[ "weidai11", "cryptopp" ]
Details here: https://github.com/Entware/Entware/issues/412 Any help would be welcome!
Illegal instruction in CryptoPP::CPU_ProbeARMv7() under armv5tel architecture
https://api.github.com/repos/weidai11/cryptopp/issues/931/comments
2
2020-02-09T14:49:45Z
2020-02-09T15:17:01Z
https://github.com/weidai11/cryptopp/issues/931
562,187,743
931
[ "weidai11", "cryptopp" ]
Wiki documentation error in 8.2.0. [GCM Mode](https://www.cryptopp.com/wiki/GCM_Mode) states: ``` byte iv[ AES::BLOCKSIZE * 16 ]; ``` Should be: ``` byte iv[ AES::BLOCKSIZE ]; ``` This apparent typo confused me since the referenced zip file is also different in several ways and uses the number 12. Note `AES::BLOCKSIZE` is 16, which could work. However, `16*16` bytes is more than the desired 96, or 128 bits.
GCM wiki documentation error/inconsistency with regard to: iv size in bytes.
https://api.github.com/repos/weidai11/cryptopp/issues/930/comments
4
2020-02-07T23:30:35Z
2020-02-11T18:42:14Z
https://github.com/weidai11/cryptopp/issues/930
561,923,612
930
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report * OS: + Host: Xubuntu: Linux 5.3.0-26-generic #28~18.04.1-Ubuntu SMP Wed Dec 18 16:40:14 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux + Target: Android 24, NDK 21.0.6113669 * Crypto++ 8.2.0 * Build script based on setenv-android.sh: [build_crypto++_android.sh](https://github.com/weidai11/cryptopp/files/4122880/build_crypto%2B%2B_android.sh.txt) * Error: ``` armv7a-linux-androideabi24-clang++ -DNDEBUG -g2 -O3 -fPIC -pipe -Wall -march=armv7-a -mthumb -mfloat-abi=softfp -funwind-tables -fexceptions -frtti -DANDROID --sysroot=/home/paul/Android/Sdk/ndk/21.0.6113669//toolchains/llvm/prebuilt/linux-x86_64//sysroot -Wa,--noexecstack -I -I -fpermissive -c cpu-features.c clang++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] cpu-features.c:222:13: error: assigning to 'const char *' from incompatible type 'void *' p = memmem(p, bufend-p, field, fieldlen); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cpu-features.c:234:10: error: assigning to 'const char *' from incompatible type 'const void *' p = memchr(p, ':', bufend-p); ^~~~~~~~~~~~~~~~~~~~~~~~ cpu-features.c:240:9: error: assigning to 'const char *' from incompatible type 'const void *' q = memchr(p, '\n', bufend-p); ^~~~~~~~~~~~~~~~~~~~~~~~~ cpu-features.c:246:14: error: assigning to 'char *' from incompatible type 'void *' result = malloc(len+1); ^~~~~~~~~~~~~ cpu-features.c:399:13: error: assigning to 'const char *' from incompatible type 'const void *' q = memchr(p, ',', end-p); ^~~~~~~~~~~~~~~~~~~~~ cpu-features.c:693:15: error: assigning to 'char *' from incompatible type 'void *' cpuinfo = malloc(cpuinfo_len); ``` * Fix: Changing compiler in GNUmakefile-cross from CXX to CC
error caused by cpu-features.c getting compiled with CXX
https://api.github.com/repos/weidai11/cryptopp/issues/926/comments
1
2020-01-28T14:38:28Z
2020-02-08T16:47:32Z
https://github.com/weidai11/cryptopp/issues/926
556,252,766
926
[ "weidai11", "cryptopp" ]
AMD cpu's from family 15h and 16h fail to produce random numbers using RDRAND after a suspend/resume. While first reported in 2014, AMD did not diagnose and offer a patch until late 2019. Also see the following bug reports and patches. Kernel bug: * https://bugzilla.kernel.org/show_bug.cgi?id=85911 Systemd bug: * https://github.com/systemd/systemd/issues/11810 Fedora bug: * https://bugzilla.redhat.com/show_bug.cgi?id=1150286 AMD patch: * https://lore.kernel.org/patchwork/patch/1115413/ The AMD patch simply disables RDRAND for the 15h and 16h families. We need to do the same in case we are running on old Linux kernels or other operating systems.
Disable RDRAND and RDSEED on AMD cpu's with family 15h or 16h
https://api.github.com/repos/weidai11/cryptopp/issues/924/comments
1
2020-01-17T05:02:17Z
2020-12-20T00:58:49Z
https://github.com/weidai11/cryptopp/issues/924
551,200,630
924
[ "weidai11", "cryptopp" ]
I may have found some collisions in BLAKE2b-32 and they are listed below. **Data:0x13A50A7FCDCF49DFE5 Hash:0x12345678 Data:0x4B10E44FD2 Hash:0x1234567B Data:0xAAD63D4CF4 Hash:0x12345678 Data:0xF47560ED9C Hash:0x12345678**
BLAKE2b Collision
https://api.github.com/repos/weidai11/cryptopp/issues/923/comments
1
2020-01-15T05:37:58Z
2020-01-17T06:41:07Z
https://github.com/weidai11/cryptopp/issues/923
549,977,357
923
[ "weidai11", "cryptopp" ]
The readme mentions compatibility for Visual Studio 2003 - 2017. Yet the readme sports instructions for compiling MSVC 2003 - 2015. Moreover, the site (https://www.cryptopp.com/) mentions compatibility up to 2019. My immediate question is: Are the compilation instructions valid for 2017?
MSVC version documentation inconsistencies
https://api.github.com/repos/weidai11/cryptopp/issues/922/comments
1
2020-01-08T23:00:57Z
2020-01-09T01:47:26Z
https://github.com/weidai11/cryptopp/issues/922
547,152,469
922
[ "weidai11", "cryptopp" ]
Crypto++ 8.2 has a bug in its Blake2b implementation. The output digest values are the same whether a salt is used or not. I changed the test code in validat5.cpp:2149 to verify this. Passing in a salt doesn't have any effect on the output digest. I used the pyblake2 module to verify that the digest values should be different (of course). Let me know if you would like any more information on this.
Blake2b implementation: Salt has no effect and produces an incorrect digest.
https://api.github.com/repos/weidai11/cryptopp/issues/921/comments
2
2020-01-05T20:30:09Z
2020-01-10T05:28:50Z
https://github.com/weidai11/cryptopp/issues/921
545,463,092
921
[ "weidai11", "cryptopp" ]
Using Cryptopp 8.2, building with setenv-android-gcc.sh on android NDK r20 failed. Environment Ubuntu(WSL) Android SDK with NDK r20. Looks like the latest ndk changes directories, the setenv-android-gcc.sh is unable to set properly.
Build failed for android NDK r20
https://api.github.com/repos/weidai11/cryptopp/issues/920/comments
1
2020-01-04T12:19:49Z
2020-12-20T00:59:09Z
https://github.com/weidai11/cryptopp/issues/920
545,278,766
920
[ "weidai11", "cryptopp" ]
The Ethereum network recently went through a hardfork which allows users to call the Blake2b compression function `F` directly in their smart contracts (to offer better interoperability with ZCash network). See details of the EIP here, including a link to the specification of the function `F` in question: https://eips.ethereum.org/EIPS/eip-152 Currently all the clients are rolling their own implementation of function `F` because no libraries expose this one directly. We develop [KEVM](https://github.com/kframework/evm-semantics), a K implementation of the EVM, and rely on cryptopp for several other cryptographic primitives. For now, we will roll our own implementation of `F` as well, but this is a shame because it means that all the clients are not benefiting from having a single well-tested implementation of this function, even though the function already exists (for the most part). The function in question in this library is the following: https://github.com/weidai11/cryptopp/blob/90d957c09b6c19027ce96288c42e70fee32b3621/blake2.cpp#L717 One key difference is that the exposed `F` needed by Ethereum clients must be parametric in the number of rounds run, whereas the implementation here hardcodes 12 rounds. Is it possible to expose (in the header) an implementation of `F` which Ethereum clients can use (must be parametric in the number of rounds)? If people are agreeable to this, we can offer to make the implementation/PR ourselves and submit it here.
Expose Blake2b Compression function for Ethereum Clients
https://api.github.com/repos/weidai11/cryptopp/issues/917/comments
7
2019-12-05T19:03:38Z
2023-10-02T06:56:18Z
https://github.com/weidai11/cryptopp/issues/917
533,536,388
917
[ "weidai11", "cryptopp" ]
> I think the original Tiger hash had a padding bug. I think the authors fixed it in a revision. > > See [Tiger: A Fast New Cryptographic Hash Function](http://www.cs.technion.ac.il/~biham/Reports/Tiger/). And [Ross Anderson's homepage](https://www.cl.cam.ac.uk/~rja14/), where the two implementations are provided. > _Originally posted by @noloader in https://github.com/weidai11/cryptopp/issues/915#issuecomment-560031163_ No, that is not it. There seems to be a difference between compiling it with GCC and with Visual Studio. So, now every Tiger implementation (like CryptoPP) that compiles with Visual Studio gives a DIFFERENT hash back than the original authors claim. I contacted Eli Biham (one of the creators) and he simply said, "I do not use that compiler". Is there anyone here who has compiled with Visual Studio and gotten the correct hashes? Alternatively, is there anyone here who has compiled with GCC and gotten the correct hashes? This, so I can do a step-by-step comparison of the internal state to see where the compilers diverge. The fact that this has not worked properly since 1995 is just plain ridiculous!
Tiger official test vectors fail
https://api.github.com/repos/weidai11/cryptopp/issues/916/comments
1
2019-12-01T09:13:27Z
2019-12-14T00:29:51Z
https://github.com/weidai11/cryptopp/issues/916
530,698,913
916
[ "weidai11", "cryptopp" ]
OS = Windows 10 x64 Compiler = Visual Studio 2017 Version = CryptoPP v8.2.0 I created my own independent implementation for the Tiger hash on Windows with Visual Studio. Unfortunately, it fails some of the test vectors. I compiled and ran the ValidateTiger() function of CryptoPP v8.2.0 with some of the official test vectors and CryptoPP fails with the exact same hashes as my implementation. In fact, CryptoPP and my own implementation agree 100% of the time! I added this test to the ValidateTiger() function: `HashTestTuple("A...Za...z0...9", "\x8d\xce\xa6\x80\xa1\x75\x83\xee\x50\x2b\xa3\x8a\x3c\x36\x86\x51\x89\x0f\xfb\xcc\xdc\x49\xa8\xcc") ` CryptoPP and my implementation both return 8623ee15cec8cca7552b4dcbdf76133a34b837e10d7f22d8, but the creators of Tiger claim it should be 8dcea680a17583ee502ba38a3c368651890ffbccdc49a8cc Can someone who has compiled CryptoPP please try the above test?
Tiger official test vectors fail
https://api.github.com/repos/weidai11/cryptopp/issues/915/comments
2
2019-11-30T21:29:57Z
2019-12-01T09:05:25Z
https://github.com/weidai11/cryptopp/issues/915
530,632,481
915
[ "weidai11", "cryptopp" ]
I'm working on an embedded security device, and I have to remove all software-based pseudo-randomness generators. I have removed three so far: (1) The Intel Rdrand engine inside OpenSSL (2) The DBRG randomness generator built into OpenSSL (3) The simulator engine for the TPM2 chip There's only one software random number generator left, and it's inside the Linux kernel. I will look into removing this one at a later date. I have recently added libcryptopp to my project, and I see that it has a PRNG. Is it possible to use a compiler switch to to omit the PRNG? If not, I think this feature should be implemented.
Compiler flag to omit the PRNG
https://api.github.com/repos/weidai11/cryptopp/issues/914/comments
1
2019-11-20T11:55:11Z
2019-12-01T00:30:53Z
https://github.com/weidai11/cryptopp/issues/914
525,757,044
914
[ "weidai11", "cryptopp" ]
I'm working on a embedded Linux project, using "Buildroot" to put my operating system together along with packages. Buildroot comes with loads of packages already built-in, but it also gives you the option of adding in your own. I have added libcryptopp to my Buildroot. Before doing this, I searched the web to see if anyone had done it before, and all I could find was two incomplete sets of files. So I've put together my own. They're not perfect and I might tweak them in future, but here's what I've got so far: Config.in: ``` config BR2_PACKAGE_LIBCRYPTOPP bool "libcryptopp" help An advanced C++ encryption library (AES, Twofish, TripleDES) http://www.cryptopp.com/ ``` libcryptopp.mk: ``` ################################################################################ # # libcryptopp # ################################################################################ LIBCRYPTOPP_VERSION = 8.2.0 LIBCRYPTOPP_SOURCE = cryptopp$(subst .,,$(LIBCRYPTOPP_VERSION)).zip LIBCRYPTOPP_SITE = $(TOPDIR)/board/abc/xyz/distfiles LIBCRYPTOPP_SITE_METHOD = file LIBCRYPTOPP_INSTALL_STAGING = YES LIBCRYPTOPP_INSTALL_TARGET = NO LIBCRYPTOPP_INSTALL_HOST = NO LIBCRYPTOPP_DEPENDENCIES = LIBCRYPTOPP_PATCH_DIR = $(TOPDIR)/board/abc/xyz/patches/libcryptopp # Set the compiler flags for where to look for header files (.h), shared static libraries (.a), shared dynamic libraries (.so). # Use the "--sysroot" flag instead of -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib define LIBCRYPTOPP_EXTRACT_CMDS unzip $(DL_DIR)/libcryptopp/$(LIBCRYPTOPP_SOURCE) -d $(@D) endef define LIBCRYPTOPP_BUILD_CMDS $(TARGET_MAKE_ENV) $(MAKE1) static --file=GNUmakefile-cross -C $(@D) \ $(TARGET_CONFIGURE_OPTS) \ CXXFLAGS+=--sysroot=$(STAGING_DIR) \ LDFLAGS+=--sysroot=$(STAGING_DIR) \ CXXFLAGS+='-D__always_inline__=__unused__' # The above line is needed to suppress errors about inability to inline certain functions endef define LIBCRYPTOPP_INSTALL_STAGING_CMDS $(INSTALL) -D -m 0755 $(@D)/libcryptopp.a $(STAGING_DIR)/usr/lib/libcryptopp.a endef $(eval $(generic-package)) ```
Two files for Buildroot: Config.in, libcryptopp.mk
https://api.github.com/repos/weidai11/cryptopp/issues/913/comments
1
2019-11-19T13:05:59Z
2019-12-01T00:50:29Z
https://github.com/weidai11/cryptopp/issues/913
524,997,455
913
[ "weidai11", "cryptopp" ]
Looks like wiki is down. I get this: ``` Sorry! This site is experiencing technical difficulties. Try waiting a few minutes and reloading. (Cannot access the database) Backtrace: #0 /var/www/html/w/includes/libs/rdbms/loadbalancer/LoadBalancer.php(769): Wikimedia\Rdbms\LoadBalancer->reportConnectionError() #1 /var/www/html/w/includes/GlobalFunctions.php(2694): Wikimedia\Rdbms\LoadBalancer->getConnection(0, Array, false) #2 /var/www/html/w/includes/cache/localisation/LCStoreDB.php(54): wfGetDB(-1) #3 /var/www/html/w/includes/cache/localisation/LocalisationCache.php(410): LCStoreDB->get('en', 'deps') #4 /var/www/html/w/includes/cache/localisation/LocalisationCache.php(456): LocalisationCache->isExpired('en') #5 /var/www/html/w/includes/cache/localisation/LocalisationCache.php(375): LocalisationCache->initLanguage('en') #6 /var/www/html/w/includes/cache/localisation/LocalisationCache.php(294): LocalisationCache->loadSubitem('en', 'messages', 'title-invalid-e...') #7 /var/www/html/w/languages/Language.php(2655): LocalisationCache->getSubitem('en', 'messages', 'title-invalid-e...') #8 /var/www/html/w/includes/cache/MessageCache.php(979): Language->getMessage('title-invalid-e...') #9 /var/www/html/w/includes/cache/MessageCache.php(937): MessageCache->getMessageForLang(Object(LanguageEn), 'title-invalid-e...', false, Array) #10 /var/www/html/w/includes/cache/MessageCache.php(879): MessageCache->getMessageFromFallbackChain(Object(LanguageEn), 'title-invalid-e...', false) #11 /var/www/html/w/includes/Message.php(1299): MessageCache->get('title-invalid-e...', false, Object(LanguageEn)) #12 /var/www/html/w/includes/Message.php(851): Message->fetchMessage() #13 /var/www/html/w/includes/Message.php(943): Message->toString('text') #14 /var/www/html/w/includes/title/MalformedTitleException.php(49): Message->text() #15 /var/www/html/w/includes/title/MediaWikiTitleCodec.php(297): MalformedTitleException->__construct('title-invalid-e...', '') #16 /var/www/html/w/includes/Title.php(3752): MediaWikiTitleCodec->splitTitleString('', 0) #17 /var/www/html/w/includes/Title.php(377): Title->secureAndSplit() #18 /var/www/html/w/includes/MediaWiki.php(83): Title::newFromURL('') #19 /var/www/html/w/includes/MediaWiki.php(140): MediaWiki->parseTitle() #20 /var/www/html/w/includes/MediaWiki.php(776): MediaWiki->getTitle() #21 /var/www/html/w/includes/MediaWiki.php(517): MediaWiki->main() #22 /var/www/html/w/index.php(42): MediaWiki->run() #23 {main} ```
https://cryptopp.com/wiki/ fails to load
https://api.github.com/repos/weidai11/cryptopp/issues/911/comments
3
2019-11-05T06:46:48Z
2019-11-07T17:23:14Z
https://github.com/weidai11/cryptopp/issues/911
517,578,075
911
[ "weidai11", "cryptopp" ]
Does crypto++ provide an implementation of paillier encryption?
Does crypto++ provide an implementation of paillier encryption?
https://api.github.com/repos/weidai11/cryptopp/issues/906/comments
2
2019-10-25T05:29:54Z
2019-10-28T23:44:08Z
https://github.com/weidai11/cryptopp/issues/906
512,311,121
906
[ "weidai11", "cryptopp" ]
Add XTS block cipher mode of operation
Add XTS block cipher mode of operation
https://api.github.com/repos/weidai11/cryptopp/issues/891/comments
1
2019-10-12T11:13:28Z
2020-12-20T00:59:36Z
https://github.com/weidai11/cryptopp/issues/891
506,173,154
891
[ "weidai11", "cryptopp" ]
We have `BytePtr` and `ConstBytePtr` for `std::string` that allows us to easily extract a `byte*`: ``` inline byte* BytePtr(std::string& str) { // Caller wants a writeable pointer CRYPTOPP_ASSERT(str.empty() == false); if (str.empty()) return NULLPTR; return reinterpret_cast<byte*>(&str[0]); } ``` The `BytePtr` and `ConstBytePtr` helper functions are very useful because they avoid undefined behavior when using the `std::string` class. The UB arises when taking the address of the first element for an empty string. `misc.h` lacks similar overloads for `SecByteBlock` due to a circular dependency between `secblock.h` and `misc.h`. Wei's original `SecBlock` always did the right thing. It was not the problem. The problem was, we lacked an overload so we had different patterns: ``` std::string str1; SecByteBlock str2; byte *ptr1 = str1.empty() ? "" : (byte *)&str1[0]; byte *ptr2 = str2.data(); ``` This issue will track adding `secblockfwd.h` that forward declares some of the template classes needed for `SecBlock<T, A>` and `SecByteBlock`. With the addition we can provided overloaded `BytePtr` and `ConstBytePtr`. The new `secblockfwd.h` tested OK on Windows XP with VS2002; and modern Linux, OSX and Windows. We should be OK for the cut-in.
Add BytePtr and ConstBytePtr overloads for SecByteBlock
https://api.github.com/repos/weidai11/cryptopp/issues/890/comments
0
2019-10-03T07:39:55Z
2019-10-03T08:12:54Z
https://github.com/weidai11/cryptopp/issues/890
501,903,358
890
[ "weidai11", "cryptopp" ]
gcc-9.2.0 in pedantic mode complains about extra semicolons here: ``` keccak.h:104:49: warning: extra ';' [-Wpedantic] 104 | DOCUMENTED_TYPEDEF(Keccak_Final<28>, Keccak_224); | ^ keccak.h:108:49: warning: extra ';' [-Wpedantic] 108 | DOCUMENTED_TYPEDEF(Keccak_Final<32>, Keccak_256); | ^ keccak.h:112:49: warning: extra ';' [-Wpedantic] 112 | DOCUMENTED_TYPEDEF(Keccak_Final<48>, Keccak_384); | ^ keccak.h:116:49: warning: extra ';' [-Wpedantic] 116 | DOCUMENTED_TYPEDEF(Keccak_Final<64>, Keccak_512); | ^ ```
Tiny issue with extra semicolons and gcc-9.2.0 in pedantic mode
https://api.github.com/repos/weidai11/cryptopp/issues/889/comments
2
2019-10-02T13:03:10Z
2019-10-04T02:41:16Z
https://github.com/weidai11/cryptopp/issues/889
501,475,424
889
[ "weidai11", "cryptopp" ]
Hi I can not compile my test program with cryptopp how I compile g++ -g3 -O2 -Wall -Wextra -o main main.cpp -l:libcryptopp.a error Undefined symbols for architecture x86_64: "CryptoPP::AlignedDeallocate(void*)", referenced from: CryptoPP::AllocatorWithCleanup<unsigned long, true>::deallocate(void*, unsigned long) in main-543731.o "CryptoPP::UnalignedDeallocate(void*)", referenced from: CryptoPP::AllocatorWithCleanup<unsigned long, true>::deallocate(void*, unsigned long) in main-543731.o "CryptoPP::Integer::Integer()", referenced from: _main in main-543731.o "CryptoPP::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, CryptoPP::Integer const&)", referenced from: _main in main-543731.o "vtable for CryptoPP::Integer", referenced from: CryptoPP::Integer::~Integer() in main-543731.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation) on MacOS
https://api.github.com/repos/weidai11/cryptopp/issues/887/comments
0
2019-09-30T05:32:16Z
2019-09-30T09:35:45Z
https://github.com/weidai11/cryptopp/issues/887
500,059,465
887
[ "weidai11", "cryptopp" ]
While working [Issue 884](https://github.com/weidai11/cryptopp/issues/884) we uncovered a circular dependency between `misc.h` and `secblock.h`. `misc.h` provides `AlignedAllocate`, `AlignedDeallocate` and friends. Including `secblock.h` in `misc.h` for use of `SecByteBlock` caused the allocation functions to be undefined at the point of use.
Circular dependency between misc.h and secblock.h
https://api.github.com/repos/weidai11/cryptopp/issues/885/comments
1
2019-09-28T21:02:18Z
2019-09-29T06:54:50Z
https://github.com/weidai11/cryptopp/issues/885
499,820,767
885
[ "weidai11", "cryptopp" ]
On occasion I find a need for X509 certificate support. It is not often, but it arises on occasion. Besides just declaring a stand-alone `X509Certificate`, it would be nice to have a class that integrates a little better with the library. All users can benefit from the support. I think we can offer a stub for better downstream integration. That is, the Crypto++ library would provide the scaffolding without an `X509Certificate` class, and downstream users could supply a `X509Certificate` class as needed. The stub would look like this in `cryptlib.h`: ``` class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Certificate : virtual public CryptoMaterial { }; ``` Or ``` class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Certificate : public PublicKey { }; ``` Later, a downstream user could do something like this, as in the [PEM files](https://github.com/noloader/cryptopp-pem): ``` class X509Certificate : public ASN1CryptoMaterial<Certificate> { public: void Save (BufferedTransformation &bt) const; void Load (BufferedTransformation &bt); }; ``` ----- I think the changes to `cryptlib.h` are fairly clean and I think it OK to stub-out the interface. What I am less sure about is a subtle design decision. Should `Certificate` inherit from (a) `CryptoMaterial` or (b) `PublicKey`? The question arises (for me) because a certificate binds an identity to public key. So should the relationship be `Certificate` *"has a"* `PublicKey`; or should the relationship be `Certificate` *"is a"* `PublicKey`? In practice, I think it boils down to this use case: ``` extern bool VerifyMessageWithPublicKey(PublicKey& key, std::string message, std::string signature); RSA::PublicKey key; X509Certificate cert; // This should always work VerifyMessageWithPublicKey(key, ...); // But should this work, too? VerifyMessageWithPublicKey(cert, ...); ``` ----- Eventually, once we get some experience using a `X509Certificate`, we can add it to the library like `X509PublicKey` and `PKCS8PrivateKey`.
Add Certificate interface
https://api.github.com/repos/weidai11/cryptopp/issues/884/comments
1
2019-09-28T06:51:12Z
2019-09-28T22:30:38Z
https://github.com/weidai11/cryptopp/issues/884
499,735,153
884
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report operating system and version - centos 6.6 version of the Crypto++ library : Crypto++ 8.2.0, Recovered Text after decryption does not match ``` #include <filters.h> #include <osrng.h> #include <modes.h> #include <files.h> #include <aes.h> #include <iostream> #include <string> using namespace CryptoPP; using namespace std; // g++ -DNDEBUG -g2 -O2 -I. test.cxx ./libcryptopp.a -o test.exe int main(int argc, char* argv[]) { unsigned char plain[] = "Now is the time for all good men to come to the aide of their country"; unsigned int data_size = strlen((char*) plain) + 1; SecByteBlock key(AES::DEFAULT_KEYLENGTH), iv(AES::BLOCKSIZE); AutoSeededRandomPool prng; prng.GenerateBlock(key, key.size()); prng.GenerateBlock(iv, iv.size()); cout << key.data() << endl; cout << iv.data() << endl; AES::Encryption aesEncrypt(key, key.size()); CFB_Mode_ExternalCipher::Encryption cfbEncryption_external(aesEncrypt, iv); AES::Decryption aesDecrypt(key, key.size()); CFB_Mode_ExternalCipher::Decryption cfbDecryption_external(aesDecrypt, iv); // CFB_Mode<AES>::Encryption cfbEncryption(key, key.size(), iv); CFB_Mode<AES>::Decryption cfbDecryption(key, key.size(), iv); //encryption------------------------------------------------------------------------------ unsigned char * cipher = (unsigned char *) malloc(sizeof(unsigned char) * (data_size)); ArraySink cipherSink(cipher, data_size); ArraySource ss1(plain, data_size, true, new StreamTransformationFilter(cfbEncryption_external, new Redirector(cipherSink))); //decryption------------------------------------------------------------------------------ unsigned char * recover_external = (unsigned char *) malloc(sizeof(unsigned char) * (data_size)); ArraySink recoverSink(recover_external, data_size); ArraySource ss2(cipher, data_size, true, new StreamTransformationFilter(cfbDecryption_external, new Redirector(recoverSink))); unsigned char * recover_withoutExternal = (unsigned char *) malloc(sizeof(unsigned char) * (data_size)); ArraySink recoverSink1(recover_withoutExternal, data_size); ArraySource ss3(cipher, data_size, true, new StreamTransformationFilter(cfbDecryption, new Redirector(recoverSink1))); cout << "Plain: " << plain << endl; cout << "Plain data size: " << data_size << endl; cout << "cipher: " << cipher << endl; cout << "recover_external : " << recover_external << endl; cout << "recover_withoutExternal: " << recover_withoutExternal << endl; return 0; } ``` compile: g++ -DNDEBUG -g2 -O2 -I ../dependency_src/cryptopp-CRYPTOPP_8_2_0_2/ test_git.cpp ../dependency_lib/libcryptopp.a -o test_cfb_git.exe
CFB_Mode_ExternalCipher does not work
https://api.github.com/repos/weidai11/cryptopp/issues/883/comments
3
2019-09-26T21:10:43Z
2019-09-26T22:27:01Z
https://github.com/weidai11/cryptopp/issues/883
499,118,246
883
[ "weidai11", "cryptopp" ]
In Windows XP SP2 or lower cannot locate program input points GetLogicalProcesserInformation() ![1569424587(1)](https://user-images.githubusercontent.com/31638230/65614950-20ac9280-dfeb-11e9-8104-cd6a9cadc52e.png)
Unable to locate program input point GetLogicalProcesserInformation
https://api.github.com/repos/weidai11/cryptopp/issues/882/comments
2
2019-09-25T15:21:40Z
2019-09-26T21:36:58Z
https://github.com/weidai11/cryptopp/issues/882
498,357,385
882
[ "weidai11", "cryptopp" ]
* State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) Windows 10 RS5 x64 * State the version of the Crypto++ library (Crypto++ 5.6.5, Master, etc) Tried on master and 8.1.0 * State how you built the library (Makefile, Cmake, distro, etc) VS solution * Show a typical command line (the output of the compiler for cryptlib.cpp) Have not any warning or error 1>cryptlib.vcxproj -> C:\Users\Administrator\Desktop\cryptopp-CRYPTOPP_8_1_0\Win32\Output\Debug\cryptlib_debug.lib ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ========== * Show the link command (the output of the linker for libcryptopp.so or cryptest.exe) Default * Show the exact error message you are receiving (copy and paste it); or Call stacks; http://i.koray.cc/feb7dde5b60fdbd8f25690d6e32c649e.png http://i.koray.cc/6601228dd0901cb65234983666882dc2.png * Clearly state the undesired behavior (and state the expected behavior) When I link cryptopp static library in debug build mode to another 3rd app, the app instant crash before than their entrypoint when I launch.
msvc instant crash in debug build
https://api.github.com/repos/weidai11/cryptopp/issues/881/comments
1
2019-09-10T17:19:03Z
2019-09-22T03:47:46Z
https://github.com/weidai11/cryptopp/issues/881
491,799,992
881
[ "weidai11", "cryptopp" ]
`Rijndael::Enc::ProcessAndXorBlock` recurses infinitely under certain combinations of defines.: - `CRYPTOPP_SSE2_ASM_AVAILABLE` is true - `CRYPTOPP_X64_MASM_AVAILABLE` is not defined - `CRYPTOPP_AESNI_AVAILABLE` is not defined - `CRYPTOPP_DISABLE_RIJNDAEL_ASM` is defined This causes `if (HasAESNI())` to be run, if this returns true then `Rijndael::Enc::AdvancedProcessBlocks` is called. With this combination of defines `Rijndael::Enc::AdvancedProcessBlocks` just calls `Rijndael::Enc::ProcessAndXorBlock`. This was found on OSX 10.14 with XCode 10.3 and building with the makefile with the following additional defines: `-DCRYPTOPP_DISABBLE_SSSE3`
Infinite recursion in rijndael.cpp
https://api.github.com/repos/weidai11/cryptopp/issues/880/comments
6
2019-09-10T10:13:27Z
2019-09-29T01:43:22Z
https://github.com/weidai11/cryptopp/issues/880
491,579,753
880
[ "weidai11", "cryptopp" ]
I'm just wondering if there's any appetite for this really. Right now internal headers, public headers, implementation and test files are all piled together into a jumbled mess. Would it not be much better to clean this up? I'd be happy to help with this effort I think it would also make things much simpler with respect to other build systems. I maintain a cmake build file for the project and I keep getting odd regressions due to not knowing which files I need for the build and which ones are part of the testing and benchmarking.
Project structure re-organisation
https://api.github.com/repos/weidai11/cryptopp/issues/879/comments
4
2019-09-06T06:17:01Z
2023-10-02T06:41:55Z
https://github.com/weidai11/cryptopp/issues/879
490,150,334
879
[ "weidai11", "cryptopp" ]
As reported on the mailing list by Philippe Antoine at [Regression in Elliptic Curve Operation on brainpoolP256r1](https://groups.google.com/d/msg/cryptopp-users/RfAFR3_y1sI/qYH2rTavBQAJ): ``` ... I have been doing differential fuzzing about elliptic curve cryptography with different libraries including cryptopp. On August the 6th, oss-fuzz found the first regression after about one year. I think this is dut to commit https://github.com/weidai11/cryptopp/commit/c9ef9420e762b91cc06463d349cf06e04c749b9d My output is the following point=04202020202020ffffff2020202020200020ffffffff20202020ff20ff20ff200104c8423eb699c3ace2e623855cb9238cb43971464f4b6686765c46ed4ce035dc bignum=000000000000000000000000000000000000000000000000000000000000000a mbedlts:045de6bae41907dbe3f0aa32b272add6b92fb2b79fdc49af35fb844be1c4c629e899295109c41cfe76a9c06c23d95b2d4be3b6f61a476acf1a67a0d848abba89e1 libecc:045de6bae41907dbe3f0aa32b272add6b92fb2b79fdc49af35fb844be1c4c629e899295109c41cfe76a9c06c23d95b2d4be3b6f61a476acf1a67a0d848abba89e1 libecc:045de6bae41907dbe3f0aa32b272add6b92fb2b79fdc49af35fb844be1c4c629e899295109c41cfe76a9c06c23d95b2d4be3b6f61a476acf1a67a0d848abba89e1 openssl:045de6bae41907dbe3f0aa32b272add6b92fb2b79fdc49af35fb844be1c4c629e899295109c41cfe76a9c06c23d95b2d4be3b6f61a476acf1a67a0d848abba89e1 gcrypt:045de6bae41907dbe3f0aa32b272add6b92fb2b79fdc49af35fb844be1c4c629e899295109c41cfe76a9c06c23d95b2d4be3b6f61a476acf1a67a0d848abba89e1 cryptopp:0407f16bad8b16f5441f1a15f8e7eca364d97bb3a3c09b320bb9807ee26857b66f882ba526e55ebbf22342ae5a0186ed0ca1db8870fd001c63ae36dc72ee15f6e7 That means when I multiply by 10 the point on the curve brainpoolP256r1 x = 202020202020ffffff2020202020200020ffffffff20202020ff20ff20ff2001 y = 04c8423eb699c3ace2e623855cb9238cb43971464f4b6686765c46ed4ce035dc I get a different result than all the other libraries. ```
Regression in Elliptic Curve Operation on brainpoolP256r1
https://api.github.com/repos/weidai11/cryptopp/issues/878/comments
20
2019-08-26T22:00:55Z
2021-01-01T20:01:05Z
https://github.com/weidai11/cryptopp/issues/878
485,474,676
878
[ "weidai11", "cryptopp" ]
``` std::string PublicKeyString("MHYwTwYGKw4HAgEBMEUCIQDebUvQDd9UPMmD27BJovZSIgWfexL0SWkfJQPMLsJvMwIgDy/kEthwO6Q+L8XHnzumnEKs+txH8QkQD+M/8u82ql0DIwACIAY6rfW+BTcRZ9QAJovgoB8DgNLJ8ocqOeF4nEBB0DHH"); CryptoPP::ByteQueue queue; CryptoPP::Base64Decoder decoder(new CryptoPP::Redirector(queue)); decoder.Put((const Byte *) PublicKeyString.data(), PublicKeyString.size()); decoder.MessageEnd(); CryptoPP::ElGamal::Encryptor encryptor; encryptor.AccessKey().Load(queue); ```
ElGamal encryption key Load and BERDecodeErr
https://api.github.com/repos/weidai11/cryptopp/issues/876/comments
24
2019-08-24T04:18:48Z
2020-12-20T01:00:32Z
https://github.com/weidai11/cryptopp/issues/876
484,776,595
876
[ "weidai11", "cryptopp" ]
https://github.com/weidai11/cryptopp/blob/8130bd7a2405dbf889b8a0e3baa54ace7b630afc/secblock.h#L208 The condition `size == 0` was already checked five lines above.
Size cannot be zero
https://api.github.com/repos/weidai11/cryptopp/issues/875/comments
1
2019-08-22T20:40:24Z
2020-12-20T01:00:48Z
https://github.com/weidai11/cryptopp/issues/875
484,206,008
875
[ "weidai11", "cryptopp" ]
```cpp #include <sha.h> #include <pwdbased.h> int main(void) { unsigned char out[714]; const unsigned char password[8] = { 0 }; const unsigned char salt[8] = { 0 }; ::CryptoPP::PKCS5_PBKDF1<::CryptoPP::SHA1> pbkdf1; pbkdf1.DeriveKey( out, sizeof(out), 0, password, sizeof(password), salt, sizeof(salt), 4); return 0; } ``` Results in a buffer overflow in ```PKCS5_PBKDF1<T>::DeriveKey``` because: ```cpp 128 SecByteBlock buffer(hash.DigestSize()); ... ... 140 memcpy(derived, buffer, derivedLen); ``` So with SHA1, 20 bytes are allocated, but because ```derivedLen``` is 714, (714-20)=694 too many bytes are copied.
PKCS5_PBKDF1 buffer overflow
https://api.github.com/repos/weidai11/cryptopp/issues/874/comments
4
2019-08-16T09:03:29Z
2020-12-20T01:00:59Z
https://github.com/weidai11/cryptopp/issues/874
481,514,733
874
[ "weidai11", "cryptopp" ]
I get a 0xc0000005 in cryptotest.exe in rdrand.cpp:249. Here's what I did: - downloaded Cryptopp 8.2.0, official release zip https://github.com/weidai11/cryptopp/archive/CRYPTOPP_8_2_0.zip - opened cryptest.sln in VS2017 - upgraded to latest Windows SDK 10.0.17763.0 - build - run cryptest.exe The crash happens in rdrand.cpp:249, but probably at the call MASM_RDSEED_GenerateBlock(). Stacktrace: ```` cryptest.exe!01ae6360() cryptest.exe!CryptoPP::RDSEED::GenerateBlock(unsigned char * output, unsigned int size) Line 249 cryptest.exe!CryptoPP::RandomNumberGenerator::GenerateIntoBufferedTransformation(CryptoPP::BufferedTransformation & target, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & channel, unsigned __int64 length) Line 330 cryptest.exe!CryptoPP::RandomNumberStore::TransferTo2(CryptoPP::BufferedTransformation & target, unsigned __int64 & transferBytes, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & channel, bool blocking) Line 1227 cryptest.exe!CryptoPP::BufferedTransformation::TransferMessagesTo2(CryptoPP::BufferedTransformation & target, unsigned int & messageCount, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & channel, bool blocking) Line 650 cryptest.exe!CryptoPP::BufferedTransformation::TransferAllTo2(CryptoPP::BufferedTransformation & target, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & channel, bool blocking) Line 696 cryptest.exe!CryptoPP::SourceTemplate<CryptoPP::RandomNumberStore>::PumpAll2(bool blocking) Line 1378 cryptest.exe!CryptoPP::Source::PumpAll() Line 1319 cryptest.exe!CryptoPP::Source::SourceInitialize(bool pumpAll, const CryptoPP::NameValuePairs & parameters) Line 1355 cryptest.exe!CryptoPP::RandomNumberSource::RandomNumberSource(CryptoPP::RandomNumberGenerator & rng, int length, bool pumpAll, CryptoPP::BufferedTransformation * attachment) Line 1454 cryptest.exe!CryptoPP::Test::Test_RandomNumberGenerator(CryptoPP::RandomNumberGenerator & prng, bool drain) Line 431 cryptest.exe!CryptoPP::Test::TestRDSEED() Line 866 ```` Configurations affected: Debug-Win32, Release-Win32 Configurations not affected: Debug-x64, Release-x64 (except for a few assertion failures) I also built it with cmake (https://github.com/noloader/cryptopp-cmake), here the same error occurs, but this time all Win32 builds are fine and the crash happens in x64 builds. The only change from "stock" settings is the Windows SDK update, but I cannot see how this could lead to the problems observed. Is this expected behaviour?
Exception 0xc0000005 in cryptest using VS2017
https://api.github.com/repos/weidai11/cryptopp/issues/872/comments
7
2019-08-05T12:49:08Z
2020-12-20T01:01:14Z
https://github.com/weidai11/cryptopp/issues/872
476,840,859
872
[ "weidai11", "cryptopp" ]
From a private email by Ján Jančár: > Message-ID: <93874bd8-653e-33e9-c429-93712c3f30ba@mail.muni.cz> > Subject: Vulnerability disclosure > ... > > During our research into security of elliptic curve cryptography implementations on smart-cards and in software libraries [1], we have discovered timing leakage in the ECDSA signature generation in the Crypto++ library. > > *Vulnerability description* > > When performing ECDSA over binary field curves, Crypto++ leaks the bit-length of the nonce used in scalar multiplication. It also leaks some other currently unknown information, see the attached plots, specifically the 'msb_hist.png' plot. > > This leakage can be abused if an attacker is able to measure the duration of signing of a few hundreds or thousands of known messages. The attacker can then use a lattice attack based on the Hidden Number Problem [2] to reconstruct the private key used, as demonstrated in [3] (even remotely!). > > See the attached plots and heatmaps for details of the leakage on the standard sect233r1 curve. based on the level of noise present in the attacker's measurements (the lattice attack is very sensitive to noise) and willingness to trade-off computation time, the attack would require from 500 to 10k signatures. > > The private key recovery itself, assuming a noise free set of just enough signatures, would then take a few minutes. The leakage is somewhat present in ECDSA over prime field curves as well, but much smaller, I do not know the cause of this. > > [1]: ECTester: https://crocs-muni.github.io/ECTester/ > > [2]: D. Boneh, R. Venkatesan: Hardness of computing the most significant bits of secret keys in Diffie-Hellman and related schemes; https://crypto.stanford.edu/~dabo/abstracts/dhmsb.html > > [3]: B. B. Brumley, N. Tuveri: Remote Timing Attacks are Still Practical; https://eprint.iacr.org/2011/232.pdf It appears nearly all versions of Crypto++ are affected. Based on some research of antique Crypto++, I believe that means Crypto++ 3.2 and forward. Crypto++ 3.2 was released March 20, 2000. Also posted to the mailing list at [ECDSA timing leaks](https://groups.google.com/forum/#!topic/cryptopp-users/1GGTAh4CEdA).
Elliptic Curve timing leaks
https://api.github.com/repos/weidai11/cryptopp/issues/869/comments
9
2019-07-26T04:49:09Z
2020-12-20T11:23:40Z
https://github.com/weidai11/cryptopp/issues/869
473,175,638
869
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report Cross compiling on ubuntu 18.04 for aarch64 (just armv8-a) Cryptopp 8.0, built using custom buildsystem ```.sh aarch64-linux-gnu-g++ -MMD -MF obj/deps/build/cryptlib/cryptlib/crc_simd.o.d -DNDEBUG -I../../../deps/build/cryptlib -Wall -Werror -fopenmp -fno-strict-aliasing -funwind-tables -fPIC -pipe -fdiagnostics-color -fstack-protector-strong -pthread -O3 -fno-ident -fdata-sections -ffunction-sections -fno-omit-frame-pointer -g2 -fvisibility=hidden -Wno-attributes -fvisibility-inlines-hidden -std=c++17 -c ../../../deps/build/cryptlib/crc_simd.cpp -o obj/deps/build/cryptlib/cryptlib/crc_simd.o ``` ``` In file included from ../../../deps/build/cryptlib/crc_simd.cpp:24:0: /usr/lib/gcc-cross/aarch64-linux-gnu/7/include/arm_acle.h: In function ‘bool CryptoPP::CPU_ProbeCRC32()’: /usr/lib/gcc-cross/aarch64-linux-gnu/7/include/arm_acle.h:77:1: error: inlining failed in call to always_inline ‘uint32_t __crc32w(uint32_t, uint32_t)’: target specific option mismatch __crc32w (uint32_t __a, uint32_t __b) ^~~~~~~~ ../../../deps/build/cryptlib/crc_simd.cpp:98:11: note: called from here w = __crc32w(w,x); ~~^~~~~~~~~~~~~~~ In file included from ../../../deps/build/cryptlib/crc_simd.cpp:24:0: /usr/lib/gcc-cross/aarch64-linux-gnu/7/include/arm_acle.h:71:1: error: inlining failed in call to always_inline ‘uint32_t __crc32h(uint32_t, uint16_t)’: target specific option mismatch __crc32h (uint32_t __a, uint16_t __b) ^~~~~~~~ ../../../deps/build/cryptlib/crc_simd.cpp:99:11: note: called from here w = __crc32h(w,y); ~~^~~~~~~~~~~~~~~ In file included from ../../../deps/build/cryptlib/crc_simd.cpp:24:0: /usr/lib/gcc-cross/aarch64-linux-gnu/7/include/arm_acle.h:41:1: error: inlining failed in call to always_inline ‘uint32_t __crc32b(uint32_t, uint8_t)’: target specific option mismatch __crc32b (uint32_t __a, uint8_t __b) ^~~~~~~~ ../../../deps/build/cryptlib/crc_simd.cpp:100:11: note: called from here w = __crc32b(w,z); ~~^~~~~~~~~~~~~~~ In file included from ../../../deps/build/cryptlib/crc_simd.cpp:24:0: /usr/lib/gcc-cross/aarch64-linux-gnu/7/include/arm_acle.h:59:1: error: inlining failed in call to always_inline ‘uint32_t __crc32cw(uint32_t, uint32_t)’: target specific option mismatch __crc32cw (uint32_t __a, uint32_t __b) ^~~~~~~~~ ../../../deps/build/cryptlib/crc_simd.cpp:101:11: note: called from here w = __crc32cw(w,x); ~~^~~~~~~~~~~~~~~~ In file included from ../../../deps/build/cryptlib/crc_simd.cpp:24:0: /usr/lib/gcc-cross/aarch64-linux-gnu/7/include/arm_acle.h:53:1: error: inlining failed in call to always_inline ‘uint32_t __crc32ch(uint32_t, uint16_t)’: target specific option mismatch __crc32ch (uint32_t __a, uint16_t __b) ^~~~~~~~~ ../../../deps/build/cryptlib/crc_simd.cpp:102:11: note: called from here w = __crc32ch(w,y); ~~^~~~~~~~~~~~~~~~ In file included from ../../../deps/build/cryptlib/crc_simd.cpp:24:0: /usr/lib/gcc-cross/aarch64-linux-gnu/7/include/arm_acle.h:47:1: error: inlining failed in call to always_inline ‘uint32_t __crc32cb(uint32_t, uint8_t)’: target specific option mismatch __crc32cb (uint32_t __a, uint8_t __b) ^~~~~~~~~ ../../../deps/build/cryptlib/crc_simd.cpp:103:11: note: called from here w = __crc32cb(w,z); ~~^~~~~~~~~~~~~~~~ ```
CRYPTOPP_ARM_CRC32_AVAILABLE is set even when +crc is not set in march
https://api.github.com/repos/weidai11/cryptopp/issues/868/comments
16
2019-07-24T11:29:29Z
2019-08-05T08:23:15Z
https://github.com/weidai11/cryptopp/issues/868
472,230,486
868
[ "weidai11", "cryptopp" ]
Currently the recipe to build `cryptest.exe` hard-codes `libcryptopp.a`. From `GNUmakefile`: ``` cryptest.exe:libcryptopp.a $(TESTOBJS) $(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS) ``` Using `libcryptopp.a` is a good engineering decision because it sidesteps [path problems](https://www.cryptopp.com/wiki/Runtime_Path) that plague Unix and Linux. However, there are two gaps. First, distros usually patch to use the shared object. Second, `cryptest.sh` (and some other scripts) test shared object linking, and they require makefile hacks. For example, we make a copy of the makefile, run sed over it, and then use the new makefile for testing. We can make it easier to swap-in the shared object by introducing a makefile variable: ``` LINK_LIBRARY ?= ./libcryptopp.a ... cryptest.exe: $(LINK_LIBRARY) $(TESTOBJS) $(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) $(LINK_LIBRARY) $(LDFLAGS) $(LDLIBS) ``` This will track the changes to add the variable `LINK_LIBRARY`.
Add link-library variable to Makefiles
https://api.github.com/repos/weidai11/cryptopp/issues/866/comments
1
2019-07-21T06:12:15Z
2019-07-21T07:41:23Z
https://github.com/weidai11/cryptopp/issues/866
470,747,193
866
[ "weidai11", "cryptopp" ]
* openSUSE Tumbleweed (it's a rolling release) * armv7l * Crypto++ 8.2.0 * GNUMakefile Full compilation log: http://susepaste.org/view//9613298 In short: `-march=armv7-a -mfpu=neon` flags are added to compile selected source files. Linking fails with LTO enabled, because those flags are not specified.
LTO build fails due to missint "-m" flags in linker command
https://api.github.com/repos/weidai11/cryptopp/issues/865/comments
28
2019-07-18T21:04:26Z
2019-09-27T06:17:58Z
https://github.com/weidai11/cryptopp/issues/865
469,988,552
865
[ "weidai11", "cryptopp" ]
I compile Crypto++ library source code in CentOS 6, run Linux command to get OS info and version: ``` #uname -a Linux centos6 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux ``` [SNIP unneeded by JW] ``` #make g++ -I/usr/local/mysql/include -I/usr/local/include/cryptopp -Wall -O0 -fPIC -st d=c++0x -c ArbiInst.cpp ArbiProduct.cpp ArbiStatus.cpp ArbiTemplate.cpp Broker.c pp Common.cpp conf.cpp CtpMdBase.cpp CtpMdRecvIF.cpp CtpTdBase.cpp CtpTd.cpp DbI f.cpp Exchange.cpp GridOrder.cpp GridOrderMgr.cpp Instrument.cpp IpAddr.cpp Isp. cpp main.cpp Model.cpp OrderInfo.cpp OrderLeg.cpp OrderLegItem.cpp Position.cpp Product.cpp Seat.cpp SimNow.cpp SocketAgent.cpp Socket.cpp stdafx.cpp StrategyBa se.cpp Strategy.cpp Timer.cpp times.cpp TradingDetail.cpp TradingLog.cpp Trading Time.cpp TradingTimeType.cpp User.cpp UserStatus.cpp In file included from /usr/local/include/cryptopp/seckey.h:11, from /usr/local/include/cryptopp/rijndael.h:13, from /usr/local/include/cryptopp/aes.h:13, from /usr/local/include/cryptopp/dll.h:16, from Socket.cpp:45: /usr/local/include/cryptopp/misc.h:94:32: error: missing binary operator before token "0" make: *** [*.o] Error 1 ``` I tried to change /usr/local/include/cryptopp/misc.h:94 from: ``` #elif defined(SIZE_T_MAX) && (SIZE_T_MAX > 0) #define SIZE_MAX SIZE_T_MAX ``` to: ``` #elif defined(SIZE_T_MAX) #if (SIZE_T_MAX > 0) #define SIZE_MAX SIZE_T_MAX #endif ``` but it didn't work, compiler report another error.
Crypto++ 8.2 and misc.h:94:32: error: missing binary operator before token "0"
https://api.github.com/repos/weidai11/cryptopp/issues/864/comments
7
2019-07-13T18:21:16Z
2019-07-14T16:18:30Z
https://github.com/weidai11/cryptopp/issues/864
467,751,690
864
[ "weidai11", "cryptopp" ]
As discussed on Stack Overflow at [Crypto++ and neon_vector_type attribute is not supported for this target using Android NDK?](https://stackoverflow.com/q/56988965/608639). The target is `armeabi`, which is the old armv5 gear. The toolchain is ndk-r16b. android-ndk-r16b/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/5.0.300080/include/arm_neon.h:28:2: error: "NEON support not enabled" ^ android-ndk-r16b/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/5.0.300080/include/arm_neon.h:48:24: error: 'neon_vector_type' attribute is not supported for this target typedef __attribute__((neon_vector_type(8))) int8_t int8x8_t; OP disabled ASM and intrinsics using `CRYPTOPP_DISABLE_ASM`, but we are still trying to include ARM-specific headers.
Android and neon_vector_type attribute is not supported for this target
https://api.github.com/repos/weidai11/cryptopp/issues/863/comments
1
2019-07-11T21:54:30Z
2020-12-20T01:03:10Z
https://github.com/weidai11/cryptopp/issues/863
467,125,232
863
[ "weidai11", "cryptopp" ]
`BufferedTransformation` lacks `GetWord64` and `PutWord64`. Also see [StreamTransformationFilter: invalid PKCS #7 block padding found using AES decryption](https://stackoverflow.com/q/56945847/608639) on Stack Overflow. This issue will track the addition.
Add GetWord64 and PutWord64
https://api.github.com/repos/weidai11/cryptopp/issues/862/comments
0
2019-07-10T14:04:14Z
2020-12-20T01:03:21Z
https://github.com/weidai11/cryptopp/issues/862
466,329,422
862
[ "weidai11", "cryptopp" ]
`AutoSeededX917RNG` can be tricky to use correctly due to `Reseed`. If user input is too small or seed size is too large then uninitialized data could be used to key the underlying block cipher. Feeding uninitialized data to the RNG is not necessarily a bad thing since entropy is a good thing. However, we should probably avoid Valgrind findings since it creates noisy test results. HKDF is Krawczyk and Eronen's HMAC-based extract-and-expand key derivation function. It has provable security properties and should work nicely. This report tracks use of `HKDF` in `AutoSeededX917RNG::Reseed` to ensure well sized key material to avoid Valgrind findings.
Use HKDF in AutoSeededX917RNG::Reseed
https://api.github.com/repos/weidai11/cryptopp/issues/861/comments
1
2019-07-06T07:04:10Z
2019-07-06T07:12:29Z
https://github.com/weidai11/cryptopp/issues/861
464,826,067
861
[ "weidai11", "cryptopp" ]
This issue has been nagging us for about 4 years, since we started testing with Asan. Also see [Issue 304](https://github.com/weidai11/cryptopp/issues/304). Originally we thought (hoped?) it may be a false positive since the finding pointed to an address in our stack frame. We also were not able to duplicate with Valgrind, so it became a low priority item. However, the finding has not cleared itself in several versions of Asan. Here is what it looks like on a 32-bit Intel machine with ASM enabled: ``` $ ./cryptest.exe tv vmac Using seed: 1562310506 Testing MAC algorithm VMAC(AES)-64. .ASAN:DEADLYSIGNAL ================================================================= ==30299==ERROR: AddressSanitizer: SEGV on unknown address 0xffffffd0 (pc 0x00cb1d05 bp 0xbfd41708 sp 0xbfd41630 T0) #0 0xcb1d04 in CryptoPP::VMAC_Base::VHASH_Update_SSE2(unsigned long long const*, unsigned int, int) /home/jwalton/cryptopp/vmac.cpp:427 #1 0xcb275a in CryptoPP::VMAC_Base::VHASH_Update(unsigned long long const*, unsigned int) /home/jwalton/cryptopp/vmac.cpp:756 ... ``` Stepping it under GDB: ``` (gdb) r tv vmac ... (gdb) disass ... 0x00c0dcf9 <+955>: jne 0xc0dabc <VMAC_Base::VHASH_Update_SSE2(unsigned long long const*, unsigned int, int)+382> 0x00c0dcff <+961>: add $0xc,%esp 0x00c0dd02 <+964>: pop %ebp 0x00c0dd03 <+965>: emms => 0x00c0dd05 <+967>: mov -0x40(%ebx),%ebx 0x00c0dd08 <+970>: mov -0xbc(%ebp),%ebx 0x00c0dd0e <+976>: cmp %ebx,-0xc8(%ebp) ... ``` The `mov -0x40(%ebx),%ebx` is due to `mov %0, %%ebx` in `vmac.cpp`. Obviously, that won't work. `ebx` was blown away since it was used in `VHASH_Update_SSE2`, so we can't use something relative to `ebx` to restore `ebx`. We need to find a better pattern than below due to code generation: ``` AS_POP_IF86( bp) AS1( emms) #ifdef __GNUC__ ATT_PREFIX AS2( mov %0, %%ebx) : "=m" (temp) : "m" (L1KeyLength), "c" (blocksRemainingInWord64), "S" (data), "D" (nhK+tagPart*2), "d" (m_isFirstBlock), "a" (polyS+tagPart*4) : "memory", "cc" ); #endif ```
Asan finding in VMAC on i686 in inline asm
https://api.github.com/repos/weidai11/cryptopp/issues/860/comments
2
2019-07-05T07:17:59Z
2020-12-20T01:03:38Z
https://github.com/weidai11/cryptopp/issues/860
464,498,617
860
[ "weidai11", "cryptopp" ]
The Gentoo folks caught a bug report at Issue 689162, [dev-libs/crypto++-8.2.0 with CXXFLAGS="-march=bdver1" - error: ‘_mm_roti_epi64’ was not declared in this scope](https://bugs.gentoo.org/689162): ``` x86_64-pc-linux-gnu-g++ -O2 -march=bdver1 -pipe -fPIC -pthread -pipe -msse4.1 -c blake2b_simd.cpp blake2b_simd.cpp: In function ‘void CryptoPP::BLAKE2_Compress64_SSE4(const byte*, CryptoPP::BLAKE2b_State&)’: blake2b_simd.cpp:364:5: error: ‘_mm_roti_epi64’ was not declared in this scope _mm_roti_epi64(r, c) ^~~~~~~~~~~~~~ blake2b_simd.cpp:381:13: note: in expansion of macro ‘MM_ROTI_EPI64’ row4l = MM_ROTI_EPI64(row4l, -32); \ ... ``` It looks like GCC and Clang have a problem with both XOP and SSE4.1 when using `-march=bdver1`. Using `-march=native` on a Bulldozer machine is OK. Here is the reporducer: ``` bulldozer:~$ g++ -march=bdver1 -msse4.1 test.cxx test.cxx: In function ‘int main(int, char**)’: test.cxx:15:9: error: ‘_mm_roti_epi64’ was not declared in this scope b = _mm_roti_epi64(a, 1); ^~~~~~~~~~~~~~ test.cxx:15:9: note: suggested alternative: ‘_mm_rorv_epi64’ b = _mm_roti_epi64(a, 1); ^~~~~~~~~~~~~~ _mm_rorv_epi64 bulldozer:~$ cat test.cxx #ifdef __XOP__ #include <immintrin.h> #include <ammintrin.h> #endif #ifdef __SSE41__ #include <smmintrin.h> #endif int main(int argc, char* argv[]) { __m128i a=_mm_setzero_si128(), b=_mm_setzero_si128(), c; #ifdef __XOP__ b = _mm_roti_epi64(a, 1); #endif #ifdef __SSE41__ c = _mm_blend_epi16(a, b, 0); #endif return 0; } ``` We opened a question on the GCC mailing list at [Which header for AMD XOP _mm_roti_epi64?](https://gcc.gnu.org/ml/gcc-help/2019-07/msg00032.html).
AMD and error: use of undeclared identifier '_mm_roti_epi64'
https://api.github.com/repos/weidai11/cryptopp/issues/859/comments
1
2019-07-02T20:40:52Z
2020-12-20T01:03:48Z
https://github.com/weidai11/cryptopp/issues/859
463,425,829
859
[ "weidai11", "cryptopp" ]
As discussed on the mailing list at [ECIES with no HMAC](https://groups.google.com/forum/#!topic/cryptopp-users/csUq-DqdWa8). After Crypto++ 5.6.5 was released we changed ECIES to align with Botan and Bouncy Castle. The change was mostly without incident, except... It looks like `GetSymmetricKeyLength` took an unintended change (also see [Commit c3e2e0fb25fd](https://github.com/weidai11/cryptopp/commit/c3e2e0fb25fd)): - size_t GetSymmetricKeyLength(size_t plaintextLength) const - {return plaintextLength + MAC::DEFAULT_KEYLENGTH;} + size_t GetSymmetricKeyLength(size_t plaintextLength) const + {return plaintextLength + static_cast<size_t>(MAC::DIGESTSIZE);} Notice `MAC::DEFAULT_KEYLENGTH` was removed, and `MAC::DIGESTSIZE` used instead. But `void SymmetricEncrypt(...)` did not change. It still uses `MAC::DEFAULT_KEYLENGTH`: const byte *cipherKey = NULLPTR, *macKey = NULLPTR; if (DHAES_MODE) { macKey = key; cipherKey = key + MAC::DEFAULT_KEYLENGTH; } else { cipherKey = key; macKey = key + plaintextLength; } The problem did not surface under normal circumstances because we perform a pairwise consistency check, so both encrypt and decrypt used the same mistake. However, OP encrypted with Crypto++ 5.6.4 and decrypted with Crypto++ 8.2, and it revealed the problem. This will track what happens with ECIES.
ECIES and GetSymmetricKeyLength no longer uses MAC::DEFAULT_KEYLENGTH
https://api.github.com/repos/weidai11/cryptopp/issues/856/comments
0
2019-07-01T22:26:31Z
2020-12-20T01:04:02Z
https://github.com/weidai11/cryptopp/issues/856
462,938,031
856
[ "weidai11", "cryptopp" ]
There is an issue reported by static analysis in `pwdbased.h` where not checking the results of the hmac processing can lead to a divide by zero. Here is the hmac portion: HMAC<T> hmac(secret, secretLen); SecByteBlock buffer(hmac.DigestSize()); If `hmac.DigestSize()` returns 0, then this subsequent call can result in a divide by zero: timeInSeconds = timeInSeconds / ((derivedLen + buffer.size() - 1) / buffer.size()); I haven't observed this issue in practice, but it may be useful to check the hmac results since this flow is possible.
Possible divide by zero
https://api.github.com/repos/weidai11/cryptopp/issues/855/comments
6
2019-06-28T14:18:58Z
2019-07-01T15:22:50Z
https://github.com/weidai11/cryptopp/issues/855
462,057,771
855
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report I am trying to build static lib .a for iPhone app os macosx Mojave Xcode 10.21 building master branch (currently 8.2) Procedure building in console (building in Xcode fails with same problems): 1. Setting up environment ``` ./setenv-ios.sh Configuring for iPhoneOS (armv7) XCODE_SDK: iPhoneOS12.2.sdk XCODE_DEVELOPER: /Applications/Xcode.app/Contents/Developer XCODE_TOOLCHAIN: /Applications/Xcode.app/Contents/Developer/usr/bin XCODE_DEVELOPER_TOP: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer IOS_ARCH: armv7 IOS_TOOLCHAIN: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ IOS_FLAGS: IOS_SYSROOT: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk ``` ``` echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin ``` ``` printenv| egrep "(IOS|XCODE)" | sort ``` it shows null for some reason 2. building ``` make -f GNUmakefile-cross Here's what we found... IS_X86: 0, IS_X64: 0, IS_ARM32: 0, IS_ARMV8: 0 Using testing flags: -DNDEBUG -g2 -O3 -fPIC -pipe c++ -DNDEBUG -g2 -O3 -fPIC -pipe -Wall -c cryptlib.cpp c++ -DNDEBUG -g2 -O3 -fPIC -pipe -Wall -c cpu.cpp c++ -DNDEBUG -g2 -O3 -fPIC -pipe -Wall -c integer.cpp integer.cpp:650:2: error: unknown token in expression INTEL_NOPREFIX ^ ./cpu.h:46:25: note: expanded from macro 'INTEL_NOPREFIX' #define INTEL_NOPREFIX ".intel_syntax;" ^ <inline asm>:1:20: note: instantiated into assembly here .intel_syntax;neg %rcx; ^ integer.cpp:653:2: error: unknown token in expression AS2( mov %0,[%3+8*%1]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:277:2: note: expanded from here "mov %0" ^ <inline asm>:5:5: note: instantiated into assembly here mov %rax, [%rdx+8*%rcx]; ^ integer.cpp:654:2: error: unknown token in expression AS2( add %0,[%4+8*%1]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:279:2: note: expanded from here "add %0" ^ <inline asm>:6:5: note: instantiated into assembly here add %rax, [%rsi+8*%rcx]; ^ integer.cpp:655:2: error: unknown token in expression AS2( mov [%2+8*%1],%0) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:281:2: note: expanded from here "mov [%2+8*%1]" ^ <inline asm>:7:6: note: instantiated into assembly here mov [%r8+8*%rcx], %rax; ^ integer.cpp:657:2: error: unknown token in expression AS2( mov %0,[%3+8*%1+8]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:284:2: note: expanded from here "mov %0" ^ <inline asm>:10:5: note: instantiated into assembly here mov %rax, [%rdx+8*%rcx+8]; ^ integer.cpp:658:2: error: unknown token in expression AS2( adc %0,[%4+8*%1+8]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:286:2: note: expanded from here "adc %0" ^ <inline asm>:11:5: note: instantiated into assembly here adc %rax, [%rsi+8*%rcx+8]; ^ integer.cpp:659:2: error: unknown token in expression AS2( mov [%2+8*%1+8],%0) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:288:2: note: expanded from here "mov [%2+8*%1+8]" ^ <inline asm>:12:6: note: instantiated into assembly here mov [%r8+8*%rcx+8], %rax; ^ integer.cpp:660:2: error: unknown token in expression AS2( lea %1,[%1+2]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:290:2: note: expanded from here "lea %1" ^ <inline asm>:13:5: note: instantiated into assembly here lea %rcx, [%rcx+2]; ^ integer.cpp:662:2: error: unknown token in expression AS2( mov %0,[%3+8*%1]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:295:2: note: expanded from here "mov %0" ^ <inline asm>:17:5: note: instantiated into assembly here mov %rax, [%rdx+8*%rcx]; ^ integer.cpp:663:2: error: unknown token in expression AS2( adc %0,[%4+8*%1]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:297:2: note: expanded from here "adc %0" ^ <inline asm>:18:5: note: instantiated into assembly here adc %rax, [%rsi+8*%rcx]; ^ integer.cpp:664:2: error: unknown token in expression AS2( mov [%2+8*%1],%0) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:299:2: note: expanded from here "mov [%2+8*%1]" ^ <inline asm>:19:6: note: instantiated into assembly here mov [%r8+8*%rcx], %rax; ^ integer.cpp:667:2: error: unknown token in expression AS2( mov %0, 0) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:305:2: note: expanded from here "mov %0" ^ <inline asm>:25:5: note: instantiated into assembly here mov %rax, 0; ^ integer.cpp:668:2: error: unknown token in expression AS2( adc %0, %0) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:307:2: note: expanded from here "adc %0" ^ <inline asm>:26:5: note: instantiated into assembly here adc %rax, %rax; ^ integer.cpp:682:2: error: unknown token in expression INTEL_NOPREFIX ^ ./cpu.h:46:25: note: expanded from macro 'INTEL_NOPREFIX' #define INTEL_NOPREFIX ".intel_syntax;" ^ <inline asm>:1:20: note: instantiated into assembly here .intel_syntax;neg %rcx; ^ integer.cpp:685:2: error: unknown token in expression AS2( mov %0,[%3+8*%1]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:313:2: note: expanded from here "mov %0" ^ <inline asm>:5:5: note: instantiated into assembly here mov %rax, [%rdx+8*%rcx]; ^ integer.cpp:686:2: error: unknown token in expression AS2( sub %0,[%4+8*%1]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:315:2: note: expanded from here "sub %0" ^ <inline asm>:6:5: note: instantiated into assembly here sub %rax, [%rsi+8*%rcx]; ^ integer.cpp:687:2: error: unknown token in expression AS2( mov [%2+8*%1],%0) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:317:2: note: expanded from here "mov [%2+8*%1]" ^ <inline asm>:7:6: note: instantiated into assembly here mov [%r8+8*%rcx], %rax; ^ integer.cpp:689:2: error: unknown token in expression AS2( mov %0,[%3+8*%1+8]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:320:2: note: expanded from here "mov %0" ^ <inline asm>:10:5: note: instantiated into assembly here mov %rax, [%rdx+8*%rcx+8]; ^ integer.cpp:690:2: error: unknown token in expression AS2( sbb %0,[%4+8*%1+8]) ^ ./cpu.h:812:20: note: expanded from macro 'AS2' #define AS2(x, y) GNU_AS2(x, y) ^ ./cpu.h:802:24: note: expanded from macro 'GNU_AS2' #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE ^ <scratch space>:322:2: note: expanded from here "sbb %0" ^ <inline asm>:11:5: note: instantiated into assembly here sbb %rax, [%rsi+8*%rcx+8]; ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *** [integer.o] Error 1 ```
Assembler errors when building with clang on MacOSX Mojave : error: unknown token in expression INTEL_NOPREFIX
https://api.github.com/repos/weidai11/cryptopp/issues/854/comments
5
2019-06-27T18:57:10Z
2019-06-30T12:25:48Z
https://github.com/weidai11/cryptopp/issues/854
461,697,115
854
[ "weidai11", "cryptopp" ]
Hello, I experiment using cryptopp on redhat 7.2 and got a mysterious problem. Using valgring memcheck, I got: ``` ==7472== Conditional jump or move depends on uninitialised value(s) ==7472== at 0x80DC3B2: BERGeneralDecoder::TransferTo2(BufferedTransformation&, unsigned long long&, std::string const&, bool) (asn.cpp:479) ``` Using gdb to find out more, I Added a breakpoint at asn.cpp:479. After a bit of trial, I notice that the class attribute lword m_length; is been set with a random value : 586577603468939024 586577981426061072 586577843987107600 Here is how I create an object `BERGeneralDecoder`: BERGeneralDecoder decoder(BER, Tag1, Tag2); My conclusion is : attribute `m_length` is not initialized when using the constructor : explicit BERGeneralDecoder(BERGeneralDecoder &inQueue, byte asnTag1, byte asnTag2) : m_inQueue(inQueue), m_finished(false) { CheckByte(asnTag1); Init(asnTag2); } Regards
Issue on creating CryptoPP::BERGeneralDecoder object
https://api.github.com/repos/weidai11/cryptopp/issues/852/comments
5
2019-06-07T15:24:47Z
2019-06-11T16:01:23Z
https://github.com/weidai11/cryptopp/issues/852
453,569,931
852
[ "weidai11", "cryptopp" ]
Clang, GCC and code review services like [lgtm](https://lgtm.com) have been nagging that the ASN.1 encoders and decoders have signatures that could match a copy constructor due to the default parameter of `asnTag`. Clang and GCC would do it on occasion at elevated warnings; while [lgtm](https://lgtm.com) does it during its automated security evaluation. This issue report will track the cleanup of the classes. In general we will (1) remove the default value for `asnTag`, and (2) provide an overload to take the place of the constructor with the default argument. We also make the base classes `BERGeneralDecoder` and `DERGeneralEncoder` as not copyable. This makes sense since the encoders and decoders hold a reference to an external `BufferedTransformation` or `ByteQueue`. As such, multiple objects should not be reading/writing to the queues.
Refine ASN.1 encoders and decoders so they don't accidentally match copy ctor
https://api.github.com/repos/weidai11/cryptopp/issues/851/comments
0
2019-06-04T06:43:38Z
2019-06-04T06:54:03Z
https://github.com/weidai11/cryptopp/issues/851
451,823,832
851
[ "weidai11", "cryptopp" ]
We cut-in BMI2 code paths for the `Integer` class at [Commit fb0bef1eb6e5](https://github.com/weidai11/cryptopp/commit/fb0bef1eb6e5) and [Commit 4952fa489d43](https://github.com/weidai11/cryptopp/commit/4952fa489d43). The changes made use of BMI2's `mulx` and `adcx` instructions. The instructions allow compilers greater freedom in selecting registers and memory operands, and `mulx` is non-destructive on the cc flags, and the change resulted in a modest 0.03 ms speedup in integer operations. After the commits UB uncovered problems on OS X. JW was not able to reproduce initially due to old hardware, but was able to reproduce with `-mavx -mavx2 -mbmi -mbmi2`. It looks like Apple Clang 6.0 does not provide `_blsr_u32`, which caused compile errors in `misc.h`. [Commit 392ec3465e42](https://github.com/weidai11/cryptopp/commit/392ec3465e42) fixed it. Then UB discovered and endless stream of warnings in later versions of Apple Clang. [Commit 8e27c6b3fa86](https://github.com/weidai11/cryptopp/commit/8e27c6b3fa86) fixed it. Then, UB discovered an OS X machine that says it has BMI and BMI2, defines `__BMI__` and `__BMI2__` during compile, but results in a `SIGILL` at runtime. The code path in question is guarded by `__BMI2__` at compile time, but lacks a `HasBMI2()` runtime guard because it is hot. Anything in that code path that does not multiply or add slows down the big integer multiplication. We are going to disable BMI2 in `Integer` class since we don't have a way to enable it and improve the speed of big integer multiplication.
Disable BMI2 code paths in Integer class
https://api.github.com/repos/weidai11/cryptopp/issues/850/comments
1
2019-06-01T04:00:28Z
2019-06-01T04:18:10Z
https://github.com/weidai11/cryptopp/issues/850
451,041,096
850
[ "weidai11", "cryptopp" ]
Hello there, I am using Debian 9.8 (Stretch). I am using Crypto++ version 8.2.0. downloaded from the Crypto++ website. I built the library using Make and the instructions on the [Wiki page](https://www.cryptopp.com/wiki/Linux#Build_and_Install_the_Library). I built my one-file program using: g++ myfile.cpp -o myfile.o -DNDEBUG -g3 -O2 -Wall -Wextra -l:libcryptopp.a My compiler gives me some warnings, but only about implicit type conversions (unrelated to the bug at hand; it is related to some other parts of my program which do not produce the bug). **My program gets stuck on the Mul_16 line (line 1411) of integer.cpp file.** Here is the code that causes this: ``` CryptoPP::AutoSeededRandomPool rnd; CryptoPP::InvertibleRSAFunction params; params.GenerateRandomWithKeySize(rnd, 12000); ``` I ran the program 3 times and it always gets stuck on the line I gave you above. I found that out by running my program in gdb and pressing CTRL + C and seeing where it was at the time it received SIGINT. The 12000 magic number was chosen just cause - it could have been any other number (I tried). The desired behavior is for the program not to get stuck on that line. I am using this library for a college assignment; just wanted to let you know what happened. Best regards!
Program stuck on MUL_16 (line 1411 in integer.cpp)
https://api.github.com/repos/weidai11/cryptopp/issues/849/comments
3
2019-05-28T14:10:45Z
2019-05-29T21:52:27Z
https://github.com/weidai11/cryptopp/issues/849
449,292,867
849
[ "weidai11", "cryptopp" ]
### Crypto++ Issue Report Heap corruption when using x86_64-w64-mingw32-g++ 8.3.0 ``` warning: HEAP[main.exe]: warning: Invalid address specified to RtlFreeHeap( 0000000003590000, 00000000034488B0 ) Thread 1 received signal SIGTRAP, Trace/breakpoint trap. 0x00007ff9d6fc8c07 in ntdll!RtlpNtMakeTemporaryKey () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll (gdb) bt #0 0x00007ff9d6fc8c07 in ntdll!RtlpNtMakeTemporaryKey () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll #1 0x00007ff9d6f84a3d in ntdll!memset () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll #2 0x00007ff9d6fc7a94 in ntdll!RtlpNtMakeTemporaryKey () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll #3 0x00007ff9d6f6ba02 in ntdll!memset () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll #4 0x00007ff9d6eceb2e in ntdll!RtlFreeHeap () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll #5 0x00007ff9d6ad9d0c in msvcrt!free () from /cygdrive/c/Windows/System32/msvcrt.dll #6 0x0000000000492894 in CryptoPP::UnalignedDeallocate (p=0x34488b0) at misc.cpp:334 ``` I wrote a patch to avoid this using VirtualAlloc/VirtualFree: [patch.txt](https://github.com/weidai11/cryptopp/files/3227756/patch.txt)
Heap Corruption on Mingw64
https://api.github.com/repos/weidai11/cryptopp/issues/848/comments
3
2019-05-28T13:13:27Z
2019-05-29T11:09:30Z
https://github.com/weidai11/cryptopp/issues/848
449,262,165
848
[ "weidai11", "cryptopp" ]
Currently the Cryptogams SHA implementation comingles NEON and ARMv7 code. The caller calls `sha1_block_data_order`, and either ARMv7 or NEON executes depending on `CRYTPOGAMS_armcap` feature bits. The Cryptogams code does this internally. We can't check for NEON and call it independently. Breaking out `sha1_block_data_order` and `sha1_block_data_order_neon` means we can call them independently, and also removes the need for `CRYTPOGAMS_armcap`. `CRYTPOGAMS_armcap` is mostly a wart. This issue will track the breakout of `sha1_block_data_order` and `sha1_block_data_order_neon` functions for SHA-1, SHA-256 and SHA-512.
Add Cryptogams sha_xxx_neon functions
https://api.github.com/repos/weidai11/cryptopp/issues/847/comments
0
2019-05-27T01:36:25Z
2020-12-20T01:05:58Z
https://github.com/weidai11/cryptopp/issues/847
448,631,354
847
[ "weidai11", "cryptopp" ]
After cutting in Cryptogams SHA for ARM (GH #837, GH #839, GH #841), loading the shared object results in: LD_LIBRARY_PATH=./ ./cryptest.exe v /home/test/cryptopp/.libs/lt-cryptest: error while loading shared libraries: /home/test/cryptopp/.libs/libcryptopp.so.8: unexpected reloc type 0x03 The static archive is OK. It looks like the shared object and `CRYPTOGAMS_armcaps` (formerly `OPENSSL_armcap_P`) are the problems. And maybe a missing kernel patch at [arm: module: add support for R_ARM_REL32 relocations](https://patchwork.kernel.org/patch/9527003/). `CRYPTOGAMS_armcaps` has a symbol type `R_ARM_REL32` instead of `R_ARM_GOT32`. It probably would not be a problem except the kernel/loader cannot handle the `R_ARM_REL32` symbol type: ``` $ objdump -r sha1_armv4.o | grep CRYPTOGAMS_armcaps 000004d0 R_ARM_REL32 CRYPTOGAMS_armcaps ``` `R_ARM_GOT32` appears to be how the C++ compiler creates the reference to the global symbol (from `sha.cpp`, which calls the Cryptogams gear): ``` $ objdump -r sha.o | grep CRYPTOGAMS_armcaps 00001a74 R_ARM_GOT32 CRYPTOGAMS_armcaps // reference 00001c14 R_ARM_GOT32 CRYPTOGAMS_armcaps // reference 00001db4 R_ARM_GOT32 CRYPTOGAMS_armcaps // reference 0000af15 R_ARM_ABS32 CRYPTOGAMS_armcaps // definition, global ``` Inside the Cryptogams routines, the asm source does some trickery. Notice the module declares `.word CRYPTOGAMS_armcaps` in the ARMv7 path. Later, an assembler directive places `CRYPTOGAMS_armcaps` in the Common section of the elf header. ``` #if __ARM_MAX_ARCH__>=7 .Lsha1_block: ldr r12,.LCRYPTOGAMS_armcap_loc # if !defined(_WIN32) adr r3,.Lsha1_block ldr r12,[r3,r12] @ CRYPTOGAMS_armcaps # endif # if defined(__APPLE__) || defined(_WIN32) ldr r12,[r12] # endif tst r12,#ARMV7_NEON bne .LNEON #endif ... #if __ARM_MAX_ARCH__>=7 .LCRYPTOGAMS_armcap_loc: # ifdef _WIN32 .word CRYPTOGAMS_armcaps # else .word CRYPTOGAMS_armcaps-.Lsha1_block # endif #endif ``` I talked to Andy Polyakov about this. I suggested he change the interface from implicitly depending on an `CRYPTOGAMS_armcaps` to taking a `caps` parameter as a fourth argument: ``` extern "C" void sha1_block_data_order( word32* state, const word32 *data, size_t blocks, unsigned int caps // new ); ``` Passing the parameter avoids the relocation problem and takes fewer instructions, but the suggestion was declined. We are going to have to make the change to fix the shared object. We don't have a choice. This will track the change that avoids the `CRYPTOGAMS_armcaps` load and passes the cap flags directly to the functions.
ARM and "unexpected reloc type 0x03" loading shared object
https://api.github.com/repos/weidai11/cryptopp/issues/846/comments
0
2019-05-22T22:54:36Z
2019-05-23T10:09:08Z
https://github.com/weidai11/cryptopp/issues/846
447,377,006
846
[ "weidai11", "cryptopp" ]
The library uses two defines for Clang: `CRYPTOPP_APPLE_CLANG_VERSION` and `CRYPTOPP_LLVM_CLANG_VERSION`. The distinction is necessary because Apple does not pickup all LLVM patches, and Apple uses a different numbering scheme. Also see [Xcode Clang Version Record](https://gist.github.com/yamaya/2924292) GitHub. Due to historic reasons (i.e., we did not have a good grasp on what was going on for ARM), we are still using one define for ARM. The single define is `CRYPTOPP_CLANG_VERSION`, and it is defined as shown below. It is the same as `CRYPTOPP_LLVM_CLANG_VERSION`: ``` CRYPTOPP_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) ``` We need to go through the ARM defines in [`config_asm.h`](https://github.com/weidai11/cryptopp/blob/master/config_asm.h) and [`config_ver.h`](https://github.com/weidai11/cryptopp/blob/master/config_ver.h) and fix them: ``` // Requires ARMv7 and ACLE 1.0. -march=armv7-a or above must be present // Requires GCC 4.3, Clang 2.8 or Visual Studio 2012 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead. #if !defined(CRYPTOPP_ARM_NEON_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM) # if defined(__arm__) || defined(__ARM_NEON) || defined(__ARM_FEATURE_NEON) || defined(_M_ARM) # if (CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_CLANG_VERSION >= 20800) || \ (CRYPTOPP_MSC_VERSION >= 1700) # define CRYPTOPP_ARM_NEON_AVAILABLE 1 # endif // Compilers # endif // Platforms #endif ``` The downside to this is, I don't have a good testing environment for Apple. I'm down to 1 MacBook, 3 iPads and 2 iPhones. And all of the gear is old.
Fix use of CRYPTOPP_CLANG_VERSION
https://api.github.com/repos/weidai11/cryptopp/issues/845/comments
0
2019-05-21T07:14:35Z
2020-12-20T01:06:28Z
https://github.com/weidai11/cryptopp/issues/845
446,453,521
845
[ "weidai11", "cryptopp" ]
Since cutting over to Cryptogams SHA on 32-bit ARM, the numbers for Clang have not improved. For example, on a Tinkerboard @1.8 GHz: ***GCC***: Hash|Provider|MB/s|Cpb -- | -- | -- | -- MD5 | C++ | 245 | 7.00 SHA-1 | NEON | 223 | 7.69 SHA-256 | NEON | 88 | 19.50 ***Clang***: Hash|Provider|MB/s|Cpb -- | -- | -- | -- MD5|C++|222|7.74 SHA-1|NEON|120|14.36 SHA-256|NEON|59|29.0 It looks like there are a few problems. First, our CPU query for ARMv7 is failing under Clang (from `cpu.cpp`): g_hasARMv7 = CPU_QueryARMv7() || CPU_ProbeARMv7(); ... And: ``` inline bool CPU_QueryARMv7() { if ((getauxval(AT_HWCAP) & HWCAP_ARMv7) != 0) return true; return false; } ``` Then, `CPU_ProbeARMv7` is failing because a define is not enabled (from `neon_simd.cpp`): ``` bool CPU_ProbeARMv7() { #if ... .... #elif (CRYPTOPP_ARM_NEON_AVAILABLE) ... // ARMv7 added movt and movw int a; asm volatile("movw %0,%1 \n" "movt %0,%1 \n" : "=r"(a) : "i"(0x1234) ); result = (a == 0x12341234); #endif return result; } ``` `CRYPTOPP_ARM_NEON_AVAILABLE` is the wrong define but we are using it as a proxy. NEON should be enabled but it is not. So we need to fix `CPU_QueryARMv7`, and then switch to byte codes so we can do away with `CPU_QueryARMv7`.
Performance is off for some algorithms on ARM with Clang
https://api.github.com/repos/weidai11/cryptopp/issues/844/comments
1
2019-05-20T22:35:10Z
2019-05-21T03:40:08Z
https://github.com/weidai11/cryptopp/issues/844
446,339,486
844
[ "weidai11", "cryptopp" ]
Tested on latest git master on Linux 64 bit. In my opinion, it should throw, not crash. ```cpp #include <scrypt.h> int main(void) { unsigned char out[32] = { 0 }; const unsigned char password[8] = { 0 }; const unsigned char salt[8] = { 0 }; ::CryptoPP::Scrypt scrypt; scrypt.DeriveKey( out, sizeof(out), password, sizeof(password), salt, sizeof(salt), 1, 0, 1); return 0; } ```
Scrypt with blocksize = 0 segfaults
https://api.github.com/repos/weidai11/cryptopp/issues/842/comments
1
2019-05-19T12:28:13Z
2020-12-20T01:06:42Z
https://github.com/weidai11/cryptopp/issues/842
445,814,225
842
[ "weidai11", "cryptopp" ]
Add ARM SHA512 asm implementation from Cryptogams. Cryptogams is Andy Polyakov's project used to create high speed crypto algorithms and share them with other developers. Cryptogams has a dual license. First is the OpenSSL license because Andy contributes to OpenSSL. Second is a BSD license for those who want a more permissive license. Andy's implementation runs about 45% faster than C/C++ code. Testing on a 1.8 GHz Cortex-A17 shows Cryptograms at 45 cpb, and C++ at 79 cpb. The integration instructions are documented at [Cryptogams SHA](https://wiki.openssl.org/index.php/Cryptogams_SHA) on the OpenSSL wiki.
Add ARM SHA512 asm implementation from Cryptogams
https://api.github.com/repos/weidai11/cryptopp/issues/841/comments
0
2019-05-19T12:09:13Z
2020-12-20T01:06:57Z
https://github.com/weidai11/cryptopp/issues/841
445,812,359
841
[ "weidai11", "cryptopp" ]
Add ARM SHA256 asm implementation from Cryptogams. Cryptogams is Andy Polyakov's project used to create high speed crypto algorithms and share them with other developers. Cryptogams has a dual license. First is the OpenSSL license because Andy contributes to OpenSSL. Second is a BSD license for those who want a more permissive license. Andy's implementation runs about 45% faster than C/C++ code. Testing on a 1 GHz Cortex-A7 shows Cryptograms at 17 cpb, and C++ at 30 cpb. The integration instructions are documented at [Cryptogams SHA](https://wiki.openssl.org/index.php/Cryptogams_SHA) on the OpenSSL wiki.
Add ARM SHA256 asm implementation from Cryptogams
https://api.github.com/repos/weidai11/cryptopp/issues/839/comments
0
2019-05-19T09:27:36Z
2020-12-20T01:07:07Z
https://github.com/weidai11/cryptopp/issues/839
445,798,575
839
[ "weidai11", "cryptopp" ]
Add ARM SHA1 asm implementation from Cryptogams. Cryptogams is Andy Polyakov's project used to create high speed crypto algorithms and share them with other developers. Cryptogams has a dual license. First is the OpenSSL license because Andy contributes to OpenSSL. Second is a BSD license for those who want a more permissive license. Andy's implementation runs about 50% faster than C/C++ code. Testing on a 1 GHz Cortex-A7 shows Cryptograms at 16 cpb, and C++ at 23 cpb. The integration instructions are documented at [Cryptogams SHA](https://wiki.openssl.org/index.php/Cryptogams_SHA) on the OpenSSL wiki.
Add ARM SHA1 asm implementation from Cryptogams
https://api.github.com/repos/weidai11/cryptopp/issues/837/comments
0
2019-05-18T10:39:16Z
2020-12-20T01:07:31Z
https://github.com/weidai11/cryptopp/issues/837
445,703,364
837
[ "weidai11", "cryptopp" ]
Currently we don't integrate well with Autoconf's feature tests. Autoconf would like to write a new `config.h` based on platform feature tests, but our `config.h` has stuff in it that Autoconf cannot handle. For example, our `config.h` header has: ``` #if defined(_MSC_VER) || defined(__BORLANDC__) typedef signed __int64 sword64; typedef unsigned __int64 word64; #define SW64LIT(x) x##i64 #define W64LIT(x) x##ui64 #elif (_LP64 || __LP64__) typedef signed long sword64; typedef unsigned long word64; #define SW64LIT(x) x##L #define W64LIT(x) x##UL #else typedef signed long long sword64; typedef unsigned long long word64; #define SW64LIT(x) x##LL #define W64LIT(x) x##ULL #endif ``` That block is not the result of testing, and Autoconf does not allow us to copy it into the `config.h` it is generating, or write to the `config.h` it is generating. Small problems like this has stopped us from moving forward with better Autoconf integration. I think several smaller changes, like adding a `config_int.h` for the library's integer defines will be the cleanest way to separate and move forward. Then, we can add `config_int.h` to `config.h` so user code does not experience pain or discomfort. Library users will continue to include `config.h` as usual. This report will track the changes to isolate the testable items in `config.h` from the non-testable stuff.
Make config.h more autoconf friendly
https://api.github.com/repos/weidai11/cryptopp/issues/835/comments
1
2019-05-16T07:00:59Z
2020-12-20T01:07:22Z
https://github.com/weidai11/cryptopp/issues/835
444,786,249
835
[ "weidai11", "cryptopp" ]
libcrypto++ 8.1, gcc 4.9.4 running on linux x64. The exactly same code works fine with gcc 4.5 on the same linux x64 environment, but after I upgraded GCC to 4.9, the same code triggered a SIGILL. However, on the MSW/x64 platform, the same code compiled with GCC (MinGW) 4.9.2 can be executed correctly. So, for the same code: - Gcc 4.5 compiled code can run correctly on linux / x64 platform. - Gcc 4.9 compiled code can run correctly on msw / x64 platform. - **Code compiled with gcc 4.9 cannot run on linux/x64 platforms!** The following is the backtrace information from gdb: ``` Program received signal SIGILL, Illegal instruction. [Switching to Thread 0x7ffff5e15700 (LWP 6121)] 0x0000000000855803 in _mm_loadu_si128 (__P=0x7ffff5e0ca30) at /usr/lib/gcc/x86_64-linux-gnu/4.9/include/emmintrin.h:694 694 return (__m128i) __builtin_ia32_loaddqu ((char const *)__P); (gdb) bt #0 0x0000000000855803 in _mm_loadu_si128 (__P=0x7ffff5e0ca30) at /usr/lib/gcc/x86_64-linux-gnu/4.9/include/emmintrin.h:694 #1 CryptoPP::Rijndael_UncheckedSetKey_SSE4_AESNI (userKey=0x7ffff5e0ca20 "\263\254_\367DJ0\r̛", keyLen=32, rk=0x7fffec002300) at /root/develop-lib/crypto/contrib/cryptopp/rijndael_simd.cpp:455 #2 0x0000000000851739 in CryptoPP::Rijndael::Base::UncheckedSetKey (this=0x7fffec001040, userKey=0x7ffff5e0ca20 "\263\254_\367DJ0\r̛", keyLen=32) at /root/develop-lib/crypto/contrib/cryptopp/rijndael.cpp:430 #3 0x000000000074bc76 in CryptoPP::SimpleKeyingInterface::SetKey (this=0x7fffec001040, key=0x7ffff5e0ca20 "\263\254_\367DJ0\r̛", length=32, params=...) at /root/develop-lib/crypto/contrib/cryptopp/cryptlib.cpp:61 #4 0x0000000000850c9e in CryptoPP::RandomPool::GenerateIntoBufferedTransformation (this=0x7ffff5e0c9d0, target=..., channel=..., size=16) at /root/develop-lib/crypto/contrib/cryptopp/randpool.cpp:53 #5 0x000000000074d483 in CryptoPP::RandomNumberGenerator::GenerateBlock (this=0x7ffff5e0c9d0, output=0x7fffec001000 "", size=16) at /root/develop-lib/crypto/contrib/cryptopp/cryptlib.cpp:316 ``` The linux/x64 platform runs on the same hardware (Xeon E3-1505M) as the msw/x64 platform (linux runs in the VMWare virtual machine) and is compiled with the same parameters (`-msse4.2 -maes -mpclmul -mavx2 -msha`). But only the linux target encounters the illegal instruction problem. This makes me a bit confused. Any suggestions?
GCC 4.9 linux x64 target crash with SIGILL
https://api.github.com/repos/weidai11/cryptopp/issues/834/comments
15
2019-05-16T04:45:01Z
2019-05-18T02:34:11Z
https://github.com/weidai11/cryptopp/issues/834
444,751,967
834
[ "weidai11", "cryptopp" ]
I've build a [cryptography implementation differential fuzzer](https://github.com/guidovranken/cryptofuzz) that has been running on OSS-Fuzz for a few weeks and has found some [nice bugs](https://github.com/guidovranken/cryptofuzz#hall-of-fame). I will be integrating Crypto++ support for my fuzzer into OSS-Fuzz shortly. Would any of the maintainers like to be notified of automated bug reports? If so, please give me one or more e-mail addresses linked to a Google account. I noticed that someone had commenced [OSS-Fuzz integration](https://github.com/weidai11/cryptopp/issues/602#issuecomment-376222204), did anything come of this? I'm also running a [bignum differential fuzzer](https://github.com/guidovranken/bignum-fuzzer) on OSS-Fuzz. Would you be interested in writing Crypto++ support for this fuzzer?
OSS-Fuzz integration
https://api.github.com/repos/weidai11/cryptopp/issues/833/comments
5
2019-05-06T11:53:32Z
2019-05-18T08:45:13Z
https://github.com/weidai11/cryptopp/issues/833
440,662,414
833
[ "weidai11", "cryptopp" ]
I built a statis lib but it could't work, I got an incorrent result(using CRC32, MD5 or SHA1), but I run the cryptest.exe well, it showed all test passed. And this problem doesn't exists in my server machine. my local machine runs windows 10 2019 LTSC(64Bit), and my server machine runs windows 10 2016 LTSB((64Bit)), the cryptopp version is the lasted version 8.2.
static lib can't work good
https://api.github.com/repos/weidai11/cryptopp/issues/832/comments
1
2019-05-02T13:48:19Z
2019-05-02T15:56:32Z
https://github.com/weidai11/cryptopp/issues/832
439,600,947
832
[ "weidai11", "cryptopp" ]
Native testing on a [Tritium H3 dev-board](https://libre.computer/products/boards/all-h3-cc/) with Cortex-A7 running Armbian, which is a Ubuntu Bionic derivative: $ clang -dumpmachine armv8l-unknown-linux-gnueabihf And GCC on the same machine: $ gcc -dumpmachine arm-linux-gnueabihf We detect the machine as ARMv8 due to `armv8l` in the triplet. According to [armv8l-toolchain-linux](https://github.com/tsandmann/armv8l-toolchain-linux) GitHub, it indicates an ARMv8 toolchain targeting Cortex-A53 cpu's. ARM A53 cpu's are aarch64. It is also noteworthy that ARM does not mention `armv8l` on their website. ----- Around line 40 of the makefile we perform the following. Column 1 is the machine in a triplet (the triplet is `machine-vendor-operatingsystem`), and it is what we `cut` from the triplet. ``` HOSTX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null | cut -f 1 -d '-') ``` ----- Also see Issue 1827175, [armv8l-unknown-linux-gnueabihf triplet from clang -dumpmachine on ARMv7l](https://bugs.launchpad.net/ubuntu/+source/clang/+bug/1827175) in the Ubuntu issue reporter.
Gracefully handle Clang triplet armv8l-unknown-linux-gnueabihf
https://api.github.com/repos/weidai11/cryptopp/issues/831/comments
1
2019-05-01T05:27:30Z
2020-12-20T01:07:48Z
https://github.com/weidai11/cryptopp/issues/831
439,072,701
831
[ "weidai11", "cryptopp" ]
`xed25519.cpp` is generating about three findings during self test with UBsan. The findings occur on a Tritium H3 ARM A-32 dev-board. Below is a sample finding. ``` xed25519.cpp:856:97: runtime error: reference binding to misaligned address 0xbe8cfaa4 for type 'const struct ed25519PrivateKey', which requires 8 byte alignment 0xbe8cfaa4: note: pointer points here 38 9f 14 02 b8 9f 14 02 1c 2e 14 02 e4 2e 14 02 00 00 00 00 01 ff ff 3f 00 01 00 00 48 0a 6b 03 ^ ``` It looks like it is due to a `static_cast` instead of a `dynamic_cast` like: ``` const ed25519PrivateKey& priv = static_cast<const ed25519PrivateKey&>(signer.GetPrivateKey()); ``` aarch64, x86_64, i686 and PowerPC did not produce a finding. However, the misaligned address has the potential to surface on the platforms.
xed25519.cpp:856:97: runtime error: reference binding to misaligned address
https://api.github.com/repos/weidai11/cryptopp/issues/829/comments
1
2019-05-01T00:28:22Z
2020-12-20T01:08:11Z
https://github.com/weidai11/cryptopp/issues/829
439,031,299
829
[ "weidai11", "cryptopp" ]
We cut-over to inline functions that retrieve a `BytePtr` or `ConstBytePtr` from a `std::string`. The function handles the casts and asserts so we don't have to use the pattern throughout the code. We are catching some asserts in Debug builds that we could sidestep. The current code in `datatest.cpp` uses a `BytePtr`, but it could use a `ConstBytePtr` like shown below (from around line 285): ``` else if (valueType == typeid(ConstByteArrayParameter)) { m_temp.clear(); PutDecodedDatumInto(m_data, name, StringSink(m_temp).Ref()); reinterpret_cast<ConstByteArrayParameter *>(pValue)->Assign(ConstBytePtr(m_temp), BytePtrSize(m_temp), false); } ``` This will track the change.
Debug asserts in TestDataNameValuePairs
https://api.github.com/repos/weidai11/cryptopp/issues/827/comments
1
2019-04-29T04:02:30Z
2019-04-29T04:16:45Z
https://github.com/weidai11/cryptopp/issues/827
438,142,351
827
[ "weidai11", "cryptopp" ]
Use PowerPC unaligned loads and stores with Power8. We are seeing some trouble using Power7.
Use PowerPC unaligned loads and stores with Power8
https://api.github.com/repos/weidai11/cryptopp/issues/825/comments
1
2019-04-28T00:21:55Z
2019-04-28T01:18:00Z
https://github.com/weidai11/cryptopp/issues/825
437,996,877
825
[ "weidai11", "cryptopp" ]
``` std::string result_str; CryptoPP::CBC_Mode<CryptoPP::SKIPJACK>::Encryption e; CryptoPP::byte key[10] = { 0x00, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 }; CryptoPP::byte plain[8] = { 0x33, 0x22, 0x11, 0x00, 0xdd, 0xcc, 0xbb, 0xaa }; d.SetKey(key, sizeof(key)); std::string input(reinterpret_cast<char*>(plain), 8); CryptoPP::StringSource s(input, true, new CryptoPP::StreamTransformationFilter(e, new CryptoPP::StringSink(result_str) ) // StreamTransformationFilter ); // StringSource std::string hex_result; CryptoPP::StringSource(result_str, true, new CryptoPP::HexEncoder( new CryptoPP::StringSink(hex_result) ) // HexDecoder ); // StringSource std::cout<<hex_result<<std::endl; ``` I know that correct result cipher should be "2587CAE27A12D30069E1B7CA26BD2646". But above code is giving me "C3069674579678B3864BEBE40220757B", which is quite different. I am using Crypto++ 8.0 version now.
SKIPJACK encryption gives wrong result
https://api.github.com/repos/weidai11/cryptopp/issues/824/comments
5
2019-04-26T15:12:57Z
2019-04-28T03:33:45Z
https://github.com/weidai11/cryptopp/issues/824
437,720,577
824
[ "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. There is a wiki page with information on filing useful bug reports. If you have some time please visit http://www.cryptopp.com/wiki/Bug_Report on the wiki. The executive summary is: * State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) * State the version of the Crypto++ library (Crypto++ 5.6.5, Master, etc) * State how you built the library (Makefile, Cmake, distro, etc) * Show a typical command line (the output of the compiler for cryptlib.cpp) * Show the link command (the output of the linker for libcryptopp.so or cryptest.exe) * Show the exact error message you are receiving (copy and paste it); or * Clearly state the undesired behavior (and state the expected behavior)
CRC32 value is
https://api.github.com/repos/weidai11/cryptopp/issues/823/comments
0
2019-04-20T10:32:14Z
2019-04-20T16:15:04Z
https://github.com/weidai11/cryptopp/issues/823
435,382,845
823
[ "weidai11", "cryptopp" ]
I am trying to cross compile from my Ubuntu 14.04 i686 32bit (LXC) for a Qnap NAS (GCC 4.3.6 i686 32bit)... to include it for UrBackup I am stuck on this error ``` i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -msse2 -c donna_sse.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c dsa.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c eax.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c ec2n.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c eccrypto.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c ecp.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c elgamal.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c emsa2.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c eprecomp.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c esign.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c files.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c filters.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c fips140.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c fipstest.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -c gcm.cpp i686-QNAP-linux-gnu-g++ -O2 -fPIC -I/opt/QUrBackup/include -msse2 -c gcm_simd.cpp In file included from gcm_simd.cpp:28: /data/i686-QNAP-linux-gnu/bin/../lib/gcc/i686-QNAP-linux-gnu/4.3.6/include/tmmintrin.h:34:3: error: #error "SSSE3 instruction set not enabled" gcm_simd.cpp:29:24: error: wmmintrin.h: No such file or directory gcm_simd.cpp: In function 'long long int __vector__ CryptoPP::GCM_Reduce_CLMUL(long long int __vector__, long long int __vector__, long long int __vector__, const long long int __vector__&)': gcm_simd.cpp:447: error: '_mm_clmulepi64_si128' was not declared in this scope gcm_simd.cpp: In function 'long long int __vector__ CryptoPP::GCM_Multiply_CLMUL(const long long int __vector__&, const long long int __vector__&, const long long int __vector__&)': gcm_simd.cpp:463: error: '_mm_clmulepi64_si128' was not declared in this scope gcm_simd.cpp: In function 'void CryptoPP::GCM_SetKeyWithoutResync_CLMUL(const CryptoPP::byte*, CryptoPP::byte*, unsigned int)': gcm_simd.cpp:474: error: '_mm_shuffle_epi8' was not declared in this scope gcm_simd.cpp: In function 'size_t CryptoPP::GCM_AuthenticateBlocks_CLMUL(const CryptoPP::byte*, size_t, const CryptoPP::byte*, CryptoPP::byte*)': gcm_simd.cpp:505: error: '_mm_shuffle_epi8' was not declared in this scope gcm_simd.cpp:520: error: '_mm_clmulepi64_si128' was not declared in this scope gcm_simd.cpp:528: error: '_mm_clmulepi64_si128' was not declared in this scope gcm_simd.cpp: In function 'void CryptoPP::GCM_ReverseHashBufferIfNeeded_CLMUL(CryptoPP::byte*)': gcm_simd.cpp:566: error: '_mm_shuffle_epi8' was not declared in this scope make: *** [gcm_simd.o] Error 1 ``` Have any idea on how to fix ?
cross compile for i686 (Qnap NAS failed)
https://api.github.com/repos/weidai11/cryptopp/issues/822/comments
4
2019-04-07T10:07:58Z
2020-12-20T01:09:16Z
https://github.com/weidai11/cryptopp/issues/822
430,126,852
822
[ "weidai11", "cryptopp" ]
Including `"hmac.h"` yields the following compiler warning when compiling with cl.exe (2017 version): ``` ...\cryptopp\seckey.h(172): warning C4296: '>=': expression is always true ...\cryptopp\hmac.h(17): note: see reference to class template instantiation 'CryptoPP::VariableKeyLength<16,0,2147483647,1,4,0>' being compiled ``` I'm compiling on Windows 10 with cryptopp version 8.1.0.
Compiler warning in hmac.h
https://api.github.com/repos/weidai11/cryptopp/issues/821/comments
1
2019-03-25T18:35:11Z
2019-04-28T01:38:45Z
https://github.com/weidai11/cryptopp/issues/821
425,055,552
821
[ "weidai11", "cryptopp" ]
crypto++ 8.1: shake.h The Google Native Client compiler complain something like: "SHACK128: there is no field named SHAKE_Final", we must use the **full template name** to fix it: ```C++ // ... SHAKE128(unsigned int outputSize) : SHAKE_Final<128>(outputSize) {} // NaCl compiler fix // ... SHAKE256(unsigned int outputSize) : SHAKE_Final<256>(outputSize) {} // NaCl compiler fix ```
shake.h not compatible for the NaCl GCC compiler
https://api.github.com/repos/weidai11/cryptopp/issues/820/comments
1
2019-03-23T18:46:57Z
2020-12-20T01:10:06Z
https://github.com/weidai11/cryptopp/issues/820
424,532,416
820
[ "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. There is a wiki page with information on filing useful bug reports. If you have some time please visit http://www.cryptopp.com/wiki/Bug_Report on the wiki. The executive summary is: * State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc) * State the version of the Crypto++ library (Crypto++ 5.6.5, Master, etc) * State how you built the library (Makefile, Cmake, distro, etc) * Show a typical command line (the output of the compiler for cryptlib.cpp) * Show the link command (the output of the linker for libcryptopp.so or cryptest.exe) * Show the exact error message you are receiving (copy and paste it); or * Clearly state the undesired behavior (and state the expected behavior) win7 cryptopp 8.1.0 vs2013 When I compile the project cryptlib, an error appears. error: Element <EnableEnhancedInstructionSet> has an invalid value of AdvancedVectorExtensions2. Why? How can I solve it? Thanks.
VS2013 compile error
https://api.github.com/repos/weidai11/cryptopp/issues/819/comments
2
2019-03-21T02:40:50Z
2023-08-17T15:49:23Z
https://github.com/weidai11/cryptopp/issues/819
423,551,494
819
[ "weidai11", "cryptopp" ]
GCC version: gcc version 4.4.6 20110731 (Red Hat 4.4.6-4) (GCC) run make command and compile fail, below is the last message: ``` g++ -DNDEBUG -g2 -O3 -DCRYPTOPP_DISABLE_AVX2 -fPIC -pthread -pipe -c seed.cpp g++ -DNDEBUG -g2 -O3 -DCRYPTOPP_DISABLE_AVX2 -fPIC -pthread -pipe -c serpent.cpp g++ -DNDEBUG -g2 -O3 -DCRYPTOPP_DISABLE_AVX2 -fPIC -pthread -pipe -c sha.cpp g++ -DNDEBUG -g2 -O3 -DCRYPTOPP_DISABLE_AVX2 -fPIC -pthread -pipe -c sha3.cpp g++ -DNDEBUG -g2 -O3 -DCRYPTOPP_DISABLE_AVX2 -fPIC -pthread -pipe -c sha_simd.cpp g++ -DNDEBUG -g2 -O3 -DCRYPTOPP_DISABLE_AVX2 -fPIC -pthread -pipe -c shacal2.cpp g++ -DNDEBUG -g2 -O3 -DCRYPTOPP_DISABLE_AVX2 -fPIC -pthread -pipe -c shacal2_simd.cpp g++ -DNDEBUG -g2 -O3 -DCRYPTOPP_DISABLE_AVX2 -fPIC -pthread -pipe -c shake.cpp In file included from shake.cpp:21: shake.h: In constructor 'CryptoPP::SHAKE128::SHAKE128(unsigned int)': shake.h:128: error: class 'CryptoPP::SHAKE128' does not have any field named 'SHAKE_Final' shake.h: In constructor 'CryptoPP::SHAKE256::SHAKE256(unsigned int)': shake.h:158: error: class 'CryptoPP::SHAKE256' does not have any field named 'SHAKE_Final' make: *** [shake.o] Error 1 ```
compile error when building version 810
https://api.github.com/repos/weidai11/cryptopp/issues/818/comments
2
2019-03-18T11:15:50Z
2019-03-18T12:08:27Z
https://github.com/weidai11/cryptopp/issues/818
422,163,085
818
[ "weidai11", "cryptopp" ]
I found a strange behaviour using a `FileSource` to decrypt a text encrypted with AES/EAX using both channels provided by `AuthenticatedEncryptionFilter` and `AuthenticatedDecryptionFilter`: it seems that the operations sequence used (successfully) with a `StringSource` cannot be used with a `FileSource` instead. Digging into the library code, I think the reason is that `AuthenticatedDecryptionFilter` does not redefine the `ChannelPutModifiable2` method, but only the `ChannelPut2` one. I don't know whether `AuthenticatedDecryptionFilter` is really bugged or not, but it sounds odd to me that the code working with a `StringSource` does not work with a `FileSource`, so I searched a way to remove this discrepancy. The attached code, adapted from the Crypto++ Wiki example [EAX-AEAD-Test.zip](https://www.cryptopp.com/w/images/b/bd/EAX-AEAD-Test.zip), shows what I found: * sections from 1 to 4 are more or less like the original code; * section 5 decrypts (successfully) the text in `cipher` using a `StringSource` by first putting the authenticated data into the AAD channel and then pumping all the source contents; * section 6 writes `cipher` into a file; * section 7 tries to decrypt this file using a `FileSource` and the same operations used in section 5, but the library throws an `InvalidArgument` exception; * section 8 decrypts (successfully) the file like in section 7, but using a modified version of `AuthenticatedDecryptionFilter` with the method `ChannelPutModifiable2` redefined; * section 9 does the same as section 8, with another modified version of `AuthenticatedDecryptionFilter` (I don't know if either this "fix" or the other could be right: they are simply two ways to mimic what happens in the `StringSource` case, i.e. to call `m_hashVerifier.ForceNextPut()` at the right moment). The program output is the following: ``` Crypto++ Version: 810 key: 0000000000000000000000000000000000000000000000000000000000000000 iv: 000000000000000000000000 adata: 00000000000000000000000000000000 pdata: 00000000000000000000000000000000 cipher: A67F548596FDF6C457402F467A10E2B270586FD20C3A1564051C48C436873C57 adata (received): 00000000000000000000000000000000 pdata (recovered): 00000000000000000000000000000000 adata (received): 00000000000000000000000000000000 pdata (recovered from string): 00000000000000000000000000000000 Caught InvalidArgument... AES/EAX: additional authenticated data (AAD) cannot be input after data to be encrypted or decrypted adata (received): 00000000000000000000000000000000 pdata (recovered from file - bug fixed 1): 00000000000000000000000000000000 adata (received): 00000000000000000000000000000000 pdata (recovered from file - bug fixed 2): 00000000000000000000000000000000 ``` I'm using Crypto++ 8.1.0 build with Visual Studio 2012 and the OS is Windows 10 Pro (1803). [CryptoPP_test.cpp](https://github.com/weidai11/cryptopp/files/2937246/CryptoPP_test.cpp.txt)
AuthenticatedDecryptionFilter with AAD throws an exception when used with a FileSource
https://api.github.com/repos/weidai11/cryptopp/issues/817/comments
6
2019-03-06T16:28:45Z
2020-12-20T01:10:25Z
https://github.com/weidai11/cryptopp/issues/817
417,895,688
817
[ "weidai11", "cryptopp" ]
This has been mentioned in the wiki as a possible solution. Since I've upgraded my code to C++17 and `std::byte`, I have to `reinterpret_cast` my buffers to `CryptoPP::byte`. I think this is a usability issue. Can you add overloads that take `std::byte*` to functions that take `CryptoPP::byte*`?
Add std::byte overloads
https://api.github.com/repos/weidai11/cryptopp/issues/816/comments
5
2019-03-06T16:21:09Z
2019-03-09T16:45:06Z
https://github.com/weidai11/cryptopp/issues/816
417,891,752
816
[ "weidai11", "cryptopp" ]
This is a side/tangential issue from [Issue 812](https://github.com/weidai11/cryptopp/issues/812#issuecomment-468215577). Here is the relevant information from the 812 issue: ----- You actually tickled a bug in our Makefile. I've known about it for several years, but I never addressed it. The problem is, we don't build correctly when make is invoked like below because make overrides the flags we would add. ``` make CXXFLAGS="..." ``` Here's the reason it happens. It is our default recipe: ``` # We determine we need some flag, but CXXFLAGS is # read-only due to 'make CXXFLAGS="..."' CXXFLAGS += <some flag> ... %.o : %.cpp $(CXX) $(strip $(CXXFLAGS) -c) $< ``` This is what we should be doing. It is textbook Stallman from the GNU Make manual: ``` # We determine we need some flag OUR_CXXFLAGS += <some flag> ... %.o : %.cpp $(CXX) $(strip $(OUR_CXXFLAGS) $(CXXFLAGS) -c) $< ``` Now it does not matter how you invoke make. Things just work for you. And it follows Stallman's freedom philosophy. The user's `CXXFLAGS` always takes precedence over `OUR_CXXFLAGS`. Since someone tickled it in the field I am going to get it fixed.
GNUmakefile needs to use separate variable for CXXFLAGS
https://api.github.com/repos/weidai11/cryptopp/issues/814/comments
2
2019-02-28T10:32:59Z
2020-12-20T01:10:39Z
https://github.com/weidai11/cryptopp/issues/814
415,553,544
814
[ "weidai11", "cryptopp" ]
The makefile tries to pre-qualify NEON (for lack of a better term), and sets `IS_NEON` accordingly. If `IS_NEON=1`, then we go on to perform test compiles to see if `-mfloat-abi=X -mfpu=neon` (and friends) actually work. Effectively we are performing a test to see if we should perform another test. The `IS_NEON` flag predates our compile time feature tests. It was kind of helpful when we were trying to sort out if a platform and compiler options supported NEON without a compile test. That was an absolute mess and we quickly learned we needed a real compile time feature test (which we now have). Additionally, Debian and Fedora ARMEL builds are failing because we are misdetecting NEON availability. It looks like we fail to set `IS_NEON` properly, so we never get into the code paths that set either (1) `-mfloat-abi=X -mfpu=neon` or (2) `-DCRYPTOPP_DISABLE_NEON` or `-DCRYPTOPP_DISABLE_ASM`. Later, the makefile builds a `*_simd.cpp` and the result is an error that NEON needs to be activated (or disabled). This commit removes IS_NEON so we immediately move to compile time feature tests.
Remove IS_NEON from Makefile
https://api.github.com/repos/weidai11/cryptopp/issues/813/comments
1
2019-02-28T00:34:46Z
2020-12-20T01:10:51Z
https://github.com/weidai11/cryptopp/issues/813
415,391,575
813
[ "weidai11", "cryptopp" ]
Using Fedora 30, I cannot update to cryptopp 8.0.0/8.1.0 Seems like CPU features are miss-detected as I cannot see any ASM_FLAGS been used in "some" cases. Build attempt for f31,f29, f28 https://koji.fedoraproject.org/koji/taskinfo?taskID=33066081 https://koji.fedoraproject.org/koji/taskinfo?taskID=33066857 https://koji.fedoraproject.org/koji/taskinfo?taskID=33067570 I'm using the default GNUMake files to build using: %make_build -f GNUmakefile \ CXXFLAGS="-DNDEBUG %{optflags} -fPIC -DPIC" \ LDFLAGS="%{?__global_ldflags}" \ shared cryptest.exe
Build fails on fedora30+ (CPU features miss-detected)
https://api.github.com/repos/weidai11/cryptopp/issues/812/comments
11
2019-02-26T17:12:18Z
2019-02-28T11:45:02Z
https://github.com/weidai11/cryptopp/issues/812
414,723,029
812
[ "weidai11", "cryptopp" ]
### Crypto++ 8.0 Issue Report GCC 4.7 (gcc-linaro-arm-linux-gnueabihf-4.7) with ARMv8 and NEON enabled: ``` -march=armv7-a -mfpu=neon-vfpv4 ``` We encrypt the plaintext with Speck128-128 and dcrypt it immediately on a Freescale i.MX6 UltraLite processor, and the result is wrong. If we disabled the NEON optimization by `#undef CRYPTOPP_ARM_NEON_AVAILABLE` at the begin of speck.cpp, then everything is ok.
The ARM NEON Speck optimization is wrong
https://api.github.com/repos/weidai11/cryptopp/issues/808/comments
30
2019-02-14T22:09:58Z
2019-02-15T18:59:16Z
https://github.com/weidai11/cryptopp/issues/808
410,515,188
808
[ "weidai11", "cryptopp" ]
### Crypto++ 8.0 Issue Report We have some disk data encrypted by Crypto++ 7.0 with ChaCha8, We use the same 8 rounds ChaCha algorithm provided by 8.0 to decrypt it with exactly same key and iv, but the result is wrong. We have try a few other algorithms, both encrypted using 7.0, then decrypt them use the 8.0, they all working fine. So only ChaCha failed, is there something changed (on the algorithm level)? Compiler: VC2005; Target: MSW/x86-32
ChaCha Algorithm changed?
https://api.github.com/repos/weidai11/cryptopp/issues/807/comments
15
2019-02-13T21:41:11Z
2019-02-23T05:23:40Z
https://github.com/weidai11/cryptopp/issues/807
410,016,057
807