Skip to content

Commit 555036e

Browse files
Mbed TLS 4.x upgrade.
1 parent df88d23 commit 555036e

17 files changed

Lines changed: 1152 additions & 314 deletions

‎examples/platform/silabs/provision/ProvisionCryptoMbed.cpp‎

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
#include <lib/support/CodeUtils.h>
99
#include <mbedtls/asn1.h>
1010
#include <mbedtls/pk.h>
11-
#include <mbedtls/sha256.h>
1211
#include <mbedtls/version.h>
1312
#include <mbedtls/x509_csr.h>
1413
#include <platform/silabs/SilabsConfig.h>
1514

15+
#if MBEDTLS_VERSION_MAJOR >= 4 && !defined(SLI_SI91X_MCU_INTERFACE)
16+
#include <psa/crypto.h>
17+
#endif
18+
1619
#if defined(SL_MBEDTLS_USE_TINYCRYPT) && SL_MBEDTLS_USE_TINYCRYPT
1720
#include <tinycrypt/ecc_dsa.h>
1821
#endif
@@ -51,10 +54,31 @@ struct ScopedCsrContext
5154

5255
#ifndef SLI_SI91X_MCU_INTERFACE
5356
constexpr size_t kSubjectNameLengthMax = 160;
57+
58+
#if MBEDTLS_VERSION_MAJOR < 4
5459
int GetRandom(void *, unsigned char * output, size_t size)
5560
{
5661
return chip::Crypto::DRBG_get_bytes(output, size) == CHIP_NO_ERROR ? 0 : -1;
5762
}
63+
#else
64+
CHIP_ERROR GenerateKeyPair(mbedtls_pk_context & key)
65+
{
66+
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
67+
psa_set_key_type(&attributes, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
68+
psa_set_key_bits(&attributes, 256);
69+
psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
70+
71+
psa_key_id_t keyId = PSA_KEY_ID_NULL;
72+
const psa_status_t status = psa_generate_key(&attributes, &keyId);
73+
psa_reset_key_attributes(&attributes);
74+
VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL);
75+
76+
// The PK context holds an independent copy of the key material, so the PSA key can be destroyed right away.
77+
const int error = mbedtls_pk_copy_from_psa(keyId, &key);
78+
psa_destroy_key(keyId);
79+
return error == 0 ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL;
80+
}
81+
#endif // MBEDTLS_VERSION_MAJOR < 4
5882

