Skip to content

Commit 4d01268

Browse files
pan-paul-szczepanek-arm
authored andcommitted
BLE Nordic: Initialize and teardown tls platform context
1 parent dfcdbbf commit 4d01268

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xCrypto.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ namespace vendor {
4747
namespace nordic {
4848

4949
CryptoToolbox::CryptoToolbox() : _initialized(false) {
50+
mbedtls_platform_setup(&_platform_context);
5051
mbedtls_entropy_init(&_entropy_context);
5152
mbedtls_ecp_group_init(&_group);
5253
int err = mbedtls_ecp_group_load(
@@ -59,6 +60,7 @@ CryptoToolbox::CryptoToolbox() : _initialized(false) {
5960
CryptoToolbox::~CryptoToolbox() {
6061
mbedtls_ecp_group_free(&_group);
6162
mbedtls_entropy_free(&_entropy_context);
63+
mbedtls_platform_teardown(&_platform_context);
6264
}
6365

6466
bool CryptoToolbox::generate_keys(

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xCrypto.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class CryptoToolbox : mbed::NonCopyable<CryptoToolbox> {
132132
void swap_endian(uint8_t* buf, size_t len);
133133

134134
bool _initialized;
135+
mbedtls_platform_context _platform_context;
135136
mbedtls_entropy_context _entropy_context;
136137
mbedtls_ecp_group _group;
137138
};

0 commit comments

Comments
 (0)