Skip to content

Commit

Permalink
Remove MBEDTLS_ALLOW_PRIVATE_ACCESS
Browse files Browse the repository at this point in the history
  • Loading branch information
rosahay-silabs committed Dec 2, 2024
1 parent fb7efa0 commit eaed9c6
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
*/
#include <string.h>

// Use ECDH legacy context format
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
#include <crypto/CHIPCryptoPAL.h>

#include <type_traits>
Expand Down Expand Up @@ -133,12 +131,6 @@ bool _isValidTagLength(size_t tag_length)
}
return false;
}

inline mbedtls_uecc_keypair * mbedtls_pk_uecc(const mbedtls_pk_context pk)
{
return ((mbedtls_uecc_keypair *) (pk).pk_ctx);
}

} // namespace

CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, const uint8_t * aad, size_t aad_length,
Expand Down Expand Up @@ -1498,7 +1490,7 @@ CHIP_ERROR ExtractPubkeyFromX509Cert(const ByteSpan & certificate, Crypto::P256P
VerifyOrExit(mbedtls_pk_get_type(&(mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(pk))) == MBEDTLS_PK_ECKEY,
error = CHIP_ERROR_INVALID_ARGUMENT);

keypair = (mbedtls_uecc_keypair *) (mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(pk)).pk_ctx;
keypair = (mbedtls_uecc_keypair *) (mbedtls_pk_ec(mbed_cert.CHIP_CRYPTO_PAL_PRIVATE_X509(pk)));
Uint8::to_uchar(pubkey)[0] = 0x04; // uncompressed type
memcpy(Uint8::to_uchar(pubkey) + 1, keypair->public_key, 2 * NUM_ECC_BYTES);

Expand Down

0 comments on commit eaed9c6

Please sign in to comment.