Skip to content

Commit 3726828

Browse files
authored
Merge pull request #11435 from Patater/update-to-mbedtls-2.19.0d2
Update to Mbed TLS 2.19.0 and Mbed Crypto 2.0.0
2 parents 5cbede4 + ea834eb commit 3726828

32 files changed

+827
-142
lines changed

features/mbedtls/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
mbedtls-2.19.0d0
1+
mbedtls-2.19.0

features/mbedtls/importer/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#
2828

2929
# Set the mbed TLS release to import (this can/should be edited before import)
30-
MBED_TLS_RELEASE ?= mbedtls-2.19.0d0
30+
MBED_TLS_RELEASE ?= mbedtls-2.19.0
3131
MBED_TLS_REPO_URL ?= [email protected]:ARMmbed/mbedtls-restricted.git
3232

3333
# Translate between mbed TLS namespace and mbed namespace

features/mbedtls/inc/mbedtls/check_config.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,16 @@
130130
#error "MBEDTLS_ECP_RESTARTABLE defined, but not MBEDTLS_ECDH_LEGACY_CONTEXT"
131131
#endif
132132

133+
#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED) && \
134+
defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
135+
#error "MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED defined, but MBEDTLS_ECDH_LEGACY_CONTEXT not disabled"
136+
#endif
137+
133138
#if defined(MBEDTLS_ECDSA_DETERMINISTIC) && !defined(MBEDTLS_HMAC_DRBG_C)
134139
#error "MBEDTLS_ECDSA_DETERMINISTIC defined, but not all prerequisites"
135140
#endif
136141

137-
#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \
142+
#if defined(MBEDTLS_ECP_C) && ( !defined(MBEDTLS_BIGNUM_C) || ( \
138143
!defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) && \
139144
!defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) && \
140145
!defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && \
@@ -145,7 +150,9 @@
145150
!defined(MBEDTLS_ECP_DP_BP512R1_ENABLED) && \
146151
!defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) && \
147152
!defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED) && \
148-
!defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) ) )
153+
!defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED) && \
154+
!defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && \
155+
!defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) ) )
149156
#error "MBEDTLS_ECP_C defined, but not all prerequisites"
150157
#endif
151158

features/mbedtls/inc/mbedtls/config.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3592,6 +3592,15 @@
35923592
*/
35933593
//#define MBEDTLS_PLATFORM_GMTIME_R_ALT
35943594

3595+
/**
3596+
* Enable the verified implementations of ECDH primitives from Project Everest
3597+
* (currently only Curve25519). This feature changes the layout of ECDH
3598+
* contexts and therefore is a compatibility break for applications that access
3599+
* fields of a mbedtls_ecdh_context structure directly. See also
3600+
* MBEDTLS_ECDH_LEGACY_CONTEXT in include/mbedtls/ecdh.h.
3601+
*/
3602+
//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
3603+
35953604
/* \} name SECTION: Customisation configuration options */
35963605

35973606
/* Target and application specific configurations

features/mbedtls/inc/mbedtls/net_sockets.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ int mbedtls_net_send( void *ctx, const unsigned char *buf, size_t len );
257257
int mbedtls_net_recv_timeout( void *ctx, unsigned char *buf, size_t len,
258258
uint32_t timeout );
259259

260+
/**
261+
* \brief Closes down the connection and free associated data
262+
*
263+
* \param ctx The context to close
264+
*/
265+
void mbedtls_net_close( mbedtls_net_context *ctx );
266+
260267
/**
261268
* \brief Gracefully shutdown the connection and free associated data
262269
*

features/mbedtls/inc/mbedtls/version.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@
3939
* Major, Minor, Patchlevel
4040
*/
4141
#define MBEDTLS_VERSION_MAJOR 2
42-
#define MBEDTLS_VERSION_MINOR 18
42+
#define MBEDTLS_VERSION_MINOR 19
4343
#define MBEDTLS_VERSION_PATCH 0
4444

4545
/**
4646
* The single version number has the following structure:
4747
* MMNNPP00
4848
* Major version | Minor version | Patch version
4949
*/
50-
#define MBEDTLS_VERSION_NUMBER 0x02120000
51-
#define MBEDTLS_VERSION_STRING "2.18.0"
52-
#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.18.0"
50+
#define MBEDTLS_VERSION_NUMBER 0x02130000
51+
#define MBEDTLS_VERSION_STRING "2.19.0"
52+
#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.19.0"
5353

5454
#if defined(MBEDTLS_VERSION_C)
5555

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
mbedcrypto-2.0.0d1
1+
mbedcrypto-2.0.0

features/mbedtls/mbed-crypto/importer/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
# Set the Mbed Crypto release to import (this can/should be edited before
3131
# import)
32-
CRYPTO_RELEASE ?= mbedcrypto-2.0.0d1
33-
CRYPTO_REPO_URL ?= [email protected]:ARMmbed/mbed-crypto.git
32+
CRYPTO_RELEASE ?= mbedcrypto-2.0.0
33+
CRYPTO_REPO_URL ?= [email protected]:ARMmbed/mbedtls-psa.git
3434

3535
# Translate between Mbed Crypto namespace and Mbed OS namespace
3636
TARGET_PREFIX:=..

features/mbedtls/mbed-crypto/inc/mbedtls/bignum.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@
129129
defined(__ppc64__) || defined(__powerpc64__) || \
130130
defined(__ia64__) || defined(__alpha__) || \
131131
( defined(__sparc__) && defined(__arch64__) ) || \
132-
defined(__s390x__) || defined(__mips64) )
132+
defined(__s390x__) || defined(__mips64) || \
133+
defined(__aarch64__) )
133134
#if !defined(MBEDTLS_HAVE_INT64)
134135
#define MBEDTLS_HAVE_INT64
135136
#endif /* MBEDTLS_HAVE_INT64 */

features/mbedtls/mbed-crypto/inc/mbedtls/bn_mul.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,30 @@
198198

199199
#endif /* AMD64 */
200200

201+
#if defined(__aarch64__)
202+
203+
#define MULADDC_INIT \
204+
asm(
205+
206+
#define MULADDC_CORE \
207+
"ldr x4, [%2], #8 \n\t" \
208+
"ldr x5, [%1] \n\t" \
209+
"mul x6, x4, %3 \n\t" \
210+
"umulh x7, x4, %3 \n\t" \
211+
"adds x5, x5, x6 \n\t" \
212+
"adc x7, x7, xzr \n\t" \
213+
"adds x5, x5, %0 \n\t" \
214+
"adc %0, x7, xzr \n\t" \
215+
"str x5, [%1], #8 \n\t"
216+
217+
#define MULADDC_STOP \
218+
: "+r" (c), "+r" (d), "+r" (s) \
219+
: "r" (b) \
220+
: "x4", "x5", "x6", "x7", "cc" \
221+
);
222+
223+
#endif /* Aarch64 */
224+
201225
#if defined(__mc68020__) || defined(__mcpu32__)
202226

203227
#define MULADDC_INIT \

0 commit comments

Comments
 (0)