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 <utzig@apache.org>
This commit is contained in:
Fabio Utzig 2018-12-14 06:43:31 -02:00 committed by Fabio Utzig
parent 754438dfd5
commit 04fd63e6ba
1 changed files with 8 additions and 4 deletions

View File

@ -35,7 +35,6 @@ fn main() {
conf.define("MCUBOOT_SIGN_RSA", None); conf.define("MCUBOOT_SIGN_RSA", None);
conf.define("MCUBOOT_USE_MBED_TLS", None); conf.define("MCUBOOT_USE_MBED_TLS", None);
conf.define("MBEDTLS_CONFIG_FILE", Some("<config-rsa.h>"));
conf.include("mbedtls/include"); conf.include("mbedtls/include");
conf.file("mbedtls/library/sha256.c"); conf.file("mbedtls/library/sha256.c");
conf.file("csupport/keys.c"); conf.file("csupport/keys.c");
@ -49,7 +48,6 @@ fn main() {
conf.define("MCUBOOT_SIGN_EC256", None); conf.define("MCUBOOT_SIGN_EC256", None);
conf.define("MCUBOOT_USE_TINYCRYPT", None); conf.define("MCUBOOT_USE_TINYCRYPT", None);
conf.define("MBEDTLS_CONFIG_FILE", Some("<config-asn1.h>"));
conf.include("../../ext/mbedtls/include"); conf.include("../../ext/mbedtls/include");
conf.include("../../ext/tinycrypt/lib/include"); conf.include("../../ext/tinycrypt/lib/include");
@ -79,7 +77,6 @@ fn main() {
conf.define("MCUBOOT_ENCRYPT_RSA", None); conf.define("MCUBOOT_ENCRYPT_RSA", None);
conf.define("MCUBOOT_ENC_IMAGES", None); conf.define("MCUBOOT_ENC_IMAGES", None);
conf.define("MCUBOOT_USE_MBED_TLS", None); conf.define("MCUBOOT_USE_MBED_TLS", None);
conf.define("MBEDTLS_CONFIG_FILE", Some("<config-rsa.h>"));
conf.file("../../boot/bootutil/src/encrypted.c"); conf.file("../../boot/bootutil/src/encrypted.c");
conf.file("csupport/keys.c"); conf.file("csupport/keys.c");
@ -102,7 +99,6 @@ fn main() {
conf.define("MCUBOOT_ENCRYPT_KW", None); conf.define("MCUBOOT_ENCRYPT_KW", None);
conf.define("MCUBOOT_ENC_IMAGES", None); conf.define("MCUBOOT_ENC_IMAGES", None);
conf.define("MCUBOOT_USE_MBED_TLS", None); conf.define("MCUBOOT_USE_MBED_TLS", None);
conf.define("MBEDTLS_CONFIG_FILE", Some("<config-kw.h>"));
conf.file("../../boot/bootutil/src/encrypted.c"); conf.file("../../boot/bootutil/src/encrypted.c");
conf.file("csupport/keys.c"); conf.file("csupport/keys.c");
@ -118,6 +114,14 @@ fn main() {
conf.file("mbedtls/library/aes.c"); conf.file("mbedtls/library/aes.c");
} }
if sig_rsa || enc_rsa {
conf.define("MBEDTLS_CONFIG_FILE", Some("<config-rsa.h>"));
} else if sig_ecdsa {
conf.define("MBEDTLS_CONFIG_FILE", Some("<config-asn1.h>"));
} else if enc_kw {
conf.define("MBEDTLS_CONFIG_FILE", Some("<config-kw.h>"));
}
conf.file("../../boot/bootutil/src/image_validate.c"); conf.file("../../boot/bootutil/src/image_validate.c");
if sig_rsa { if sig_rsa {
conf.file("../../boot/bootutil/src/image_rsa.c"); conf.file("../../boot/bootutil/src/image_rsa.c");