CryptoKey.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
84 #ifndef ti_drivers_cryptoutils_cyptokey_CryptoKey__include
85 #define ti_drivers_cryptoutils_cyptokey_CryptoKey__include
86 
87 #ifdef __cplusplus
88 extern "C" {
89 #endif
90 
91 #include <stdint.h>
92 #include <stdbool.h>
93 
117 #define CryptoKey_STATUS_RESERVED (-32)
118 
132 #define CryptoKey_STATUS_SUCCESS (0)
133 
140 #define CryptoKey_STATUS_ERROR (-1)
141 
148 #define CryptoKey_STATUS_UNDEFINED_ENCODING (-2)
149 
150 
159 typedef enum CryptoKey_Encoding_ {
167 
174 typedef struct CryptoKey_Plaintext_ {
175  uint8_t *keyMaterial;
176  uint16_t keyLength;
178 
185 typedef struct CryptoKey_KeyStore_ {
186  void* keyStore;
187  uint16_t keyLength;
188  uint32_t keyIndex;
190 
197 typedef struct CryptoKey_KeyBlob_ {
198  uint8_t *keyBlob;
199  uint32_t keyBlobLength;
201 
210 typedef struct CryptoKey_ {
212  union {
216  } u;
217 } CryptoKey;
218 
219 
230 typedef struct CryptoKey_SecurityPolicy_ CryptoKey_SecurityPolicy;
231 
240 int_fast16_t CryptoKey_getCryptoKeyType(CryptoKey *keyHandle, CryptoKey_Encoding *keyType);
241 
250 int_fast16_t CryptoKey_isBlank(CryptoKey *keyHandle, bool *isBlank);
251 
261 int_fast16_t CryptoKey_markAsBlank(CryptoKey *keyHandle);
262 
273 
274 #ifdef __cplusplus
275 }
276 #endif
277 
278 #endif /* ti_drivers_cryptoutils_cyptokey_CryptoKey__include */
Definition: CryptoKey.h:160
Keyblob CryptoKey datastructure.
Definition: CryptoKey.h:197
uint32_t keyIndex
Definition: CryptoKey.h:188
Definition: CryptoKey.h:163
CryptoKey_Encoding_
List of the different types of CryptoKey.
Definition: CryptoKey.h:159
CryptoKey datastructure.
Definition: CryptoKey.h:210
uint8_t * keyMaterial
Definition: CryptoKey.h:175
CryptoKey_KeyBlob keyBlob
Definition: CryptoKey.h:215
Definition: CryptoKey.h:165
uint16_t keyLength
Definition: CryptoKey.h:176
Definition: CryptoKey.h:161
Definition: CryptoKey.h:164
int_fast16_t CryptoKey_getCryptoKeyType(CryptoKey *keyHandle, CryptoKey_Encoding *keyType)
Gets the key type of the CryptoKey.
struct CryptoKey_Plaintext_ CryptoKey_Plaintext
Plaintext CryptoKey datastructure.
struct CryptoKey_KeyStore_ CryptoKey_KeyStore
Key store CryptoKey datastructure.
Definition: CryptoKey.h:162
enum CryptoKey_Encoding_ CryptoKey_Encoding
List of the different types of CryptoKey.
struct CryptoKey_KeyBlob_ CryptoKey_KeyBlob
Keyblob CryptoKey datastructure.
int_fast16_t CryptoKey_markAsBlank(CryptoKey *keyHandle)
Marks a CryptoKey as &#39;blank&#39;.
void * keyStore
Definition: CryptoKey.h:186
Plaintext CryptoKey datastructure.
Definition: CryptoKey.h:174
uint32_t keyBlobLength
Definition: CryptoKey.h:199
struct CryptoKey_ CryptoKey
CryptoKey datastructure.
CryptoKey_Encoding encoding
Definition: CryptoKey.h:211
CryptoKey_KeyStore keyStore
Definition: CryptoKey.h:214
Key store CryptoKey datastructure.
Definition: CryptoKey.h:185
uint8_t * keyBlob
Definition: CryptoKey.h:198
int_fast16_t CryptoKey_initSecurityPolicy(CryptoKey_SecurityPolicy *policy)
Function to initialize the CryptoKey_SecurityPolicy struct to its defaults.
int_fast16_t CryptoKey_isBlank(CryptoKey *keyHandle, bool *isBlank)
Wheather the CryptoKey is &#39;blank&#39; or represents valid keying material.
uint16_t keyLength
Definition: CryptoKey.h:187
struct CryptoKey_SecurityPolicy_ CryptoKey_SecurityPolicy
Structure that specifies the restrictions on a CryptoKey.
Definition: CryptoKey.h:230
CryptoKey_Plaintext plaintext
Definition: CryptoKey.h:213
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale