diff --git a/package/libs/mbedtls/patches/200-Implements-AES-and-GCM-with-ARMv8-Crypto-Extensions.patch b/package/libs/mbedtls/patches/200-Implements-AES-and-GCM-with-ARMv8-Crypto-Extensions.patch index 72f96d2a70..3633b35f60 100644 --- a/package/libs/mbedtls/patches/200-Implements-AES-and-GCM-with-ARMv8-Crypto-Extensions.patch +++ b/package/libs/mbedtls/patches/200-Implements-AES-and-GCM-with-ARMv8-Crypto-Extensions.patch @@ -100,8 +100,8 @@ Then run normal make or cmake etc. +#endif /* MBEDTLS_ARMV8CE_AES_H */ --- a/include/mbedtls/check_config.h +++ b/include/mbedtls/check_config.h -@@ -72,6 +72,10 @@ - #error "MBEDTLS_AESNI_C defined, but not all prerequisites" +@@ -69,6 +69,10 @@ + #error "MBEDTLS_HAVE_TIME_DATE without MBEDTLS_HAVE_TIME does not make sense" #endif +#if defined(MBEDTLS_ARMV8CE_AES_C) && !defined(MBEDTLS_HAVE_ASM) @@ -111,9 +111,9 @@ 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 -@@ -956,3 +960,4 @@ - typedef int mbedtls_iso_c_forbids_empty_translation_units; +@@ -959,3 +963,4 @@ typedef int mbedtls_iso_c_forbids_empty_ + /* *INDENT-ON* */ #endif /* MBEDTLS_CHECK_CONFIG_H */ + --- a/include/mbedtls/config.h @@ -126,7 +126,7 @@ Then run normal make or cmake etc. * library/aria.c * library/timing.c * include/mbedtls/bn_mul.h -@@ -2331,6 +2332,21 @@ +@@ -2374,6 +2375,21 @@ #define MBEDTLS_AESNI_C /** @@ -161,8 +161,8 @@ Then run normal make or cmake etc. #include "mbedtls/platform.h" #if !defined(MBEDTLS_AES_ALT) -@@ -992,6 +994,11 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_c - return( mbedtls_aesni_crypt_ecb( ctx, mode, input, output ) ); +@@ -1040,6 +1042,11 @@ int mbedtls_aes_crypt_ecb(mbedtls_aes_co + } #endif +#if defined(MBEDTLS_ARMV8CE_AES_C) @@ -171,8 +171,8 @@ Then run normal make or cmake etc. +#endif + #if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) - if( aes_padlock_ace ) - { + if (aes_padlock_ace) { + return mbedtls_padlock_xcryptecb(ctx, mode, input, output); --- /dev/null +++ b/library/armv8ce_aes.c @@ -0,0 +1,142 @@ @@ -341,9 +341,9 @@ Then run normal make or cmake etc. #if !defined(MBEDTLS_GCM_ALT) /* Parameter validation macros */ -@@ -79,6 +83,12 @@ static int gcm_gen_table( mbedtls_gcm_co - if( ( ret = mbedtls_cipher_update( &ctx->cipher_ctx, h, 16, h, &olen ) ) != 0 ) - return( ret ); +@@ -80,6 +84,12 @@ static int gcm_gen_table(mbedtls_gcm_con + return ret; + } +#if defined(MBEDTLS_ARMV8CE_AES_C) + // we don't do feature testing with ARMv8 cryptography extensions @@ -352,9 +352,9 @@ Then run normal make or cmake etc. +#endif + /* pack h as two 64-bits ints, big-endian */ - hi = MBEDTLS_GET_UINT32_BE( h, 0 ); - lo = MBEDTLS_GET_UINT32_BE( h, 4 ); -@@ -188,6 +198,11 @@ static void gcm_mult( mbedtls_gcm_contex + hi = MBEDTLS_GET_UINT32_BE(h, 0); + lo = MBEDTLS_GET_UINT32_BE(h, 4); +@@ -190,6 +200,11 @@ static void gcm_mult(mbedtls_gcm_context unsigned char lo, hi, rem; uint64_t zh, zl; @@ -363,8 +363,8 @@ Then run normal make or cmake etc. + return; +#endif + - #if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64) - if( mbedtls_aesni_has_support( MBEDTLS_AESNI_CLMUL ) ) { + #if defined(MBEDTLS_AESNI_HAVE_CODE) + if (mbedtls_aesni_has_support(MBEDTLS_AESNI_CLMUL)) { unsigned char h[16]; --- a/library/Makefile +++ b/library/Makefile