wolfssl: Bump to 4.8.1
authorRISCi_ATOM <bob@bobcall.me>
Fri, 31 Dec 2021 17:53:50 +0000 (12:53 -0500)
committerRISCi_ATOM <bob@bobcall.me>
Fri, 31 Dec 2021 17:53:50 +0000 (12:53 -0500)
package/libs/wolfssl/Config.in
package/libs/wolfssl/Makefile
package/libs/wolfssl/patches/001-Maths-x86-asm-change-asm-snippets-to-get-compiling.patch [new file with mode: 0644]
package/libs/wolfssl/patches/002-Update-macro-guard-on-SHA256-transform-call.patch [new file with mode: 0644]
package/libs/wolfssl/patches/100-disable-hardening-check.patch
package/libs/wolfssl/patches/110-build-with-libtool-2.4.patch [new file with mode: 0644]
package/libs/wolfssl/patches/200-ecc-rng.patch [new file with mode: 0644]
package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch [deleted file]

index c2f66589e6522c2041059df5211c69192d84ea6e..5d1f119ac4d5271adabb73ada23e29fb3e565fdd 100644 (file)
@@ -48,7 +48,7 @@ config WOLFSSL_HAS_WPAS
        default y
 
 config WOLFSSL_HAS_ECC25519
-       bool "Include ECC Curve 22519 support"
+       bool "Include ECC Curve 25519 support"
        default n
 
 config WOLFSSL_HAS_DEVCRYPTO
index 45ec25ecae76d940b383d8ca9c88da7ce57ac224..f11ee39d5ce55355f41e560bf70d37b0f7e99595 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=wolfssl
-PKG_VERSION:=4.7.0-stable
+PKG_VERSION:=4.8.1-stable
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION)
-PKG_HASH:=b0e740b31d4d877d540ad50cc539a8873fc41af02bd3091c4357b403f7106e31
+PKG_HASH:=50db45f348f47e00c93dd244c24108220120cb3cc9d01434789229c32937c444
 
 PKG_FIXUP:=libtool
 PKG_INSTALL:=1
diff --git a/package/libs/wolfssl/patches/001-Maths-x86-asm-change-asm-snippets-to-get-compiling.patch b/package/libs/wolfssl/patches/001-Maths-x86-asm-change-asm-snippets-to-get-compiling.patch
new file mode 100644 (file)
index 0000000..763f9e8
--- /dev/null
@@ -0,0 +1,116 @@
+From fa8f23284d4689c2a737204b337b58d966dcbd8c Mon Sep 17 00:00:00 2001
+From: Sean Parkinson <sean@wolfssl.com>
+Date: Fri, 20 Aug 2021 10:23:38 +1000
+Subject: [PATCH] Maths x86 asm: change asm snippets to get compiling
+
+TFM:
+  Use register or memory for c0, c1, c2 in SQRADD and SQRADD2.
+SP:
+  Use register or memory for vl, vh, vo in SP_ASM_MUL_ADD,
+SP_ASM_MUL_ADD2 and SP_ASM_SQR_ADD.
+---
+ wolfcrypt/src/asm.c    | 29 ++++++++++++++++++++---------
+ wolfcrypt/src/sp_int.c |  6 +++---
+ 2 files changed, 23 insertions(+), 12 deletions(-)
+
+--- a/wolfcrypt/src/asm.c
++++ b/wolfcrypt/src/asm.c
+@@ -698,33 +698,39 @@ __asm__(                             \
+ #define SQRADD(i, j)                                      \
+ __asm__(                                                  \
+-     "movl  %6,%%eax     \n\t"                            \
++     "movl  %3,%%eax     \n\t"                            \
+      "mull  %%eax        \n\t"                            \
+      "addl  %%eax,%0     \n\t"                            \
+      "adcl  %%edx,%1     \n\t"                            \
+      "adcl  $0,%2        \n\t"                            \
+-     :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i) :"%eax","%edx","cc");
++     :"+rm"(c0), "+rm"(c1), "+rm"(c2)                     \
++     : "m"(i)                                             \
++     :"%eax","%edx","cc");
+ #define SQRADD2(i, j)                                     \
+ __asm__(                                                  \
+-     "movl  %6,%%eax     \n\t"                            \
+-     "mull  %7           \n\t"                            \
++     "movl  %3,%%eax     \n\t"                            \
++     "mull  %4           \n\t"                            \
+      "addl  %%eax,%0     \n\t"                            \
+      "adcl  %%edx,%1     \n\t"                            \
+      "adcl  $0,%2        \n\t"                            \
+      "addl  %%eax,%0     \n\t"                            \
+      "adcl  %%edx,%1     \n\t"                            \
+      "adcl  $0,%2        \n\t"                            \
+-     :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j)  :"%eax","%edx", "cc");
++     :"+rm"(c0), "+rm"(c1), "+rm"(c2)                     \
++     : "m"(i), "m"(j)                                     \
++     :"%eax","%edx", "cc");
+ #define SQRADDSC(i, j)                                    \
+-__asm__(                                                     \
++__asm__(                                                  \
+      "movl  %3,%%eax     \n\t"                            \
+      "mull  %4           \n\t"                            \
+      "movl  %%eax,%0     \n\t"                            \
+      "movl  %%edx,%1     \n\t"                            \
+      "xorl  %2,%2        \n\t"                            \
+-     :"=r"(sc0), "=r"(sc1), "=r"(sc2): "g"(i), "g"(j) :"%eax","%edx","cc");
++     :"=r"(sc0), "=r"(sc1), "=r"(sc2)                     \
++     : "g"(i), "g"(j)                                     \
++     :"%eax","%edx","cc");
+ #define SQRADDAC(i, j)                                    \
+ __asm__(                                                  \
+@@ -733,7 +739,9 @@ __asm__(
+      "addl  %%eax,%0     \n\t"                            \
+      "adcl  %%edx,%1     \n\t"                            \
+      "adcl  $0,%2        \n\t"                            \
+-     :"=r"(sc0), "=r"(sc1), "=r"(sc2): "0"(sc0), "1"(sc1), "2"(sc2), "g"(i), "g"(j) :"%eax","%edx","cc");
++     :"=r"(sc0), "=r"(sc1), "=r"(sc2)                     \
++     : "0"(sc0), "1"(sc1), "2"(sc2), "g"(i), "g"(j)       \
++     :"%eax","%edx","cc");
+ #define SQRADDDB                                          \
+ __asm__(                                                  \
+@@ -743,7 +751,10 @@ __asm__(
+      "addl %6,%0         \n\t"                            \
+      "adcl %7,%1         \n\t"                            \
+      "adcl %8,%2         \n\t"                            \
+-     :"=r"(c0), "=r"(c1), "=r"(c2) : "0"(c0), "1"(c1), "2"(c2), "r"(sc0), "r"(sc1), "r"(sc2) : "cc");
++     :"=r"(c0), "=r"(c1), "=r"(c2)                        \
++     : "0"(c0), "1"(c1), "2"(c2), "r"(sc0), "r"(sc1),     \
++       "r"(sc2)                                           \
++     : "cc");
+ #elif defined(TFM_X86_64)
+ /* x86-64 optimized */
+--- a/wolfcrypt/src/sp_int.c
++++ b/wolfcrypt/src/sp_int.c
+@@ -476,7 +476,7 @@ static WC_INLINE sp_int_digit sp_div_wor
+         "addl %%eax, %[l]     \n\t"                    \
+         "adcl %%edx, %[h]     \n\t"                    \
+         "adcl $0   , %[o]     \n\t"                    \
+-        : [l] "+r" (vl), [h] "+r" (vh), [o] "+r" (vo)    \
++        : [l] "+rm" (vl), [h] "+rm" (vh), [o] "+rm" (vo) \
+         : [a] "r" (va), [b] "r" (vb)                     \
+         : "eax", "edx", "cc"                             \
+     )
+@@ -502,7 +502,7 @@ static WC_INLINE sp_int_digit sp_div_wor
+         "addl %%eax, %[l]     \n\t"                    \
+         "adcl %%edx, %[h]     \n\t"                    \
+         "adcl $0   , %[o]     \n\t"                    \
+-        : [l] "+r" (vl), [h] "+r" (vh), [o] "+r" (vo)    \
++        : [l] "+rm" (vl), [h] "+rm" (vh), [o] "+rm" (vo) \
+         : [a] "r" (va), [b] "r" (vb)                     \
+         : "eax", "edx", "cc"                             \
+     )
+@@ -541,7 +541,7 @@ static WC_INLINE sp_int_digit sp_div_wor
+         "addl %%eax, %[l]     \n\t"                    \
+         "adcl %%edx, %[h]     \n\t"                    \
+         "adcl $0   , %[o]     \n\t"                    \
+-        : [l] "+r" (vl), [h] "+r" (vh), [o] "+r" (vo)    \
++        : [l] "+rm" (vl), [h] "+rm" (vh), [o] "+rm" (vo) \
+         : [a] "m" (va)                                   \
+         : "eax", "edx", "cc"                             \
+     )
diff --git a/package/libs/wolfssl/patches/002-Update-macro-guard-on-SHA256-transform-call.patch b/package/libs/wolfssl/patches/002-Update-macro-guard-on-SHA256-transform-call.patch
new file mode 100644 (file)
index 0000000..f986b72
--- /dev/null
@@ -0,0 +1,22 @@
+From f447e4c1fa4c932c0286fa0331966756e243db81 Mon Sep 17 00:00:00 2001
+From: JacobBarthelmeh <jacob@wolfssl.com>
+Date: Fri, 17 Sep 2021 15:06:13 -0700
+Subject: [PATCH] update macro guard on SHA256 transform call
+
+---
+ src/ssl.c   | 3 ++-
+ tests/api.c | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+--- a/src/ssl.c
++++ b/src/ssl.c
+@@ -17639,7 +17639,8 @@ size_t wolfSSL_get_client_random(const W
+     
+     #if defined(OPENSSL_EXTRA)
+     #if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || \
+-        (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2)))
++        (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2))) && \
++        !defined(WOLFSSL_DEVCRYPTO_HASH) && !defined(WOLFSSL_AFALG_HASH)
+     /* Apply SHA256 transformation to the data */
+     int wolfSSL_SHA256_Transform(WOLFSSL_SHA256_CTX* sha256, 
+                                                 const unsigned char* data)
index c89ff1be9df9e3e1dec8b507d4668aed1bab6970..4141e28750d10a1940e0ef60668e06007cb1a2f4 100644 (file)
@@ -1,6 +1,6 @@
 --- a/wolfssl/wolfcrypt/settings.h
 +++ b/wolfssl/wolfcrypt/settings.h
-@@ -2255,7 +2255,7 @@ extern void uITRON4_free(void *p) ;
+@@ -2274,7 +2274,7 @@ extern void uITRON4_free(void *p) ;
  #endif
  
  /* warning for not using harden build options (default with ./configure) */
diff --git a/package/libs/wolfssl/patches/110-build-with-libtool-2.4.patch b/package/libs/wolfssl/patches/110-build-with-libtool-2.4.patch
new file mode 100644 (file)
index 0000000..206c6da
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/configure.ac b/configure.ac
+index 144c857e4..de7f6b45a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -32,7 +32,7 @@ AC_ARG_PROGRAM
+ AC_CONFIG_HEADERS([config.h:config.in])
+-LT_PREREQ([2.4.2])
++LT_PREREQ([2.4])
+ LT_INIT([disable-static win32-dll])
+ #shared library versioning
diff --git a/package/libs/wolfssl/patches/200-ecc-rng.patch b/package/libs/wolfssl/patches/200-ecc-rng.patch
new file mode 100644 (file)
index 0000000..d8581be
--- /dev/null
@@ -0,0 +1,50 @@
+Since commit 6467de5a8840 ("Randomize z ordinates in scalar
+mult when timing resistant") wolfssl requires a RNG for an EC
+key when the hardened built option is selected.
+
+wc_ecc_set_rng is only available when built hardened, so there
+is no safe way to install the RNG to the key regardless whether
+or not wolfssl is compiled hardened.
+
+Always export wc_ecc_set_rng so tools such as hostapd can install
+RNG regardless of the built settings for wolfssl.
+
+--- a/wolfcrypt/src/ecc.c
++++ b/wolfcrypt/src/ecc.c
+@@ -10938,21 +10938,21 @@ void wc_ecc_fp_free(void)
+ #endif /* FP_ECC */
+-#ifdef ECC_TIMING_RESISTANT
+ int wc_ecc_set_rng(ecc_key* key, WC_RNG* rng)
+ {
+     int err = 0;
++#ifdef ECC_TIMING_RESISTANT
+     if (key == NULL) {
+         err = BAD_FUNC_ARG;
+     }
+     else {
+         key->rng = rng;
+     }
++#endif
+     return err;
+ }
+-#endif
+ #ifdef HAVE_ECC_ENCRYPT
+--- a/wolfssl/wolfcrypt/ecc.h
++++ b/wolfssl/wolfcrypt/ecc.h
+@@ -616,10 +616,8 @@ WOLFSSL_API
+ void wc_ecc_fp_free(void);
+ WOLFSSL_LOCAL
+ void wc_ecc_fp_init(void);
+-#ifdef ECC_TIMING_RESISTANT
+ WOLFSSL_API
+ int wc_ecc_set_rng(ecc_key* key, WC_RNG* rng);
+-#endif
+ WOLFSSL_API
+ int wc_ecc_set_curve(ecc_key* key, int keysize, int curve_id);
diff --git a/package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch b/package/libs/wolfssl/patches/900-remove-broken-autoconf-macros.patch
deleted file mode 100644 (file)
index f7756b1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -4140,7 +4140,6 @@ AC_CONFIG_FILES([support/wolfssl.pc])
- AC_CONFIG_FILES([rpm/spec])
- AX_CREATE_GENERIC_CONFIG
--AX_AM_JOBSERVER([yes])
- AC_OUTPUT
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -20,8 +20,6 @@ dist_noinst_SCRIPTS =
- noinst_SCRIPTS =
- check_SCRIPTS =
--#includes additional rules from aminclude.am
--@INC_AMINCLUDE@
- DISTCLEANFILES+= aminclude.am
- CLEANFILES+= cert.der \