diff --git a/crypto/internal.h b/crypto/internal.h index 3bfeaf7a78..62ce4a3271 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -206,10 +206,18 @@ typedef __uint128_t uint128_t; #define OPENSSL_SSE2 #endif -// For convenience in testing 64-bit generic code, we allow disabling SSE2 -// intrinsics via |OPENSSL_NO_SSE2_FOR_TESTING|. x86_64 always has SSE2 -// available, so we would otherwise need to test such code on a non-x86_64 -// platform. +#if defined(OPENSSL_X86) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_SSE2) +#error \ + "x86 assembly requires SSE2. Build with -msse2 (recommended), or disable assembly optimizations with -DOPENSSL_NO_ASM." +#endif + +// For convenience in testing the fallback code, we allow disabling SSE2 +// intrinsics via |OPENSSL_NO_SSE2_FOR_TESTING|. We require SSE2 on x86 and +// x86_64, so we would otherwise need to test such code on a non-x86 platform. +// +// This does not remove the above requirement for SSE2 support with assembly +// optimizations. It only disables some intrinsics-based optimizations so that +// we can test the fallback code on CI. #if defined(OPENSSL_SSE2) && defined(OPENSSL_NO_SSE2_FOR_TESTING) #undef OPENSSL_SSE2 #endif