Skip to content

Commit

Permalink
Merge pull request #7960 from RonEld/set_NULL_as_platform_context
Browse files Browse the repository at this point in the history
Change mbedtls_platform_context parameter to NULL
  • Loading branch information
0xc0170 authored Sep 17, 2018
2 parents 9abcbf6 + 5817d71 commit 10b5a3a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions TESTS/mbedtls/multi/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,14 @@ int main()
{
int ret = 0;
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_platform_context platform_ctx;
if ((ret = mbedtls_platform_setup(&platform_ctx)) != 0) {
if ((ret = mbedtls_platform_setup(NULL)) != 0) {
mbedtls_printf("Mbed TLS multitest failed! mbedtls_platform_setup returned %d\n", ret);
return 1;
}
#endif
ret = (Harness::run(specification) ? 0 : 1);
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_platform_teardown(&platform_ctx);
mbedtls_platform_teardown(NULL);
#endif
return ret;
}
5 changes: 2 additions & 3 deletions TESTS/mbedtls/selftest/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,14 @@ int main()
{
int ret = 0;
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_platform_context platform_ctx;
if ((ret = mbedtls_platform_setup(&platform_ctx)) != 0) {
if ((ret = mbedtls_platform_setup(NULL)) != 0) {
mbedtls_printf("Mbed TLS selftest failed! mbedtls_platform_setup returned %d\n", ret);
return 1;
}
#endif
ret = (Harness::run(specification) ? 0 : 1);
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_platform_teardown(&platform_ctx);
mbedtls_platform_teardown(NULL);
#endif
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace vendor {
namespace nordic {

CryptoToolbox::CryptoToolbox() : _initialized(false) {
mbedtls_platform_setup(&_platform_context);
mbedtls_platform_setup(NULL);
mbedtls_entropy_init(&_entropy_context);
mbedtls_ecp_group_init(&_group);
int err = mbedtls_ecp_group_load(
Expand All @@ -60,7 +60,7 @@ CryptoToolbox::CryptoToolbox() : _initialized(false) {
CryptoToolbox::~CryptoToolbox() {
mbedtls_ecp_group_free(&_group);
mbedtls_entropy_free(&_entropy_context);
mbedtls_platform_teardown(&_platform_context);
mbedtls_platform_teardown(NULL);
}

bool CryptoToolbox::generate_keys(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class CryptoToolbox : mbed::NonCopyable<CryptoToolbox> {
void swap_endian(uint8_t* buf, size_t len);

bool _initialized;
mbedtls_platform_context _platform_context;
mbedtls_entropy_context _entropy_context;
mbedtls_ecp_group _group;
};
Expand Down

0 comments on commit 10b5a3a

Please sign in to comment.