Skip to content

Commit 295e8c2

Browse files
sigvartmhnvlsianpu
authored andcommitted
[nrf fromlist] boot: bootutil: Simplify check for crypto backends
Upstream PR#460 Adding multiple crypto backends will grow quadraticly. This change will ensure that the growth will be linear and generate less complexity. Signed-off-by: Sigvart Hovland <[email protected]>
1 parent 40ab097 commit 295e8c2

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

boot/bootutil/include/bootutil/sha256.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,11 @@
3131

3232
#include "mcuboot_config/mcuboot_config.h"
3333

34-
#if (defined(MCUBOOT_USE_MBED_TLS) && defined(MCUBOOT_USE_TINYCRYPT))\
35-
||(defined MCUBOOT_USE_MBED_TLS) && defined(MCUBOOT_USE_CC310)\
36-
||(defined(MCUBOOT_USE_TINYCRYPT) && defined(MCUBOOT_USE_CC310))
37-
#error "Cannot define CC310, MBED_TLS and TINYCRYPT"
38-
#endif
39-
40-
#if !defined(MCUBOOT_USE_MBED_TLS) && !defined(MCUBOOT_USE_TINYCRYPT) && !defined(MCUBOOT_USE_CC310)
41-
#error "One of CC310, MBED_TLS or TINYCRYPT must be defined"
34+
#define NUM_CRYPTO_BACKENDS (defined(MCUBOOT_USE_MBED_TLS) +\
35+
defined(MCUBOOT_USE_TINYCRYPT) +\
36+
defined(MCUBOOT_USE_CC310))
37+
#if NUM_CRYPTO_BACKENDS != 1
38+
#error "One crypto backend must be defined either CC310, MBED_TLS or TINYCRYPT"
4239
#endif
4340

4441
#ifdef MCUBOOT_USE_MBED_TLS

0 commit comments

Comments
 (0)