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 
341 #define AESCBC_STATUS_RESERVED (-32)
342 
349 #define AESCBC_STATUS_SUCCESS (0)
350 
357 #define AESCBC_STATUS_ERROR (-1)
358 
367 #define AESCBC_STATUS_RESOURCE_UNAVAILABLE (-2)
368 
372 #define AESCBC_STATUS_CANCELED (-3)
373 
374 
379 
417 
421 typedef enum AESCBC_Mode_ {
424 } AESCBC_Mode;
425 
430 typedef struct AESCBC_Operation_ {
432  const uint8_t *input;
437  uint8_t *output;
443  uint8_t *iv;
449  size_t inputLength;
455 
459 typedef enum AESCBC_OperationType_ {
463 
475 typedef struct AESCBC_Config_ {
477  void *object;
478 
480  void const *hwAttrs;
481 } AESCBC_Config;
482 
498 typedef void (*AESCBC_CallbackFxn) (AESCBC_Handle handle,
499  int_fast16_t returnValue,
500  AESCBC_Operation *operation,
501  AESCBC_OperationType operationType);
502 
511 typedef struct AESCBC_Params_ {
514  uint32_t timeout;
517  void *custom;
520 } AESCBC_Params;
521 
528 
537 void AESCBC_init(void);
538 
551 void AESCBC_Params_init(AESCBC_Params *params);
552 
570 AESCBC_Handle AESCBC_open(uint_least8_t index, AESCBC_Params *params);
571 
581 void AESCBC_close(AESCBC_Handle handle);
582 
591 void AESCBC_Operation_init(AESCBC_Operation *operationStruct);
592 
609 int_fast16_t AESCBC_oneStepEncrypt(AESCBC_Handle handle, AESCBC_Operation *operationStruct);
610 
627 int_fast16_t AESCBC_oneStepDecrypt(AESCBC_Handle handle, AESCBC_Operation *operationStruct);
628 
641 int_fast16_t AESCBC_cancelOperation(AESCBC_Handle handle);
642 
643 #ifdef __cplusplus
644 }
645 #endif
646 
647 #endif /* ti_drivers_AESCBC__include */
AESCBC_OperationType_
Enum for the operation types supported by the driver.
Definition: AESCBC.h:459
AESCBC_Mode_
Enum for the direction of the CBC operation.
Definition: AESCBC.h:421
Definition: AESCBC.h:412
Definition: AESCBC.h:423
const AESCBC_Params AESCBC_defaultParams
Default AESCBC_Params structure.
uint8_t * iv
Definition: AESCBC.h:443
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:378
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:498
AESCBC_ReturnBehavior returnBehavior
Definition: AESCBC.h:512
int_fast16_t AESCBC_cancelOperation(AESCBC_Handle handle)
Cancels an ongoing AESCBC operation.
CryptoKey datastructure.
Definition: CryptoKey.h:210
Definition: AESCBC.h:460
struct AESCBC_Config_ AESCBC_Config
AESCBC Global configuration.
Definition: AESCBC.h:402
Definition: AESCBC.h:461
Definition: AESCBC.h:408
struct AESCBC_Operation_ AESCBC_Operation
Struct containing the parameters required for encrypting/decrypting a message.
CryptoKey * key
Definition: AESCBC.h:431
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:449
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:401
const uint8_t * input
Definition: AESCBC.h:432
void AESCBC_init(void)
This function initializes the CBC module.
AESCBC Global configuration.
Definition: AESCBC.h:475
AESCBC_CallbackFxn callbackFxn
Definition: AESCBC.h:513
void const * hwAttrs
Definition: AESCBC.h:480
uint32_t timeout
Definition: AESCBC.h:514
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:430
bool ivInternallyGenerated
Definition: AESCBC.h:450
enum AESCBC_Mode_ AESCBC_Mode
Enum for the direction of the CBC operation.
void * custom
Definition: AESCBC.h:517
struct AESCBC_Params_ AESCBC_Params
CBC Parameters.
Definition: AESCBC.h:422
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:511
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.
void * object
Definition: AESCBC.h:477
void AESCBC_Params_init(AESCBC_Params *params)
Function to initialize the AESCBC_Params struct to its defaults.
uint8_t * output
Definition: AESCBC.h:437
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale