Skip to content

Commit a25e2b7

Browse files
Vge0rgetomi-font
authored andcommitted
[nrf toup] crypto: Update includes for mbedTLS > 4
The MBEDTLS_VERSION_NUMBER is defined in mbedtls/build_info.h from mbedTLS version >= 4 so adapt to the change. Also ecp.h now lives inside the TF-PSA-Crypto repo, and they chaged the path add a private prefix, so adapt to that as well. Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
1 parent ea85da9 commit a25e2b7

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

src/crypto/CHIPCryptoPALPSA.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,14 @@
3535

3636
#include <psa/crypto.h>
3737

38+
#if (MBEDTLS_VERSION_NUMBER >= 0x04000000)
39+
#include <mbedtls/private/bignum.h>
40+
#include <mbedtls/private/ecp.h>
41+
#else
3842
#include <mbedtls/bignum.h>
3943
#include <mbedtls/ecp.h>
44+
#endif
45+
4046
#include <mbedtls/error.h>
4147
#include <mbedtls/x509_csr.h>
4248

src/crypto/CHIPCryptoPALmbedTLS.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@
1919

2020
#include <lib/support/logging/CHIPLogging.h>
2121

22-
#include <mbedtls/ecp.h>
22+
#include <mbedtls/build_info.h>
2323
#include <mbedtls/error.h>
24-
#include <mbedtls/version.h>
24+
25+
#if (MBEDTLS_VERSION_NUMBER >= 0x04000000)
26+
#include <mbedtls/private/ecp.h>
27+
#else
28+
#include <mbedtls/ecp.h>
29+
#endif
2530

2631
namespace chip {
2732
namespace Crypto {

src/crypto/CHIPCryptoPALmbedTLSCert.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@
2828
#include <lib/support/CodeUtils.h>
2929
#include <lib/support/SafeInt.h>
3030

31-
#include <mbedtls/ecp.h>
3231
#include <mbedtls/oid.h>
32+
33+
#if (MBEDTLS_VERSION_NUMBER >= 0x04000000)
34+
#include <mbedtls/private/ecp.h>
35+
#else
36+
#include <mbedtls/ecp.h>
37+
#endif
38+
3339
#include <mbedtls/x509.h>
3440
#include <mbedtls/x509_csr.h>
3541

0 commit comments

Comments
 (0)