AESCBC.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 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  */
316 #ifndef ti_drivers_AESCBC__include
317 #define ti_drivers_AESCBC__include
318 
319 #ifdef __cplusplus
320 extern "C" {
321 #endif
322 
323 #include <stdbool.h>
324 #include <stddef.h>
325 #include <stdint.h>
326 
328 
346 #define AESCBC_CMD_RESERVED (32)
347 
360 #define AESCBC_STATUS_RESERVED (-32)
361 
375 #define AESCBC_STATUS_SUCCESS (0)
376 
383 #define AESCBC_STATUS_ERROR (-1)
384 
392 #define AESCBC_STATUS_UNDEFINEDCMD (-2)
393 
402 #define AESCBC_STATUS_RESOURCE_UNAVAILABLE (-3)
403 
416 /* Add AESCBC_CMD_<commands> here */
417 
426 
464 
468 typedef enum AESCBC_Mode_ {
471 } AESCBC_Mode;
472 
477 typedef struct AESCBC_Operation_ {
479  const uint8_t *input;
484  uint8_t *output;
490  uint8_t *iv;
496  size_t inputLength;
502 
506 typedef enum AESCBC_OperationType_ {
510 
522 typedef struct AESCBC_Config_ {
524  void *object;
525 
527  void const *hwAttrs;
528 } AESCBC_Config;
529 
545 typedef void (*AESCBC_CallbackFxn) (AESCBC_Handle handle,
546  int_fast16_t returnValue,
547  AESCBC_Operation *operation,
548  AESCBC_OperationType operationType);
549 
558 typedef struct AESCBC_Params_ {
561  uint32_t timeout;
564  void *custom;
567 } AESCBC_Params;
568 
575 
584 void AESCBC_init(void);
585 
598 void AESCBC_Params_init(AESCBC_Params *params);
599 
617 AESCBC_Handle AESCBC_open(uint_least8_t index, AESCBC_Params *params);
618 
628 void AESCBC_close(AESCBC_Handle handle);
629 
667 int_fast16_t AESCBC_control(AESCBC_Handle handle, uint32_t cmd, void *args);
668 
677 void AESCBC_Operation_init(AESCBC_Operation *operationStruct);
678 
695 int_fast16_t AESCBC_oneStepEncrypt(AESCBC_Handle handle, AESCBC_Operation *operationStruct);
696 
713 int_fast16_t AESCBC_oneStepDecrypt(AESCBC_Handle handle, AESCBC_Operation *operationStruct);
714 
715 #ifdef __cplusplus
716 }
717 #endif
718 
719 #endif /* ti_drivers_AESCBC__include */
AESCBC_OperationType_
Enum for the operation types supported by the driver.
Definition: AESCBC.h:506
AESCBC_Mode_
Enum for the direction of the CBC operation.
Definition: AESCBC.h:468
Definition: AESCBC.h:459
Definition: AESCBC.h:470
const AESCBC_Params AESCBC_defaultParams
Default AESCBC_Params structure.
uint8_t * iv
Definition: AESCBC.h:490
The CryptoKey type is an opaque representation of a cryptographic key.
struct AESCBC_Config_ * AESCBC_Handle
A handle that is returned from an AESCBC_open() call.
Definition: AESCBC.h:425
void(* AESCBC_CallbackFxn)(AESCBC_Handle handle, int_fast16_t returnValue, AESCBC_Operation *operation, AESCBC_OperationType operationType)
The definition of a callback function used by the AESCBC driver when used in AESCBC_RETURN_BEHAVIOR_C...
Definition: AESCBC.h:545
AESCBC_ReturnBehavior returnBehavior
Definition: AESCBC.h:559
CryptoKey datastructure.
Definition: CryptoKey.h:210
Definition: AESCBC.h:507
struct AESCBC_Config_ AESCBC_Config
AESCBC Global configuration.
Definition: AESCBC.h:449
Definition: AESCBC.h:508
Definition: AESCBC.h:455
struct AESCBC_Operation_ AESCBC_Operation
Struct containing the parameters required for encrypting/decrypting a message.
CryptoKey * key
Definition: AESCBC.h:478
int_fast16_t AESCBC_oneStepDecrypt(AESCBC_Handle handle, AESCBC_Operation *operationStruct)
Function to perform an AESCBC decryption operation in one call.
void AESCBC_close(AESCBC_Handle handle)
Function to close a CBC peripheral specified by the CBC handle.
size_t inputLength
Definition: AESCBC.h:496
enum AESCBC_OperationType_ AESCBC_OperationType
Enum for the operation types supported by the driver.
AESCBC_ReturnBehavior_
The way in which CBC function calls return after performing an encryption or decryption operation...
Definition: AESCBC.h:448
const uint8_t * input
Definition: AESCBC.h:479
void AESCBC_init(void)
This function initializes the CBC module.
AESCBC Global configuration.
Definition: AESCBC.h:522
AESCBC_CallbackFxn callbackFxn
Definition: AESCBC.h:560
void const * hwAttrs
Definition: AESCBC.h:527
uint32_t timeout
Definition: AESCBC.h:561
void AESCBC_Operation_init(AESCBC_Operation *operationStruct)
Function to initialize an AESCBC_Operation struct to its defaults.
Struct containing the parameters required for encrypting/decrypting a message.
Definition: AESCBC.h:477
bool ivInternallyGenerated
Definition: AESCBC.h:497
enum AESCBC_Mode_ AESCBC_Mode
Enum for the direction of the CBC operation.
void * custom
Definition: AESCBC.h:564
struct AESCBC_Params_ AESCBC_Params
CBC Parameters.
Definition: AESCBC.h:469
enum AESCBC_ReturnBehavior_ AESCBC_ReturnBehavior
The way in which CBC function calls return after performing an encryption or decryption operation...
CBC Parameters.
Definition: AESCBC.h:558
AESCBC_Handle AESCBC_open(uint_least8_t index, AESCBC_Params *params)
This function opens a given CBC peripheral.
int_fast16_t AESCBC_oneStepEncrypt(AESCBC_Handle handle, AESCBC_Operation *operationStruct)
Function to perform an AESCBC encryption operation in one call.
int_fast16_t AESCBC_control(AESCBC_Handle handle, uint32_t cmd, void *args)
Function performs implementation specific features on a given AESCBC_Handle.
void * object
Definition: AESCBC.h:524
void AESCBC_Params_init(AESCBC_Params *params)
Function to initialize the AESCBC_Params struct to its defaults.
uint8_t * output
Definition: AESCBC.h:484
Copyright 2018, Texas Instruments Incorporated