Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
security.h
00001 /***************************************************************************** 00002 * 00003 * security.h - CC3000 Host Driver Implementation. 00004 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 00013 * Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the 00016 * distribution. 00017 * 00018 * Neither the name of Texas Instruments Incorporated nor the names of 00019 * its contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00026 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00028 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00029 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00030 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 *****************************************************************************/ 00035 #ifndef __SECURITY__ 00036 #define __SECURITY__ 00037 00038 #include "nvmem.h" 00039 00040 //***************************************************************************** 00041 // 00042 // If building with a C++ compiler, make all of the definitions in this header 00043 // have a C binding. 00044 // 00045 //***************************************************************************** 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00050 00051 #define AES128_KEY_SIZE 16 00052 00053 #ifndef CC3000_UNENCRYPTED_SMART_CONFIG 00054 00055 00056 //***************************************************************************** 00057 // 00058 //! aes_encrypt 00059 //! 00060 //! @param[in] key AES128 key of size 16 bytes 00061 //! @param[in\out] state 16 bytes of plain text and cipher text 00062 //! 00063 //! @return none 00064 //! 00065 //! @brief AES128 encryption: 00066 //! Given AES128 key and 16 bytes plain text, cipher text of 16 bytes 00067 //! is computed. The AES implementation is in mode ECB (Electronic 00068 //! Code Book). 00069 //! 00070 //! 00071 //***************************************************************************** 00072 extern void aes_encrypt(unsigned char *state, unsigned char *key); 00073 00074 //***************************************************************************** 00075 // 00076 //! aes_decrypt 00077 //! 00078 //! @param[in] key AES128 key of size 16 bytes 00079 //! @param[in\out] state 16 bytes of cipher text and plain text 00080 //! 00081 //! @return none 00082 //! 00083 //! @brief AES128 decryption: 00084 //! Given AES128 key and 16 bytes cipher text, plain text of 16 bytes 00085 //! is computed The AES implementation is in mode ECB 00086 //! (Electronic Code Book). 00087 //! 00088 //! 00089 //***************************************************************************** 00090 extern void aes_decrypt(unsigned char *state, unsigned char *key); 00091 00092 00093 //***************************************************************************** 00094 // 00095 //! aes_read_key 00096 //! 00097 //! @param[out] key AES128 key of size 16 bytes 00098 //! 00099 //! @return on success 0, error otherwise. 00100 //! 00101 //! @brief Reads AES128 key from EEPROM 00102 //! Reads the AES128 key from fileID #12 in EEPROM 00103 //! returns an error if the key does not exist. 00104 //! 00105 //! 00106 //***************************************************************************** 00107 extern signed long aes_read_key(unsigned char *key); 00108 00109 //***************************************************************************** 00110 // 00111 //! aes_write_key 00112 //! 00113 //! @param[out] key AES128 key of size 16 bytes 00114 //! 00115 //! @return on success 0, error otherwise. 00116 //! 00117 //! @brief writes AES128 key from EEPROM 00118 //! Writes the AES128 key to fileID #12 in EEPROM 00119 //! 00120 //! 00121 //***************************************************************************** 00122 extern signed long aes_write_key(unsigned char *key); 00123 00124 #endif //CC3000_UNENCRYPTED_SMART_CONFIG 00125 00126 #ifdef __cplusplus 00127 } 00128 #endif // __cplusplus 00129 00130 #endif 00131
Generated on Tue Jul 12 2022 19:26:44 by
1.7.2