Skip to content

Commit 227cc3d

Browse files
author
Arto Kinnunen
authored
Merge pull request #120 from ARMmbed/sync_with_mbedos_2
Sync with mbedos
2 parents 5feb8dd + 88894d1 commit 227cc3d

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

source/coap_security_handler.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ static int coap_security_handler_init(coap_security_t *sec)
102102
const int entropy_source_type = MBEDTLS_ENTROPY_SOURCE_WEAK;
103103
#endif
104104

105+
#if defined(MBEDTLS_PLATFORM_C)
106+
if (mbedtls_platform_setup(NULL) != 0) {
107+
return -1;
108+
}
109+
#endif /* MBEDTLS_PLATFORM_C */
110+
105111
mbedtls_ssl_init(&sec->_ssl);
106112
mbedtls_ssl_config_init(&sec->_conf);
107113
mbedtls_ctr_drbg_init(&sec->_ctr_drbg);
@@ -153,6 +159,9 @@ static void coap_security_handler_reset(coap_security_t *sec)
153159
mbedtls_ctr_drbg_free(&sec->_ctr_drbg);
154160
mbedtls_ssl_config_free(&sec->_conf);
155161
mbedtls_ssl_free(&sec->_ssl);
162+
#if defined(MBEDTLS_PLATFORM_C)
163+
mbedtls_platform_teardown(NULL);
164+
#endif /* MBEDTLS_PLATFORM_C */
156165
}
157166

158167

test/coap-service/unittest/stub/mbedtls_stub.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,3 +387,15 @@ int mbedtls_ssl_session_reset(mbedtls_ssl_context *ssl)
387387
void mbedtls_strerror(int ret, char *buf, size_t buflen)
388388
{
389389
}
390+
391+
int mbedtls_platform_setup(mbedtls_platform_context *ctx)
392+
{
393+
(void)ctx;
394+
395+
return (0);
396+
}
397+
398+
void mbedtls_platform_teardown(mbedtls_platform_context *ctx)
399+
{
400+
(void)ctx;
401+
}

test/coap-service/unittest/stub/mbedtls_stub.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "mbedtls/sha256.h"
2929
#include "mbedtls/entropy.h"
3030
#include "mbedtls/pk.h"
31-
31+
#include "mbedtls/platform.h"
3232

3333

3434
#define HANDSHAKE_FINISHED_VALUE 8888

0 commit comments

Comments
 (0)