/******************************************************************************/
/* Component Name   ICU-M Interface Library (ICUMIF)                          */
/******************************************************************************/
/* Product      : ICU-M Firmware                                              */
/******************************************************************************/
/*******************************************************************************
* Copyright(C) 2021-2023 Renesas Electronics Corporation.                       
*                                                                               
*          RENESAS ELECTRONICS CONFIDENTIAL AND PROPRIETARY                     
*                                                                               
* These instructions, statements, and programs are the confidential information 
* of Renesas Electronics Corporation. They must be used and modified solely for 
* the purpose for which it was furnished by Renesas Electronics Corporation.    
* All part of them must not be reproduced nor disclosed to others in any form,  
* without the prior written permission of Renesas Electronics Corporation.      
*******************************************************************************/
#if !defined(R_ICUMIF_API_AES_AUTH_CIPHER_H)
#define R_ICUMIF_API_AES_AUTH_CIPHER_H

/**********************************************************************************/
/* Defines                                                                        */
/**********************************************************************************/

#define AES_BLOCK_SIZE_IN_BYTES           (16u)
#define AUTH_CIPHER_SAFETY_MODE_ENABLE    (0xA55AA55Au)

/**********************************************************************************/
/* Type definition                                                                */
/**********************************************************************************/

typedef enum
{
    AUTH_CIPHER_MOD_GCM,
    AUTH_CIPHER_MOD_CCM,

    LAST_ITEM_AUTH_CIPHER_MOD = 0x01000000
} auth_cipher_modes_t;

typedef struct auth_cipher_status_reg
{
    uint32_t    dma_used;
    uint32_t    status;
    uint32_t    transfer_num;
    uint32_t    control_src;
    uint32_t    control_dst;
    uint32_t    transfered_num_src;
    uint32_t    transfered_num_dst;
    uint32_t    remain_num_src;
    uint32_t    remain_num_dst;
    uint32_t    address_src;
    uint32_t    address_dst;
} auth_cipher_status_reg_t;

/**********************************************************************************/
/* Service parameters                                                             */
/**********************************************************************************/

typedef struct ISD_AES_AUTH_CIPHER
{
    union
    {
        const uint32_t           *p_iv;
        uint64_t                 padding_sys64;
    } ptr1;
    union
    {
        const uint32_t           *p_auth_data;
        uint64_t                 padding_sys64;
    } ptr2;
    union
    {
        const uint32_t           *p_data_in;
        uint64_t                 padding_sys64;
    } ptr3;
    union
    {
        uint32_t                 *p_data_out;
        uint64_t                 padding_sys64;
    } ptr4;
    union
    {
        uint32_t                 *p_auth_tag;
        uint64_t                 padding_sys64;
    } ptr5;
    union
    {
        auth_cipher_status_reg_t *p_status_reg_auth_data;
        uint64_t                 padding_sys64;
    } ptr6;
    union
    {
        auth_cipher_status_reg_t *p_status_reg_data;
        uint64_t                 padding_sys64;
    } ptr7;
    uint32_t                     data_size_in_bits;
    uint32_t                     auth_data_size_in_bits;
    uint32_t                     iv_size_in_bits;
    uint8_t                      auth_tag_size_in_bits;
    uint32_t                     safety_mode;
    r_key_group_t                key_group;
    r_key_index_t                key_id;
    cipher_direction_t           direction;
    auth_cipher_modes_t          cipher_mode;
    r_job_slice_t                job_slice;
    r_job_cycle_t                job_cycle;
    volatile r_verif_result_t    verification_result;
} ISD_AES_AUTH_CIPHER_t;

#endif /* R_ICUMIF_API_AES_AUTH_CIPHER_H */
