![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
This is a simple mbed client example demonstrating, registration of a device with mbed Device Connector and reading and writing values as well as deregistering on different Network Interfaces including Ethernet, WiFi, 6LoWPAN ND and Thread respectively.
Fork of mbed-os-example-client by
Diff: main.cpp
- Revision:
- 19:91eb6f58fd77
- Parent:
- 13:c44e318674db
- Child:
- 21:b88cdeb5b302
--- a/main.cpp Wed Sep 21 07:30:08 2016 +0100 +++ b/main.cpp Thu Sep 29 16:15:08 2016 +0100 @@ -18,6 +18,7 @@ #include <sstream> #include <vector> #include "mbed-trace/mbed_trace.h" +#include "mbedtls/entropy_poll.h" #include "security.h" @@ -256,19 +257,29 @@ // Entry point to the program int main() { -#ifndef MBEDTLS_ENTROPY_HARDWARE_ALT + unsigned int seed; + size_t len; -#ifdef MBEDTLS_TEST_NULL_ENTROPY +#ifdef MBEDTLS_ENTROPY_HARDWARE_ALT + // Used to randomize source port + mbedtls_hardware_poll(NULL, (unsigned char *) &seed, sizeof seed, &len); + +#elif defined MBEDTLS_TEST_NULL_ENTROPY + #warning "mbedTLS security feature is disabled. Connection will not be secure !! Implement proper hardware entropy for your selected hardware." + // Used to randomize source port + mbedtls_null_entropy_poll( NULL,(unsigned char *) &seed, sizeof seed, &len); #else #error "This hardware does not have entropy, endpoint will not register to Connector.\ You need to enable NULL ENTROPY for your application, but if this configuration change is made then no security is offered by mbed TLS.\ Add MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES and MBEDTLS_TEST_NULL_ENTROPY in mbed_app.json macros to register your endpoint." + #endif -#endif + srand(seed); + status_ticker.attach_us(blinky, 250000); // Keep track of the main thread