aboutsummaryrefslogtreecommitdiffstats
path: root/package/libs/wolfssl/preinst.arm-ce
diff options
context:
space:
mode:
authorEneas U de Queiroz <cotequeiroz@gmail.com>2022-08-07 21:56:50 -0300
committerChristian Marangi <ansuelsmth@gmail.com>2022-09-16 08:30:26 +0200
commitc3e7d86d2b1d2645e394464d828bb248d47379d0 (patch)
tree3f145933762d5dc1fd9644359b6c1b6dfe9e0ac8 /package/libs/wolfssl/preinst.arm-ce
parent94129cbefb6027cdfe2b7801a6e27a36d4ec58b8 (diff)
downloadupstream-c3e7d86d2b1d2645e394464d828bb248d47379d0.tar.gz
upstream-c3e7d86d2b1d2645e394464d828bb248d47379d0.tar.bz2
upstream-c3e7d86d2b1d2645e394464d828bb248d47379d0.zip
wolfssl: add libwolfssl-cpu-crypto package
libwolfssl-cpu-crypto is a variant of libwolfssl with support for cryptographic CPU instructions on x86_64 and aarch64. On aarch64, wolfSSL does not perform run-time detection, so the library will crash when the AES functions are called. A preinst script attempts to check for support by querying /proc/cpuinfo, if installed in a running system. When building an image, the script will check the DISTRIB_TARGET value in /etc/openwrt_release, and will abort installation if target is bcm27xx. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Diffstat (limited to 'package/libs/wolfssl/preinst.arm-ce')
-rw-r--r--package/libs/wolfssl/preinst.arm-ce25
1 files changed, 25 insertions, 0 deletions
diff --git a/package/libs/wolfssl/preinst.arm-ce b/package/libs/wolfssl/preinst.arm-ce
new file mode 100644
index 0000000000..449e324f16
--- /dev/null
+++ b/package/libs/wolfssl/preinst.arm-ce
@@ -0,0 +1,25 @@
+#!/bin/sh
+exec >&2
+printf "[libwolfssl-cpu-crypto] Checking for Arm v8-A Cryptographic Extension support: "
+if [ -n "${IPKG_INSTROOT}" ]; then
+ printf "...[offline]... "
+ eval "$(grep '^DISTRIB_TARGET=' "${IPKG_INSTROOT}/etc/openwrt_release")"
+ ### @@WOLFSSL_NOASM_REGEX@@ is expanded from WOLFSSL_NOASM_REGEX in the Makefile
+ echo "${DISTRIB_TARGET}" | grep '@@WOLFSSL_NOASM_REGEX@@' > /dev/null && {
+ echo "not supported"
+ echo "Error: Target ${DISTRIB_TARGET} does not support Arm Cryptographic Extension."
+ echo "Install the regular libwolfssl package instead of libwolfssl-cpu-crypto."
+ exit 1
+ }
+else
+ grep -q '^Features.*\baes\b' /proc/cpuinfo || {
+ echo "not supported"
+ echo "Error: Arm v8-A Cryptographic Extension not supported."
+ echo "Install the regular libwolfssl package instead of libwolfssl-cpu-crypto."
+ echo "Contents of /proc/cpuinfo:"
+ cat /proc/cpuinfo
+ exit 1
+ }
+fi
+echo OK
+exit 0