X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gosthash2012.h;h=99c9e3d694fd8305d099c1def5b8a114d3381e5e;hb=20f4ae52470e6dcf2af1f97ceb40a63b5200ec37;hp=4d57e14f2f34c6cd4fc2ad84524a9b50404269e5;hpb=78ff909c3ca7260912360427fd3b029c9ba08d87;p=openssl-gost%2Fengine.git diff --git a/gosthash2012.h b/gosthash2012.h index 4d57e14..99c9e3d 100644 --- a/gosthash2012.h +++ b/gosthash2012.h @@ -10,11 +10,18 @@ #include -#ifdef OPENSSL_IA32_SSE2 -# ifdef __MMX__ -# ifdef __SSE2__ -# define __GOST3411_HAS_SSE2__ -# endif +#ifdef __SSE2__ +# define __GOST3411_HAS_SSE2__ +# if !defined(__x86_64__) && !defined(__e2k__) +/* + * x86-64 bit Linux and Windows ABIs provide malloc function that returns + * 16-byte alignment memory buffers required by SSE load/store instructions. + * Other platforms require special trick for proper gost2012_hash_ctx structure + * allocation. It will be easier to switch to unaligned loadu/storeu memory + * access instructions in this case. + */ +# define UNALIGNED_SIMD_ACCESS +# pragma message "Use unaligned SIMD memory access" # endif #endif @@ -27,6 +34,7 @@ #ifndef L_ENDIAN # define __GOST3411_BIG_ENDIAN__ #endif + #if defined __GOST3411_HAS_SSE2__ # include "gosthash2012_sse2.h" #else