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.
simplelink/source/nonos.c@0:33d4e66780c0, 2017-02-24 (annotated)
- Committer:
- IanBenzMaxim
- Date:
- Fri Feb 24 11:23:12 2017 -0600
- Revision:
- 0:33d4e66780c0
Initial commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
IanBenzMaxim | 0:33d4e66780c0 | 1 | /* |
IanBenzMaxim | 0:33d4e66780c0 | 2 | * nonos.c - CC31xx/CC32xx Host Driver Implementation |
IanBenzMaxim | 0:33d4e66780c0 | 3 | * |
IanBenzMaxim | 0:33d4e66780c0 | 4 | * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ |
IanBenzMaxim | 0:33d4e66780c0 | 5 | * |
IanBenzMaxim | 0:33d4e66780c0 | 6 | * |
IanBenzMaxim | 0:33d4e66780c0 | 7 | * Redistribution and use in source and binary forms, with or without |
IanBenzMaxim | 0:33d4e66780c0 | 8 | * modification, are permitted provided that the following conditions |
IanBenzMaxim | 0:33d4e66780c0 | 9 | * are met: |
IanBenzMaxim | 0:33d4e66780c0 | 10 | * |
IanBenzMaxim | 0:33d4e66780c0 | 11 | * Redistributions of source code must retain the above copyright |
IanBenzMaxim | 0:33d4e66780c0 | 12 | * notice, this list of conditions and the following disclaimer. |
IanBenzMaxim | 0:33d4e66780c0 | 13 | * |
IanBenzMaxim | 0:33d4e66780c0 | 14 | * Redistributions in binary form must reproduce the above copyright |
IanBenzMaxim | 0:33d4e66780c0 | 15 | * notice, this list of conditions and the following disclaimer in the |
IanBenzMaxim | 0:33d4e66780c0 | 16 | * documentation and/or other materials provided with the |
IanBenzMaxim | 0:33d4e66780c0 | 17 | * distribution. |
IanBenzMaxim | 0:33d4e66780c0 | 18 | * |
IanBenzMaxim | 0:33d4e66780c0 | 19 | * Neither the name of Texas Instruments Incorporated nor the names of |
IanBenzMaxim | 0:33d4e66780c0 | 20 | * its contributors may be used to endorse or promote products derived |
IanBenzMaxim | 0:33d4e66780c0 | 21 | * from this software without specific prior written permission. |
IanBenzMaxim | 0:33d4e66780c0 | 22 | * |
IanBenzMaxim | 0:33d4e66780c0 | 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
IanBenzMaxim | 0:33d4e66780c0 | 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
IanBenzMaxim | 0:33d4e66780c0 | 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
IanBenzMaxim | 0:33d4e66780c0 | 26 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
IanBenzMaxim | 0:33d4e66780c0 | 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
IanBenzMaxim | 0:33d4e66780c0 | 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
IanBenzMaxim | 0:33d4e66780c0 | 29 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
IanBenzMaxim | 0:33d4e66780c0 | 30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
IanBenzMaxim | 0:33d4e66780c0 | 31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
IanBenzMaxim | 0:33d4e66780c0 | 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
IanBenzMaxim | 0:33d4e66780c0 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
IanBenzMaxim | 0:33d4e66780c0 | 34 | * |
IanBenzMaxim | 0:33d4e66780c0 | 35 | */ |
IanBenzMaxim | 0:33d4e66780c0 | 36 | |
IanBenzMaxim | 0:33d4e66780c0 | 37 | |
IanBenzMaxim | 0:33d4e66780c0 | 38 | |
IanBenzMaxim | 0:33d4e66780c0 | 39 | /*****************************************************************************/ |
IanBenzMaxim | 0:33d4e66780c0 | 40 | /* Include files */ |
IanBenzMaxim | 0:33d4e66780c0 | 41 | /*****************************************************************************/ |
IanBenzMaxim | 0:33d4e66780c0 | 42 | #include "simplelink.h" |
IanBenzMaxim | 0:33d4e66780c0 | 43 | #include "protocol.h" |
IanBenzMaxim | 0:33d4e66780c0 | 44 | #include "driver.h" |
IanBenzMaxim | 0:33d4e66780c0 | 45 | |
IanBenzMaxim | 0:33d4e66780c0 | 46 | |
IanBenzMaxim | 0:33d4e66780c0 | 47 | #ifndef SL_PLATFORM_MULTI_THREADED |
IanBenzMaxim | 0:33d4e66780c0 | 48 | |
IanBenzMaxim | 0:33d4e66780c0 | 49 | #include "nonos.h" |
IanBenzMaxim | 0:33d4e66780c0 | 50 | |
IanBenzMaxim | 0:33d4e66780c0 | 51 | |
IanBenzMaxim | 0:33d4e66780c0 | 52 | _SlNonOsCB_t g__SlNonOsCB = {0}; |
IanBenzMaxim | 0:33d4e66780c0 | 53 | |
IanBenzMaxim | 0:33d4e66780c0 | 54 | |
IanBenzMaxim | 0:33d4e66780c0 | 55 | _SlNonOsRetVal_t _SlNonOsSemSet(_SlNonOsSemObj_t* pSemObj , _SlNonOsSemObj_t Value) |
IanBenzMaxim | 0:33d4e66780c0 | 56 | { |
IanBenzMaxim | 0:33d4e66780c0 | 57 | *pSemObj = Value; |
IanBenzMaxim | 0:33d4e66780c0 | 58 | return NONOS_RET_OK; |
IanBenzMaxim | 0:33d4e66780c0 | 59 | } |
IanBenzMaxim | 0:33d4e66780c0 | 60 | |
IanBenzMaxim | 0:33d4e66780c0 | 61 | _SlNonOsRetVal_t _SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout) |
IanBenzMaxim | 0:33d4e66780c0 | 62 | { |
IanBenzMaxim | 0:33d4e66780c0 | 63 | #if (!defined (SL_TINY)) && (defined(sl_GetTimestamp)) |
IanBenzMaxim | 0:33d4e66780c0 | 64 | _SlTimeoutParams_t TimeoutInfo={0}; |
IanBenzMaxim | 0:33d4e66780c0 | 65 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 66 | |
IanBenzMaxim | 0:33d4e66780c0 | 67 | /* If timeout 0 configured, just detect the value and return */ |
IanBenzMaxim | 0:33d4e66780c0 | 68 | if ((Timeout ==0) && (WaitValue == *pSyncObj)) |
IanBenzMaxim | 0:33d4e66780c0 | 69 | { |
IanBenzMaxim | 0:33d4e66780c0 | 70 | *pSyncObj = SetValue; |
IanBenzMaxim | 0:33d4e66780c0 | 71 | return NONOS_RET_OK; |
IanBenzMaxim | 0:33d4e66780c0 | 72 | } |
IanBenzMaxim | 0:33d4e66780c0 | 73 | |
IanBenzMaxim | 0:33d4e66780c0 | 74 | #if (!defined (SL_TINY)) && (defined(sl_GetTimestamp)) |
IanBenzMaxim | 0:33d4e66780c0 | 75 | if ((Timeout != NONOS_WAIT_FOREVER) && (Timeout != NONOS_NO_WAIT)) |
IanBenzMaxim | 0:33d4e66780c0 | 76 | { |
IanBenzMaxim | 0:33d4e66780c0 | 77 | _SlDrvStartMeasureTimeout(&TimeoutInfo, Timeout); |
IanBenzMaxim | 0:33d4e66780c0 | 78 | } |
IanBenzMaxim | 0:33d4e66780c0 | 79 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 80 | |
IanBenzMaxim | 0:33d4e66780c0 | 81 | #ifdef _SlSyncWaitLoopCallback |
IanBenzMaxim | 0:33d4e66780c0 | 82 | _SlNonOsTime_t timeOutRequest = Timeout; |
IanBenzMaxim | 0:33d4e66780c0 | 83 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 84 | while (Timeout>0) |
IanBenzMaxim | 0:33d4e66780c0 | 85 | { |
IanBenzMaxim | 0:33d4e66780c0 | 86 | if (WaitValue == *pSyncObj) |
IanBenzMaxim | 0:33d4e66780c0 | 87 | { |
IanBenzMaxim | 0:33d4e66780c0 | 88 | *pSyncObj = SetValue; |
IanBenzMaxim | 0:33d4e66780c0 | 89 | break; |
IanBenzMaxim | 0:33d4e66780c0 | 90 | } |
IanBenzMaxim | 0:33d4e66780c0 | 91 | #if (!defined (sl_GetTimestamp)) || (defined (SL_TINY_EXT)) |
IanBenzMaxim | 0:33d4e66780c0 | 92 | if (Timeout != NONOS_WAIT_FOREVER) |
IanBenzMaxim | 0:33d4e66780c0 | 93 | { |
IanBenzMaxim | 0:33d4e66780c0 | 94 | Timeout--; |
IanBenzMaxim | 0:33d4e66780c0 | 95 | } |
IanBenzMaxim | 0:33d4e66780c0 | 96 | #else |
IanBenzMaxim | 0:33d4e66780c0 | 97 | if ((Timeout != NONOS_WAIT_FOREVER) && (Timeout != NONOS_NO_WAIT)) |
IanBenzMaxim | 0:33d4e66780c0 | 98 | { |
IanBenzMaxim | 0:33d4e66780c0 | 99 | if (_SlDrvIsTimeoutExpired(&TimeoutInfo)) |
IanBenzMaxim | 0:33d4e66780c0 | 100 | { |
IanBenzMaxim | 0:33d4e66780c0 | 101 | return (_SlNonOsRetVal_t)NONOS_RET_ERR; |
IanBenzMaxim | 0:33d4e66780c0 | 102 | } |
IanBenzMaxim | 0:33d4e66780c0 | 103 | |
IanBenzMaxim | 0:33d4e66780c0 | 104 | } |
IanBenzMaxim | 0:33d4e66780c0 | 105 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 106 | |
IanBenzMaxim | 0:33d4e66780c0 | 107 | /* If we are in cmd context and waiting for its cmd response |
IanBenzMaxim | 0:33d4e66780c0 | 108 | * do not handle spawn async events as the global lock was already taken */ |
IanBenzMaxim | 0:33d4e66780c0 | 109 | if (FALSE == g_pCB->IsCmdRespWaited) |
IanBenzMaxim | 0:33d4e66780c0 | 110 | { |
IanBenzMaxim | 0:33d4e66780c0 | 111 | (void)_SlNonOsMainLoopTask(); |
IanBenzMaxim | 0:33d4e66780c0 | 112 | } |
IanBenzMaxim | 0:33d4e66780c0 | 113 | #ifdef _SlSyncWaitLoopCallback |
IanBenzMaxim | 0:33d4e66780c0 | 114 | if( (__NON_OS_SYNC_OBJ_SIGNAL_VALUE == WaitValue) && (timeOutRequest != NONOS_NO_WAIT) ) |
IanBenzMaxim | 0:33d4e66780c0 | 115 | { |
IanBenzMaxim | 0:33d4e66780c0 | 116 | if (WaitValue == *pSyncObj) |
IanBenzMaxim | 0:33d4e66780c0 | 117 | { |
IanBenzMaxim | 0:33d4e66780c0 | 118 | *pSyncObj = SetValue; |
IanBenzMaxim | 0:33d4e66780c0 | 119 | break; |
IanBenzMaxim | 0:33d4e66780c0 | 120 | } |
IanBenzMaxim | 0:33d4e66780c0 | 121 | _SlSyncWaitLoopCallback(); |
IanBenzMaxim | 0:33d4e66780c0 | 122 | } |
IanBenzMaxim | 0:33d4e66780c0 | 123 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 124 | } |
IanBenzMaxim | 0:33d4e66780c0 | 125 | |
IanBenzMaxim | 0:33d4e66780c0 | 126 | if (0 == Timeout) |
IanBenzMaxim | 0:33d4e66780c0 | 127 | { |
IanBenzMaxim | 0:33d4e66780c0 | 128 | return NONOS_RET_ERR; |
IanBenzMaxim | 0:33d4e66780c0 | 129 | } |
IanBenzMaxim | 0:33d4e66780c0 | 130 | else |
IanBenzMaxim | 0:33d4e66780c0 | 131 | { |
IanBenzMaxim | 0:33d4e66780c0 | 132 | return NONOS_RET_OK; |
IanBenzMaxim | 0:33d4e66780c0 | 133 | } |
IanBenzMaxim | 0:33d4e66780c0 | 134 | } |
IanBenzMaxim | 0:33d4e66780c0 | 135 | |
IanBenzMaxim | 0:33d4e66780c0 | 136 | |
IanBenzMaxim | 0:33d4e66780c0 | 137 | _SlNonOsRetVal_t _SlNonOsSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , _u32 flags) |
IanBenzMaxim | 0:33d4e66780c0 | 138 | { |
IanBenzMaxim | 0:33d4e66780c0 | 139 | _i8 i = 0; |
IanBenzMaxim | 0:33d4e66780c0 | 140 | |
IanBenzMaxim | 0:33d4e66780c0 | 141 | (void)flags; |
IanBenzMaxim | 0:33d4e66780c0 | 142 | |
IanBenzMaxim | 0:33d4e66780c0 | 143 | #ifndef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 144 | for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++) |
IanBenzMaxim | 0:33d4e66780c0 | 145 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 146 | { |
IanBenzMaxim | 0:33d4e66780c0 | 147 | _SlNonOsSpawnEntry_t* pE = &g__SlNonOsCB.SpawnEntries[i]; |
IanBenzMaxim | 0:33d4e66780c0 | 148 | |
IanBenzMaxim | 0:33d4e66780c0 | 149 | if (pE->IsAllocated == FALSE) |
IanBenzMaxim | 0:33d4e66780c0 | 150 | { |
IanBenzMaxim | 0:33d4e66780c0 | 151 | pE->pValue = pValue; |
IanBenzMaxim | 0:33d4e66780c0 | 152 | pE->pEntry = pEntry; |
IanBenzMaxim | 0:33d4e66780c0 | 153 | pE->IsAllocated = TRUE; |
IanBenzMaxim | 0:33d4e66780c0 | 154 | #ifndef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 155 | break; |
IanBenzMaxim | 0:33d4e66780c0 | 156 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 157 | } |
IanBenzMaxim | 0:33d4e66780c0 | 158 | } |
IanBenzMaxim | 0:33d4e66780c0 | 159 | |
IanBenzMaxim | 0:33d4e66780c0 | 160 | |
IanBenzMaxim | 0:33d4e66780c0 | 161 | return NONOS_RET_OK; |
IanBenzMaxim | 0:33d4e66780c0 | 162 | } |
IanBenzMaxim | 0:33d4e66780c0 | 163 | |
IanBenzMaxim | 0:33d4e66780c0 | 164 | |
IanBenzMaxim | 0:33d4e66780c0 | 165 | _SlNonOsRetVal_t _SlNonOsMainLoopTask(void) |
IanBenzMaxim | 0:33d4e66780c0 | 166 | { |
IanBenzMaxim | 0:33d4e66780c0 | 167 | _i8 i=0; |
IanBenzMaxim | 0:33d4e66780c0 | 168 | void* pValue; |
IanBenzMaxim | 0:33d4e66780c0 | 169 | |
IanBenzMaxim | 0:33d4e66780c0 | 170 | #ifndef SL_TINY_EXT |
IanBenzMaxim | 0:33d4e66780c0 | 171 | for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++) |
IanBenzMaxim | 0:33d4e66780c0 | 172 | #endif |
IanBenzMaxim | 0:33d4e66780c0 | 173 | { |
IanBenzMaxim | 0:33d4e66780c0 | 174 | _SlNonOsSpawnEntry_t* pE = &g__SlNonOsCB.SpawnEntries[i]; |
IanBenzMaxim | 0:33d4e66780c0 | 175 | |
IanBenzMaxim | 0:33d4e66780c0 | 176 | |
IanBenzMaxim | 0:33d4e66780c0 | 177 | if (pE->IsAllocated == TRUE) |
IanBenzMaxim | 0:33d4e66780c0 | 178 | { |
IanBenzMaxim | 0:33d4e66780c0 | 179 | _SlSpawnEntryFunc_t pF = pE->pEntry; |
IanBenzMaxim | 0:33d4e66780c0 | 180 | pValue = pE->pValue; |
IanBenzMaxim | 0:33d4e66780c0 | 181 | |
IanBenzMaxim | 0:33d4e66780c0 | 182 | |
IanBenzMaxim | 0:33d4e66780c0 | 183 | /* Clear the entry */ |
IanBenzMaxim | 0:33d4e66780c0 | 184 | pE->pEntry = NULL; |
IanBenzMaxim | 0:33d4e66780c0 | 185 | pE->pValue = NULL; |
IanBenzMaxim | 0:33d4e66780c0 | 186 | pE->IsAllocated = FALSE; |
IanBenzMaxim | 0:33d4e66780c0 | 187 | |
IanBenzMaxim | 0:33d4e66780c0 | 188 | /* execute the spawn function */ |
IanBenzMaxim | 0:33d4e66780c0 | 189 | pF(pValue); |
IanBenzMaxim | 0:33d4e66780c0 | 190 | } |
IanBenzMaxim | 0:33d4e66780c0 | 191 | } |
IanBenzMaxim | 0:33d4e66780c0 | 192 | |
IanBenzMaxim | 0:33d4e66780c0 | 193 | return NONOS_RET_OK; |
IanBenzMaxim | 0:33d4e66780c0 | 194 | } |
IanBenzMaxim | 0:33d4e66780c0 | 195 | |
IanBenzMaxim | 0:33d4e66780c0 | 196 | |
IanBenzMaxim | 0:33d4e66780c0 | 197 | #endif /*(SL_PLATFORM != SL_PLATFORM_NON_OS)*/ |