Driver for CC3000 Wi-Fi module

Dependencies:   NVIC_set_all_priorities

Dependents:   CC3000_Simple_Socket Wi-Go_IOT_Demo

Information

The current code has been reworked to a full object oriented application and contains an mbed socket compatible API.

CC3000 Wi-Fi module library

Info

This is the low level driver for TI's SimpleLink CC3000 device.
Port from Avnet's Wi-Go KEIL code (based on TI's CC3000 code).
Special thanks to Jim Carver from Avnet for providing the Wi-Go board and for his assistance.

Differences with TI's original code

The code functionality stays exactly the same.
In order to make it easier to use the code, following changes were made :

  • Addition of a tool to shift all IRQ priorities to a lower level since it is very important to keep the SPI handler at the highest system priority, the WLAN interrupt the second highest and all other system interrupts at a lower priority, so their handlers can be preempted by the CC3000 interrupts.
  • Addition of low level I/O controls and conditional compiler controls in cc3000_common.h.
  • CC3000 initialisation, pin declarations, SPI and WLAN irq priorities are set in Init_HostDriver , we need to call this function at the start of the main function.
  • The SPI and HCI code are joined into one file.
  • The include list has been rearranged - Only #include "wlan.h" is needed in the user API.
  • Part of the CC3000's user eeprom memory is used to store additional info (52 bytes in NVMEM_USER_FILE_1):
# bytesDescriptionInfo
1First time config parameterUseful when connecting
2Firmware updater versionused with the Firmware update tool
2Service Pack versionused with the Firmware update tool
3Driver Versionused with the Firmware update tool
3Firmware Versionused with the Firmware update tool
1CIK validation (Client Interface Key)
40CIK data (Client Interface Key)used with the exosite

Using the Library

A user API is needed to access the CC3000 functions.
Examples:

Using the library with other processors

cc3000_common.cpp loads the irq tool for all targets:
All current mbed targets are supported by this library.

#include "NVIC_set_all_priorities.h"


All low level settings that need to change are available in cc3000_common.h

//*****************************************************************************
//              PIN CONTROLS & COMPILE CONTROLS
//*****************************************************************************
// Compiler control
#define CC3000_UNENCRYPTED_SMART_CONFIG   // No encryption
//#define CC3000_TINY_DRIVER                // Driver for small memory model CPUs

//Interrupt controls
#define NVIC_ALL_IRQ        NVIC_set_all_irq_priorities(3);         // Set ALL interrupt priorities to level 3
#define NVIC_SPI_IRQ        NVIC_SetPriority(SPI0_IRQn, 0x0);       // Wi-Fi SPI interrupt must be higher priority than SysTick
#define NVIC_PORT_IRQ       NVIC_SetPriority(PORTA_IRQn, 0x1);
#define NVIC_SYSTICK_IRQ    NVIC_SetPriority(SysTick_IRQn, 0x2);    // SysTick set to lower priority than Wi-Fi SPI bus interrupt
//#define NVIC_ADC_IRQ        NVIC_SetPriority(ADC0_IRQn, 0x3);       // ADC is the lowest of all

// Wlan controls
#define WLAN_ISF_PCR        PORTA->PCR[16]
#define WLAN_ISF_ISFR       PORTA->ISFR
#define WLAN_ISF_MASK       (1<<16)

#define WLAN_ASSERT_CS      wlan_cs = 0;   //CS : active low
#define WLAN_DEASSERT_CS    wlan_cs = 1;

#define WLAN_ASSERT_EN      wlan_en = 1;   //EN : active high
#define WLAN_DEASSERT_EN    wlan_en = 0;

#define WLAN_READ_IRQ       wlan_int

#define WLAN_ENABLE_IRQ     wlan_int.fall(&WLAN_IRQHandler);
#define WLAN_DISABLE_IRQ    wlan_int.fall(NULL);

#define WLAN_IRQ_PIN_CREATE         InterruptIn wlan_int (PTA16);
#define WLAN_EN_PIN_CREATE          DigitalOut  wlan_en  (PTA13);
#define WLAN_CS_PIN_CREATE          DigitalOut  wlan_cs  (PTD0);
#define WLAN_SPI_PORT_CREATE        SPI wlan(PTD2, PTD3, PTC5); // mosi, miso, sclk

#define WLAN_SPI_PORT_INIT          wlan.format(8,1);
#define WLAN_SPI_SET_FREQ           wlan.frequency(12000000);
#define WLAN_SPI_SET_IRQ_HANDLER    wlan_int.fall(&WLAN_IRQHandler);

#define WLAN_SPI_WRITE              wlan.write(*data++);
#define WLAN_SPI_READ               wlan.write(0x03);          // !! DO NOT MODIFY the 0x03 parameter (CC3000 will not respond).

