weidai11 / cryptopp

free C++ class library of cryptographic schemes
https://cryptopp.com
Other
4.83k stars 1.49k forks source link

SSE3_FLAG used but not not tested for #1163

Closed abdes closed 2 years ago

abdes commented 2 years ago

Crypto++ Issue Report

Crypto++ 8.7.0

In GNUMakefile, SSE3_FLAG is used but it was never being tested for with the test program to check if it is available or not, unlike sse2 and ssse3.

/cryptopp-cmake/_build/_deps/cryptopp # grep -n -A 5 [^S]SSE3_FLAG GNUmakefile
250:    SSE3_FLAG = -xarch=sse3
251-    SSSE3_FLAG = -xarch=ssse3
252-    SSE41_FLAG = -xarch=sse4_1
253-    SSE42_FLAG = -xarch=sse4_2
254-    CLMUL_FLAG = -xarch=aes
255-    AESNI_FLAG = -xarch=aes
--
261:    SSE3_FLAG = -msse3
262-    SSSE3_FLAG = -mssse3
263-    SSE41_FLAG = -msse4.1
264-    SSE42_FLAG = -msse4.2
265-    CLMUL_FLAG = -mpclmul
266-    AESNI_FLAG = -maes
--
409:    ifeq ($(SSE3_FLAG),)
410-      CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SSE3
411-    else ifeq ($(SSSE3_FLAG),)
412-      CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SSSE3
413-    else ifeq ($(SSE41_FLAG),)
414-      CRYPTOPP_CPPFLAGS += -DCRYPTOPP_DISABLE_SSE4
noloader commented 2 years ago

SSE3 is available when SSSE3 is available.

What problem are you having?

abdes commented 2 years ago

The test at line 409, what's the point from it if SSE3 was not checked before? SSE3_FLAG is always set to something and never cleared cause it's never tested with the test program...

noloader commented 2 years ago

I cleared this at Commit cb6804da1763. But I would also be interested in learning what trouble you were having because of it.

abdes commented 2 years ago

I personally did not have any trouble. I was going through the GNUMakefile line by line to sync the cmake build with it. I reported all the issues I have seen. Some of them I have been able to definitely reproduce in a bad build and this one I could not reproduce, but I'm pretty sure it's a programming error. Thanks for fixing it and for considering the other reported issues.