mbedtls: refresh patch

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2022-03-02 11:11:05 +08:00
parent fa1e59eb19
commit 06fb2cdbef
No known key found for this signature in database
GPG Key ID: 6850B6345C862176

View File

@ -27,12 +27,12 @@ QEMU seems to also need
Then run normal make or cmake etc.
---
--- a/ChangeLog.d/armv8_crypto_extensions.txt
--- /dev/null
+++ b/ChangeLog.d/armv8_crypto_extensions.txt
@@ -0,0 +1,2 @@
+Features
+ * Support ARMv8 Cryptography Extensions for AES and GCM.
--- a/include/mbedtls/armv8ce_aes.h
--- /dev/null
+++ b/include/mbedtls/armv8ce_aes.h
@@ -0,0 +1,63 @@
+/**
@ -100,7 +100,7 @@ Then run normal make or cmake etc.
+#endif /* MBEDTLS_ARMV8CE_AES_H */
--- a/include/mbedtls/check_config.h
+++ b/include/mbedtls/check_config.h
@@ -95,6 +95,10 @@
@@ -72,6 +72,10 @@
#error "MBEDTLS_AESNI_C defined, but not all prerequisites"
#endif
@ -111,14 +111,14 @@ Then run normal make or cmake etc.
#if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
#error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
#endif
@@ -772,3 +776,4 @@
@@ -897,3 +901,4 @@
typedef int mbedtls_iso_c_forbids_empty_translation_units;
#endif /* MBEDTLS_CHECK_CONFIG_H */
+
--- a/include/mbedtls/config.h
+++ b/include/mbedtls/config.h
@@ -73,6 +73,7 @@
@@ -46,6 +46,7 @@
* Requires support for asm() in compiler.
*
* Used in:
@ -126,7 +126,7 @@ Then run normal make or cmake etc.
* library/aria.c
* library/timing.c
* include/mbedtls/bn_mul.h
@@ -1905,6 +1906,21 @@
@@ -2313,6 +2314,21 @@
#define MBEDTLS_AESNI_C
/**
@ -150,7 +150,7 @@ Then run normal make or cmake etc.
* Enable the AES block cipher.
--- a/library/aes.c
+++ b/library/aes.c
@@ -69,7 +69,9 @@
@@ -39,7 +39,9 @@
#if defined(MBEDTLS_AESNI_C)
#include "mbedtls/aesni.h"
#endif
@ -161,7 +161,7 @@ Then run normal make or cmake etc.
#if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
@@ -1052,6 +1054,11 @@
@@ -999,6 +1001,11 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_c
return( mbedtls_aesni_crypt_ecb( ctx, mode, input, output ) );
#endif
@ -173,7 +173,7 @@ Then run normal make or cmake etc.
#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86)
if( aes_padlock_ace )
{
--- a/library/armv8ce_aes.c
--- /dev/null
+++ b/library/armv8ce_aes.c
@@ -0,0 +1,142 @@
+/*
@ -320,7 +320,7 @@ Then run normal make or cmake etc.
+#endif /* MBEDTLS_ARMV8CE_AES_C */
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -7,6 +7,7 @@
@@ -15,6 +15,7 @@ set(src_crypto
aesni.c
arc4.c
aria.c
@ -330,7 +330,7 @@ Then run normal make or cmake etc.
base64.c
--- a/library/gcm.c
+++ b/library/gcm.c
@@ -71,6 +71,10 @@
@@ -41,6 +41,10 @@
#include "mbedtls/aesni.h"
#endif
@ -341,7 +341,7 @@ Then run normal make or cmake etc.
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
#include "mbedtls/aes.h"
#include "mbedtls/platform.h"
@@ -140,6 +144,12 @@
@@ -87,6 +91,12 @@ static int gcm_gen_table( mbedtls_gcm_co
if( ( ret = mbedtls_cipher_update( &ctx->cipher_ctx, h, 16, h, &olen ) ) != 0 )
return( ret );
@ -352,9 +352,9 @@ Then run normal make or cmake etc.
+#endif
+
/* pack h as two 64-bits ints, big-endian */
GET_UINT32_BE( hi, h, 0 );
GET_UINT32_BE( lo, h, 4 );
@@ -248,6 +258,11 @@
hi = MBEDTLS_GET_UINT32_BE( h, 0 );
lo = MBEDTLS_GET_UINT32_BE( h, 4 );
@@ -196,6 +206,11 @@ static void gcm_mult( mbedtls_gcm_contex
unsigned char lo, hi, rem;
uint64_t zh, zl;
@ -368,17 +368,17 @@ Then run normal make or cmake etc.
unsigned char h[16];
--- a/library/Makefile
+++ b/library/Makefile
@@ -65,6 +65,7 @@
OBJS_CRYPTO= aes.o aesni.o arc4.o \
aria.o asn1parse.o asn1write.o \
+ armv8ce_aes.o \
base64.o bignum.o blowfish.o \
camellia.o ccm.o chacha20.o \
chachapoly.o cipher.o cipher_wrap.o \
@@ -74,6 +74,7 @@ OBJS_CRYPTO= \
aria.o \
asn1parse.o \
asn1write.o \
+ armv8ce_aes.o \
base64.o \
bignum.o \
blowfish.o \
--- a/library/version_features.c
+++ b/library/version_features.c
@@ -586,6 +586,9 @@
@@ -624,6 +624,9 @@ static const char * const features[] = {
#if defined(MBEDTLS_AESNI_C)
"MBEDTLS_AESNI_C",
#endif /* MBEDTLS_AESNI_C */