AESECB.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, 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  */
256 #ifndef ti_drivers_AESECB__include
257 #define ti_drivers_AESECB__include
258 
259 #ifdef __cplusplus
260 extern "C" {
261 #endif
262 
263 #include <stdbool.h>
264 #include <stddef.h>
265 #include <stdint.h>
266 
268 
286 #define AESECB_CMD_RESERVED (32)
287 
300 #define AESECB_STATUS_RESERVED (-32)
301 
315 #define AESECB_STATUS_SUCCESS (0)
316 
323 #define AESECB_STATUS_ERROR (-1)
324 
332 #define AESECB_STATUS_UNDEFINEDCMD (-2)
333 
342 #define AESECB_STATUS_RESOURCE_UNAVAILABLE (-3)
343 
356 /* Add AESECB_CMD_<commands> here */
357 
366 
404 
408 typedef enum AESECB_Mode_ {
411 } AESECB_Mode;
412 
417 typedef struct AESECB_Operation_ {
419  uint8_t *input;
424  uint8_t *output;
430  size_t inputLength;
434 
438 typedef enum AESECB_OperationType_ {
442 
454 typedef struct AESECB_Config_ {
456  void *object;
457 
459  void const *hwAttrs;
460 } AESECB_Config;
461 
470 typedef void (*AESECB_CallbackFxn) (AESECB_Handle handle,
471  int_fast16_t returnValue,
472  AESECB_Operation *operation,
473  AESECB_OperationType operationType);
474 
483 typedef struct AESECB_Params_ {
486  uint32_t timeout;
489  void *custom;
492 } AESECB_Params;
493 
500 
509 void AESECB_init(void);
510 
523 void AESECB_Params_init(AESECB_Params *params);
524 
542 AESECB_Handle AESECB_open(uint_least8_t index, AESECB_Params *params);
543 
553 void AESECB_close(AESECB_Handle handle);
554 
592 int_fast16_t AESECB_control(AESECB_Handle handle, uint32_t cmd, void *args);
593 
594 
595 
604 void AESECB_Operation_init(AESECB_Operation *operationStruct);
605 
622 int_fast16_t AESECB_oneStepEncrypt(AESECB_Handle handle, AESECB_Operation *operation);
623 
640 int_fast16_t AESECB_oneStepDecrypt(AESECB_Handle handle, AESECB_Operation *operation);
641 
642 
643 
644 #ifdef __cplusplus
645 }
646 #endif
647 
648 #endif /* ti_drivers_AESECB__include */
Struct containing the parameters required for encrypting/decrypting and a message.
Definition: AESECB.h:417
The CryptoKey type is an opaque representation of a cryptographic key.
Definition: AESECB.h:395
struct AESECB_Params_ AESECB_Params
ECB Parameters.
void AESECB_close(AESECB_Handle handle)
Function to close a ECB peripheral specified by the ECB handle.
AESECB Global configuration.
Definition: AESECB.h:454
CryptoKey * key
Definition: AESECB.h:418
Definition: AESECB.h:399
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:484
enum AESECB_OperationType_ AESECB_OperationType
Enum for the operation types supported by the driver.
Definition: AESECB.h:439
void * custom
Definition: AESECB.h:489
size_t inputLength
Definition: AESECB.h:430
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:459
struct AESECB_Config_ * AESECB_Handle
A handle that is returned from an AESECB_open() call.
Definition: AESECB.h:365
void AESECB_init(void)
This function initializes the ECB module.
Definition: AESECB.h:409
void AESECB_Params_init(AESECB_Params *params)
Function to initialize the AESECB_Params struct to its defaults.
void * object
Definition: AESECB.h:456
Definition: AESECB.h:389
enum AESECB_Mode_ AESECB_Mode
Enum for the direction of the ECB operation.
Definition: AESECB.h:440
AESECB_OperationType_
Enum for the operation types supported by the driver.
Definition: AESECB.h:438
uint32_t timeout
Definition: AESECB.h:486
struct AESECB_Config_ AESECB_Config
AESECB Global configuration.
uint8_t * output
Definition: AESECB.h:424
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 a 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:470
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:408
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:388
AESECB_CallbackFxn callbackFxn
Definition: AESECB.h:485
Definition: AESECB.h:410
ECB Parameters.
Definition: AESECB.h:483
uint8_t * input
Definition: AESECB.h:419
struct AESECB_Operation_ AESECB_Operation
Struct containing the parameters required for encrypting/decrypting and a message.
Copyright 2017, Texas Instruments Incorporated