Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit 1e9c8cc4439edaa81aa33c12165b3ccca5b2ea25
- Author: Pierre Chevalier <pierrechevalier83@hotmail.fr>
- Date: Thu May 29 02:11:19 2014 +0100
- Dirty Hack to get cryptopp to compile
- The new file: dirtyHackForGcc49.h
- contains the relevant bits of gpu.h
- that needs to be included in gcm.cpp and rijndael.cpp
- diff --git a/src/third_party_libs/cryptopp/dirtyHackForGcc49.h b/src/third_party_libs/cryptopp/dirtyHackForGcc49.h
- new file mode 100644
- index 0000000..aa0c854
- --- /dev/null
- +++ b/src/third_party_libs/cryptopp/dirtyHackForGcc49.h
- @@ -0,0 +1,88 @@
- +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ > 8) // only if gcc 4.9 or higher
- +#if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
- +
- +#ifndef EXCLUDE_FIRST_HALF // This ones are redefined in rijndael.cpp if not excluded
- +#if !defined(__GNUC__) || defined(__SSSE3__) || defined(__INTEL_COMPILER)
- +#include <tmmintrin.h>
- +#else
- +__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- +_mm_shuffle_epi8 (__m128i a, __m128i b)
- +{
- + asm ("pshufb %1, %0" : "+x"(a) : "xm"(b));
- + return a;
- +}
- +#endif
- +#if !defined(__GNUC__) || (defined(__AES__) && defined(__PCLMUL__)) || defined(__INTEL_COMPILER)
- +#include <wmmintrin.h>
- +#else
- +__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- +_mm_clmulepi64_si128 (__m128i a, __m128i b, const int i)
- +{
- + asm ("pclmulqdq %2, %1, %0" : "+x"(a) : "xm"(b), "i"(i));
- + return a;
- +}
- +#endif
- +#endif // EXCLUDE_FIRST_HALF
- +
- +#if !defined(__GNUC__) || defined(__SSE4_1__) || defined(__INTEL_COMPILER)
- +#include <smmintrin.h>
- +#else
- +__inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- +_mm_extract_epi32 (__m128i a, const int i)
- +{
- + int r;
- + asm ("pextrd %2, %1, %0" : "=rm"(r) : "x"(a), "i"(i));
- + return r;
- +}
- +__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- +_mm_insert_epi32 (__m128i a, int b, const int i)
- +{
- + asm ("pinsrd %2, %1, %0" : "+x"(a) : "rm"(b), "i"(i));
- + return a;
- +}
- +#endif
- +#if !defined(__GNUC__) || (defined(__AES__) && defined(__PCLMUL__)) || defined(__INTEL_COMPILER)
- +#include <wmmintrin.h>
- +#else
- +__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- +_mm_aeskeygenassist_si128 (__m128i a, const int i)
- +{
- + __m128i r;
- + asm ("aeskeygenassist %2, %1, %0" : "=x"(r) : "xm"(a), "i"(i));
- + return r;
- +}
- +__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- +_mm_aesimc_si128 (__m128i a)
- +{
- + __m128i r;
- + asm ("aesimc %1, %0" : "=x"(r) : "xm"(a));
- + return r;
- +}
- +__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- +_mm_aesenc_si128 (__m128i a, __m128i b)
- +{
- + asm ("aesenc %1, %0" : "+x"(a) : "xm"(b));
- + return a;
- +}
- +__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- +_mm_aesenclast_si128 (__m128i a, __m128i b)
- +{
- + asm ("aesenclast %1, %0" : "+x"(a) : "xm"(b));
- + return a;
- +}
- +__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- +_mm_aesdec_si128 (__m128i a, __m128i b)
- +{
- + asm ("aesdec %1, %0" : "+x"(a) : "xm"(b));
- + return a;
- +}
- +__inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- +_mm_aesdeclast_si128 (__m128i a, __m128i b)
- +{
- + asm ("aesdeclast %1, %0" : "+x"(a) : "xm"(b));
- + return a;
- +}
- +#endif
- +
- +#endif// CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
- +#endif// gcc 4.9
- diff --git a/src/third_party_libs/cryptopp/gcm.cpp b/src/third_party_libs/cryptopp/gcm.cpp
- index 237325d..0969939 100644
- --- a/src/third_party_libs/cryptopp/gcm.cpp
- +++ b/src/third_party_libs/cryptopp/gcm.cpp
- @@ -85,6 +85,8 @@ static CRYPTOPP_ALIGN_DATA(16) const word64 s_clmulConstants64[] = {
- static const __m128i *s_clmulConstants = (const __m128i *)s_clmulConstants64;
- static const unsigned int s_clmulTableSizeInBlocks = 8;
- +#include "dirtyHackForGcc49.h"
- +
- inline __m128i CLMUL_Reduce(__m128i c0, __m128i c1, __m128i c2, const __m128i &r)
- {
- /*
- diff --git a/src/third_party_libs/cryptopp/rijndael.cpp b/src/third_party_libs/cryptopp/rijndael.cpp
- index c185032..20dc461 100644
- --- a/src/third_party_libs/cryptopp/rijndael.cpp
- +++ b/src/third_party_libs/cryptopp/rijndael.cpp
- @@ -195,6 +195,9 @@ void Rijndael::Base::FillDecTable()
- s_TdFilled = true;
- }
- +#define EXCLUDE_FIRST_HALF
- +#include "dirtyHackForGcc49.h"
- +
- void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keylen, const NameValuePairs &)
- {
- AssertValidKeyLength(keylen);
- commit dbaa3decd029cc8107fc8dbcc34f41792b9df98e
- Author: Pierre Chevalier <pierrechevalier83@hotmail.fr>
- Date: Wed May 28 22:09:43 2014 +0100
- Fix crypto++ library for GCC 4.9 - part 1
- This part is as recommended by the gcc guys.
- See http://sourceforge.net/apps/trac/cryptopp/ticket/33
- diff --git a/src/third_party_libs/cryptopp/cpu.h b/src/third_party_libs/cryptopp/cpu.h
- index 65029d3..c890da9 100644
- --- a/src/third_party_libs/cryptopp/cpu.h
- +++ b/src/third_party_libs/cryptopp/cpu.h
- @@ -17,7 +17,7 @@
- #endif
- #if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
- -#if !defined(__GNUC__) || defined(__SSSE3__) || defined(__INTEL_COMPILER)
- +#if !defined(__GNUC__) || defined(__SSSE3__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ > 8) || defined(__INTEL_COMPILER)
- #include <tmmintrin.h>
- #else
- __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- @@ -27,7 +27,7 @@ _mm_shuffle_epi8 (__m128i a, __m128i b)
- return a;
- }
- #endif
- -#if !defined(__GNUC__) || defined(__SSE4_1__) || defined(__INTEL_COMPILER)
- +#if !defined(__GNUC__) || defined(__SSE4_1__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ > 8) || defined(__INTEL_COMPILER)
- #include <smmintrin.h>
- #else
- __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
- @@ -44,7 +44,7 @@ _mm_insert_epi32 (__m128i a, int b, const int i)
- return a;
- }
- #endif
- -#if !defined(__GNUC__) || (defined(__AES__) && defined(__PCLMUL__)) || defined(__INTEL_COMPILER)
- +#if !defined(__GNUC__) || (defined(__AES__) && defined(__PCLMUL__)) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ > 8) || defined(__INTEL_COMPILER)
- #include <wmmintrin.h>
- #else
- __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement