From 04fd63e6bac91b011c1276f6289b66bf9524ce95 Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Fri, 14 Dec 2018 06:43:31 -0200 Subject: [PATCH] Add build section for mbedTLS config This makes it easier to choose the mbedTLS config file when multiple features share files. Signed-off-by: Fabio Utzig --- sim/mcuboot-sys/build.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sim/mcuboot-sys/build.rs b/sim/mcuboot-sys/build.rs index ea958f6a..58b65692 100644 --- a/sim/mcuboot-sys/build.rs +++ b/sim/mcuboot-sys/build.rs @@ -35,7 +35,6 @@ fn main() { conf.define("MCUBOOT_SIGN_RSA", None); conf.define("MCUBOOT_USE_MBED_TLS", None); - conf.define("MBEDTLS_CONFIG_FILE", Some("")); conf.include("mbedtls/include"); conf.file("mbedtls/library/sha256.c"); conf.file("csupport/keys.c"); @@ -49,7 +48,6 @@ fn main() { conf.define("MCUBOOT_SIGN_EC256", None); conf.define("MCUBOOT_USE_TINYCRYPT", None); - conf.define("MBEDTLS_CONFIG_FILE", Some("")); conf.include("../../ext/mbedtls/include"); conf.include("../../ext/tinycrypt/lib/include"); @@ -79,7 +77,6 @@ fn main() { conf.define("MCUBOOT_ENCRYPT_RSA", None); conf.define("MCUBOOT_ENC_IMAGES", None); conf.define("MCUBOOT_USE_MBED_TLS", None); - conf.define("MBEDTLS_CONFIG_FILE", Some("")); conf.file("../../boot/bootutil/src/encrypted.c"); conf.file("csupport/keys.c"); @@ -102,7 +99,6 @@ fn main() { conf.define("MCUBOOT_ENCRYPT_KW", None); conf.define("MCUBOOT_ENC_IMAGES", None); conf.define("MCUBOOT_USE_MBED_TLS", None); - conf.define("MBEDTLS_CONFIG_FILE", Some("")); conf.file("../../boot/bootutil/src/encrypted.c"); conf.file("csupport/keys.c"); @@ -118,6 +114,14 @@ fn main() { conf.file("mbedtls/library/aes.c"); } + if sig_rsa || enc_rsa { + conf.define("MBEDTLS_CONFIG_FILE", Some("")); + } else if sig_ecdsa { + conf.define("MBEDTLS_CONFIG_FILE", Some("")); + } else if enc_kw { + conf.define("MBEDTLS_CONFIG_FILE", Some("")); + } + conf.file("../../boot/bootutil/src/image_validate.c"); if sig_rsa { conf.file("../../boot/bootutil/src/image_rsa.c");