d65a117d1ef4a95e99bffe3d2a4a7c0d5061efd8
[openwrt/staging/noltari.git] / package / libs / wolfssl / patches / 300-AESNI-fix-configure-to-use-minimal-compiler-flags.patch
1 From 9ba77300f9f5dea9f53aed00bf6c33d10b7b2fce Mon Sep 17 00:00:00 2001
2 From: Sean Parkinson <sean@wolfssl.com>
3 Date: Thu, 7 Jul 2022 09:30:48 +1000
4 Subject: [PATCH] AESNI: fix configure to use minimal compiler flags
5
6
7 diff --git a/configure.ac b/configure.ac
8 index df97ac75c..6abb0c744 100644
9 --- a/configure.ac
10 +++ b/configure.ac
11 @@ -2142,21 +2142,19 @@ then
12 if test "$ENABLED_AESNI" = "yes" || test "$ENABLED_INTELASM" = "yes"
13 then
14 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI"
15 - if test "$GCC" = "yes"
16 + if test "$CC" != "icc"
17 then
18 - # clang needs these flags
19 - if test "$CC" = "clang"
20 - then
21 - AM_CFLAGS="$AM_CFLAGS -maes -mpclmul"
22 - else
23 - # GCC needs these flags, icc doesn't
24 - # opt levels greater than 2 may cause problems on systems w/o
25 - # aesni
26 - if test "$CC" != "icc"
27 - then
28 - AM_CFLAGS="$AM_CFLAGS -maes -msse4 -mpclmul"
29 - fi
30 - fi
31 + case $host_os in
32 + mingw*)
33 + # Windows uses intrinsics for GCM which uses SSE4 instructions.
34 + # MSVC has own build files.
35 + AM_CFLAGS="$AM_CFLAGS -maes -msse4 -mpclmul"
36 + ;;
37 + *)
38 + # Intrinsics used in AES_set_decrypt_key (TODO: rework)
39 + AM_CFLAGS="$AM_CFLAGS -maes"
40 + ;;
41 + esac
42 fi
43 AS_IF([test "x$ENABLED_AESGCM" != "xno"],[AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"])
44 fi