Browse Source

Update ARMV8CE_AES.patch

garypang13 4 years ago
parent
commit
e180456d63
1 changed files with 25 additions and 9 deletions
  1. 25 9
      devices/common/patches/ARMV8CE_AES.patch

+ 25 - 9
devices/common/patches/ARMV8CE_AES.patch

@@ -1,14 +1,15 @@
 --- a/package/libs/mbedtls/Makefile
 +++ b/package/libs/mbedtls/Makefile
-@@ -23,6 +23,7 @@ PKG_CPE_ID:=cpe:/a:arm:mbed_tls
+@@ -23,6 +23,8 @@ PKG_CPE_ID:=cpe:/a:arm:mbed_tls
  
  PKG_CONFIG_DEPENDS := \
  	CONFIG_LIBMBEDTLS_DEBUG_C \
 +	CONFIG_LIBMBEDTLS_HAVE_ARMV8CE_AES \
- 	CONFIG_LIBMBEDTLS_HAVE_SSE2 \
++	CONFIG_LIBMBEDTLS_HAVE_SSE2 \
  	CONFIG_LIBMBEDTLS_HKDF_C
  
-@@ -61,6 +62,20 @@ config LIBMBEDTLS_DEBUG_C
+ include $(INCLUDE_DIR)/package.mk
+@@ -60,6 +62,34 @@ config LIBMBEDTLS_DEBUG_C
  
  	 Usually, you don't need this, so don't select this if you're unsure.
  
@@ -26,24 +27,39 @@
 +	 devices, except some wastes like Broadcom.
 +	 If you don't sure, say Y here.
 +
- config LIBMBEDTLS_HAVE_SSE2
++config LIBMBEDTLS_HAVE_SSE2
++	depends on PACKAGE_libmbedtls
++	bool
++	default y if !TARGET_x86_legacy && !TARGET_x86_geode
++	prompt "Enable use of x86 SSE2 instructions"
++	depends on x86_64 || i386
++	help
++	 Use of SSE2 instructions greatly increase performance (up to
++	 3x faster) with a minimum (~0.2%, or 23KB) increase in package
++	 size, but it will bring no benefit if your hardware does not
++	 support them, such as Geode GX and LX.  In this case you may
++	 save 23KB by saying yes here.  AMD Geode NX, and Intel
++	 Pentium 4 and above support SSE2.
++
+ config LIBMBEDTLS_HKDF_C
  	depends on PACKAGE_libmbedtls
- 	bool
-@@ -107,6 +122,9 @@ PKG_INSTALL:=1
+ 	bool "Enable the HKDF algorithm (RFC 5869)"
+@@ -92,6 +122,9 @@ PKG_INSTALL:=1
  
  TARGET_CFLAGS += -ffunction-sections -fdata-sections
  TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS))
-+ifneq ($(CONFIG_LIBMBEDTILS_HAVE_ARMV8CE_AES),)
++ifneq ($(CONFIG_LIBMBEDTLS_HAVE_ARMV8CE_AES),)
 +  TARGET_CFLAGS := $(filter-out -march=%,$(TARGET_CFLAGS)) -march=armv8-a+crypto
 +endif
  
  CMAKE_OPTIONS += \
  	-DUSE_SHARED_MBEDTLS_LIBRARY:Bool=ON \
-@@ -118,6 +136,7 @@ define Build/Configure
+@@ -103,6 +136,8 @@ define Build/Configure
  
  	awk 'BEGIN { rc = 1 } \
  	     /#define MBEDTLS_DEBUG_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_DEBUG_C),,// )#define MBEDTLS_DEBUG_C"; rc = 0 } \
 +	     /#define MBEDTLS_ARMV8CE_AES_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_HAVE_ARMV8CE_AES),,// )#define MBEDTLS_ARMV8CE_AES_C"; rc = 0 } \
- 	     /#define MBEDTLS_HAVE_SSE2/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_HAVE_SSE2),,// )#define MBEDTLS_HAVE_SSE2"; rc = 0 } \
++	     /#define MBEDTLS_HAVE_SSE2/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_HAVE_SSE2),,// )#define MBEDTLS_HAVE_SSE2"; rc = 0 } \
  	     { print } \
  	     END { exit(rc) }' $(PKG_BUILD_DIR)/include/mbedtls/config.h \
+ 	     >$(PKG_BUILD_DIR)/include/mbedtls/config.h.new && \