
DeepCover Embedded Security in IoT: Public-key Secured Data Paths
Dependencies: MaximInterface
The MAXREFDES155# is an internet-of-things (IoT) embedded-security reference design, built to authenticate and control a sensing node using elliptic-curve-based public-key cryptography with control and notification from a web server.
The hardware includes an ARM® mbed™ shield and attached sensor endpoint. The shield contains a DS2476 DeepCover® ECDSA/SHA-2 coprocessor, Wifi communication, LCD push-button controls, and status LEDs. The sensor endpoint is attached to the shield using a 300mm cable and contains a DS28C36 DeepCover ECDSA/SHA-2 authenticator, IR-thermal sensor, and aiming laser for the IR sensor. The MAXREFDES155# is equipped with a standard Arduino® form-factor shield connector for immediate testing using an mbed board such as the MAX32600MBED#. The combination of these two devices represent an IoT device. Communication to the web server is accomplished with the shield Wifi circuitry. Communication from the shield to the attached sensor module is accomplished over I2C . The sensor module represents an IoT endpoint that generates small data with a requirement for message authenticity/integrity and secure on/off operational control.
The design is hierarchical with each mbed platform and shield communicating data from the sensor node to a web server that maintains a centralized log and dispatches notifications as necessary. The simplicity of this design enables rapid integration into any star-topology IoT network to provide security with the low overhead and cost provided by the ECDSA-P256 asymmetric-key and SHA-256 symmetric-key algorithms.
More information about the MAXREFDES155# is available on the Maxim Integrated website.
Revision 17:5926077e5345, committed 2019-10-04
- Comitter:
- IanBenzMaxim
- Date:
- Fri Oct 04 12:10:11 2019 -0500
- Parent:
- 16:a004191a79ab
- Child:
- 18:c2631e985780
- Commit message:
- Set pin maps through the mbed configuration system. Added support for MAX32625MBED target. Updated mbed-os to version 5.7.7 for MAX32625 I2C fixes. Consolidated simplelink hook definitions.
Changed in this revision
--- a/mbed-os.lib Thu Oct 03 11:40:13 2019 -0500 +++ b/mbed-os.lib Fri Oct 04 12:10:11 2019 -0500 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-os/#ca661f9d28526ca8f874b05432493a489c9671ea \ No newline at end of file +https://github.com/ARMmbed/mbed-os/#16bac101a6b7b4724023dcf86ece1548e3a23cbf \ No newline at end of file
--- a/mbed_app.json Thu Oct 03 11:40:13 2019 -0500 +++ b/mbed_app.json Fri Oct 04 12:10:11 2019 -0500 @@ -1,3 +1,47 @@ { - "macros": ["RAPIDJSON_ENDIAN RAPIDJSON_LITTLEENDIAN"] + "config": { + "Up_button_pin": "D5", + "Down_button_pin": "D4", + "Left_button_pin": "D3", + "Right_button_pin": "D2", + "Left_Click_button_pin": "D1", + "Right_Click_button_pin": "D0", + "CC3100_MOSI_pin": "D11", + "CC3100_MISO_pin": "D12", + "CC3100_CLK_pin": "D13", + "CC3100_nCS_pin": "D10", + "CC3100_INTR_pin": "D9", + "CC3100_nHIB_pin": "D8", + "Display_MOSI_pin": "D11", + "Display_MISO_pin": "D12", + "Display_SCLK_pin": "D13", + "Display_SSEL_pin": "D7", + "Display_A0_pin": "D6", + "SDA_pin": "D14", + "SCL_pin": "D15" + }, + "target_overrides": { + "MAX32625MBED": { + "Up_button_pin": "P0_5", + "Down_button_pin": "P0_4", + "Left_button_pin": "P0_3", + "Right_button_pin": "P0_2", + "Left_Click_button_pin": "P0_1", + "Right_Click_button_pin": "P0_0", + "CC3100_MOSI_pin": "P1_1", + "CC3100_MISO_pin": "P1_2", + "CC3100_CLK_pin": "P1_0", + "CC3100_nCS_pin": "P1_3", + "CC3100_INTR_pin": "P1_5", + "CC3100_nHIB_pin": "P1_4", + "Display_MOSI_pin": "P1_1", + "Display_MISO_pin": "P1_2", + "Display_SCLK_pin": "P1_0", + "Display_SSEL_pin": "P0_7", + "Display_A0_pin": "P0_6", + "SDA_pin": "P1_6", + "SCL_pin": "P1_7" + } + }, + "macros": ["RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN"] } \ No newline at end of file
--- a/src/CC3100.cpp Thu Oct 03 11:40:13 2019 -0500 +++ b/src/CC3100.cpp Fri Oct 04 12:10:11 2019 -0500 @@ -33,16 +33,72 @@ #include <cstdio> #include <cstring> #include <simplelink.h> +#include <mbed-os/drivers/InterruptIn.h> #include <mbed-os/platform/mbed_wait_api.h> #include "CC3100.hpp" -#include "CC3100_transport.h" -#include "CC3100_pins.h" using std::printf; using std::strlen; static CC3100::State currentState = CC3100::Stopped; +static mbed::InterruptIn irq(MBED_CONF_APP_CC3100_INTR_PIN); +static mbed::DigitalOut nHIB(MBED_CONF_APP_CC3100_NHIB_PIN, 0); + +static SL_P_EVENT_HANDLER pIrqEventHandler = NULL; +static void * pIrqEventHandlerValue = NULL; + +_SlFd_t sl_IfOpen(const char * ifName, unsigned long flags) { + _SlFd_t fd = NULL; + if (ifName) { + std::sscanf(ifName, "%p", &fd); + } + return fd; +} + +int sl_IfClose(_SlFd_t fd) { + return 0; // Success +} + +int sl_IfRead(_SlFd_t fd, unsigned char * pBuff, int len) { + if (!fd) { + return 0; // Failure + } + std::memset(pBuff, 0xFF, len); + static_cast<CC3100::SPI *>(fd)->transfer(pBuff, len, pBuff); + return len; // Success +} + +int sl_IfWrite(_SlFd_t fd, const unsigned char * pBuff, int len) { + if (!fd) { + return 0; // Failure + } + static_cast<CC3100::SPI *>(fd)->transfer(pBuff, len, NULL); + return len; // Success +} + +int sl_IfRegIntHdlr(SL_P_EVENT_HANDLER InterruptHdl, void * pValue) { + pIrqEventHandler = InterruptHdl; + pIrqEventHandlerValue = pValue; + return 0; // Success +} + +static void interruptHandler(void) { + if (pIrqEventHandler) { + pIrqEventHandler(pIrqEventHandlerValue); + } +} + +void sl_DeviceEnable(void) { + irq.rise(&interruptHandler); + nHIB = 1; +} + +void sl_DeviceDisable(void) { + irq.rise(NULL); + nHIB = 0; +} + /*! \brief This function handles general error events indication @@ -229,8 +285,8 @@ } CC3100::CC3100() - : spi(HOST_SPI_MOSI_PIN, HOST_SPI_MISO_PIN, HOST_SPI_CLK_PIN, - HOST_SPI_nCS_PIN) {} + : spi(MBED_CONF_APP_CC3100_MOSI_PIN, MBED_CONF_APP_CC3100_MISO_PIN, + MBED_CONF_APP_CC3100_CLK_PIN, MBED_CONF_APP_CC3100_NCS_PIN) {} CC3100 & CC3100::instance() { static CC3100 instance;
--- a/src/CC3100_pins.h Thu Oct 03 11:40:13 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/******************************************************************************* -* Copyright (C) Maxim Integrated Products, Inc., All Rights Reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES -* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -* -* Except as contained in this notice, the name of Maxim Integrated -* Products, Inc. shall not be used except as stated in the Maxim Integrated -* Products, Inc. Branding Policy. -* -* The mere transfer of this software does not imply any licenses -* of trade secrets, proprietary technology, copyrights, patents, -* trademarks, maskwork rights, or any other form of intellectual -* property whatsoever. Maxim Integrated Products, Inc. retains all -* ownership rights. -*******************************************************************************/ - -#ifndef CC3100_PINS_H -#define CC3100_PINS_H - -#define HOST_SPI_MOSI_PIN D11 -#define HOST_SPI_MISO_PIN D12 -#define HOST_SPI_CLK_PIN D13 -#define HOST_SPI_nCS_PIN D10 -#define HOST_INTR_PIN D9 -#define nHIB_PIN D8 - -#endif
--- a/src/CC3100_transport.cpp Thu Oct 03 11:40:13 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/******************************************************************************* -* Copyright (C) Maxim Integrated Products, Inc., All Rights Reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES -* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -* -* Except as contained in this notice, the name of Maxim Integrated -* Products, Inc. shall not be used except as stated in the Maxim Integrated -* Products, Inc. Branding Policy. -* -* The mere transfer of this software does not imply any licenses -* of trade secrets, proprietary technology, copyrights, patents, -* trademarks, maskwork rights, or any other form of intellectual -* property whatsoever. Maxim Integrated Products, Inc. retains all -* ownership rights. -*******************************************************************************/ - -#include <cstdio> -#include <cstring> -#include <mbed-os/drivers/DigitalOut.h> -#include <mbed-os/drivers/InterruptIn.h> -#include "CC3100.hpp" -#include "CC3100_transport.h" -#include "CC3100_pins.h" - -static const SlFd_t invalidFd = NULL; - -static mbed::InterruptIn irq(HOST_INTR_PIN); -static mbed::DigitalOut nHIB(nHIB_PIN, 0); - -static SL_P_EVENT_HANDLER pIrqEventHandler = NULL; -static void * pIrqEventHandlerValue = NULL; - -SlFd_t sl_IfOpen(const char * ifName, unsigned long flags) { - SlFd_t fd = invalidFd; - if (ifName) { - std::sscanf(ifName, "%p", &fd); - } - return fd; -} - -int sl_IfClose(SlFd_t fd) { - return 0; // Success -} - -int sl_IfRead(SlFd_t fd, unsigned char * pBuff, int len) { - if (fd == invalidFd) { - return 0; // Failure - } - std::memset(pBuff, 0xFF, len); - static_cast<CC3100::SPI *>(fd)->transfer(pBuff, len, pBuff); - return len; // Success -} - -int sl_IfWrite(SlFd_t fd, const unsigned char * pBuff, int len) { - if (fd == invalidFd) { - return 0; // Failure - } - static_cast<CC3100::SPI *>(fd)->transfer(pBuff, len, NULL); - return len; // Success -} - -int sl_IfRegIntHdlr(SL_P_EVENT_HANDLER InterruptHdl, void * pValue) { - pIrqEventHandler = InterruptHdl; - pIrqEventHandlerValue = pValue; - return 0; // Success -} - -static void interruptHandler(void) { - if (pIrqEventHandler) { - pIrqEventHandler(pIrqEventHandlerValue); - } -} - -void sl_DeviceEnable(void) { - irq.rise(&interruptHandler); - nHIB = 1; -} - -void sl_DeviceDisable(void) { - irq.rise(NULL); - nHIB = 0; -}
--- a/src/CC3100_transport.h Thu Oct 03 11:40:13 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +0,0 @@ -/******************************************************************************* -* Copyright (C) Maxim Integrated Products, Inc., All Rights Reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES -* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -* -* Except as contained in this notice, the name of Maxim Integrated -* Products, Inc. shall not be used except as stated in the Maxim Integrated -* Products, Inc. Branding Policy. -* -* The mere transfer of this software does not imply any licenses -* of trade secrets, proprietary technology, copyrights, patents, -* trademarks, maskwork rights, or any other form of intellectual -* property whatsoever. Maxim Integrated Products, Inc. retains all -* ownership rights. -*******************************************************************************/ - -#ifndef CC3100_TRANSPORT_H -#define CC3100_TRANSPORT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - \brief type definition for the spi channel file descriptor - - \note On each porting or platform the type could be whatever is needed - - integer, pointer to structure etc. -*/ -typedef void * SlFd_t; - -/*! - \brief type definition for the host interrupt handler - \param pValue - pointer to any memory structure. The value of this pointer is given on - registration of a new interrupt handler - \note -*/ -typedef void (*SL_P_EVENT_HANDLER)(void * pValue); - -/*! - \brief open spi communication port to be used for communicating with a - SimpleLink device - - Given an interface name and option flags, this function opens the spi - communication port and creates a file descriptor. This file descriptor can - be used afterwards to read and write data from and to this specific spi - channel. - The SPI speed, clock polarity, clock phase, chip select and all other - attributes are all set to hardcoded values in this function. - - \param[in] ifName - points to the interface name/path. The - interface name is an optional attributes that the simple - link driver receives on opening the device. in systems that - the spi channel is not implemented as part of the os device - drivers, this parameter could be NULL. - \param[in] flags - option flags - - \return upon successful completion, the function shall open the spi - channel and return a non-negative integer representing the - file descriptor. Otherwise, -1 shall be returned - - \sa spi_Close , spi_Read , spi_Write - \note - \warning -*/ -SlFd_t sl_IfOpen(const char * ifName, unsigned long flags); - -/*! - \brief closes an opened spi communication port - - \param[in] fd - file descriptor of an opened SPI channel - - \return upon successful completion, the function shall return 0. - Otherwise, -1 shall be returned - - \sa spi_Open - \note - \warning -*/ -int sl_IfClose(SlFd_t fd); - -/*! - \brief attempts to read up to len bytes from SPI channel into a buffer - starting at pBuff. - - \param[in] fd - file descriptor of an opened SPI channel - - \param[in] pBuff - points to first location to start writing the - data - - \param[in] len - number of bytes to read from the SPI channel - - \return upon successful completion, the function shall return 0. - Otherwise, -1 shall be returned - - \sa spi_Open , spi_Write - \note - \warning -*/ -int sl_IfRead(SlFd_t fd, unsigned char * pBuff, int len); - -/*! - \brief attempts to write up to len bytes to the SPI channel - - \param[in] fd - file descriptor of an opened SPI channel - - \param[in] pBuff - points to first location to start getting the - data from - - \param[in] len - number of bytes to write to the SPI channel - - \return upon successful completion, the function shall return 0. - Otherwise, -1 shall be returned - - \sa spi_Open , spi_Read - \note This function could be implemented as zero copy and return - only upon successful completion of writing the whole buffer, - but in cases that memory allocation is not too tight, the - function could copy the data to internal buffer, return - back and complete the write in parallel to other activities - as long as the other SPI activities would be blocked untill - the entire buffer write would be completed - \warning -*/ -int sl_IfWrite(SlFd_t fd, const unsigned char * pBuff, int len); - -/*! - \brief register an interrupt handler for the host IRQ - - \param[in] InterruptHdl - pointer to interrupt handler function - - \param[in] pValue - pointer to a memory strcuture that is - passed to the interrupt handler. - - \return upon successful registration, the function shall return 0. - Otherwise, -1 shall be returned - - \sa - \note If there is already registered interrupt handler, the - function should overwrite the old handler with the new one - - \warning -*/ -int sl_IfRegIntHdlr(SL_P_EVENT_HANDLER InterruptHdl, void * pValue); - -/*! - \brief Enable the Network Processor - - \sa sl_DeviceDisable - - \note belongs to \ref porting_sec - -*/ -void sl_DeviceEnable(void); - -/*! - \brief Disable the Network Processor - - \sa sl_DeviceEnable - - \note belongs to \ref porting_sec -*/ -void sl_DeviceDisable(void); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif
--- a/src/main.cpp Thu Oct 03 11:40:13 2019 -0500 +++ b/src/main.cpp Fri Oct 04 12:10:11 2019 -0500 @@ -43,17 +43,21 @@ #include "SensorNode.hpp" #include "WindowManager.hpp" -static mbed::DigitalIn upButton(D5); -static mbed::DigitalIn downButton(D4); -static mbed::DigitalIn leftButton(D3); -static mbed::DigitalIn rightButton(D2); -static mbed::DigitalIn leftClickButton(D1); -static mbed::DigitalIn rightClickButton(D0); +static mbed::DigitalIn upButton(MBED_CONF_APP_UP_BUTTON_PIN); +static mbed::DigitalIn downButton(MBED_CONF_APP_DOWN_BUTTON_PIN); +static mbed::DigitalIn leftButton(MBED_CONF_APP_LEFT_BUTTON_PIN); +static mbed::DigitalIn rightButton(MBED_CONF_APP_RIGHT_BUTTON_PIN); +static mbed::DigitalIn leftClickButton(MBED_CONF_APP_LEFT_CLICK_BUTTON_PIN); +static mbed::DigitalIn rightClickButton(MBED_CONF_APP_RIGHT_CLICK_BUTTON_PIN); -static Display display(D11, D12, D13, D7, D6); +static Display display(MBED_CONF_APP_DISPLAY_MOSI_PIN, + MBED_CONF_APP_DISPLAY_MISO_PIN, + MBED_CONF_APP_DISPLAY_SCLK_PIN, + MBED_CONF_APP_DISPLAY_SSEL_PIN, + MBED_CONF_APP_DISPLAY_A0_PIN); static WindowManager windowManager(display.canvas()); -static mbed::I2C mbedI2C(D14, D15); +static mbed::I2C mbedI2C(MBED_CONF_APP_SDA_PIN, MBED_CONF_APP_SCL_PIN); static MaximInterfaceMbed::I2CMaster i2c(mbedI2C); static MaximInterfaceMbed::Sleep sleep; MaximInterfaceDevices::DS2476 coproc(sleep, i2c); @@ -101,7 +105,8 @@ static bool buttonPressed(mbed::DigitalIn & button) { const int buttonPressed = 0; // Active low if (button == buttonPressed) { - while (button == buttonPressed); + while (button == buttonPressed) + ; return true; } // else
--- a/xternal/simplelink/user.h Thu Oct 03 11:40:13 2019 -0500 +++ b/xternal/simplelink/user.h Fri Oct 04 12:10:11 2019 -0500 @@ -74,8 +74,8 @@ ****************************************************************************** */ - #include <string.h> - #include <CC3100_transport.h> +#include <string.h> +typedef void (*SL_P_EVENT_HANDLER)(void *); /*! ****************************************************************************** @@ -369,7 +369,7 @@ \note belongs to \ref porting_sec */ -#define sl_DeviceEnable sl_DeviceEnable +void sl_DeviceEnable(void); /*! \brief Disable the Network Processor @@ -378,7 +378,7 @@ \note belongs to \ref porting_sec */ -#define sl_DeviceDisable sl_DeviceDisable +void sl_DeviceDisable(void); /*! @@ -410,7 +410,7 @@ ****************************************************************************** */ -#define _SlFd_t SlFd_t +#define _SlFd_t void * /*! \brief Opens an interface communication port to be used for communicating @@ -445,7 +445,7 @@ \warning */ -#define sl_IfOpen sl_IfOpen +_SlFd_t sl_IfOpen(const char * ifName, unsigned long flags); /*! \brief Closes an opened interface communication port @@ -464,7 +464,7 @@ \warning */ -#define sl_IfClose sl_IfClose +int sl_IfClose(_SlFd_t fd); /*! \brief Attempts to read up to len bytes from an opened communication channel @@ -490,7 +490,7 @@ \warning */ -#define sl_IfRead sl_IfRead +int sl_IfRead(_SlFd_t fd, unsigned char * pBuff, int len); /*! \brief attempts to write up to len bytes to the SPI channel @@ -520,7 +520,7 @@ \warning */ -#define sl_IfWrite sl_IfWrite +int sl_IfWrite(_SlFd_t fd, const unsigned char * pBuff, int len); /*! \brief register an interrupt handler routine for the host IRQ @@ -545,7 +545,7 @@ \warning */ -#define sl_IfRegIntHdlr(InterruptHdl , pValue) sl_IfRegIntHdlr(InterruptHdl , pValue) +int sl_IfRegIntHdlr(SL_P_EVENT_HANDLER InterruptHdl, void * pValue); /*! \brief Masks the Host IRQ