AESECB.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2018, 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  */
255 #ifndef ti_drivers_AESECB__include
256 #define ti_drivers_AESECB__include
257 
258 #ifdef __cplusplus
259 extern "C" {
260 #endif
261 
262 #include <stdbool.h>
263 #include <stddef.h>
264 #include <stdint.h>
265 
267 
280 #define AESECB_STATUS_RESERVED (-32)
281 
288 #define AESECB_STATUS_SUCCESS (0)
289 
296 #define AESECB_STATUS_ERROR (-1)
297 
306 #define AESECB_STATUS_RESOURCE_UNAVAILABLE (-2)
307 
311 #define AESECB_STATUS_CANCELED (-3)
312 
317 
355 
359 typedef enum AESECB_Mode_ {
362 } AESECB_Mode;
363 
368 typedef struct AESECB_Operation_ {
370  uint8_t *input;
375  uint8_t *output;
381  size_t inputLength;
385 
389 typedef enum AESECB_OperationType_ {
393 
405 typedef struct AESECB_Config_ {
407  void *object;
408 
410  void const *hwAttrs;
411 } AESECB_Config;
412 
428 typedef void (*AESECB_CallbackFxn) (AESECB_Handle handle,
429  int_fast16_t returnValue,
430  AESECB_Operation *operation,
431  AESECB_OperationType operationType);
432 
441 typedef struct AESECB_Params_ {
444  uint32_t timeout;
447  void *custom;
450 } AESECB_Params;
451 
458 
467 void AESECB_init(void);
468 
481 void AESECB_Params_init(AESECB_Params *params);
482 
500 AESECB_Handle AESECB_open(uint_least8_t index, AESECB_Params *params);
501 
511 void AESECB_close(AESECB_Handle handle);
512 
521 void AESECB_Operation_init(AESECB_Operation *operationStruct);
522 
539 int_fast16_t AESECB_oneStepEncrypt(AESECB_Handle handle, AESECB_Operation *operation);
540 
557 int_fast16_t AESECB_oneStepDecrypt(AESECB_Handle handle, AESECB_Operation *operation);
558 
571 int_fast16_t AESECB_cancelOperation(AESECB_Handle handle);
572 
573 #ifdef __cplusplus
574 }
575 #endif
576 
577 #endif /* ti_drivers_AESECB__include */
Struct containing the parameters required for encrypting/decrypting and a message.
Definition: AESECB.h:368
The CryptoKey type is an opaque representation of a cryptographic key.
Definition: AESECB.h:346
struct AESECB_Params_ AESECB_Params
ECB Parameters.
void AESECB_close(AESECB_Handle handle)
Function to close an ECB peripheral specified by the ECB handle.
int_fast16_t AESECB_cancelOperation(AESECB_Handle handle)
Cancels an ongoing AESECB operation.
AESECB Global configuration.
Definition: AESECB.h:405
CryptoKey * key
Definition: AESECB.h:369
Definition: AESECB.h:350
CryptoKey datastructure.
Definition: CryptoKey.h:210
int_fast16_t AESECB_oneStepEncrypt(AESECB_Handle handle, AESECB_Operation *operation)
Function to perform an AESECB encryption operation in one call.
AESECB_ReturnBehavior returnBehavior
Definition: AESECB.h:442
enum AESECB_OperationType_ AESECB_OperationType
Enum for the operation types supported by the driver.
Definition: AESECB.h:390
void * custom
Definition: AESECB.h:447
size_t inputLength
Definition: AESECB.h:381
void const * hwAttrs
Definition: AESECB.h:410
struct AESECB_Config_ * AESECB_Handle
A handle that is returned from an AESECB_open() call.
Definition: AESECB.h:316
void AESECB_init(void)
This function initializes the ECB module.
Definition: AESECB.h:360
void AESECB_Params_init(AESECB_Params *params)
Function to initialize the AESECB_Params struct to its defaults.
void * object
Definition: AESECB.h:407
Definition: AESECB.h:340
enum AESECB_Mode_ AESECB_Mode
Enum for the direction of the ECB operation.
Definition: AESECB.h:391
AESECB_OperationType_
Enum for the operation types supported by the driver.
Definition: AESECB.h:389
uint32_t timeout
Definition: AESECB.h:444
struct AESECB_Config_ AESECB_Config
AESECB Global configuration.
uint8_t * output
Definition: AESECB.h:375
int_fast16_t AESECB_oneStepDecrypt(AESECB_Handle handle, AESECB_Operation *operation)
Function to perform an AESECB decryption in one call.
void AESECB_Operation_init(AESECB_Operation *operationStruct)
Function to initialize an AESECB_Operation struct to its defaults.
enum AESECB_ReturnBehavior_ AESECB_ReturnBehavior
The way in which ECB function calls return after performing an encryption + authentication or decrypt...
void(* AESECB_CallbackFxn)(AESECB_Handle handle, int_fast16_t returnValue, AESECB_Operation *operation, AESECB_OperationType operationType)
The definition of a callback function used by the AESECB driver when used in AESECB_RETURN_BEHAVIOR_C...
Definition: AESECB.h:428
AESECB_Handle AESECB_open(uint_least8_t index, AESECB_Params *params)
This function opens a given ECB peripheral.
AESECB_Mode_
Enum for the direction of the ECB operation.
Definition: AESECB.h:359
const AESECB_Params AESECB_defaultParams
Default AESECB_Params structure.
AESECB_ReturnBehavior_
The way in which ECB function calls return after performing an encryption + authentication or decrypt...
Definition: AESECB.h:339
AESECB_CallbackFxn callbackFxn
Definition: AESECB.h:443
Definition: AESECB.h:361
ECB Parameters.
Definition: AESECB.h:441
uint8_t * input
Definition: AESECB.h:370
struct AESECB_Operation_ AESECB_Operation
Struct containing the parameters required for encrypting/decrypting and a message.
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale