Skip to content

Commit 0eb9c43

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 6cbea0a commit 0eb9c43

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
@@ -109,6 +109,7 @@ fn main() {
109109
conf.file("../../ext/mbedtls/library/chachapoly.c");
110110
conf.file("../../ext/mbedtls/library/cipher.c");
111111
conf.file("../../ext/mbedtls/library/cipher_wrap.c");
112+
conf.file("../../ext/mbedtls/library/constant_time.c");
112113
conf.file("../../ext/mbedtls/library/ctr_drbg.c");
113114
conf.file("../../ext/mbedtls/library/des.c");
114115
conf.file("../../ext/mbedtls/library/ecdsa.c");
@@ -131,14 +132,14 @@ fn main() {
131132
conf.file("../../ext/mbedtls/library/psa_crypto.c");
132133
conf.file("../../ext/mbedtls/library/psa_crypto_cipher.c");
133134
conf.file("../../ext/mbedtls/library/psa_crypto_client.c");
134-
conf.file("../../ext/mbedtls/library/psa_crypto_driver_wrappers.c");
135135
conf.file("../../ext/mbedtls/library/psa_crypto_ecp.c");
136136
conf.file("../../ext/mbedtls/library/psa_crypto_hash.c");
137137
conf.file("../../ext/mbedtls/library/psa_crypto_mac.c");
138138
conf.file("../../ext/mbedtls/library/psa_crypto_rsa.c");
139139
conf.file("../../ext/mbedtls/library/psa_crypto_slot_management.c");
140140
conf.file("../../ext/mbedtls/library/psa_crypto_storage.c");
141141
conf.file("../../ext/mbedtls/library/psa_its_file.c");
142+
conf.file("../../ext/mbedtls/library/psa_util.c");
142143
conf.file("../../ext/mbedtls/library/ripemd160.c");
143144
conf.file("../../ext/mbedtls/library/rsa_alt_helpers.c");
144145
conf.file("../../ext/mbedtls/library/sha1.c");
@@ -170,6 +171,9 @@ fn main() {
170171

171172
conf.file("../../ext/mbedtls/library/rsa.c");
172173
conf.file("../../ext/mbedtls/library/bignum.c");
174+
conf.file("../../ext/mbedtls/library/bignum_core.c");
175+
conf.file("../../ext/mbedtls/library/constant_time.c");
176+
conf.file("../../ext/mbedtls/library/nist_kw.c");
173177
conf.file("../../ext/mbedtls/library/platform.c");
174178
conf.file("../../ext/mbedtls/library/platform_util.c");
175179
conf.file("../../ext/mbedtls/library/asn1parse.c");
@@ -203,6 +207,9 @@ fn main() {
203207

204208
conf.file("../../ext/mbedtls/library/asn1parse.c");
205209
conf.file("../../ext/mbedtls/library/bignum.c");
210+
conf.file("../../ext/mbedtls/library/bignum_core.c");
211+
conf.file("../../ext/mbedtls/library/constant_time.c");
212+
conf.file("../../ext/mbedtls/library/nist_kw.c");
206213
conf.file("../../ext/mbedtls/library/ecdsa.c");
207214
conf.file("../../ext/mbedtls/library/ecp.c");
208215
conf.file("../../ext/mbedtls/library/ecp_curves.c");
@@ -222,6 +229,9 @@ fn main() {
222229
conf.file("csupport/keys.c");
223230
conf.file("../../ext/mbedtls/library/asn1parse.c");
224231
conf.file("../../ext/mbedtls/library/bignum.c");
232+
conf.file("../../ext/mbedtls/library/bignum_core.c");
233+
conf.file("../../ext/mbedtls/library/constant_time.c");
234+
conf.file("../../ext/mbedtls/library/nist_kw.c");
225235
conf.file("../../ext/mbedtls/library/ecp.c");
226236
conf.file("../../ext/mbedtls/library/ecp_curves.c");
227237
conf.file("../../ext/mbedtls/library/platform.c");
@@ -285,6 +295,9 @@ fn main() {
285295
conf.file("../../ext/mbedtls/library/md.c");
286296
conf.file("../../ext/mbedtls/library/aes.c");
287297
conf.file("../../ext/mbedtls/library/bignum.c");
298+
conf.file("../../ext/mbedtls/library/bignum_core.c");
299+
conf.file("../../ext/mbedtls/library/constant_time.c");
300+
conf.file("../../ext/mbedtls/library/nist_kw.c");
288301
conf.file("../../ext/mbedtls/library/asn1parse.c");
289302
}
290303

@@ -308,6 +321,7 @@ fn main() {
308321
conf.conf.include("../../ext/mbedtls/library");
309322
conf.file("../../ext/mbedtls/library/platform_util.c");
310323
conf.file("../../ext/mbedtls/library/nist_kw.c");
324+
conf.file("../../ext/mbedtls/library/constant_time.c");
311325
conf.file("../../ext/mbedtls/library/cipher.c");
312326
conf.file("../../ext/mbedtls/library/cipher_wrap.c");
313327
conf.file("../../ext/mbedtls/library/aes.c");
@@ -372,6 +386,9 @@ fn main() {
372386
conf.file("../../ext/mbedtls/library/sha256.c");
373387
conf.file("../../ext/mbedtls/library/asn1parse.c");
374388
conf.file("../../ext/mbedtls/library/bignum.c");
389+
conf.file("../../ext/mbedtls/library/bignum_core.c");
390+
conf.file("../../ext/mbedtls/library/constant_time.c");
391+
conf.file("../../ext/mbedtls/library/nist_kw.c");
375392
conf.file("../../ext/mbedtls/library/ecdh.c");
376393
conf.file("../../ext/mbedtls/library/md.c");
377394
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)