Skip to content

Commit c99b701

Browse files
committed
mbedtls: Move local mbedtls to v3.6.0
The in-tree mbedtls (used for the simulator and some targets) is a few years old, and currently is unable to pass the rsa tests when built with clang. Update this mbed TLS to the v3.6.0 release. This fixes clang support in the simulator. There are a few minor changes to configuration and what files are needed to support newer version of Mbed TLS. Fixes #1986 Signed-off-by: David Brown <[email protected]>
1 parent a28a932 commit c99b701

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

ext/mbedtls

sim/mcuboot-sys/build.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ fn main() {
108108
conf.file("../../ext/mbedtls/library/chachapoly.c");
109109
conf.file("../../ext/mbedtls/library/cipher.c");
110110
conf.file("../../ext/mbedtls/library/cipher_wrap.c");
111+
conf.file("../../ext/mbedtls/library/constant_time.c");
111112
conf.file("../../ext/mbedtls/library/ctr_drbg.c");
112113
conf.file("../../ext/mbedtls/library/des.c");
113114
conf.file("../../ext/mbedtls/library/ecdsa.c");
@@ -130,14 +131,14 @@ fn main() {
130131
conf.file("../../ext/mbedtls/library/psa_crypto.c");
131132
conf.file("../../ext/mbedtls/library/psa_crypto_cipher.c");
132133
conf.file("../../ext/mbedtls/library/psa_crypto_client.c");
133-
conf.file("../../ext/mbedtls/library/psa_crypto_driver_wrappers.c");
134134
conf.file("../../ext/mbedtls/library/psa_crypto_ecp.c");
135135
conf.file("../../ext/mbedtls/library/psa_crypto_hash.c");
136136
conf.file("../../ext/mbedtls/library/psa_crypto_mac.c");
137137
conf.file("../../ext/mbedtls/library/psa_crypto_rsa.c");
138138
conf.file("../../ext/mbedtls/library/psa_crypto_slot_management.c");
139139
conf.file("../../ext/mbedtls/library/psa_crypto_storage.c");
140140
conf.file("../../ext/mbedtls/library/psa_its_file.c");
141+
conf.file("../../ext/mbedtls/library/psa_util.c");
141142
conf.file("../../ext/mbedtls/library/ripemd160.c");
142143
conf.file("../../ext/mbedtls/library/rsa_alt_helpers.c");
143144
conf.file("../../ext/mbedtls/library/sha1.c");
@@ -169,6 +170,9 @@ fn main() {
169170

170171
conf.file("../../ext/mbedtls/library/rsa.c");
171172
conf.file("../../ext/mbedtls/library/bignum.c");
173+
conf.file("../../ext/mbedtls/library/bignum_core.c");
174+
conf.file("../../ext/mbedtls/library/constant_time.c");
175+
conf.file("../../ext/mbedtls/library/nist_kw.c");
172176
conf.file("../../ext/mbedtls/library/platform.c");
173177
conf.file("../../ext/mbedtls/library/platform_util.c");
174178
conf.file("../../ext/mbedtls/library/asn1parse.c");
@@ -202,6 +206,9 @@ fn main() {
202206

203207
conf.file("../../ext/mbedtls/library/asn1parse.c");
204208
conf.file("../../ext/mbedtls/library/bignum.c");
209+
conf.file("../../ext/mbedtls/library/bignum_core.c");
210+
conf.file("../../ext/mbedtls/library/constant_time.c");
211+
conf.file("../../ext/mbedtls/library/nist_kw.c");
205212
conf.file("../../ext/mbedtls/library/ecdsa.c");
206213
conf.file("../../ext/mbedtls/library/ecp.c");
207214
conf.file("../../ext/mbedtls/library/ecp_curves.c");
@@ -221,6 +228,9 @@ fn main() {
221228
conf.file("csupport/keys.c");
222229
conf.file("../../ext/mbedtls/library/asn1parse.c");
223230
conf.file("../../ext/mbedtls/library/bignum.c");
231+
conf.file("../../ext/mbedtls/library/bignum_core.c");
232+
conf.file("../../ext/mbedtls/library/constant_time.c");
233+
conf.file("../../ext/mbedtls/library/nist_kw.c");
224234
conf.file("../../ext/mbedtls/library/ecp.c");
225235
conf.file("../../ext/mbedtls/library/ecp_curves.c");
226236
conf.file("../../ext/mbedtls/library/platform.c");
@@ -282,6 +292,9 @@ fn main() {
282292
conf.file("../../ext/mbedtls/library/md.c");
283293
conf.file("../../ext/mbedtls/library/aes.c");
284294
conf.file("../../ext/mbedtls/library/bignum.c");
295+
conf.file("../../ext/mbedtls/library/bignum_core.c");
296+
conf.file("../../ext/mbedtls/library/constant_time.c");
297+
conf.file("../../ext/mbedtls/library/nist_kw.c");
285298
conf.file("../../ext/mbedtls/library/asn1parse.c");
286299
}
287300

@@ -305,6 +318,7 @@ fn main() {
305318
conf.conf.include("../../ext/mbedtls/library");
306319
conf.file("../../ext/mbedtls/library/platform_util.c");
307320
conf.file("../../ext/mbedtls/library/nist_kw.c");
321+
conf.file("../../ext/mbedtls/library/constant_time.c");
308322
conf.file("../../ext/mbedtls/library/cipher.c");
309323
conf.file("../../ext/mbedtls/library/cipher_wrap.c");
310324
conf.file("../../ext/mbedtls/library/aes.c");
@@ -369,6 +383,9 @@ fn main() {
369383
conf.file("../../ext/mbedtls/library/sha256.c");
370384
conf.file("../../ext/mbedtls/library/asn1parse.c");
371385
conf.file("../../ext/mbedtls/library/bignum.c");
386+
conf.file("../../ext/mbedtls/library/bignum_core.c");
387+
conf.file("../../ext/mbedtls/library/constant_time.c");
388+
conf.file("../../ext/mbedtls/library/nist_kw.c");
372389
conf.file("../../ext/mbedtls/library/ecdh.c");
373390
conf.file("../../ext/mbedtls/library/md.c");
374391
conf.file("../../ext/mbedtls/library/aes.c");

sim/mcuboot-sys/csupport/config-ec-psa.h

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define MBEDTLS_BIGNUM_C
2323
#define MBEDTLS_MD_C
2424
#define MBEDTLS_OID_C
25+
#define MBEDTLS_CIPHER_C
2526
#if defined(MCUBOOT_SIGN_EC384)
2627
#define MBEDTLS_SHA384_C
2728
#define MBEDTLS_SHA512_C

sim/mcuboot-sys/csupport/config-rsa-kw.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363

6464
/* mbed TLS modules */
6565
#define MBEDTLS_ASN1_PARSE_C
66+
#define MBEDTLS_ASN1_WRITE_C
6667
#define MBEDTLS_BIGNUM_C
6768
#define MBEDTLS_MD_C
6869
#define MBEDTLS_OID_C
@@ -72,10 +73,6 @@
7273
#define MBEDTLS_CIPHER_C
7374
#define MBEDTLS_NIST_KW_C
7475

75-
/* Save RAM by adjusting to our exact needs */
76-
#define MBEDTLS_ECP_MAX_BITS 2048
77-
#define MBEDTLS_MPI_MAX_SIZE 256
78-
7976
#define MBEDTLS_SSL_MAX_CONTENT_LEN 1024
8077

8178
/* Save ROM and a few bytes of RAM by specifying our own ciphersuite list */

0 commit comments

Comments
 (0)