AESCTRDRBGX4_s.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022-2023, Texas Instruments Incorporated - https://www.ti.com
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 #ifndef ti_drivers_aesctrdrbg_AESCTRDRBGX4_s__include
34 #define ti_drivers_aesctrdrbg_AESCTRDRBGX4_s__include
35 
36 #include <stdint.h>
37 
39 #include <ti/drivers/AESCTRDRBG.h>
40 
41 #include <third_party/tfm/interface/include/psa/error.h>
42 #include <third_party/tfm/interface/include/psa/service.h>
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /*
49  * AES CTR DRBG secure message types
50  *
51  * The underlying AES CTR DRBG driver does not support callback return behavior,
52  * therefore this secure service can only support polling mode. If the non-secure
53  * client specifies blocking mode, polling mode will be automatically substituted.
54  */
55 #define AESCTRDRBG_S_MSG_TYPE_CONSTRUCT AESCTRDRBG_S_MSG_TYPE(0U)
56 #define AESCTRDRBG_S_MSG_TYPE_OPEN AESCTRDRBG_S_MSG_TYPE(1U)
57 #define AESCTRDRBG_S_MSG_TYPE_CLOSE AESCTRDRBG_S_MSG_TYPE(2U)
58 #define AESCTRDRBG_S_MSG_TYPE_RESEED AESCTRDRBG_S_MSG_TYPE(3U)
59 #define AESCTRDRBG_S_MSG_TYPE_GET_RANDOM_BYTES AESCTRDRBG_S_MSG_TYPE(4U)
60 #define AESCTRDRBG_S_MSG_TYPE_GENERATE_KEY AESCTRDRBG_S_MSG_TYPE(5U)
61 
62 /*
63  * Config pool size determines how many dynamic driver instances can be created
64  * by the non-secure client using AESCTRDRBG_construct().
65  */
66 #ifndef CONFIG_AESCTRDRBG_S_CONFIG_POOL_SIZE
67  #define CONFIG_AESCTRDRBG_S_CONFIG_POOL_SIZE 1
68 #endif
69 
70 /*
71  * ========= AES CTR DRBG Secure Message Structs =========
72  * These secure message structs correspond to the secure message types defined
73  * above. Together, they are used by non-secure client to make PSA calls to the
74  * AES CTR DRBG secure service. There is a single input vector for the PSA call
75  * which is a pointer to secure message struct. If the underlying function
76  * has a return value, there is a single output vector which is a pointer to
77  * storage for the return value.
78  */
79 typedef struct
80 {
84 
85 typedef struct
86 {
87  uint_least8_t index;
90 
91 typedef struct
92 {
95 
96 typedef struct
97 {
99  const void *seed;
100  const void *additionalData;
103 
104 typedef struct
105 {
107  void *randomBytes;
110 
111 typedef struct
112 {
116 
127 psa_status_t AESCTRDRBG_s_handlePsaMsg(psa_msg_t *msg);
128 
134 void AESCTRDRBG_s_init(void);
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif /* ti_drivers_aesctrdrbg_AESCTRDRBGX4_s__include */
AESCTRDRBG_Handle handle
Definition: AESCTRDRBGX4_s.h:113
size_t additionalDataLength
Definition: AESCTRDRBGX4_s.h:101
const void * additionalData
Definition: AESCTRDRBGX4_s.h:100
AESCTRDRBG_Handle handle
Definition: AESCTRDRBGX4_s.h:93
const AESCTRDRBG_Params * params
Definition: AESCTRDRBGX4_s.h:82
psa_status_t AESCTRDRBG_s_handlePsaMsg(psa_msg_t *msg)
Handles PSA messages for AES CTR DRBG secure driver.
AES Global configuration.
Definition: AESCommon.h:154
void AESCTRDRBG_s_init(void)
Initializes the AES CTR DRBG secure driver.
CryptoKey datastructure.
Definition: CryptoKey.h:196
const void * seed
Definition: AESCTRDRBGX4_s.h:99
Secure Crypto Service.
void * randomBytes
Definition: AESCTRDRBGX4_s.h:107
Definition: AESCTRDRBGX4_s.h:104
AESCTRDRBG Parameters.
Definition: AESCTRDRBG.h:442
Definition: AESCTRDRBGX4_s.h:85
Definition: AESCTRDRBGX4_s.h:111
Definition: AESCTRDRBGX4_s.h:91
Definition: AESCTRDRBGX4_s.h:96
AESCTRDRBG driver header.
uint_least8_t index
Definition: AESCTRDRBGX4_s.h:87
size_t randomBytesSize
Definition: AESCTRDRBGX4_s.h:108
const AESCTRDRBG_Params * params
Definition: AESCTRDRBGX4_s.h:88
AESCTRDRBG_Handle handle
Definition: AESCTRDRBGX4_s.h:106
CryptoKey * randomKey
Definition: AESCTRDRBGX4_s.h:114
AESCTRDRBG_Config * config
Definition: AESCTRDRBGX4_s.h:81
AESCTRDRBG_Handle handle
Definition: AESCTRDRBGX4_s.h:98
Definition: AESCTRDRBGX4_s.h:79
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale