AESCTRDRBGXX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-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  * @file AESCTRDRBGXX.h
34  *
35  * @brief Generic AESCTRDRBG implementation based on the AESCTR driver
36  *
37  * This file should only be included in the board file to fill the AESCTR_config
38  * struct.
39  *
40  * # Use of AESCTR #
41  * This implementation uses the AESCTR driver to generate the random bitstream
42  * required to mutate the internal AESCTRDRBG state and provide random output
43  * bits. The driver will construct a dynamic instance of the AESCTR driver.
44  * Mutual exclusion and hardware access are all handled by the AESCTR driver
45  * instance.
46  *
47  * # Implementation Limitations
48  * - Only plaintext CryptoKeys are supported by this implementation.
49  *
50  * # Runtime Parameter Validation #
51  * The driver implementation does not perform runtime checks for most input
52  * parameters. Only values that are likely to have a stochastic element to them
53  * are checked (such as whether a driver is already open). Higher input
54  * parameter validation coverage is achieved by turning on assertions when
55  * compiling the driver.
56  */
57 
58 #ifndef ti_drivers_aesctrdrbg_AESCTRDRBGXX__include
59 #define ti_drivers_aesctrdrbg_AESCTRDRBGXX__include
60 
61 #include <stdint.h>
62 #include <stdbool.h>
63 
64 #include <ti/drivers/AESCTRDRBG.h>
65 #include <ti/devices/DeviceFamily.h>
66 #include DeviceFamily_constructPath(driverlib/aes.h)
67 
68 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC23X0)
70 #else
71  #include <ti/drivers/aesctr/AESCTRCC26XX.h>
72 #endif
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
87 #ifndef AESCTRDRBG_MAX_KEY_LENGTH
88  #define AESCTRDRBG_MAX_KEY_LENGTH AESCTRDRBG_AES_KEY_LENGTH_256
89 #endif
90 
92 #define AESCTRDRBG_MAX_SEED_LENGTH (AESCTRDRBG_MAX_KEY_LENGTH + AESCTRDRBG_AES_BLOCK_SIZE_BYTES)
93 
94 #if (ENABLE_KEY_STORAGE == 1) || (TFM_ENABLED == 1)
95 
96  #define AESCTRDRBG_MAX_KEYSTORE_KEY_SIZE 64
97 #endif
98 
105 typedef struct
106 {
107  /*
108  * Priority in HWAttrs will be passed to AESCTR instance upon construct
109  */
110 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC23X0)
112 #else
113  AESCTRCC26XX_HWAttrs aesctrHWAttrs;
114 #endif
116 
122 typedef struct
123 {
124  uint8_t keyingMaterial[AESCTRDRBG_AES_KEY_LENGTH_256];
126 #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC23X0)
128 #else
129  AESCTRCC26XX_Object aesctrObject;
130 #endif
134  size_t seedLength;
135  uint32_t reseedCounter;
136  uint32_t reseedInterval;
137  int_fast16_t returnStatus;
138  bool isOpen;
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif /* ti_drivers_aesctrdrbg_AESCTRDRBGXX__include */
AESCTRLPF3_HWAttrs aesctrHWAttrs
Definition: AESCTRDRBGXX.h:111
#define AESCTRDRBG_AES_BLOCK_SIZE_BYTES
The AES block size in bytes.
Definition: AESCTRDRBG.h:362
CryptoKey key
Definition: AESCTRDRBGXX.h:133
int_fast16_t returnStatus
Definition: AESCTRDRBGXX.h:137
AES Global configuration.
Definition: AESCommon.h:154
CryptoKey datastructure.
Definition: CryptoKey.h:192
AESCTRDRBGXX Hardware Attributes.
Definition: AESCTRDRBGXX.h:105
AESCTR_Handle ctrHandle
Definition: AESCTRDRBGXX.h:132
uint32_t reseedCounter
Definition: AESCTRDRBGXX.h:135
AESCTRLPF3 Object.
Definition: AESCTRLPF3.h:114
size_t seedLength
Definition: AESCTRDRBGXX.h:134
AESCTRDRBGXX Object.
Definition: AESCTRDRBGXX.h:122
uint32_t reseedInterval
Definition: AESCTRDRBGXX.h:136
AESCTRLPF3_Object aesctrObject
Definition: AESCTRDRBGXX.h:127
bool isInstantiated
Definition: AESCTRDRBGXX.h:139
bool isOpen
Definition: AESCTRDRBGXX.h:138
AESCommonLPF3 Hardware Attributes.
Definition: AESCommonLPF3.h:80
AESCTRDRBG driver header.
AESCTR_Config ctrConfig
Definition: AESCTRDRBGXX.h:131
AESCTR driver implementation for the Low Power F3 family.
Definition: AESCTRDRBG.h:370
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale