Skip to content

Commit f60e9a8

Browse files
authored
Merge pull request ARMmbed#11476 from ARMmbed/release-candidate
Release candidate for mbed-os-5.14.0-rc2
2 parents 4640441 + fa14b0c commit f60e9a8

File tree

73 files changed

+1687
-562
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1687
-562
lines changed

TESTS/mbedmicro-rtos-mbed/systimer/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
extern "C" {
2424
#include "rtx_lib.h"
2525
}
26-
#include "platform/SysTimer.h"
26+
#include "platform/source/SysTimer.h"
2727

2828
#define TEST_TICKS 42
2929
#define TEST_TICK_US (TEST_TICKS * 1000)

components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "mbed_critical.h"
2020

2121
#include <string.h>
22+
#include <inttypes.h>
2223

2324
#include "mbed_trace.h"
2425
#include "mbed_debug.h"

events/source/equeue_mbed.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ using namespace mbed;
3838
#if MBED_CONF_RTOS_API_PRESENT
3939

4040
#include "rtos/Kernel.h"
41-
#include "platform/mbed_os_timer.h"
41+
#include "platform/source/mbed_os_timer.h"
4242

4343
void equeue_tick_init()
4444
{

features/mbedtls/VERSION.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
mbedtls-2.19.0d0
1+
mbedtls-2.19.0

features/mbedtls/importer/Makefile

+1-1
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 ?= git@github.com:ARMmbed/mbedtls-restricted.git
3232

3333
# Translate between mbed TLS namespace and mbed namespace

features/mbedtls/inc/mbedtls/check_config.h

+9-2
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

+9
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

+7
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

+4-4
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

+1-1
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

+2-2
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 ?= git@github.com:ARMmbed/mbed-crypto.git
32+
CRYPTO_RELEASE ?= mbedcrypto-2.0.0
33+
CRYPTO_REPO_URL ?= git@github.com: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

+2-1
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

+24
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 \

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

+20
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242

4343
#include "mbedtls/ecp.h"
4444

45+
#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
46+
#undef MBEDTLS_ECDH_LEGACY_CONTEXT
47+
#include "everest/everest.h"
48+
#endif
49+
4550
#ifdef __cplusplus
4651
extern "C" {
4752
#endif
@@ -66,6 +71,9 @@ typedef enum
6671
{
6772
MBEDTLS_ECDH_VARIANT_NONE = 0, /*!< Implementation not defined. */
6873
MBEDTLS_ECDH_VARIANT_MBEDTLS_2_0,/*!< The default Mbed TLS implementation */
74+
#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
75+
MBEDTLS_ECDH_VARIANT_EVEREST /*!< Everest implementation */
76+
#endif
6977
} mbedtls_ecdh_variant;
7078

7179
/**
@@ -119,6 +127,9 @@ typedef struct mbedtls_ecdh_context
119127
union
120128
{
121129
mbedtls_ecdh_context_mbed mbed_ecdh;
130+
#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
131+
mbedtls_ecdh_context_everest everest_ecdh;
132+
#endif
122133
} ctx; /*!< Implementation-specific context. The
123134
context in use is specified by the \c var
124135
field. */
@@ -133,6 +144,15 @@ typedef struct mbedtls_ecdh_context
133144
}
134145
mbedtls_ecdh_context;
135146

147+
/**
148+
* \brief Check whether a given group can be used for ECDH.
149+
*
150+
* \param gid The ECP group ID to check.
151+
*
152+
* \return \c 1 if the group can be used, \c 0 otherwise
153+
*/
154+
int mbedtls_ecdh_can_do( mbedtls_ecp_group_id gid );
155+
136156
/**
137157
* \brief This function generates an ECDH keypair on an elliptic
138158
* curve.

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

+80-2
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ typedef void mbedtls_ecdsa_restart_ctx;
125125

126126
#endif /* MBEDTLS_ECP_RESTARTABLE */
127127

128+
/**
129+
* \brief This function checks whether a given group can be used
130+
* for ECDSA.
131+
*
132+
* \param gid The ECP group ID to check.
133+
*
134+
* \return \c 1 if the group can be used, \c 0 otherwise
135+
*/
136+
int mbedtls_ecdsa_can_do( mbedtls_ecp_group_id gid );
137+
128138
/**
129139
* \brief This function computes the ECDSA signature of a
130140
* previously-hashed message.
@@ -166,6 +176,12 @@ int mbedtls_ecdsa_sign( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s,
166176
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
167177

168178
#if defined(MBEDTLS_ECDSA_DETERMINISTIC)
179+
#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
180+
#if defined(MBEDTLS_DEPRECATED_WARNING)
181+
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
182+
#else
183+
#define MBEDTLS_DEPRECATED
184+
#endif
169185
/**
170186
* \brief This function computes the ECDSA signature of a
171187
* previously-hashed message, deterministic version.
@@ -180,6 +196,19 @@ int mbedtls_ecdsa_sign( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s,
180196
* (SECG): SEC1 Elliptic Curve Cryptography</em>, section
181197
* 4.1.3, step 5.
182198
*
199+
* \warning Since the output of the internal RNG is always the same for
200+
* the same key and message, this limits the efficiency of
201+
* blinding and leaks information through side channels. For
202+
* secure behavior use mbedtls_ecdsa_sign_det_ext() instead.
203+
*
204+
* (Optimally the blinding is a random value that is different
205+
* on every execution. In this case the blinding is still
206+
* random from the attackers perspective, but is the same on
207+
* each execution. This means that this blinding does not
208+
* prevent attackers from recovering secrets by combining
209+
* several measurement traces, but may prevent some attacks
210+
* that exploit relationships between secret data.)
211+
*
183212
* \see ecp.h
184213
*
185214
* \param grp The context for the elliptic curve to use.
@@ -204,7 +233,55 @@ int mbedtls_ecdsa_sign( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_mpi *s,
204233
int mbedtls_ecdsa_sign_det( mbedtls_ecp_group *grp, mbedtls_mpi *r,
205234
mbedtls_mpi *s, const mbedtls_mpi *d,
206235
const unsigned char *buf, size_t blen,
207-
mbedtls_md_type_t md_alg );
236+
mbedtls_md_type_t md_alg ) MBEDTLS_DEPRECATED;
237+
#undef MBEDTLS_DEPRECATED
238+
#endif /* MBEDTLS_DEPRECATED_REMOVED */
239+
240+
/**
241+
* \brief This function computes the ECDSA signature of a
242+
* previously-hashed message, deterministic version.
243+
*
244+
* For more information, see <em>RFC-6979: Deterministic
245+
* Usage of the Digital Signature Algorithm (DSA) and Elliptic
246+
* Curve Digital Signature Algorithm (ECDSA)</em>.
247+
*
248+
* \note If the bitlength of the message hash is larger than the
249+
* bitlength of the group order, then the hash is truncated as
250+
* defined in <em>Standards for Efficient Cryptography Group
251+
* (SECG): SEC1 Elliptic Curve Cryptography</em>, section
252+
* 4.1.3, step 5.
253+
*
254+
* \see ecp.h
255+
*
256+
* \param grp The context for the elliptic curve to use.
257+
* This must be initialized and have group parameters
258+
* set, for example through mbedtls_ecp_group_load().
259+
* \param r The MPI context in which to store the first part
260+
* the signature. This must be initialized.
261+
* \param s The MPI context in which to store the second part
262+
* the signature. This must be initialized.
263+
* \param d The private signing key. This must be initialized
264+
* and setup, for example through mbedtls_ecp_gen_privkey().
265+
* \param buf The hashed content to be signed. This must be a readable
266+
* buffer of length \p blen Bytes. It may be \c NULL if
267+
* \p blen is zero.
268+
* \param blen The length of \p buf in Bytes.
269+
* \param md_alg The hash algorithm used to hash the original data.
270+
* \param f_rng_blind The RNG function used for blinding. This must not be
271+
* \c NULL.
272+
* \param p_rng_blind The RNG context to be passed to \p f_rng. This may be
273+
* \c NULL if \p f_rng doesn't need a context parameter.
274+
*
275+
* \return \c 0 on success.
276+
* \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX
277+
* error code on failure.
278+
*/
279+
int mbedtls_ecdsa_sign_det_ext( mbedtls_ecp_group *grp, mbedtls_mpi *r,
280+
mbedtls_mpi *s, const mbedtls_mpi *d,
281+
const unsigned char *buf, size_t blen,
282+
mbedtls_md_type_t md_alg,
283+
int (*f_rng_blind)(void *, unsigned char *, size_t),
284+
void *p_rng_blind );
208285
#endif /* MBEDTLS_ECDSA_DETERMINISTIC */
209286

210287
/**
@@ -283,7 +360,8 @@ int mbedtls_ecdsa_verify( mbedtls_ecp_group *grp,
283360
* the signature written. Must not be \c NULL.
284361
* \param f_rng The RNG function. This must not be \c NULL if
285362
* #MBEDTLS_ECDSA_DETERMINISTIC is unset. Otherwise,
286-
* it is unused and may be set to \c NULL.
363+
* it is used only for blinding and may be set to \c NULL, but
364+
* doing so is DEPRECATED.
287365
* \param p_rng The RNG context to be passed to \p f_rng. This may be
288366
* \c NULL if \p f_rng is \c NULL or doesn't use a context.
289367
*

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

+12
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,12 @@ mbedtls_ecp_curve_type mbedtls_ecp_get_type( const mbedtls_ecp_group *grp );
437437
* mbedtls_ecp_curve_info() for all supported curves in order
438438
* of preference.
439439
*
440+
* \note This function returns information about all curves
441+
* supported by the library. Some curves may not be
442+
* supported for all algorithms. Call mbedtls_ecdh_can_do()
443+
* or mbedtls_ecdsa_can_do() to check if a curve is
444+
* supported for ECDH or ECDSA.
445+
*
440446
* \return A statically allocated array. The last entry is 0.
441447
*/
442448
const mbedtls_ecp_curve_info *mbedtls_ecp_curve_list( void );
@@ -446,6 +452,12 @@ const mbedtls_ecp_curve_info *mbedtls_ecp_curve_list( void );
446452
* identifiers of all supported curves in the order of
447453
* preference.
448454
*
455+
* \note This function returns information about all curves
456+
* supported by the library. Some curves may not be
457+
* supported for all algorithms. Call mbedtls_ecdh_can_do()
458+
* or mbedtls_ecdsa_can_do() to check if a curve is
459+
* supported for ECDH or ECDSA.
460+
*
449461
* \return A statically allocated array,
450462
* terminated with MBEDTLS_ECP_DP_NONE.
451463
*/

0 commit comments

Comments
 (0)