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 
285 #define AESECB_CMD_RESERVED (32)
286 
299 #define AESECB_STATUS_RESERVED (-32)
300 
314 #define AESECB_STATUS_SUCCESS (0)
315 
322 #define AESECB_STATUS_ERROR (-1)
323 
331 #define AESECB_STATUS_UNDEFINEDCMD (-2)
332 
341 #define AESECB_STATUS_RESOURCE_UNAVAILABLE (-3)
342 
355 /* Add AESECB_CMD_<commands> here */
356 
365 
403 
407 typedef enum AESECB_Mode_ {
410 } AESECB_Mode;
411 
416 typedef struct AESECB_Operation_ {
418  uint8_t *input;
423  uint8_t *output;
429  size_t inputLength;
433 
437 typedef enum AESECB_OperationType_ {
441 
453 typedef struct AESECB_Config_ {
455  void *object;
456 
458  void const *hwAttrs;
459 } AESECB_Config;
460 
476 typedef void (*AESECB_CallbackFxn) (AESECB_Handle handle,
477  int_fast16_t returnValue,
478  AESECB_Operation *operation,
479  AESECB_OperationType operationType);
480 
489 typedef struct AESECB_Params_ {
492  uint32_t timeout;
495  void *custom;
498 } AESECB_Params;
499 
506 
515 void AESECB_init(void);
516 
529 void AESECB_Params_init(AESECB_Params *params);
530 
548 AESECB_Handle AESECB_open(uint_least8_t index, AESECB_Params *params);
549 
559 void AESECB_close(AESECB_Handle handle);
560 
598 int_fast16_t AESECB_control(AESECB_Handle handle, uint32_t cmd, void *args);
599 
600 
601 
610 void AESECB_Operation_init(AESECB_Operation *operationStruct);
611 
628 int_fast16_t AESECB_oneStepEncrypt(AESECB_Handle handle, AESECB_Operation *operation);
629 
646 int_fast16_t AESECB_oneStepDecrypt(AESECB_Handle handle, AESECB_Operation *operation);
647 
648 
649 
650 #ifdef __cplusplus
651 }
652 #endif
653 
654 #endif /* ti_drivers_AESECB__include */
Struct containing the parameters required for encrypting/decrypting and a message.
Definition: AESECB.h:416
The CryptoKey type is an opaque representation of a cryptographic key.
Definition: AESECB.h:394
struct AESECB_Params_ AESECB_Params
ECB Parameters.
void AESECB_close(AESECB_Handle handle)
Function to close an ECB peripheral specified by the ECB handle.
AESECB Global configuration.
Definition: AESECB.h:453
CryptoKey * key
Definition: AESECB.h:417
Definition: AESECB.h:398
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:490
enum AESECB_OperationType_ AESECB_OperationType
Enum for the operation types supported by the driver.
Definition: AESECB.h:438
void * custom
Definition: AESECB.h:495
size_t inputLength
Definition: AESECB.h:429
int_fast16_t AESECB_control(AESECB_Handle handle, uint32_t cmd, void *args)
Function performs implementation specific features on a given AESECB_Handle.
void const * hwAttrs
Definition: AESECB.h:458
struct AESECB_Config_ * AESECB_Handle
A handle that is returned from an AESECB_open() call.
Definition: AESECB.h:364
void AESECB_init(void)
This function initializes the ECB module.
Definition: AESECB.h:408
void AESECB_Params_init(AESECB_Params *params)
Function to initialize the AESECB_Params struct to its defaults.
void * object
Definition: AESECB.h:455
Definition: AESECB.h:388
enum AESECB_Mode_ AESECB_Mode
Enum for the direction of the ECB operation.
Definition: AESECB.h:439
AESECB_OperationType_
Enum for the operation types supported by the driver.
Definition: AESECB.h:437
uint32_t timeout
Definition: AESECB.h:492
struct AESECB_Config_ AESECB_Config
AESECB Global configuration.
uint8_t * output
Definition: AESECB.h:423
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:476
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:407
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:387
AESECB_CallbackFxn callbackFxn
Definition: AESECB.h:491
Definition: AESECB.h:409
ECB Parameters.
Definition: AESECB.h:489
uint8_t * input
Definition: AESECB.h:418
struct AESECB_Operation_ AESECB_Operation
Struct containing the parameters required for encrypting/decrypting and a message.
Copyright 2018, Texas Instruments Incorporated