AESCTRDRBGXX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, 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  * @warning This is a beta API. It may change in future releases.
38  *
39  * This file should only be included in the board file to fill the AESCTR_config
40  * struct.
41  *
42  * # Use of AESCTR #
43  * This implementation uses the AESCTR driver to generate the random bitstream
44  * required to mutate the internal AESCTRDRBG state and provide random output
45  * bits. The driver will open an instance of the AESCTR driver based on the index
46  * specified in #AESCTRDRBGXX_HWAttrs:aesctrIndex. Mutual exclusion and hardware
47  * access are all handled by the AESCTR driver instance.
48  *
49  * # Implementation Limitations
50  * - Only plaintext CryptoKeys are supported by this implementation.
51  *
52  * # Runtime Parameter Validation #
53  * The driver implementation does not perform runtime checks for most input parameters.
54  * Only values that are likely to have a stochastic element to them are checked (such
55  * as whether a driver is already open). Higher input paramter validation coverage is
56  * achieved by turning on assertions when compiling the driver.
57  */
58 
59 #ifndef ti_drivers_aesctrdrbg_AESCTRDRBGXX__include
60 #define ti_drivers_aesctrdrbg_AESCTRDRBGXX__include
61 
62 #include <stdint.h>
63 #include <stdbool.h>
64 
65 #include <ti/drivers/AESCTRDRBG.h>
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
80 #ifndef AESCTRDRBG_MAX_KEY_LENGTH
81  #define AESCTRDRBG_MAX_KEY_LENGTH AESCTRDRBG_AES_KEY_LENGTH_256
82 #endif
83 
85 #define AESCTRDRBG_MAX_SEED_LENGTH (AESCTRDRBG_MAX_KEY_LENGTH + AESCTRDRBG_AES_BLOCK_SIZE_BYTES)
86 
93 typedef struct {
94  uint_least8_t aesctrIndex;
96 
102 typedef struct {
103  uint8_t keyingMaterial[AESCTRDRBG_AES_KEY_LENGTH_256];
107  size_t seedLength;
108  uint32_t reseedCounter;
109  uint32_t reseedInterval;
110  int_fast16_t returnStatus;
111  bool isOpen;
113 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif /* ti_drivers_aesctrdrbg_AESCTRDRBGXX__include */
#define AESCTRDRBG_AES_BLOCK_SIZE_BYTES
The AES block size in bytes.
Definition: AESCTRDRBG.h:301
CryptoKey key
Definition: AESCTRDRBGXX.h:105
int_fast16_t returnStatus
Definition: AESCTRDRBGXX.h:110
AESCTR Global configuration.
Definition: AESCTR.h:452
CryptoKey datastructure.
Definition: CryptoKey.h:210
AESCTRDRBGXX Hardware Attributes.
Definition: AESCTRDRBGXX.h:93
AESCTR_Handle ctrHandle
Definition: AESCTRDRBGXX.h:106
uint32_t reseedCounter
Definition: AESCTRDRBGXX.h:108
size_t seedLength
Definition: AESCTRDRBGXX.h:107
AESCTRDRBGXX Object.
Definition: AESCTRDRBGXX.h:102
uint32_t reseedInterval
Definition: AESCTRDRBGXX.h:109
bool isOpen
Definition: AESCTRDRBGXX.h:111
uint_least8_t aesctrIndex
Definition: AESCTRDRBGXX.h:94
AESCTRDRBG driver header.
Definition: AESCTRDRBG.h:308
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale