Closed IlyaBizyaev closed 9 years ago
Warnings on Windows, MinGW x32 with GCC 4.8.1:
g++ -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c fipstest.cpp
fipstest.cpp:37:33: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
# pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
^
g++ -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-p
ragmas -pipe -c socketft.cpp
In file included from socketft.cpp:5:0:
socketft.h: In constructor 'CryptoPP::SocketReceiver::SocketReceiver(CryptoPP::Socket&)':
socketft.h:158:7: warning: 'CryptoPP::SocketReceiver::m_resultPending' will be initialized after [-Wreorder]
bool m_resultPending;
^
socketft.h:153:7: warning: 'bool CryptoPP::SocketReceiver::m_eofReceived' [-Wreorder]
bool m_eofReceived;
^
socketft.cpp:314:1: warning: when initialized here [-Wreorder]
SocketReceiver::SocketReceiver(Socket &s)
^
Warnings on Windows, MinGW x64 with GCC 4.9.2:
g++ -DNDEBUG -g2 -O3 -march=native -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 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c fipstest.cpp
fipstest.cpp:14:0: warning: "_WIN32_WINNT" redefined
#define _WIN32_WINNT 0x0400
^
In file included from c:/MinGW-w64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10:0,
from c:/MinGW-w64/mingw64/x86_64-w64-mingw32/include/stddef.h:7,
from c:/MinGW-w64/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/stddef.h:1,
from stdcpp.h:9,
from cryptlib.h:83,
from misc.h:4,
from fipstest.cpp:5:
c:/MinGW-w64/mingw64/x86_64-w64-mingw32/include/_mingw.h:225:0: note: this is the location of the previous definition
#define _WIN32_WINNT 0x502
^
fipstest.cpp:37:33: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
# pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
^
g++ -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c socketft.cpp
In file included from socketft.cpp:5:0:
socketft.h: In member function 'void CryptoPP::Socket::CheckAndHandleError(const char*, CryptoPP::socket_t) const':
socketft.h:100:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
{if (result == SOCKET_ERROR) HandleError(operation);}
^
socketft.h: In constructor 'CryptoPP::SocketReceiver::SocketReceiver(CryptoPP::Socket&)':
socketft.h:158:7: warning: 'CryptoPP::SocketReceiver::m_resultPending' will be initialized after [-Wreorder]
bool m_resultPending;
^
socketft.h:153:7: warning: 'bool CryptoPP::SocketReceiver::m_eofReceived' [-Wreorder]
bool m_eofReceived;
^
socketft.cpp:314:1: warning: when initialized here [-Wreorder]
SocketReceiver::SocketReceiver(Socket &s)
^
Th first warning is kind of interesting. I thought we cleared it at https://github.com/weidai11/cryptopp/commit/69c6989e991da4c5980e7a6f4ac757340172ca34.
Which one, in particular?
Oh, you mean the second one...
The line number seems to be different from the one in commit.
I believe we cleared these warnings. From a Windows 7 x64 machine and MinGW:
~/cryptopp-5.6.3 $ make cpu.o
g++ -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-p
ragmas -march=native -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -pipe -c cpu.cpp
<clean compile>
~/cryptopp-5.6.3 $ make socketft.o
g++ -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-p
ragmas -march=native -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -pipe -c socketft.cpp
<clean compile>
~/cryptopp-5.6.3 $ make integer.o
g++ -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-p
ragmas -march=native -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -pipe -c integer.cpp
<clean compile>
~/cryptopp-5.6.3 $ make fipstest.o
g++ -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-p
ragmas -march=native -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS -pipe -c fipstest.cpp
<clean compile>
And what about the warnings that are displayed on Linux during compilation with CRYPTOPP_NO_UNALIGNED_ACCESS defined?
Note that I have reported three different types of warnings on different platforms.
On Sun, Oct 25, 2015 at 5:53 AM, Ilya Bizyaev notifications@github.com wrote:
And what about the warnings that are displayed on Linux during compilation with CRYPTOPP_NO_UNALIGNED_ACCESS defined?
Hmm... I'm not sure. I thought this report was for MinGW.
I believe they are cleared on Linux, too.
Ok, I'll test them today, although I now have different Ubuntu and GCC versions on my PC.
I have tested it on GCC 5.2.1 on Ubuntu 15.10, Linux 4.2.0-16-generic, and here is the only warning:
g++ -DNDEBUG -g2 -O3 -fPIC -march=native -DCRYPTOPP_DISABLE_ASM -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c fipstest.cpp fipstest.cpp:37:33: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]
Warnings on Windows, MinGW x64 with GCC 4.9.2:
g++ -DNDEBUG -g2 -O3 -march=native -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;
fipstest.cpp:14:0: warning: "_WIN32_WINNT" redefined
#define _WIN32_WINNT 0x0400
^
In file included from c:/MinGW-w64/mingw64/x86_64-w64-mingw32/include/crtdefs.h:10:0,
from c:/MinGW-w64/mingw64/x86_64-w64-mingw32/include/stddef.h:7,
from c:/MinGW-w64/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/stddef.h:1,
from stdcpp.h:9,
from cryptlib.h:83,
from misc.h:4,
from fipstest.cpp:5:
c:/MinGW-w64/mingw64/x86_64-w64-mingw32/include/_mingw.h:225:0: note: this is the location of the previous definition
#define _WIN32_WINNT 0x502
^
fipstest.cpp:37:33: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
# pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
^
g++ -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-pragmas -pipe -c socketft.cpp
In file included from socketft.cpp:5:0:
socketft.h: In member function 'void CryptoPP::Socket::CheckAndHandleError(const char*, CryptoPP::socket_t) const':
socketft.h:100:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
{if (result == SOCKET_ERROR) HandleError(operation);}
^
socketft.h: In constructor 'CryptoPP::SocketReceiver::SocketReceiver(CryptoPP::Socket&)':
socketft.h:158:7: warning: 'CryptoPP::SocketReceiver::m_resultPending' will be i
nitialized after [-Wreorder]
bool m_resultPending;
^
socketft.h:153:7: warning: 'bool CryptoPP::SocketReceiver::m_eofReceived' [-Wreorder]
bool m_eofReceived;
^
socketft.cpp:314:1: warning: when initialized here [-Wreorder]
SocketReceiver::SocketReceiver(Socket &s)
^
And finally, here is an error:
g++ -DNDEBUG -g2 -O3 -march=native -Wall -Wextra -Wno-type-limits -Wno-unknown-p
ragmas -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:213: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 count)
^
make: *** [validat0.o] Error 1
And nothing has changed on MinGW-32 either. So, I suppose, this issue should be reopened.
// longjmp and clobber warnings. Volatile is required.
// http://stackoverflow.com/q/7721854
volatile bool result = true;
CRYPTOPP_UNUSED(result);
There are lots of warnings when building Crypto++ with TDM-GCC 5.1.0. Here are some of them:
In file included from default.cpp:13:0:
default.h:29:7: note: declared here
class DefaultEncryptor : public ProxyFilter
^
default.cpp: In constructor 'CryptoPP::DefaultEncryptorWithMAC::DefaultEncryptor
WithMAC(const byte*, size_t, CryptoPP::BufferedTransformation*)':
default.cpp:227:39: warning: 'DefaultEncryptor' is deprecated: DefaultEncryptor
will be changing in the near future because the algorithms are no longer secure
[-Wdeprecated-declarations]
SetFilter(new HashFilter(*m_mac, new DefaultEncryptor(passphrase, passphraseLength), true));
^
In file included from default.cpp:13:0:
default.h:29:7: note: declared here
class DefaultEncryptor : public ProxyFilter
^
default.cpp: In constructor 'CryptoPP::DefaultDecryptorWithMAC::DefaultDecryptor
WithMAC(const char*, CryptoPP::BufferedTransformation*, bool)':
default.cpp:243:16: warning: 'DefaultDecryptor' is deprecated: DefaultDecryptor
will be changing in the near future because the algorithms are no longer secure
[-Wdeprecated-declarations]
SetFilter(new DefaultDecryptor(passphrase, m_hashVerifier=new HashVerifier(*m_
mac, NULL, HashVerifier::PUT_MESSAGE), throwException));
^
In file included from default.cpp:13:0:
default.h:63:7: note: declared here
class DefaultDecryptor : public ProxyFilter
^
default.cpp: In constructor 'CryptoPP::DefaultDecryptorWithMAC::DefaultDecryptor
WithMAC(const byte*, size_t, CryptoPP::BufferedTransformation*, bool)':
default.cpp:251:16: warning: 'DefaultDecryptor' is deprecated: DefaultDecryptor
will be changing in the near future because the algorithms are no longer secure
[-Wdeprecated-declarations]
SetFilter(new DefaultDecryptor(passphrase, passphraseLength, m_hashVerifier=ne
w HashVerifier(*m_mac, NULL, HashVerifier::PUT_MESSAGE), throwException));
^
In file included from default.cpp:13:0:
default.h:63:7: note: declared here
class DefaultDecryptor : public ProxyFilter
^
default.cpp: In member function 'CryptoPP::DefaultDecryptor::State CryptoPP::Def
aultDecryptorWithMAC::CurrentState() const':
default.cpp:256:44: warning: 'DefaultDecryptor' is deprecated: DefaultDecryptor
will be changing in the near future because the algorithms are no longer secure
[-Wdeprecated-declarations]
return static_cast<const DefaultDecryptor *>(m_filter.get())->CurrentState();
^
In file included from default.cpp:13:0:
default.h:63:7: note: declared here
class DefaultDecryptor : public ProxyFilter
^
test.cpp:15:0: warning: "_WIN32_WINNT" redefined
fine _WIN32_WINNT 0x0400
ile included from c:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:10:0,
from c:/TDM-GCC-64/x86_64-w64-mingw32/include/wchar.h:9,
from c:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++
har:44,
from c:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++
s/postypes.h:40,
from c:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++
s/char_traits.h:40,
from c:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++
ing:40,
from stdcpp.h:9,
from cryptlib.h:87,
from seckey.h:16,
from rijndael.h:11,
from aes.h:9,
from dll.h:17,
from fipstest.cpp:8:
DM-GCC-64/x86_64-w64-mingw32/include/_mingw.h:225:0: note: this is the location
of the previous definition
fine _WIN32_WINNT 0x502
test.cpp: In function 'std::__cxx11::string EncryptString(const char*, const char*)':
test.cpp:591:36: warning: 'DefaultEncryptorWithMAC' is deprecated: DefaultEncryp
torWithMAC will be changing in the near future because the algorithms are no longer secure [-Wdeprecated-declarations]
DefaultEncryptorWithMAC encryptor(passPhrase, new HexEncoder(new StringSink(ou
tstr)));
^
In file included from test.cpp:14:0:
default.h:121:7: note: declared here
class DefaultEncryptorWithMAC : public ProxyFilter
^
test.cpp: In function 'std::__cxx11::string DecryptString(const char*, const char*)':
test.cpp:602:27: warning: 'DefaultDecryptorWithMAC' is deprecated: DefaultDecryptorWithMAC will be changing in the near future because the algorithms are no longer secure [-Wdeprecated-declarations]
HexDecoder decryptor(new DefaultDecryptorWithMAC(passPhrase, new StringSink(outstr)));
^
In file included from test.cpp:14:0:
default.h:159:7: note: declared here
class DefaultDecryptorWithMAC : public ProxyFilter
^
test.cpp: In function 'void EncryptFileA(const char*, const char*, const char*)':
test.cpp:611:29: warning: 'DefaultEncryptorWithMAC' is deprecated: DefaultEncryptorWithMAC will be changing in the near future because the algorithms are no longer secure [-Wdeprecated-declarations]
FileSource f(in, true, new DefaultEncryptorWithMAC(passPhrase, new FileSink(out)));
^
In file included from test.cpp:14:0:
default.h:121:7: note: declared here
class DefaultEncryptorWithMAC : public ProxyFilter
^
test.cpp: In function 'void DecryptFileA(const char*, const char*, const char*)':
test.cpp:616:29: warning: 'DefaultDecryptorWithMAC' is deprecated: DefaultDecryptorWithMAC will be changing in the near future because the algorithms are no longer secure [-Wdeprecated-declarations]
FileSource f(in, true, new DefaultDecryptorWithMAC(passPhrase, new FileSink(out)));
^
In file included from test.cpp:14:0:
default.h:159:7: note: declared here
class DefaultDecryptorWithMAC : public ProxyFilter
^
g++ -DNDEBUG -g2 -O2 -march=native -pipe -c validat1.cpp
g++ -DNDEBUG -g2 -O2 -march=native -pipe -c validat2.cpp
validat2.cpp: In function 'bool ValidateECP()':
validat2.cpp:673:2: warning: 'template<class EC, class COFACTOR_OPTION, bool DHAES_MODE> struct CryptoPP::ECIES' is deprecated [-Wdeprecated-declarations]
ECIES<ECP>::Decryptor cpriv(GlobalRNG(), ASN1::secp192r1());
^
In file included from validat2.cpp:10:0:
eccrypto.h:290:8: note: declared here
struct ECIES
^
validat2.cpp:674:2: warning: 'template<class EC, class COFACTOR_OPTION, bool DHAES_MODE> struct CryptoPP::ECIES' is deprecated [-Wdeprecated-declarations]
ECIES<ECP>::Encryptor cpub(cpriv);
^
In file included from validat2.cpp:10:0:
eccrypto.h:290:8: note: declared here
struct ECIES
^
validat2.cpp: In function 'bool ValidateEC2N()':
validat2.cpp:722:2: warning: 'template<class EC, class COFACTOR_OPTION, bool DHAES_MODE> struct CryptoPP::ECIES' is deprecated [-Wdeprecated-declarations]
ECIES<EC2N>::Decryptor cpriv(GlobalRNG(), ASN1::sect193r1());
^
In file included from validat2.cpp:10:0:
eccrypto.h:290:8: note: declared here
struct ECIES
^
validat2.cpp:723:2: warning: 'template<class EC, class COFACTOR_OPTION, bool DHAES_MODE> struct CryptoPP::ECIES' is deprecated [-Wdeprecated-declarations]
ECIES<EC2N>::Encryptor cpub(cpriv);
^
In file included from validat2.cpp:10:0:
eccrypto.h:290:8: note: declared here
struct ECIES
^
And both ./cryptest v
and ./cryptest vv
get stuck and provide no output.
There are lots of warnings when building Crypto++ with TDM-GCC 5.1.0.
These are expected as we warn about impending changes. For these warnings, you need to:
export CXXFLAGS="-DNDEBUG -g2 -O2 -Wno-deprecated-declarations"
make
We can't add it because it neutralizes what we are trying to achieve by warning folks.
This one looks new or it was overlooked in the past. We might be able to fix it. Can you tell us what MinGW is defining it to?
test.cpp:15:0: warning: "_WIN32_WINNT" redefined
fine _WIN32_WINNT 0x0400
It looks like the left part of the message was lost. Can you open up the offending file and add an #undef _WIN32_WINNT
before the #define _WIN32_WINNT 0x0400
?
And both ./cryptest v and ./cryptest vv get stuck and provide no output.
Yeah, we've seen some trouble with GCC 5.x. See, for example, Hang on Debian ARM64 QEMU Chroot. We think its an issue with the compiler, but we are not certain.
We engaged one of the GCC devs about it. In the 3rd week of December, he checked the ARM64 platform using GCC Master, and he confirmed the issue is still present in GCC 6.0.
I emailed him on Thursday, December 31 about it. I have not received a reply yet. I hope to get one soon.
> Hi AP,
>
> I've tried a few more work arounds, but I have not been able to
> sidestep the issue on arm64.
>
> We encountered similar behavior with GCC 5.x on other platforms, like
> Cygwin or ARMEL. We found we could move some inline definitions
> located in headers out-of-line and that resolved the issues. We also
> found dropping optimizations to -O1 would help on occasion.
>
> Do any workarounds come to mind? Would you be able to suggest one?
> ...
>
> On Thu, Dec 24, 2015 at 4:40 AM, AP wrote:
>> If you want I can debug the problem for you on actual arm64 hardware. I
>> need a project for the holidays :). I have access to an armv8.1 hardware
>> too.
>>
>> On Dec 24, 2015 12:29 AM, JW wrote:
>>> ...
>>> The compile farm has a number of arm64/aarch64 machines. Let me say,
>>> that is awesome. I was surprised to learn how difficult it is to
>>> source 64-bit arm machines at a reasonable price.
>>>
>>> The arm64/aarch64 machines at gcc113 - gcc116 are powered by Ubuntu
>>> 14.04, which provides GCC 4.8.4.
>>>
>>> I'm searching for arm64/aarch64 with GCC 5.x. Does anyone know where I
>>> can find one?
I have just found out that incorrect cryptest.exe behaviour is not a Crypto++ problem. That's somewhat like an Avast and TDM conflict. I have disabled Avast, and Crypto++ has passed all tests.
Here are the warnings that are displayed on Linux during compilation with CRYPTOPP_NO_UNALIGNED_ACCESS defined:
GCC version: 4.9.2, Ubuntu 15.04, Linux Kernel 3.19.0-25-generic.