Skip to content

Commit

Permalink
Merge pull request ARMmbed#120 from ARMmbed/sync_with_mbedos_2
Browse files Browse the repository at this point in the history
Sync with mbedos
  • Loading branch information
Arto Kinnunen authored Feb 25, 2019
2 parents 5feb8dd + 88894d1 commit 227cc3d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
9 changes: 9 additions & 0 deletions source/coap_security_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ static int coap_security_handler_init(coap_security_t *sec)
const int entropy_source_type = MBEDTLS_ENTROPY_SOURCE_WEAK;
#endif

#if defined(MBEDTLS_PLATFORM_C)
if (mbedtls_platform_setup(NULL) != 0) {
return -1;
}
#endif /* MBEDTLS_PLATFORM_C */

mbedtls_ssl_init(&sec->_ssl);
mbedtls_ssl_config_init(&sec->_conf);
mbedtls_ctr_drbg_init(&sec->_ctr_drbg);
Expand Down Expand Up @@ -153,6 +159,9 @@ static void coap_security_handler_reset(coap_security_t *sec)
mbedtls_ctr_drbg_free(&sec->_ctr_drbg);
mbedtls_ssl_config_free(&sec->_conf);
mbedtls_ssl_free(&sec->_ssl);
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_platform_teardown(NULL);
#endif /* MBEDTLS_PLATFORM_C */
}


Expand Down
12 changes: 12 additions & 0 deletions test/coap-service/unittest/stub/mbedtls_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,15 @@ int mbedtls_ssl_session_reset(mbedtls_ssl_context *ssl)
void mbedtls_strerror(int ret, char *buf, size_t buflen)
{
}

int mbedtls_platform_setup(mbedtls_platform_context *ctx)
{
(void)ctx;

return (0);
}

void mbedtls_platform_teardown(mbedtls_platform_context *ctx)
{
(void)ctx;
}
2 changes: 1 addition & 1 deletion test/coap-service/unittest/stub/mbedtls_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "mbedtls/sha256.h"
#include "mbedtls/entropy.h"
#include "mbedtls/pk.h"

#include "mbedtls/platform.h"


#define HANDSHAKE_FINISHED_VALUE 8888
Expand Down

0 comments on commit 227cc3d

Please sign in to comment.