5983
CHIP_ERROR FormatMatterOidUtf8DerHex(char * destination, size_t destinationSize, uint16_t value)
6084
{
@@ -208,16 +232,25 @@ CHIP_ERROR ProvisionCrypto::GenerateDeviceAttestationCSR(uint16_t vid, uint16_t
208232
ScopedPkContext key;
209233
ScopedCsrContext csrWriter;
210234

235+
#if MBEDTLS_VERSION_MAJOR >= 4
236+
ReturnErrorOnFailure(GenerateKeyPair(key.context));
237+
#else
211238
VerifyOrReturnError(mbedtls_pk_setup(&key.context, mbedtls_pk_info_from_type(MBEDTLS_PK_ECKEY)) == 0, CHIP_ERROR_INTERNAL);
212239
VerifyOrReturnError(mbedtls_ecdsa_genkey(mbedtls_pk_ec(key.context), MBEDTLS_ECP_DP_SECP256R1, GetRandom, nullptr) == 0,
213240
CHIP_ERROR_INTERNAL);
241+
#endif
214242
VerifyOrReturnError(mbedtls_x509write_csr_set_subject_name(&csrWriter.context, subjectName) == 0, CHIP_ERROR_INTERNAL);
215243
mbedtls_x509write_csr_set_md_alg(&csrWriter.context, MBEDTLS_MD_SHA256);
216244

217245
mbedtls_x509write_csr_set_key(&csrWriter.context, &key.context);
246+
#if MBEDTLS_VERSION_MAJOR >= 4
247+
VerifyOrReturnError(mbedtls_x509write_csr_pem(&csrWriter.context, reinterpret_cast<uint8_t *>(csr.data()), csr.size()) == 0,
248+
CHIP_ERROR_INTERNAL);
249+
#else
218250
VerifyOrReturnError(
219251
mbedtls_x509write_csr_pem(&csrWriter.context, reinterpret_cast<uint8_t *>(csr.data()), csr.size(), GetRandom, nullptr) == 0,
220252
CHIP_ERROR_INTERNAL);
253+
#endif
221254
csr.reduce_size(strlen(csr.data()) + 1);
222255

223256
uint8_t encodedKey[kDeviceAttestationKeySizeMax] = { 0 };
@@ -241,23 +274,31 @@ CHIP_ERROR ProvisionCrypto::SignWithDeviceAttestationKey(const ByteSpan & messag
241274
VerifyOrReturnError(signature.size() >= 64, CHIP_ERROR_BUFFER_TOO_SMALL);
242275

243276
uint8_t hash[chip::Crypto::kSHA256_Hash_Length] = { 0 };
244-
VerifyOrReturnError(mbedtls_sha256(message.data(), message.size(), hash, 0) == 0, CHIP_ERROR_INTERNAL);
277+
ReturnErrorOnFailure(chip::Crypto::Hash_SHA256(message.data(), message.size(), hash));
245278
VerifyOrReturnError(uECC_sign(privateKey, hash, sizeof(hash), signature.data()) == UECC_SUCCESS, CHIP_ERROR_INTERNAL);
246279
signature.reduce_size(64);
247280
return CHIP_NO_ERROR;
248281
#else
249282
uint8_t hash[chip::Crypto::kSHA256_Hash_Length] = { 0 };
250283
uint8_t encodedSignature[chip::Crypto::kMax_ECDSA_Signature_Length] = { 0 };
251284
size_t encodedSignatureSize = 0;
252-
VerifyOrReturnError(mbedtls_sha256(message.data(), message.size(), hash, 0) == 0, CHIP_ERROR_INTERNAL);
285+
ReturnErrorOnFailure(chip::Crypto::Hash_SHA256(message.data(), message.size(), hash));
253286

254287
ScopedPkContext key;
288+
#if MBEDTLS_VERSION_MAJOR >= 4
289+
VerifyOrReturnError(mbedtls_pk_parse_key(&key.context, encodedKeySpan.data(), encodedKeySpan.size(), nullptr, 0) == 0,
290+
CHIP_ERROR_INTERNAL);
291+
VerifyOrReturnError(mbedtls_pk_sign(&key.context, MBEDTLS_MD_SHA256, hash, sizeof(hash), encodedSignature,
292+
sizeof(encodedSignature), &encodedSignatureSize) == 0,
293+
CHIP_ERROR_INTERNAL);
294+
#else
255295
VerifyOrReturnError(
256296
mbedtls_pk_parse_key(&key.context, encodedKeySpan.data(), encodedKeySpan.size(), nullptr, 0, GetRandom, nullptr) == 0,
257297
CHIP_ERROR_INTERNAL);
258298
VerifyOrReturnError(mbedtls_pk_sign(&key.context, MBEDTLS_MD_SHA256, hash, sizeof(hash), encodedSignature,
259299
sizeof(encodedSignature), &encodedSignatureSize, GetRandom, nullptr) == 0,
260300
CHIP_ERROR_INTERNAL);
301+
#endif
261302
return ConvertAsn1Signature(ByteSpan(encodedSignature, encodedSignatureSize), signature);
262303
#endif
263304
}

‎src/platform/silabs/SiWx/CHIPCryptoPALTinyCrypt.cpp‎

Lines changed: 161 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,40 @@
2525

2626
#include <type_traits>
2727

28+
#include <mbedtls/version.h>
29+
#if (MBEDTLS_VERSION_NUMBER >= 0x04000000)
30+
// mbedTLS 4 / TF-PSA-Crypto gates legacy crypto APIs behind this macro.
31+
// Must be set before including md.h and private/* headers.
32+
#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
33+
#endif
34+
35+
#include <mbedtls/error.h>
36+
#include <mbedtls/md.h>
37+
#include <mbedtls/pk.h>
38+
#include <mbedtls/platform_util.h>
39+
#if (MBEDTLS_VERSION_NUMBER >= 0x04000000)
40+
#include <mbedtls/private/bignum.h>
41+
#include <mbedtls/private/ccm.h>
42+
#include <mbedtls/private/ctr_drbg.h>
43+
#include <mbedtls/private/ecdsa.h>
44+
#include <mbedtls/private/ecp.h>
45+
#include <mbedtls/private/entropy.h>
46+
#include <mbedtls/private/pkcs5.h>
47+
#include <mbedtls/private/sha1.h>
48+
#include <mbedtls/private/sha256.h>
49+
#else
2850
#include <mbedtls/bignum.h>
2951
#include <mbedtls/ccm.h>
3052
#include <mbedtls/ctr_drbg.h>
3153
#include <mbedtls/ecdh.h>
3254
#include <mbedtls/ecdsa.h>
3355
#include <mbedtls/ecp.h>
3456
#include <mbedtls/entropy.h>
35-
#include <mbedtls/error.h>
3657
#include <mbedtls/hkdf.h>
37-
#include <mbedtls/md.h>
38-
#include <mbedtls/pk.h>
3958
#include <mbedtls/pkcs5.h>
4059
#include <mbedtls/sha1.h>
4160
#include <mbedtls/sha256.h>
61+
#endif // (MBEDTLS_VERSION_NUMBER >= 0x04000000)
4262
#if defined(MBEDTLS_X509_CRT_PARSE_C)
4363
#include <mbedtls/x509_crt.h>
4464
#endif // defined(MBEDTLS_X509_CRT_PARSE_C)
@@ -348,6 +368,98 @@ CHIP_ERROR HKDF_sha::HKDF_SHA256(const uint8_t * secret, const size_t secret_len
348368
VerifyOrReturnError(out_length > 0, CHIP_ERROR_INVALID_ARGUMENT);
349369
VerifyOrReturnError(out_buffer != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
350370

371+
#if (MBEDTLS_VERSION_NUMBER >= 0x04000000)
372+
// mbedtls_hkdf was removed in mbedTLS 4; implement HKDF-Extract/Expand with HMAC-SHA256.
373+
CHIP_ERROR error = CHIP_NO_ERROR;
374+
const mbedtls_md_info_t * const md = mbedtls_md_info_from_type(MBEDTLS_MD_SHA256);
375+
VerifyOrReturnError(md != nullptr, CHIP_ERROR_INTERNAL);
376+
377+
uint8_t prk[NUM_BYTES_IN_SHA256_HASH];
378+
uint8_t t[NUM_BYTES_IN_SHA256_HASH];
379+
uint8_t empty_salt[NUM_BYTES_IN_SHA256_HASH] = { 0 };
380+
const uint8_t * const salt_ptr = (salt_length > 0) ? salt : empty_salt;
381+
const size_t salt_len = (salt_length > 0) ? salt_length : sizeof(empty_salt);
382+
383+
int result = mbedtls_md_hmac(md, Uint8::to_const_uchar(salt_ptr), salt_len, Uint8::to_const_uchar(secret), secret_length, prk);
384+
VerifyOrReturnError(result == 0, CHIP_ERROR_INTERNAL);
385+
386+
mbedtls_md_context_t ctx;
387+
mbedtls_md_init(&ctx);
388+
// mbedTLS 4 rejects hmac=1 in mbedtls_md_setup(); HMAC needs a separate setup.
389+
result = mbedtls_md_setup(&ctx, md, /*hmac=*/0);
390+
if (result != 0)
391+
{
392+
error = CHIP_ERROR_INTERNAL;
393+
goto exit;
394+
}
395+
result = mbedtls_md_hmac_setup(&ctx, md);
396+
if (result != 0)
397+
{
398+
error = CHIP_ERROR_INTERNAL;
399+
goto exit;
400+
}
401+
402+
{
403+
size_t done = 0;
404+
size_t t_len = 0;
405+
uint8_t counter = 1;
406+
407+
while (done < out_length)
408+
{
409+
result = mbedtls_md_hmac_starts(&ctx, prk, sizeof(prk));
410+
if (result != 0)
411+
{
412+
error = CHIP_ERROR_INTERNAL;
413+
goto exit;
414+
}
415+
if (t_len > 0)
416+
{
417+
result = mbedtls_md_hmac_update(&ctx, t, t_len);
418+
if (result != 0)
419+
{
420+
error = CHIP_ERROR_INTERNAL;
421+
goto exit;
422+
}
423+
}
424+
result = mbedtls_md_hmac_update(&ctx, Uint8::to_const_uchar(info), info_length);
425+
if (result != 0)
426+
{
427+
error = CHIP_ERROR_INTERNAL;
428+
goto exit;
429+
}
430+
result = mbedtls_md_hmac_update(&ctx, &counter, 1);
431+
if (result != 0)
432+
{
433+
error = CHIP_ERROR_INTERNAL;
434+
goto exit;
435+
}
436+
result = mbedtls_md_hmac_finish(&ctx, t);
437+
if (result != 0)
438+
{
439+
error = CHIP_ERROR_INTERNAL;
440+
goto exit;
441+
}
442+
t_len = sizeof(t);
443+
444+
const size_t to_copy = (out_length - done > t_len) ? t_len : (out_length - done);
445+
memcpy(out_buffer + done, t, to_copy);
446+
done += to_copy;
447+
counter++;
448+
if (counter == 0)
449+
{
450+
error = CHIP_ERROR_INTERNAL;
451+
goto exit;
452+
}
453+
}
454+
}
455+
456+
exit:
457+
_log_mbedTLS_error(result);
458+
mbedtls_md_free(&ctx);
459+
mbedtls_platform_zeroize(prk, sizeof(prk));
460+
mbedtls_platform_zeroize(t, sizeof(t));
461+
return error;
462+
#else
351463
const mbedtls_md_info_t * const md = mbedtls_md_info_from_type(MBEDTLS_MD_SHA256);
352464
VerifyOrReturnError(md != nullptr, CHIP_ERROR_INTERNAL);
353465

@@ -357,6 +469,7 @@ CHIP_ERROR HKDF_sha::HKDF_SHA256(const uint8_t * secret, const size_t secret_len
357469
VerifyOrReturnError(result == 0, CHIP_ERROR_INTERNAL);
358470

359471
return CHIP_NO_ERROR;
472+
#endif // (MBEDTLS_VERSION_NUMBER >= 0x04000000)
360473
}
361474

362475
CHIP_ERROR HMAC_sha::HMAC_SHA256(const uint8_t * key, size_t key_length, const uint8_t * message, size_t message_length,
@@ -393,11 +506,12 @@ CHIP_ERROR PBKDF2_sha256::pbkdf2_sha256(const uint8_t * password, size_t plen, c
393506
{
394507
CHIP_ERROR error = CHIP_NO_ERROR;
395508
int result = 0;
509+
#if (MBEDTLS_VERSION_NUMBER < 0x04000000) && (!defined(MBEDTLS_DEPRECATED_REMOVED) || MBEDTLS_VERSION_NUMBER < 0x03030000)
396510
const mbedtls_md_info_t * md_info;
397511
mbedtls_md_context_t md_ctxt;
398512
constexpr int use_hmac = 1;
399-
400-
bool free_md_ctxt = false;
513+
bool free_md_ctxt = false;
514+
#endif
401515

402516
VerifyOrExit(password != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT);
403517
VerifyOrExit(plen > 0, error = CHIP_ERROR_INVALID_ARGUMENT);
@@ -407,6 +521,7 @@ CHIP_ERROR PBKDF2_sha256::pbkdf2_sha256(const uint8_t * password, size_t plen, c
407521
VerifyOrExit(key_length > 0, error = CHIP_ERROR_INVALID_ARGUMENT);
408522
VerifyOrExit(output != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT);
409523

524+
#if (MBEDTLS_VERSION_NUMBER < 0x04000000) && (!defined(MBEDTLS_DEPRECATED_REMOVED) || MBEDTLS_VERSION_NUMBER < 0x03030000)
410525
md_info = mbedtls_md_info_from_type(MBEDTLS_MD_SHA256);
411526
VerifyOrExit(md_info != nullptr, error = CHIP_ERROR_INTERNAL);
412527

@@ -418,16 +533,22 @@ CHIP_ERROR PBKDF2_sha256::pbkdf2_sha256(const uint8_t * password, size_t plen, c
418533

419534
result = mbedtls_pkcs5_pbkdf2_hmac(&md_ctxt, Uint8::to_const_uchar(password), plen, Uint8::to_const_uchar(salt), slen,
420535
iteration_count, key_length, Uint8::to_uchar(output));
536+
#else
537+
result = mbedtls_pkcs5_pbkdf2_hmac_ext(MBEDTLS_MD_SHA256, Uint8::to_const_uchar(password), plen, Uint8::to_const_uchar(salt),
538+
slen, iteration_count, key_length, Uint8::to_uchar(output));
539+
#endif
421540

422541
VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL);
423542

424543
exit:
425544
_log_mbedTLS_error(result);
426545

546+
#if (MBEDTLS_VERSION_NUMBER < 0x04000000) && (!defined(MBEDTLS_DEPRECATED_REMOVED) || MBEDTLS_VERSION_NUMBER < 0x03030000)
427547
if (free_md_ctxt)
428548
{
429549
mbedtls_md_free(&md_ctxt);
430550
}
551+
#endif
431552

432553
return error;
433554
}
@@ -724,8 +845,6 @@ CHIP_ERROR VerifyCertificateSigningRequest(const uint8_t * csr_buf, size_t csr_l
724845
CHIP_ERROR error = CHIP_NO_ERROR;
725846
size_t pubkey_size = 0;
726847

727-
mbedtls_ecp_keypair * keypair = nullptr;
728-
729848
P256ECDSASignature signature;
730849
MutableByteSpan out_raw_sig_span(signature.Bytes(), signature.Capacity());
731850

@@ -737,16 +856,26 @@ CHIP_ERROR VerifyCertificateSigningRequest(const uint8_t * csr_buf, size_t csr_l
737856

738857
// Verify the signature algorithm and public key type
739858
VerifyOrExit(csr.CHIP_CRYPTO_PAL_PRIVATE(sig_md) == MBEDTLS_MD_SHA256, error = CHIP_ERROR_UNSUPPORTED_SIGNATURE_TYPE);
740-
VerifyOrExit(csr.CHIP_CRYPTO_PAL_PRIVATE(sig_pk) == MBEDTLS_PK_ECDSA, error = CHIP_ERROR_WRONG_KEY_TYPE);
741-
742-
keypair = mbedtls_pk_ec(csr.CHIP_CRYPTO_PAL_PRIVATE_X509(pk));
743-
744-
// Copy the public key from the CSR
745-
result = mbedtls_ecp_point_write_binary(&keypair->CHIP_CRYPTO_PAL_PRIVATE(grp), &keypair->CHIP_CRYPTO_PAL_PRIVATE(Q),
746-
MBEDTLS_ECP_PF_UNCOMPRESSED, &pubkey_size, Uint8::to_uchar(pubkey), pubkey.Length());
859+
#if (MBEDTLS_VERSION_NUMBER >= 0x04000000)
860+
VerifyOrExit(csr.CHIP_CRYPTO_PAL_PRIVATE(sig_pk) == MBEDTLS_PK_SIGALG_ECDSA, error = CHIP_ERROR_WRONG_KEY_TYPE);
747861

862+
// Tinycrypt builds omit the PSA crypto core; export the raw EC point from PK pub_raw.
863+
result = mbedtls_pk_write_pubkey_psa(&csr.CHIP_CRYPTO_PAL_PRIVATE_X509(pk), Uint8::to_uchar(pubkey), pubkey.Length(),
864+
&pubkey_size);
748865
VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL);
749866
VerifyOrExit(pubkey_size == pubkey.Length(), error = CHIP_ERROR_INTERNAL);
867+
#else
868+
{
869+
mbedtls_ecp_keypair * keypair = mbedtls_pk_ec(csr.CHIP_CRYPTO_PAL_PRIVATE_X509(pk));
870+
VerifyOrExit(keypair != nullptr, error = CHIP_ERROR_WRONG_KEY_TYPE);
871+
872+
result = mbedtls_ecp_point_write_binary(&keypair->CHIP_CRYPTO_PAL_PRIVATE(grp), &keypair->CHIP_CRYPTO_PAL_PRIVATE(Q),
873+
MBEDTLS_ECP_PF_UNCOMPRESSED, &pubkey_size, Uint8::to_uchar(pubkey), pubkey.Length());
874+
875+
VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL);
876+
VerifyOrExit(pubkey_size == pubkey.Length(), error = CHIP_ERROR_INTERNAL);
877+
}
878+
#endif // (MBEDTLS_VERSION_NUMBER >= 0x04000000)
750879

751880
// Convert DER signature to raw signature
752881
error = EcdsaAsn1SignatureToRaw(kP256_FE_Length,
@@ -1449,23 +1578,33 @@ CHIP_ERROR IsCertificateValidAtCurrentTime(const ByteSpan & certificate)
14491578
CHIP_ERROR ExtractPubkeyFromX509Cert(const ByteSpan & certificate, Crypto::P256PublicKey & pubkey)
14501579
{
14511580
#if defined(MBEDTLS_X509_CRT_PARSE_C)
1452-
CHIP_ERROR error = CHIP_NO_ERROR;
1581+
CHIP_ERROR error = CHIP_NO_ERROR;
1582+
size_t pubkey_size = 0;
14531583
mbedtls_x509_crt mbed_cert;
1454-
mbedtls_uecc_keypair * keypair = nullptr;
14551584

14561585
mbedtls_x509_crt_init(&mbed_cert);
14571586

14581587
int result = mbedtls_x509_crt_parse(&mbed_cert, Uint8::to_const_uchar(certificate.data()), certificate.size());
14591588
VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL);
14601589

1461-
VerifyOrExit(mbedtls_pk_get_type(&(mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(pk))) == MBEDTLS_PK_ECKEY,
1462-
error = CHIP_ERROR_INVALID_ARGUMENT);
1590+
#if (MBEDTLS_VERSION_NUMBER >= 0x04000000)
1591+
// Tinycrypt builds omit the PSA crypto core; export the raw EC point from PK pub_raw.
1592+
result = mbedtls_pk_write_pubkey_psa(&mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(pk), Uint8::to_uchar(pubkey.Bytes()),
1593+
pubkey.Length(), &pubkey_size);
1594+
VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL);
1595+
VerifyOrExit(pubkey_size == pubkey.Length(), error = CHIP_ERROR_INTERNAL);
1596+
#else
1597+
{
1598+
mbedtls_uecc_keypair * keypair = nullptr;
14631599

1464-
keypair = (mbedtls_uecc_keypair *) (mbedtls_pk_ec(mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(pk)));
1465-
Uint8::to_uchar(pubkey)[0] = 0x04; // uncompressed type
1466-
memcpy(Uint8::to_uchar(pubkey) + 1, keypair->public_key, 2 * NUM_ECC_BYTES);
1600+
VerifyOrExit(mbedtls_pk_get_type(&(mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(pk))) == MBEDTLS_PK_ECKEY,
1601+
error = CHIP_ERROR_INVALID_ARGUMENT);
14671602

1468-
VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL);
1603+
keypair = (mbedtls_uecc_keypair *) (mbedtls_pk_ec(mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(pk)));
1604+
Uint8::to_uchar(pubkey)[0] = 0x04; // uncompressed type
1605+
memcpy(Uint8::to_uchar(pubkey) + 1, keypair->public_key, 2 * NUM_ECC_BYTES);
1606+
}
1607+
#endif // (MBEDTLS_VERSION_NUMBER >= 0x04000000)
14691608

14701609
exit:
14711610
_log_mbedTLS_error(result);

‎src/platform/silabs/SiWx/siwx917-chip-mbedtls-config.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232

3333
#define MBEDTLS_FREERTOS
3434

35-
#define MBEDTLS_MPI_WINDOW_SIZE 1
36-
3735
// Added for codesize optimizations
3836
#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
3937
#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf

0 commit comments

Comments
 (0)