API documentation

Due to a little problem with the links on the mbed site, the API documentation is not directly accessible (will be solved in a next release).
Currently, it is only accessible by adding modules.html to the API doc link: http://mbed.org/users/frankvnk/code/CC3000_Hostdriver/docs/tip/modules.html

Committer:
frankvnk
Date:
Mon Jul 15 14:19:46 2013 +0000
Revision:
4:d8255a5aad46
Parent:
0:c44f0314d6ec
Child:
5:854f9b13a0f9
Full clean up (comments, Doxygen, code)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
frankvnk 0:c44f0314d6ec 1 /*****************************************************************************
frankvnk 0:c44f0314d6ec 2 *
frankvnk 0:c44f0314d6ec 3 * security.h - CC3000 Host Driver Implementation.
frankvnk 0:c44f0314d6ec 4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
frankvnk 0:c44f0314d6ec 5 *
frankvnk 0:c44f0314d6ec 6 * Redistribution and use in source and binary forms, with or without
frankvnk 0:c44f0314d6ec 7 * modification, are permitted provided that the following conditions
frankvnk 0:c44f0314d6ec 8 * are met:
frankvnk 0:c44f0314d6ec 9 *
frankvnk 0:c44f0314d6ec 10 * Redistributions of source code must retain the above copyright
frankvnk 0:c44f0314d6ec 11 * notice, this list of conditions and the following disclaimer.
frankvnk 0:c44f0314d6ec 12 *
frankvnk 0:c44f0314d6ec 13 * Redistributions in binary form must reproduce the above copyright
frankvnk 0:c44f0314d6ec 14 * notice, this list of conditions and the following disclaimer in the
frankvnk 0:c44f0314d6ec 15 * documentation and/or other materials provided with the
frankvnk 0:c44f0314d6ec 16 * distribution.
frankvnk 0:c44f0314d6ec 17 *
frankvnk 0:c44f0314d6ec 18 * Neither the name of Texas Instruments Incorporated nor the names of
frankvnk 0:c44f0314d6ec 19 * its contributors may be used to endorse or promote products derived
frankvnk 0:c44f0314d6ec 20 * from this software without specific prior written permission.
frankvnk 0:c44f0314d6ec 21 *
frankvnk 0:c44f0314d6ec 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
frankvnk 0:c44f0314d6ec 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
frankvnk 0:c44f0314d6ec 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
frankvnk 0:c44f0314d6ec 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
frankvnk 0:c44f0314d6ec 26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
frankvnk 0:c44f0314d6ec 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
frankvnk 0:c44f0314d6ec 28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
frankvnk 0:c44f0314d6ec 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
frankvnk 0:c44f0314d6ec 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
frankvnk 0:c44f0314d6ec 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
frankvnk 0:c44f0314d6ec 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
frankvnk 0:c44f0314d6ec 33 *
frankvnk 0:c44f0314d6ec 34 *****************************************************************************/
frankvnk 0:c44f0314d6ec 35 #ifndef __SECURITY__
frankvnk 0:c44f0314d6ec 36 #define __SECURITY__
frankvnk 0:c44f0314d6ec 37
frankvnk 0:c44f0314d6ec 38 #include "GlobalAssigns.h"
frankvnk 0:c44f0314d6ec 39 #include "nvmem.h"
frankvnk 0:c44f0314d6ec 40
frankvnk 0:c44f0314d6ec 41 /** CC3000 Host driver - Security
frankvnk 0:c44f0314d6ec 42 *
frankvnk 0:c44f0314d6ec 43 */
frankvnk 4:d8255a5aad46 44
frankvnk 0:c44f0314d6ec 45 #ifdef __cplusplus
frankvnk 0:c44f0314d6ec 46 extern "C" {
frankvnk 0:c44f0314d6ec 47 #endif
frankvnk 0:c44f0314d6ec 48
frankvnk 0:c44f0314d6ec 49
frankvnk 0:c44f0314d6ec 50 #define AES128_KEY_SIZE 16
frankvnk 0:c44f0314d6ec 51
frankvnk 4:d8255a5aad46 52
frankvnk 0:c44f0314d6ec 53 #ifndef CC3000_UNENCRYPTED_SMART_CONFIG
frankvnk 0:c44f0314d6ec 54
frankvnk 4:d8255a5aad46 55 // forward sbox
frankvnk 4:d8255a5aad46 56 const unsigned char sbox[256] = {
frankvnk 4:d8255a5aad46 57 //0 1 2 3 4 5 6 7 8 9 A B C D E F
frankvnk 4:d8255a5aad46 58 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, //0
frankvnk 4:d8255a5aad46 59 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, //1
frankvnk 4:d8255a5aad46 60 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, //2
frankvnk 4:d8255a5aad46 61 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, //3
frankvnk 4:d8255a5aad46 62 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, //4
frankvnk 4:d8255a5aad46 63 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, //5
frankvnk 4:d8255a5aad46 64 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, //6
frankvnk 4:d8255a5aad46 65 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, //7
frankvnk 4:d8255a5aad46 66 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, //8
frankvnk 4:d8255a5aad46 67 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, //9
frankvnk 4:d8255a5aad46 68 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, //A
frankvnk 4:d8255a5aad46 69 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, //B
frankvnk 4:d8255a5aad46 70 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, //C
frankvnk 4:d8255a5aad46 71 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, //D
frankvnk 4:d8255a5aad46 72 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, //E
frankvnk 4:d8255a5aad46 73 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; //F
frankvnk 4:d8255a5aad46 74 // inverse sbox
frankvnk 4:d8255a5aad46 75 const unsigned char rsbox[256] =
frankvnk 4:d8255a5aad46 76 { 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
frankvnk 4:d8255a5aad46 77 , 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
frankvnk 4:d8255a5aad46 78 , 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
frankvnk 4:d8255a5aad46 79 , 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
frankvnk 4:d8255a5aad46 80 , 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
frankvnk 4:d8255a5aad46 81 , 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
frankvnk 4:d8255a5aad46 82 , 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
frankvnk 4:d8255a5aad46 83 , 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
frankvnk 4:d8255a5aad46 84 , 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
frankvnk 4:d8255a5aad46 85 , 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
frankvnk 4:d8255a5aad46 86 , 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
frankvnk 4:d8255a5aad46 87 , 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
frankvnk 4:d8255a5aad46 88 , 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
frankvnk 4:d8255a5aad46 89 , 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
frankvnk 4:d8255a5aad46 90 , 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
frankvnk 4:d8255a5aad46 91 , 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d };
frankvnk 4:d8255a5aad46 92 // round constant
frankvnk 4:d8255a5aad46 93 const unsigned char Rcon[11] = {0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36};
frankvnk 0:c44f0314d6ec 94
frankvnk 4:d8255a5aad46 95 /**
frankvnk 4:d8255a5aad46 96 * expend a 16 bytes key for AES128 implementation
frankvnk 4:d8255a5aad46 97 * @param key AES128 key - 16 bytes
frankvnk 4:d8255a5aad46 98 * @param expandedKey expanded AES128 key
frankvnk 4:d8255a5aad46 99 * @return none
frankvnk 4:d8255a5aad46 100 */
frankvnk 4:d8255a5aad46 101 void expandKey(unsigned char *expandedKey, unsigned char *key);
frankvnk 4:d8255a5aad46 102
frankvnk 4:d8255a5aad46 103 /**
frankvnk 4:d8255a5aad46 104 * multiply by 2 in the galois field
frankvnk 4:d8255a5aad46 105 * @param value argument to multiply
frankvnk 4:d8255a5aad46 106 * @return multiplied argument
frankvnk 4:d8255a5aad46 107 */
frankvnk 4:d8255a5aad46 108 unsigned char galois_mul2(unsigned char value);
frankvnk 4:d8255a5aad46 109
frankvnk 4:d8255a5aad46 110 /**
frankvnk 4:d8255a5aad46 111 * internal implementation of AES128 encryption.
frankvnk 4:d8255a5aad46 112 * straight forward aes encryption implementation
frankvnk 4:d8255a5aad46 113 * first the group of operations
frankvnk 4:d8255a5aad46 114 * - addRoundKey
frankvnk 4:d8255a5aad46 115 * - subbytes
frankvnk 4:d8255a5aad46 116 * - shiftrows
frankvnk 4:d8255a5aad46 117 * - mixcolums
frankvnk 4:d8255a5aad46 118 * is executed 9 times, after this addroundkey to finish the 9th
frankvnk 4:d8255a5aad46 119 * round, after that the 10th round without mixcolums
frankvnk 4:d8255a5aad46 120 * no further subfunctions to save cycles for function calls
frankvnk 4:d8255a5aad46 121 * no structuring with "for (....)" to save cycles.
frankvnk 4:d8255a5aad46 122 * @param[in] expandedKey expanded AES128 key
frankvnk 4:d8255a5aad46 123 * @param[in/out] state 16 bytes of plain text and cipher text
frankvnk 4:d8255a5aad46 124 * @return none
frankvnk 4:d8255a5aad46 125 */
frankvnk 4:d8255a5aad46 126 void aes_encr(unsigned char *state, unsigned char *expandedKey);
frankvnk 4:d8255a5aad46 127
frankvnk 4:d8255a5aad46 128 /**
frankvnk 4:d8255a5aad46 129 * internal implementation of AES128 decryption.
frankvnk 4:d8255a5aad46 130 * straightforward aes decryption implementation
frankvnk 4:d8255a5aad46 131 * the order of substeps is the exact reverse of decryption
frankvnk 4:d8255a5aad46 132 * inverse functions:
frankvnk 4:d8255a5aad46 133 * - addRoundKey is its own inverse
frankvnk 4:d8255a5aad46 134 * - rsbox is inverse of sbox
frankvnk 4:d8255a5aad46 135 * - rightshift instead of leftshift
frankvnk 4:d8255a5aad46 136 * - invMixColumns = barreto + mixColumns
frankvnk 4:d8255a5aad46 137 * no further subfunctions to save cycles for function calls
frankvnk 4:d8255a5aad46 138 * no structuring with "for (....)" to save cycles
frankvnk 4:d8255a5aad46 139 * @param[in] expandedKey expanded AES128 key
frankvnk 4:d8255a5aad46 140 * @param[in\out] state 16 bytes of cipher text and plain text
frankvnk 4:d8255a5aad46 141 * @return none
frankvnk 4:d8255a5aad46 142 */
frankvnk 4:d8255a5aad46 143 void aes_decr(unsigned char *state, unsigned char *expandedKey);
frankvnk 4:d8255a5aad46 144
frankvnk 4:d8255a5aad46 145 /**
frankvnk 4:d8255a5aad46 146 * AES128 encryption: Given AES128 key and 16 bytes plain text, cipher text of 16 bytes is
frankvnk 4:d8255a5aad46 147 * computed. The AES implementation is in mode ECB (Electronic Code Book).
frankvnk 4:d8255a5aad46 148 * @param[in] key AES128 key of size 16 bytes
frankvnk 4:d8255a5aad46 149 * @param[in\out] state 16 bytes of plain text and cipher text
frankvnk 4:d8255a5aad46 150 * @return none
frankvnk 4:d8255a5aad46 151 */
frankvnk 0:c44f0314d6ec 152 extern void aes_encrypt(unsigned char *state, unsigned char *key);
frankvnk 0:c44f0314d6ec 153
frankvnk 4:d8255a5aad46 154 /**
frankvnk 4:d8255a5aad46 155 * AES128 decryption: Given AES128 key and 16 bytes cipher text, plain text of 16 bytes is
frankvnk 4:d8255a5aad46 156 * computed The AES implementation is in mode ECB (Electronic Code Book).
frankvnk 4:d8255a5aad46 157 * @param[in] key AES128 key of size 16 bytes
frankvnk 4:d8255a5aad46 158 * @param[in\out] state 16 bytes of cipher text and plain text
frankvnk 4:d8255a5aad46 159 * @return none
frankvnk 4:d8255a5aad46 160 */
frankvnk 0:c44f0314d6ec 161 extern void aes_decrypt(unsigned char *state, unsigned char *key);
frankvnk 0:c44f0314d6ec 162
frankvnk 0:c44f0314d6ec 163
frankvnk 4:d8255a5aad46 164 /**
frankvnk 4:d8255a5aad46 165 * Read the AES128 key from fileID #12 in EEPROM
frankvnk 4:d8255a5aad46 166 * @param[out] key AES128 key of size 16 bytes
frankvnk 4:d8255a5aad46 167 * @return 0 on success, error otherwise.
frankvnk 4:d8255a5aad46 168 */
frankvnk 0:c44f0314d6ec 169 extern signed long aes_read_key(unsigned char *key);
frankvnk 0:c44f0314d6ec 170
frankvnk 4:d8255a5aad46 171 /**
frankvnk 4:d8255a5aad46 172 * Write the AES128 key to fileID #12 in EEPROM
frankvnk 4:d8255a5aad46 173 * @param[out] key AES128 key of size 16 bytes
frankvnk 4:d8255a5aad46 174 * @return on success 0, error otherwise.
frankvnk 4:d8255a5aad46 175 */
frankvnk 0:c44f0314d6ec 176 extern signed long aes_write_key(unsigned char *key);
frankvnk 0:c44f0314d6ec 177
frankvnk 0:c44f0314d6ec 178 #endif //CC3000_UNENCRYPTED_SMART_CONFIG
frankvnk 0:c44f0314d6ec 179
frankvnk 0:c44f0314d6ec 180 #ifdef __cplusplus
frankvnk 0:c44f0314d6ec 181 }
frankvnk 0:c44f0314d6ec 182 #endif // __cplusplus
frankvnk 0:c44f0314d6ec 183
frankvnk 0:c44f0314d6ec 184 #endif //__SECURITY__
frankvnk 0:c44f0314d6ec 185
frankvnk 0:c44f0314d6ec 186