mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-09 22:42:57 +00:00
c3e7d86d2b
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>
26 lines
926 B
Bash
26 lines
926 B
Bash
#!/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
|