CryptoKeyKeyStore_PSA_helpers.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022-2023, 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  */
32 
33 /*!*****************************************************************************
34  * @file CryptoKeyKeyStore_PSA_helpers.h
35  * @brief CryptoKeyKeyStore driver header
36  *
37  * @anchor ti_drivers_cryptoutils_cryptokey_CryptoKeyKeyStore_PSA_helpers_Overview
38  * # Overview
39  * The CryptoKeyKeyStore driver provides API to initialize keys and get plaintext
40  * keys from KeyStore. This file provides definitions that are only available to the
41  * the secure side, in both TF-M disabled and TF-M enabled environments.
42  *
43  *******************************************************************************
44  */
45 
46 #ifndef ti_drivers_cryptoutils_cryptokey_CryptoKeyKeyStore_PSA_helpers__include
47 #define ti_drivers_cryptoutils_cryptokey_CryptoKeyKeyStore_PSA_helpers__include
48 
49 #include <stddef.h>
50 #include <stdint.h>
51 
53 
54 #include <ti/drivers/dpl/SemaphoreP.h>
55 
56 #include <third_party/mbedcrypto/library/psa_crypto_core.h>
57 #include <third_party/mbedcrypto/library/psa_crypto_slot_management.h>
58 #include <third_party/mbedcrypto/library/psa_crypto_storage.h>
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
69 typedef struct
70 {
71  SemaphoreP_Struct KeyStore_accessSemaphore;
73  bool isAcquired;
75 
77 
78 #define FLETCHER_CHECKSUM_ALGORITHM 32 /* FLETCHER-32 */
79 
111  uint8_t *data,
112  size_t dataSize,
113  size_t *dataLength,
115  KeyStore_PSA_KeyUsage usage);
116 
132 int_fast16_t KeyStore_PSA_init(void);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif /* ti_drivers_cryptoutils_cryptokey_CryptoKeyKeyStore_PSA_helpers__include */
psa_key_usage_t KeyStore_PSA_KeyUsage
Encoding of permitted usage on a key.
Definition: CryptoKeyKeyStore_PSA.h:124
Definition: CryptoKeyKeyStore_PSA_helpers.h:69
CryptoKeyKeyStore_PSA driver header.
psa_key_file_id_t KeyStore_PSA_KeyFileId
Definition: CryptoKeyKeyStore_PSA.h:762
KeyStore_accessSemaphoreObject KeyStore_semaphoreObject
psa_algorithm_t KeyStore_PSA_Algorithm
Encoding of a cryptographic algorithm.
Definition: CryptoKeyKeyStore_PSA.h:440
SemaphoreP_Struct KeyStore_accessSemaphore
Definition: CryptoKeyKeyStore_PSA_helpers.h:71
int_fast16_t KeyStore_PSA_getKey(KeyStore_PSA_KeyFileId key, uint8_t *data, size_t dataSize, size_t *dataLength, KeyStore_PSA_Algorithm alg, KeyStore_PSA_KeyUsage usage)
Get the plaintext key in binary format.
bool isAcquired
Definition: CryptoKeyKeyStore_PSA_helpers.h:73
bool isInitialized
Definition: CryptoKeyKeyStore_PSA_helpers.h:72
int_fast16_t KeyStore_PSA_init(void)
Initialize the Key Store.
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale