mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 23:12:32 +00:00
wolfssl: enable CPU crypto instructions
This enables AES & SHA CPU instructions for compatible armv8, and x86_64 architectures. Add this to the hardware acceleration choice, since they can't be enabled at the same time. The package was marked non-shared, since the arm CPUs may or may not have crypto extensions enabled based on licensing; bcm27xx does not enable them. There is no run-time detection of this for arm. NOTE: Should this be backported to a release branch, it must be done shortly before a new minor release, because the change to nonshared will remove libwolfssl from the shared packages, but the nonshared are only built in a subsequent release! Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
This commit is contained in:
parent
18fd12edb8
commit
0a2edc2714
@ -62,13 +62,25 @@ config WOLFSSL_ALT_NAMES
|
|||||||
config WOLFSSL_HAS_DEVCRYPTO
|
config WOLFSSL_HAS_DEVCRYPTO
|
||||||
bool
|
bool
|
||||||
|
|
||||||
|
config WOLFSSL_ASM_CAPABLE
|
||||||
|
bool
|
||||||
|
default x86_64 || (aarch64 && !TARGET_bcm27xx)
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Hardware Acceleration"
|
prompt "Hardware Acceleration"
|
||||||
|
default WOLFSSL_HAS_CPU_CRYPTO if WOLFSSL_ASM_CAPABLE
|
||||||
default WOLFSSL_HAS_NO_HW
|
default WOLFSSL_HAS_NO_HW
|
||||||
|
|
||||||
config WOLFSSL_HAS_NO_HW
|
config WOLFSSL_HAS_NO_HW
|
||||||
bool "None"
|
bool "None"
|
||||||
|
|
||||||
|
config WOLFSSL_HAS_CPU_CRYPTO
|
||||||
|
bool "Use CPU crypto instructions"
|
||||||
|
depends on WOLFSSL_ASM_CAPABLE
|
||||||
|
help
|
||||||
|
This will use Intel AESNI insturctions or armv8 Crypto Extensions.
|
||||||
|
Either of them should easily outperform hardware crypto in WolfSSL.
|
||||||
|
|
||||||
config WOLFSSL_HAS_AFALG
|
config WOLFSSL_HAS_AFALG
|
||||||
bool "AF_ALG"
|
bool "AF_ALG"
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ PKG_ABI_VERSION:=$(patsubst %-stable,%,$(PKG_VERSION)).$(call version_abbrev,$(c
|
|||||||
|
|
||||||
PKG_CONFIG_DEPENDS+=\
|
PKG_CONFIG_DEPENDS+=\
|
||||||
CONFIG_WOLFSSL_HAS_AFALG \
|
CONFIG_WOLFSSL_HAS_AFALG \
|
||||||
|
CONFIG_WOLFSSL_HAS_CPU_CRYPTO \
|
||||||
CONFIG_WOLFSSL_HAS_DEVCRYPTO_AES \
|
CONFIG_WOLFSSL_HAS_DEVCRYPTO_AES \
|
||||||
CONFIG_WOLFSSL_HAS_DEVCRYPTO_CBC \
|
CONFIG_WOLFSSL_HAS_DEVCRYPTO_CBC \
|
||||||
CONFIG_WOLFSSL_HAS_DEVCRYPTO_FULL
|
CONFIG_WOLFSSL_HAS_DEVCRYPTO_FULL
|
||||||
@ -59,6 +60,7 @@ endef
|
|||||||
define Package/libwolfssl
|
define Package/libwolfssl
|
||||||
$(call Package/libwolfssl/Default)
|
$(call Package/libwolfssl/Default)
|
||||||
TITLE:=wolfSSL library
|
TITLE:=wolfSSL library
|
||||||
|
PKGFLAGS:=nonshared
|
||||||
MENU:=1
|
MENU:=1
|
||||||
PROVIDES:=libcyassl
|
PROVIDES:=libcyassl
|
||||||
DEPENDS:=+WOLFSSL_HAS_DEVCRYPTO:kmod-cryptodev +WOLFSSL_HAS_AFALG:kmod-crypto-user
|
DEPENDS:=+WOLFSSL_HAS_DEVCRYPTO:kmod-cryptodev +WOLFSSL_HAS_AFALG:kmod-crypto-user
|
||||||
@ -133,6 +135,15 @@ CONFIGURE_ARGS += \
|
|||||||
--enable-wpas --enable-fortress --enable-fastmath
|
--enable-wpas --enable-fortress --enable-fastmath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef CONFIG_WOLFSSL_HAS_CPU_CRYPTO
|
||||||
|
ifdef CONFIG_aarch64
|
||||||
|
CONFIGURE_ARGS += --enable-armasm
|
||||||
|
TARGET_CFLAGS:=$(TARGET_CFLAGS:-mcpu%=-mcpu%+crypto)
|
||||||
|
else ifdef CONFIG_TARGET_x86_64
|
||||||
|
CONFIGURE_ARGS += --enable-intelasm
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
define Build/InstallDev
|
define Build/InstallDev
|
||||||
$(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig
|
$(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
|
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
|
||||||
|
Loading…
Reference in New Issue
Block a user