/*!
* @file     Crypto_Cfg.c
*
* @version  1.0.0
*
* @brief    AUTOSAR Crypto Driver source file
*           Include Crypto Driver Configuration Parameter source file.
* @attention
*
* Project Name      : AUTOSAR MCAL
*
* Platform          : Arm
*
* Autosar Standard  : Classic Platform 4.4.0
*
* Compiled Version  : G32A10xx_MCAL_1_0_0_15-Nov-25
*
* Copyright (C) 2026 Geehy Semiconductor
*
* You may not use this file except in compliance with the
* GEEHY COPYRIGHT NOTICE (Geehy Semiconductor Software License Agreement).
*
* The program is only for reference, which is distributed in the hope
* that it will be usefull and instructional for customers to develop
* their software. Unless required by applicable law or agreed to in
* writing, the program is distributed on an "AS IS" BASIS, WITHOUT
* ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
* See the Geehy Semiconductor Software License Agreement for the governing permissions
* and limitations under the License.
*/

#ifdef __cplusplus
extern "C"
{
#endif

#include "Crypto_Cfg.h"
#include "Crypto_Types.h"
#include "Crypto_Impl.h"
/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup CRYPTO_Driver
  * @brief CRYPTO driver modules
  @{
*/

/** @defgroup CRYPTO_Macros
  @{
*/
/**************************************************************************
                  VENDOR ID & AUTOSAR VERSION INFO
**************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define CRYPTO_CFG_VENDOR_ID                        0x00C1U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CRYPTO_CFG_AR_RELEASE_MAJOR_VERSION         0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CRYPTO_CFG_AR_RELEASE_MINOR_VERSION         0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define CRYPTO_CFG_AR_RELEASE_REVISION_VERSION      0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CRYPTO_CFG_SW_MAJOR_VERSION                 0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CRYPTO_CFG_SW_MINOR_VERSION                 0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define CRYPTO_CFG_SW_PATCH_VERSION                 0x00U
/**@} end of group CRYPTO_Macros */
/*******************************************************************************
                             VERSION CHECK
*******************************************************************************/

/* Make sure the vendor id is the same between Crypto_Cfg.c and Crypto_Cfg.h */
#if(CRYPTO_CFG_VENDOR_ID != CRYPTO_CFG_H_VENDOR_ID)
    #error "Vendor id mismatch between Crypto_Cfg.c and Crypto_Cfg.h"
#endif
/* Make sure the AUTOSAR major version number is the same between Crypto_Cfg.c and Crypto_Cfg.h */
#if(CRYPTO_CFG_AR_RELEASE_MAJOR_VERSION != CRYPTO_CFG_H_AR_RELEASE_MAJOR_VERSION)
    #error "AUTOSAR Major Version Number mismatch between Crypto_Cfg.c and Crypto_Cfg.h"
#endif
/* Make sure the AUTOSAR minor version number is the same between Crypto_Cfg.c and Crypto_Cfg.h */
#if(CRYPTO_CFG_AR_RELEASE_MINOR_VERSION != CRYPTO_CFG_H_AR_RELEASE_MINOR_VERSION)
    #error "AUTOSAR Minor Version Number mismatch between Crypto_Cfg.c and Crypto_Cfg.h"
#endif
/* Make sure the AUTOSAR revision version number is the same between Crypto_Cfg.c and Crypto_Cfg.h */
#if(CRYPTO_CFG_AR_RELEASE_REVISION_VERSION != CRYPTO_CFG_H_AR_RELEASE_REVISION_VERSION)
    #error "AUTOSAR Revision Version Number mismatch between Crypto_Cfg.c and Crypto_Cfg.h"
#endif
/* Make sure the software major version number is the same between Crypto_Cfg.c and Crypto_Cfg.h */
#if(CRYPTO_CFG_SW_MAJOR_VERSION != CRYPTO_CFG_H_SW_MAJOR_VERSION)
    #error "Software Major Version Number mismatch between Crypto_Cfg.c and Crypto_Cfg.h"
#endif
/* Make sure the software minor version number is the same between Crypto_Cfg.c and Crypto_Cfg.h */
#if(CRYPTO_CFG_SW_MINOR_VERSION != CRYPTO_CFG_H_SW_MINOR_VERSION)
    #error "Software Minor Version Number mismatch between Crypto_Cfg.c and Crypto_Cfg.h"
#endif
/* Make sure the software patch version number is the same between Crypto_Cfg.c and Crypto_Cfg.h */
#if(CRYPTO_CFG_SW_PATCH_VERSION != CRYPTO_CFG_H_SW_PATCH_VERSION)
    #error "Software Patch Version Number mismatch between Crypto_Cfg.c and Crypto_Cfg.h"
#endif

/*******************************************************************************
                            GLOBAL VARIABLES
*******************************************************************************/
/** @defgroup CRYPTO_Variable
  @{
*/
#define CRYPTO_START_SEC_VAR_INIT_8
#include "Crypto_MemMap.h"

/** save the initialize value for Crypto Key Element */
static VAR(uint8, CRYPTO_VAR) Crypto_InitValueKeyMaterial_256[32] = {0};
static VAR(uint8, CRYPTO_VAR) Crypto_InitValueKeyMaterial_192[24] = {0};
static VAR(uint8, CRYPTO_VAR) Crypto_InitValueKeyMaterial_128[16] = {0};

static VAR(uint8, CRYPTO_VAR) Crypto_InitValueIV[16] =
{
    0x11U,
    0x22U,
    0x33U,
    0x44U,
    0x55U,
    0x66U,
    0x77U,
    0x88U,
    0x99U,
    0x00U,
    0xaaU,
    0xbbU,
    0xccU,
    0xddU,
    0xeeU,
    0xffU
};

static VAR(uint8, CRYPTO_VAR) Crypto_InitValueKeyMaterial_NotRead[32] = {0};
static VAR(uint8, CRYPTO_VAR) Crypto_InitValueKeyMaterial_64_Bytes[32] = {0};
static VAR(uint8, CRYPTO_VAR) Crypto_InitValueSeed[10] = {0};

#define CRYPTO_STOP_SEC_VAR_INIT_8
#include "Crypto_MemMap.h"

#define CRYPTO_START_SEC_VAR_INIT_UNSPECIFIED
#include "Crypto_MemMap.h"

/** the information for crypto key element */
static VAR(Crypto_KeyElementType, CRYPTO_VAR) Crypto_InfoKeyMaterial_256 =
{
    1U,
    0U,
    0U,
    CRYPTO_KE_FORMAT_BIN_OCTET,
    0U,
    CRYPTO_RA_ALLOWED,
    32U,
    32U,
    CRYPTO_WA_ALLOWED,
    Crypto_InitValueKeyMaterial_256
};

static VAR(Crypto_KeyElementType, CRYPTO_VAR) Crypto_InfoKeyMaterial_192 =
{
    2U,
    5U,
    0U,
    CRYPTO_KE_FORMAT_BIN_OCTET,
    0U,
    CRYPTO_RA_ALLOWED,
    24U,
    24U,
    CRYPTO_WA_ALLOWED,
    Crypto_InitValueKeyMaterial_192
};

static VAR(Crypto_KeyElementType, CRYPTO_VAR) Crypto_InfoKeyMaterial_128 =
{
    3U,
    6U,
    0U,
    CRYPTO_KE_FORMAT_BIN_OCTET,
    0U,
    CRYPTO_RA_ALLOWED,
    16U,
    16U,
    CRYPTO_WA_ALLOWED,
    Crypto_InitValueKeyMaterial_128
};


static VAR(Crypto_KeyElementType, CRYPTO_VAR) Crypto_InfoIV =
{
    5U,
    1U,
    0U,
    CRYPTO_KE_FORMAT_BIN_OCTET,
    0U,
    CRYPTO_RA_ALLOWED,
    16U,
    16U,
    CRYPTO_WA_ALLOWED,
    Crypto_InitValueIV
};

static VAR(Crypto_KeyElementType, CRYPTO_VAR) Crypto_InfoKeyMaterial_NotRead =
{
    1U,
    2U,
    0U,
    CRYPTO_KE_FORMAT_BIN_OCTET,
    0U,
    CRYPTO_RA_DENIED,
    32U,
    32U,
    CRYPTO_WA_ALLOWED,
    Crypto_InitValueKeyMaterial_NotRead
};

static VAR(Crypto_KeyElementType, CRYPTO_VAR) Crypto_InfoKeyMaterial_64_Bytes =
{
    1U,
    3U,
    0U,
    CRYPTO_KE_FORMAT_BIN_OCTET,
    0U,
    CRYPTO_RA_ALLOWED,
    64U,
    64U,
    CRYPTO_WA_ALLOWED,
    Crypto_InitValueKeyMaterial_64_Bytes
};

static VAR(Crypto_KeyElementType, CRYPTO_VAR) Crypto_InfoSeed =
{
    16U,
    4U,
    0U,
    CRYPTO_KE_FORMAT_BIN_OCTET,
    0U,
    CRYPTO_RA_ALLOWED,
    10U,
    10U,
    CRYPTO_WA_ALLOWED,
    Crypto_InitValueSeed
};

#define CRYPTO_STOP_SEC_VAR_INIT_UNSPECIFIED
#include "Crypto_MemMap.h"

#define CRYPTO_START_SEC_CONST_32
#include "Crypto_MemMap.h"

/** the reference of Crypto key element for each Crypto key types */
static CONST(uint32, CRYPTO_CONST) Crypto_refListKeyMaterial[1] =
{
    0U
};

static CONST(uint32, CRYPTO_CONST) Crypto_refListKeyMaterial_And_IV[4] =
{
    3U,
    2U,
    1U,
    0U
};

static CONST(uint32, CRYPTO_CONST) Crypto_refListKeyMaterial_NotRead[1] =
{
    4U
};

static CONST(uint32, CRYPTO_CONST) Crypto_refListKeyMaterial_64_Bytes[1] =
{
    5U
};

static CONST(uint32, CRYPTO_CONST) Crypto_refListSeed[1] =
{
    6U
};

#define CRYPTO_STOP_SEC_CONST_32
#include "Crypto_MemMap.h"

#define CRYPTO_START_SEC_CONST_UNSPECIFIED
#include "Crypto_MemMap.h"

/** List of key elements */
static CONST(Crypto_KeyElementListType, CRYPTO_CONST) Crypto_KeyMaterial =
{
    1U,
    Crypto_refListKeyMaterial
};

static CONST(Crypto_KeyElementListType, CRYPTO_CONST) Crypto_KeyMaterial_And_IV =
{
    4U,
    Crypto_refListKeyMaterial_And_IV
};

static CONST(Crypto_KeyElementListType, CRYPTO_CONST) Crypto_KeyMaterial_NotRead =
{
    1U,
    Crypto_refListKeyMaterial_NotRead
};

static CONST(Crypto_KeyElementListType, CRYPTO_CONST) Crypto_KeyMaterial_64_Bytes =
{
    1U,
    Crypto_refListKeyMaterial_64_Bytes
};

static CONST(Crypto_KeyElementListType, CRYPTO_CONST) Crypto_Seed =
{
    1U,
    Crypto_refListSeed
};

#define CRYPTO_STOP_SEC_CONST_UNSPECIFIED
#include "Crypto_MemMap.h"

#define CRYPTO_START_SEC_VAR_INIT_UNSPECIFIED
#include "Crypto_MemMap.h"

/** the infomation of Crypto driver key elements */
P2VAR(Crypto_KeyElementType, AUTOMATIC, CRYPTO_APPL_DATA) Crypto_KeyElementList[CRYPTO_KEY_ELEMENTS_NUMBER] =
{
    &Crypto_InfoKeyMaterial_256,
    &Crypto_InfoKeyMaterial_192,
    &Crypto_InfoKeyMaterial_128,
    &Crypto_InfoIV,
    &Crypto_InfoKeyMaterial_NotRead,
    &Crypto_InfoKeyMaterial_64_Bytes,
    &Crypto_InfoSeed,
};

/** the information of Crypto key */
static VAR(Crypto_KeyType, AUTOMATIC) Crypto_InfoKEY_1 =
{
    1U,
    1U,
    0U,
    &Crypto_KeyMaterial_And_IV
};

static VAR(Crypto_KeyType, AUTOMATIC) Crypto_InfoKEY_2 =
{
    2U,
    1U,
    0U,
    &Crypto_KeyMaterial
};

static VAR(Crypto_KeyType, AUTOMATIC) Crypto_InfoKEY_3 =
{
    3U,
    1U,
    0U,
    &Crypto_KeyMaterial_64_Bytes
};

static VAR(Crypto_KeyType, AUTOMATIC) Crypto_InfoKEY_NOT_READ =
{
    4U,
    1U,
    0U,
    &Crypto_KeyMaterial_NotRead
};

static VAR(Crypto_KeyType, AUTOMATIC) Crypto_InfoKEY_SEED =
{
    5U,
    1U,
    0U,
    &Crypto_Seed
};

/** the infomation of Crypto keys */
P2VAR(Crypto_KeyType, AUTOMATIC, CRYPTO_APPL_DATA) Crypto_KeyList[CRYPTO_KEYS_NUMBER] =
{
    &Crypto_InfoKEY_1,
    &Crypto_InfoKEY_2,
    &Crypto_InfoKEY_3,
    &Crypto_InfoKEY_NOT_READ,
    &Crypto_InfoKEY_SEED
};

#define CRYPTO_STOP_SEC_VAR_INIT_UNSPECIFIED
#include "Crypto_MemMap.h"

#define CRYPTO_START_SEC_VAR_NO_INIT_UNSPECIFIED
#include "Crypto_MemMap.h"

/** the queued job of Crypto driver object */
static VAR(Crypto_QueueType, CRYTO_VAR) Crypto_QueuedJobsWithQueue[2U];

#define CRYPTO_STOP_SEC_VAR_NO_INIT_UNSPECIFIED
#include "Crypto_MemMap.h"

#define CRYPTO_START_SEC_CONST_UNSPECIFIED
#include "Crypto_MemMap.h"

/** Configuration of crypto primitive */
static CONST(Crypto_PrimitiveType, CRYPTO_CONST) Crypto_PrimitiveWithQueue[11] =
{
    {
        ENCRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_ECB,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        DECRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_ECB,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        ENCRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CBC,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        DECRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CBC,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        ENCRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CTR,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        DECRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CTR,
        CRYPTO_ALGOFAM_NOT_SET
    },
        {
        MAC_GENERATE,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CMAC,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        MAC_VERIFY,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CMAC,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        RANDOM,
        CRYPTO_ALGOFAM_NOT_SET,
        CRYPTO_ALGOMODE_TRNG,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        HASH,
        CRYPTO_ALGOFAM_SHA2_256,
        CRYPTO_ALGOMODE_SHA256,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        MPC,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_MPC,
        CRYPTO_ALGOFAM_NOT_SET
    }
};

static CONST(Crypto_PrimitiveType, CRYPTO_CONST) Crypto_PrimitiveNoQueue[11] =
{
    {
        ENCRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_ECB,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        DECRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_ECB,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        ENCRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CBC,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        DECRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CBC,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        ENCRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CTR,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        DECRYPT,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CTR,
        CRYPTO_ALGOFAM_NOT_SET
    },
        {
        MAC_GENERATE,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CMAC,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        MAC_VERIFY,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_CMAC,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        RANDOM,
        CRYPTO_ALGOFAM_NOT_SET,
        CRYPTO_ALGOMODE_NOT_SET,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        HASH,
        CRYPTO_ALGOFAM_SHA2_256,
        CRYPTO_ALGOMODE_NOT_SET,
        CRYPTO_ALGOFAM_NOT_SET
    },
    {
        MPC,
        CRYPTO_ALGOFAM_AES,
        CRYPTO_ALGOMODE_NOT_SET,
        CRYPTO_ALGOFAM_NOT_SET
    }
};

#define CRYPTO_STOP_SEC_CONST_UNSPECIFIED
#include "Crypto_MemMap.h"

#define CRYPTO_START_SEC_VAR_INIT_UNSPECIFIED
#include "Crypto_MemMap.h"

/** Configuration of Crypto Driver Object */
static VAR(Crypto_ObjectType, CRYPTO_VAR) Crypto_InfoWithQueue =
{
    1U,
    Crypto_QueuedJobsWithQueue,2U,
    0U,
    0U,
    Crypto_PrimitiveWithQueue,
    11U
};

static VAR(Crypto_ObjectType, CRYPTO_VAR) Crypto_InfoNoQueue =
{
    2U,
    NULL_PTR,0U,
    0U,
    0U,
    Crypto_PrimitiveNoQueue,
    11U
};

/** The list save Configuration of Crypto Driver Object */
P2VAR(Crypto_ObjectType, AUTOMATIC, CRYPTO_APPL_DATA) Crypto_ListObject[CRYPTO_DRIVER_OBJECT_NUMBER] =
{
    &Crypto_InfoWithQueue,
    &Crypto_InfoNoQueue
};

#define CRYPTO_STOP_SEC_VAR_INIT_UNSPECIFIED
#include "Crypto_MemMap.h"

#if (CRYPTO_KEY_EXPORT_CONFIGURED == STD_ON)

#define CRYPTO_START_SEC_VAR_INIT_UNSPECIFIED
#include "Crypto_MemMap.h"

/** Create an info structure for CryptoExportKeys */
static VAR(Crypto_Cse_ExportKeyType, CRYPTO_VAR) Crypto_InfoRAM_Key =
{
    3U,
    1U,
    0U,
    &Crypto_InfoKEY_3
};


/** Exportkey configuration */
P2VAR(Crypto_Cse_ExportKeyType, AUTOMATIC, CRYPTO_APPL_DATA) Crypto_ListExportKey[CRYPTO_KEY_EXPROT_ELEMENTS_NUMBER] =
{
    &Crypto_InfoRAM_Key
};

#define CRYPTO_STOP_SEC_VAR_INIT_UNSPECIFIED
#include "Crypto_MemMap.h"

#endif
/**@} end of group CRYPTO_Variable */
#ifdef __cplusplus
}
#endif
/**@} end of group CRYPTO_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
