AESCTRDRBGXX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2020, 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 open an instance of the AESCTR driver based on the index
44  * specified in #AESCTRDRBGXX_HWAttrs:aesctrIndex. Mutual exclusion and hardware
45  * access are all handled by the AESCTR driver 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 parameters.
52  * Only values that are likely to have a stochastic element to them are checked (such
53  * as whether a driver is already open). Higher input paramter validation coverage is
54  * achieved by turning on assertions when compiling the driver.
55  */
56 
57 #ifndef ti_drivers_aesctrdrbg_AESCTRDRBGXX__include
58 #define ti_drivers_aesctrdrbg_AESCTRDRBGXX__include
59 
60 #include <stdint.h>
61 #include <stdbool.h>
62 
63 #include <ti/drivers/AESCTRDRBG.h>
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
78 #ifndef AESCTRDRBG_MAX_KEY_LENGTH
79  #define AESCTRDRBG_MAX_KEY_LENGTH AESCTRDRBG_AES_KEY_LENGTH_256
80 #endif
81 
83 #define AESCTRDRBG_MAX_SEED_LENGTH (AESCTRDRBG_MAX_KEY_LENGTH + AESCTRDRBG_AES_BLOCK_SIZE_BYTES)
84 
91 typedef struct {
92  uint_least8_t aesctrIndex;
94 
100 typedef struct {
101  uint8_t keyingMaterial[AESCTRDRBG_AES_KEY_LENGTH_256];
105  size_t seedLength;
106  uint32_t reseedCounter;
107  uint32_t reseedInterval;
108  int_fast16_t returnStatus;
109  bool isOpen;
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif /* ti_drivers_aesctrdrbg_AESCTRDRBGXX__include */
#define AESCTRDRBG_AES_BLOCK_SIZE_BYTES
The AES block size in bytes.
Definition: AESCTRDRBG.h:345
CryptoKey key
Definition: AESCTRDRBGXX.h:103
int_fast16_t returnStatus
Definition: AESCTRDRBGXX.h:108
AESCTR Global configuration.
Definition: AESCTR.h:450
CryptoKey datastructure.
Definition: CryptoKey.h:209
AESCTRDRBGXX Hardware Attributes.
Definition: AESCTRDRBGXX.h:91
AESCTR_Handle ctrHandle
Definition: AESCTRDRBGXX.h:104
uint32_t reseedCounter
Definition: AESCTRDRBGXX.h:106
size_t seedLength
Definition: AESCTRDRBGXX.h:105
AESCTRDRBGXX Object.
Definition: AESCTRDRBGXX.h:100
uint32_t reseedInterval
Definition: AESCTRDRBGXX.h:107
bool isInstantiated
Definition: AESCTRDRBGXX.h:110
bool isOpen
Definition: AESCTRDRBGXX.h:109
uint_least8_t aesctrIndex
Definition: AESCTRDRBGXX.h:92
AESCTRDRBG driver header.
Definition: AESCTRDRBG.h:352
© Copyright 1995-2021, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale