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"
] | Simple program that attempts to calculate message digest from string compiles without warnings,
but then crashes. gdb shows the following:
```
Program received signal SIGSEGV, Segmentation fault.
0x000000000049e6db in CryptoPP::SHA3::TruncatedFinal (this=0x7fffffffd7e0,
hash=0x7fffffffd960 "\270\f\257\367\377\177", size=256) at sha3.cpp:284
284 m_state.BytePtr()[r()-1] ^= 0x80;
(gdb) bt
#0 0x000000000049e6db in CryptoPP::SHA3::TruncatedFinal (this=0x7fffffffd7e0,
hash=0x7fffffffd960 "\270\f\257\367\377\177", size=256) at sha3.cpp:284
#1 0x000000000040423f in CryptoPP::HashTransformation::CalculateDigest (this=0x7fffffffd7e0,
digest=0x7fffffffd960 "\270\f\257\367\377\177", input=0x71a078 "Räksmörgås 12", length=16)
at /usr/include/cryptopp/cryptlib.h:928
#2 0x0000000000403882 in sha3 (message=...) at sha3.cpp:30
#3 0x0000000000403bfa in main (argc=1, argv=0x7fffffffdbf8) at sha3.cpp:53
(gdb) up
#1 0x000000000040423f in CryptoPP::HashTransformation::CalculateDigest (this=0x7fffffffd7e0,
digest=0x7fffffffd960 "\270\f\257\367\377\177", input=0x71a078 "Räksmörgås 12", length=16)
at /usr/include/cryptopp/cryptlib.h:928
928 {Update(input, length); Final(digest);}
(gdb)
```
Any ideas what is wrong?
| SHA3 CalculateDigest() results in SIGSEGV | https://api.github.com/repos/weidai11/cryptopp/issues/128/comments | 2 | 2016-01-29T11:06:24Z | 2016-01-29T14:57:33Z | https://github.com/weidai11/cryptopp/issues/128 | 129,734,221 | 128 |
[
"weidai11",
"cryptopp"
] | This caught my eye from the CFE-Users mailing list: [static inline functions in headers and -Wunused-function](http://lists.llvm.org/pipermail/cfe-users/2016-January/000854.html) (Thread view available at [January 2016 Archives by thread](http://lists.llvm.org/pipermail/cfe-users/2016-January/thread.html)). It caught my eye because of **_`StringNarrow`**_.
If I am parsing the thread correctly, then **_`static inline`**_ should not be used on a function in a header _when_ the header includes the definition.
According to David Blaikie, who answered the question and is likely a LLVM dev:
> They [static inline functions in the header] should probably just be "inline" without the static.
>
> static functions are distinct functions per translation unit - so having static functions in headers has a number of problems:
> - The function definitions won't be deduplicated by the linker across object files -> code bloat (larger binaries) & address inequality
> - This can lead to technical (& undiagnosed) Undefined Behavior due to ODR violations
>
> Consider the following header:
>
> ```
> static inline void f() { }
> struct foo {
> void g() { f(); }
> };
> ```
>
> Include that header in two .cpp files, compile and link the two objects together and the program now violates the ODR..
---
A quick audit reveals the following.
```
$ grep static * | grep inline | grep -v "\.cpp"
idea.h: static inline void LookupMUL(word &a, word b);
iterhash.h: inline static void CorrectEndianess(HashWordType *out, const HashWordType *in, size_t byteCount)
misc.h:static inline std::string StringNarrow(const wchar_t *str, bool throwOnError = true)
misc.h: static inline GetBlock<T, B, GA> Get(const void *block) {return GetBlock<T, B, GA>(block);}
misc.h: static inline T RightShift(T value, unsigned int bits)
misc.h: static inline T LeftShift(T value, unsigned int bits)
misc.h: static inline T RightShift(T value, unsigned int bits)
misc.h: static inline T LeftShift(T value, unsigned int bits)
```
---
Also see the following threads on the User Group:
- [cryptopp/misc.h:548:20: warning: unused function 'StringNarrow' [-Wunused-function]](http://groups.google.com/forum/#!topic/cryptopp-users/ySAaAdTPGwY)
- [Use of static inline functions in headers may violate ODR and lead to UB (Issue 127)](http://groups.google.com/forum/#!topic/cryptopp-users/0dW8ghx2vdQ)
| Use of static inline functions in headers may violate ODR and lead to UB | https://api.github.com/repos/weidai11/cryptopp/issues/127/comments | 2 | 2016-01-28T21:39:31Z | 2016-01-30T19:04:02Z | https://github.com/weidai11/cryptopp/issues/127 | 129,590,513 | 127 |
[
"weidai11",
"cryptopp"
] | It seems that code in IncrementCounterByOne has minor but very important bug which I've already
fixed in my branch:
```
inline void IncrementCounterByOne(byte *output, const byte *input, unsigned int size)
{
assert(output != NULL); assert(input != NULL); assert(size < INT_MAX);
int i, carry;
for (i=int(size-1), carry=1; i>=0 && carry; i--)
carry = ((output[i] = input[i+1]) == 0);
memcpy_s(output, size, input, i+1);
}
```
| misc.h IncrementCounterByOne (output, input, size) | https://api.github.com/repos/weidai11/cryptopp/issues/126/comments | 9 | 2016-01-28T13:03:00Z | 2016-01-29T14:54:44Z | https://github.com/weidai11/cryptopp/issues/126 | 129,446,600 | 126 |
[
"weidai11",
"cryptopp"
] | Compiles fine but crashes with:
crypt: /usr/include/cryptopp/misc.h:304: void CryptoPP::memcpy_s(void_, size_t, const void_, size_t): Assertion `dest != __null' failed.
Aborted (core dumped)
Debugging leads to:
(gdb) up
#5 0x00007ffff79898ff in CryptoPP::AlgorithmParametersBase::GetVoidValue(char const_, std::type_info const&, void_) const () from /usr/lib/libcrypto++.so.9
(gdb)
Could be a good idea to make Base64Encoder.IsolatedInitialize(params) simpler to ease debugging!
| misc.h, memcpy_s assert() fails | https://api.github.com/repos/weidai11/cryptopp/issues/125/comments | 3 | 2016-01-26T09:45:18Z | 2016-01-29T14:56:18Z | https://github.com/weidai11/cryptopp/issues/125 | 128,774,370 | 125 |
[
"weidai11",
"cryptopp"
] | When I was running the test suite compiled with Clang and some optimisation passes, I had an error.
After some research, I found that the asm volatile didn't have the clobbered registers setted ([link](http://www.codeproject.com/Articles/15971/Using-Inline-Assembly-in-C-C)) in the file _rdrand.cpp_.
I am not an expert with asm inlining but I think you must specify the register, especially if you put the byte representation.
I have modify the following line in the function _GCC_RRA_GenerateBlock_:
``` c
__asm__ volatile(
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32
".byte 0x48, 0x0f, 0xc7, 0xf0;\n" // rdrand rax
#else
".byte 0x0f, 0xc7, 0xf0;\n" // rdrand eax
#endif
"setc %1; "
: "=a" (val), "=qm" (rc)
:
: "cc"
);
```
to
``` c
__asm__ volatile(
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32
".byte 0x48, 0x0f, 0xc7, 0xf0;\n" // rdrand rax
#else
".byte 0x0f, 0xc7, 0xf0;\n" // rdrand eax
#endif
"setc %1; "
: "=a" (val), "=qm" (rc)
:
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32
: "cc","rax"
#else
: "cc","eax"
#endif
);
```
| __asm__ volatile missing clobbered registers | https://api.github.com/repos/weidai11/cryptopp/issues/124/comments | 9 | 2016-01-25T13:44:18Z | 2016-09-12T14:17:32Z | https://github.com/weidai11/cryptopp/issues/124 | 128,540,078 | 124 |
[
"weidai11",
"cryptopp"
] | We recently cut-in [little-endian Integers](https://github.com/weidai11/cryptopp/commit/f8091d9a156bbd9cd8aa7fa4bc7cda7a934ad64e). On Microsoft platforms, use of **_`std:reverse_copy`**_ is causing a C4996 warning:
```
1>c:\Program Files\...\VC\include\algorithm(2184): warning C4996: 'std::_Reverse_copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
1> c:\...\VC\include\algorithm(2168) : see declaration of 'std::_Reverse_copy'
1> integer.cpp(2898) : see reference to function template instantiation '_OutIt std::reverse_copy<const byte*,unsigned char*>(_BidIt,_BidIt,_OutIt)' being compiled
1> with
1> [
1> _OutIt=unsigned char *,
1> _BidIt=const byte *
1> ]
```
The offending code is:
```
Integer::Integer(const byte *encodedInteger, size_t byteCount, Signedness s, ByteOrder o)
{
if(o == LITTLE_ENDIAN_ORDER)
{
SecByteBlock block(byteCount);
std::reverse_copy(encodedInteger, encodedInteger+byteCount, block.begin());
Decode(block.begin(), block.size(), s);
return;
}
...
}
```
I think we need to find a Microsoft overload that allows us to specify the destination buffer size. Or we need to use the library's [ByteReverse from misc.h](https://github.com/weidai11/cryptopp/blob/master/misc.h#L1718):
```
template <class T>
void ByteReverse(T *out, const T *in, size_t byteCount);
```
| C4996 warning due to std::reverse_copy on Microsoft platforms | https://api.github.com/repos/weidai11/cryptopp/issues/123/comments | 6 | 2016-01-25T02:14:53Z | 2023-11-23T07:49:10Z | https://github.com/weidai11/cryptopp/issues/123 | 128,444,740 | 123 |
[
"weidai11",
"cryptopp"
] | [`crytest.sh`](https://github.com/weidai11/cryptopp/blob/master/cryptest.sh#L1487) has a couple of tests with elevated warnings. The elevated warnings include `-Wall -Wextra -Wcast-align`. Under GCC 4.9 and Clang 3.7 (and above), its producing about 500 warnings. The test is run four times under **_`{Debug,Release} x {C++03,C++11}`**_, so there's about 2000 in total:
```
24 configurations tested
No failures detected
1980 warnings detected. See cryptest-warn.txt for details
```
Many of the warnings are false positives. For example, in the code below, **_`inBlock`**_ is aligned. Both a code review and runtime assert verified it:
```
warning: cast from 'const byte *' (aka 'const unsigned char *') to 'word64 *'
(aka 'unsigned long long *') increases required alignment from 1 to 8 [-Wcast-align]
word64 tmp = *(word64 *)inBlock ^ roundKeys[0];
^~~~~~~~~~~~~~~~~
```
The warning is generated from:
```
inline SharkProcessAndXorBlock(const word64 *roundKeys, unsigned int rounds, const byte *inBlock, const byte *xorBlock, byte *outBlock)
{
assert(IsAlignedOn(inBlock, GetAlignmentOf<word64>()));
word64 tmp = *(word64 *)inBlock ^ roundKeys[0];
...
}
```
We found we can clear the warning with a cast to `void*`:
```
word64 tmp = *(word64 *)(void*)inBlock ^ roundKeys[0];
```
Once we remove the spurious warnings, we may be left with a handful of valid ones. The valid ones are expected to be a cast to/from double/float/integral, which can result in a **_`SIGBUS`**_.
This issue will serve to add the assert to all affected variables, and then perform the intermediate cast to `void*`.
| Warning when using -Wcast-align with modern GCC and Clang | https://api.github.com/repos/weidai11/cryptopp/issues/122/comments | 2 | 2016-01-24T19:32:34Z | 2016-01-28T00:10:37Z | https://github.com/weidai11/cryptopp/issues/122 | 128,419,244 | 122 |
[
"weidai11",
"cryptopp"
] | We've had some suggestions/requests to add deterministic DSA and ECDSA signatures to the library. [RFC 6769](https://tools.ietf.org/html/rfc6979) discusses the reasons for them in-depth. The abbreviated version is:
- hardening - ensure **_`k`**_ is not accidentally weak
- testability - repeatable results to ensure proper operation
- compatibility - completely compatible with existing schemes
I think its a good idea, especially on resource constrained devices, like IoT gadgets. (I'm not sure how much signing they will do, but they will be able to do it if needed)
The mailing list discussion is available at [Deterministic DSA and ECDSA Signatures](https://groups.google.com/forum/#!topic/cryptopp-users/t-EaRGNLn4s).
A thread on the [TLS Working Group](https://www.ietf.org/mail-archive/web/tls/current/msg19111.html) mailing list is also discussing the change in the context of the IETF and TLS. The [CFRG](http://irtf.org/cfrg) may provide feedback or make a recommendation.
If we decide to move forward, I believe the way to approach this is similar to a new <strike>signature encoding method</strike> `SignatureScheme`. To that end, the library has an interface for this operation in <strike>`pubkey.h`</strike> `gfpcrypt.h` by way of <strike>[`PK_DeterministicSignatureMessageEncodingMethod`](http://www.cryptopp.com/docs/ref/class_p_k___deterministic_signature_message_encoding_method.html)</strike> [`DL_Algorithm_GDSA`](https://www.cryptopp.com/docs/ref/class_d_l___algorithm___g_d_s_a.html). Expand the inheritance diagram for the best view.
This ticket tracks the request and the progress.
| Deterministic DSA and ECDSA Signatures | https://api.github.com/repos/weidai11/cryptopp/issues/121/comments | 24 | 2016-01-24T14:42:41Z | 2018-02-21T09:03:32Z | https://github.com/weidai11/cryptopp/issues/121 | 128,401,146 | 121 |
[
"weidai11",
"cryptopp"
] | Below is from a [LeMaker HiKey](http://www.amazon.com/dp/B019O3QTSA). The device is ARM64 with a Coretx-A53 octa-core and 1GB or RAM.
```
$ ./cryptest.sh
HAVE_CXX03: 1
HAVE_CXX11: 1
HAVE_ASAN: 0
HAVE_UBSAN: 0
HAVE_VALGRIND: 1
IS_LINUX: 1
CPU: 8 logical, MEM: 949 MB
Compiler: g++ (Debian/Linaro 4.9.2-10) 4.9.2
make
...
g++ -DDEBUG -g2 -O2 -fPIC -pipe -c regtest.cpp
Message from syslogd@hikey at Jan 23 19:30:58 ...
kernel:[409934.625121] Call trace:
{standard input}: Assembler messages:
{standard input}:913941: Warning: end of file not at end of a line; newline inserted
{standard input}:913986: Error: unknown pseudo-op: `.b'
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
GNUmakefile:642: recipe for target 'regtest.o' failed
make: *** [regtest.o] Error 4
```
| g++: internal compiler error: Killed when using -pipe with regtest.cpp | https://api.github.com/repos/weidai11/cryptopp/issues/120/comments | 2 | 2016-01-24T00:39:54Z | 2022-12-26T18:40:58Z | https://github.com/weidai11/cryptopp/issues/120 | 128,363,649 | 120 |
[
"weidai11",
"cryptopp"
] | Here is the output of the compilation with gcc-4.9 or gcc-5 toolchains of Android NDK (official 10e and CrystaX 10.3.1):
```
[armeabi] Compile++ thumb: cryptopp_static <= integer.cpp
/opt/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF /Users/cawka/Devel/devel/cryptopp/extras/obj/local/armeabi/objs/cryptopp_static/__/__/integer.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include -I/opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -I/opt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -I/Users/cawka/Devel/devel/cryptopp/extras/jni -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security -fexceptions -frtti -I/opt/android-ndk-r10e/platforms/android-21/arch-arm/usr/include -c /Users/cawka/Devel/devel/cryptopp/extras/jni/../../integer.cpp -o /Users/cawka/Devel/devel/cryptopp/extras/jni/../../integer.cpp: In constructor 'CryptoPP::InitializeInteger::InitializeInteger()':
/Users/cawka/Devel/devel/cryptopp/extras/jni/../../integer.cpp:2792:25: error: invalid conversion from 'bool (*)(const std::type_info&, void*, const void*)' to 'CryptoPP::PAssignIntToInteger {aka bool (*)(const std::type_info&, void*, const void*)}' [-fpermissive]
g_pAssignIntToInteger = AssignIntToInteger;
^
/Users/cawka/Devel/devel/cryptopp/extras/jni/../../integer.cpp: At global scope:
/Users/cawka/Devel/devel/cryptopp/extras/jni/../../integer.cpp:4491:10: warning: #pragma GCC target is not supported for this machine [-Wpragmas]
# pragma GCC pop_options
^
[armeabi] Compile++ thumb: cryptopp_static <= md2.cpp
```
I'm kind of puzzled on what exactly compiler doesn't like: the suggested conversion seem to be exactly the same type.
Note that the issue doesn't exist for x86, x86_64, mips (and may be others) platforms. If I compile with gcc 4.8, clang3.7 toolchain, the issue also doesn't exist.
Is it some kind of compiler (gcc 4.9, gcc 5.0) bug or there is some missing flag?
| Failure on to compile for armeabi using android NDK | https://api.github.com/repos/weidai11/cryptopp/issues/119/comments | 12 | 2016-01-22T01:40:41Z | 2016-01-24T21:31:08Z | https://github.com/weidai11/cryptopp/issues/119 | 128,062,330 | 119 |
[
"weidai11",
"cryptopp"
] | According to [the wiki](https://cryptopp.com/wiki/Release_process#Executing_the_Script),
> The script takes between 3 hours to 3 days to run.
which is quite a long time-span.
I've had a quick look into the script (I'm not a script wizard :( ) and it looked like everything was executed linearly. Now most modern machines have at least 2 cores.
Can the (cryptest) script be adapted to (automatically) scale with the number of cores?
---
Another (smaller) issue: Given an empty (recent) debian / ubuntu / fedora setup, what packages are needed to run the script?
---
Last question: Is the output the same, if you look at the console output versus `> file.txt`-'ing it?
| Optimizing the test script | https://api.github.com/repos/weidai11/cryptopp/issues/117/comments | 13 | 2016-01-17T12:49:31Z | 2016-01-24T02:57:12Z | https://github.com/weidai11/cryptopp/issues/117 | 127,093,024 | 117 |
[
"weidai11",
"cryptopp"
] | There recently was [a question over at Crypto.SE about the speed of ECGDSA vs ECKCDSA vs ECDSA](http://crypto.stackexchange.com/q/31853/23623). The question showed a general lack of implementation of the former two schemes and so I though to bring it up here.
I'm hereby proposing to adding support for ECGDSA (EC German DSA) and ECKCDSA (EC Korean Certificate DSA) for Crypto++.
Note that once you've finished ECGDSA you can easily do ECKCDSA with the gained knowledge because they are both highly similar.
The strategy proposal for implementors:
1) Identify where the signature / verification logic for ECDSA is situated at
2) Copy, rename and adapt the relevant classes
3) Provide a new file (add it to the same place where ECDSA is) to allow people to use the new algorithms
As for the certificate hashing part, you need to assume that the certificate is prepended to the message to be signed.
The following ressources may be useful for the implementation:
1) [Siemens' original specification](https://www.teletrust.de/fileadmin/files/oid/ecgdsa_final.pdf) (GDSA only + many test vectors)
2) [BSI's TR-03111](https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publications/TechGuidelines/TR03111/BSI-TR-03111_pdf.pdf;jsessionid=1DE78E2010CFB9DBB5FCF76DBDB035DE.2_cid368?__blob=publicationFile&v=1) (ECGDSA + ECKCDSA no test vectors)
3) [KCDSA's original specification](http://grouper.ieee.org/groups/1363/P1363a/contributions/kcdsa1363.pdf) (KCDSA only + including one test vector)
If nobody picks it up until I have finished my current ECPE work, I'll do it after wards.
| Add support for EC-GDSA and EC-KCDSA | https://api.github.com/repos/weidai11/cryptopp/issues/113/comments | 7 | 2016-01-12T19:47:00Z | 2017-10-07T21:44:43Z | https://github.com/weidai11/cryptopp/issues/113 | 126,260,114 | 113 |
[
"weidai11",
"cryptopp"
] | Most of my compressed data samples `Inflator` class decompresses just fine. But on some compressed data it throws "Inflator: unexpected end of compressed block" yet the data is valid and complete. Adding one extra byte of ANY VALUE to the end of such data makes `Inflator` to decompress it without errors.
See the attached sample code and data file that reproduces the problem: [default.gz](https://github.com/weidai11/cryptopp/files/87843/default.gz)
P.S. GitHub stuck on uploading sample C++ code in a separate file so I am pasting it here:
``` C++
#include <cstdio>
#include "cryptopp/gzip.h"
using namespace CryptoPP;
int main()
{
byte in[20000], out[70000];
const size_t file_size = 16782;
FILE* f = fopen("!.gz", "rb");
fread(in, 1, file_size, f);
fclose(f);
// Works fine:
//ArraySource(in, file_size, true, new Gunzip(new ArraySink(out, sizeof(out))));
// GZIP data in test file has 10 bytes of GZIP header and 8 bytes of footer (CRC32 and ISIZE, see http://www.rfc-editor.org/rfc/rfc1952.txt).
// So we offset "in" by 10 bytes and the size of actual compressed data (without GZIP header and footer) would be (file_size - 18) bytes.
// Yet the following line of code throws "Inflator: unexpected end of compressed block".
ArraySource(in + 10, file_size - 18, true, new Inflator(new ArraySink(out, sizeof(out))));
// If at least one extra byte of data is passed to the Inflator (the value of that byte of data makes no difference) no exception is thrown.
//in[file_size - 8] = 0xFF; // value of extra byte makes no difference
//ArraySource(in + 10, file_size - 18 + 1, true, new Inflator(new ArraySink(out, sizeof(out))));
}
```
| Inflator throws end of compressed block on complete compressed data | https://api.github.com/repos/weidai11/cryptopp/issues/112/comments | 18 | 2016-01-12T19:03:38Z | 2016-04-11T12:35:04Z | https://github.com/weidai11/cryptopp/issues/112 | 126,250,921 | 112 |
[
"weidai11",
"cryptopp"
] | Brad from the mailing list [reports the following program causes a segmentation fault on Linux](https://groups.google.com/d/msg/cryptopp-users/5oOQ_8CW0q4/lwUeXwBwBAAJ). The issue was also confirmed on OS X.
```
#include <iostream>
#include <sstream>
#include <string>
#include <cryptopp/base32.h>
// This file is intended to debug base32 decoding issues in CryptoPP
// when using an alternate alphabet. By default, CryptoPP uses DUDE
// for base32 encoding/decoding. Most other libraries use RFC4648.
// This creates compatibility issues.
// DUDE - http://tools.ietf.org/html/draft-ietf-idn-dude-02
// RFC 4648 - http://tools.ietf.org/html/rfc4648
// Note - Alternate alphabet encoding works, but decoding fails
// with a stack overflow.
static const byte ALPHABET[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; // RFC4648
static const std::string test_encoded = "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ";
static const std::string test_raw = "12345678901234567890";
const std::string encode( const std::string& raw )
{
// This function correctly encodes RFC4648
std::string encoded;
CryptoPP::Base32Encoder b32encoder;
CryptoPP::AlgorithmParameters ep = CryptoPP::MakeParameters(
CryptoPP::Name::EncodingLookupArray(),
(const byte *)ALPHABET,
false);
b32encoder.IsolatedInitialize(ep);
b32encoder.Attach( new CryptoPP::StringSink( encoded ) );
b32encoder.Put( (std::uint8_t*)raw.c_str(), raw.size() );
b32encoder.MessageEnd();
return encoded;
}
const std::string decode( const std::string& encoded )
{
std::string decoded;
static int decoding_array[256];
CryptoPP::Base32Decoder::InitializeDecodingLookupArray(decoding_array,
ALPHABET,
32,
true); // false = case insensitive
CryptoPP::Base32Decoder b32decoder;
CryptoPP::AlgorithmParameters dp = CryptoPP::MakeParameters(
CryptoPP::Name::DecodingLookupArray(),
(const int *)decoding_array,
false);
b32decoder.IsolatedInitialize(dp);
b32decoder.Attach( new CryptoPP::StringSink( decoded ) );
b32decoder.Put( (std::uint8_t*)encoded.c_str(), encoded.size() );
b32decoder.MessageEnd();
return decoded;
}
int main()
{
// Test encoding
const std::string e = encode( test_raw );
if( e == test_encoded )
{
std::cout << "'" << test_raw << "' encodes to '" << e << "' RFC4648 Encoding works!\n";
}
else
{
std::cout << e << " RFC4648 Encoding failed\n";
}
// Test decoding
const std::string d = decode( test_encoded );
if( d == test_raw )
{
std::cout << d << " RFC4648 Decoding works!\n";
}
else
{
std::cout << d << " RFC4648 Decoding failed\n";
}
return 0;
}
```
| Crash when trying to set alternate alphabet for Base32 decoder | https://api.github.com/repos/weidai11/cryptopp/issues/108/comments | 7 | 2016-01-12T00:34:12Z | 2018-06-15T15:48:20Z | https://github.com/weidai11/cryptopp/issues/108 | 126,070,490 | 108 |
[
"weidai11",
"cryptopp"
] | I'm trying to use the PEM pack available on the wiki https://www.cryptopp.com/wiki/PEM_Pack but it's missing the pem-com.h file.
Would it be possible to update it? I understand the PEM pack is not officially part of Crypto++ but I thought someone might have it since it's hosted on the official wiki
| pem-com.h missing from PEM pack archive | https://api.github.com/repos/weidai11/cryptopp/issues/106/comments | 3 | 2016-01-08T19:23:01Z | 2017-05-01T19:57:56Z | https://github.com/weidai11/cryptopp/issues/106 | 125,675,831 | 106 |
[
"weidai11",
"cryptopp"
] | Valgrind is reporting an uninitialized read under 32-bit ARM. The device is a BeagleBone Black running Debian 8.2.
The open question at the moment is Debian's Valgrind-3.10.0 and LibVEX. The library has experienced false positives in the past that were cleared with 3.11.
We need to wait until `cryptest.sh` is finished its run before the processor becomes free to build Valgrind and then perform another run. Also, the `AutoSeededX917RNG` test was added recently.
```
==18642== Use of uninitialised value of size 4
==18642== at 0x12B4A4: CryptoPP::Rijndael::Enc::ProcessAndXorBlock(unsigned char const*, unsigned char const*, unsigned char*) const (rijndael.cpp:399)
==18642== by 0xFBD9B: ProcessBlock (cryptlib.h:735)
==18642== by 0xFBD9B: CryptoPP::X917RNG::X917RNG(CryptoPP::BlockTransformation*, unsigned char const*, unsigned char const*) (rng.cpp:73)
==18642== by 0x118F43: CryptoPP::AutoSeededX917RNG<CryptoPP::Rijndael>::Reseed(unsigned char const*, unsigned int, unsigned char const*, unsigned char const*) (osrng.h:209)
==18642== by 0x119391: CryptoPP::AutoSeededX917RNG<CryptoPP::Rijndael>::Reseed(bool, unsigned char const*, unsigned int) (osrng.h:231)
==18642== by 0x1193F9: CryptoPP::AutoSeededX917RNG<CryptoPP::Rijndael>::AutoSeededX917RNG(bool, bool) (in /home/jwalton/cryptopp/cryptest.exe)
==18642== by 0x71D53: TestAutoSeededX917() (validat1.cpp:968)
==18642== by 0x76129: ValidateAll(bool) (validat1.cpp:69)
==18642== by 0x65DC3: Validate(int, bool, char const*) (test.cpp:870)
==18642== by 0x6A237: main (test.cpp:342)
==18642== Uninitialised value was created by a heap allocation
==18642== at 0x483E394: malloc (vg_replace_malloc.c:296)
==18642== by 0xB83D7: CryptoPP::UnalignedAllocate(unsigned int) (misc.cpp:198)
==18642== by 0xFBC33: allocate (secblock.h:184)
==18642== by 0xFBC33: SecBlock (secblock.h:441)
==18642== by 0xFBC33: CryptoPP::X917RNG::X917RNG(CryptoPP::BlockTransformation*, unsigned char const*, unsigned char const*) (rng.cpp:67)
==18642== by 0x118F43: CryptoPP::AutoSeededX917RNG<CryptoPP::Rijndael>::Reseed(unsigned char const*, unsigned int, unsigned char const*, unsigned char const*) (osrng.h:209)
==18642== by 0x119391: CryptoPP::AutoSeededX917RNG<CryptoPP::Rijndael>::Reseed(bool, unsigned char const*, unsigned int) (osrng.h:231)
==18642== by 0x1193F9: CryptoPP::AutoSeededX917RNG<CryptoPP::Rijndael>::AutoSeededX917RNG(bool, bool) (in /home/jwalton/cryptopp/cryptest.exe)
==18642== by 0x71D53: TestAutoSeededX917() (validat1.cpp:968)
==18642== by 0x76129: ValidateAll(bool) (validat1.cpp:69)
==18642== by 0x65DC3: Validate(int, bool, char const*) (test.cpp:870)
==18642== by 0x6A237: main (test.cpp:342)
==18642==
...
==18642==
==18642== HEAP SUMMARY:
==18642== in use at exit: 0 bytes in 0 blocks
==18642== total heap usage: 1,868,454 allocs, 1,868,454 frees, 142,291,810 bytes allocated
==18642==
==18642== All heap blocks were freed -- no leaks are possible
==18642==
==18642== For counts of detected and suppressed errors, rerun with: -v
==18642== ERROR SUMMARY: 90 errors from 18 contexts (suppressed: 0 from 0)
```
| Valgrind reports unintialized reads under 32-bit ARM | https://api.github.com/repos/weidai11/cryptopp/issues/105/comments | 3 | 2016-01-08T03:03:57Z | 2016-01-10T22:54:44Z | https://github.com/weidai11/cryptopp/issues/105 | 125,532,854 | 105 |
[
"weidai11",
"cryptopp"
] | Is there a better way to send patches? I don't have a github clone of your repo.
```
index a6a2700..a39df88 100644
--- a/test.cpp
+++ b/test.cpp
@@ -796,8 +796,9 @@ void ForwardTcpPort(const char *sourcePortName, const char *destinationHost, con
sockListen.Create();
sockListen.Bind(sourcePort);
-
- int err = setsockopt(sockListen, IPPROTO_TCP, TCP_NODELAY, "\x01", 1);
+
+ int one = 1;
+ int err = setsockopt(sockListen, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one));
assert(err == 0);
if(err != 0)
throw Socket::Err(sockListen, "setsockopt", sockListen.GetLastError());
```
| setsockopt EINVAL with cryptopp ft 9109 example.com 80 | https://api.github.com/repos/weidai11/cryptopp/issues/104/comments | 5 | 2016-01-07T19:41:43Z | 2016-01-08T20:11:51Z | https://github.com/weidai11/cryptopp/issues/104 | 125,470,205 | 104 |
[
"weidai11",
"cryptopp"
] | I'm facing a heap corruption if i compile the actual git Version on Windows x86 (using Visual Studio 2015 on Win10), see the minimal code example below!
``` c++
#include <iostream>
#if defined(WIN32)
#include <windows.h>
#endif
#include "cryptopp/cryptlib.h"
#include "cryptopp/hex.h"
#include "cryptopp/sha.h"
#include "cryptopp/sha3.h"
#include "cryptopp/secblock.h"
#include "cryptopp/oids.h"
#include "cryptopp/asn.h"
#include "cryptopp/osrng.h"
#include "cryptopp/pwdbased.h"
#include "cryptopp/integer.h"
#include "cryptopp/aes.h"
#include "cryptopp/gcm.h"
#include "cryptopp/filters.h"
#include "cryptopp/eccrypto.h"
#include "cryptopp/dsa.h"
#include "cryptopp/queue.h"
int main(int argc, char* argv[]) {
CryptoPP::OID CURVE = CryptoPP::ASN1::brainpoolP512r1();
CryptoPP::AutoSeededRandomPool rng(true, 64);
//everything fine
CryptoPP::ECDH < CryptoPP::ECP >::Domain dh(CURVE);
//heap corruption
CryptoPP::SecByteBlock privatKey(dh.PrivateKeyLength()), publicKey(dh.PublicKeyLength());
dh.GenerateKeyPair(rng, privatKey, publicKey);
std::string priKey, pubKey;
CryptoPP::HexEncoder hex(new CryptoPP::StringSink(priKey));
hex.Put(privatKey.data(), privatKey.size());
hex.MessageEnd();
CryptoPP::HexEncoder hex2(new CryptoPP::StringSink(pubKey));
hex2.Put(publicKey.data(), publicKey.size());
hex2.MessageEnd();
std::cout << "Private Key: " << priKey << std::endl << "Public Key: " << pubKey;
return 0;
}
```
(link against _cryptlib.lib_ and _ws2_32.lib_)
If i get it right the problem is the assignment in line 464 in the file _eccrypto.cpp_ which happens to execute line 2951 in _integer.cpp_.
And there the **reg** value looks like this:
```
reg {m_alloc={...} m_size=3435973836 m_ptr=0x00000002 {???} }
CryptoPP::SecBlock<unsigned int,CryptoPP::AllocatorWithCleanup<unsigned int,1> >
```
This then happens to be deallocated and there the heap corruption appears (see the m_ptr)!
All self tests with the cryptest.exe run through by the way.
| Heap Corruption on Windows | https://api.github.com/repos/weidai11/cryptopp/issues/103/comments | 11 | 2016-01-07T10:55:58Z | 2016-01-11T13:06:43Z | https://github.com/weidai11/cryptopp/issues/103 | 125,371,316 | 103 |
[
"weidai11",
"cryptopp"
] | Hello, I was having problems compiling Crypto++ with C++Builder XE6 in 64-bit (Clang compiler). Here is the message I was getting:
```
[bcc64 Error] pkcspad.h(79): call to constructor of 'HashIdentifier' (aka 'pair<const byte *, size_t>') is ambiguous
```
My first move was to cast the second parameter as **size_t**:
``` cpp
return HashIdentifier(PKCS_DigestDecoration<H>::decoration, (size_t)PKCS_DigestDecoration<H>::length);
```
It was now compiling correctly, but I felt like this was not the proper fix. So instead I changed the **length** property from **unsigned int** to **size_t**:
``` cpp
template <class H> class PKCS_DigestDecoration
{
public:
static const byte decoration[];
static const size_t length; // It was unsigned int before
};
```
Some other other files were also changed. But I look more accurate to have the result of a **sizeof** in **size_t**.
These are my changes:
``` diff
diff --git a/dll.cpp b/dll.cpp
index 72dade9..6328765 100644
--- a/dll.cpp
+++ b/dll.cpp
@@ -24,19 +24,19 @@
NAMESPACE_BEGIN(CryptoPP)
template<> const byte PKCS_DigestDecoration<SHA1>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14};
-template<> const unsigned int PKCS_DigestDecoration<SHA1>::length = sizeof(PKCS_DigestDecoration<SHA1>::decoration);
+template<> const size_t PKCS_DigestDecoration<SHA1>::length = sizeof(PKCS_DigestDecoration<SHA1>::decoration);
template<> const byte PKCS_DigestDecoration<SHA224>::decoration[] = {0x30,0x2d,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x04,0x05,0x00,0x04,0x1c};
-template<> const unsigned int PKCS_DigestDecoration<SHA224>::length = sizeof(PKCS_DigestDecoration<SHA224>::decoration);
+template<> const size_t PKCS_DigestDecoration<SHA224>::length = sizeof(PKCS_DigestDecoration<SHA224>::decoration);
template<> const byte PKCS_DigestDecoration<SHA256>::decoration[] = {0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20};
-template<> const unsigned int PKCS_DigestDecoration<SHA256>::length = sizeof(PKCS_DigestDecoration<SHA256>::decoration);
+template<> const size_t PKCS_DigestDecoration<SHA256>::length = sizeof(PKCS_DigestDecoration<SHA256>::decoration);
template<> const byte PKCS_DigestDecoration<SHA384>::decoration[] = {0x30,0x41,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02,0x05,0x00,0x04,0x30};
-template<> const unsigned int PKCS_DigestDecoration<SHA384>::length = sizeof(PKCS_DigestDecoration<SHA384>::decoration);
+template<> const size_t PKCS_DigestDecoration<SHA384>::length = sizeof(PKCS_DigestDecoration<SHA384>::decoration);
template<> const byte PKCS_DigestDecoration<SHA512>::decoration[] = {0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05,0x00,0x04,0x40};
-template<> const unsigned int PKCS_DigestDecoration<SHA512>::length = sizeof(PKCS_DigestDecoration<SHA512>::decoration);
+template<> const size_t PKCS_DigestDecoration<SHA512>::length = sizeof(PKCS_DigestDecoration<SHA512>::decoration);
template<> const byte EMSA2HashId<SHA>::id = 0x33;
template<> const byte EMSA2HashId<SHA224>::id = 0x38;
diff --git a/pkcspad.cpp b/pkcspad.cpp
index d3d6d2e..a1ed97e 100644
--- a/pkcspad.cpp
+++ b/pkcspad.cpp
@@ -13,16 +13,16 @@ NAMESPACE_BEGIN(CryptoPP)
// more in dll.cpp
template<> const byte PKCS_DigestDecoration<Weak1::MD2>::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02,0x05,0x00,0x04,0x10};
-template<> const unsigned int PKCS_DigestDecoration<Weak1::MD2>::length = sizeof(PKCS_DigestDecoration<Weak1::MD2>::decoration);
+template<> const size_t PKCS_DigestDecoration<Weak1::MD2>::length = sizeof(PKCS_DigestDecoration<Weak1::MD2>::decoration);
template<> const byte PKCS_DigestDecoration<Weak1::MD5>::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x04,0x10};
-template<> const unsigned int PKCS_DigestDecoration<Weak1::MD5>::length = sizeof(PKCS_DigestDecoration<Weak1::MD5>::decoration);
+template<> const size_t PKCS_DigestDecoration<Weak1::MD5>::length = sizeof(PKCS_DigestDecoration<Weak1::MD5>::decoration);
template<> const byte PKCS_DigestDecoration<RIPEMD160>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x24,0x03,0x02,0x01,0x05,0x00,0x04,0x14};
-template<> const unsigned int PKCS_DigestDecoration<RIPEMD160>::length = sizeof(PKCS_DigestDecoration<RIPEMD160>::decoration);
+template<> const size_t PKCS_DigestDecoration<RIPEMD160>::length = sizeof(PKCS_DigestDecoration<RIPEMD160>::decoration);
template<> const byte PKCS_DigestDecoration<Tiger>::decoration[] = {0x30,0x29,0x30,0x0D,0x06,0x09,0x2B,0x06,0x01,0x04,0x01,0xDA,0x47,0x0C,0x02,0x05,0x00,0x04,0x18};
-template<> const unsigned int PKCS_DigestDecoration<Tiger>::length = sizeof(PKCS_DigestDecoration<Tiger>::decoration);
+template<> const size_t PKCS_DigestDecoration<Tiger>::length = sizeof(PKCS_DigestDecoration<Tiger>::decoration);
size_t PKCS_EncryptionPaddingScheme::MaxUnpaddedLength(size_t paddedLength) const
{
diff --git a/pkcspad.h b/pkcspad.h
index 6a15b49..7532dbf 100644
--- a/pkcspad.h
+++ b/pkcspad.h
@@ -30,7 +30,7 @@ template <class H> class PKCS_DigestDecoration
{
public:
static const byte decoration[];
- static const unsigned int length;
+ static const size_t length;
};
// PKCS_DigestDecoration can be instantiated with the following
```
Is that correct? If so, feel free to patch the code.
| Length should be using size_t | https://api.github.com/repos/weidai11/cryptopp/issues/102/comments | 2 | 2016-01-06T17:03:53Z | 2016-01-12T04:50:53Z | https://github.com/weidai11/cryptopp/issues/102 | 125,218,622 | 102 |
[
"weidai11",
"cryptopp"
] | Is there any reason why eccrypto.h appears to contain two copies of itself - with second copy starting from line 337?
https://github.com/weidai11/cryptopp/blob/master/eccrypto.h#L338
| eccrypto.h duplicated within itself? | https://api.github.com/repos/weidai11/cryptopp/issues/101/comments | 3 | 2016-01-02T13:16:30Z | 2016-01-07T15:13:11Z | https://github.com/weidai11/cryptopp/issues/101 | 124,590,386 | 101 |
[
"weidai11",
"cryptopp"
] | [cryptest.sh](https://github.com/weidai11/cryptopp/blob/master/cryptest.sh) has one failure when running on Cygwin-x64. Its only present in the Debug/Optimize Size configuration test (-DDEBUG -Os) for the platform. Its not present in other configurations or on other platforms (including Cygwin-x86).
Cygwin version is 2.3.1:
```
$ cygcheck -V
cygcheck (cygwin) 2.3.1
System Checker for Cygwin
Copyright (C) 1998 - 2015 Red Hat, Inc.
```
GCC version is 5.2:
```
$ gcc --version
gcc (GCC) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.
...
```
From the backtrace below, the `input` buffer is aligned on a byte boundary (address is 0x23a4a9). Line 92/93 of misc.cpp is the tail of the `xorbuf`. Its not clear to me why `i=39767` when the string's length is clearly less (12 according to the proceeding frames). Maybe the optimizer is causing a wild write or discarding an initialization?
```
68 if (IsAligned<word32>(output) && IsAligned<word32>(input) && IsAligned<word32>(mask))
69 {
70 ...
90 }
91
92 for (i=0; i<count; i++)
93 output[i] = input[i] ^ mask[i];
```
The backtrace:
```
Testing MAC algorithm Panama-LE.
....
Testing MAC algorithm Panama-BE.
....
Testing SymmetricCipher algorithm Panama-LE.
Program received signal SIGSEGV, Segmentation fault.
CryptoPP::xorbuf (output=output@entry=0x600063d80 "",
input=input@entry=0x23a4a9 "\360\177_\362\314\320\032\n}D\254\326\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037",
mask=0x6000619c0 "\360~]\361\310\325\034\ruM\246\335\336\064̠\035\260\355&3N\271J\342w\023Z\adƦ00010203\301", count=2335913) at misc.cpp:93
93 output[i] = input[i] ^ mask[i];
(gdb) bt full
#0 CryptoPP::xorbuf (output=output@entry=0x600063d80 "",
input=input@entry=0x23a4a9 "\360\177_\362\314\320\032\n}D\254\326\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037",
mask=0x6000619c0 "\360~]\361\310\325\034\ruM\246\335\336\064̠\035\260\355&3N\271J\342w\023Z\adƦ00010203\301", count=2335913) at misc.cpp:93
__PRETTY_FUNCTION__ = "void CryptoPP::xorbuf(byte*, const byte*, const byte*, size_t)"
i = 39767
#1 0x00000001005042e4 in CryptoPP::AdditiveCipherTemplate<CryptoPP::AbstractPolicyHolder<CryptoPP::AdditiveCipherAbstractPolicy, CryptoPP::SymmetricCipher> >::ProcessData (this=0x600062880, outString=0x600063d80 "",
inString=0x23a4a9 "\360\177_\362\314\320\032\n}D\254\326\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", length=12)
at strciphr.cpp:120
__PRETTY_FUNCTION__ = "void CryptoPP::AdditiveCipherTemplate<BASE>::ProcessData(byte*, const byte*, size_t) [with BASE = CryptoPP::AbstractPolicyHolder<CryptoPP::AdditiveCipherAbstractPolicy, CryptoPP::SymmetricCipher>; byt"...
policy = @0x6000628b8: {
_vptr.AdditiveCipherAbstractPolicy = 0x1006afa18 <vtable for CryptoPP::SymmetricCipherFinal<CryptoPP::ConcretePolicyHolder<CryptoPP::PanamaCipherPolicy<CryptoPP::EnumToType<CryptoPP::ByteOrder, 0> >, CryptoPP::AdditiveCipherTemplate<CryptoPP::AbstractPolicyHolder<CryptoPP::AdditiveCipherAbstractPolicy, CryptoPP::SymmetricCipher> >, CryptoPP::AdditiveCipherAbstractPolicy>, CryptoPP::Panam---Type <return> to continue, or q <return> to quit---
aCipherInfo<CryptoPP::EnumToType<CryptoPP::ByteOrder, 0> > >+504>}
bytesPerIteration = 32
bufferByteSize = 32
bufferIterations = <optimized out>
#2 0x0000000100467f28 in ProcessString (length=<optimized out>,
inString=0x23a4a9 "\360\177_\362\314\320\032\n}D\254\326\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037",
outString=0x600063d80 "", this=<optimized out>) at cryptlib.h:850
No locals.
#3 CryptoPP::StreamTransformationFilter::NextPutMultiple (this=0x23b9b0,
inString=<optimized out>, length=<optimized out>) at filters.cpp:655
len = 12
space = 0x600063d80 ""
s = 1
length = 12
inString = 0x23a4a9 "\360\177_\362\314\320\032\n}D\254\326\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
this = 0x23b9b0
#4 0x0000000100467a94 in CryptoPP::FilterWithBufferedInput::PutMaybeModifiable
(this=0x23b9b0, inString=<optimized out>, length=<optimized out>,
messageEnd=0, blocking=blocking@entry=true,
modifiable=modifiable@entry=false) at filters.cpp:394
len = 12
newLength = <optimized out>
__PRETTY_FUNCTION__ = "size_t CryptoPP::FilterWithBufferedInput::PutMaybeModifiable(byte*, size_t, int, bool, bool)"
#5 0x000000010050a9fa in CryptoPP::FilterWithBufferedInput::Put2 (
this=<optimized out>, inString=<optimized out>, length=<optimized out>,
messageEnd=<optimized out>, blocking=true) at filters.h:340
No locals.
#6 0x000000010042f669 in CryptoPP::BufferedTransformation::ChannelPut2 (
this=0x23b9b0, channel=..., begin=<optimized out>, length=<optimized out>,
messageEnd=0, blocking=true) at cryptlib.cpp:470
No locals.
#7 0x0000000100422a36 in ChannelPut (blocking=true, length=<optimized out>,
inString=0x23a4a9 "\360\177_\362\314\320\032\n}D\254\326\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", channel=...,
this=0x23b9b0) at cryptlib.h:1781
No locals.
#8 RandomizedTransfer (source=..., target=..., finish=finish@entry=true,
channel=...) at datatest.cpp:86
buf = "\360\244#\000\000\000\000\000\030\267#", '\000' <repeats 13 times>, "\224)B\000\001\000\000\000he\000\000\006\000\000\000\300\360\177_\362\314\320\032\n}D\254\326\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", '\000' <repeats 15 times>, "\020\000\000\000\000\000\000\000", 'a' <repeats 16 times>, "rown fox jumps over the lazy dogk b\275\250\207Gu\201I\3---Type <return> to continue, or q <return> to quit---
04.;\301?\205\274", 'a' <repeats 1431 times>...
start = 41
len = <optimized out>
#9 0x0000000100424858 in TestSymmetricCipher (v=..., overrideParameters=...)
at datatest.cpp:453
encryptor = {m_p = 0x600062390}
decryptor = {m_p = 0x600062880}
lastName = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x100745270 <TestSymmetricCipher(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&, CryptoPP::NameValuePairs const&)::lastName+16> "Panama-LE"}, _M_string_length = 9, {
_M_local_buf = "Panama-LE\000\000\000\000\000\000",
_M_allocated_capacity = 5489150643248456016}}
encrypted = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x600061680 "\360\177_\362\314\320\032\n}D\254\326\322\071¯\r\241\377\065'[\257]\372n\tA\033yع"}, _M_string_length = 32, {
_M_local_buf = " \000\000\000\000\000\000\000\350\245\062\200\001\000\000", _M_allocated_capacity = 32}}
decrypted = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x23b7f0 ""},
_M_string_length = 0, {
_M_local_buf = "\000#\006\000\006\000\000\000\002\000\000\000\000\000\000", _M_allocated_capacity = 25770205952}}
iv = {m_deepCopy = false, m_data = 0x600061810 "", m_size = 32,
m_block = {
m_alloc = {<CryptoPP::AllocatorBase<unsigned char>> = {<No data fields>}, <No data fields>}, m_size = 0, m_ptr = 0x0}}
encFilter = {<CryptoPP::FilterWithBufferedInput> = {<CryptoPP::Filter> = {<CryptoPP::BufferedTransformation> = {<CryptoPP::Algorithm> = {<CryptoPP::Clonable> = {
_vptr.Clonable = 0x1006bbd20 <vtable for CryptoPP::StreamTransformationFilter+16>}, <No data fields>}, <CryptoPP::Waitable> = {
_vptr.Waitable = 0x1006bbf08 <vtable for CryptoPP::StreamTransformationFilter+504>}, static NULL_CHANNEL = <optimized out>,
m_buf = "`\000\000"}, <CryptoPP::NotCopyable> = {<No data fields>}, m_attachment = {m_p = 0x600061650}, m_inputPosition = 0,
m_continueAt = 0}, m_firstSize = 0, m_blockSize = 1,
m_lastSize = 0, m_firstInputDone = false, m_queue = {m_buffer = {
m_alloc = {<CryptoPP::AllocatorBase<unsigned char>> = {<No data fields>}, <No data fields>}, m_size = 0, m_ptr = 0x0}, m_blockSize = 1,
m_maxBlocks = 0, m_size = 0,
m_begin = 0x0}}, <CryptoPP::BlockPaddingSchemeDef> = {<No data fields>}, <CryptoPP::FilterPutSpaceHelper> = {m_tempSpace = {
m_alloc = {<CryptoPP::AllocatorBase<unsigned char>> = {<No data fields>}, <No data fields>}, m_size = 4096,
m_ptr = 0x600062d70 "\360\177_\362\314\320\032\n}D\254\326\322\071¯\r\241\377\065'[\257]\372n\tA\033yع"}}, m_cipher = @0x600062398,
m_padding = CryptoPP::BlockPaddingSchemeDef::NO_PADDING,
m_optimalBufferSize = 4096}
decFilter = {<CryptoPP::FilterWithBufferedInput> = {<CryptoPP::Filter> = {<CryptoPP::BufferedTransformation> = {<CryptoPP::Algorithm> = {<CryptoPP::Clonable> = {
_vptr.Clonable = 0x1006bbd20 <vtable for CryptoPP::StreamTransformationFilter+16>}, <No data fields>}, <CryptoPP::Waitable> = {
_vptr.Waitable = 0x1006bbf08 <vtable for CryptoPP::StreamTransformationFilter+504>}, static NULL_CHANNEL = <optimized out>,
m_buf = "0I\037\200"}, <CryptoPP::NotCopyable> = {<No data fields>}, m_attachment = {m_p = 0x600061860}, m_inputPosition = 0,
m_continueAt = 0}, m_firstSize = 0, m_blockSize = 1,
m_lastSize = 0, m_firstInputDone = true, m_queue = {m_buffer = {
m_alloc = {<CryptoPP::AllocatorBase<unsigned char>> = {<No data fields>}, <No data fields>}, m_size = 0, m_ptr = 0x0}, m_blockSize = 1,
m_maxBlocks = 0, m_size = 0,
m_begin = 0x0}}, <CryptoPP::BlockPaddingSchemeDef> = {<No data fields>}, <CryptoPP::FilterPutSpaceHelper> = {m_tempSpace = {
m_alloc = {<CryptoPP::AllocatorBase<unsigned char>> = {<No data fields>}, <No data fields>}, m_size = 4096, m_ptr = 0x600063d80 ""}},
m_cipher = @0x600062888,
m_padding = CryptoPP::BlockPaddingSchemeDef::NO_PADDING,
m_optimalBufferSize = 4096}
seek = <optimized out>
xorDigest = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x23b650 ""},
_M_string_length = 0, {
_M_local_buf = "\000\326#\000\000\000\000\000\002\000\000\000\000\000\000", _M_allocated_capacity = 2348544}}
ciphertext = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x600062290 "\360\177_\362\314\320\032\n}D\254\326\322\071¯\r\241\377\065'[\257]\372n\tA\033yع"}, _M_string_length = 32, {
_M_local_buf = " \000\000\000\000\000\000\000\016~\v\200\001\000\000", _M_allocated_capacity = 32}}
ciphertextXorDigest = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x23b690 ""},
_M_string_length = 0, {
_M_local_buf = "\000\000\000\000R?\001\340ض#\000\000\000\000",
_M_allocated_capacity = 16141252160892436480}}
name = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x23b5b0 "Panama-LE"},
_M_string_length = 9, {
_M_local_buf = "Panama-LE\000#\000\000\000\000",
_M_allocated_capacity = 5489150643248456016}}
test = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x23b5d0 "Encrypt"},
_M_string_length = 7, {
_M_local_buf = "Encrypt\000\001\000\000\000\001\000\000",
_M_allocated_capacity = 32774764210908741}}
key = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x600061970 ""},
_M_string_length = 32, {
_M_local_buf = "<\000\000\000\000\000\000\000\b\t\n\v\000\000\000", _M_allocated_capacity = 60}}
plaintext = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x6000618b0 ""},
_M_string_length = 32, {
_M_local_buf = "<\000\000\000\000\000\000\000\b\t\n\v\f\r\000",
_M_allocated_capacity = 60}}
testDataPairs = {<CryptoPP::NameValuePairs> = {
_vptr.NameValuePairs = 0x100664f40 <vtable for TestDataNameValuePairs+16>}, m_data = @0x23bbd8, m_temp = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x600061810 ""},
_M_string_length = 32, {
_M_local_buf = "<\000\000\000\000\000\000\000\217\322\024\200\001\000\000", _M_allocated_capacity = 60}}}
pairs = {<CryptoPP::NameValuePairs> = {
_vptr.NameValuePairs = 0x1006b1e70 <vtable for CryptoPP::CombinedNameValuePairs+16>}, m_pairs1 = @0x60004bd60, m_pairs2 = @0x23b800}
#10 0x0000000100427a81 in TestDataFile (filename=..., overrideParameters=...,
totalTests=@0x23be68: 14, failedTests=@0x23be6c: 0) at datatest.cpp:768
failed = true
algType = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x23bba8 "SymmetricCipher"}, _M_string_length = 15, {
_M_local_buf = "SymmetricCipher",
_M_allocated_capacity = 7598263500303858003}}
dataDirectory = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x100745250 <TestDataFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, CryptoPP::NameValuePairs const&, unsigned int&, unsigned int&)::dataDirectory+16> ""}, _M_string_length = 0, {
_M_local_buf = '\000' <repeats 15 times>,
_M_allocated_capacity = 0}}
file = <incomplete type>
v = {_M_t = {
_M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >> = {<No data fields>}, <No data fields>},
_M_key_compare = {<std::binary_function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool>> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red,
_M_parent = 0x600061c20, _M_left = 0x600061b10,
_M_right = 0x6000615e0}, _M_node_count = 8}}}
name = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x23bb48 "Test"},
_M_string_length = 4, {
_M_local_buf = "Test\000\000text\000\000e\000\000",
_M_allocated_capacity = 7310468097082877268}}
value = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x6000622d0 "Encrypt"},
_M_string_length = 7, {
_M_local_buf = "\202\000\000\000\000\000\000\000E\000\000st\000\000", _M_allocated_capacity = 130}}
lastAlgName = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x23bb88 "Panama-LE"},
_M_string_length = 9, {
_M_local_buf = "Panama-LE\000\000\000\000\000\000",
_M_allocated_capacity = 5489150643248456016}}
#11 0x0000000100427e56 in RunTestDataFile (
filename=filename@entry=0x1005a5a20 <ValidateBBS()::output1+784> "TestVectors/panama.txt", overrideParameters=..., thorough=thorough@entry=true)
at datatest.cpp:815
totalTests = 14
failedTests = 0
#12 0x000000010041f756 in ValidatePanama () at validat3.cpp:344
No locals.
#13 0x0000000100415ee3 in ValidateAll (thorough=thorough@entry=false)
at validat1.cpp:90
pass = false
#14 0x0000000100407af4 in Validate (alg=0, thorough=thorough@entry=false,
seedInput=seedInput@entry=0x0) at test.cpp:870
result = <optimized out>
seed = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x6000507a0 "1451716383 "}, _M_string_length = 16, {
_M_local_buf = "\036\000\000\000\000\000\000\000\070\063\000\000\006\000\000", _M_allocated_capacity = 30}}
prng = <optimized out>
endTime = 2342936
#15 0x000000010058fd5d in main (argc=2, argv=<optimized out>) at test.cpp:342
command = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x23c028 "v"},
_M_string_length = 1, {
_M_local_buf = "v\000\021\200\001\000\000\000\000\000\000\000\000\000\000", _M_allocated_capacity = 6443565174}}
seed = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x600050750 "1451716383 "}, _M_string_length = 16, {
_M_local_buf = "\036\000\000\000\000\000\000\000\070\063\000\200\001\000\000", _M_allocated_capacity = 30}}
prng = <optimized out>
executableName = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x23c048 ""},
_M_string_length = 0, {_M_local_buf = '\000' <repeats 15 times>,
_M_allocated_capacity = 0}}
macFilename = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x23c068 ""},
_M_string_length = 0, {
_M_local_buf = "\000\234Ħ\372\177\000\000\060\301#\000\000\000\000", _M_allocated_capacity = 140714516454400}}
__PRETTY_FUNCTION__ = "int main(int, char**)"
```
| Crash on Cygwin-x64 with -DDEBUG -Os | https://api.github.com/repos/weidai11/cryptopp/issues/100/comments | 5 | 2016-01-02T07:08:06Z | 2017-06-14T09:14:31Z | https://github.com/weidai11/cryptopp/issues/100 | 124,578,752 | 100 |
[
"weidai11",
"cryptopp"
] | Hi
first of all: Thanks for this great library, it helped me a lot in a current student project!
However there were some compile issues with msvc2015 and CMake:
- for MSVC some assembler sources must be add
- also Assembler must be enabled and correct flags must be set
- there was also another source winpipes.cpp missing
Furthermore the define CRYPTO_DATA_DIR needs quote symbols (for all compilers and systems)
I created a small patch, that works for me. Maybe this also helps other people out there.
I tested the patch for Win64 build (MSVC2015), Linux64 (GCC) build and Android (Android NDK r10e) build. In all builds the debug and release version works well. I did not test the shared libraries, since they are limited anyway.
However currently I have no time to test Win32 builds or other compilers and systems like MacOSX and CLang. That's why I did not create a pull request.
This is the patch, have a lot of fun with it :)
``` patch
From 1531ab255d84b5c774284031927293f18f7c0254 Mon Sep 17 00:00:00 2001
From: Andre Netzeband <there_is_no@mail.de>
Date: Fri, 1 Jan 2016 18:32:34 +0100
Subject: [PATCH] Corrected missing quote symbols for crypto-data-dir
definition. Added special settings for MSVC: Enable Assembler, set assembler
flags for 32bit and 64bit added missing assembler files and source files.
---
CMakeLists.txt | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ca9aea..8fa8631 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,13 +48,15 @@ if(DISABLE_AESNI)
add_definitions(-DCRYPTOPP_DISABLE_AESNI)
endif()
if(NOT CRYPTOPP_DATA_DIR STREQUAL "")
- add_definitions(-DCRYPTOPP_DATA_DIR=${CRYPTOPP_DATA_DIR})
+ add_definitions(-DCRYPTOPP_DATA_DIR="${CRYPTOPP_DATA_DIR}")
endif()
#============================================================================
# Sources & headers
#============================================================================
+math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}")
+
# Library headers
file(GLOB cryptopp_HEADERS *.h)
@@ -82,6 +84,19 @@ if(MINGW)
list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/winpipes.cpp)
endif()
+if(MSVC)
+ enable_language(ASM_MASM)
+ if (BITS EQUAL 32)
+ SET(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /nologo /D_M_X86 /W3 /Cx /Zi /safeseh")
+ else ()
+ SET(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /nologo /D_M_X64 /W3 /Cx /Zi")
+ list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/x64dll.asm)
+ list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/x64masm.asm)
+ endif ()
+ list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/winpipes.cpp)
+ list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/rdrand.asm)
+endif()
+
#============================================================================
# Compile targets
#============================================================================
--
2.5.0.windows.1
```
| MSVC2015 (win64) CMakeLists.txt issues | https://api.github.com/repos/weidai11/cryptopp/issues/99/comments | 12 | 2016-01-01T17:44:57Z | 2016-06-22T13:28:37Z | https://github.com/weidai11/cryptopp/issues/99 | 124,552,658 | 99 |
[
"weidai11",
"cryptopp"
] | Continuous integration and testing is a topic that comes up frequently. Crypto++ testing is [believed to be thorough](http://github.com/weidai11/cryptopp/blob/master/cryptest.sh) on common platforms like Linux, OS X and Windows, but its a manual process. Tools like Travis-CI can be a helpful to automate testing, but Crypto++ does not have a process in place to utilize it.
Travis-CI is often recommended, but it requires [dangerous GitHub permissions](https://github.com/travis-ci/travis-ci/issues/1390) on a GitHub hosted project. Also see [Travis-CI Issue 1390: Travis should not need write access to GitHub profile, followers, emails, etc..](https://github.com/travis-ci/travis-ci/issues/1390).
For Crypto++, it appears Travis-CI effectively requires [GitHub Collaborator](https://help.github.com/articles/permission-levels-for-a-user-account-repository/) status. If the Travis-CI service is compromised, then it could have potentially damaging effects on Crypto++. From [The Linux Backdoor Attempt of 2003](https://freedom-to-tinker.com/blog/felten/the-linux-backdoor-attempt-of-2003/) (server compromise and insertion of backdoors) and [Target data breach](http://krebsonsecurity.com/2014/02/target-hackers-broke-in-via-hvac-company/) (compromise a secondary vendor/partner to gain access to the primary data), we know attackers will use all means to compromise a code base, so the risk is non-trivial. In fact, in 2007, [SourceForge.net got hacked which contaminated all projects SF hosted](http://news.softpedia.com/news/SourceForge-net-Hacked-73241.shtml), including Crypto++.
We'd like to find a way to make Travis-CI work with GitHub without exposing the project to unneeded risk. Or, we would like to find a replacement service that can be used more safely. Please provide suggestions, comments and thoughts on:
- What we can use in lieu of Travis-CI
- How how we can use Travis-CI safely
---
Also see [Issue 97: Continuous integration and testing](https://groups.google.com/forum/#!topic/cryptopp-users/-fmbRJ6ooZo) on the Crypto++ mailing list.
| Continuous integration and testing | https://api.github.com/repos/weidai11/cryptopp/issues/97/comments | 6 | 2015-12-30T19:15:31Z | 2017-04-15T10:35:16Z | https://github.com/weidai11/cryptopp/issues/97 | 124,388,736 | 97 |
[
"weidai11",
"cryptopp"
] | Hi there,
I have cross-compiled cryptopp for Android using the provided makefile. However, the linker complains about a specific class, see [linker_errors.txt](https://github.com/weidai11/cryptopp/files/73329/linker_errors.txt). Other pieces of code, such as SHA256 and RandomPool link correctly.
The code im trying to compile is:
```
CryptoPP::AES::Encryption aes(m_bufSeed,m_bufSeed.size());
CryptoPP::CFB_Mode_ExternalCipher::Decryption decryptor(aes,m_bufIV);
decryptor.ProcessString(pData,dwSize);
```
I am using the GCC 4.9 toolchain targeting platform version 19, armeabi-v7a. My cflags are
"-std=c++11", "-frtti", "-mfloat-abi=softfp",
"-fexceptions", "-g2", "-gdwarf-2" , "-funwind-tables" , "-Wl,--fix-cortex-a8",
"-DANDROID", "-fpermissive", "-Wall"
I assume I am either missing something critical something here, or it is a bug on Android?
Thanks
| CFB_ModePolicy Android | https://api.github.com/repos/weidai11/cryptopp/issues/94/comments | 7 | 2015-12-28T16:03:43Z | 2016-01-07T15:14:45Z | https://github.com/weidai11/cryptopp/issues/94 | 124,085,151 | 94 |
[
"weidai11",
"cryptopp"
] | We have a pretty good release process located at [Release](https://www.cryptopp.com/wiki/Release_process). However, a postmortem analysis of [Issue 92](https://github.com/weidai11/cryptopp/issues/92) revealed we don't know what code _lacks_ a test case.
| Need a Code Coverage tool added to the Release Process | https://api.github.com/repos/weidai11/cryptopp/issues/93/comments | 7 | 2015-12-28T08:40:28Z | 2016-01-18T01:58:11Z | https://github.com/weidai11/cryptopp/issues/93 | 124,035,546 | 93 |
[
"weidai11",
"cryptopp"
] | Line 569 and 589 of secblock.h contain this:
```
assert((!t.m_ptr && !t.m_size) || (t.m_ptr && t.m_ptr.m_size));
```
`m_ptr.m_size` doesn't work, since `m_ptr` is a pointer. I believe what is meant is
```
assert((!t.m_ptr && !t.m_size) || (t.m_ptr && t.m_size));
```
This prevents use of operators +=`and`+` in a debug build (i.e. with assertions not disabled).
| secblock.h: Error inside assert() | https://api.github.com/repos/weidai11/cryptopp/issues/92/comments | 8 | 2015-12-27T13:26:34Z | 2015-12-28T08:41:02Z | https://github.com/weidai11/cryptopp/issues/92 | 123,978,435 | 92 |
[
"weidai11",
"cryptopp"
] | Open discussion at [Make VS2010 default sometime in 2016?](http://groups.google.com/d/msg/cryptopp-users/vCYAEj3OI8g/BPxFrKedDgAJ) on the User Group.
Here are the breaking changes for [Visual Studio 2010](https://msdn.microsoft.com/en-us/library/bb531344%28v=vs.100%29.aspx). I don't think they materially affect Crypto++ or library users, and its probably no longer worth mentioning given the testing under VS2010 and above.
<strike>And we will also need to properly address [C4996 warnings](https://msdn.microsoft.com/en-us/library/ttcz0bys%28v=vs.100%29.aspx) and [Checked Iterators](https://msdn.microsoft.com/en-us/library/aa985965%28v=vs.100%29.aspx). Disabling C4996 on a per-translation unit basis is not adequate.</strike> Warnings have been cleared.
We recently [archived the VC++ 5.0/6.0 project files](http://github.com/weidai11/cryptopp/issues/261). We can probably do the same for VS2005 now that we've spent some time testing it.
| Make VS2010 default sometime in 2016 | https://api.github.com/repos/weidai11/cryptopp/issues/89/comments | 1 | 2015-12-26T08:27:25Z | 2016-09-10T08:45:19Z | https://github.com/weidai11/cryptopp/issues/89 | 123,916,567 | 89 |
[
"weidai11",
"cryptopp"
] | Post build event should be changed to `Win32\output\debug\cryptest mac_dll $(TargetDir)\cryptopp.dll
echo mac done > "$(OutDir)"\cryptopp.mac.done`. The reason is that there is a mismatch between the `${TargetName}` which cryptdll and the actual output dll which is `cryptopp.dll`.
Ideally the fix should be the other way around so that the `${TargetName}` is correct so the above is just a workaround. Also the hardcoded values of vc80 should be changed to probably `${TargetName}.pdb` so that they are OK in case users update the VS solution file to a newer version.
| Issues with post build event with newer msvc | https://api.github.com/repos/weidai11/cryptopp/issues/87/comments | 11 | 2015-12-19T04:58:37Z | 2015-12-30T18:01:04Z | https://github.com/weidai11/cryptopp/issues/87 | 123,062,702 | 87 |
[
"weidai11",
"cryptopp"
] | The input lib is set to AdditionalLibraryDirectories="$(PlatformName)\DLL_Output\$(ConfigurationName) $(NOINHERIT)"
however the .cryptopp.lib is output over at $(PlatformName)\Output\etc...
| Incorrect paths for AdditionalLibraryDirectories in msvc for dll generation | https://api.github.com/repos/weidai11/cryptopp/issues/86/comments | 9 | 2015-12-19T03:54:59Z | 2016-01-08T14:31:04Z | https://github.com/weidai11/cryptopp/issues/86 | 123,059,730 | 86 |
[
"weidai11",
"cryptopp"
] | Hi I am trying to install cryptoPP for cross-compilation on a beaglebone black and I am using Ubuntu for compilation. I am quite a newbie in this please help me out.
I did

And everything seems fine. Then I tried to the the make command. But I did not get the same output.

And then trying to test it.

The machine is still Intel not ARM.
Can you help me with this one?
Thank you very much
| CryptoPP for cross-compilation on ARM-embedded | https://api.github.com/repos/weidai11/cryptopp/issues/85/comments | 1 | 2015-12-16T03:47:03Z | 2016-01-08T14:29:00Z | https://github.com/weidai11/cryptopp/issues/85 | 122,421,682 | 85 |
[
"weidai11",
"cryptopp"
] | When I compress a plain
[atom.txt](https://github.com/weidai11/cryptopp/files/61198/atom.txt)
text buffer, I get an assert from zdeflate in MatchFound, line
assert(length >= 3 && length < COUNTOF(lengthCodes));
Code snippet that I am using to compress......
```
CryptoPP::Gzip zipper;
//is - is an ifstream passed in
//read the source file
if (!is.is_open() || !os.is_open() )
{
return(-1);
}
// get its size:
long fileSize = getFileSize(is);
//allocate a buffer big enough to read the entire file
byte *buffer = new byte[(long)fileSize+1024];
if (buffer != NULL)
{
//read the entire file into the buffer
is.read((char *)buffer, fileSize);
//compress it
zipper.Put((byte*)buffer, (int)fileSize);
zipper.MessageEnd();
}
```
| zdeflate error | https://api.github.com/repos/weidai11/cryptopp/issues/83/comments | 10 | 2015-12-14T13:09:17Z | 2016-09-10T23:57:01Z | https://github.com/weidai11/cryptopp/issues/83 | 122,039,038 | 83 |
[
"weidai11",
"cryptopp"
] | Distro maintainers currently have it rough. They install `cryptest.exe` into `/usr/bin`, `TestVectors` and `TestData` into `/usr/share`, and everything breaks because the library presumes a location relative to `cryptest.exe`.
We have a [DataDir](https://www.cryptopp.com/wiki/DataDir) patch, but its a bit complicated. Its probably more complicated than needed. It also requires a user to `make PREFIX=...`, which is unusual in the Crypto++ build procedure workflows.
The distros currently use a Debian patch provided. Whenever we add a new set of test vectors, the distros must apply their patch or endure breaking when a new data set is added, like those for HKDF.
The Debian patch has two parts. First, it adds a macro prefix to the relevant files. For example, the following change is made:
```
- FileSource keys("TestData/rsa512a.dat", true, new HexDecoder);
+ FileSource keys(PACKAGE_DATA_DIR "TestData/rsa512a.dat", true, new HexDecoder);
```
Then, the distros build with:
```
CXXFLAGS = $(CXXFLAGS) -DPACKAGE_DATA_DIR='"/usr/share/crypto++/"'
```
---
I had the opportunity to speak with two of our package maintainers, László (Debian) and Morten (Fedora). We have hashed out the following changes:
```
// config.h
#ifndef CRYPTOPP_DATA_DIR
# define CRYPTOPP_DATA_DIR "./"
#endif
```
Then, we will apply the changes following Debian's lead with:
```
- FileSource keys("TestData/rsa512a.dat", true, new HexDecoder);
+ FileSource keys(CRYPTOPP_DATA_DIR "TestData/rsa512a.dat", true, new HexDecoder);
```
The changes above will preserve exiting behavior, and allow distros to continue modifying it as required.
In the future, when we add files, they will always have the prefix applied, so the distros won't need to manage it.
---
The discussion is available at [Debian-style Data Directory patch](http://groups.google.com/d/msg/cryptopp-users/q1o808taOKA/ztZleJFLCgAJ).
| Add Debian-style Data Directory patch | https://api.github.com/repos/weidai11/cryptopp/issues/82/comments | 3 | 2015-12-12T06:19:09Z | 2015-12-26T04:52:10Z | https://github.com/weidai11/cryptopp/issues/82 | 121,836,600 | 82 |
[
"weidai11",
"cryptopp"
] | When compiling dynamic version of crypto++ library, it uses `install_name` parameter equal to `libcryptopp.dylib`. Effectively, if the library is installed, the programs will be able to compile against it, but the at the runtime the library will not be found.
I believe, the default should be `$PREFIX/lib/libcryptopp.dylib`, however there could be other options depending on how the library is used.
(I came across this issue with MacPorts. It was fixed prior to 5.6.3 update, but now broken again.)
| [OSX] Incorrect install_name for dynamic library | https://api.github.com/repos/weidai11/cryptopp/issues/80/comments | 13 | 2015-12-12T01:55:36Z | 2015-12-25T17:12:27Z | https://github.com/weidai11/cryptopp/issues/80 | 121,825,208 | 80 |
[
"weidai11",
"cryptopp"
] | in function inline void memcpy_s of misc.h, the line
```
assert(dest != NULL); assert(src != NULL);
```
causes that a program that compiles, and assigns both dest and src, still fails. This may be platform specific, but on my g++ 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04), I get the following runtime error:
```
sample: misc.h:304: void CryptoPP::memcpy_s(void*, size_t, const void*, size_t): Assertion `dest != __null' failed.
```
commenting out this line lets the program compile and execute correctly. Should it be there?
| failiure of assert(dest != NULL); assert(src != NULL); | https://api.github.com/repos/weidai11/cryptopp/issues/79/comments | 6 | 2015-12-09T13:16:55Z | 2015-12-12T02:02:33Z | https://github.com/weidai11/cryptopp/issues/79 | 121,236,105 | 79 |
[
"weidai11",
"cryptopp"
] | Any link of official tutorial would be great. Or any other link if you already don't have one.
I found out this http://www.cryptopp.com/wiki/Compiling but it didn't help me.
Any help would be great thank you.
| How do I install Crypto++ in Visual Studio 2013 Windows 8? | https://api.github.com/repos/weidai11/cryptopp/issues/78/comments | 2 | 2015-12-09T13:02:15Z | 2015-12-16T03:54:57Z | https://github.com/weidai11/cryptopp/issues/78 | 121,232,665 | 78 |
[
"weidai11",
"cryptopp"
] | We have some scripts that help with cross-compiling Crypto++ for Android, iOS and ARM Embedded. There are wiki pages on it, but using them requires folks to download the script from the wiki.
<strike>In addition, the Android script has incomplete `CXXFLAGS` when compared to what the Android NDK provides. We need to round out the flags to ensure they are compatible with what Android is producing.</strike> This has been resolved; see [Android (Command Line)](https://www.cryptopp.com/wiki/Android_%28Command_Line%29) on the wiki.
This issue will track:
- updating GNUmakefile-cross
- adding setenv-android.sh, setenv-ios.sh and setenv-embedded.sh
| Add setenv scripts for Makefile based cross-compiles | https://api.github.com/repos/weidai11/cryptopp/issues/76/comments | 1 | 2015-12-07T19:07:29Z | 2016-03-09T19:59:40Z | https://github.com/weidai11/cryptopp/issues/76 | 120,844,422 | 76 |
[
"weidai11",
"cryptopp"
] | - New virtual machine (android-ndk in home dir)
- Pulled the sources directly from git
- got the setenv-android.sh from the wiki
- Building like
```
AOSP_API="android-8" . ./setenv-android.sh
make -f GNUmakefile-cross static dynamic cryptest.exe
```
It looks like the setenv.sh sets everything right, cause the used compiler is already the right one (arm-linux-adroideabi-g++) but unfortunately the environment doesn't get the include path for the stl-classes.
```
stdcpp.h:9:18: fatal error: string: No such file or directory
#include <string>
```
If i check the environment value AOSP_STL_INC, it is set to an existing path (from the android-ndk).
```
AOSP_STL_INC: /home/user/android-ndk-r10e/sources/cxx-stl/stlport/stlport/
```
So, is it my fault it's not running like this?
| Build for Android: #include <string> | https://api.github.com/repos/weidai11/cryptopp/issues/74/comments | 5 | 2015-12-07T16:02:37Z | 2016-01-08T14:28:26Z | https://github.com/weidai11/cryptopp/issues/74 | 120,805,448 | 74 |
[
"weidai11",
"cryptopp"
] | Well, the idea is to move away from traditional Makefile to a Makefile generator. CMake is the most robust, stable and reliable cross-platform build system.
Advantages:
- Much, MUCH easier to maintain:
Now we have to mantain Visual Studio project, Borlang C++ Builder project, GNUmakefile, GNUmakefile-cross, and (bonus!) Debian maintainers also have to maintain autoconf/automake builds. Using CMake you just have to maintain a single file: CMakeLists.txt
- Uniform across all platforms
We don't need to remember, how to build Crypto++ on Windows or Android (and it is really hard without something like msys2, if using MinGW).
Building process is the same on every single platform:
``` shell
mkdir build
cd build
cmake ../build
cmake --build .
```
- Cross-platform out of the box:
CMake uses [toolchain files](https://cmake.org/cmake/help/v3.0/manual/cmake-toolchains.7.html) to be really crossplatform. If you want to cross-compile Crypto++ for Android or Raspberry PI, for example, you just create CMake toolchain file for each platform, and it works like magic.
- Great documentation and community
CMake is becoming _de facto_ standard in building C and C++ applications, gaining popularity every day.
- Many IDE's start to support it out of the box:
Visual Studio (using generator)
Code::Blocks (using generator)
Eclipse CDT (using generator)
CLion (natively!)
Disadvantages:
- It would be necessary to rewrite building process in various Linux distros.
If you are agree with this idea, I can start writing the CMakeLists.txt file right now, so we could complete it until version 5.7. Also, we can roll out both Makefile+CMake builds simultaneously in 5.7, and remove Makefile in 6.0 (as it is a major release).
| Provide CMake build system | https://api.github.com/repos/weidai11/cryptopp/issues/73/comments | 4 | 2015-12-07T14:00:06Z | 2016-02-10T23:36:00Z | https://github.com/weidai11/cryptopp/issues/73 | 120,779,554 | 73 |
[
"weidai11",
"cryptopp"
] | Please take note of this source code compiling error:
Platform:
```
OSX 10.10
```
Clang compiler:
```
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
```
Command:
```
/usr/bin/clang++ -arch i386 -DCRYPTOPP_DISABLE_ASM cpu.cpp
```
Error:
```
cpu.cpp:104:4: error: register %rbx is only available in 64-bit mode
"pushq %%rbx; cpuid; mov %%ebx, %%edi; popq %%rbx"
^
<inline asm>:1:8: note: instantiated into assembly here
pushq %rbx; cpuid; mov %ebx, %edi; popq %rbx
^~~~~
cpu.cpp:104:4: error: register %rbx is only available in 64-bit mode
"pushq %%rbx; cpuid; mov %%ebx, %%edi; popq %%rbx"
^
<inline asm>:1:42: note: instantiated into assembly here
pushq %rbx; cpuid; mov %ebx, %edi; popq %rbx
^~~~
2 errors generated.
```
Note: In clang600.0.57 did not appear such error, but rbx is not a 32 bit register.
Thank you in advance.
| clang compilation error on cpu.cpp | https://api.github.com/repos/weidai11/cryptopp/issues/72/comments | 5 | 2015-11-30T11:07:00Z | 2016-01-26T08:35:49Z | https://github.com/weidai11/cryptopp/issues/72 | 119,470,183 | 72 |
[
"weidai11",
"cryptopp"
] | Todd Knarr has offered a patch for SONAME under Linux. The patch embeds the SONAME in the shared object, names the output artifact according to Linux standards, and symlinks to to the long shared object name.
We want to pick this up in about 30 days, distributions have time to uptake 5.6.3.
| Pick-up SONAME merge requests | https://api.github.com/repos/weidai11/cryptopp/issues/71/comments | 6 | 2015-11-24T17:51:52Z | 2016-01-07T15:19:44Z | https://github.com/weidai11/cryptopp/issues/71 | 118,667,558 | 71 |
[
"weidai11",
"cryptopp"
] | Crypto++ 5.6.3 cleared a number of issues uncovered by analysis and testing tools. To maintain compatibility with Crypto++ 5.6.2, `MAINTAIN_BACKWARDS_COMPATIBILITY_562` was introduced. It allowed us to clear _most_ of the findings while maintaining compatibility. If `MAINTAIN_BACKWARDS_COMPATIBILITY_562` was not defined, then _all_ the issues were mitigated.
Future version of Crypto++ will not need `MAINTAIN_BACKWARDS_COMPATIBILITY_562` because compatibility with 5.6.2 is not a concern. That is, Crypto++ 5.7 or 6.0 will not need it because advancement is expected, and there are no guarantees. Also see [Release Versioning](http://cryptopp.com/wiki/Release_Versioning) on the Crypto++ Wiki.
Distributions, like Debian and Fedora, are currently incorporating 5.6.3. In about 30 days, we should remove `MAINTAIN_BACKWARDS_COMPATIBILITY_562` so GitHub users enjoy the most stable code.
---
We should also remove warning suppression of C4505 from `config.h`:
```
#pragma warning(disable: 4127 4231 4250 4251 4275 4505 4512 4660 4661 4786 4355 4910)
```
| Remove MAINTAIN_BACKWARDS_COMPATIBILITY_562 | https://api.github.com/repos/weidai11/cryptopp/issues/70/comments | 7 | 2015-11-24T16:19:35Z | 2016-12-03T05:46:56Z | https://github.com/weidai11/cryptopp/issues/70 | 118,645,328 | 70 |
[
"weidai11",
"cryptopp"
] | Uri uncovered some of the cryptosystem or algorithms don't perform key generation in their self test routines (both with `cryptest.exe v` and `cryptest.exe tv`). Where applicable, the self tests _do_ perform (1) known answer tests and (2) pairwise consistency checks to ensure proper operation, but the keys were generated offline.
The gap may exist in other areas, and not be limited to key generations. We should probably perform an audit to ensure all classes of operations are well represented.
Related, see the push of the new Crypto++ 5.6.3 release zip: [Crypto++ 5.6.3 released](http://groups.google.com/d/msg/cryptopp-announce/I9ncI2gg8g0/7vEXq8LRAgAJ)
| Need a set of tests which perform key generation | https://api.github.com/repos/weidai11/cryptopp/issues/69/comments | 1 | 2015-11-22T12:23:02Z | 2016-03-11T07:02:40Z | https://github.com/weidai11/cryptopp/issues/69 | 118,260,299 | 69 |
[
"weidai11",
"cryptopp"
] | We noticed problems with CryptoPP when testing our eIDClientCore software (which uses CryptoPP as a shared library).
We created a minimal example, which could reproduce the problem on our systems.
Makefile:
```
PREFIX ?=$(shell pwd)
CRYPTOPP ?= cryptopp
all: cryptopp test_rand run
cryptopp:
git clone https://github.com/weidai11/cryptopp.git $(CRYPTOPP)
make -C $(CRYPTOPP) all libcryptopp.so
make -C $(CRYPTOPP) install PREFIX=$(PREFIX)
test_rand: test_rand.cpp
g++ -Iinclude -Llib -lcryptopp -lpthread -o test_rand test_rand.cpp
run: test_rand
$(PREFIX)/test_rand
```
test_rand.cpp:
```
#include <cryptopp/osrng.h>
#include <cryptopp/secblock.h>
#include <iostream>
/*
* http://www.cryptopp.com/wiki/RandomNumberGenerator#AutoSeededRandomPool
*/
int main(int argc, char* argv[]){
// Scratch Area
const unsigned int BLOCKSIZE = 16 * 8;
CryptoPP::SecByteBlock scratch( BLOCKSIZE );
// Construction
CryptoPP::AutoSeededRandomPool rng;
// Random Block
std::cout<<"Before rng.GenerateBlock\n"<<std::flush;
rng.GenerateBlock( scratch, scratch.size() );
std::cout<<"After rng.GenerateBlock\n"<<std::flush;
return 0;
}
```
The line
```
std::cout<<"After rng.GenerateBlock\n"<<std::flush;
```
is never reached. On OpenSUSE 32bit
```
3.16.7-29-desktop #1 SMP PREEMPT Fri Oct 23 00:46:04 UTC 2015 (6be6a97) i686 i686 i386 GNU/Linux
```
we got a segmentation fault. On OpenSUSE 64bit
```
3.16.7-29-desktop #1 SMP PREEMPT Fri Oct 23 00:46:04 UTC 2015 (6be6a97) x86_64 x86_64 x86_64 GNU/Linux
```
the program is stuck.
| AutoSeededRandomPool::GenerateBlock causes Segmentation Fault/Freeze | https://api.github.com/repos/weidai11/cryptopp/issues/68/comments | 7 | 2015-11-19T15:48:25Z | 2015-11-26T20:57:18Z | https://github.com/weidai11/cryptopp/issues/68 | 117,842,286 | 68 |
[
"weidai11",
"cryptopp"
] | The following page gives a list of safe curves to use with ECC:
http://safecurves.cr.yp.to/
As far as I can see, Crypto++ doesn't currently implement any of the safe curves listed on that page (e.g. Curve25519), and a lot of the curves that are implemented have known issues (e.g. secp256k1).
I'm no expert, but would I be right in thinking that the work that needs doing is: (1) adding a new OID to `oids.h`, and (2) adding the curve parameters to `eccrypto.cpp`?
| No safe curves are currently supported | https://api.github.com/repos/weidai11/cryptopp/issues/67/comments | 52 | 2015-11-18T12:48:02Z | 2018-12-25T10:46:45Z | https://github.com/weidai11/cryptopp/issues/67 | 117,579,654 | 67 |
[
"weidai11",
"cryptopp"
] | Crypto++ has gone through Coverity scans for Debug (x64), Release (x64), Release (No-ASM), Debug (x86), Release (x86). The following are the remaining items that need to be fixed or explained:
- CID 147829 - Bad Shift amount in gf2n.cpp. [JPM thinks its a false positive](https://groups.google.com/d/msg/cryptopp-users/cMBy60ONPew/gouOMSF3AgAJ)
- CID 154223 - Dereference after NULL check in misc.cpp. We see the potential, but a mitigating circumstance is `size` is 0, so we never actually operate on the buffer.
- CID 154224 - Wrong size argument (SIZEOF_MISMATCH) in integer.cpp. I'm fairly certain this is a false positive. The finding warns of `T+2`, where `T` is a pointer, and states it should be size 8 rather than 2. But the +2 skip 2 elements, which makes it size 8 or 16.
| Rollup of Coverity items to be fixed before release | https://api.github.com/repos/weidai11/cryptopp/issues/66/comments | 1 | 2015-11-16T22:21:34Z | 2015-11-18T20:20:41Z | https://github.com/weidai11/cryptopp/issues/66 | 117,232,132 | 66 |
[
"weidai11",
"cryptopp"
] | When using PolynomialMod2 shift left operator, the most significant word
is lost when shifting by more than WORD_BITS bits.
In "gf2n.c" the line 349 states:
```
reg[reg.size()-1] = carry;
```
it should be:
```
reg[reg.size()-shiftWords-1] = carry;
```
| PolynomialMod2::operator<<= Bug | https://api.github.com/repos/weidai11/cryptopp/issues/64/comments | 3 | 2015-11-06T23:38:20Z | 2015-11-16T22:12:00Z | https://github.com/weidai11/cryptopp/issues/64 | 115,612,754 | 64 |
[
"weidai11",
"cryptopp"
] | https://github.com/weidai11/cryptopp/blob/48809d4e85c125814425c621d8d0d89f95405924/winpipes.h#L60
They inherit `virtual HANDLE GetHandle() const =0;` from `WindowsPipe`.
It is then called in `WindowsPipeReceiver::Receive()`, `WindowsPipeReceiver::GetReceiveResult()`, `WindowsPipeSender::Send` and `WindowsPipeSender::GetSendResult()`:
https://github.com/weidai11/cryptopp/blob/48809d4e85c125814425c621d8d0d89f95405924/winpipes.cpp#L94
At this state: https://github.com/weidai11/cryptopp/tree/8a02fe1787e62fb14f90650dee57024920c83adb
Compilation of `cryptest.exe` failed because of this:
```
g++ -o cryptest.exe -DNDEBUG -g2 -O3 -fPIC -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe bench.o bench2.o test.o validat0.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o ./libcryptopp.a -lws2_32
./libcryptopp.a(winpipes.o): In function `ZN8CryptoPP19WindowsPipeReceiver16GetReceiveResultEv':
C:\GitHub\cryptopp/winpipes.cpp:131: undefined reference to `non-virtual thunk to CryptoPP::WindowsPipeSource::GetHandle() const'
C:\GitHub\cryptopp/winpipes.cpp:131: undefined reference to `non-virtual thunk to CryptoPP::WindowsPipeSource::GetHandle() const'
./libcryptopp.a(winpipes.o): In function `ZN8CryptoPP19WindowsPipeReceiver7ReceiveEPhj':
C:\GitHub\cryptopp/winpipes.cpp:94: undefined reference to `non-virtual thunk to CryptoPP::WindowsPipeSource::GetHandle() const'
C:\GitHub\cryptopp/winpipes.cpp:94: undefined reference to `non-virtual thunk to CryptoPP::WindowsPipeSource::GetHandle() const'
collect2.exe: error: ld returned 1 exit status
```
After you pushed 5.6.3 RC6, these errors do not appear anymore. But I guess that's because these classes are not tested? Because you still have a pure virtual function that isn't overridden.
| WindowsPipeReceiver/Sender inherit a pure virtual function but do not override it | https://api.github.com/repos/weidai11/cryptopp/issues/62/comments | 6 | 2015-11-06T14:57:39Z | 2016-01-08T14:34:00Z | https://github.com/weidai11/cryptopp/issues/62 | 115,520,162 | 62 |
[
"weidai11",
"cryptopp"
] | László Böszörményi of Debian reports a hang near _"BlumBlumShub validation suite running..."_ when testing under Debian QEMU Chroot for ARM64. The hang is present under GCC 5.1, but is _not_ present under Clang on the same machine.
---
The issue is present with both `-std=c++03`, `-std=c++11`. Following [GCC miscompiles my code when optimizing...](https://gcc.gnu.org/wiki/FAQ#GCC_miscompiles_my_code_when_optimizing.2C_how_to_find_whether_it_is_a_bug_in_my_code_or_in_GCC_.3F), its also present with `-fno-strict-aliasing`. On other platforms and compilers, using the following produces no findings or problems: `-Wall -Wextra -Wstrict-aliasing=3 -Wstrict-overflow -Waggressive-loop-optimizations`. In fact, that's our "Elevated Warnings" test case (with a few more warnings added.
The issue appears to related to inlining. The issue is present with `-free` and `-findirect-inlining`. Building with `-fno-inline` or `-fno-devirtualize` resolves it at the expense of performance.
An additional issue is the GDB debugger does not work. It can start the program and even attach to the process, but that's about it. It can't break, and it does not provide symbols. LLDB is not available on this platform.
---
The hang _is not_ present in [GCC's compile farm](https://gcc.gnu.org/wiki/CompileFarm) using `gcc113.fsffrance.org` or `gcc115.fsffrance.org`:
```
$ uname -a
Linux gcc113 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:31:00 UTC 2015 aarch64 aarch64 aarch64 GNU/Linux
$ gcc --version
gcc (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
```
---
The hang _is_ present on a [LeMaker HiKey](http://www.amazon.com/gp/product/B019O3QTSA):
```
$ uname -a
Linux hikey 3.18.0-linaro-hikey #1 SMP PREEMPT Mon Nov 30 00:11:03 UTC 2015 aarch64 GNU/Linux
$ gcc --version
gcc (Debian/Linaro 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
```
---
<strike>A [HTC Desire 510](http://www.amazon.com/gp/product/B00QW45918) and a [Samsung Galaxy Core-Prime](http://www.amazon.com/dp/B00TRB5NUA) with a [Cortex-A53](http://www.arm.com/products/processors/cortex-a/cortex-a53-processor.php) [(ARMv8-a)](http://www.arm.com/products/processors/armv8-architecture.php) were ordered for additional on-device testing. But both devices did not live up to their press releases, and they came with 32-bit ARMv7.</strike>
A [DragonBoard 410c kit](http://www.amazon.com/gp/product/B01600X7IU) and [LeMaker HiKey](http://www.amazon.com/gp/product/B019O3QTSA) were ordered for additional on-device testing.
| Hang on Debian ARM64 QEMU Chroot | https://api.github.com/repos/weidai11/cryptopp/issues/61/comments | 1 | 2015-11-06T12:54:37Z | 2016-01-08T13:57:17Z | https://github.com/weidai11/cryptopp/issues/61 | 115,499,740 | 61 |
[
"weidai11",
"cryptopp"
] | - Version: 5.6.3 RC6
- Error message:
```
g++ -DNDEBUG -g2 -O2 -fPIC -march=native -pipe -c rdrand.cpp
rdrand.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
// rdrand.cpp - written and placed in public domain by Jeffrey Walton and Uri Blumenthal.
^
rdrand.cpp:435:5: error: #error "Please report on the Crypto++ user group"
# error "Please report on the Crypto++ user group"
^
GNUmakefile:449: recipe for target 'rdrand.o' failed
make: *** [rdrand.o] Error 1
```
- Preprocessor's defines: https://gist.github.com/Zireael-N/694402a705830b0e6723
- g++ --version: `g++.exe (Rev4, Built by MSYS2 project) 5.2.0`
| rdrand.cpp causes the library to fail to compile when using MinGW-w64 | https://api.github.com/repos/weidai11/cryptopp/issues/60/comments | 12 | 2015-11-06T11:17:26Z | 2016-01-07T15:21:35Z | https://github.com/weidai11/cryptopp/issues/60 | 115,486,173 | 60 |
[
"weidai11",
"cryptopp"
] | Cross-compiling produced many errors today on OpenSUSE 13.1 and Travis CI (Ubuntu 12.40).
We used to follow the procedure described in http://www.cryptopp.com/wiki/Android_%28Command_Line%29 . That means, we downloaded the patched files and then built cryptopp for android. This still worked 7 days ago. With the new commits today, this does not work anymore.
I believe that this is because of the many changes in the new commits. We tried to apply the patch (from the wiki) to a fresh copy of cryptopp, but patch failed:
```
> patch < mobile.diff
patching file wait.h
Hunk #1 succeeded at 19 with fuzz 1 (offset 4 lines).
patching file wait.cpp
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] y
Hunk #1 FAILED at 363.
1 out of 1 hunk FAILED -- saving rejects to file wait.cpp.rej
patching file validat1.cpp
Hunk #1 succeeded at 18 (offset 6 lines).
patching file test.cpp
Hunk #1 succeeded at 34 (offset 5 lines).
patching file iterhash.h
patching file GNUmakefile
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 36.
Hunk #3 FAILED at 86.
Hunk #4 FAILED at 146.
Hunk #5 FAILED at 165.
5 out of 5 hunks FAILED -- saving rejects to file GNUmakefile.rej
patching file config.h
Hunk #1 succeeded at 93 with fuzz 2 (offset 47 lines).
Hunk #2 succeeded at 355 with fuzz 1 (offset 101 lines).
Hunk #3 FAILED at 367.
Hunk #4 succeeded at 513 (offset 128 lines).
1 out of 4 hunks FAILED -- saving rejects to file config.h.rej
patching file algparam.h
Hunk #1 FAILED at 320.
1 out of 1 hunk FAILED -- saving rejects to file algparam.h.rej
```
We then had a look at the new GNUmakefile and saw, that it already has built-in many features of the patch. So we tried to just use that GNUmakefile for cross-compiling for android. That did not work with the following error message:
```
arm-linux-androideabi-g++ -DNDEBUG -g2 -O2 -fPIC -march=native -pipe -c cryptlib.cpp
Assembler messages:
Error: unknown architecture `native'
Error: unrecognized option -march=native
cc1plus: error: unrecognized argument in option '-march=native'
cc1plus: note: valid arguments to '-march=' are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6 armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv8-a iwmmxt iwmmxt2 native
```
So we changed the GNUmakefile and just commented out the line CXXFLAGS += -march=native (dirty). Cryptopp then compiled, but when we built our library depending on cryptopp, we encountered the following error:
```
include/cryptopp/config.h:667:3: error: #error "std::uncaught_exception is not available. This is likely a configuration error."
# error "std::uncaught_exception is not available. This is likely a configuration error."
^
include/cryptopp/secblock.h: In member function 'void CryptoPP::AllocatorBase<T>::construct(U*, Args&& ...)':
include/cryptopp/secblock.h:64:66: error: 'forward' is not a member of 'std'
void construct(U* ptr, Args&&... args) {::new ((void*)ptr) U(std::forward<Args>(args)...);}
^
include/cryptopp/secblock.h:64:83: error: expected primary-expression before '>' token
void construct(U* ptr, Args&&... args) {::new ((void*)ptr) U(std::forward<Args>(args)...);}
^
```
Did you already test cross-compiling for android? Can you reproduce the problems?
| Cross-compiling for android does not work anymore on OpenSUSE and Travis CI | https://api.github.com/repos/weidai11/cryptopp/issues/59/comments | 5 | 2015-11-05T14:29:44Z | 2016-01-08T14:30:36Z | https://github.com/weidai11/cryptopp/issues/59 | 115,295,158 | 59 |
[
"weidai11",
"cryptopp"
] | These are the issues we are aware that should be fixed prior to 5.6.3 release. They were reported after RC6 (give or take...). We are tracking them under a single bug report.
- Guard `CRYPTOPP_CXX11_ALIGNOF` on MSC `1900`
- `cryptest.exe tv all` does not run HKDF tests. Need to add `hkdf.txt` to `all.txt`.
- _"... to the ABI and ABI"_ → _"... to the ABI and API"_ in `Readme.txt`.
- MinGW and _`error: 'memcpy_s' was not declared in this scope`_. Cleared with a `using CryptoPP::memcpy_s;`
- MinGW and `rdrand` detection. Investigating.
- Remove unneeded `-Wno-unused-function -Wno-unused-parameter -Wno-unused-variable` from `GNUmakefile-cross`.
- Change `GNUmakefile`'s `make docs` recipe to use `ref<Version>` as the output directory.
- Change `GNUmakefile`'s to avoid `-fPIC` for MinGW.
- Remove `CRYPTOPP_DISABLE_SHA_ASM` from `sha.h` and `sha.cpp`. Its an artifact from earlier testing.
- [Issue 64: PolynomialMod2::operator<<= Bug](http://github.com/weidai11/cryptopp/issues/64) - fixed the `reg.Grow(...)` logic
- [Issue 24: Compiler warnings on GCC and MinGW]() - cleared the longmp warning
| Rollup of errata items to be fixed before release | https://api.github.com/repos/weidai11/cryptopp/issues/58/comments | 6 | 2015-11-05T11:21:49Z | 2015-11-18T20:21:46Z | https://github.com/weidai11/cryptopp/issues/58 | 115,263,888 | 58 |
[
"weidai11",
"cryptopp"
] | ```
make
...
g++ -DNDEBUG -std=c++03 -g3 -O1 -march=native -pipe -c nbtheory.cpp
In file included from nbtheory.cpp:14:0:
c:\mingw\include\math.h: In function 'float hypotf(float, float)':
c:\mingw\include\math.h:635:30: error: '_hypot' was not declared in this scope
{ return (float)(_hypot (x, y)); }
^
```
| MinGW cannot compile the library due to missing symbol MinGW _hypot | https://api.github.com/repos/weidai11/cryptopp/issues/57/comments | 2 | 2015-11-02T00:32:21Z | 2015-11-04T03:43:10Z | https://github.com/weidai11/cryptopp/issues/57 | 114,504,363 | 57 |
[
"weidai11",
"cryptopp"
] | Maximilian Zamorsky reports `WaitObjectsTracer` causes dirty compile under VS2015:
```
1> network.cpp
1>...\cryptopp\wait.h(141): error C2220: warning treated as error - no 'object' file generated
1>...\cryptopp\wait.h(141): warning C4589: Constructor of abstract class 'WaitObjectsTracer' ignores initializer for virtual base class 'Tracer'
1> ...\cryptopp\wait.h(141): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
1> ...\cryptopp\wait.h(141): note: virtual base classes are only initialized by the most-derived type
```
This appears to be a bug in Visual Studio 2015; see [VS 2015 generates a copy constructor and then complains about it](http://connect.microsoft.com/VisualStudio/feedback/details/1570496/) on Microsoft Connect.
| WaitObjectsTracer causes dirty compile under VS2015 | https://api.github.com/repos/weidai11/cryptopp/issues/56/comments | 8 | 2015-11-01T14:15:39Z | 2016-07-04T12:54:44Z | https://github.com/weidai11/cryptopp/issues/56 | 114,471,620 | 56 |
[
"weidai11",
"cryptopp"
] | `test.cpp` and `bench.cpp` include [`#define _CRT_SECURE_NO_DEPRECATE`](http://msdn.microsoft.com/en-us/library/8ef0s5kh.aspx). From [Security Features in the CRT](https://msdn.microsoft.com/en-us/library/8ef0s5kh.aspx):
> There are several ways to eliminate deprecation warnings for the older, less secure functions. The simplest is simply to define _CRT_SECURE_NO_WARNINGS or use the warning pragma. Either will disable deprecation warnings, but of course the security issues that caused the warnings still exist. It is far better to leave deprecation warnings enabled and take advantage of the new CRT security features.
Other ways the Secure CRT Warning can be disabled include `pragma warning(disable: 4996)`. An audit of the proposed 5.6.3 changes shows its used in one place, and that's [`misc.h` around line 150](https://www.cryptopp.com/docs/ref/misc_8h_source.html#l00150).
`pragma warning(disable: 4996)` is used because `misc.h` provides wrappers for `memcpy_s` and `memmove_s`. Once we removed the `_CRT_SECURE_NO_DEPRECATE` define, `misc.h` generated a C4996 warning. We ensured the code performs the requisite bounds check, and then disabled the warning on the two wrapper functions. An auditor should sign-off on it.
We also disable Enterprise Analysis warning C6386 because Microsoft performs the same in their headers. Confer, the late answer at [Disabling Warnings generated via `_CRT_SECURE_NO_DEPRECATE`](http://stackoverflow.com/a/32858904/608639).
This is a Certification and Accreditation (C&A) item.
| _CRT_SECURE_NO_DEPRECATE is used under Windows | https://api.github.com/repos/weidai11/cryptopp/issues/55/comments | 1 | 2015-11-01T00:01:09Z | 2016-01-08T14:31:28Z | https://github.com/weidai11/cryptopp/issues/55 | 114,441,365 | 55 |
[
"weidai11",
"cryptopp"
] | **_Background**_
Crypto++ 5.6.3 and above use GCC's [`init_priority`](http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html) in an effort to tame the [C++ Static Initialization Order Fiasco](http://cryptopp.com/wiki/Static_Initialization_Order_Fiasco). Its an optional feature that is disabled by default under 5.6.3. It can be enabled with `CXXFLAGS="-DCRYPTOPP_INIT_PRIORITY=250"` (or similar).
OS X has about 6 projects that provide Unix and Linux tools on OS X. The projects are called "ports' and they include:
- Fink
- Gentoo/Alt
- Homebrew
- MacPorts
- Pkgsrc
- Rudix
Some of the ports provide GCC, but they do not enable `init_priority` support and subsequently fail the compile. The compiler appears to be acting as a proxy for the linker, and assume `init_priority` is an error because the OS X linker does not offer a pubic interface to control the order. Or maybe more correctly, Apple did not respond to a GNU/Binutils bug report on the subject. (Its not clear if the linker would actually fail a link if the metadata was present).
As far as we know, Fink will accept `init_priority`, and MacPorts will reject `init_priority`. We don't know what the other ports are doing. Additionally, other compilers are OK, like Apple's GCC and Clang.
We attempted to acquire metrics to help gauge the impact of disabling `init_priority` among a ports collection, but MacPorts does not test its compilers. Also see [Does MacPorts provide its Test/QA results online?](https://lists.macosforge.org/pipermail/macports-users/2015-October/039739.html)
**_Strategies**_
We don't have a strategy for dealing with GCC-compatible compilers that refuse to compile a program. The two strategies being considered are:
1. disable `init_priority` for all non-Apple GCC compilers
2. disable `init_priority` for port compilers that refuse to compile the program
_Strategy 1_ disables `init_priority` for all GCC compilers since Apple no longer provides GCC. For example, if we detect any port like Fink (and not just a problematic port like MacPorts), then the code disables `init_priority`.
_Strategy 2_ disables `init_priority` on a per-need basis. For example, if we detect a problematic port like MacPorts (and not just any port like Fink), then the code disables `init_priority`.
| Need a strategy for dealing with OS X ported compilers | https://api.github.com/repos/weidai11/cryptopp/issues/54/comments | 2 | 2015-10-31T12:10:54Z | 2015-11-18T21:31:39Z | https://github.com/weidai11/cryptopp/issues/54 | 114,406,478 | 54 |
[
"weidai11",
"cryptopp"
] | Here are some test results from Debian Unstable (x64) with GCC 4.9. The messages below are from the log file called `cryptest-result.sh`, which is created by the test script located at [Release Testing](https://cryptopp.com/wiki/Release_Testing).
Though not readily apparent, they are produced by the following configurations:
- Debug, C++11
- Release, C++11
- Valgrind, Debug, C++11
- Valgrind, Release, C++11
- Undefined Behavior sanitizer, C++11
- Address sanitizer, C++11
Omitting `-std=` and using `-std=c++03` avoids the issue.
---
Here is what a single squawk looks like:
```
cryptlib.h:864:39: error: ‘__m128i _mm_aesdeclast_si128(__m128i, __m128i)’ conflicts with a previous declaration
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE BufferedTransformation : public Algorithm, public Waitable
^
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:43:0,
from /usr/include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33,
from /usr/include/c++/4.9/random:50,
from /usr/include/c++/4.9/bits/stl_algo.h:66,
from /usr/include/c++/4.9/algorithm:62,
from stdcpp.h:13,
from cryptlib.h:85,
from misc.h:11,
from cpu.cpp:13:
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:52:1: note: previous declaration ‘__m128i _mm_aesdeclast_si128(__m128i, __m128i)’
_mm_aesdeclast_si128 (__m128i __X, __m128i __Y)
^
In file included from cpu.cpp:12:0:
cpu.h:89:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
_mm_aesdeclast_si128 (__m128i a, __m128i b)
^
```
---
5038:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:44:1: error: redefinition of ‘__m128i _mm_aesdec_si128(__m128i, __m128i)’
5055:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:52:1: error: redefinition of ‘__m128i _mm_aesdeclast_si128(__m128i, __m128i)’
5072:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:61:1: error: redefinition of ‘__m128i _mm_aesenc_si128(__m128i, __m128i)’
5089:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:69:1: error: redefinition of ‘__m128i _mm_aesenclast_si128(__m128i, __m128i)’
5106:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:77:1: error: redefinition of ‘__m128i _mm_aesimc_si128(__m128i)’
5123:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:87:1: error: redefinition of ‘__m128i _mm_aeskeygenassist_si128(__m128i, int)’
5140:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:116:1: error: redefinition of ‘__m128i _mm_clmulepi64_si128(__m128i, __m128i, int)’
5150:cryptlib.h:864:39: error: ‘__m128i _mm_aesdeclast_si128(__m128i, __m128i)’ conflicts with a previous declaration
5166:cpu.h:89:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5171:cryptlib.h:864:39: error: ‘__m128i _mm_aesdec_si128(__m128i, __m128i)’ conflicts with a previous declaration
5187:cpu.h:83:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5192:cryptlib.h:864:39: error: ‘__m128i _mm_aesenclast_si128(__m128i, __m128i)’ conflicts with a previous declaration
5208:cpu.h:77:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5213:cryptlib.h:864:39: error: ‘__m128i _mm_aesenc_si128(__m128i, __m128i)’ conflicts with a previous declaration
5229:cpu.h:71:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5234:cryptlib.h:864:39: error: ‘__m128i _mm_aesimc_si128(__m128i)’ conflicts with a previous declaration
5250:cpu.h:64:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5255:cryptlib.h:864:39: error: ‘__m128i _mm_aeskeygenassist_si128(__m128i, int)’ conflicts with a previous declaration
5271:cpu.h:57:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5276:cryptlib.h:864:39: error: ‘__m128i _mm_clmulepi64_si128(__m128i, __m128i, int)’ conflicts with a previous declaration
5292:cpu.h:51:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5320:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:44:1: error: redefinition of ‘__m128i _mm_aesdec_si128(__m128i, __m128i)’
5337:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:52:1: error: redefinition of ‘__m128i _mm_aesdeclast_si128(__m128i, __m128i)’
5354:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:61:1: error: redefinition of ‘__m128i _mm_aesenc_si128(__m128i, __m128i)’
5371:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:69:1: error: redefinition of ‘__m128i _mm_aesenclast_si128(__m128i, __m128i)’
5388:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:77:1: error: redefinition of ‘__m128i _mm_aesimc_si128(__m128i)’
5405:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:87:1: error: redefinition of ‘__m128i _mm_aeskeygenassist_si128(__m128i, int)’
5422:/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h:116:1: error: redefinition of ‘__m128i _mm_clmulepi64_si128(__m128i, __m128i, int)’
5432:cryptlib.h:864:39: error: ‘__m128i _mm_aesdeclast_si128(__m128i, __m128i)’ conflicts with a previous declaration
5448:cpu.h:89:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5453:cryptlib.h:864:39: error: ‘__m128i _mm_aesdec_si128(__m128i, __m128i)’ conflicts with a previous declaration
5469:cpu.h:83:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5474:cryptlib.h:864:39: error: ‘__m128i _mm_aesenclast_si128(__m128i, __m128i)’ conflicts with a previous declaration
5490:cpu.h:77:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5495:cryptlib.h:864:39: error: ‘__m128i _mm_aesenc_si128(__m128i, __m128i)’ conflicts with a previous declaration
5511:cpu.h:71:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5516:cryptlib.h:864:39: error: ‘__m128i _mm_aesimc_si128(__m128i)’ conflicts with a previous declaration
5532:cpu.h:64:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5537:cryptlib.h:864:39: error: ‘__m128i _mm_aeskeygenassist_si128(__m128i, int)’ conflicts with a previous declaration
5553:cpu.h:57:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
5558:cryptlib.h:864:39: error: ‘__m128i _mm_clmulepi64_si128(__m128i, __m128i, int)’ conflicts with a previous declaration
5574:cpu.h:51:1: note: -fabi-version=6 (or =0) avoids this error with a change in mangling
| Compile Failure under Debian Unstable (x64), GCC 4.9, -std=c++11 | https://api.github.com/repos/weidai11/cryptopp/issues/53/comments | 2 | 2015-10-31T08:51:37Z | 2016-01-04T08:30:21Z | https://github.com/weidai11/cryptopp/issues/53 | 114,398,710 | 53 |
[
"weidai11",
"cryptopp"
] | This is a Microsoft SDLC finding, and we need to switch to `wcstombs_s` for C&A purposes.
In addition, we need some test cases for the conversion.
| StringNarrow uses wcstombs on Microsoft platforms | https://api.github.com/repos/weidai11/cryptopp/issues/52/comments | 1 | 2015-10-31T03:45:37Z | 2016-01-08T14:31:50Z | https://github.com/weidai11/cryptopp/issues/52 | 114,384,932 | 52 |
[
"weidai11",
"cryptopp"
] | Reference [FIPS 186-3 Change Notice (2-28-12)](http://csrc.nist.gov/groups/ST/toolkit/documents/FIPS186-3_ChangeNotice041012.pdf). From 5, _Processing Step Error in the Secret Number Generation for ECDSA_:
> In Appendices B.5.1 and B.5.2, processing step 1 (i.e., N = len(q)) is incorrect. This change notice specifies the following change to step 1: “N = len(n),” ; i.e., “q” is changed to “n”
>
> This change may be significant if the cofactor is greater than one; for the NIST-recommended curves, the cofactor is one, so in this case, both values produce the same value for N.
A cofactor of 2 and 4 are common. Crypto++ optionally operates on ANSI X9.62 and WTLS curves, and some of them have a cofactor that is quite large. The curves are optional because its a [free community patch](https://cryptopp.com/wiki/Object_Identifiers).
| Verify conformance with FIPS 186-4, Change Notice, Item 5 | https://api.github.com/repos/weidai11/cryptopp/issues/51/comments | 2 | 2015-10-30T21:54:19Z | 2015-10-31T14:08:59Z | https://github.com/weidai11/cryptopp/issues/51 | 114,362,523 | 51 |
[
"weidai11",
"cryptopp"
] | ```
$ make dll.o dsa.o
g++ ... -DCRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY ... -c dll.cpp
In file included from dll.h:18:0,
from dll.cpp:6:
dsa.h: In function ‘bool CryptoPP::GenerateDSAPrimes(const byte*, size_t, int&, CryptoPP::Integer&, unsigned int, CryptoPP::Integer&)’:
dsa.h:30:10: error: ‘GeneratePrimes’ is not a member of ‘CryptoPP::DSA {aka CryptoPP::DSA2<CryptoPP::SHA1>}’
{return DSA::GeneratePrimes(seed, seedLength, counter, p, primeLength, q);}
^
GNUmakefile:424: recipe for target 'dll.o' failed
```
---
`GeneratePrimes` appears to be a function from an earlier version of the library. I cannot find a definition for it in Crypto++ 5.6.2.
The other issues were cleared (relatively easily). This is the one that remains.
---
Here's the result of the same error under the [test script]() used for comprehensive testing:
```
...
Testing started: Sat Oct 31 07:00:03 UTC 2015
Testing finished: Sat Oct 31 08:38:15 UTC 2015
21 configurations tested
1 errors detected
7753:dsa.h:30:10: error: ‘GeneratePrimes’ is not a member of ‘CryptoPP::DSA {aka CryptoPP::DSA2<CryptoPP::SHA1>}’
```
| GeneratePrimes is not a member of CryptoPP::DSA with CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY | https://api.github.com/repos/weidai11/cryptopp/issues/50/comments | 1 | 2015-10-29T15:52:00Z | 2015-10-31T13:28:40Z | https://github.com/weidai11/cryptopp/issues/50 | 114,080,772 | 50 |
[
"weidai11",
"cryptopp"
] | When running [`cryptest.sh`](http://cryptopp.com/wiki/Release_Testing#Test_Script) under Cygwin-i686 and the sanitizers, the `cryptest.exe` program fails to build:
```
...
g++ -DDEBUG -g2 -O2 -std=c++03 -fsanitize=address -march=native -pipe -c fipsalgt.cpp
g++ -DDEBUG -g2 -O2 -std=c++03 -fsanitize=address -march=native -pipe -c dlltest.cpp
g++ -o cryptest.exe -DDEBUG -g2 -O2 -std=c++03 -fsanitize=address -march=native -pipe bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o ./libcryptopp.a
/usr/lib/gcc/i686-pc-cygwin/4.9.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lasan
collect2: error: ld returned 1 exit status
GNUmakefile:333: recipe for target 'cryptest.exe' failed
```
The host is Windows 7, x64:
```
$ uname -a
CYGWIN_NT-6.1-WOW windows-7-x64 2.2.1(0.289/5/3) 2015-08-20 11:40 i686 Cygwin
```
Naively it seems like a simple package problem. However, I can't seem to locate the package. Searching for **_`ubsan`**_ results in 0 hits. Also see [What package do I need for Cygwin's UBsan?](http://stackoverflow.com/q/33375789) on Stack Overflow.
| Cryptest.exe fails to build under Cygwin-i686 with sanitizer flags | https://api.github.com/repos/weidai11/cryptopp/issues/49/comments | 1 | 2015-10-27T18:36:43Z | 2016-01-04T08:58:41Z | https://github.com/weidai11/cryptopp/issues/49 | 113,652,701 | 49 |
[
"weidai11",
"cryptopp"
] | Opened to tend to all issues related to dirty compiles due to use of `auto_ptr` and C++011. It includes [Issue 17](https://github.com/weidai11/cryptopp/issues/17).
Bug 17 cleared the issue under Cygwin by using a lot of define magic to determine when C++ 11 was **_really**_ available, and then switched to a `unique_ptr` if C++11 was really available. Its correct, but it might not be the easiest way to get there.
Denis provided an insightful observation in [Issue 17](https://github.com/weidai11/cryptopp/issues/17), but it was kind of lost upon us as we rushed to use C++ language features to solve the problem. The problem was more cleanly solved...
We found we could simply use `member_ptr` from `smartptr.h`. `member_ptr` (1) provides the basic functionality we need, and (2) provides `reset` and `release`. `member_ptr` allows us to (3) forgo all the additional logic need to determine when `unique_ptr` was **_really**_ available, and (4) forgo the `using auto_ptr = unique_ptr<T>` template declaration.
| Use of auto_ptr causes dirty compile under C++11 | https://api.github.com/repos/weidai11/cryptopp/issues/48/comments | 3 | 2015-10-27T02:00:32Z | 2015-11-01T02:09:22Z | https://github.com/weidai11/cryptopp/issues/48 | 113,489,097 | 48 |
[
"weidai11",
"cryptopp"
] | László Böszörményi of Debian reports a hang in SHA self tests when testing under Debian Sid (Unstable) with GCC 5.2 and older hardware. The older hardware includes a Core2 Duo and AMD Athlon.
| Hang in SHA with Debian Sid, GCC 5.2 and Core2 Duo hardware | https://api.github.com/repos/weidai11/cryptopp/issues/47/comments | 1 | 2015-10-26T17:21:38Z | 2016-01-04T08:56:58Z | https://github.com/weidai11/cryptopp/issues/47 | 113,406,357 | 47 |
[
"weidai11",
"cryptopp"
] | GCC offers `-fdevirtualize` option, which appears to be similar to Microsoft's `__declspec(novtable)`. See [Options That Control Optimization](http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html)
| Attempt to support GCC's -fdevirtualize | https://api.github.com/repos/weidai11/cryptopp/issues/45/comments | 6 | 2015-10-25T08:00:41Z | 2016-01-04T08:57:25Z | https://github.com/weidai11/cryptopp/issues/45 | 113,212,350 | 45 |
[
"weidai11",
"cryptopp"
] | Here's the full message:
```
==6985== Conditional jump or move depends on uninitialised value(s)
==6985== at 0x557A328: CryptoPP::DetectX86Features() (in /usr/lib/libcryptopp.so)
==6985== by 0x55613F0: CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&) (in /usr/lib/libcryptopp.so)
==6985== by 0x55191CC: CryptoPP::GCM_Base::SetKeyWithoutResync(unsigned char const*, unsigned long, CryptoPP::NameValuePairs const&) (in /usr/lib/libcryptopp.so)
==6985== by 0x5498312: CryptoPP::AuthenticatedSymmetricCipherBase::SetKey(unsigned char const*, unsigned long, CryptoPP::NameValuePairs const&) (in /usr/lib/libcryptopp.so)
==6985== by 0x557F7A4: CryptoPP::SimpleKeyingInterface::SetKeyWithIV(unsigned char const*, unsigned long, unsigned char const*, unsigned long) (in /usr/lib/libcryptopp.so)
```
Code calling Crypto++:
``` c++
// These are defined before:
// std::vector<uint8_t> plaintext;
// byte key[];
// byte iv[];
#define TAG_SIZE 12
std::string ciphertext;
CryptoPP::GCM< CryptoPP::AES >::Encryption e;
e.SetKeyWithIV(key, sizeof(key), iv, sizeof(iv));
CryptoPP::ArraySource ss(plaintext.data(), plaintext.size(), true,
new CryptoPP::AuthenticatedEncryptionFilter(e,
new CryptoPP::StringSink(encrypted), false, TAG_SIZE
)
);
```
I believe it has something to do with **cryptopp/cpu.cpp** containing this:
``` c++
void DetectX86Features()
{
// ...
word32 cpuid2[4]; // uninitialized
CpuId(0x080000000, cpuid2);
if (cpuid2[0] >= 0x080000001)
```
And this:
```
bool CpuId(word32 input, word32 *output)
{
#ifdef CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY
// ...
#else
SigHandler oldHandler = signal(SIGILL, SigIllHandlerCPUID);
if (oldHandler == SIG_ERR)
return false; // still uninitialized
bool result = true;
if (setjmp(s_jmpNoCPUID))
result = false; // still uninitialized, since the else-statement
// contains the code that changes output[]
else
{
// ...
```
But it's just an assumption, because I couldn't succeed to build shared libraries of Crypto++ on Linux myself, thus I can't test it.
| Valgrind: "Conditional jump or move depends on uninitialised value(s)" | https://api.github.com/repos/weidai11/cryptopp/issues/44/comments | 14 | 2015-10-24T21:39:19Z | 2017-01-28T15:32:21Z | https://github.com/weidai11/cryptopp/issues/44 | 113,184,715 | 44 |
[
"weidai11",
"cryptopp"
] | The system is Windows XP 64-bit and Visual Studio 2005. The issue is **_not**_ present with Windows 8 64-bit and Visual Studio 2010 and 2012.
With `CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS` undefined (i.e., aligned data access), a Visual Studio build for X86 using an `AutoSeededRandomPool` results in a crash. `TestAutoSeeded` is similar to `TestOS_RNG`:
```
AutoSeededRandomPool prng;
MeterFilter meter(new Redirector(TheBitBucket()));
RandomNumberSource test(prng, 100000, true, new Deflator(new Redirector(meter)));
...
```
The `cryptest.exe!_chkstk() Line 99` is the `test dword ptr [eax],eax` below:
```
; Find next lower page and probe
cs20:
sub eax, _PAGESIZE_ ; decrease by PAGESIZE
test dword ptr [eax],eax ; probe page.
jmp short cs10
```
The call stack looks like:
```
cryptest.exe!_chkstk() Line 99 Asm
cryptest.exe!CryptoPP::Rijndael::Enc::ProcessAndXorBlock(const unsigned char * inBlock=0x0012da88, const unsigned char * xorBlock=0x00000000, unsigned char * outBlock=0x0012da88) Line 359 + 0x18 bytes C++
cryptest.exe!CryptoPP::BlockTransformation::ProcessBlock(unsigned char * inoutBlock=0x0012da88) Line 455 + 0x1e bytes C++
cryptest.exe!CryptoPP::RandomPool::GenerateIntoBufferedTransformation(CryptoPP::BufferedTransformation & target={...}, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & channel="", unsigned __int64 size=100000) Line 54 C++
cryptest.exe!CryptoPP::RandomNumberStore::TransferTo2(CryptoPP::BufferedTransformation & target={...}, unsigned __int64 & transferBytes=100000, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & channel="", bool blocking=true) Line 1131 C++
cryptest.exe!CryptoPP::BufferedTransformation::TransferMessagesTo2(CryptoPP::BufferedTransformation & target={...}, unsigned int & messageCount=0, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & channel="", bool blocking=true) Line 566 + 0x1d bytes C++
cryptest.exe!CryptoPP::BufferedTransformation::TransferAllTo2(CryptoPP::BufferedTransformation & target={...}, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & channel="", bool blocking=true) Line 612 + 0x18 bytes C++
cryptest.exe!CryptoPP::SourceTemplate<CryptoPP::RandomNumberStore>::PumpAll2(bool blocking=true) Line 794 + 0x2c bytes C++
cryptest.exe!CryptoPP::Source::PumpAll() Line 765 + 0x19 bytes C++
cryptest.exe!CryptoPP::Source::SourceInitialize(bool pumpAll=true, const CryptoPP::NameValuePairs & parameters={...}) Line 777 C++
cryptest.exe!CryptoPP::RandomNumberSource::RandomNumberSource(CryptoPP::RandomNumberGenerator & rng={...}, int length=100000, bool pumpAll=true, CryptoPP::BufferedTransformation * attachment=0x008001c8) Line 832 + 0x96 bytes C++
cryptest.exe!TestAutoSeeded() Line 401 + 0xca bytes C++
cryptest.exe!ValidateAll(bool thorough=false) Line 58 + 0x5 bytes C++
cryptest.exe!Validate(int alg=0, bool thorough=false, const char * seedInput=0x00000000) Line 818 + 0x9 bytes C++
```
| Crash in AutoSeededRandomPool under Windows XP, VS2005, Aligned Data Access | https://api.github.com/repos/weidai11/cryptopp/issues/43/comments | 0 | 2015-10-23T07:11:15Z | 2015-10-31T14:01:00Z | https://github.com/weidai11/cryptopp/issues/43 | 112,966,041 | 43 |
[
"weidai11",
"cryptopp"
] | With `CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS` undefined (i.e., aligned data access), a Visual Studio build for X64 results in:
```
------ Build started: Project: cryptest, Configuration: Debug x64 ------
Linking...
cryptlib.lib(x64dll.obj) : error LNK2001: unresolved external symbol
"unsigned __int64 CryptoPP::rdtable::Te" (?Te@rdtable@CryptoPP@@3PA_KA)
x64\Output\Debug\cryptest.exe : fatal error LNK1120: 1 unresolved externals
```
To duplicate the issue, ensure `CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS` is **_not**_ defined. Under 5.6.3 (and above), `CRYPTOPP_NO_UNALIGNED_DATA_ACCESS` can be defined to facilitate it.
The fix would appear to be simple (like ensure an aligned version of `rdtable::Te` is available), but its not. That's because there's an implicit assumption that Rijndael/AES is using compressed tables when unaligned data access is allowed.
| Undefined symbol `rdtable::Te` under Visual Studio, X64, Aligned Data Access | https://api.github.com/repos/weidai11/cryptopp/issues/42/comments | 4 | 2015-10-23T05:56:46Z | 2017-05-22T01:53:36Z | https://github.com/weidai11/cryptopp/issues/42 | 112,958,289 | 42 |
[
"weidai11",
"cryptopp"
] | Here are the symptoms:
```
$ make
g++ -DNDEBUG -g2 -O3 -march=native -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -pipe -c cryptlib.cpp
g++ -DNDEBUG -g2 -O3 -march=native -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -pipe -c shacal2.cpp
...
$ ./cryptest.exe v
...
MQV validation suite running...
passed authenticated key agreement domain parameters validation
...
$ gdb ./cryptest.exe
...
Program received signal SIGSEGV, Segmentation fault.
CryptoPP::DL_GroupParameters_IntegerBased::GetEncodedElementSize (this=0x11,
reversible=0x1) at gfpcrypt.h:65
65 {CRYPTOPP_UNUSED(reversible); return GetModulus().ByteCount();}
(gdb)
```
Here is the platform and compiler version:
```
$ g++ --version
g++ (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname -a
CYGWIN_NT-6.1-WOW windows-7-x64 2.2.1(0.289/5/3) 2015-08-20 11:40 i686 Cygwin
```
The issue is present with `-DCRYPTOPP_DISABLE_ASM`.
Despite best efforts, its still unclear why `this` pointer is `0x11`.
| Crash in DL_GroupParameters_IntegerBased::GetEncodedElementSize for Cygwin i386 at -O3 | https://api.github.com/repos/weidai11/cryptopp/issues/40/comments | 1 | 2015-10-10T16:47:27Z | 2016-01-07T15:21:58Z | https://github.com/weidai11/cryptopp/issues/40 | 110,804,776 | 40 |
[
"weidai11",
"cryptopp"
] | László Böszörményi of Debian reports the following issue when testing under Debian Unstable.
```
passed: sizeof(hword) == 4, sizeof(word) == 8, sizeof(dword) == 16
FAILED: hasMMX == 1, hasISSE == 1, hasSSE2 == 1, hasSSSE3 == 0,
hasAESNI == 0, hasCLMUL == 0, isP4 == 0, cacheLineSize == 808,
AESNI_INTRINSICS == 1
Some critical setting in config.h is in error. Please fix it and recompile.
Process terminating with default action of signal 6 (SIGABRT)
at 0x5FA1107: raise (raise.c:56)
by 0x5FA24E7: abort (abort.c:89)
by 0x5CBF1F: TestSettings() (validat1.cpp:280)
by 0x5CB2D1: ValidateAll(bool) (validat1.cpp:66)
by 0x5B887E: Validate(int, bool, char const*) (test.cpp:819)
by 0x5B33BB: main (test.cpp:343)
...
```
The `SIGABRT` is due to an assert firing because `cacheLineSize == 808`.
Its unclear what the issue is or how to reproduce it.
| Feature detection issue in Debian Unstable | https://api.github.com/repos/weidai11/cryptopp/issues/39/comments | 2 | 2015-10-09T18:45:25Z | 2016-01-07T15:28:43Z | https://github.com/weidai11/cryptopp/issues/39 | 110,715,718 | 39 |
[
"weidai11",
"cryptopp"
] | Testing of `RandomNumberGenerator::GenerateWord32` revealed a potential bug in `GenerateBlock`. `GenerateBlock` calls `GenerateIntoBufferedTransformation`. `GenerateIntoBufferedTransformation`, in turn, calls, `GenerateBlock`. Ad infinitum.
In the past, a patch to call `OS_GenerateRandom` was declined; see [Patch for RandomNumberGenerator::GenerateIntoBufferedTransformation bug](https://groups.google.com/d/msg/cryptopp-users/GUtJOdx9ltU/WPI8Q70MJ7oJ). It turns out that was not a bad decision. But the issue endured and we got a private bug report against 5.6.3rc4 due to it.
I dug up an old email thread with Wei on the same subject (from 2012 or so), and here's what he had to say about it:
> Yeah, you're not supposed to use it directly. It's just meant to define the interface that other RNGs are supposed to implement, and includes some helper functions. I should probably make it so that it can't be instantiated.
So I'd like to make it so it can't be instantiated. The best way I know is to remove the implementations for `GenerateIntoBufferedTransformation` and `GenerateBlock`, and make them pure virtuals.
| Crash in RandomNumberGenerator::GenerateWord32 due to stack recursion | https://api.github.com/repos/weidai11/cryptopp/issues/38/comments | 6 | 2015-10-06T19:49:26Z | 2015-10-31T14:08:17Z | https://github.com/weidai11/cryptopp/issues/38 | 110,085,954 | 38 |
[
"weidai11",
"cryptopp"
] | ```
$ . ./setenv-ios.sh
$ make -f GNUmakefile-cross
clang++ -DNDEBUG -g2 -Os -mios-version-min=5.1 -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -DCRYPTOPP_DISABLE_ASM
-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
-stdlib=libc++ -c cryptlib.cpp
...
JWs-iPad:~/cryptopp563 root# ./cryptest.exe tv sha
Using seed: 1443896312
Testing MessageDigest algorithm SHA-1.
...
Testing MessageDigest algorithm SHA-224.
...
Testing MessageDigest algorithm SHA-256.
...
Testing MessageDigest algorithm SHA-384.
...Abort trap: 6
```
| Crash in SHA under iOS 5.1.1 | https://api.github.com/repos/weidai11/cryptopp/issues/37/comments | 4 | 2015-10-03T18:19:42Z | 2016-01-04T08:56:24Z | https://github.com/weidai11/cryptopp/issues/37 | 109,637,031 | 37 |
[
"weidai11",
"cryptopp"
] | See [How to change the include file path with autotools?](http://stackoverflow.com/q/32805772)
We invited the Debian, Fedora and Macport maintainers to comment and provide general advice.
| Crypto++ should provide a pkg-config for users and distros | https://api.github.com/repos/weidai11/cryptopp/issues/36/comments | 1 | 2015-10-03T07:35:31Z | 2018-04-25T05:08:14Z | https://github.com/weidai11/cryptopp/issues/36 | 109,607,805 | 36 |
[
"weidai11",
"cryptopp"
] | Hi,
there is an assert in an app I try to build when encrypting the user data.
The affected function is here:
https://github.com/ola-ct/Qt-SESAM/blob/master/libSESAM/crypter.cpp#L139
The code runs in an assert here:
https://github.com/weidai11/cryptopp/blob/master/secblock.h#L161
This is the stacktrace:
```
#0 0x00007ffff5a9b267 in __GI_raise (sig=sig@entry=6)
at ../sysdeps/unix/sysv/linux/raise.c:55
#1 0x00007ffff5a9ceca in __GI_abort () at abort.c:89
#2 0x00007ffff5a9403d in __assert_fail_base (
fmt=0x7ffff5bf6028 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=assertion@entry=0x4a3814 "false",
file=file@entry=0x4a37e0 "/usr/include/crypto++/secblock.h",
line=line@entry=151,
function=function@entry=0x4a3ac0 <CryptoPP::NullAllocator<unsigned int>::deallocate(void*, unsigned long)::__PRETTY_FUNCTION__> "void CryptoPP::NullAllocator<T>::deallocate(void*, CryptoPP::NullAllocator<T>::size_type) [with T = unsigned int; CryptoPP::NullAllocator<T>::size_type = long unsigned int]")
at assert.c:92
#3 0x00007ffff5a940f2 in __GI___assert_fail (assertion=0x4a3814 "false",
file=0x4a37e0 "/usr/include/crypto++/secblock.h", line=151,
function=0x4a3ac0 <CryptoPP::NullAllocator<unsigned int>::deallocate(void*, unsigned long)::__PRETTY_FUNCTION__> "void CryptoPP::NullAllocator<T>::deallocate(void*, CryptoPP::NullAllocator<T>::size_type) [with T = unsigned int; CryptoPP::NullAllocator<T>::size_type = long unsigned int]") at assert.c:101
#4 0x000000000045bbbf in CryptoPP::NullAllocator<unsigned int>::deallocate (
this=0x7fffffffca20, p=0x3c, n=316) at /usr/include/crypto++/secblock.h:151
#5 0x000000000045b96d in CryptoPP::FixedSizeAllocatorWithCleanup<unsigned int, 60ul, CryptoPP::NullAllocator<unsigned int>, true>::deallocate (
---Type <return> to continue, or q <return> to quit---
this=0x7fffffffc930, p=0x3c, n=316) at /usr/include/crypto++/secblock.h:202
#6 0x000000000045b4ab in CryptoPP::SecBlock<unsigned int, CryptoPP::FixedSizeAllocatorWithCleanup<unsigned int, 60ul, CryptoPP::NullAllocator<unsigned int>, true> >::~SecBlock (this=0x7fffffffc930, __in_chrg=<optimized out>)
at /usr/include/crypto++/secblock.h:261
#7 0x000000000045a44c in CryptoPP::FixedSizeSecBlock<unsigned int, 60u, CryptoPP::FixedSizeAllocatorWithCleanup<unsigned int, 60ul, CryptoPP::NullAllocator<unsigned int>, true> >::~FixedSizeSecBlock (this=0x7fffffffc930,
__in_chrg=<optimized out>) at /usr/include/crypto++/secblock.h:422
#8 0x000000000045a466 in CryptoPP::FixedSizeAlignedSecBlock<unsigned int, 60u, true>::~FixedSizeAlignedSecBlock (this=0x7fffffffc930,
__in_chrg=<optimized out>) at /usr/include/crypto++/secblock.h:429
#9 0x000000000045a4ac in CryptoPP::Rijndael::Base::~Base (
this=0x7fffffffc918, __in_chrg=<optimized out>)
at /usr/include/crypto++/rijndael.h:21
#10 0x000000000045a544 in CryptoPP::Rijndael::Enc::~Enc (this=0x7fffffffc918,
__in_chrg=<optimized out>) at /usr/include/crypto++/rijndael.h:40
#11 0x000000000045a5d0 in CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>::~ClonableImpl (this=0x7fffffffc918, __in_chrg=<optimized out>)
at /usr/include/crypto++/simple.h:16
#12 0x000000000045a65c in CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>::~BlockCipherFinal (this=0x7fffffffc918,
---Type <return> to continue, or q <return> to quit---
__in_chrg=<optimized out>) at /usr/include/crypto++/seckey.h:151
#13 0x000000000045a6da in CryptoPP::ObjectHolder<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc> >::~ObjectHolder (
this=0x7fffffffc918, __in_chrg=<optimized out>)
at /usr/include/crypto++/misc.h:83
#14 0x000000000045bd76 in CryptoPP::CipherModeFinalTemplate_CipherHolder<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::CBC_Encryption>::~CipherModeFinalTemplate_CipherHolder (this=0x7fffffffc8d0,
__in_chrg=<optimized out>) at /usr/include/crypto++/modes.h:248
#15 0x0000000000457198 in Crypter::encrypt (key=..., IV=..., plain=...,
padding=CryptoPP::BlockPaddingSchemeDef::NO_PADDING) at crypter.cpp:143
#16 0x0000000000456836 in Crypter::encode (key=..., IV=..., salt=..., KGK=...,
data=..., compress=true) at crypter.cpp:90
```
I tried to build the code with the crypto++ lib that is packaged in Ubuntu 15.04:
http://packages.ubuntu.com/vivid/libcrypto++-dev
There is also a version of crypto++ packaged in the application but want to use the system's lib.
The maintainer of the app does not want to support other versions. This is why I am asking for support here.
| Assert in class NullAllocator, function deallocate | https://api.github.com/repos/weidai11/cryptopp/issues/34/comments | 7 | 2015-09-23T19:07:18Z | 2016-01-07T15:30:29Z | https://github.com/weidai11/cryptopp/issues/34 | 107,986,036 | 34 |
[
"weidai11",
"cryptopp"
] | László Böszörményi of Debian helped with some cross validation testing. Building the library under a S/390/chroot on Debian x86_64 results in a configuration failure. There were actually two failures - one was reported, the other was silent.
---
The first reported failure was a failure to detect the big endian platform:
```
FAILED: Your machine is big endian.
passed: CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS is not defined. Will
restrict to aligned data access.
passed: sizeof(byte) == 1
passed: sizeof(word16) == 2
passed: sizeof(word32) == 4
passed: sizeof(word64) == 8
passed: sizeof(hword) == 2, sizeof(word) == 4, sizeof(dword) == 8
Some critical setting in config.h is in error. Please fix it and recompile.
Aborted
```
The fix was easy enough: add the following to `config.h` for the platform:
```
// define this if running on a big-endian CPU
#if !defined(IS_LITTLE_ENDIAN) && (defined(__BIG_ENDIAN__) || (defined(__s390__) || defined(__s390x__) || defined(__zarch__)) || ... || defined(__ARMEB__) || (defined(__MWERKS__) && !defined(__INTEL__)))
# define IS_BIG_ENDIAN
#endif
```
We also added the following to produce a hardstop in the future under certain somewhat known conditions:
```
// Sanity checks. Some processors have more than big-, little- and bi-endian modes. PDP mode, where order results in "4312", should
// raise red flags immediately. Additionally, mis-classified machines, like (previosuly) S/390, should raise red flags immediately.
#if defined(IS_BIG_ENDIAN) && defined(__GNUC__) && defined(__BYTE_ORDER__) && (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__)
# error "IS_BIG_ENDIAN is set, but __BYTE_ORDER__ does not equal __ORDER_BIG_ENDIAN__"
#endif
#if defined(IS_LITTLE_ENDIAN) && defined(__GNUC__) && defined(__BYTE_ORDER__) && (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__)
# error "IS_LITTLE_ENDIAN is set, but __BYTE_ORDER__ does not equal __ORDER_LITTLE_ENDIAN__"
#endif
```
---
The second unreported issue was a failure to detect the availability of `int128_t` and `uint128_t` on S/390. It means the "Slow Word" integers would be used, which could negatively impact performance. It was caught through an additional sanity check added to `config.h`:
```
// Detect availabliltiy of int128_t and unint128_t in preprocessor, http://gcc.gnu.org/ml/gcc-help/2015-08/msg00185.html.
// Produce a compiler error. It can be commented out, but you may not get the benefit of of faster native integers.
#if (__SIZEOF_INT128__ >= 16) && !defined(CRYPTOPP_WORD128_AVAILABLE)
# error "An int128_t and uint128_t are available, but CRYPTOPP_WORD128_AVAILABLE is not defined"
#endif
```
| Configuration failure under S/390{x} | https://api.github.com/repos/weidai11/cryptopp/issues/33/comments | 0 | 2015-09-21T07:41:57Z | 2015-10-31T13:32:38Z | https://github.com/weidai11/cryptopp/issues/33 | 107,459,586 | 33 |
[
"weidai11",
"cryptopp"
] | László Böszörményi of Debian helped with some cross validation testing. Building the library under a X32/chroot on Debian x86_64 results in a number of compile failures. Classes and source files with issues include CPU, Integer, Rijndael, SHA, Panama, Tiger, Sosemanuk, VMAC, Whirlpool and GCM.
Here's the 3-second tour for X32 from [Debian's wiki on X32 Port](https://wiki.debian.org/X32Port): _X32 is an ABI for amd64/x86_64 CPUs using 32-bit integers, longs and pointers. The idea is to combine the smaller memory and cache footprint from 32-bit data types with the larger register set of x86_64._
We were not detecting X32, and the following was added to `config.h`:
```
#if (__ILP32__ >= 1 || _ILP32 >= 1)
# define CRYPTOPP_BOOL_X32 1
#else
# define CRYPTOPP_BOOL_X32 0
#endif
```
In general, X86 code paths are enabled, and X64 code paths are disabled. That's consistent with ILP32, where integers, longs and pointer are 32-bits. However, even in X32 mode, we still have to push/pop 64-bit registers. For example, from gcm.cpp, within a 32-bit assembly block:
```
@@ -589,8 +606,13 @@
AS2( shr WORD_REG(dx), 4 )
#endif
- AS_PUSH_IF86( bx)
- AS_PUSH_IF86( bp)
+ #if CRYPTOPP_BOOL_X32
+ AS1(push rbx)
+ AS1(push rbp)
+ #else
+ AS_PUSH_IF86( bx)
+ AS_PUSH_IF86( bp)
+ #endif
```
---
On the down side, Valgrind has _not_ been ported to X32. Valgrind has helped us twice in the past with ASM issues (use of CPUID on x86_64 and Salsa on x86_64). I think we should cautiously approach any ASM ports, and possibly consider `-DCRYPTOPP_DISABLE_ASM` even though we have ported routines.
Also see [[Valgrind-developers] Support for x32 ABI](https://sourceforge.net/p/valgrind/mailman/message/33306917/).
| Compile failures under X32 (32-bit integers, longs, pointers on x86_64) | https://api.github.com/repos/weidai11/cryptopp/issues/32/comments | 2 | 2015-09-18T09:34:31Z | 2015-10-31T13:33:21Z | https://github.com/weidai11/cryptopp/issues/32 | 107,167,863 | 32 |
[
"weidai11",
"cryptopp"
] | László Böszörményi of Debian helped with some cross validation testing. Building the library under a ARMEL/chroot on Debian x86_64 produces the following results:
```
BlumBlumShub validation suite running...
passed 49ea2cfdb01064a0bbb92af101dac18a94f7b7ce
FAILED 53171c6887956cea5d3b
cryptest.exe: integer.cpp:2210: void CryptoPP::MultiplyTop(CryptoPP::word*, CryptoPP::word*, const word*, const word*, const word*, size_t):
Assertion `c3 >= 0 && c3 <= 2' failed.
uncaught target signal 6 (Aborted) - core dumped
Aborted
```
The assert is due lack of `-DNDEBUG`, and it is expected in this case.
Böszörményi tried both Crypto++ 5.6.1 with patches (which effectively makes it roughly 5.6.2) and Crypto++ 5.6.3. The results were reproduced under 5.6.3 RC1 candidate as well.
---
The following configurations _fail_ to reproduce the issue. Each configuration is tested after a `make clean` to ensure artifacts don't cross pollinate.
- `export CXXFLAGS="-DDEBUG -g3 -Og"`
- `export CXXFLAGS="-g3 -Og"`
- `export CXXFLAGS="-g3 -O1"`
The issue can be reproduced with:
- `export CXXFLAGS="-g3 -O2"`
- `export CXXFLAGS="-g3 -O3"`
The presence of `-DDEBUG` tells the makefile to enlist GXXLIB's debug and concept checks. In this case, two additional defines are defined: `-D_GLIBCXX_DEBUG` and `-D_GLIBCXX_CONCEPT_CHECKS`.
The presence of `-O3` tells the makefile to add `-DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS`, which forbids unaligned data access (which is undefined behavior in C/C++). The **_`_NO_`**_ define ensures `CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS` is _not_ defined. _Aligned data access_ is effect all the time on this platform, regardless of `-DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS`. It can be verified by inspecting the head of `cryptest.exe v` output and the message (similar to) _"unaligned data access is not allowed..."_. The results have been verified with UBsan, Asan and Valgrind.
| BlumBlumShub validation fails under ARMEL (likely others) | https://api.github.com/repos/weidai11/cryptopp/issues/31/comments | 5 | 2015-09-10T15:42:51Z | 2016-09-20T16:58:24Z | https://github.com/weidai11/cryptopp/issues/31 | 105,836,994 | 31 |
[
"weidai11",
"cryptopp"
] | There are many compile warnings when enabling '-Wabi' .
It will complain about 'contains empty classes which may cause base classes to be placed at different locations in a future version of GCC'
```
$ g++ -DNDEBUG -g2 -O3 -Wabi -fPIC -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c ecp.cpp
algebra.cpp:250: warning: ‘CryptoPP::WindowSlider::m_windowModulus’ contains empty classes which may cause base classes to be placed at different locations in a future version of GCC
ecp.cpp:294: warning: ‘CryptoPP::ProjectivePoint::y’ contains empty classes which may cause base classes to be placed at different locations in a future version of GCC
ecp.cpp:338: warning: ‘CryptoPP::ProjectiveDoubling::sixteenY4’ contains empty classes which may cause base classes to be placed at different locations in a future version of GCC
ecp.cpp:338: warning: ‘CryptoPP::ProjectiveDoubling::twoY’ contains empty classes which may cause base classes to be placed at different locations in a future version of GCC
ecp.cpp:338: warning: ‘CryptoPP::ProjectiveDoubling::S’ contains empty classes which may cause base classes to be placed at different locations in a future version of GCC
$ g++ -DNDEBUG -g2 -O3 -Wabi -fPIC -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c filters.cpp
integer.h:378: warning: ‘CryptoPP::Integer::reg’ contains empty classes which may cause base classes to be placed at different locations in a future version of GCC
In file included from filters.h:11,
from filters.cpp:7:
algparam.h:57: warning: ‘CryptoPP::ConstByteArrayParameter::m_block’ contains empty classes which may cause base classes to be placed at different locations in a future version of GCC
```
GCC version
```
$ g++ -v
Using built-in specs.
Target: x86_64-redhat-linux6E
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --disable-gnu-unique-object --with-as=/usr/libexec/binutils220/as --enable-languages=c,c++,fortran --disable-libgcj --with-mpfr=/builddir/build/BUILD/gcc-4.4.7-20120601/obj-x86_64-redhat-linux6E/mpfr-install/ --with-ppl=/builddir/build/BUILD/gcc-4.4.7-20120601/obj-x86_64-redhat-linux6E/ppl-install --with-cloog=/builddir/build/BUILD/gcc-4.4.7-20120601/obj-x86_64-redhat-linux6E/cloog-install --with-tune=generic --with-arch_32=i586 --build=x86_64-redhat-linux6E
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-1) (GCC)
```
CentOS release 5.11, kernel 2.6.18-398
| There are many compile warnings on GCC with '-Wabi' | https://api.github.com/repos/weidai11/cryptopp/issues/30/comments | 3 | 2015-08-27T07:12:40Z | 2016-01-26T07:32:30Z | https://github.com/weidai11/cryptopp/issues/30 | 103,443,734 | 30 |
[
"weidai11",
"cryptopp"
] | Assertion failed: m_allocated
cryptopp\secblock.h, line 197
```
The issue appears to be some problem with the alignment of the 60 byte array that is allocated.
It’s intended to be 8 byte aligned with 8 extra bytes added on to the end. The address used for
the array is the next 16 byte aligned address, which is guaranteed to end at latest at the end
of the allocated array.
However, the memory addresses I’m seeing in the debugger are not 8 byte aligned, so the
memory accessed goes past the end of the array into whatever comes next in the struct,
which includes the m_allocated flag, which is what’s causing the assertion failure.
```
```
For whatever reason, __declspec(align(8)) isn’t working and I can’t seem to find a way around
this. From googling, it seems like there might be an issue with the alignment of things
allocated with new / malloc. Work around the bug by just increasing the padding on the array.
```
Here's the workaround.
```
--- cryptopp/secblock.h.orig 2013-02-20 14:30:52.000000000 -0500
+++ cryptopp/secblock.h 2015-08-12 13:46:00.088518500 -0400
@@ -227,7 +227,7 @@
T m_array[S];
#else
T* GetAlignedArray() {return (CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16) ? (T*)(((byte *)m_array) + (0-(size_t)m_array)%16) : m_array;}
- CRYPTOPP_ALIGN_DATA(8) T m_array[(CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16) ? S+8/sizeof(T) : S];
+ CRYPTOPP_ALIGN_DATA(8) T m_array[(CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16) ? S+16/sizeof(T) : S];
#endif
A m_fallbackAllocator;
bool m_allocated;
```
Here's the stack trace of the assertion
```
CryptoPP::FixedSizeAllocatorWithCleanup<unsigned int,60,CryptoPP::NullAllocator<unsigned int>,1>::deallocate(void * p, unsigned int n) Line 197 C++
CryptoPP::SecBlock<unsigned int,CryptoPP::FixedSizeAllocatorWithCleanup<unsigned int,60,CryptoPP::NullAllocator<unsigned int>,1> >::~SecBlock<unsigned int,CryptoPP::FixedSizeAllocatorWithCleanup<unsigned int,60,CryptoPP::NullAllocator<unsigned int>,1> >() Line 261 C++
CryptoPP::FixedSizeSecBlock<unsigned int,60,CryptoPP::FixedSizeAllocatorWithCleanup<unsigned int,60,CryptoPP::NullAllocator<unsigned int>,1> >::~FixedSizeSecBlock<unsigned int,60,CryptoPP::FixedSizeAllocatorWithCleanup<unsigned int,60,CryptoPP::NullAllocator<unsigned int>,1> >() C++
CryptoPP::FixedSizeAlignedSecBlock<unsigned int,60,1>::~FixedSizeAlignedSecBlock<unsigned int,60,1>() C++
CryptoPP::Rijndael::Base::~Base() C++
CryptoPP::Rijndael::Enc::~Enc() C++
CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<0,CryptoPP::Rijndael::Enc>,CryptoPP::Rijndael::Enc>::~ClonableImpl<CryptoPP::BlockCipherFinal<0,CryptoPP::Rijndael::Enc>,CryptoPP::Rijndael::Enc>() C++
CryptoPP::BlockCipherFinal<0,CryptoPP::Rijndael::Enc>::~BlockCipherFinal<0,CryptoPP::Rijndael::Enc>() C++
CryptoPP::GCM_Final<CryptoPP::Rijndael,0,0>::~GCM_Final<CryptoPP::Rijndael,0,0>() C++
```
```
I set breakpoints on the `allocate’ function of secblock.h (line 181), and recorded the following allocations prior to ultimately hitting my breakpoint at the assertion at line 197:
Here are the return values of CryptoPP::FixedSizeAllocatorWithCleanup<unsigned int,60,CryptoPP::NullAllocator<unsigned int>,1>::GetAlignedArray:
Bytes Address
(De-/)Allocated of Alloc
60 0x00ab88d0
16 0x0037ef48
16 0x0037efa0
-16 0x0037efa0
-16 0x0037ef48
16 0x0037ef48
16 0x0037efa0
-16 0x0037efa0
-16 0x0037ef48
-44 0x00ab88d0
Some points of interest:
• The pattern above is totally reproducible (with different address values).
• The size deallocated (-44) does not match the size allocated.
• Decryption happens just fine, it’s cleanup that aborts.
```
| Memory allocation not properly aligned on Windows platforms. | https://api.github.com/repos/weidai11/cryptopp/issues/29/comments | 18 | 2015-08-12T20:56:00Z | 2019-06-03T23:59:32Z | https://github.com/weidai11/cryptopp/issues/29 | 100,633,323 | 29 |
[
"weidai11",
"cryptopp"
] | ```
g++ -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c validat0.cpp
validat0.cpp: In function 'bool TestSettings()':
validat0.cpp:27:47: error: call of overloaded 'memcpy_s(CryptoPP::word32*, long long unsigned int, const char [5], int)' is ambiguous
memcpy_s(&w, sizeof(w), "\x01\x02\x03\x04", 4);
^
validat0.cpp:27:47: note: candidates are:
In file included from stdcpp.h:12:0,
from validat0.cpp:6:
c:/MinGW-w64/mingw64/x86_64-w64-mingw32/include/string.h:42:27: note: errno_t memcpy_s(void*, size_t, const void*, size_t)
_CRTIMP errno_t __cdecl memcpy_s (void *_dest,size_t _numberOfElements,const
void *_src,size_t _count);
^
In file included from validat0.cpp:7:0:
misc.h:201:13: note: void CryptoPP::memcpy_s(void*, size_t, const void*, size_t)
inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t co
unt)
^
make: *** [validat0.o] Error 1
```
---
**g++ -v** output:
```
Using built-in specs.
COLLECT_GCC=c:\MinGW-w64\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=c:/MinGW-w64/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.9.2/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw492/x86_64-492-win32-seh-rt_v4-rev3/mingw64 --with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw492/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw492/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw492/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw492/prerequisites/x86_64-w64-mingw32-static --with-cloog=/c/mingw492/prerequisites/x86_64-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='x86_64-win32-seh-rev3, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw492/x86_64-492-win32-seh-rt_v4-rev3/mingw64/opt/include -I/c/mingw492/prerequisites/x86_64-zlib-static/include -I/c/mingw492/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw492/x86_64-492-win32-seh-rt_v4-rev3/mingw64/opt/include -I/c/mingw492/prerequisites/x86_64-zlib-static/include -I/c/mingw492/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw492/x86_64-492-win32-seh-rt_v4-rev3/mingw64/opt/lib -L/c/mingw492/prerequisites/x86_64-zlib-static/lib -L/c/mingw492/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: win32
gcc version 4.9.2 (x86_64-win32-seh-rev3, Built by MinGW-W64 project)
```
| Building cryptest.exe fails on MinGW-w64 | https://api.github.com/repos/weidai11/cryptopp/issues/28/comments | 70 | 2015-08-06T08:01:36Z | 2016-10-10T11:08:15Z | https://github.com/weidai11/cryptopp/issues/28 | 99,381,227 | 28 |
[
"weidai11",
"cryptopp"
] | This code causes a segmentation fault:
```
unsigned int result;
GenerateBlock((byte*)&result, sizeof(unsigned int));
```
Here is the call stack (image, as I cannot copy text from Code::Blocks call stack window):

This problem may be caused by [issue 26](https://github.com/weidai11/cryptopp/issues/26).
| A problem with random generator on MinGW | https://api.github.com/repos/weidai11/cryptopp/issues/27/comments | 2 | 2015-08-06T07:44:03Z | 2015-12-26T02:00:16Z | https://github.com/weidai11/cryptopp/issues/27 | 99,378,014 | 27 |
[
"weidai11",
"cryptopp"
] | On MinGW-32, the **cryptest.exe v** with _CRYPTOPP_NO_UNALIGNED_ACCESS_ defined crashes with SIGSEGV:
```
Using seed: 1438287574
Testing Settings...
passed: Your machine is little endian.
passed: CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS is not defined. Will restrict to a
ligned data access.
passed: sizeof(byte) == 1
passed: sizeof(word16) == 2
passed: sizeof(word32) == 4
passed: sizeof(word64) == 8
passed: sizeof(hword) == 2, sizeof(word) == 4, sizeof(dword) == 8
Testing rotate...
passed left rotate
passed right rotate
Testing conversions...
passed signed char
passed signed char overflow
passed unsigned char
passed unsigned char overflow
passed signed short
passed signed short overflow
passed unsigned short
passed unsigned short overflow
passed signed int
passed signed int overflow
passed unsigned int
passed unsigned int overflow
passed signed long
passed signed long overflow
passed unsigned long
passed unsigned long overflow
passed signed long long
passed unsigned long long
passed ssize_t
passed size_t
No operating system provided blocking random number generator, skipping test.
Testing operating system provided nonblocking random number generator...
passed: 100000 generated bytes compressed to 100020 bytes by DEFLATE
CRC-32 validation suite running...
passed 00000000 ""
passed 43beb7e8 "a"
passed c2412435 "abc"
passed 7f9d1520 "message digest"
passed bd50274c "abcdefghijklmnopqrstuvwxyz"
passed d2e6c21f "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456
789"
passed 724aa97c "12345678901234567890123456789012345678901234567890123456789
012345678901234567890"
passed 2639f4cb "123456789"
Adler-32 validation suite running...
passed 00000001 ""
passed 00620062 "a"
passed 024d0127 "abc"
passed 29750586 "message digest"
passed 90860b20 "abcdefghijklmnopqrstuvwxyz"
passed 8adb150c "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456
789"
passed 15d870f9 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaa" repeated 15625 times
MD2 validation suite running...
passed 8350e5a3e24c153df2275c9f80692773 ""
passed 32ec01ec4a6dac72c0ab96fb34c0b5d1 "a"
passed da853b0d3f88d99b30283a69e6ded6bb "abc"
passed ab4f496bfb2a530b219ff33031fe06b0 "message digest"
passed 4e8ddff3650292ab5a4108c3aa47940b "abcdefghijklmnopqrstuvwxyz"
passed da33def2a42df13975352846c30338cd "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi
jklmnopqrstuvwxyz0123456789"
passed d5976f79d83d3a0dc9806c3c66f3efd8 "12345678901234567890123456789012345
678901234567890123456789012345678901234567890"
MD5 validation suite running...
passed d41d8cd98f00b204e9800998ecf8427e ""
passed 0cc175b9c0f1b6a831c399e269772661 "a"
passed 900150983cd24fb0d6963f7d28e17f72 "abc"
passed f96b697d7cb7938d525a2f31aaf161d0 "message digest"
passed c3fcd3d76192e4007dfb496cca67e13b "abcdefghijklmnopqrstuvwxyz"
passed d174ab98d277d9f5a5611c2c9f419d9f "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi
jklmnopqrstuvwxyz0123456789"
passed 57edf4a22be3c955ac49da2e2107b67a "12345678901234567890123456789012345
678901234567890123456789012345678901234567890"
SHA validation suite running...
Testing MessageDigest algorithm SHA-1.
Program received signal SIGSEGV, Segmentation fault.
0x004f8ebc in __chkstk_ms ()
(gdb) backtrace
#0 0x004f8ebc in __chkstk_ms ()
#1 0x00497c57 in CryptoPP::Rijndael::Enc::AdvancedProcessBlocks (
this=this@entry=0x7b10d0 <s_globalRNG+48>,
inBlocks=inBlocks@entry=0x2e92990 "1438287574",
xorBlocks=xorBlocks@entry=0x0,
outBlocks=outBlocks@entry=0x2e982e0 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
length=length@entry=16, flags=flags@entry=0) at rijndael.cpp:1215
#2 0x004988ab in CryptoPP::Rijndael::Enc::ProcessAndXorBlock (
this=0x7b10d0 <s_globalRNG+48>, inBlock=0x2e92990 "1438287574",
xorBlock=0x0, outBlock=0x2e982e0 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<")
at rijndael.cpp:365
#3 0x004a7f75 in ProcessBlock (
outBlock=0x2e982e0 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
inBlock=<optimized out>, this=<optimized out>) at cryptlib.h:470
#4 CryptoPP::OFB_ModePolicy::WriteKeystream (this=0x7b10a0 <s_globalRNG>,
keystreamBuffer=0x2e982e0 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
iterationCount=1) at modes.cpp:84
#5 0x0055d4b5 in CryptoPP::AdditiveCipherTemplate<CryptoPP::AbstractPolicyHolde
r<CryptoPP::AdditiveCipherAbstractPolicy, CryptoPP::OFB_ModePolicy> >::GenerateB
lock (this=0x7b10a0 <s_globalRNG>, outString=0x28def0 "", length=4)
at strciphr.cpp:61
#6 0x0043ce87 in CryptoPP::RandomNumberGenerator::GenerateWord32 (
this=0x7b10bc <s_globalRNG+28>, min=0, max=63) at cryptlib.cpp:263
#7 0x0042c440 in RandomizedTransfer (source=..., target=..., channel=...,
finish=true) at datatest.cpp:69
#8 0x0042d704 in _fu94___ZNSs4_Rep20_S_empty_rep_storageE ()
at datatest.cpp:123
#9 0x00430cac in _fu2426___ZTIi () at datatest.cpp:573
#10 0x00432bfb in _fu871___ZSt4cout () at datatest.cpp:716
#11 0x00432fa5 in RunTestDataFile (
filename=filename@entry=0x64267f <ValidateBBS()::output1+1457> "TestVectors/
sha.txt", overrideParameters=..., thorough=thorough@entry=true)
at datatest.cpp:755
#12 0x0042925c in _fu800___ZSt4cout () at validat3.cpp:173
#13 0x00419db5 in ValidateAll (thorough=thorough@entry=false)
at validat1.cpp:61
#14 0x0040b61d in _fu523___ZSt4cout () at test.cpp:847
#15 0x00605f89 in _fu2814___ZSt3cin () at test.cpp:367
```
[Dump file (if it helps)](https://yadi.sk/d/VUJErBzEiC3tD)
---
**cryptest.exe tv all** crashes on Testing SymmetricCipher algorithm TEA/ECB. The problem seems to be the same.
Here is the call stack:
```
Testing FileList algorithm all.txt collection.
Testing SymmetricCipher algorithm TEA/ECB.
Program received signal SIGSEGV, Segmentation fault.
0x004f920c in __chkstk_ms ()
(gdb) backtrace
#0 0x004f920c in __chkstk_ms ()
#1 0x00497fa7 in CryptoPP::Rijndael::Enc::AdvancedProcessBlocks (
this=this@entry=0x7b10d0 <GlobalRNG()::s_globalRNG+48>,
inBlocks=inBlocks@entry=0x2ca7dd0 "1438330210",
xorBlocks=xorBlocks@entry=0x0,
outBlocks=outBlocks@entry=0x2ca8390 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
length=length@entry=16, flags=flags@entry=0) at rijndael.cpp:1215
#2 0x00498bfb in CryptoPP::Rijndael::Enc::ProcessAndXorBlock (
this=0x7b10d0 <GlobalRNG()::s_globalRNG+48>,
inBlock=0x2ca7dd0 "1438330210", xorBlock=0x0,
outBlock=0x2ca8390 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<") at rijndael.cpp:365
#3 0x004a82c5 in ProcessBlock (
outBlock=0x2ca8390 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
inBlock=<optimized out>, this=<optimized out>) at cryptlib.h:470
#4 CryptoPP::OFB_ModePolicy::WriteKeystream (
this=0x7b10a0 <GlobalRNG()::s_globalRNG>,
keystreamBuffer=0x2ca8390 "\rр-є\rр-є\rр-є\rр-є<<<<<<<<",
iterationCount=1) at modes.cpp:84
#5 0x0055d805 in CryptoPP::AdditiveCipherTemplate<CryptoPP::AbstractPolicyHolde
r<CryptoPP::AdditiveCipherAbstractPolicy, CryptoPP::OFB_ModePolicy> >::GenerateB
lock (this=0x7b10a0 <GlobalRNG()::s_globalRNG>, outString=0x28dba0 "",
length=4) at strciphr.cpp:61
#6 0x0043d1d7 in CryptoPP::RandomNumberGenerator::GenerateWord32 (
this=0x7b10bc <GlobalRNG()::s_globalRNG+28>, min=0, max=63)
at cryptlib.cpp:263
#7 0x0042c790 in RandomizedTransfer (source=..., target=..., channel=...,
finish=true) at datatest.cpp:69
#8 0x0042da54 in _fu94___ZNSs4_Rep20_S_empty_rep_storageE ()
at datatest.cpp:123
#9 0x0042e363 in _fu95___ZNSs4_Rep20_S_empty_rep_storageE ()
at datatest.cpp:129
#10 0x0042e403 in TestSymmetricCipher (v=..., overrideParameters=...)
at datatest.cpp:328
#11 0x00432cce in _fu870___ZSt4cout () at datatest.cpp:710
#12 0x004330c4 in _fu871___ZSt4cout () at datatest.cpp:720
#13 0x004332f5 in RunTestDataFile (filename=0x2ca849c "TestVectors/all.txt",
overrideParameters=..., thorough=thorough@entry=true) at datatest.cpp:755
#14 0x00605473 in _fu2781___ZSt4cerr () at test.cpp:315
```
---
Steps to reproduce:
1) Install MinGW-32 with GCC 4.8.1, as in my case. Seems to be the latest MinGW-32. Don't forget about MSYS.
2) Run **gdb --args ./cryptest.exe v** or **gdb --args ./cryptest.exe tv all** in MSYS console
3) Finally, execute **run** in GDB console. You'll see the program output till the crash and the crash information.
4) Type **backtrace** to get the stack trace.
5) After all, type **kill** and **quit** to stop debugging.
Or simply run **cryptest.exe v** to get Windows's crash message.
---
Environment information:
**uname -a:**
```
MINGW32_NT-6.1 ИЛЬЯ-ПК 1.0.18(0.48/3/2) 2012-11-21 22:34 i686 Msys
```
**g++ -v:**
```
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto --enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
```
To build the library, I simply uncomment the line with _CRYPTOPP_NO_UNALLIGNED_ACCESS_ in _config.h_ and then run **make**.
| Tests fail on MinGW-32 | https://api.github.com/repos/weidai11/cryptopp/issues/26/comments | 3 | 2015-08-06T07:40:27Z | 2016-01-04T08:35:08Z | https://github.com/weidai11/cryptopp/issues/26 | 99,377,355 | 26 |
[
"weidai11",
"cryptopp"
] | ```
g++ -shared -o libcryptopp.so -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe 3way.o adler32.o algebra.o algparam.o arc4.o asn.o authenc.o base32.o base64.o basecode.o bfinit.o blowfish.o blumshub.o camellia.o cast.o casts.o cbcmac.o ccm.o channels.o cmac.o cpu.o crc.o cryptlib.o default.o des.o dessp.o dh.o dh2.o dll.o dsa.o eax.o ec2n.o eccrypto.o ecp.o elgamal.o emsa2.o eprecomp.o esign.o files.o filters.o fips140.o fipstest.o gcm.o gf256.o gf2_32.o gf2n.o gfpcrypt.o gost.o gzip.o hex.o hmac.o hrtimer.o ida.o idea.o integer.o iterhash.o luc.o mars.o marss.o md2.o md4.o md5.o misc.o modes.o mqueue.o mqv.o nbtheory.o network.o oaep.o osrng.o panama.o pkcspad.o polynomi.o pssr.o pubkey.o queue.o rabin.o randpool.o rc2.o rc5.o rc6.o rdtables.o rijndael.o ripemd.o rng.o rsa.o rw.o safer.o salsa.o seal.o seed.o serpent.o sha.o sha3.o shacal2.o shark.o sharkbox.o simple.o skipjack.o socketft.o sosemanuk.o square.o squaretb.o strciphr.o tea.o tftables.o tiger.o tigertab.o trdlocal.o ttmac.o twofish.o vmac.o wait.o wake.o whrlpool.o winpipes.o xtr.o xtrcrypt.o zdeflate.o zinflate.o zlib.o
socketft.o: In function `ZN8CryptoPP14SocketReceiver16GetReceiveResultEv':
c:\cryptopp-master/socketft.cpp:372: undefined reference to `WSAGetOverlappedResult@20'
c:\cryptopp-master/socketft.cpp:379: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP12SocketSender13GetSendResultEv':
c:\cryptopp-master/socketft.cpp:469: undefined reference to `WSAGetOverlappedResult@20'
socketft.o: In function `ZN8CryptoPP12SocketSender4SendEPKhj':
c:\cryptopp-master/socketft.cpp:418: undefined reference to `WSASend@28'
c:\cryptopp-master/socketft.cpp:425: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket8ShutDownEi':
c:\cryptopp-master/socketft.cpp:209: undefined reference to `shutdown@8'
socketft.o: In function `ZN8CryptoPP12SocketSender7SendEofEv':
c:\cryptopp-master/socketft.cpp:437: undefined reference to `WSAEventSelect@12'
socketft.o: In function `ZN8CryptoPP14SocketReceiver7ReceiveEPhj':
c:\cryptopp-master/socketft.cpp:337: undefined reference to `WSARecv@28'
c:\cryptopp-master/socketft.cpp:344: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket11CloseSocketEv':
c:\cryptopp-master/socketft.cpp:85: undefined reference to `closesocket@4'
socketft.o: In function `ZN8CryptoPP6Socket6CreateEi':
c:\cryptopp-master/socketft.cpp:73: undefined reference to `socket@12'
socketft.o: In function `ZN8CryptoPP6Socket11CloseSocketEv':
c:\cryptopp-master/socketft.cpp:85: undefined reference to `closesocket@4'
socketft.o: In function `ZN8CryptoPP6Socket4BindEjPKc':
c:\cryptopp-master/socketft.cpp:104: undefined reference to `inet_addr@4'
c:\cryptopp-master/socketft.cpp:113: undefined reference to `htons@4'
socketft.o: In function `ZN8CryptoPP6Socket4BindEPK8sockaddri':
c:\cryptopp-master/socketft.cpp:122: undefined reference to `bind@12'
socketft.o: In function `ZN8CryptoPP6Socket12SetLastErrorEi':
c:\cryptopp-master/socketft.cpp:300: undefined reference to `WSASetLastError@4'
socketft.o: In function `ZN8CryptoPP6Socket4BindEjPKc':
c:\cryptopp-master/socketft.cpp:101: undefined reference to `htonl@4'
socketft.o: In function `ZN8CryptoPP6Socket4BindEPK8sockaddri':
c:\cryptopp-master/socketft.cpp:122: undefined reference to `bind@12'
socketft.o: In function `ZN8CryptoPP6Socket6ListenEi':
c:\cryptopp-master/socketft.cpp:128: undefined reference to `listen@8'
socketft.o: In function `ZN8CryptoPP6Socket7ConnectEPKcj':
c:\cryptopp-master/socketft.cpp:138: undefined reference to `inet_addr@4'
c:\cryptopp-master/socketft.cpp:152: undefined reference to `htons@4'
socketft.o: In function `ZN8CryptoPP6Socket7ConnectEPK8sockaddri':
c:\cryptopp-master/socketft.cpp:160: undefined reference to `connect@12'
socketft.o: In function `ZN8CryptoPP6Socket7ConnectEPKcj':
c:\cryptopp-master/socketft.cpp:142: undefined reference to `gethostbyname@4'
socketft.o: In function `ZN8CryptoPP6Socket12GetLastErrorEv':
c:\cryptopp-master/socketft.cpp:291: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket12SetLastErrorEi':
c:\cryptopp-master/socketft.cpp:300: undefined reference to `WSASetLastError@4'
socketft.o: In function `ZN8CryptoPP6Socket7ConnectEPK8sockaddri':
c:\cryptopp-master/socketft.cpp:160: undefined reference to `connect@12'
socketft.o: In function `ZN8CryptoPP6Socket12GetLastErrorEv':
c:\cryptopp-master/socketft.cpp:291: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket6AcceptERS0_P8sockaddrPi':
c:\cryptopp-master/socketft.cpp:170: undefined reference to `accept@12'
socketft.o: In function `ZN8CryptoPP6Socket11CloseSocketEv':
c:\cryptopp-master/socketft.cpp:85: undefined reference to `closesocket@4'
socketft.o: In function `ZN8CryptoPP6Socket12GetLastErrorEv':
c:\cryptopp-master/socketft.cpp:291: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket11GetSockNameEP8sockaddrPi':
c:\cryptopp-master/socketft.cpp:181: undefined reference to `getsockname@12'
socketft.o: In function `ZN8CryptoPP6Socket11GetPeerNameEP8sockaddrPi':
c:\cryptopp-master/socketft.cpp:187: undefined reference to `getpeername@12'
socketft.o: In function `ZN8CryptoPP6Socket4SendEPKhji':
c:\cryptopp-master/socketft.cpp:193: undefined reference to `send@16'
socketft.o: In function `ZN8CryptoPP6Socket7ReceiveEPhji':
c:\cryptopp-master/socketft.cpp:201: undefined reference to `recv@16'
socketft.o: In function `ZN8CryptoPP6Socket8ShutDownEi':
c:\cryptopp-master/socketft.cpp:209: undefined reference to `shutdown@8'
socketft.o: In function `ZN8CryptoPP6Socket5IOCtlElPm':
c:\cryptopp-master/socketft.cpp:217: undefined reference to `ioctlsocket@12'
socketft.o: In function `ZN8CryptoPP6Socket9SendReadyEPK7timeval':
c:\cryptopp-master/socketft.cpp:234: undefined reference to `select@20'
socketft.o: In function `ZN8CryptoPP6Socket12ReceiveReadyEPK7timeval':
c:\cryptopp-master/socketft.cpp:251: undefined reference to `select@20'
socketft.o: In function `ZN8CryptoPP6Socket12SetLastErrorEi':
c:\cryptopp-master/socketft.cpp:300: undefined reference to `WSASetLastError@4'
socketft.o: In function `ZN8CryptoPP6Socket12StartSocketsEv':
c:\cryptopp-master/socketft.cpp:273: undefined reference to `WSAStartup@8'
socketft.o: In function `ZN8CryptoPP6Socket15ShutdownSocketsEv':
c:\cryptopp-master/socketft.cpp:282: undefined reference to `WSACleanup@0'
socketft.o: In function `ZN8CryptoPP6Socket12GetLastErrorEv':
c:\cryptopp-master/socketft.cpp:291: undefined reference to `WSAGetLastError@0'
socketft.o: In function `ZN8CryptoPP6Socket11CloseSocketEv':
c:\cryptopp-master/socketft.cpp:85: undefined reference to `closesocket@4'
c:\cryptopp-master/socketft.cpp:85: undefined reference to `closesocket@4'
socketft.o: In function `ZN8CryptoPP12SocketSender7EofSentEv':
c:\cryptopp-master/socketft.cpp:446: undefined reference to `WSAEnumNetworkEvents@12'
socketft.o: In function `ZN8CryptoPP6Socket16PortNameToNumberEPKcS2_':
c:\cryptopp-master/socketft.cpp:263: undefined reference to `getservbyname@8'
c:\cryptopp-master/socketft.cpp:266: undefined reference to `ntohs@4'
socketft.o: In function `ZN8CryptoPP6Socket12GetLastErrorEv':
c:\cryptopp-master/socketft.cpp:291: undefined reference to `WSAGetLastError@0'
collect2.exe: error: ld returned 1 exit status
make: *** [libcryptopp.so] Error 1
```
| 'dynamic' target fails on MinGW x32 and x64 | https://api.github.com/repos/weidai11/cryptopp/issues/25/comments | 4 | 2015-08-06T07:29:08Z | 2015-10-31T13:39:48Z | https://github.com/weidai11/cryptopp/issues/25 | 99,375,522 | 25 |
[
"weidai11",
"cryptopp"
] | Here are the warnings that are displayed on Linux during compilation with CRYPTOPP_NO_UNALIGNED_ACCESS defined:
---
```
g++ -DNDEBUG -g2 -O3 -fPIC -march=native -DCRYPTOPP_DISABLE_ASM -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c cpu.cpp
cpu.cpp: In function ‘bool CryptoPP::CpuId(CryptoPP::word32, CryptoPP::word32*)’:
cpu.cpp:83:7: warning: variable ‘result’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
bool result = true;
^
g++ -DNDEBUG -g2 -O3 -fPIC -march=native -DCRYPTOPP_DISABLE_ASM -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c md2.cpp
g++ -DNDEBUG -g2 -O3 -fPIC -march=native -DCRYPTOPP_DISABLE_ASM -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c integer.cpp
integer.cpp: In function ‘void CryptoPP::Baseline_MultiplyBottom2(CryptoPP::word*, const word*, const word*)’:
integer.cpp:1058:16: warning: variable ‘d1’ set but not used [-Wunused-but-set-variable]
Declare2Words(d) \
^
integer.cpp:111:40: note: in definition of macro ‘Declare2Words’
#define Declare2Words(x) word x##0, x##1;
^
integer.cpp:972:2: note: in expansion of macro ‘Mul_Begin’
Mul_Begin(2) \
^
integer.cpp:1161:2: note: in expansion of macro ‘Bot_2’
Bot_2
^
```
---
GCC version: 4.9.2, Ubuntu 15.04, Linux Kernel 3.19.0-25-generic.
| Compiler warnings on GCC and MinGW | https://api.github.com/repos/weidai11/cryptopp/issues/24/comments | 18 | 2015-08-06T07:22:36Z | 2016-01-04T08:35:29Z | https://github.com/weidai11/cryptopp/issues/24 | 99,374,548 | 24 |
[
"weidai11",
"cryptopp"
] | This apples to the library in general, and the intersection of assemblers and compilers. It was recently brought to light with Clang testing.
Clang has an integrated assembler that's not quite as mature as it needs to be. There are 5 or 6 LLVM bugs that affect Crypto++ (cf., 18916, 24200, 24226, 24232 and a few others). When the assembler is disabled, the library disables the inline assembly code paths that perform the zeroization and leave it to C++ statements.
C++ statements with volatile are somewhat ambiguous because the meaning of volatile is not well defined in the standard. See, for example, Ian Lance Taylor's blog at http://www.airs.com/blog/archives/154. In fact, the Crypto++ code has comments regarding work arounds due to GCC optimizing out a write of 0 on occasion.
| Zeroizer may be removed if assembler is not available | https://api.github.com/repos/weidai11/cryptopp/issues/23/comments | 1 | 2015-08-03T02:56:46Z | 2015-10-31T14:12:05Z | https://github.com/weidai11/cryptopp/issues/23 | 98,661,276 | 23 |
[
"weidai11",
"cryptopp"
] | `counted_ptr` should use atomics, if available; see http://en.cppreference.com/w/cpp/atomic.
```
template <class T> counted_ptr<T>::counted_ptr(const counted_ptr<T>& rhs)
: m_p(rhs.m_p)
{
if (m_p)
m_p->m_referenceCount++;
}
template <class T> counted_ptr<T>::~counted_ptr()
{
if (m_p && --m_p->m_referenceCount == 0)
delete m_p;
}
```
| counted_ptr should use atomics, if available | https://api.github.com/repos/weidai11/cryptopp/issues/22/comments | 1 | 2015-08-02T12:57:11Z | 2016-01-26T07:33:31Z | https://github.com/weidai11/cryptopp/issues/22 | 98,607,872 | 22 |
[
"weidai11",
"cryptopp"
] | This issue was originally investigated and reported by Jesse Wilson and Daniele Perito at [Problem with the way gfpcrypt HMAC's the encoding parameters' length in DHAES_MODE](https://groups.google.com/forum/#!msg/cryptopp-users/vR8GSL8wxPA/Bf9koUDyZ88J). Since that time, David Hook of the Bouncy Castle project investigated further and found another interop issue: Crypto++'s ECIES should use a bit count for the label, and not a byte count.
The issue was confirmed by cross referencing both P1363, revision 13 and subsequent P1363 2000 publications.
This report creates an actionable item for tracking.
| ECIES uses byte count, and not bit count, for label size | https://api.github.com/repos/weidai11/cryptopp/issues/21/comments | 18 | 2015-07-30T06:50:23Z | 2016-10-18T21:08:23Z | https://github.com/weidai11/cryptopp/issues/21 | 98,098,452 | 21 |
[
"weidai11",
"cryptopp"
] | `FileSink::Put2` (from files.cpp) uses the following. If `length` > `std::streamsize`, then only one iteration is performed and the user must retry manually.
```
size_t FileSink::Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
{
if (!m_stream)
throw Err("FileSink: output stream not opened");
while (length > 0)
{
std::streamsize size;
bool safe = SafeConvert(length, size);
CRYPTOPP_ASSERT(safe);
if (!safe)
size = numeric_limits<std::streamsize>::max();
m_stream->write((const char *)inString, size);
inString += size;
length -= (size_t)size;
}
...
}
```
| Should FileSInk::Put2 use streamsize blocks? | https://api.github.com/repos/weidai11/cryptopp/issues/20/comments | 11 | 2015-07-30T06:32:17Z | 2015-10-31T13:25:48Z | https://github.com/weidai11/cryptopp/issues/20 | 98,096,358 | 20 |
[
"weidai11",
"cryptopp"
] | To help facilitate the release of Crypto++ 5.6.3, <strike>`_WINSOCK_DEPRECATED_NO_WARNINGS` was defined before including Winsock gear to avoid the warnings and the rewrite.</strike> `pragmas` were used to disable warning C4996 before including the affected header; and then the warning was re-enabled.
See https://github.com/weidai11/cryptopp/commit/05076dbdea07eac39f72803f6cdbca030069a6bc and https://github.com/weidai11/cryptopp/commit/185a2c8e830644a62eaedf21853abb3b7fd1254b
| socketft defines _WINSOCK_DEPRECATED_NO_WARNINGS | https://api.github.com/repos/weidai11/cryptopp/issues/19/comments | 1 | 2015-07-27T21:53:11Z | 2016-10-10T09:08:09Z | https://github.com/weidai11/cryptopp/issues/19 | 97,562,322 | 19 |
[
"weidai11",
"cryptopp"
] | Add missing git tags for a few of the latest releases:
- 5.4
- 5.5.2
- 5.6.0
- 5.6.1
- 5.6.2
Adding 5.6.2 tag:
```
git checkout 789f81f048c9bc472c7e7596f49b02eadd6fc1fd
git tag -a v5.6.2 -m 'version 5.6.2'
```
| Missing Git tags | https://api.github.com/repos/weidai11/cryptopp/issues/18/comments | 1 | 2015-07-27T15:53:27Z | 2016-01-04T08:35:47Z | https://github.com/weidai11/cryptopp/issues/18 | 97,495,028 | 18 |
[
"weidai11",
"cryptopp"
] | ```
cryptlib.cpp: In member function ‘virtual size_t CryptoPP::PK_Signer::SignMessage(CryptoPP::RandomNumberGenerator&, const byte*, size_t, byte*) const’:
cryptlib.cpp:770:41: warning: ‘auto_ptr’ is deprecated (declared at /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/backward/auto_ptr.h:87) [-Wdeprecated-declarations]
std::auto_ptr<PK_MessageAccumulator> m(NewSignatureAccumulator(rng));
^
cryptlib.cpp: In member function ‘virtual size_t CryptoPP::PK_Signer::SignMessageWithRecovery(CryptoPP::RandomNumberGenerator&, const byte*, size_t, const byte*, size_t, byte*) const’:
cryptlib.cpp:778:41: warning: ‘auto_ptr’ is deprecated (declared at /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/backward/auto_ptr.h:87) [-Wdeprecated-declarations]
std::auto_ptr<PK_MessageAccumulator> m(NewSignatureAccumulator(rng));
^
cryptlib.cpp: In member function ‘virtual bool CryptoPP::PK_Verifier::Verify(CryptoPP::PK_MessageAccumulator*) const’:
cryptlib.cpp:786:59: warning: ‘auto_ptr’ is deprecated (declared at /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/backward/auto_ptr.h:87) [-Wdeprecated-declarations]
std::auto_ptr<PK_MessageAccumulator> m(messageAccumulator);
^
cryptlib.cpp: In member function ‘virtual bool CryptoPP::PK_Verifier::VerifyMessage(const byte*, size_t, const byte*, size_t) const’:
cryptlib.cpp:792:41: warning: ‘auto_ptr’ is deprecated (declared at /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/c++/backward/auto_ptr.h:87) [-Wdeprecated-declarations]
std::auto_ptr<PK_MessageAccumulator> m(NewVerificationAccumulator());
^
...
```
| Use of auto_ptr causes dirty compile under Cygwin with -std=c++11 | https://api.github.com/repos/weidai11/cryptopp/issues/17/comments | 3 | 2015-07-27T06:13:23Z | 2015-10-31T13:40:54Z | https://github.com/weidai11/cryptopp/issues/17 | 97,394,678 | 17 |
[
"weidai11",
"cryptopp"
] | ```
g++ -std=c++11 -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c rijndael.cpp
rijndael.cpp: In member function ‘virtual size_t CryptoPP::Rijndael::Enc::AdvancedProcessBlocks(const byte*, const byte*, byte*, size_t, CryptoPP::word32) const’:
rijndael.cpp:1214:45: error: ‘alloca’ was not declared in this scope
space = (byte *)alloca(255+sizeof(Locals));
^
GNUmakefile:475: recipe for target 'rijndael.o' failed
make: *** [rijndael.o] Error 1
```
To duplicate on a Cygwin machine:
```
git clone...
export CXXFLAGS="-std=c++11"
make
```
or:
```
make rijndael.o
```
| Compile failure under Cygwin with GCC 4.8 in C++11 mode due to alloca | https://api.github.com/repos/weidai11/cryptopp/issues/16/comments | 1 | 2015-07-27T04:36:52Z | 2015-10-31T13:42:24Z | https://github.com/weidai11/cryptopp/issues/16 | 97,385,382 | 16 |
[
"weidai11",
"cryptopp"
] | ```
> CAST-128 validation suite running...
>
> passed 0123456712345678234567893456789A 0123456789ABCDEF
> 238B4FE5847E44B2
>
> Assertion failed: (y > 0 && y < THIS_SIZE), function rotlVariable, file
> misc.h, line 713.
>
> Abort trap: 6
```
Assert does not fire when inline assembler is in effect because ASM is not bound to the C/C++ UB rules.
| Assert fires when using rotate in CAST due to Undefined Behavior | https://api.github.com/repos/weidai11/cryptopp/issues/15/comments | 1 | 2015-07-23T00:59:47Z | 2015-10-31T13:44:45Z | https://github.com/weidai11/cryptopp/issues/15 | 96,700,941 | 15 |
[
"weidai11",
"cryptopp"
] | ```
integer.cpp:542:2: error: unknown token in expression
AS1( neg %1)
^
./cpu.h:220:17: note: expanded from macro 'AS1'
#define AS1(x) GNU_AS1(x)
^
./cpu.h:215:24: note: expanded from macro 'GNU_AS1'
#define GNU_AS1(x) "\n\t" #x ";"
^
<inline asm>:3:6: note: instantiated into assembly here
neg %rcx;
^
integer.cpp:542:2: error: unknown token in expression
AS1( neg %1)
^
./cpu.h:220:17: note: expanded from macro 'AS1'
#define AS1(x) GNU_AS1(x)
^
./cpu.h:215:24: note: expanded from macro 'GNU_AS1'
#define GNU_AS1(x) "\n\t" #x ";"
^
<inline asm>:3:6: note: instantiated into assembly here
neg %rcx;
^
```
This looks exactly like the missing operand size discussed at [Clang Inline Assembly and Compatibility](http://clang.llvm.org/compatibility.html#inline-asm).
| Clang integrated assembler and "unknown token in expression" | https://api.github.com/repos/weidai11/cryptopp/issues/14/comments | 1 | 2015-07-22T10:39:05Z | 2016-01-04T08:36:15Z | https://github.com/weidai11/cryptopp/issues/14 | 96,533,200 | 14 |
[
"weidai11",
"cryptopp"
] | ASM statements need a `"\n\t"` when being consumed by Clang Integrated Assembler.
GAS allows them on a single line separated by a semicolon.
| ASM statements need a "\n\t" when being consumed by Clang Integrated Assembler | https://api.github.com/repos/weidai11/cryptopp/issues/13/comments | 1 | 2015-07-22T08:56:23Z | 2016-01-04T08:36:36Z | https://github.com/weidai11/cryptopp/issues/13 | 96,513,685 | 13 |
[
"weidai11",
"cryptopp"
] | ```
$ make GAS210_OR_LATER=1 GAS219_OR_LATER=1 GAS219_OR_LATER=1
clang++ -DNDEBUG -g2 -O3 -Wall -fPIC -march=native -pipe -Wno-tautological-compare -c gcm.cpp
gcm.cpp:676:3: error: invalid operand for instruction
AS2( movd WORD_REG(di), xmm...
^
./cpu.h:221:20: note: expanded from macro 'AS2'
#define AS2(x, y) GNU_AS2(x, y)
^
./cpu.h:216:27: note: expanded from macro 'GNU_AS2'
#define GNU_AS2(x, y) "\n\t" #x ", " #y ";"
^
<inline asm>:110:12: note: instantiated into assembly here
movd rdi, xmm0;
^~~~~
gcm.cpp:685:3: error: invalid operand for instruction
AS2( movd WORD_REG(di), xmm...
^
./cpu.h:221:20: note: expanded from macro 'AS2'
#define AS2(x, y) GNU_AS2(x, y)
^
./cpu.h:216:27: note: expanded from macro 'GNU_AS2'
#define GNU_AS2(x, y) "\n\t" #x ", " #y ";"
^
<inline asm>:117:12: note: instantiated into assembly here
movd rdi, xmm1;
^~~~~
```
Possibly related: [Clang Inline Assembly and Compatibility](http://clang.llvm.org/compatibility.html#inline-asm).
| Clang integrated assembler and "invalid operand for instruction" | https://api.github.com/repos/weidai11/cryptopp/issues/12/comments | 1 | 2015-07-22T08:50:33Z | 2016-01-04T08:36:48Z | https://github.com/weidai11/cryptopp/issues/12 | 96,512,080 | 12 |
[
"weidai11",
"cryptopp"
] | Issue 18916: https://llvm.org/bugs/show_bug.cgi?id=18916
Issue 24200: https://llvm.org/bugs/show_bug.cgi?id=24200
LLVM will eventually fix the 18916 issue (".intel_syntax noprefix;" and ".att_syntax prefix;"). If they fix it in a forward compatible way, then we can just leave `WORKAROUND_LLVM_BUG_18916` in effect and things will "just work". If its not a forward fix, then we can guard with a define like `CRYPTOPP_CLANG_41_OR_EARLIER` once we know when its available. So it should not be a problem either way.
The 24200 issue is going to be trickier because we need to know when to switch to fixes for Clang Integrated Assembler _in the source code_ (and not the GNUmakefile). The source code is guarded with `CRYPTOPP_USING_CLANG_INTEGRATED_ASSEMBLER`, but we won't know when to activate it.
The first problem with 24200 is the only way I am aware to determine when Clang's assembler is being used is through the compiler driver. If we get the `clang: error...` string, then its the integrated assembler.
```
$ clang++ -xc -c /dev/null -Wa,-v -o/dev/null 2>&1
clang: error: unsupported argument '-v' to option 'Wa,'
```
The second issue with 24200 is the Integrated Assembler can be switched off (https://stackoverflow.com/questions/11118887/how-to-switch-off-llvms-integrated-assembler), but we don't know how to test for it. Ideally, there would be a #define available, but it appears there is none. Confer, "Determine Clang Assembler versus System Assembler at compile time?", http://lists.cs.uiuc.edu/pipermail/cfe-users/2015-July/000719.html.
Maybe we will be able to test in the makefile, and then define/undefine `CRYPTOPP_USING_CLANG_INTEGRATED_ASSEMBLER` using `sed`. This way, `config.h` stays in sync with the actual build tools and settings.
| Need extensible way to handle Clang Integrated Assembler/LLVM Issues 18916 and 24200 | https://api.github.com/repos/weidai11/cryptopp/issues/11/comments | 4 | 2015-07-22T08:22:30Z | 2016-01-04T08:53:27Z | https://github.com/weidai11/cryptopp/issues/11 | 96,506,856 | 11 |
[
"weidai11",
"cryptopp"
] | Library does not compile due to inline assembly and ".att_sytax noprefix" and ".intel_syntax prefix" under Clang | https://api.github.com/repos/weidai11/cryptopp/issues/10/comments | 1 | 2015-07-22T08:21:20Z | 2016-01-04T08:53:57Z | https://github.com/weidai11/cryptopp/issues/10 | 96,506,633 | 10 | |
[
"weidai11",
"cryptopp"
] | The library fails to detect when SSE, SSE2, SSE3 are available under Clang when the Integrated Assembler is being used in the GNUmakefile. The issue is:
```
GAS219_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -i -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
```
Reduces to/results in:
```
$ clang++ -xc -c /dev/null -Wa,-v -o/dev/null 2>&1
clang: error: unsupported argument '-v' to option 'Wa,'
```
The error makes code like this kick in:
```
ifeq ($(GAS210_OR_LATER),0) # .intel_syntax wasn't supported until GNU assembler 2.10
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
...
```
The issue was reported upstream at [LLVM Issue 24200: With integrated assembler enabled, fail to fetch version string of assembler](http://llvm.org/bugs/show_bug.cgi?id=24200).
| Library fails to detect when SSE, SSE2, SSE3 are available under Clang | https://api.github.com/repos/weidai11/cryptopp/issues/9/comments | 1 | 2015-07-22T08:13:24Z | 2016-01-04T08:55:36Z | https://github.com/weidai11/cryptopp/issues/9 | 96,505,148 | 9 |
[
"weidai11",
"cryptopp"
] | `filters.cpp` generates the following findings under UBsan.
```
$ make ubsan
$ ./cryptest.exe v | grep error
```
A smaller (but inclusive) list is generated with `./cryptest.exe tv all | grep error`.
---
Fedora 22, i386 (GCC 5.1):
```
filters.cpp:519:84: runtime error: null pointer passed as argument 1, which is declared to never be null
filters.cpp:291:28: runtime error: null pointer passed as argument 1, which is declared to never be null
filters.cpp:280:39: runtime error: null pointer passed as argument 1, which is declared to never be null
filters.cpp:280:39: runtime error: null pointer passed as argument 2, which is declared to never be null
filters.cpp:281:50: runtime error: null pointer passed as argument 1, which is declared to never be null
filters.cpp:281:50: runtime error: null pointer passed as argument 2, which is declared to never be null
filters.cpp:677:35: runtime error: null pointer passed as argument 2, which is declared to never be null
```
| filters.cpp and undefined behavior | https://api.github.com/repos/weidai11/cryptopp/issues/8/comments | 1 | 2015-07-19T04:14:10Z | 2015-10-31T13:40:23Z | https://github.com/weidai11/cryptopp/issues/8 | 95,883,656 | 8 |
[
"weidai11",
"cryptopp"
] | ```
{
simple_ptr<int> p1(new int);
simple_ptr<int> p2(p1);
} // double delete, undefined behaviour
```
| simple_ptr should be non-copyable | https://api.github.com/repos/weidai11/cryptopp/issues/6/comments | 2 | 2015-07-13T10:43:30Z | 2016-01-04T08:54:27Z | https://github.com/weidai11/cryptopp/issues/6 | 94,692,851 | 6 |
[
"weidai11",
"cryptopp"
] | The uses of Hack_DefaultValueFromConstReferenceType and Hack_GetValueIntoConstReference are undefined behaviour, and quite foul.
If the VC60 workaround is still needed (VC6 in 2015, really?) the sane way to do it would be:
```
typename decay<R>::type value;
if (!m_source.GetValue(name, value))
throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name + "'");
(m_pObject->*pm)(value);
```
with the following added as private members of `AssignFromHelperClass`:
```
template <class R> struct decay { typedef R type; };
template <class R> struct decay<const R&> { typedef R type; };
```
If you really must support VC6 then do it with `#if` not by using the same horrible code for compilers that aren't totally broken.
| AssignFromHelperClass is horrible | https://api.github.com/repos/weidai11/cryptopp/issues/5/comments | 2 | 2015-07-13T10:35:59Z | 2015-10-31T13:46:09Z | https://github.com/weidai11/cryptopp/issues/5 | 94,691,769 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.