/******************************************************************************/
/* Component Name   ICU-M Interface Library (ICUMIF)                          */
/******************************************************************************/
/* Product      : ICU-M Firmware                                              */
/******************************************************************************/
/*******************************************************************************
* Copyright(C) 2022-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_SECURE_BOOT_API_H)
#define R_ICUMIF_API_SECURE_BOOT_API_H

/**********************************************************************************/
/* Type definition                                                                */
/**********************************************************************************/
typedef enum
{
    ROM_GET_LCS = 0,
    ROM_SECURE_BOOT_VERIFY,
    ROM_SECURE_BOOT_DECRYPT,
    ROM_SECURE_BOOT_COMPARE,

    LAST_ITEM_BOOT_API = 0x01000000
} boot_api_t;

typedef struct
{
    union
    {
        uint32_t        *p_lcs;
        uint64_t        padding_sys64;
    } ptr;
    uint32_t            lcs_size_in_bytes;
} boot_api_get_lcs_t;

typedef struct
{
    union
    {
        uint32_t        *p_key_cert;
        uint64_t        padding_sys64;
    } ptr1;
    union
    {
        uint32_t        *p_content_cert;
        uint64_t        padding_sys64;
    } ptr2;
    union
    {
        uint32_t        *p_cmac;
        uint64_t        padding_sys64;
    } ptr3;
} boot_api_boot_verify_t;

typedef struct
{
    union
    {
        uint32_t        *p_content_cert;
        uint64_t        padding_sys64;
    } ptr1;
    union
    {
        uint32_t        *p_cmac;
        uint64_t        padding_sys64;
    } ptr2;
} boot_api_boot_decrypt_t;

typedef struct
{
    union
    {
        uint32_t        *p_content_cert;
        uint64_t        padding_sys64;
    } ptr1;
    union
    {
        uint32_t        *p_hash;
        uint64_t        padding_sys64;
    } ptr2;
    uint32_t            hash_size_in_bytes;
    union
    {
        uint32_t        *p_cmac;
        uint64_t        padding_sys64;
    } ptr3;
} boot_api_boot_compare_t;

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

typedef struct ISD_SECURE_BOOT_API
{
    boot_api_t                      boot_api_id;
    uint32_t                        api_return_value;
    union api_parameters
    {
        boot_api_get_lcs_t          get_lcs;
        boot_api_boot_verify_t      boot_verify;
        boot_api_boot_decrypt_t     boot_decrypt;
        boot_api_boot_compare_t     boot_compare;
    } api;
} ISD_SECURE_BOOT_API_t;

#endif /* R_ICUMIF_API_SECURE_BOOT_API_H */
