diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2019-10-24 19:20:05 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2019-10-24 21:07:39 +0200 |
commit | 96c90d18c2b0b036a90aa19337424c939391b1ac (patch) | |
tree | cdaf72906b8b51cab89cf92bbc31c164eeec909f /src | |
parent | 6b90e026247de0ef459d999dea40c75e7c1f9569 (diff) | |
download | VeraCrypt-96c90d18c2b0b036a90aa19337424c939391b1ac.tar.gz VeraCrypt-96c90d18c2b0b036a90aa19337424c939391b1ac.zip |
Linux/MacOSX: Better approach to avoid that jitterentropy code is optimized by the compiler
Diffstat (limited to 'src')
-rw-r--r-- | src/Build/Include/Makefile.inc | 12 | ||||
-rw-r--r-- | src/Crypto/jitterentropy-base.c | 6 | ||||
-rw-r--r-- | src/Volume/Volume.make | 4 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/Build/Include/Makefile.inc b/src/Build/Include/Makefile.inc index b39021d4..ba166b69 100644 --- a/src/Build/Include/Makefile.inc +++ b/src/Build/Include/Makefile.inc @@ -14,12 +14,16 @@ $(NAME): $(NAME).a clean: @echo Cleaning $(NAME) - rm -f $(APPNAME) $(NAME).a $(OBJS) $(OBJSEX) $(OBJS:.o=.d) *.gch + rm -f $(APPNAME) $(NAME).a $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) *.gch %.o: %.c @echo Compiling $(<F) $(CC) $(CFLAGS) -c $< -o $@ +%.o0: %.c + @echo Compiling $(<F) + $(CC) $(CFLAGS) -O0 -c $< -o $@ + %.o: %.cpp @echo Compiling $(<F) $(CXX) $(CXXFLAGS) -c $< -o $@ @@ -64,10 +68,10 @@ TR_SED_BIN := tr '\n' ' ' | tr -s ' ' ',' | sed -e 's/^,//g' -e 's/,$$/n/' | tr # Dependencies --include $(OBJS:.o=.d) $(OBJSEX:.oo=.d) +-include $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) -$(NAME).a: $(OBJS) $(OBJSEX) +$(NAME).a: $(OBJS) $(OBJSEX) $(OBJSNOOPT) @echo Updating library $@ - $(AR) $(AFLAGS) -rcu $@ $(OBJS) $(OBJSEX) + $(AR) $(AFLAGS) -rcu $@ $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(RANLIB) $@ diff --git a/src/Crypto/jitterentropy-base.c b/src/Crypto/jitterentropy-base.c index c05f0c37..50544acb 100644 --- a/src/Crypto/jitterentropy-base.c +++ b/src/Crypto/jitterentropy-base.c @@ -57,7 +57,11 @@ #pragma optimize( "", off ) #pragma warning(disable:4242 4244 4334) /* disable warnings on the original code */ #else -#pragma GCC optimize ("O0") +#if defined(__clang__) + #pragma clang optimize off +#elif defined (__GNUC__) + #pragma GCC optimize ("O0") +#endif #endif #include "jitterentropy.h" diff --git a/src/Volume/Volume.make b/src/Volume/Volume.make index 9b7ea5dd..224eff66 100644 --- a/src/Volume/Volume.make +++ b/src/Volume/Volume.make @@ -12,6 +12,7 @@ OBJS := OBJSEX := +OBJSNOOPT := OBJS += Cipher.o OBJS += EncryptionAlgorithm.o OBJS += EncryptionMode.o @@ -80,7 +81,8 @@ OBJS += ../Crypto/GostCipher.o OBJS += ../Crypto/Streebog.o OBJS += ../Crypto/kuznyechik.o OBJS += ../Crypto/kuznyechik_simd.o -OBJS += ../Crypto/jitterentropy-base.o + +OBJSNOOPT += ../Crypto/jitterentropy-base.o0 OBJS += ../Common/Crc.o OBJS += ../Common/Endian.o |