This commit is contained in:
2025-12-24 17:21:08 +09:00
parent a96323de19
commit 96dc62d8dc
2302 changed files with 455822 additions and 0 deletions

View File

@@ -0,0 +1,236 @@
diff --git b/V4H_Cx_Loader/secure/icumif/renesas_types.h a/V4H_Cx_Loader/secure/icumif/renesas_types.h
index 4c63220..5d28109 100644
--- b/V4H_Cx_Loader/secure/icumif/renesas_types.h
+++ a/V4H_Cx_Loader/secure/icumif/renesas_types.h
@@ -18,28 +18,7 @@
#if !defined (R_TYPEDEFS_H)
#define R_TYPEDEFS_H
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-typedef unsigned long uintptr_t;
-
-#define bool _Bool
-#define false (0)
-#define true (1)
-
-#define NULL ((void*)0)
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+#include <stddef.h>
+#include <stdint.h>
#endif /* R_TYPEDEFS_H */
diff --git b/V4H_Cx_Loader/secure/shared/src/mem_info_def.c a/V4H_Cx_Loader/secure/shared/src/mem_info_def.c
index dea5c7b..34ccc7e 100644
--- b/V4H_Cx_Loader/secure/shared/src/mem_info_def.c
+++ a/V4H_Cx_Loader/secure/shared/src/mem_info_def.c
@@ -25,8 +25,8 @@
#define ICUM_SHAREDMEMORY_1_SIZE (2097152u -1152u)
#define ICUM_SHAREDMEMORY_2_ADDR (0x41E00000u)
#define ICUM_SHAREDMEMORY_2_SIZE (2097152u)
-#define ICUM_SHAREDMEMORY_3_ADDR (0xE2100000u)
-#define ICUM_SHAREDMEMORY_3_SIZE (1048576u)
+#define ICUM_SHAREDMEMORY_3_ADDR (0xEB231000u)
+#define ICUM_SHAREDMEMORY_3_SIZE (0xD000u)
#define ICUM_EXPORT_DATA_ADDR (0x41C20000u)
#define ICUM_EXPORT_DATA_SIZE (114688u)
#define ICUM_DATA_WORKAREA_ADDR (0xEB2E0000u)
@@ -172,42 +172,9 @@ const uint32_t memory_information[ICUM_MEMORY_CONFIG_NUM] __attribute__((aligned
/*******************************************************************************/
/*******************************************************************************/
-/* ISD request & response queue */
+/* Communication buffer between host and ICU-M */
/*******************************************************************************/
-uint32_t ICUM_QUEUE[ICUM_SERVICEQUEUE_1_SIZE/sizeof(uint32_t)] __attribute__((aligned(32), section(".bss.SHARED_TOP")));
-
-/*******************************************************************************/
-/* Output buffer */
-/*******************************************************************************/
-uint8_t strbin[20096] __attribute__((aligned(32), section(".bss.SHARED_TOP")));
-
-/*******************************************************************************/
-/* Big buffers for tests */
-/*******************************************************************************/
-uint8_t BIG_BUFFER[4][SIZE_OF_BIG_BUFFER] __attribute__((aligned(256), section(".bss.SHARED_TOP")));
-
-/*******************************************************************************/
-/* Communication buffer between host and ICU-M */
-/*******************************************************************************/
-uint8_t ISD_BUFFER[SIZE_OF_ISD_BUFFER] __attribute__((aligned(32), section(".bss.SHARED_TOP")));
-
-/*******************************************************************************/
-/* Output buffer */
-/*******************************************************************************/
-uint8_t COM_BUFFER[SIZE_OF_COM_BUFFER] __attribute__((aligned(32), section(".bss.SHARED_TOP")));
-
-/*******************************************************************************/
-/* Big buffers ( 256 Byte aligned ) for tests */
-/*******************************************************************************/
-uint8_t DMAC_BUFFE[1][SIZE_OF_BIG_BUFFER] __attribute__((aligned(256), section(".bss.SHARED_TOP")));
-uint8_t DMAC_BUFFE_2[1][SIZE_OF_BIG_BUF2] __attribute__((aligned(256), section(".bss.SHARED_TOP")));
-
-/*******************************************************************************/
-/* Big buffers on SDRAM for tests */
-/*******************************************************************************/
-uint8_t BIG_BUF_SD[3][SIZE_OF_BIG_BUFFER] __attribute__((aligned(32), section(".bss.SDRAM")));
-
-/*******************************************************************************/
-/* Communication buffer on SDRAM between host and ICU-M */
-/*******************************************************************************/
-uint8_t ISD_BUF_SD[SIZE_OF_ISD_BUFFER] __attribute__((aligned(32), section(".bss.SDRAM")));
+uint8_t ISD_BUFFER[SIZE_OF_ISD_BUFFER] __attribute__((aligned(64), section(".bss.SHARED_TOP")));
+uint8_t LCS_BUFFER[SIZE_OF_LCS_BUFFER] __attribute__((aligned(64), section(".bss.SHARED_LCS")));
+uint8_t CMAC_BUFFER[SIZE_OF_CMAC_BUFFER] __attribute__((aligned(64), section(".bss.SHARED_CMAC")));
+uint8_t HASH_BUFFER[SIZE_OF_HASH_BUFFER] __attribute__((aligned(64), section(".bss.SHARED_HASH")));
diff --git b/V4H_Cx_Loader/secure/shared/src/shared.h a/V4H_Cx_Loader/secure/shared/src/shared.h
index b4dec66..5c71428 100644
--- b/V4H_Cx_Loader/secure/shared/src/shared.h
+++ a/V4H_Cx_Loader/secure/shared/src/shared.h
@@ -29,23 +29,13 @@
/**********************************************************************************
* Global external references
***********************************************************************************/
-/** ISD request & response queue */
-extern uint32_t ICUM_QUEUE[];
-/** Big buffers for tests */
-extern uint8_t BIG_BUFFER[][SIZE_OF_BIG_BUFFER];
-/** Communication buffer between host and ICU-M */
-extern uint8_t ISD_BUFFER[SIZE_OF_ISD_BUFFER];
-/** Extended communication buffer */
-extern uint8_t COM_BUFFER[SIZE_OF_COM_BUFFER];
-
-extern uint8_t DMAC_BUFFE[][SIZE_OF_BIG_BUFFER];
-extern uint8_t DMAC_BUFFE_2[][SIZE_OF_BIG_BUF2];
-
-extern uint8_t BIG_BUF_SD[][SIZE_OF_BIG_BUFFER];
-extern uint8_t ISD_BUF_SD[SIZE_OF_ISD_BUFFER];
-
-#if defined(TARGET_DEVICE_S4X) || defined(TARGET_DEVICE_V4H)
-extern uint16_t notification_from_cr52[9];
-#endif
+#define SIZE_OF_LCS_BUFFER (4U)
+#define SIZE_OF_CMAC_BUFFER (16U)
+#define SIZE_OF_HASH_BUFFER (32U * 2U)
+
+extern uint8_t ISD_BUFFER[SIZE_OF_ISD_BUFFER];
+extern uint8_t LCS_BUFFER[SIZE_OF_LCS_BUFFER];
+extern uint8_t CMAC_BUFFER[SIZE_OF_CMAC_BUFFER];
+extern uint8_t HASH_BUFFER[SIZE_OF_HASH_BUFFER];
#endif /* SHARED_H */
diff --git b/V4H_Cx_Loader/secure/user_api/user_icumif_api.c a/V4H_Cx_Loader/secure/user_api/user_icumif_api.c
index 4501e8a..a875a20 100644
--- b/V4H_Cx_Loader/secure/user_api/user_icumif_api.c
+++ a/V4H_Cx_Loader/secure/user_api/user_icumif_api.c
@@ -43,90 +43,12 @@ extern void inv_dcache_range(uintptr_t addr, uint32_t size);
void USER_ICUMIF_FlushDCache(uint32_t addr, uint32_t size)
{
- uint32_t cache_line_addr;
- uint32_t flush_size;
- uint32_t limit_size;
-
-#if defined(TARGET_CORTEX_A) && defined(AARCH64)
- unsigned long prog_status_reg_64;
- __asm volatile ("mrs %[result], DAIF" : [result] "=r" (prog_status_reg_64));
- __asm ("msr DAIFSet, #0x3");
-#else
- uint32_t prog_status_reg_32;
- __asm volatile ("mrs %[result], CPSR" : [result] "=r" (prog_status_reg_32));
- __asm ("cpsid if");
-#endif
-
- if (D_CACHE_LIMIT_ADDR > addr)
- {
- cache_line_addr = addr & D_CACHE_LINE_ADDR_MASK;
- flush_size = size + (addr - cache_line_addr);
-
- /* round to the limit size */
- limit_size = D_CACHE_LIMIT_ADDR - cache_line_addr;
- if (flush_size > limit_size)
- {
- flush_size = limit_size;
- }
-
- flush_dcache_range((uintptr_t)cache_line_addr, flush_size);
- }
-
-#if defined(TARGET_CORTEX_A) && defined(AARCH64)
- if (CR52_CPSR_IRQ_DISABLE_STATUS != (prog_status_reg_64 & CR52_CPSR_IRQ_DISABLE_STATUS))
- {
- __asm ("msr DAIFClr, #0x3");
- }
-#else
- if (CR52_CPSR_IRQ_DISABLE_STATUS != (prog_status_reg_32 & CR52_CPSR_IRQ_DISABLE_STATUS))
- {
- __asm ("cpsie if");
- }
-#endif
+ /* do nothing */
}
void USER_ICUMIF_InvalidateDCache(uint32_t addr, uint32_t size)
{
- uint32_t cache_line_addr;
- uint32_t invalidate_size;
- uint32_t limit_size;
-
-#if defined(TARGET_CORTEX_A) && defined(AARCH64)
- unsigned long prog_status_reg_64;
- __asm volatile ("mrs %[result], DAIF" : [result] "=r" (prog_status_reg_64));
- __asm ("msr DAIFSet, #0x3");
-#else
- uint32_t prog_status_reg_32;
- __asm volatile ("mrs %[result], CPSR" : [result] "=r" (prog_status_reg_32));
- __asm ("cpsid if");
-#endif
-
- if (D_CACHE_LIMIT_ADDR > addr)
- {
- cache_line_addr = addr & D_CACHE_LINE_ADDR_MASK;
- invalidate_size = size + (addr - cache_line_addr);
-
- /* round to the limit size */
- limit_size = D_CACHE_LIMIT_ADDR - cache_line_addr;
- if (invalidate_size > limit_size)
- {
- invalidate_size = limit_size;
- }
-
- inv_dcache_range(cache_line_addr, invalidate_size);
- }
-
-#if defined(TARGET_CORTEX_A) && defined(AARCH64)
- if (CR52_CPSR_IRQ_DISABLE_STATUS != (prog_status_reg_64 & CR52_CPSR_IRQ_DISABLE_STATUS))
- {
- __asm ("msr DAIFClr, #0x3");
- }
-#else
- if (CR52_CPSR_IRQ_DISABLE_STATUS != (prog_status_reg_32 & CR52_CPSR_IRQ_DISABLE_STATUS))
- {
- __asm ("cpsie if");
- }
-#endif
+ /* do nothing */
}
uint32_t USER_ICUMIF_GetMyPEID(void)
@@ -179,4 +101,3 @@ void USER_ICUMIF_Sync(void)
{
USER_ICUMIF_SYNC();
}
-

View File

@@ -0,0 +1,672 @@
/******************************************************************************/
/* 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_H)
#define R_ICUMIF_API_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**********************************************************************************/
/* Ensure the structure alignment */
/**********************************************************************************/
#pragma pack(8)
/**********************************************************************************/
/* Headers */
/**********************************************************************************/
/**********************************************************************************/
/* Defines */
/**********************************************************************************/
#include "renesas_types.h"
/*===========================================================================*/
/* Transition state of ISD service request / response queue */
/*===========================================================================*/
#define R_ICUMIF_REQRES_PE_REQ_ENQUE (0x01U) /* PE enqueued ISD to service request queue */
#define R_ICUMIF_REQRES_ICUM_REQ_DEQUE (0x02U) /* ICU-M dequeued ISD from service request queue */
#define R_ICUMIF_REQRES_ICUM_RES_ENQUE (0x03U) /* ICU-M enqueued ISD to service response queue */
#define R_ICUMIF_REQRES_PE_RES_DEQUE (0x04U) /* PE dequeued ISD from service response queue */
#define R_ICUMIF_REQRES_INTERRPUT (0x00U)
#define R_ICUMIF_REQRES_NOINTERRPUT (0x01U)
/*===========================================================================*/
/* Priority of ICU-M service */
/*===========================================================================*/
#define R_ICUMIF_SERV_PRIORITY_HIGHEST (0x00U)
#define R_ICUMIF_SERV_PRIORITY_HIGH (0x3FU)
#define R_ICUMIF_SERV_PRIORITY_NORMAL (0x7fU)
#define R_ICUMIF_SERV_PRIORITY_LOWEST (0xffU)
/*===========================================================================*/
/* The defines of job cycle (r_job_cycle_t) used for each service parameter */
/*===========================================================================*/
#define JOB_ALL_AT_ONCE (0x00000000u)
#define JOB_INIT (0x00000001u)
#define JOB_UPDATE (0x00000002u)
#define JOB_FINISH (0x00000004u)
/**********************************************************************************/
/* Macros */
/**********************************************************************************/
/*===========================================================================*/
/* To set the memory cluster verification flags in mem_cluster_verif_t */
/*===========================================================================*/
#define MEM_CLUSTER(i) (1 << (i))
/**********************************************************************************/
/* ICU-M interface: types */
/**********************************************************************************/
/*===========================================================================*/
/* Enumerates: ICU-M service ID */
/*===========================================================================*/
/*******************************************/
/* Note: the below enumerates should align */
/* with the table service_handler[] */
/*******************************************/
typedef enum
{
SERVICE_00_SYSTEM_INIT = 0x00,
SERVICE_00_SYSTEM_CONFIG,
SERVICE_00_GET_INFO,
SERVICE_00_KEY_MNGT,
SERVICE_00_CANCEL_SHE,
SERVICE_00_STAGE_TRANSITION,
SERVICE_00_GET_STAGE,
SERVICE_00_GET_ID,
SERVICE_00_CMD_DEBUG = 0x0C,
SERVICE_00_SECURE_BOOT_API,
SERVICE_01_AES_CIPHER = 0x10,
SERVICE_01_AES_AUTH_CIPHER,
SERVICE_01_AES_CMAC,
SERVICE_01_AES_CMAC_SHORT,
SERVICE_01_RSA_VERIFY,
SERVICE_01_RSA_SIGN,
SERVICE_01_RSA_ENCRYPT,
SERVICE_01_RSA_DECRYPT,
SERVICE_01_ECDSA_VERIFY,
SERVICE_01_ECDSA_SIGN,
SERVICE_01_ECDH,
SERVICE_01_HASH,
SERVICE_01_HMAC,
SERVICE_01_TLS_RSA_EXCHANGE,
SERVICE_01_TLS_ECDH_EXCHANGE,
SERVICE_01_TLS_VERIFY_DATA,
SERVICE_02_RAND_INIT_RNG = 0x20,
SERVICE_02_RAND_EXTEND_SEED,
SERVICE_02_RAND_RND,
SERVICE_02_RAND_TRNG,
SERVICE_02_RAND_INSTANTIATE,
SERVICE_02_RAND_RESEED,
SERVICE_02_RAND_UNINSTANTIATE,
SERVICE_02_RAND_GENERATE,
SERVICE_03_AES_KEY_UPDATE_PLAIN = 0x30,
SERVICE_03_AES_KEY_UPDATE_SHE,
SERVICE_03_AES_RAM_KEY_EXP_SHE,
SERVICE_03_PK_IMPORT,
SERVICE_03_PK_EXPORT,
SERVICE_03_RSA_KEY_GENERATE,
SERVICE_03_ECC_KEY_GENERATE,
SERVICE_03_ISO15118_UPDATE,
SERVICE_03_HMAC_IMPORT,
SERVICE_03_PK_IMPORT_EXT,
SERVICE_03_AES_KEY_UPDATE_SHE_EXT,
SERVICE_03_AES_RAM_KEY_EXP_SHE_EXT,
SERVICE_04_ICUMDF_WRITE = 0x45,
SERVICE_05_MEMCLSTR_DEFINITION = 0x50,
SERVICE_05_MEMCLSTR_INSTALL,
SERVICE_05_MEMCLSTR_VERIFY,
SERVICE_05_MEMCLSTR_VERIFY_AUTO,
SERVICE_07_MONO_CTR_MGMT = 0x70,
SERVICE_01_EDDSA_VERIFY = 0x80,
SERVICE_01_EDDSA_SIGN,
LAST_ITEM_SERV_ID = 0x01000000
} r_icumif_service_id_t;
/*===========================================================================*/
/* Enumerates: ICU-M service results */
/*===========================================================================*/
typedef enum
{
SERV_OK, /* service completed with no error */
SERV_SYS_CFG_NOT_INITIALIZED, /* system configuration not initialized */
SERV_ID_ERROR, /* wrong service ID */
SERV_REQUESTER_ID_ERROR, /* wrong requester ID */
SERV_PRM_ERROR, /* wrong service parameter error */
SERV_KEY_INVALID, /* key invalid */
SERV_KEY_NOT_USABLE, /* key not usable for the service */
SERV_INVALID_KEY_GROUP, /* key group is not valid */
SERV_INVALID_KEY_INDEX, /* wrong key index provided */
SERV_KEY_SLOT_EMPTY, /* key slot empty */
SERV_KEY_WRITE_PROTECTED, /* key is write protected */
SERV_KEY_UPDATE_ERROR, /* key update error */
SERV_SRC_MEM_ERROR, /* error on source memory range */
SERV_DEST_MEM_ERROR, /* error on destination memory range */
SERV_JOB_QUEUE_FULL, /* cannot accept another service request */
SERV_UNAVAILABLE, /* service unavailable */
SERV_INSTANCE_ALREADY_RUNNING, /* service instance already running */
SERV_SYS_ERROR, /* the service caused a system error (exception) */
SERV_MPU_ERROR, /* the service caused a MPU error (exception) */
SERV_NVM_PROG_ERROR, /* error while programming the Flash */
SERV_NVM_SYS_ERROR, /* error in the Flash sequencer */
SERV_NVM_SYS_ERROR_CRITICAL, /* error in the Flash sequencer */
SERV_NVM_UNAVAILABLE, /* Flash memory unavailable (e.g. PE1 reprogramming it) */
SERV_DATA_INVALID, /* error on the DVC (data inconsistency) */
SERV_NVM_DATA_WARNING, /* one data slot broken */
SERV_NVM_SIZE_ERROR, /* secure DF too small for the number of keys to manage */
SERV_CRYPT_ERROR, /* error in the cryptographic library */
SERV_INVALID_MEM_CLUST_INDEX, /* wrong memory cluster index */
SERV_INVALID_INSTALL_METHOD, /* invalid memory cluster installation method */
SERV_INVALID_VERIF_METHOD, /* invalid memory cluster verification method */
SERV_INVALID_CLUSTER_SIZE, /* invalid data size processed during memory cluster installation */
SERV_CLUSTER_NOT_DEFINED, /* memory cluster not defined */
SERV_CLUSTER_ALREADY_DEFINED, /* memory cluster already defined */
SERV_CLUSTER_NOT_INSTALLED, /* memory cluster not installed */
SERV_CLUSTER_INSTALL_FAIL, /* memory cluster installation fail */
SERV_CLUSTER_VERIFICATION_FAIL, /* memory cluster verification fail */
SERV_CLUSTER_NOT_VERIFIED, /* memory cluster not verified */
SERV_CLUSTER_ALREADY_VERIFIED, /* memory cluster already verified */
SERV_CLUSTER_ALREADY_INSTALLED, /* memory cluster already installed */
SERV_CLUSTER_VERIF_STATUS_LOCK, /* memory verification status locked */
SERV_BKGROUND_CHECK_RUNNING, /* background check running - unable to continue */
SERV_INVALID_ENCODING_FORMAT = 0x2A, /* invalid data encoding format */
SERV_ISD_NOT_ACCESSIBLE, /* service request not accessible by ICUP */
SERV_RAM_SIZE_ERROR, /* secure config ram too small for the number of keys to manage */
SERV_KEY_GENERATION_ERROR, /* error while generating RSA / ECC private keys */
SERV_KEY_VERIFICATION_FAIL, /* error on signature key verification */
SERV_INVALID_CURVE_ID, /* invalid ECC curve id */
SERV_ECC_POINT_INVALID, /* invalid ECC public key */
SERV_MEMORY_FULL, /* no more memory space */
SERV_INIT_DELAY, /* service initialization delayed (e.g. no AES context available) */
SERV_MYDATA_SET_EMPTY, /* no custom data set available */
SERV_MYDATA_SLOT_EMPTY, /* data slot available */
SERV_MYDATA_SIZE_ERR, /* invalid data size */
SERV_MYDATA_INVALID_IDX, /* invalid data slot index */
SERV_REQUEST_QUEUE_FULL, /* service request queue full */
SERV_MONOCTR_INVALID_TYPE, /* invalid monotonic counter type */
SERV_MONOCTR_INVALID_IDX, /* invalid monotonic counter index */
SERV_MONOCTR_NOT_INITIALIZED, /* monotonic counter not initialized */
SERV_MONOCTR_INVALID_INCREMENT, /* monotonic counter invalid increment value */
SERV_MONOCTR_INVALID, /* monotonic counter invalid counter value in Flash */
SERV_INVALID_OPERATION, /* invalid operation */
SERV_KEY_CACHE_FULL, /* unable to fix another key in cache */
SERV_MEMCLTR_CACHE_FULL, /* unable to fix another memory cluster in cache */
SERV_SEQUENCE_ERROR, /* Wrong calling sequence */
SERV_CR_VERIFY_FAIL, /* Failure on challenge & response */
SERV_AES_TIMEOUT_ERROR, /* wrong aes driver time out error */
SERV_AES_STATUS_ERROR, /* wrong aes driver status error */
SERV_AES_PRM_ERROR, /* wrong aes driver parameter error */
SERV_NO_COMP_TRNG, /* Call initialization services during the true random number generation */
SERV_NO_INIT_RNG, /* Using random number generation service not initialized */
SERV_TRN_ERROR, /* online test NG, or non-online test 3 times in consecutive random values match */
SERV_NEED_RESEED, /* A reseed is required(CTR_DRBG method) */
SERV_RESTRICTED, /* service is restricted by life cycle stage */
/* Error ID unique to the R-Car series */
SERV_NVM_REJECTED = 0xff00, /* Failed to acquire flash access authority */
SERV_REQUEST = 0xfff0,
SERV_NEW_REQUEST,
SERV_PENDING,
SERV_IN_PROCESS = 0xffff,
LAST_ITEM_SERV_ERR = 0x01000000
} r_icumif_service_result_t;
/*===========================================================================*/
/* Enumerates: verification result (CMAC, signature) */
/*===========================================================================*/
typedef enum
{
VERIFICATION_PASS,
VERIFICATION_FAIL,
LAST_ITEM_VERIF_STATUS = 0x01000000
} r_verif_result_t;
/*===========================================================================*/
/* Enumerates: number formats */
/*===========================================================================*/
typedef enum
{
FORMAT_STRING_DECIMAL,
FORMAT_STRING_HEXA,
FORMAT_BINARY_PLAIN,
LAST_ITEM_FORMAT_TYPE = 0x01000000
} r_number_format_t;
/*===========================================================================*/
/* Enumerates: hash encoding formats (rsa sign/verify) */
/*===========================================================================*/
typedef enum
{
ENCODING_FORMAT_EMSA_PSS,
ENCODING_FORMAT_EMSA_PKCS1_V15,
LAST_ITEM_HASH_ENCODING_TYPE = 0x01000000
} r_hash_encoding_format_t;
/*===========================================================================*/
/* Enumerates: message encoding formats (rsa encrypt/decrypt) */
/*===========================================================================*/
typedef enum
{
ENCODING_FORMAT_EME_OAEP,
ENCODING_FORMAT_EME_PKCS1_V15,
LAST_ITEM_MSG_ENCODING_TYPE = 0x01000000
} r_message_encoding_format_t;
/*===========================================================================*/
/* Enumerates: hash primitives */
/*===========================================================================*/
typedef enum
{
HASH_PRIMITIVE_MD5,
HASH_PRIMITIVE_RIPEMD_128,
HASH_PRIMITIVE_RIPEMD_160,
HASH_PRIMITIVE_RIPEMD_256,
HASH_PRIMITIVE_RIPEMD_320,
HASH_PRIMITIVE_SHA1,
HASH_PRIMITIVE_SHA2_224,
HASH_PRIMITIVE_SHA2_256,
HASH_PRIMITIVE_SHA2_384,
HASH_PRIMITIVE_SHA2_512,
HASH_PRIMITIVE_SHA2_512_224,
HASH_PRIMITIVE_SHA2_512_256,
HASH_PRIMITIVE_SHA3_224,
HASH_PRIMITIVE_SHA3_256,
HASH_PRIMITIVE_SHA3_384,
HASH_PRIMITIVE_SHA3_512,
HASH_PRIMITIVE_SHAKE_128,
HASH_PRIMITIVE_SHAKE_256,
LAST_ITEM_HASH_PRIMITIVE = 0x01000000
} r_hash_primitive_t;
/*===========================================================================*/
/* Enumerates: signature algorithms (for PK key imports/exports) */
/*===========================================================================*/
typedef enum
{
SIGALGO_NONE,
SIGALGO_RSA_PSS,
SIGALGO_RSA_PKCS1_V15,
LAST_ITEM_SIGNATURE_ALGO = 0x01000000
} r_signature_algo_t;
/*===========================================================================*/
/* Enumerates: ECC curves */
/*===========================================================================*/
typedef enum
{
ECC_CURVE_NIST_P192,
ECC_CURVE_NIST_P224,
ECC_CURVE_NIST_P256,
ECC_CURVE_NIST_P384,
ECC_CURVE_NIST_P521,
ECC_CURVE_BRAINPOOL_P192,
ECC_CURVE_BRAINPOOL_P224,
ECC_CURVE_BRAINPOOL_P256,
ECC_CURVE_BRAINPOOL_P320,
ECC_CURVE_BRAINPOOL_P384,
ECC_CURVE_BRAINPOOL_P512,
ECC_CURVE_BRAINPOOL_P256_T,
ECC_CURVE_BRAINPOOL_P320_T,
ECC_CURVE_BRAINPOOL_P384_T,
ECC_CURVE_BRAINPOOL_P512_T,
ECC_CURVE_CURVE25519,
ECC_CURVE_ED25519,
LAST_ITEM_ECC_TYPE = 0x01000000
} r_ecc_curve_t;
/*===========================================================================*/
/* Enumerates: KDF algorithms */
/*===========================================================================*/
typedef enum
{
KDF_ALGO_KDF1,
KDF_ALGO_KDF2,
KDF_ALGO_KDF3,
KDF_ALGO_PKDF1,
KDF_ALGO_PKDF2,
LAST_ITEM_KDF_ALGO = 0x01000000
} r_kdf_algo_t;
/*===========================================================================*/
/* Enumerates: key group */
/*===========================================================================*/
typedef enum
{
KEY_GRP_AES_ROM,
KEY_GRP_AES,
KEY_GRP_AES_RAM,
KEY_GRP_SHE,
KEY_GRP_RSA,
KEY_GRP_RSA_PUB,
KEY_GRP_RSA_ROM_PUB,
KEY_GRP_ECC,
KEY_GRP_ECC_RAM,
KEY_GRP_ECC_PUB,
KEY_GRP_ECC_ROM_PUB,
KEY_GRP_AES_CR,
KEY_GRP_HMAC,
KEY_GRP_TLS_MASTER,
KEY_GRP_RSA_PUB_EXT,
KEY_GRP_ECC_PUB_EXT,
LAST_ITEM_KEY_GRP = 0x01000000
} r_key_group_t;
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
/*===========================================================================*/
/* Type definition: requester ID */
/*===========================================================================*/
typedef uint8_t r_icumif_requester_id_t;
/*===========================================================================*/
/* Type definition: vm ID */
/*===========================================================================*/
typedef uint8_t r_icumif_vm_id_t;
/*===========================================================================*/
/* Type definition: host interrupt channel definition */
/*===========================================================================*/
typedef uint8_t r_icumif_host_intch_t;
/*===========================================================================*/
/* Type definition: transition state of ISD service request / response queue */
/*===========================================================================*/
typedef uint8_t r_icumif_req_res_status_t;
/*===========================================================================*/
/* Type definition: priority of ICU-M service */
/*===========================================================================*/
typedef uint8_t r_icumif_service_priority_t;
/*===========================================================================*/
/* Type definition: request no interrupt */
/*===========================================================================*/
typedef uint8_t r_icumif_req_nointerrupt_t;
/*===========================================================================*/
/* Type definition: responset no interrupt */
/*===========================================================================*/
typedef uint8_t r_icumif_res_nointerrupt_t;
/*===========================================================================*/
/* Type definition: job ID */
/*===========================================================================*/
typedef uint16_t r_icumif_job_id_t;
/*===========================================================================*/
/* Type definition: pointer to call back function */
/*===========================================================================*/
typedef void (*p_func_t)(void *p_ISD);
/*===========================================================================*/
/* Job slice */
/*===========================================================================*/
typedef uint16_t r_job_slice_t;
/*===========================================================================*/
/* Type definition: key index */
/*===========================================================================*/
typedef uint16_t r_key_index_t;
/*===========================================================================*/
/* Type definition: memory cluster ID */
/*===========================================================================*/
typedef uint8_t r_mem_cluster_id_t;
/*===========================================================================*/
/* Type definition: key property flag set */
/*===========================================================================*/
typedef uint16_t r_key_property_flags_t;
/*===========================================================================*/
/* Type definition: memory cluster verification map */
/*===========================================================================*/
typedef uint32_t r_mem_cluster_verif_t;
/*===========================================================================*/
/* Type definition: service job cycle */
/*===========================================================================*/
typedef uint32_t r_job_cycle_t;
/**********************************************************************************/
/* Header files inclusion for specific service properties */
/**********************************************************************************/
#include "r_icumif_api_sys_init.h"
#include "r_icumif_api_get_info.h"
#include "r_icumif_api_get_id.h"
#include "r_icumif_api_aes_key_update_plain.h"
#include "r_icumif_api_aes_key_update_she.h"
#include "r_icumif_api_aes_key_export_she.h"
#include "r_icumif_api_aes_cipher.h"
#include "r_icumif_api_aes_auth_cipher.h"
#include "r_icumif_api_aes_cmac.h"
#include "r_icumif_api_aes_cmac_short.h"
#include "r_icumif_api_rand_generate.h"
#include "r_icumif_api_pk_import.h"
#include "r_icumif_api_pk_import_ext.h"
#include "r_icumif_api_pk_export.h"
#include "r_icumif_api_iso15118_update.h"
#include "r_icumif_api_rsa_key_generate.h"
#include "r_icumif_api_ecc_key_generate.h"
#include "r_icumif_api_rsa_verify.h"
#include "r_icumif_api_rsa_sign.h"
#include "r_icumif_api_rsa_encrypt.h"
#include "r_icumif_api_rsa_decrypt.h"
#include "r_icumif_api_ecdh.h"
#include "r_icumif_api_ecdsa_verify.h"
#include "r_icumif_api_ecdsa_sign.h"
#include "r_icumif_api_hash.h"
#include "r_icumif_api_hmac.h"
#include "r_icumif_api_hmac_import.h"
#include "r_icumif_api_tls_ecdh_exchange.h"
#include "r_icumif_api_tls_rsa_exchange.h"
#include "r_icumif_api_tls_verify_data.h"
#include "r_icumif_api_lifecycle.h"
#include "r_icumif_api_mem_cluster_def.h"
#include "r_icumif_api_mem_cluster_install.h"
#include "r_icumif_api_mem_cluster_verify.h"
#include "r_icumif_api_mem_cluster_verify_auto.h"
#include "r_icumif_api_sys_cfg.h"
#include "r_icumif_api_key_mgmt.h"
#include "r_icumif_api_mono_ctr.h"
#include "r_icumif_api_cancel_she.h"
#include "r_icumif_api_cmd_debug.h"
#include "r_icumif_api_eddsa_verify.h"
#include "r_icumif_api_eddsa_sign.h"
#include "r_icumif_api_secure_boot_api.h"
/**********************************************************************************/
/* Header files inclusion for SHE specific parameters */
/**********************************************************************************/
#include "r_icumif_api_she.h"
/*===========================================================================*/
/* Type definition: ICU-M service descriptor (ISD) */
/*===========================================================================*/
typedef struct service_descriptor
{
r_icumif_service_id_t service_id;
r_icumif_requester_id_t requester_id;
r_icumif_vm_id_t vm_id;
r_icumif_host_intch_t host_int_ch;
volatile r_icumif_req_res_status_t req_res_status;
r_icumif_service_priority_t service_priority;
volatile r_icumif_service_result_t service_result;
volatile r_icumif_req_nointerrupt_t req_nointerrupt;
volatile r_icumif_res_nointerrupt_t res_nointerrupt;
volatile r_icumif_job_id_t job_id;
union
{
p_func_t p_callbackfunc;
uint64_t padding_sys64;
} ptr;
union service_parameters
{
ISD_SYSTEM_INIT_t SYSTEM_INIT;
ISD_SYSTEM_CONFIG_t SYSTEM_CONFIG;
ISD_GET_INFO_t GET_INFO;
ISD_GET_ID_t GET_ID;
ISD_KEY_UPDATE_PLAIN_t KEY_UPDATE_PLAIN;
ISD_KEY_UPDATE_SHE_t KEY_UPDATE_SHE;
ISD_KEY_AES_RAM_EXP_t RAM_KEY_EXPORT_SHE;
ISD_AES_CIPHER_t AES_CIPHER;
ISD_AES_AUTH_CIPHER_t AES_AUTH_CIPHER;
ISD_AES_CMAC_t AES_CMAC;
ISD_AES_CMAC_SHORT_t AES_CMAC_SHORT;
ISD_KEY_MNGT_t KEY_MGMT;
ISD_CANCEL_SHE_t CANCEL_SHE;
ISD_RAND_INIT_t RAND_INIT;
ISD_RAND_EXTEND_SEED_t RAND_EXTEND_SEED;
ISD_RAND_GENERATE_t RAND_GENERATE;
ISD_PK_IMPORT_t PK_IMPORT;
ISD_PK_EXPORT_t PK_EXPORT;
ISD_RSA_KEY_GENERATE_t RSA_KEY_GENERATE;
ISD_ECC_KEY_GENERATE_t ECC_KEY_GENERATE;
ISD_RSA_VERIFY_t RSA_VERIFY;
ISD_RSA_SIGN_t RSA_SIGN;
ISD_RSA_ENCRYPT_t RSA_ENCRYPT;
ISD_RSA_DECRYPT_t RSA_DECRYPT;
ISD_ECDH_t ECDH;
ISD_ECDSA_VERIFY_t ECDSA_VERIFY;
ISD_ECDSA_SIGN_t ECDSA_SIGN;
ISD_EDDSA_VERIFY_t EDDSA_VERIFY;
ISD_EDDSA_SIGN_t EDDSA_SIGN;
ISD_HASH_t HASH;
ISD_MEM_CLUSTER_DEF_t MEM_CLUSTER_DEF;
ISD_MEM_CLUSTER_INST_t MEM_CLUSTER_INSTALL;
ISD_MEM_CLUSTER_VERIF_t MEM_CLUSTER_VERIFY;
ISD_MEM_CLUSTER_VERIF_AUTO_t MEM_CLUSTER_VERIFY_AUTO;
ISD_MONO_CTR_t MONO_CTR_MGMT;
ISD_LIFE_CYCLE_t LIFE_CYCLE;
ISD_HMAC_t HMAC;
ISD_HMAC_IMPORT_t HMAC_IMPORT;
ISD_TLS_RSA_EXCHANGE_t TLS_RSA_EXCHANGE;
ISD_TLS_ECDH_EXCHANGE_t TLS_ECDH_EXCHANGE;
ISD_TLS_VERIFY_DATA_t TLS_VERIFY_DATA;
ISD_ISO15118_UPDATE_t ISO15118_UPDATE;
ISD_PK_IMPORT_EXT_t PK_IMPORT_EXT;
ISD_CMD_DEBUG_t CMD_DEBUG;
ISD_SECURE_BOOT_API_t SECURE_BOOT_API;
} prm;
} r_icumif_isd_t;
/*===========================================================================*/
/* Type definition: ICU-M firmware status */
/*===========================================================================*/
typedef struct r_icumif_sts
{
uint32_t BUSY:1;
uint32_t SECURE_BOOT:1;
uint32_t BOOT_INIT:1;
uint32_t BOOT_FINISHED:1;
uint32_t BOOT_OK:1;
uint32_t RND_INIT:1;
uint32_t EXT_DEBUGGER:1;
uint32_t INT_DEBUGGER:1;
uint32_t :1;
uint32_t FUSAERR:1;
uint32_t MONERR:1;
uint32_t BUSERR:1;
uint32_t ROMERR:1;
uint32_t RAMERR:1;
uint32_t WDTERR:1;
uint32_t SYSTEMERR:1;
uint32_t :1;
uint32_t EXTERR:1;
uint32_t FCUERR:1;
uint32_t RNDERR:1;
uint32_t DFWARNING_B:1;
uint32_t DFWARNING_A:1;
uint32_t STARTUP_BANK:1;
uint32_t BOOTERR:1;
uint32_t RPC_WAIT:1;
uint32_t TRNG:1;
uint32_t FLS_WAIT:1;
uint32_t FACIACC:1;
uint32_t SERVAVAIL:1;
uint32_t FCUINIT:1;
uint32_t PLLSET:1;
uint32_t STARTPE:1;
} r_icumif_sts_t;
/**********************************************************************************/
/* Structure alignment back to default configuration */
/**********************************************************************************/
#pragma pack()
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* R_ICUMIF_API_H */

View File

@@ -0,0 +1,109 @@
/******************************************************************************/
/* 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 */

View File

@@ -0,0 +1,86 @@
/******************************************************************************/
/* 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_CIPHER_H)
#define R_ICUMIF_API_AES_CIPHER_H
/**********************************************************************************/
/* Defines */
/**********************************************************************************/
#define AES_BLOCK_SIZE_IN_BYTES (16u)
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef enum
{
CIPHER_DIR_ENCRYPTION,
CIPHER_DIR_DECRYPTION,
LAST_ITEM_CIPHER_DIR = 0x01000000
} cipher_direction_t;
typedef enum
{
CIPHER_MOD_CBC,
CIPHER_MOD_ECB,
CIPHER_MOD_CFB,
CIPHER_MOD_OFB,
CIPHER_MOD_CTR,
CIPHER_MOD_XTS,
LAST_ITEM_CIPHER_MOD = 0x01000000
} cipher_modes_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_AES_CIPHER
{
union
{
const uint32_t *p_iv;
uint64_t padding_sys64;
} ptr1;
union
{
const uint32_t *p_block_in;
uint64_t padding_sys64;
} ptr2;
union
{
uint32_t *p_block_out;
uint64_t padding_sys64;
} ptr3;
union
{
uint32_t nb_blocks;
uint32_t data_size_in_bits;
} size;
r_key_group_t key_group;
r_key_index_t key_id;
r_key_group_t key_group_2;
r_key_index_t key_id_2;
cipher_direction_t direction;
cipher_modes_t cipher_mode;
r_job_slice_t job_slice;
r_job_cycle_t job_cycle;
} ISD_AES_CIPHER_t;
#endif /* R_ICUMIF_API_AES_CIPHER_H */

View File

@@ -0,0 +1,58 @@
/******************************************************************************/
/* 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_CMAC_H)
#define R_ICUMIF_API_AES_CMAC_H
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef enum
{
CMAC_GENERATION,
CMAC_VERIFICATION,
LAST_ITEM_CMAC = 0x01000000
} cmac_operation_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_AES_CMAC
{
union
{
const uint32_t *p_msg;
uint64_t padding_sys64;
} ptr1;
union
{
uint32_t *p_cmac;
uint64_t padding_sys64;
} ptr2;
uint32_t msg_size_in_bits;
r_key_group_t key_group;
r_key_index_t key_id;
uint8_t cmac_size_in_bits;
cmac_operation_t cmac_operation;
r_job_slice_t job_slice;
r_job_cycle_t job_cycle;
volatile r_verif_result_t verification_result;
} ISD_AES_CMAC_t;
#endif /* R_ICUMIF_API_AES_CMAC_H */

View File

@@ -0,0 +1,46 @@
/******************************************************************************/
/* 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_CMAC_SHORT_H)
#define R_ICUMIF_API_AES_CMAC_SHORT_H
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef struct cmac_position
{
uint8_t cmac_position;
uint8_t cmac_size;
uint8_t message_position;
uint8_t message_size;
} cmac_position_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_AES_CMAC_SHORT
{
uint32_t text[2];
cmac_position_t position_data;
r_key_group_t key_group;
r_key_index_t key_id;
cmac_operation_t cmac_operation;
volatile r_verif_result_t verification_result;
} ISD_AES_CMAC_SHORT_t;
#endif /* R_ICUMIF_API_AES_CMAC_SHORT_H */

View File

@@ -0,0 +1,53 @@
/******************************************************************************/
/* 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_KEY_EXPORT_SHE_H)
#define R_ICUMIF_API_AES_KEY_EXPORT_SHE_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_KEY_AES_RAM_EXP
{
union
{
uint8_t *p_M1;
uint64_t padding_sys64;
} ptr1;
union
{
uint8_t *p_M2;
uint64_t padding_sys64;
} ptr2;
union
{
uint8_t *p_M3;
uint64_t padding_sys64;
} ptr3;
union
{
uint8_t *p_M4;
uint64_t padding_sys64;
} ptr4;
union
{
uint8_t *p_M5;
uint64_t padding_sys64;
} ptr5;
} ISD_KEY_AES_RAM_EXP_t;
#endif /* R_ICUMIF_API_AES_KEY_EXPORT_SHE_H */

View File

@@ -0,0 +1,47 @@
/******************************************************************************/
/* 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_KET_UPDATE_PLAIN_H)
#define R_ICUMIF_API_AES_KET_UPDATE_PLAIN_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_KEY_UPDATE_PLAIN
{
union
{
const uint8_t *p_key_value;
uint64_t padding_sys64;
} ptr;
r_key_group_t key_group;
r_key_index_t key_id;
uint16_t key_size_in_bytes;
r_mem_cluster_verif_t mem_cluster_verif;
struct
{
r_key_property_flags_t encryption:1;
r_key_property_flags_t decryption:1;
r_key_property_flags_t cmac_generation:1;
r_key_property_flags_t cmac_verification:1;
r_key_property_flags_t write_protected:1;
r_key_property_flags_t disable_on_debug:1;
r_key_property_flags_t no_wild_card:1;
} flags;
} ISD_KEY_UPDATE_PLAIN_t;
#endif /* R_ICUMIF_API_AES_KET_UPDATE_PLAIN_H */

View File

@@ -0,0 +1,54 @@
/******************************************************************************/
/* 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_KEY_UPDATE_SHE_H)
#define R_ICUMIF_API_AES_KEY_UPDATE_SHE_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_KEY_UPDATE_SHE
{
union
{
const uint8_t *p_M1;
uint64_t padding_sys64;
} ptr1;
union
{
const uint8_t *p_M2;
uint64_t padding_sys64;
} ptr2;
union
{
const uint8_t *p_M3;
uint64_t padding_sys64;
} ptr3;
union
{
uint8_t *p_M4;
uint64_t padding_sys64;
} ptr4;
union
{
uint8_t *p_M5;
uint64_t padding_sys64;
} ptr5;
uint8_t extended_key_id;
} ISD_KEY_UPDATE_SHE_t;
#endif /* R_ICUMIF_API_AES_KEY_UPDATE_SHE_H */

View File

@@ -0,0 +1,29 @@
/******************************************************************************/
/* 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_CANCEL_SHE_H)
#define R_ICUMIF_API_CANCEL_SHE_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_CANCEL_SHE
{
r_icumif_job_id_t cancel_job_id;
} ISD_CANCEL_SHE_t;
#endif /* R_ICUMIF_API_CANCEL_SHE_H */

View File

@@ -0,0 +1,47 @@
/******************************************************************************/
/* 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_CMD_DEBUG_H)
#define R_ICUMIF_API_CMD_DEBUG_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef enum
{
DBG_CR_CHALLENGE,
DBG_CR_RESPONSE,
LAST_ITEM_DBG_CR_REQ = 0x01000000
} r_debug_request_t;
typedef struct ISD_CMD_DEBUG
{
r_debug_request_t cr_request;
union
{
uint32_t *p_challenge;
uint64_t padding_sys64;
} ptr1;
union
{
uint32_t *p_response;
uint64_t padding_sys64;
} ptr2;
} ISD_CMD_DEBUG_t;
#endif /* R_ICUMIF_API_CMD_DEBUG_H */

View File

@@ -0,0 +1,37 @@
/******************************************************************************/
/* 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_ECC_KEY_GENERATE_H)
#define R_ICUMIF_API_ECC_KEY_GENERATE_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_ECC_KEY_GENERATE
{
r_key_group_t key_group;
r_key_index_t key_id;
r_ecc_curve_t curve_id;
r_mem_cluster_verif_t mem_cluster_verif;
struct
{
r_key_property_flags_t disable_on_debug:1;
r_key_property_flags_t write_protected:1;
} flags;
} ISD_ECC_KEY_GENERATE_t;
#endif /* R_ICUMIF_API_ECC_KEY_GENERATE_H */

View File

@@ -0,0 +1,57 @@
/******************************************************************************/
/* 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_ECDH_H)
#define R_ICUMIF_API_ECDH_H
/**********************************************************************************/
/* Defines */
/**********************************************************************************/
#define SET_SHARED_SECRET (0u)
#define OUTPUT_SHARED_SECRET (1u)
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_ECDH
{
r_key_group_t ecc_priv_key_group;
r_key_index_t ecc_priv_key_id;
r_key_group_t ecc_pub_key_group;
r_key_index_t ecc_pub_key_id;
r_key_group_t shared_key_group;
r_key_index_t shared_key_id;
r_kdf_algo_t kdf_algo;
r_hash_primitive_t hash_primitive;
r_job_slice_t job_slice;
union
{
const uint8_t *p_info;
uint64_t padding_sys64;
} ptr;
uint16_t counter;
uint8_t info_size_in_bytes;
uint16_t key_size_in_bytes;
union
{
uint8_t *p_shared_secret;
uint64_t padding_sys64;
} ptr2;
uint8_t output_select;
} ISD_ECDH_t;
#endif /* R_ICUMIF_API_ECDH_H */

View File

@@ -0,0 +1,52 @@
/******************************************************************************/
/* 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_ECDSA_SIGN_H)
#define R_ICUMIF_API_ECDSA_SIGN_H
/**********************************************************************************/
/* Definition */
/**********************************************************************************/
#define ECDSA_SIGNATURE_NUM (2u)
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_ECDSA_SIGN
{
union
{
const uint8_t *p_source;
uint64_t padding_sys64;
} ptr;
union
{
uint8_t *p_data;
uint64_t padding_sys64;
} signature[ECDSA_SIGNATURE_NUM];
uint32_t source_size_in_bytes;
r_hash_primitive_t hash_primitive;
r_number_format_t signature_format;
r_key_group_t key_group;
r_key_index_t key_id;
r_job_slice_t job_slice_hash;
r_job_slice_t job_slice_point_mul;
volatile uint16_t signature_size_in_bits[ECDSA_SIGNATURE_NUM];
uint8_t is_precalculated_hash;
} ISD_ECDSA_SIGN_t;
#endif /* R_ICUMIF_API_ECDSA_SIGN_H */

View File

@@ -0,0 +1,53 @@
/******************************************************************************/
/* 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_ECDSA_VERIFY_H)
#define R_ICUMIF_API_ECDSA_VERIFY_H
/**********************************************************************************/
/* Definition */
/**********************************************************************************/
#define ECDSA_SIGNATURE_NUM (2u)
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_ECDSA_VERIFY
{
union
{
const uint8_t *p_source;
uint64_t padding_sys64;
} ptr;
union
{
const uint8_t *p_data;
uint64_t padding_sys64;
} signature[ECDSA_SIGNATURE_NUM];
uint32_t source_size_in_bytes;
uint16_t signature_size_in_bits[ECDSA_SIGNATURE_NUM];
r_hash_primitive_t hash_primitive;
r_number_format_t signature_format;
r_key_group_t key_group;
r_key_index_t key_id;
r_job_slice_t job_slice_hash;
r_job_slice_t job_slice_point_mul;
uint8_t is_precalculated_hash;
volatile r_verif_result_t verification_result;
} ISD_ECDSA_VERIFY_t;
#endif /* R_ICUMIF_API_ECDSA_VERIFY_H */

View File

@@ -0,0 +1,52 @@
/******************************************************************************/
/* 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_EDDSA_SIGH_H)
#define R_ICUMIF_API_EDDSA_SIGH_H
/**********************************************************************************/
/* Definition */
/**********************************************************************************/
#define EDDSA_SIGNATURE_NUM (2u)
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_EDDSA_SIGN
{
union
{
const uint8_t *p_source;
uint64_t padding_sys64;
} ptr;
union
{
uint8_t *p_data;
uint64_t padding_sys64;
} signature[EDDSA_SIGNATURE_NUM];
uint32_t source_size_in_bytes;
r_hash_primitive_t hash_primitive;
r_number_format_t signature_format;
r_key_group_t key_group;
r_key_index_t key_id;
r_job_slice_t job_slice_hash;
r_job_slice_t job_slice_point_mul;
volatile uint16_t signature_size_in_bits[EDDSA_SIGNATURE_NUM];
uint8_t is_precalculated_hash;
} ISD_EDDSA_SIGN_t;
#endif /* R_ICUMIF_API_EDDSA_SIGH_H */

View File

@@ -0,0 +1,53 @@
/******************************************************************************/
/* 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_EDDSA_VERIFY_H)
#define R_ICUMIF_API_EDDSA_VERIFY_H
/**********************************************************************************/
/* Definition */
/**********************************************************************************/
#define EDDSA_SIGNATURE_NUM (2u)
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_EDDSA_VERIFY
{
union
{
const uint8_t *p_source;
uint64_t padding_sys64;
} ptr;
union
{
const uint8_t *p_data;
uint64_t padding_sys64;
} signature[EDDSA_SIGNATURE_NUM];
uint32_t source_size_in_bytes;
uint16_t signature_size_in_bits[EDDSA_SIGNATURE_NUM];
r_hash_primitive_t hash_primitive;
r_number_format_t signature_format;
r_key_group_t key_group;
r_key_index_t key_id;
r_job_slice_t job_slice_hash;
r_job_slice_t job_slice_point_mul;
uint8_t is_precalculated_hash;
volatile r_verif_result_t verification_result;
} ISD_EDDSA_VERIFY_t;
#endif /* R_ICUMIF_API_EDDSA_VERIFY_H */

View File

@@ -0,0 +1,45 @@
/******************************************************************************/
/* 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_GET_ID_H)
#define R_ICUMIF_API_GET_ID_H
/**********************************************************************************/
/* Definition */
/**********************************************************************************/
#define UID_SIZE_15 (15u)
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_GET_ID
{
union
{
uint8_t *p_challenge;
uint64_t padding_sys64;
} ptr1;
uint8_t UID[UID_SIZE_15];
uint8_t SREG;
union
{
uint8_t *p_CMAC;
uint64_t padding_sys64;
} ptr2;
} ISD_GET_ID_t;
#endif /* R_ICUMIF_API_GET_ID_H */

View File

@@ -0,0 +1,125 @@
/******************************************************************************/
/* 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_GET_INFO_H)
#define R_ICUMIF_API_GET_INFO_H
/**********************************************************************************/
/* Definition */
/**********************************************************************************/
/* number of warning data */
#define INFO_WARNING_DATA_NUM (16u)
/* 16 is the maximum number of secure data flash physical blocks
assumed by the target microcomputer */
#define INFO_DF_BLOCK_NUM (16u)
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef enum
{
INFO_GET_FW_NAME,
INFO_GET_FW_VERSION,
INFO_GET_FW_BUILD_TYPE,
INFO_GET_JOB_COUNT,
INFO_GET_KEY_MAPPING,
INFO_GET_MYDATA_SET,
INFO_GET_MONOCTR_MAPPING,
INFO_GET_SECURE_TICK,
INFO_GET_SECURE_TICK_FREQ,
INFO_GET_TIMING_1ST_STAGE_BOOT,
INFO_GET_CMAC_MIN,
INFO_GET_BOOT_STAGE_SLICE,
INFO_GET_BOOT_STAGE_SANCTION,
INFO_GET_SECURE_BOOT,
INFO_GET_WDT,
INFO_GET_RND,
INFO_GET_DEBUG,
INFO_GET_SECURE_TICK_INTERVAL,
INFO_GET_START_PE,
INFO_GET_EARLY_STARTUP_PE,
INFO_GET_DEVICE_ID,
INFO_GET_MEMCLUSTER_MAPPING,
INFO_GET_RAM_EXECUTE,
INFO_GET_ECC_TEST_LOCK,
INFO_GET_NVM_DATA_WARNING,
INFO_GET_FLS_CFG,
INFO_GET_FREE_BLOCK,
INFO_GET_VM_CFG,
LAST_ITEM_INFO_FW = 0x01000000
} info_type_t;
typedef enum
{
DATASET_SYS_CFG,
DATASET_MEM_CLUSTER,
DATASET_AES_KEY,
DATASET_CR_KEY,
DATASET_RSA_PRIV_KEY,
DATASET_RSA_PUB_KEY,
DATASET_ECC_PRIV_KEY,
DATASET_ECC_PUB_KEY,
DATASET_MYDATA,
DATASET_RSA_PUB_EXT_KEY,
DATASET_ECC_PUB_EXT_KEY,
DATASET_FW_INTERNAL = 0xFE,
DATASET_NONE = 0xFF,
LAST_ITEM_DATASET = 0x01000000
} info_dataset_type_t;
typedef struct
{
info_dataset_type_t dataset;
uint16_t index;
} info_warning_data_t;
typedef struct
{
info_warning_data_t data[INFO_WARNING_DATA_NUM];
} info_warning_t;
typedef struct
{
uint16_t total_num;
uint16_t num[INFO_DF_BLOCK_NUM];
} info_free_block_t;
typedef struct
{
uint64_t counter;
} secure_tick_info_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_GET_INFO
{
info_type_t info_id;
union
{
void *p_info;
uint64_t padding_sys64;
} ptr;
volatile uint8_t data_size_in_bytes;
} ISD_GET_INFO_t;
#endif /* R_ICUMIF_API_GET_INFO_H */

View File

@@ -0,0 +1,44 @@
/******************************************************************************/
/* 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_HASH_H)
#define R_ICUMIF_API_HASH_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_HASH
{
union
{
const uint8_t *p_message;
uint64_t padding_sys64;
} ptr1;
union
{
uint8_t *p_hash;
uint64_t padding_sys64;
} ptr2;
uint32_t message_size_in_bytes;
volatile uint16_t hash_size_in_bytes;
r_hash_primitive_t hash_primitive;
r_job_slice_t job_slice;
r_job_cycle_t job_cycle;
uint32_t total_msg_size_in_bytes;
} ISD_HASH_t;
#endif /* R_ICUMIF_API_HASH_H */

View File

@@ -0,0 +1,57 @@
/******************************************************************************/
/* 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_HMAC_H)
#define R_ICUMIF_API_HMAC_H
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef enum
{
HMAC_GENERATION,
HMAC_VERIFICATION,
LAST_ITEM_HMAC = 0x01000000
} hmac_operation_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_HMAC
{
r_key_index_t key_id;
hmac_operation_t hmac_operation;
r_hash_primitive_t hash_primitive;
union
{
const uint8_t *p_msg;
uint64_t padding_sys64;
} ptr1;
uint32_t msg_size_in_bytes;
union
{
uint8_t *p_hmac;
uint64_t padding_sys64;
} ptr2;
uint8_t hmac_size_in_bytes;
r_job_slice_t job_slice;
volatile r_verif_result_t verification_result;
} ISD_HMAC_t;
#endif /* R_ICUMIF_API_HMAC_H */

View File

@@ -0,0 +1,35 @@
/******************************************************************************/
/* 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_HMAC_IMPORT_H)
#define R_ICUMIF_API_HMAC_IMPORT_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_HMAC_IMPORT
{
r_key_index_t key_id;
union
{
const uint8_t *p_key;
uint64_t padding_sys64;
} ptr;
uint8_t key_size_in_bytes;
} ISD_HMAC_IMPORT_t;
#endif /* R_ICUMIF_API_HMAC_IMPORT_H */

View File

@@ -0,0 +1,54 @@
/******************************************************************************/
/* 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_ISO15118_UPDATE_H)
#define R_ICUMIF_API_ISO15118_UPDATE_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_ISO15118_UPDATE
{
r_key_index_t ecc_priv_key_id_for_ecdh;
r_key_index_t ecc_pub_key_id_for_ecdh;
r_key_index_t ecc_priv_key_id_for_update;
union
{
const uint8_t *p_new_priv_key; /* include IV */
uint64_t padding_sys64;
} ptr1;
uint32_t new_priv_key_size_in_bytes; /* include IV */
union
{
const uint8_t *p_new_pub_key_x;
uint64_t padding_sys64;
} ptr2;
uint32_t new_pub_key_x_size_in_bytes;
union
{
const uint8_t *p_new_pub_key_y;
uint64_t padding_sys64;
} ptr3;
uint32_t new_pub_key_y_size_in_bytes;
r_mem_cluster_verif_t mem_cluster_verif;
struct
{
r_key_property_flags_t disable_on_debug:1;
r_key_property_flags_t write_protected:1;
} flags;
} ISD_ISO15118_UPDATE_t;
#endif /* R_ICUMIF_API_ISO15118_UPDATE_H */

View File

@@ -0,0 +1,40 @@
/******************************************************************************/
/* 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_KEY_MGMT_H)
#define R_ICUMIF_API_KEY_MGMT_H
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef enum
{
BUFFER_KEY_CONFIG,
LAST_ITEM_KEY_MNGT_OP = 0x01000000
} key_mngt_op_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_KEY_MNGT
{
key_mngt_op_t key_mngt_op;
} ISD_KEY_MNGT_t;
#endif /* R_ICUMIF_API_KEY_MGMT_H */

View File

@@ -0,0 +1,77 @@
/******************************************************************************/
/* 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_LIFECYCLE_H)
#define R_ICUMIF_API_LIFECYCLE_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef enum
{
LC_STAGE_LC0 = 0x1122,
LC_STAGE_LC1 = 0x2233,
LC_STAGE_LC2 = 0x3344,
LC_STAGE_LC2S = 0x4455,
LC_STAGE_TERMINATION = 0x5566,
LAST_ITEM_LC_STAGE = 0x01000000
} r_stage_type_t;
typedef enum
{
LC_CR_NONE,
LC_CR_CHALLENGE,
LC_CR_RESPONSE,
LAST_ITEM_LC_CR_REQ = 0x01000000
} r_cr_request_t;
typedef struct
{
uint16_t life_cycle_stage;
uint16_t lc_terminate_status;
} sys_cfg_lc_t;
typedef enum
{
LC_TERMINATE_NON,
LC_TERMINATE_EXECUTE,
LC_TERMINATE_COMPLETE,
LAST_ITEM_LC_TERM = 0x01000000
} r_trm_status_t;
typedef struct ISD_LIFE_CYCLE
{
r_stage_type_t current_stage;
r_stage_type_t transition_dest;
r_mem_cluster_id_t cluster_id;
r_cr_request_t cr_request;
union
{
uint8_t *p_challenge;
uint64_t padding_sys64;
} ptr1;
union
{
uint8_t *p_response;
uint64_t padding_sys64;
} ptr2;
} ISD_LIFE_CYCLE_t;
#endif /* R_ICUMIF_API_LIFECYCLE_H */

View File

@@ -0,0 +1,75 @@
/******************************************************************************/
/* 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_MEM_CLUSTER_DEF_H)
#define R_ICUMIF_API_MEM_CLUSTER_DEF_H
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef enum
{
INSTALL_METHOD_0,
INSTALL_METHOD_1,
LAST_ITEM_INSTALL_METHOD = 0x01000000
} r_install_method_t;
typedef enum
{
VERIF_ON_DEMAND,
VERIF_FIRST_STAGE_BOOT,
VERIF_SECOND_STAGE_BOOT,
VERIF_BACK_GROUND,
LAST_ITEM_VERIF_TYPE = 0x01000000
} r_verif_method_t;
typedef enum
{
BOOTMODE_NORMAL,
BOOTMODE_USER,
BOOTMODE_BOTH,
LAST_ITEM_BOOTMODE = 0x01000000
} r_boot_mode_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_MEM_CLUSTER_DEF
{
union
{
const uint32_t *p_data;
uint64_t padding_sys64;
} ptr;
uint32_t data_size_in_bytes;
r_mem_cluster_id_t cluster_id;
r_install_method_t install_method;
r_key_group_t install_key_group;
r_key_index_t install_key_id;
r_key_group_t verif_key_group;
r_key_index_t verif_key_id;
r_verif_method_t verif_method;
r_boot_mode_t boot_mode;
r_job_slice_t job_slice_cmac_install;
} ISD_MEM_CLUSTER_DEF_t;
#endif /* R_ICUMIF_API_MEM_CLUSTER_DEF_H */

View File

@@ -0,0 +1,43 @@
/******************************************************************************/
/* 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_MEM_CLUSTER_INSTALL_H)
#define R_ICUMIF_API_MEM_CLUSTER_INSTALL_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_MEM_CLUSTER_INST
{
union
{
const uint32_t *p_data;
uint64_t padding_sys64;
} ptr1;
uint32_t data_size_in_bytes;
union
{
const uint8_t *p_authentication_data;
uint64_t padding_sys64;
} ptr2;
uint32_t auth_data_size_in_bytes;
r_number_format_t auth_data_format;
r_mem_cluster_id_t cluster_id;
} ISD_MEM_CLUSTER_INST_t;
#endif /* R_ICUMIF_API_MEM_CLUSTER_INSTALL_H */

View File

@@ -0,0 +1,57 @@
/******************************************************************************/
/* 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_MEM_CLUSTER_VERIFY_H)
#define R_ICUMIF_API_MEM_CLUSTER_VERIFY_H
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef enum
{
ACTION_VERIFY,
ACTION_FORCE_INSTALL,
ACTION_GET_VERIFICATION_STATUS,
ACTION_FORCE_VERIFICATION_FAIL,
ACTION_LOCK_VERIFICATION_STATUS,
LAST_ITEM_ACTION_TYPE = 0x01000000
} r_cluster_verif_action_t;
typedef enum
{
CLUSTER_NOT_VERIFIED,
CLUSTER_VERIFICATION_FAILED,
CLUSTER_VERIFIED,
LAST_ITEM_CLUSTER_STATUS = 0x01000000
} r_cluster_verif_status_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_MEM_CLUSTER_VERIF
{
r_mem_cluster_id_t cluster_id;
r_cluster_verif_action_t action;
r_job_slice_t job_slice;
volatile r_cluster_verif_status_t verification_status;
} ISD_MEM_CLUSTER_VERIF_t;
#endif /* R_ICUMIF_API_MEM_CLUSTER_VERIFY_H */

View File

@@ -0,0 +1,31 @@
/******************************************************************************/
/* 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_MEM_CLUSTER_VERIFY_AUTO_H)
#define R_ICUMIF_API_MEM_CLUSTER_VERIFY_AUTO_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_MEM_CLUSTER_VERIF_AUTO
{
r_job_slice_t job_slice;
uint32_t timing_interval;
} ISD_MEM_CLUSTER_VERIF_AUTO_t;
#endif /* R_ICUMIF_API_MEM_CLUSTER_VERIFY_AUTO_H */

View File

@@ -0,0 +1,50 @@
/******************************************************************************/
/* 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_MONO_CTR_H)
#define R_ICUMIF_API_MONO_CTR_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef enum
{
MONOTONIC_CTR_RAM,
MONOTONIC_CTR,
LAST_ITEM_MONO_CTR = 0x01000000
} mono_ctr_type_t;
typedef enum
{
MONO_CTR_READ,
MONO_CTR_SET_VALUE,
MONO_CTR_INCREMENT,
LAST_ITEM_MONO_CTR_OP = 0x01000000
} mono_ctr_op_t;
typedef struct ISD_MONO_CTR
{
mono_ctr_type_t mono_ctr_type;
uint8_t mono_ctr_id;
mono_ctr_op_t mono_ctr_op;
volatile uint64_t counter;
} ISD_MONO_CTR_t;
#endif /* R_ICUMIF_API_MONO_CTR_H */

View File

@@ -0,0 +1,66 @@
/******************************************************************************/
/* 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_PK_EXPORT_H)
#define R_ICUMIF_API_PK_EXPORT_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_PK_EXPORT
{
union
{
uint8_t *p_modulus;
uint8_t *p_pub_point_x;
uint64_t padding_sys64;
} ptr1;
union
{
uint8_t *p_pub_exp;
uint8_t *p_pub_point_y;
uint64_t padding_sys64;
} ptr2;
union
{
uint8_t *p_signature;
uint64_t padding_sys64;
} ptr3;
r_number_format_t key_format;
r_number_format_t sig_format;
r_key_group_t key_group;
r_key_index_t key_id;
r_key_group_t sig_key_group;
r_key_index_t sig_key_id;
r_signature_algo_t sig_algo;
r_hash_primitive_t hash_primitive;
volatile r_ecc_curve_t curve_id;
union
{
volatile uint16_t point_x_size_in_bits;
volatile uint16_t modulus_size_in_bits;
} size1;
union
{
volatile uint16_t point_y_size_in_bits;
volatile uint16_t pub_exp_size_in_bits;
} size2;
volatile uint16_t sig_size_in_bits;
uint8_t skip_sign;
} ISD_PK_EXPORT_t;
#endif /* R_ICUMIF_API_PK_EXPORT_H */

View File

@@ -0,0 +1,98 @@
/******************************************************************************/
/* 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_PK_IMPORT_H)
#define R_ICUMIF_API_PK_IMPORT_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_PK_IMPORT
{
union
{
const uint8_t *p_modulus;
const uint8_t *p_pub_point_x;
uint64_t padding_sys64;
} ptr1;
union
{
const uint8_t *p_pub_exp;
const uint8_t *p_pub_point_y;
uint64_t padding_sys64;
} ptr2;
/* added for private key value import */
union
{
const uint8_t *p_priv_exp;
const uint8_t *p_priv_scalar;
uint64_t padding_sys64;
} ptr3;
union
{
const uint8_t *p_signature;
uint64_t padding_sys64;
} ptr4;
union
{
uint8_t *p_info;
uint64_t padding_sys64;
} ptr5;
r_number_format_t key_format;
r_number_format_t sig_format;
r_key_group_t key_group; /* need for x.509 import */
r_key_index_t key_id; /* need for x.509 import */
r_key_group_t sig_key_group; /* need for x.509 import */
r_key_index_t sig_key_id; /* need for x.509 import */
r_mem_cluster_verif_t mem_cluster_verif; /* need for x.509 import */
r_signature_algo_t sig_algo; /* need for x.509 import */
r_hash_primitive_t hash_primitive; /* need for x.509 import */
r_ecc_curve_t curve_id;
union
{
uint16_t point_x_size_in_bits;
uint16_t modulus_size_in_bits;
} size1;
union
{
uint16_t point_y_size_in_bits;
uint16_t pub_exp_size_in_bits;
} size2;
/* added for private key value import */
union
{
uint16_t priv_scalar_size_in_bits;
uint16_t priv_exp_size_in_bits;
} size3;
uint16_t sig_size_in_bits;
uint16_t info_size_in_bytes;
union
{
const uint8_t *p_x509_certificate;
uint64_t padding_sys64;
} ptr6;
uint16_t x509_certificate_size_in_bytes;
struct
{
r_key_property_flags_t disable_on_debug:1;
r_key_property_flags_t write_protected:1;
r_key_property_flags_t iso15118:1;
} flags;
uint8_t skip_verify;
} ISD_PK_IMPORT_t;
#endif /* R_ICUMIF_API_PK_IMPORT_H */

View File

@@ -0,0 +1,49 @@
/******************************************************************************/
/* 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_PK_IMPORT_EXT_H)
#define R_ICUMIF_API_PK_IMPORT_EXT_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_PK_IMPORT_EXT
{
r_key_group_t key_group;
r_key_index_t key_id;
struct
{
r_key_property_flags_t disable_on_debug:1;
r_key_property_flags_t write_protected:1;
r_key_property_flags_t iso15118:1;
} flags;
r_mem_cluster_verif_t mem_cluster_verif;
r_key_group_t sig_key_group;
r_key_index_t sig_key_id;
r_signature_algo_t sig_algo;
r_hash_primitive_t hash_primitive;
union
{
const uint32_t *p_x509_certificate;
uint64_t padding_sys64;
} ptr;
uint16_t x509_certificate_size_in_bytes;
uint8_t skip_verify;
} ISD_PK_IMPORT_EXT_t;
#endif /* R_ICUMIF_API_PK_IMPORT_EXT_H */

View File

@@ -0,0 +1,62 @@
/******************************************************************************/
/* 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_RAND_GENERATE_H)
#define R_ICUMIF_API_RAND_GENERATE_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef enum
{
RAND_NO_TEST,
RAND_DIAG_P1_TEST,
RAND_DIAG_P2_TEST,
RAND_HEALTH_TEST,
LAST_ITEM_RAND_TEST = 0x01000000
} r_rand_test_t;
typedef struct _ISD_RAND_INIT
{
r_rand_test_t online_test;
}
ISD_RAND_INIT_t;
typedef struct _ISD_RAND_EXTEND_SEED
{
union
{
const uint32_t *p_entropy;
const uint64_t padding_sys64;
} ptr;
}
ISD_RAND_EXTEND_SEED_t;
typedef struct ISD_RAND_GENERATE
{
union
{
uint32_t *p_block_out;
uint64_t padding_sys64;
} ptr;
uint32_t nb_blocks;
r_job_slice_t job_slice;
}
ISD_RAND_GENERATE_t;
#endif /* R_ICUMIF_API_RAND_GENERATE_H */

View File

@@ -0,0 +1,51 @@
/******************************************************************************/
/* 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_RSA_DECRYPT_H)
#define R_ICUMIF_API_RSA_DECRYPT_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_RSA_DECRYPT
{
union
{
const uint8_t* p_encrypted_message; /* in */
uint64_t padding_sys64;
} ptr1;
uint16_t encrypted_message_size_in_bits; /* in */
union
{
uint8_t* p_message; /* out */
uint64_t padding_sys64;
} ptr2;
uint32_t message_size_in_bytes; /* out */
union
{
const uint8_t* p_label; /* in */
uint64_t padding_sys64;
} ptr3;
uint32_t label_size_in_bytes; /* in */
r_hash_primitive_t hash_primitive; /* in */
r_message_encoding_format_t message_encoding_format; /* in */
r_key_index_t key_id; /* in */
r_number_format_t encrypted_message_format; /* in */
r_job_slice_t job_slice_mod_exp; /* in */
} ISD_RSA_DECRYPT_t;
#endif /* R_ICUMIF_API_RSA_DECRYPT_H */

View File

@@ -0,0 +1,52 @@
/******************************************************************************/
/* 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_RSA_ENCRYPT_H)
#define R_ICUMIF_API_RSA_ENCRYPT_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_RSA_ENCRYPT
{
union
{
const uint8_t* p_message; /* in */
uint64_t padding_sys64;
} ptr1;
uint32_t message_size_in_bytes; /* in */
union
{
uint8_t* p_encrypted_message; /* out */
uint64_t padding_sys64;
} ptr2;
uint16_t encrypted_message_size_in_bits; /* out */
union
{
const uint8_t* p_label; /* in (option for OAEP) */
uint64_t padding_sys64;
} ptr3;
uint32_t label_size_in_bytes; /* in (option for OAEP) */
r_hash_primitive_t hash_primitive; /* in */
r_message_encoding_format_t message_encoding_format; /* in */
r_key_group_t key_group; /* in */
r_key_index_t key_id; /* in */
r_number_format_t encrypted_message_format; /* in */
r_job_slice_t job_slice_mod_exp; /* in */
} ISD_RSA_ENCRYPT_t;
#endif /* R_ICUMIF_API_RSA_ENCRYPT_H */

View File

@@ -0,0 +1,37 @@
/******************************************************************************/
/* 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_KEY_GENERATE_H)
#define R_ICUMIF_API_KEY_GENERATE_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_RSA_KEY_GENERATE
{
r_key_index_t key_id;
r_mem_cluster_verif_t mem_cluster_verif;
uint16_t modulus_size_in_bits;
struct
{
r_key_property_flags_t disable_on_debug:1;
r_key_property_flags_t write_protected:1;
} flags;
} ISD_RSA_KEY_GENERATE_t;
#endif /* R_ICUMIF_API_KEY_GENERATE_H */

View File

@@ -0,0 +1,48 @@
/******************************************************************************/
/* 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_RSA_SIGN_H)
#define R_ICUMIF_API_RSA_SIGN_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_RSA_SIGN
{
union
{
const uint8_t *p_source;
uint64_t padding_sys64;
} ptr1;
union
{
uint8_t *p_signature;
uint64_t padding_sys64;
} ptr2;
uint32_t source_size_in_bytes;
r_hash_primitive_t hash_primitive;
r_hash_encoding_format_t hash_encoding_format;
r_number_format_t signature_format;
r_key_index_t key_id;
r_job_slice_t job_slice_hash;
r_job_slice_t job_slice_mod_exp;
volatile uint16_t signature_size_in_bits;
volatile uint16_t salt_size_in_bytes;
uint8_t is_precalculated_hash;
} ISD_RSA_SIGN_t;
#endif /* R_ICUMIF_API_RSA_SIGN_H */

View File

@@ -0,0 +1,50 @@
/******************************************************************************/
/* 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_RSA_VERIFY_H)
#define R_ICUMIF_API_RSA_VERIFY_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_RSA_VERIFY
{
union
{
const uint8_t *p_source;
uint64_t padding_sys64;
} ptr1;
union
{
const uint8_t *p_signature;
uint64_t padding_sys64;
} ptr2;
uint32_t source_size_in_bytes;
uint16_t signature_size_in_bits;
uint16_t salt_size_in_bytes;
r_hash_primitive_t hash_primitive;
r_hash_encoding_format_t hash_encoding_format;
r_number_format_t signature_format;
r_key_group_t key_group;
r_key_index_t key_id;
r_job_slice_t job_slice_hash;
r_job_slice_t job_slice_mod_exp;
uint8_t is_precalculated_hash;
volatile r_verif_result_t verification_result;
} ISD_RSA_VERIFY_t;
#endif /* R_ICUMIF_API_RSA_VERIFY_H */

View File

@@ -0,0 +1,114 @@
/******************************************************************************/
/* 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 */

View File

@@ -0,0 +1,129 @@
/******************************************************************************/
/* 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_SHE_H)
#define R_ICUMIF_API_SHE_H
/**********************************************************************************/
/* SHE specific parameters */
/**********************************************************************************/
/*===========================================================================*/
/* SHE key index */
/*===========================================================================*/
typedef enum
{
SHE_SECRET_KEY, /* SHE key index : 0 */
SHE_MASTER_ECU_KEY, /* SHE key index : 1 */
SHE_BOOT_MAC_KEY, /* SHE key index : 2 */
SHE_BOOT_MAC, /* SHE key index : 3 */
SHE_KEY_1, /* SHE key index : 4 */
SHE_KEY_2, /* SHE key index : 5 */
SHE_KEY_3, /* SHE key index : 6 */
SHE_KEY_4, /* SHE key index : 7 */
SHE_KEY_5, /* SHE key index : 8 */
SHE_KEY_6, /* SHE key index : 9 */
SHE_KEY_7, /* SHE key index : 10 */
SHE_KEY_8, /* SHE key index : 11 */
SHE_KEY_9, /* SHE key index : 12 */
SHE_KEY_10, /* SHE key index : 13 */
SHE_RAM_KEY, /* SHE key index : 14 */
SHE_KEY_11, /* SHE key index : 15 */
SHE_KEY_12, /* SHE key index : 16 */
SHE_KEY_13, /* SHE key index : 17 */
SHE_KEY_14, /* SHE key index : 18 */
SHE_KEY_15, /* SHE key index : 19 */
SHE_KEY_16, /* SHE key index : 20 */
SHE_KEY_17, /* SHE key index : 21 */
SHE_KEY_18, /* SHE key index : 22 */
SHE_KEY_19, /* SHE key index : 23 */
SHE_KEY_20, /* SHE key index : 24 */
SHE_KEY_21, /* SHE key index : 25 */
SHE_KEY_22, /* SHE key index : 26 */
SHE_KEY_23, /* SHE key index : 27 */
SHE_KEY_24, /* SHE key index : 28 */
SHE_KEY_25, /* SHE key index : 29 */
SHE_KEY_26, /* SHE key index : 30 */
SHE_KEY_27, /* SHE key index : 31 */
SHE_KEY_28, /* SHE key index : 32 */
SHE_KEY_29, /* SHE key index : 33 */
SHE_KEY_30, /* SHE key index : 34 */
SHE_KEY_31, /* SHE key index : 35 */
SHE_KEY_32, /* SHE key index : 36 */
SHE_KEY_33, /* SHE key index : 37 */
SHE_KEY_34, /* SHE key index : 38 */
SHE_KEY_35, /* SHE key index : 39 */
SHE_KEY_36, /* SHE key index : 40 */
SHE_KEY_37, /* SHE key index : 41 */
SHE_KEY_38, /* SHE key index : 42 */
SHE_KEY_39, /* SHE key index : 43 */
SHE_KEY_40, /* SHE key index : 44 */
SHE_KEY_41, /* SHE key index : 45 */
SHE_KEY_42, /* SHE key index : 46 */
SHE_KEY_43, /* SHE key index : 47 */
SHE_KEY_44, /* SHE key index : 48 */
SHE_KEY_45, /* SHE key index : 49 */
SHE_KEY_46, /* SHE key index : 50 */
SHE_KEY_47, /* SHE key index : 51 */
SHE_KEY_48, /* SHE key index : 52 */
SHE_KEY_49, /* SHE key index : 53 */
SHE_KEY_50, /* SHE key index : 54 */
SHE_KEY_51, /* SHE key index : 55 */
SHE_KEY_52, /* SHE key index : 56 */
SHE_KEY_53, /* SHE key index : 57 */
SHE_KEY_54, /* SHE key index : 58 */
SHE_KEY_55, /* SHE key index : 59 */
SHE_KEY_56, /* SHE key index : 60 */
SHE_KEY_57, /* SHE key index : 61 */
SHE_KEY_58, /* SHE key index : 62 */
SHE_KEY_59, /* SHE key index : 63 */
SHE_KEY_60, /* SHE key index : 64 */
SHE_KEY_61, /* SHE key index : 65 */
SHE_KEY_62, /* SHE key index : 66 */
SHE_KEY_63, /* SHE key index : 67 */
SHE_KEY_64, /* SHE key index : 68 */
SHE_KEY_65, /* SHE key index : 69 */
SHE_KEY_66, /* SHE key index : 70 */
SHE_KEY_67, /* SHE key index : 71 */
SHE_KEY_68, /* SHE key index : 72 */
SHE_KEY_69, /* SHE key index : 73 */
SHE_KEY_70, /* SHE key index : 74 */
SHE_KEY_71, /* SHE key index : 75 */
SHE_KEY_72, /* SHE key index : 76 */
SHE_KEY_73, /* SHE key index : 77 */
SHE_KEY_74, /* SHE key index : 78 */
SHE_KEY_75, /* SHE key index : 79 */
SHE_KEY_76, /* SHE key index : 80 */
SHE_KEY_77, /* SHE key index : 81 */
SHE_KEY_78, /* SHE key index : 82 */
SHE_KEY_79, /* SHE key index : 83 */
SHE_KEY_80, /* SHE key index : 84 */
SHE_KEY_81, /* SHE key index : 85 */
SHE_KEY_82, /* SHE key index : 86 */
SHE_KEY_83, /* SHE key index : 87 */
SHE_KEY_84, /* SHE key index : 88 */
SHE_KEY_85, /* SHE key index : 89 */
SHE_KEY_86, /* SHE key index : 90 */
SHE_KEY_87, /* SHE key index : 91 */
SHE_KEY_88, /* SHE key index : 92 */
SHE_KEY_89, /* SHE key index : 93 */
SHE_KEY_90, /* SHE key index : 94 */
LAST_ITEM_SHE_KEY = 0x01000000
} r_she_key_index_t;
#endif /* R_ICUMIF_API_SHE_H */

View File

@@ -0,0 +1,196 @@
/******************************************************************************/
/* 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_SYS_CFG_H)
#define R_ICUMIF_API_SYS_CFG_H
/**********************************************************************************/
/* Defines */
/**********************************************************************************/
#define STARTUP_BANK_A (0xA5u)
#define STARTUP_BANK_B (0x00u)
#define ECC_TEST_UNLOCK (0x00u)
#define ECC_TEST_LOCK (0x01u)
#define SYS_CFG_NORMAL_STARTUP_PE (0x00u)
#define SYS_CFG_EARLY_STARTUP_PE (0x01u)
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
#define SYS_CFG_MEMCLUSTER_MAX_ID (32u)
typedef enum
{
SET_KEY_MAPPING,
SET_BOOT_STAGE,
SET_MYDATA_MAPPING,
SET_MONOCTR_MAPPING,
SET_SECURE_TICK,
SET_SYS_INTERRUPT,
SET_WDT,
SET_CMAC_MIN,
SET_SECURE_BOOT_CFG,
SET_DEBUG,
SET_RAND,
SET_START_PE,
SET_EARLY_STARTUP_PE,
SET_MEMCLUSTER_MAPPING,
SET_ECC_TEST_LOCK,
SET_FLS_CFG,
SET_VM_CFG,
LAST_ITEM_CONFIG = 0x01000000
} sys_config_t;
typedef struct
{
uint16_t nb_aes_keys;
uint16_t nb_rsa_priv_keys;
uint16_t nb_rsa_pub_keys;
uint16_t nb_ecc_priv_keys;
uint16_t nb_ecc_pub_keys;
uint16_t nb_rsa_pub_ext_keys;
uint16_t nb_ecc_pub_ext_keys;
uint16_t nb_aes_ram_keys;
uint16_t nb_aes_buffer_keys;
uint16_t nb_ecc_ram_keys;
uint16_t nb_hmac_keys;
uint16_t nb_tls_master_keys;
} sys_cfg_key_mapping_t;
typedef struct
{
uint8_t nb_items;
uint16_t item_size_in_bytes;
} sys_cfg_mydata_set_t;
typedef enum
{
SANCTION_DO_NOTHING,
SANCTION_DEVICE_STOP,
SANCTION_ICUM_ADMIN,
LAST_ITEM_SANCTION = 0x01000000
} r_sanction_t;
typedef struct
{
uint8_t peid:4;
uint8_t channel:4;
} sys_cfg_sys_int_t;
typedef struct
{
uint16_t int_freq;
} sys_cfg_secure_tick_t;
typedef struct
{
uint32_t erm;
} sys_cfg_watchdog_t;
typedef struct
{
uint8_t bclr_psm;
uint8_t nsbf_psm;
uint16_t enable_skip_secureboot;
} sys_cfg_boot_t;
typedef struct
{
uint8_t mc_length_min_ctr;
uint8_t mc_length_min_val;
uint8_t short_mac_length_min_ctr;
uint8_t short_mac_length_min_val;
} sys_cfg_cmac_min_t;
typedef struct
{
uint32_t rand_trng_pre_init_start;
uint32_t rand_olt_no_ds_reset;
uint32_t rand_olt_ds_reset;
uint32_t rand_first_init_type;
} sys_cfg_rand_t;
typedef struct
{
uint32_t cr_auth_key_type;
uint32_t cr_auth_dlt;
} sys_cfg_debug_t;
typedef struct
{
uint16_t warning1;
uint16_t warning2;
} sys_cfg_fls_t;
typedef enum
{
NONE_VM,
UNIQUE_VM_ID_ALL_CORE,
LAST_ITEM_VM_TYPE = 0x01000000
} sys_cfg_vm_type_t;
typedef struct
{
sys_cfg_vm_type_t vm_type;
uint8_t nb_vms;
uint8_t privilege_vm_id;
uint8_t memcluster_vm_id[SYS_CFG_MEMCLUSTER_MAX_ID];
} sys_cfg_vm_t;
typedef struct
{
r_verif_method_t verif_method;
r_sanction_t sanction;
r_job_slice_t job_slice;
} sys_cfg_cluster_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_SYSTEM_CONFIG
{
sys_config_t sys_cfg_id;
struct config_parameters
{
sys_cfg_key_mapping_t key_mapping;
sys_cfg_mydata_set_t mydata_set;
uint8_t nb_monoctr_nv;
uint8_t mem_cluster_mapping;
sys_cfg_sys_int_t sys_interrupt;
sys_cfg_secure_tick_t secure_tick;
sys_cfg_watchdog_t watchdog;
sys_cfg_boot_t boot;
sys_cfg_cmac_min_t mac_length;
r_stage_type_t life_cycle_stage;
sys_cfg_debug_t debug;
sys_cfg_rand_t rand;
sys_cfg_cluster_t cluster;
uint8_t start_pe_set;
uint8_t early_startup_pe;
uint8_t test_lock;
sys_cfg_fls_t fls_cfg;
sys_cfg_vm_t vm_cfg;
} cfg;
} ISD_SYSTEM_CONFIG_t;
#endif /* R_ICUMIF_API_SYS_CFG_H */

View File

@@ -0,0 +1,40 @@
/******************************************************************************/
/* 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_SYS_INIT_H)
#define R_ICUMIF_API_SYS_INIT_H
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef enum
{
SYS_INIT_FW_INITIALIZATION,
LAST_ITEM_SYS_INIT = 0x01000000
} sys_init_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_SYSTEM_INIT
{
sys_init_t sys_init_id;
} ISD_SYSTEM_INIT_t;
#endif /* R_ICUMIF_API_SYS_INIT_H */

View File

@@ -0,0 +1,49 @@
/******************************************************************************/
/* 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_TLS_ECDH_EXCHANGE_H)
#define R_ICUMIF_API_TLS_ECDH_EXCHANGE_H
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_TLS_ECDH_EXCHANGE
{
union
{
const uint8_t *p_client_random;
uint64_t padding_sys64;
} ptr1;
union
{
const uint8_t *p_server_random;
uint64_t padding_sys64;
} ptr2;
r_key_group_t ecc_priv_key_group;
r_key_index_t ecc_priv_key_id;
r_key_group_t ecc_pub_key_group;
r_key_index_t ecc_pub_key_id;
r_key_index_t master_secret_id;
r_key_index_t aes_send_key_id;
r_key_index_t aes_receive_key_id;
r_key_index_t hmac_send_key_id;
r_key_index_t hmac_receive_key_id;
uint32_t hmac_key_size_in_bytes;
r_job_slice_t job_slice_multiply;
} ISD_TLS_ECDH_EXCHANGE_t;
#endif /* R_ICUMIF_API_TLS_ECDH_EXCHANGE_H */

View File

@@ -0,0 +1,63 @@
/******************************************************************************/
/* 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_TLS_RSA_EXCHANGE_H)
#define R_ICUMIF_API_TLS_RSA_EXCHANGE_H
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef struct
{
uint8_t major;
uint8_t minor;
} protocol_version_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_TLS_RSA_EXCHANGE
{
protocol_version_t protocol_version;
union
{
const uint8_t *p_client_random;
uint64_t padding_sys64;
} ptr1;
union
{
const uint8_t *p_server_random;
uint64_t padding_sys64;
} ptr2;
r_key_index_t rsa_pub_key_id;
r_key_index_t master_secret_id;
r_key_index_t aes_send_key_id;
r_key_index_t aes_receive_key_id;
r_key_index_t hmac_send_key_id;
r_key_index_t hmac_receive_key_id;
uint32_t hmac_key_size_in_bytes;
r_job_slice_t job_slice_mod_exp;
union
{
uint8_t *p_premaster;
uint64_t padding_sys64;
} ptr3;
uint32_t premaster_size_in_bytes;
} ISD_TLS_RSA_EXCHANGE_t;
#endif /* R_ICUMIF_API_TLS_RSA_EXCHANGE_H */

View File

@@ -0,0 +1,55 @@
/******************************************************************************/
/* 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_TLS_VERIFY_DATA_H)
#define R_ICUMIF_API_TLS_VERIFY_DATA_H
/**********************************************************************************/
/* Type definition */
/**********************************************************************************/
typedef enum
{
TLS_VERIFY_CLIENT,
TLS_VERIFY_SERVER,
LAST_ITEM_TLS_VERIFY_DATA = 0x01000000
} tls_verify_data_operation_t;
/**********************************************************************************/
/* Service parameters */
/**********************************************************************************/
typedef struct ISD_TLS_VERIFY_DATA
{
r_key_index_t key_id;
union
{
const uint8_t *p_msg;
uint64_t padding_sys64;
} ptr1;
uint32_t msg_size_in_bytes;
union
{
uint8_t *p_verify;
uint64_t padding_sys64;
} ptr2;
uint32_t verify_size_in_bytes;
tls_verify_data_operation_t side;
r_job_slice_t job_slice_hash;
} ISD_TLS_VERIFY_DATA_t;
#endif /* R_ICUMIF_API_TLS_VERIFY_DATA_H */

View File

@@ -0,0 +1,24 @@
/******************************************************************************/
/* 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_TYPEDEFS_H)
#define R_TYPEDEFS_H
#include <stddef.h>
#include <stdint.h>
#endif /* R_TYPEDEFS_H */

View File

@@ -0,0 +1,158 @@
/******************************************************************************/
/* Component Name ICU-M COMM(PE) Driver */
/******************************************************************************/
/* 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(ICUM_D_COMM_PE_PUB_H)
#define ICUM_D_COMM_PE_PUB_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**************************************************************************************/
/* Return Value Definition */
/**************************************************************************************/
#define ER_OK (0x00000000U)
#define ER_PARAM (0x00000001U)
#define ER_D_COMM_BASE (0x00000400U)
#define ER_D_COMM_QUE_FULL (ER_D_COMM_BASE+1U) /* Service request queue FULL */
#define ER_D_COMM_NO_ISD (ER_D_COMM_BASE+2U) /* No ISD in service response queue */
#define ER_D_COMM_QUE_ALREADY_INIT (ER_D_COMM_BASE+3U) /* Service queue already initialized */
#define ER_D_COMM_QUE_NOT_INIT (ER_D_COMM_BASE+4U) /* Service queue not initialized */
#define ER_D_COMM_PARAM_NOT_G_RAM (ER_D_COMM_BASE+5U) /* Param not within global RAM area */
#define ER_D_COMM_QUE_NOT_ACCESS (ER_D_COMM_BASE+6U)
#define ER_D_COMM_EXIST_ISD (ER_D_COMM_BASE+7U) /* ISD is exist in service response queue */
#define ER_D_COMM_MEMCHK_NG (ER_D_COMM_BASE+8U) /* address not within RAM area */
#define ER_D_COMM_ALIGN_NG (ER_D_COMM_BASE+9U) /* address not alignment NG */
/**************************************************************************************/
/* Definition */
/**************************************************************************************/
/* Bit pattern indicate channel No. of interrupt to send ( ICUM_COMM_INT_TO_CHANNEL ) */
#define ICUM_COMM_ICH_TO_SERV_REQUEST (0x00000002U)
#define ICUM_COMM_ICH_TO_CF_PRG_NOTIFY (0x00000004U)
#define ICUM_COMM_ICH_TO_DF_PRG_NOTIFY (0x00000008U)
#define ICUM_COMM_ICH_TO_CF_PRG_ERROR (0x00000010U)
#define ICUM_COMM_ICH_TO_DF_PRG_ERROR (0x00000020U)
#define ICUM_COMM_ICH_TO_OPERATION_END (0x00000040U)
/* Service execution request single interrupt */
#define ICUM_COMM_ICH_TO_SINGLE_INTERRUPT (0x00000001U)
/* Channel No. of interrupt to receive ( ICUM_COMM_INT_FROM_CHANNEL ) */
#define ICUM_COMM_ICH_FM_SYS_INTERRUPT (0U)
#define ICUM_COMM_ICH_FM_SERV_RESPONSE (1U)
/* PE status information ( ICUM_COMM_INFO_PE_STATUS ) */
#define ICUM_COMM_INF_PE_ST_FLS_DF_PRG (0U)
#define ICUM_COMM_INF_PE_ST_FLS_CF_PRG (1U)
#define ICUM_COMM_INF_PE_ST_FLS_OPRN (2U)
#define ICUM_COMM_INF_PE_ST_FACIACCDIS (3U)
#define ICUM_COMM_INF_PE_ST_PEID (8U)
#define ICUM_COMM_MEMCHECK_OK (0x00U)
#define ICUM_COMM_MEMCHECK_ERROR (0x01U)
/* Total number of PE */
#define TOTAL_PE_NUM (7U)
/* Length of service queue ( SERVICE_QUEUE_LENGTH ) */
#define REQUEST_QUEUE_LENGTH (16U)
#define RESPONSE_QUEUE_LENGTH (16U)
#define RESPONSE_QUEUE_OFST (16U)
#define PE_QUEUE_DUMMY (0U)
#define TOTAL_QUEUE_LENGTH (REQUEST_QUEUE_LENGTH + PE_QUEUE_DUMMY + RESPONSE_QUEUE_LENGTH + PE_QUEUE_DUMMY)
#define VM_QUEUE_LENGTH (4U)
/* Defines item of memory information */
extern const uint32_t memory_information[];
#define MEM_INFO_SERVICEQUE_1_ADDR (memory_information[0])
#define MEM_INFO_SERVICEQUE_1_SIZE (memory_information[1])
#define MEM_INFO_SHAREDMEM_1_ADDR (memory_information[2])
#define MEM_INFO_SHAREDMEM_1_SIZE (memory_information[3])
#define MEM_INFO_SHAREDMEM_2_ADDR (memory_information[4])
#define MEM_INFO_SHAREDMEM_2_SIZE (memory_information[5])
#define MEM_INFO_SHAREDMEM_3_ADDR (memory_information[6])
#define MEM_INFO_SHAREDMEM_3_SIZE (memory_information[7])
#define MEM_INFO_ICUM_SECUREMOD (memory_information[30])
/**************************************************************************************/
/* Macros */
/**************************************************************************************/
/***************************************************************************************
* Function ID : [ICUMFW_CD_S4_D_COMM_PE_0027]:[ICUMFW_UD_S4_D_COMM_PE_0027]
* Function name: GET_MY_PEID
* Description : Retrieve PEID from thread configurator register
* Arguments : None
*
* Return Value : PEID Value
***************************************************************************************/
extern uint32_t USER_ICUMIF_GetMyPEID(void);
#define GET_MY_PEID (USER_ICUMIF_GetMyPEID())
/**************************************************************************************/
/* Type definition */
/**************************************************************************************/
/*====================================================================================*/
/* Type definition: Channel number of interrupt to send */
/*====================================================================================*/
typedef uint32_t icum_comm_int_to_channel_t;
/*====================================================================================*/
/* Type definition: PE status information */
/*====================================================================================*/
typedef uint32_t icum_com_info_pe_status_t;
/**************************************************************************************/
/* Enumeration */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Structure Definition */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Prototypes */
/**************************************************************************************/
uint32_t D_COMM_PE_Init(uint32_t *p_request_queue);
uint32_t D_COMM_TriggerInterruptToICUP(icum_comm_int_to_channel_t channel,
r_icumif_isd_t *p_isd);
uint32_t D_COMM_GetResponseISD(r_icumif_isd_t **p_isd);
r_icumif_sts_t *D_COMM_GetICUStatusAddr(void);
uint32_t D_COMM_SetPEStatusInfo(icum_com_info_pe_status_t info, uint8_t set_value);
void D_COMM_SetInterruptEnable(void);
uint32_t D_COMM_SetSystemCallBackFunc(R_ICUMIF_CB_REGIST_t *p_regist_info);
uint32_t D_COMM_GetICUMemCheckErrInfo(uint8_t *p_error);
void D_COMM_IRQ_Handler(void);
uint32_t D_COMM_PE_CheckMemorySharedRAM(uint32_t start_addr, uint32_t size);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ICUM_D_COMM_PE_PUB_H */

View File

@@ -0,0 +1,95 @@
/******************************************************************************/
/* 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_PUB_H)
#define R_ICUMIF_PUB_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**************************************************************************************/
/* Return Value Definition */
/**************************************************************************************/
/*===========================================================================*/
/* Definition of return value of ICU-M interface primitive */
/*===========================================================================*/
#define R_ICUMIF_ER_OK (0) /* Successful completion */
#define R_ICUMIF_ER_PARAM_ALIGNMENT (-1) /* Parameter alignment error */
#define R_ICUMIF_ER_PARAM_RANGE (-2) /* Parameter range error */
#define R_ICUMIF_ER_ADDR_NOT_G_RAM (-3) /* Address not within global RAM area */
#define R_ICUMIF_ER_IF_LIB_NOT_INIT (-4) /* ICU-M interface library not initialized */
#define R_ICUMIF_ER_REQ_QUEUE_FULL (-5) /* Service request queue FULL */
#define R_ICUMIF_ER_SOFTWARE_ERROR (-99) /* Software error */
/* Used only by R_ICUMIF_IsServiceCompleted */
#define R_ICUMIF_RTN_SERV_RUNNING (0) /* Service running */
#define R_ICUMIF_RTN_SERV_COMPLETION (1) /* Service execution completion */
/**************************************************************************************/
/* Definition */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Macros */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Type definition */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Enumeration */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Structure Definition */
/**************************************************************************************/
/*===========================================================================*/
/* Type definition: Registration information of call back function */
/*===========================================================================*/
typedef struct R_ICUMIF_CB_REGIST
{
void (*p_func_addr)(void);
} R_ICUMIF_CB_REGIST_t;
/**********************************************************************************/
/* Prototypes */
/**********************************************************************************/
int32_t R_ICUMIF_Init(uint32_t *p_request_queue);
int32_t R_ICUMIF_ServiceRequest(r_icumif_isd_t *p_ISD);
int32_t R_ICUMIF_ServiceResponse(void);
int32_t R_ICUMIF_IsServiceCompleted(r_icumif_isd_t *p_ISD);
r_icumif_sts_t *R_ICUMIF_GetStatus(void);
int32_t R_ICUMIF_SetSystemCallBackFunc(R_ICUMIF_CB_REGIST_t *p_regist_info);
void R_ICUMIF_IRQ_Handler(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* #if !defined(R_ICUMIF_PUB_H) */

View File

@@ -0,0 +1,39 @@
/******************************************************************************/
/* Component Name Customer-implement component */
/******************************************************************************/
/* 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(USER_ICUMIF_API_PUB_H)
#define USER_ICUMIF_API_PUB_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/***************************************************************************************/
/* Prototypes */
/***************************************************************************************/
extern void USER_ICUMIF_FlushDCache(uint32_t addr, uint32_t size);
extern void USER_ICUMIF_InvalidateDCache(uint32_t addr, uint32_t size);
extern uint32_t USER_ICUMIF_GetMyPEID(void);
extern void USER_ICUMIF_GetLock(uintptr_t *p_saved_psw);
extern void USER_ICUMIF_ReleaseLock(uintptr_t saved_psw);
extern void USER_ICUMIF_Sync(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* #if !defined(USER_ICUMIF_API_PUB_H) */

View File

@@ -0,0 +1,522 @@
/*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
* Copyright 2018-2025 Renesas Electronics Corporation All rights reserved.
*******************************************************************************/
/*******************************************************************************
* DESCRIPTION : ICUMIF control function
******************************************************************************/
/******************************************************************************
* @file secure_boot.c
* - Version : 0.08
* @brief ICUMIF controller.
* .
*****************************************************************************/
/******************************************************************************
* History : DD.MM.YYYY Version Description
* : 16.06.2022 0.01 First Release
* : 22.07.2022 0.02 Change CMAC address settings
* Added include file
* Changed for Warning measures
* : 31.10.2022 0.03 License notation change.
* : 07.12.2022 0.04 Warning support when log output is disabled
* : 15.02.2023 0.05 Added final_hash_cmp function.
* : 04.04.2023 0.06 Removed stdio.h.
* : 21.08.2023 0.07 Add support for V4M.
* : 14.01.2024 0.08 Add parameter setting process for RTOS#1/#2.
*****************************************************************************/
#include "log.h"
#include "timer.h"
#include "r_icumif_api.h"
#include "r_icumif_pub.h"
#include "icum_d_comm_pe_pub.h"
#include "shared.h"
#include "image_load.h"
#include "secure_boot.h"
#include "rst_register.h"
#define LCS_CM (0x00000000U) /* CM */
#define LCS_DM (0x00000001U) /* DM */
#define LCS_SD (0x00000003U) /* SD */
#define LCS_SE (0x00000005U) /* SE */
#define LCS_FA (0x00000007U) /* FA */
#define RST_MODEMR0_MD5 (0x00000020U)
#define CX_CMAC_COPY (4U)
#define CX_ICUMIF_STATUS (0x1000F800UL)
#define CX_SIZEOF_CNT (4U)
#define CX_CMAC_SIZE (16U)
/* Definitions for hash_cmp */
#define HASH_CMP_NUM (0x2U) /* The number of hash check images */
#define HASH_SIZE (32U) /* Hash size (32-bytes) */
#define CR52_IPL_HASH_SAVE_ADDR (0xE635FF40U) /* Hash save address for CR52 IPL */
#define SECURE_FW_HASH_SAVE_ADDR (0xE635FFC0U) /* Hash save address for Secure FW */
static void secureboot_memset(void *buff, uint32_t data, uint32_t cnt);
static void secureboot_service(r_icumif_isd_t *p_ISD);
void secureboot_init(void)
{
int32_t r_errno;
volatile uint32_t *status;
status = (volatile uint32_t *)R_ICUMIF_GetStatus();
/* Wait until the ICU-M system intialization is complete */
while(true)
{
if((*status & CX_ICUMIF_STATUS) != 0UL)
{
break;
}
else
{
micro_wait(100U); /* 100 micro sec */
}
}
r_errno = R_ICUMIF_Init((uint32_t *)((uintptr_t)MEM_INFO_SERVICEQUE_1_ADDR));
if(r_errno != R_ICUMIF_ER_OK)
{
ERROR("R_ICUMIF_Init:Error code = (0x%x).\n", (unsigned int)r_errno);
panic;
}
}
/* End of function secureboot_init(void) */
uint32_t judge_bootmode(void)
{
uint32_t *p_lcs;
r_icumif_isd_t *p_ISD;
uint32_t md;
uint32_t is_verify = SECURE_BOOT;
__attribute__((unused))const char *lcs_name[8U] = {
[LCS_CM] = "CM",
[LCS_DM] = "DM",
[LCS_SD] = "SD",
[LCS_SE] = "SE",
[LCS_FA] = "FA",
};
secureboot_memset(ISD_BUFFER, 0U, SIZE_OF_ISD_BUFFER);
secureboot_memset(LCS_BUFFER, 0U, SIZE_OF_LCS_BUFFER);
/* initialize the global icum service header */
p_ISD = (r_icumif_isd_t *)ISD_BUFFER;
p_lcs = (uint32_t *)LCS_BUFFER;
p_ISD->service_id = SERVICE_00_SECURE_BOOT_API;
p_ISD->ptr.p_callbackfunc = NULL;
p_ISD->job_id = 0U;
p_ISD->res_nointerrupt = R_ICUMIF_REQRES_NOINTERRPUT;
p_ISD->prm.SECURE_BOOT_API.boot_api_id = ROM_GET_LCS;
p_ISD->prm.SECURE_BOOT_API.api.get_lcs.ptr.p_lcs = p_lcs;
p_ISD->prm.SECURE_BOOT_API.api.get_lcs.lcs_size_in_bytes = SIZE_OF_LCS_BUFFER;
/* trigger the service request */
secureboot_service(p_ISD);
if(ROMAPI_OK != p_ISD->prm.SECURE_BOOT_API.api_return_value)
{
ERROR("SECURE_BOOT_API:Error code = (0x%x).\n",
(unsigned int)p_ISD->prm.SECURE_BOOT_API.api_return_value);
panic;
}
else
{
/* LCM Status check */
if(( LCS_CM != *p_lcs)
&& ( LCS_DM != *p_lcs)
&& ( LCS_SD != *p_lcs)
&& ( LCS_SE != *p_lcs)
&& ( LCS_FA != *p_lcs))
{
ERROR("LCM state error. LCS = 0x%x\n", (unsigned int)*p_lcs );
panic;
}
else
{
NOTICE("LCM state is %s\n",lcs_name[*p_lcs]);
}
}
md = (mem_read32(RST_MODEMR0) & RST_MODEMR0_MD5) >> 5U;
if (LCS_SD == *p_lcs)
{
/* LCS=SD => Normal boot */
is_verify = NORMAL_BOOT;
}
else if ((LCS_SE != *p_lcs) && ( 1U == md))
{
/* LCS=CM/DM/FA and MD5=1 => Normal boot */
is_verify = NORMAL_BOOT;
}
else
{
/* LCS=SE => Secure boot */
/* LCS=CM/DM/FA and MD5=0 => Secure boot */
is_verify = SECURE_BOOT;
}
if (NORMAL_BOOT != is_verify)
{
#if (RCAR_LSI == RCAR_S4)
NOTICE("Secure boot(CA55 Loader)\n");
#elif ((RCAR_LSI == RCAR_V4H) || (RCAR_LSI == RCAR_V4M))
#ifdef AARCH64
NOTICE("Secure boot(CA76 Loader)\n");
#else
NOTICE("Secure boot(CR52 Loader)\n");
#endif
#endif /* RCAR_LSI == RCAR_S4 */
}
else
{
#if (RCAR_LSI == RCAR_S4)
NOTICE("Normal boot(CA55 Loader)\n");
#elif ((RCAR_LSI == RCAR_V4H) || (RCAR_LSI == RCAR_V4M))
#ifdef AARCH64
NOTICE("Normal boot(CA76 Loader)\n");
#else
NOTICE("Normal boot(CR52 Loader)\n");
#endif
#endif /* RCAR_LSI == RCAR_S4 */
}
return is_verify;
}
/* End of function judge_bootmode(void) */
void secureboot_verify(LOAD_INFO* li, uint32_t start, uint32_t end)
{
uint32_t *p_cmac;
r_icumif_isd_t *p_ISD;
uint32_t loop;
uint32_t i;
volatile uintptr_t p_content_cert;
volatile uintptr_t p_key_cert;
secureboot_memset(ISD_BUFFER, 0U, SIZE_OF_ISD_BUFFER);
p_ISD = (r_icumif_isd_t *)ISD_BUFFER;
/* Set Load info parameter */
for (loop = start; loop < end; loop++)
{
secureboot_memset(CMAC_BUFFER, 0U, SIZE_OF_CMAC_BUFFER);
p_cmac = (uint32_t *)CMAC_BUFFER;
p_ISD->service_id = SERVICE_00_SECURE_BOOT_API;
p_ISD->ptr.p_callbackfunc = NULL;
p_ISD->job_id = 0U;
p_ISD->res_nointerrupt = R_ICUMIF_REQRES_NOINTERRPUT;
p_ISD->prm.SECURE_BOOT_API.boot_api_id
= ROM_SECURE_BOOT_VERIFY;
p_key_cert = li[loop].key_cert_addr;
p_content_cert = li[loop].cnt_cert_addr;
p_ISD->prm.SECURE_BOOT_API.api.
boot_verify.ptr1.p_key_cert = (uint32_t*)p_key_cert;
p_ISD->prm.SECURE_BOOT_API.api.
boot_verify.ptr2.p_content_cert = (uint32_t*)p_content_cert;
p_ISD->prm.SECURE_BOOT_API.api.
boot_verify.ptr3.p_cmac = p_cmac;
/* trigger the service request */
secureboot_service(p_ISD);
if(ROMAPI_OK != p_ISD->prm.SECURE_BOOT_API.api_return_value)
{
ERROR("SECURE_BOOT_API:Error code = (0x%x).\n",
(unsigned int)p_ISD->prm.SECURE_BOOT_API.api_return_value);
panic;
}
else
{
for (i = 0U; i < CX_CMAC_COPY; i++)
{
li[loop].cmac[i] = *(p_cmac++);
}
}
}
#if ((RCAR_LSI == RCAR_V4H) || (RCAR_LSI == RCAR_V4M))
/* Set Load info parameter */
/* For RTOS#0 */
secureboot_memset(CMAC_BUFFER, 0U, CX_CMAC_SIZE);
p_cmac = (uint32_t *)CMAC_BUFFER;
p_ISD->service_id = SERVICE_00_SECURE_BOOT_API;
p_ISD->ptr.p_callbackfunc = NULL;
p_ISD->job_id = 0U;
p_ISD->res_nointerrupt = R_ICUMIF_REQRES_NOINTERRPUT;
p_ISD->prm.SECURE_BOOT_API.boot_api_id
= ROM_SECURE_BOOT_VERIFY;
p_key_cert = li[RTOS_ID].key_cert_addr;
p_content_cert = li[RTOS_ID].cnt_cert_addr;
p_ISD->prm.SECURE_BOOT_API.api.
boot_verify.ptr1.p_key_cert = (uint32_t*)p_key_cert;
p_ISD->prm.SECURE_BOOT_API.api.
boot_verify.ptr2.p_content_cert = (uint32_t*)p_content_cert;
p_ISD->prm.SECURE_BOOT_API.api.
boot_verify.ptr3.p_cmac = p_cmac;
/* trigger the service request */
secureboot_service(p_ISD);
if(ROMAPI_OK != p_ISD->prm.SECURE_BOOT_API.api_return_value)
{
ERROR("SECURE_BOOT_API:Error code = (0x%x).\n",
(unsigned int)p_ISD->prm.SECURE_BOOT_API.api_return_value);
panic;
}
else
{
for (i = 0U; i < CX_CMAC_COPY; i++)
{
li[RTOS_ID].cmac[i] = *(p_cmac++);
}
}
#if (RTOS_LOAD_NUM == RTOS_LOAD_NUM_3)
/* For RTOS#1,RTOS#2 */
for (loop = RTOS1_ID; loop <= RTOS2_ID; loop++)
{
secureboot_memset(CMAC_BUFFER, 0U, CX_CMAC_SIZE);
p_cmac = (uint32_t *)CMAC_BUFFER;
p_ISD->service_id = SERVICE_00_SECURE_BOOT_API;
p_ISD->ptr.p_callbackfunc = NULL;
p_ISD->job_id = 0U;
p_ISD->res_nointerrupt = R_ICUMIF_REQRES_NOINTERRPUT;
p_ISD->prm.SECURE_BOOT_API.boot_api_id
= ROM_SECURE_BOOT_VERIFY;
p_key_cert = li[loop].key_cert_addr;
p_content_cert = li[loop].cnt_cert_addr;
p_ISD->prm.SECURE_BOOT_API.api.
boot_verify.ptr1.p_key_cert = (uint32_t*)p_key_cert;
p_ISD->prm.SECURE_BOOT_API.api.
boot_verify.ptr2.p_content_cert = (uint32_t*)p_content_cert;
p_ISD->prm.SECURE_BOOT_API.api.
boot_verify.ptr3.p_cmac = p_cmac;
/* trigger the service request */
secureboot_service(p_ISD);
if(ROMAPI_OK != p_ISD->prm.SECURE_BOOT_API.api_return_value)
{
ERROR("SECURE_BOOT_API:Error code = (0x%x).\n",
(unsigned int)p_ISD->prm.SECURE_BOOT_API.api_return_value);
panic;
}
else
{
for (i = 0U; i < CX_CMAC_COPY; i++)
{
li[loop].cmac[i] = *(p_cmac++);
}
}
}
#endif /* RTOS_LOAD_NUM == RTOS_LOAD_NUM_3 */
#endif /* RCAR_LSI == RCAR_V4H || RCAR_LSI == RCAR_V4M */
}
/* End of function secureboot_verify(void) */
int secureboot_image(LOAD_INFO* li, int do_panic)
{
uint32_t *p_cmac;
uint32_t *p_hash;
r_icumif_isd_t *p_ISD;
uint32_t i;
volatile uintptr_t p_content_cert;
secureboot_memset(ISD_BUFFER, 0U, SIZE_OF_ISD_BUFFER);
secureboot_memset(CMAC_BUFFER, 0U, SIZE_OF_CMAC_BUFFER);
secureboot_memset(HASH_BUFFER, 0U, SIZE_OF_HASH_BUFFER);
/* initialize the global icum service header */
p_ISD = (r_icumif_isd_t *)ISD_BUFFER;
p_cmac = (uint32_t *)CMAC_BUFFER;
p_hash = (uint32_t *)HASH_BUFFER;
for (i = 0U; i < CX_CMAC_COPY; i++)
{
*(p_cmac++) = li->cmac[i];
}
p_ISD->service_id = SERVICE_00_SECURE_BOOT_API;
p_ISD->ptr.p_callbackfunc = NULL;
p_ISD->job_id = 0U;
p_ISD->res_nointerrupt = R_ICUMIF_REQRES_NOINTERRPUT;
p_ISD->prm.SECURE_BOOT_API.boot_api_id = ROM_SECURE_BOOT_DECRYPT;
p_content_cert = li->cnt_cert_addr;
p_ISD->prm.SECURE_BOOT_API.api.
boot_decrypt.ptr1.p_content_cert = (uint32_t*)p_content_cert;
p_ISD->prm.SECURE_BOOT_API.api.
boot_decrypt.ptr2.p_cmac = (uint32_t *)CMAC_BUFFER;
/* trigger the service request */
secureboot_service(p_ISD);
if(( ROMAPI_OK != p_ISD->prm.SECURE_BOOT_API.api_return_value) &&
(ROM_ERR_IMG_VERIFIER_NO_ENCRYPT_IMG != p_ISD->prm.SECURE_BOOT_API.api_return_value))
{
ERROR("SECURE_BOOT_API:Error code = (0x%x).\n",
(unsigned int)p_ISD->prm.SECURE_BOOT_API.api_return_value);
if (do_panic)
panic;
else
return -1;
}
p_ISD->service_id = SERVICE_00_SECURE_BOOT_API;
p_ISD->ptr.p_callbackfunc = NULL;
p_ISD->job_id = 0U;
p_ISD->res_nointerrupt = R_ICUMIF_REQRES_NOINTERRPUT;
p_ISD->prm.SECURE_BOOT_API.boot_api_id = ROM_SECURE_BOOT_COMPARE;
p_ISD->prm.SECURE_BOOT_API.api.
boot_compare.ptr1.p_content_cert = (uint32_t*)p_content_cert;
p_ISD->prm.SECURE_BOOT_API.api.
boot_compare.ptr2.p_hash = p_hash;
p_ISD->prm.SECURE_BOOT_API.api.
boot_compare.hash_size_in_bytes = SIZE_OF_HASH_BUFFER;
p_ISD->prm.SECURE_BOOT_API.api.
boot_compare.ptr3.p_cmac = (uint32_t *)CMAC_BUFFER;
/* trigger the service request */
secureboot_service(p_ISD);
if(ROMAPI_OK != p_ISD->prm.SECURE_BOOT_API.api_return_value)
{
ERROR("SECURE_BOOT_API:Error code = (0x%x).\n",
(unsigned int)p_ISD->prm.SECURE_BOOT_API.api_return_value);
if (do_panic)
panic;
else
return -1;
}
return 0;
}
/* End of function secureboot_image(LOAD_INFO* li) */
static void secureboot_memset(void *buff, uint32_t data, uint32_t cnt)
{
uint32_t *tmp = NULL;
uint32_t loop = cnt / CX_SIZEOF_CNT; /* Copy 4 bytes at a time */
tmp = (uint32_t *)buff;
if (buff == NULL)
{
return;
}
while (loop > 0U)
{
*tmp = data;
tmp++;
loop--;
}
}/* End of function secureboot_memset(void *buff, uint32_t data, uint32_t cnt) */
static void secureboot_service(r_icumif_isd_t *p_ISD)
{
int32_t r_errno;
/* trigger the service request */
r_errno = R_ICUMIF_ServiceRequest(p_ISD);
if(R_ICUMIF_ER_OK != r_errno)
{
ERROR("R_ICUMIF_ServiceRequest:Error code = (0x%x).\n", (unsigned int)r_errno);
panic;
}
/* wait for response */
while(true)
{
r_errno = R_ICUMIF_IsServiceCompleted(p_ISD);
if(r_errno != R_ICUMIF_RTN_SERV_RUNNING)
{
break;
}
}
if(SERV_OK != p_ISD->service_result)
{
ERROR("R_ICUMIF_IsServiceCompleted:Error code = (0x%x).\n", p_ISD->service_result);
panic;
}
r_errno = R_ICUMIF_ServiceResponse();
if(R_ICUMIF_ER_OK != r_errno)
{
ERROR("R_ICUMIF_ServiceResponse:Error code = (0x%x).\n", (unsigned int)r_errno);
panic;
}
}
/* End of function secureboot_service(r_icumif_isd_t *p_ISD) */
void final_hash_cmp(void)
{
#if ((RCAR_LSI == RCAR_V4H) || (RCAR_LSI == RCAR_V4M))
uint32_t i;
uint32_t j;
uint8_t *hash1;
uint8_t *hash2;
uintptr_t hash_addr[HASH_CMP_NUM] = {SECURE_FW_HASH_SAVE_ADDR, CR52_IPL_HASH_SAVE_ADDR};
for(i = 0U; i < HASH_CMP_NUM; i++)
{
/* Hash is placed SystemRAM by ICUMX IPL. */
hash1 = (uint8_t *)(hash_addr[i]);
hash2 = (uint8_t *)(hash_addr[i] + HASH_SIZE);
for(j = 0U; j < HASH_SIZE; j++)
{
/* Compare Hash */
if(*hash1 != *hash2)
{
/* Hash unmatch. */
ERROR("Final Hash compare error!!\n");
panic;
}
hash1++;
hash2++;
}
}
#endif /* (RCAR_LSI == RCAR_V4H) || (RCAR_LSI == RCAR_V4M) */
}
/* End of function final_hash_cmp(void) */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,226 @@
/******************************************************************************/
/* Component Name Memory information definition */
/******************************************************************************/
/* Product : ICU-M Firmware */
/******************************************************************************/
/* Copyright(C) 2021-2023 Renesas Electronics Corporation. */
/******************************************************************************/
/*******************************************************************************/
/* Definition */
/*******************************************************************************/
#if defined(TARGET_DEVICE_S4X) || defined(TARGET_DEVICE_V4H)
#define ICUM_MEMORY_CONFIG_NUM (41)
#else /* if defined(TARGET_DEVICE_S4H) */
#define ICUM_MEMORY_CONFIG_NUM (17)
#endif
/*********************************************************/
/* User configurable area start */
/*********************************************************/
/* The user can change only the value of defined macro. */
#if defined(TARGET_DEVICE_V4H)
#define ICUM_SERVICEQUEUE_1_ADDR (0x41C00000u)
#define ICUM_SERVICEQUEUE_1_SIZE (1152u)
#define ICUM_SHAREDMEMORY_1_ADDR (0x41C00480u)
#define ICUM_SHAREDMEMORY_1_SIZE (2097152u -1152u)
#define ICUM_SHAREDMEMORY_2_ADDR (0x41E00000u)
#define ICUM_SHAREDMEMORY_2_SIZE (2097152u)
#define ICUM_SHAREDMEMORY_3_ADDR (0xEB231000u)
#define ICUM_SHAREDMEMORY_3_SIZE (0xD000u)
#define ICUM_EXPORT_DATA_ADDR (0x41C20000u)
#define ICUM_EXPORT_DATA_SIZE (114688u)
#define ICUM_DATA_WORKAREA_ADDR (0xEB2E0000u)
#define ICUM_DATA_WORKAREA_SIZE (ICUM_EXPORT_DATA_SIZE)
#define ICUM_RTOS_IMAGE_ADDR (0xE2100000u)
#define ICUM_RTOS_IMAGE_SIZE (1048576u)
#define ICUM_CA_PROGRAM_1_ADDR (0x46400000u)
#define ICUM_CA_PROGRAM_1_SIZE (65536u)
#define ICUM_CA_PROGRAM_2_ADDR (0u)
#define ICUM_CA_PROGRAM_2_SIZE (0u)
#define ICUM_CA_PROGRAM_3_ADDR (0u)
#define ICUM_CA_PROGRAM_3_SIZE (0u)
#define ICUM_CA_PROGRAM_4_ADDR (0u)
#define ICUM_CA_PROGRAM_4_SIZE (0u)
#define ICUM_CA_PROGRAM_5_ADDR (0u)
#define ICUM_CA_PROGRAM_5_SIZE (0u)
#define ICUM_CA_PROGRAM_6_ADDR (0u)
#define ICUM_CA_PROGRAM_6_SIZE (0u)
#define ICUM_CA_PROGRAM_7_ADDR (0u)
#define ICUM_CA_PROGRAM_7_SIZE (0u)
#define ICUM_CA_PROGRAM_8_ADDR (0u)
#define ICUM_CA_PROGRAM_8_SIZE (0u)
#define ICUM_SECUREMOD (0x000001FFu) /*( 1:secure mode 0:non-secure mode bit0:unused,bit1:PE1,,,bit8:PE8 )*/
#define ICUM_PE0_REGION_ID (0x00130000u) /* PE0 */
#define ICUM_PE1_REGION_ID (0x00130000u) /* PE1 */
#define ICUM_PE2_REGION_ID (0x00130000u) /* PE2 */
#define ICUM_PE3_REGION_ID (0x00130000u) /* PE3 */
#define ICUM_PE4_REGION_ID (0x00130000u) /* PE4 */
#define ICUM_PE5_REGION_ID (0x00130000u) /* PE5 */
#define ICUM_PE6_REGION_ID (0x00130000u) /* PE6 */
#define ICUM_PE7_REGION_ID (0x00130000u) /* PE7 */
#define ICUM_PE8_REGION_ID (0x00130000u) /* PE8 */
#define ICUM_PES_REGION_ID (0x00130000u) /* PEs */
/* b20 : SECMASK = 1:AUTHSEC is invalid 0:AUTHSEC is valid */
/* b19-16 : IDMASK[3:0] = invalid bit of AUTHID */
/* b4 : AUTHSEC = 1:secure mode 0:non-secure mode */
/* b3-0 : AUTHID[3:0] = region ID */
#elif defined(TARGET_DEVICE_S4X)
#define ICUM_SERVICEQUEUE_1_ADDR (0x41C00000u)
#define ICUM_SERVICEQUEUE_1_SIZE (1152u)
#define ICUM_SHAREDMEMORY_1_ADDR (0x41C00480u)
#define ICUM_SHAREDMEMORY_1_SIZE (2097152u -1152u)
#define ICUM_SHAREDMEMORY_2_ADDR (0x41E00000u)
#define ICUM_SHAREDMEMORY_2_SIZE (2097152u)
#define ICUM_SHAREDMEMORY_3_ADDR (0xE2100000u)
#define ICUM_SHAREDMEMORY_3_SIZE (1048576u)
#define ICUM_EXPORT_DATA_ADDR (0x41C20000u)
#define ICUM_EXPORT_DATA_SIZE (114688u)
#define ICUM_DATA_WORKAREA_ADDR (0xEB2E0000u)
#define ICUM_DATA_WORKAREA_SIZE (ICUM_EXPORT_DATA_SIZE)
#define ICUM_RTOS_IMAGE_ADDR (0xE2100000u)
#define ICUM_RTOS_IMAGE_SIZE (1048576u)
#define ICUM_CA_PROGRAM_1_ADDR (0x46400000u)
#define ICUM_CA_PROGRAM_1_SIZE (65536u)
#define ICUM_CA_PROGRAM_2_ADDR (0u)
#define ICUM_CA_PROGRAM_2_SIZE (0u)
#define ICUM_CA_PROGRAM_3_ADDR (0u)
#define ICUM_CA_PROGRAM_3_SIZE (0u)
#define ICUM_CA_PROGRAM_4_ADDR (0u)
#define ICUM_CA_PROGRAM_4_SIZE (0u)
#define ICUM_CA_PROGRAM_5_ADDR (0u)
#define ICUM_CA_PROGRAM_5_SIZE (0u)
#define ICUM_CA_PROGRAM_6_ADDR (0u)
#define ICUM_CA_PROGRAM_6_SIZE (0u)
#define ICUM_CA_PROGRAM_7_ADDR (0u)
#define ICUM_CA_PROGRAM_7_SIZE (0u)
#define ICUM_CA_PROGRAM_8_ADDR (0u)
#define ICUM_CA_PROGRAM_8_SIZE (0u)
#define ICUM_SECUREMOD (0x000001FFu) /*( 1:secure mode 0:non-secure mode bit0:unused,bit1:PE1,,,bit8:PE8 )*/
#define ICUM_PE0_REGION_ID (0x00100000u) /* PE0 */
#define ICUM_PE1_REGION_ID (0x00100000u) /* PE1 */
#define ICUM_PE2_REGION_ID (0x00100000u) /* PE2 */
#define ICUM_PE3_REGION_ID (0x00100000u) /* PE3 */
#define ICUM_PE4_REGION_ID (0x00100000u) /* PE4 */
#define ICUM_PE5_REGION_ID (0x00100000u) /* PE5 */
#define ICUM_PE6_REGION_ID (0x00100000u) /* PE6 */
#define ICUM_PE7_REGION_ID (0x00100000u) /* PE7 */
#define ICUM_PE8_REGION_ID (0x00100000u) /* PE8 */
#define ICUM_PES_REGION_ID (0x00100000u) /* PEs */
/* b20 : SECMASK = 1:AUTHSEC is invalid 0:AUTHSEC is valid */
/* b19-16 : IDMASK[3:0] = invalid bit of AUTHID */
/* b4 : AUTHSEC = 1:secure mode 0:non-secure mode */
/* b3-0 : AUTHID[3:0] = region ID */
#elif defined(TARGET_DEVICE_S4H)
#define ICUM_SERVICEQUEUE_1_ADDR (0xFE020000u)
#define ICUM_SERVICEQUEUE_1_SIZE (256u)
#define ICUM_SHAREDMEMORY_1_ADDR (0xFE000000u)
#define ICUM_SHAREDMEMORY_1_SIZE (524288u)
#define ICUM_SHAREDMEMORY_2_ADDR (0xFE400000u)
#define ICUM_SHAREDMEMORY_2_SIZE (524288u)
#define ICUM_SHAREDMEMORY_3_ADDR (0xFE800000u) /* RRAM */
#define ICUM_SHAREDMEMORY_3_SIZE (131072u)
#define ICUM_EXPORT_DATA_ADDR (0xFE464000u)
#define ICUM_EXPORT_DATA_SIZE (114688u)
#define ICUM_DATA_WORKAREA_ADDR (0xFF200000u)
#define ICUM_DATA_WORKAREA_SIZE (ICUM_EXPORT_DATA_SIZE)
#define ICUM_HOST_IMAGE_ADDR (0x00000000u)
#define ICUM_HOST_IMAGE_SIZE (5242880u)
#define ICUM_PE0_SPID (0x00000000u) /* PE0 */
#define ICUM_PE1_SPID (0x00000001u) /* PE1 */
#define ICUM_PES_SPID (0x001F0000u) /* PEs */
/* b20-16 : IDMASK[4:0] = invalid bit of AUTHID */
/* b4-0 : AUTHID[4:0] = SPID */
#endif
/*********************************************************/
/* User configurable area end */
/*********************************************************/
/*******************************************************************************/
/* Headers */
/*******************************************************************************/
#include "renesas_types.h"
#include "shared.h"
/*******************************************************************************/
/* Global data */
/*******************************************************************************/
#if defined(TARGET_DEVICE_S4X) || defined(TARGET_DEVICE_V4H)
const uint32_t memory_information[ICUM_MEMORY_CONFIG_NUM] __attribute__((aligned(8), section(".constdata.CONFIG_DATA"))) =
{
ICUM_SERVICEQUEUE_1_ADDR,
ICUM_SERVICEQUEUE_1_SIZE,
ICUM_SHAREDMEMORY_1_ADDR,
ICUM_SHAREDMEMORY_1_SIZE,
ICUM_SHAREDMEMORY_2_ADDR,
ICUM_SHAREDMEMORY_2_SIZE,
ICUM_SHAREDMEMORY_3_ADDR,
ICUM_SHAREDMEMORY_3_SIZE,
ICUM_EXPORT_DATA_ADDR,
ICUM_EXPORT_DATA_SIZE,
ICUM_DATA_WORKAREA_ADDR,
ICUM_DATA_WORKAREA_SIZE,
ICUM_RTOS_IMAGE_ADDR,
ICUM_RTOS_IMAGE_SIZE,
ICUM_CA_PROGRAM_1_ADDR,
ICUM_CA_PROGRAM_1_SIZE,
ICUM_CA_PROGRAM_2_ADDR,
ICUM_CA_PROGRAM_2_SIZE,
ICUM_CA_PROGRAM_3_ADDR,
ICUM_CA_PROGRAM_3_SIZE,
ICUM_CA_PROGRAM_4_ADDR,
ICUM_CA_PROGRAM_4_SIZE,
ICUM_CA_PROGRAM_5_ADDR,
ICUM_CA_PROGRAM_5_SIZE,
ICUM_CA_PROGRAM_6_ADDR,
ICUM_CA_PROGRAM_6_SIZE,
ICUM_CA_PROGRAM_7_ADDR,
ICUM_CA_PROGRAM_7_SIZE,
ICUM_CA_PROGRAM_8_ADDR,
ICUM_CA_PROGRAM_8_SIZE,
ICUM_SECUREMOD,
ICUM_PE0_REGION_ID,
ICUM_PE1_REGION_ID,
ICUM_PE2_REGION_ID,
ICUM_PE3_REGION_ID,
ICUM_PE4_REGION_ID,
ICUM_PE5_REGION_ID,
ICUM_PE6_REGION_ID,
ICUM_PE7_REGION_ID,
ICUM_PE8_REGION_ID,
ICUM_PES_REGION_ID
};
#elif defined(TARGET_DEVICE_S4H)
const uint32_t memory_information[ICUM_MEMORY_CONFIG_NUM] __attribute__((aligned(8), section(".constdata.CONFIG_DATA"))) =
{
ICUM_SERVICEQUEUE_1_ADDR,
ICUM_SERVICEQUEUE_1_SIZE,
ICUM_SHAREDMEMORY_1_ADDR,
ICUM_SHAREDMEMORY_1_SIZE,
ICUM_SHAREDMEMORY_2_ADDR,
ICUM_SHAREDMEMORY_2_SIZE,
ICUM_SHAREDMEMORY_3_ADDR,
ICUM_SHAREDMEMORY_3_SIZE,
ICUM_EXPORT_DATA_ADDR,
ICUM_EXPORT_DATA_SIZE,
ICUM_DATA_WORKAREA_ADDR,
ICUM_DATA_WORKAREA_SIZE,
ICUM_HOST_IMAGE_ADDR,
ICUM_HOST_IMAGE_SIZE,
ICUM_PE0_SPID,
ICUM_PE1_SPID,
ICUM_PES_SPID
};
#endif
/*******************************************************************************/
/* Below shared variables are moved in memory via the linker directive file */
/*******************************************************************************/
/*******************************************************************************/
/* Communication buffer between host and ICU-M */
/*******************************************************************************/
uint8_t ISD_BUFFER[SIZE_OF_ISD_BUFFER] __attribute__((aligned(64), section(".bss.SHARED_TOP")));
uint8_t LCS_BUFFER[SIZE_OF_LCS_BUFFER] __attribute__((aligned(64), section(".bss.SHARED_LCS")));
uint8_t CMAC_BUFFER[SIZE_OF_CMAC_BUFFER] __attribute__((aligned(64), section(".bss.SHARED_CMAC")));
uint8_t HASH_BUFFER[SIZE_OF_HASH_BUFFER] __attribute__((aligned(64), section(".bss.SHARED_HASH")));

View File

@@ -0,0 +1,41 @@
/******************************************************************************/
/* Component Name Testing the ICU-M */
/******************************************************************************/
/* Product : ICU-M Firmware */
/******************************************************************************/
/* Copyright(C) 2021-2023 Renesas Electronics Corporation. */
/******************************************************************************/
#if !defined(SHARED_H)
#define SHARED_H
/**********************************************************************************
* Include
***********************************************************************************/
#include "renesas_types.h"
/**********************************************************************************
* Define
***********************************************************************************/
/** Area size of BIG_BUFFER */
#define SIZE_OF_BIG_BUFFER (64*4*16)
#define SIZE_OF_BIG_BUF2 (1024)
/** Area size of ISD_BUFFER */
#define SIZE_OF_ISD_BUFFER (512)
/** Area size of COM_BUFFER */
#define SIZE_OF_COM_BUFFER (512)
/**********************************************************************************
* Global external references
***********************************************************************************/
#define SIZE_OF_LCS_BUFFER (4U)
#define SIZE_OF_CMAC_BUFFER (16U)
#define SIZE_OF_HASH_BUFFER (32U * 2U)
extern uint8_t ISD_BUFFER[SIZE_OF_ISD_BUFFER];
extern uint8_t LCS_BUFFER[SIZE_OF_LCS_BUFFER];
extern uint8_t CMAC_BUFFER[SIZE_OF_CMAC_BUFFER];
extern uint8_t HASH_BUFFER[SIZE_OF_HASH_BUFFER];
#endif /* SHARED_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,277 @@
/******************************************************************************/
/* Component Name ICU-M COMM(PE) Driver */
/******************************************************************************/
/* 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(ICUM_D_COMM_PE_H)
#define ICUM_D_COMM_PE_H
/**************************************************************************************/
/* Global Pointer Variable */
/**************************************************************************************/
/*====================================================================================*/
/* Shared RAM area address */
/*====================================================================================*/
extern uint8_t __ghsbegin_start_gRAM_BANK_A[]; /* Start address ( Bank_A ) */
extern uint8_t __ghsbegin_end_gRAM_BANK_A[]; /* End address + 1 ( Bank_A ) */
extern uint8_t __ghsbegin_start_gRAM_MEV[]; /* Start addr ( Exclusion ) */
/**************************************************************************************/
/* Definition */
/**************************************************************************************/
/* ICUMD Command Register */
#define ICUM_CMDREGICUM_ICU2PES0 (*(volatile uint32_t*)0xE6610010U)
#define ICUM_CMDREGICUM_ICU2PES1 (*(volatile uint32_t*)0xE6610128U)
#define ICUM_CMDREGICUM_ICU2PES2 (*(volatile uint32_t*)0xE6610158U)
#define ICUM_CMDREGICUM_ICU2PES3 (*(volatile uint32_t*)0xE6610188U)
#define ICUM_CMDREGICUM_ICU2PES4 (*(volatile uint32_t*)0xE66101B8U)
#define ICUM_CMDREGICUM_ICU2PES5 (*(volatile uint32_t*)0xE66101E8U)
#define ICUM_CMDREGICUM_ICU2PES6 (*(volatile uint32_t*)0xE6610218U)
#define ICUM_CMDREGICUM_ICU2PES7 (*(volatile uint32_t*)0xE6610248U)
#define ICUM_CMDREGICUM_ICU2PES8 (*(volatile uint32_t*)0xE6610278U)
#define ICUM_CMDREGICUM_PE2ICUS0 (*(volatile uint32_t*)0xE6610014U)
#define ICUM_CMDREGICUM_PE2ICUS1 (*(volatile uint32_t*)0xE661012CU)
#define ICUM_CMDREGICUM_PE2ICUS2 (*(volatile uint32_t*)0xE661015CU)
#define ICUM_CMDREGICUM_PE2ICUS3 (*(volatile uint32_t*)0xE661018CU)
#define ICUM_CMDREGICUM_PE2ICUS4 (*(volatile uint32_t*)0xE66101BCU)
#define ICUM_CMDREGICUM_PE2ICUS5 (*(volatile uint32_t*)0xE66101ECU)
#define ICUM_CMDREGICUM_PE2ICUS6 (*(volatile uint32_t*)0xE661021CU)
#define ICUM_CMDREGICUM_PE2ICUS7 (*(volatile uint32_t*)0xE661024CU)
#define ICUM_CMDREGICUM_PE2ICUS8 (*(volatile uint32_t*)0xE661027CU)
#define ICUM_CMDREGICUM_PE2ICUFS0 (*(volatile uint32_t*)0xE6610044U)
#define ICUM_CMDREGICUM_PE2ICUFS1 (*(volatile uint32_t*)0xE6610104U)
#define ICUM_CMDREGICUM_PE2ICUFS2 (*(volatile uint32_t*)0xE6610134U)
#define ICUM_CMDREGICUM_PE2ICUFS3 (*(volatile uint32_t*)0xE6610164U)
#define ICUM_CMDREGICUM_PE2ICUFS4 (*(volatile uint32_t*)0xE6610194U)
#define ICUM_CMDREGICUM_PE2ICUFS5 (*(volatile uint32_t*)0xE66101C4U)
#define ICUM_CMDREGICUM_PE2ICUFS6 (*(volatile uint32_t*)0xE66101F4U)
#define ICUM_CMDREGICUM_PE2ICUFS7 (*(volatile uint32_t*)0xE6610224U)
#define ICUM_CMDREGICUM_PE2ICUFS8 (*(volatile uint32_t*)0xE6610254U)
#define ICUM_CMDREGICUM_PE2ICUIE0 (*(volatile uint32_t*)0xE661004CU)
#define ICUM_CMDREGICUM_PE2ICUIE1 (*(volatile uint32_t*)0xE661010CU)
#define ICUM_CMDREGICUM_PE2ICUIE2 (*(volatile uint32_t*)0xE661013CU)
#define ICUM_CMDREGICUM_PE2ICUIE3 (*(volatile uint32_t*)0xE661016CU)
#define ICUM_CMDREGICUM_PE2ICUIE4 (*(volatile uint32_t*)0xE661019CU)
#define ICUM_CMDREGICUM_PE2ICUIE5 (*(volatile uint32_t*)0xE66101CCU)
#define ICUM_CMDREGICUM_PE2ICUIE6 (*(volatile uint32_t*)0xE66101FCU)
#define ICUM_CMDREGICUM_PE2ICUIE7 (*(volatile uint32_t*)0xE661022CU)
#define ICUM_CMDREGICUM_PE2ICUIE8 (*(volatile uint32_t*)0xE661025CU)
#define ICUM_CMDREGICUM_ICU2PEF0 (*(volatile uint32_t*)0xE6610050U)
#define ICUM_CMDREGICUM_ICU2PEF1 (*(volatile uint32_t*)0xE6610110U)
#define ICUM_CMDREGICUM_ICU2PEF2 (*(volatile uint32_t*)0xE6610140U)
#define ICUM_CMDREGICUM_ICU2PEF3 (*(volatile uint32_t*)0xE6610170U)
#define ICUM_CMDREGICUM_ICU2PEF4 (*(volatile uint32_t*)0xE66101A0U)
#define ICUM_CMDREGICUM_ICU2PEF5 (*(volatile uint32_t*)0xE66101D0U)
#define ICUM_CMDREGICUM_ICU2PEF6 (*(volatile uint32_t*)0xE6610200U)
#define ICUM_CMDREGICUM_ICU2PEF7 (*(volatile uint32_t*)0xE6610230U)
#define ICUM_CMDREGICUM_ICU2PEF8 (*(volatile uint32_t*)0xE6610260U)
#define ICUM_CMDREGICUM_ICU2PEFC0 (*(volatile uint32_t*)0xE6610058U)
#define ICUM_CMDREGICUM_ICU2PEFC1 (*(volatile uint32_t*)0xE6610118U)
#define ICUM_CMDREGICUM_ICU2PEFC2 (*(volatile uint32_t*)0xE6610148U)
#define ICUM_CMDREGICUM_ICU2PEFC3 (*(volatile uint32_t*)0xE6610178U)
#define ICUM_CMDREGICUM_ICU2PEFC4 (*(volatile uint32_t*)0xE66101A8U)
#define ICUM_CMDREGICUM_ICU2PEFC5 (*(volatile uint32_t*)0xE66101D8U)
#define ICUM_CMDREGICUM_ICU2PEFC6 (*(volatile uint32_t*)0xE6610208U)
#define ICUM_CMDREGICUM_ICU2PEFC7 (*(volatile uint32_t*)0xE6610238U)
#define ICUM_CMDREGICUM_ICU2PEFC8 (*(volatile uint32_t*)0xE6610268U)
#define ICUM_CMDREGICUM_ICU2PEIE0 (*(volatile uint32_t*)0xE661005CU)
#define ICUM_CMDREGICUM_ICU2PEIE1 (*(volatile uint32_t*)0xE661011CU)
#define ICUM_CMDREGICUM_ICU2PEIE2 (*(volatile uint32_t*)0xE661014CU)
#define ICUM_CMDREGICUM_ICU2PEIE3 (*(volatile uint32_t*)0xE661017CU)
#define ICUM_CMDREGICUM_ICU2PEIE4 (*(volatile uint32_t*)0xE66101ACU)
#define ICUM_CMDREGICUM_ICU2PEIE5 (*(volatile uint32_t*)0xE66101DCU)
#define ICUM_CMDREGICUM_ICU2PEIE6 (*(volatile uint32_t*)0xE661020CU)
#define ICUM_CMDREGICUM_ICU2PEIE7 (*(volatile uint32_t*)0xE661023CU)
#define ICUM_CMDREGICUM_ICU2PEIE8 (*(volatile uint32_t*)0xE661026CU)
#define ICUM_CMDREGICUM_ICU2PEIS0 (*(volatile uint32_t*)0xE6610060U)
#define ICUM_CMDREGICUM_ICU2PEIS1 (*(volatile uint32_t*)0xE6610120U)
#define ICUM_CMDREGICUM_ICU2PEIS2 (*(volatile uint32_t*)0xE6610150U)
#define ICUM_CMDREGICUM_ICU2PEIS3 (*(volatile uint32_t*)0xE6610180U)
#define ICUM_CMDREGICUM_ICU2PEIS4 (*(volatile uint32_t*)0xE66101B0U)
#define ICUM_CMDREGICUM_ICU2PEIS5 (*(volatile uint32_t*)0xE66101E0U)
#define ICUM_CMDREGICUM_ICU2PEIS6 (*(volatile uint32_t*)0xE6610210U)
#define ICUM_CMDREGICUM_ICU2PEIS7 (*(volatile uint32_t*)0xE6610240U)
#define ICUM_CMDREGICUM_ICU2PEIS8 (*(volatile uint32_t*)0xE6610270U)
#define ICUM_CMDREGICUM_PE2ICUSFS (*(volatile uint32_t*)0xE6610074U)
#define ICUM_CMDREGICUM_SEMAPE00 (*(volatile uint32_t*)0xE66100A0U)
#define ICUM_CMDREGICUM_SEMAPE01 (*(volatile uint32_t*)0xE66100A4U)
#define ICUM_CMDREGICUM_SEMAPE02 (*(volatile uint32_t*)0xE66100A8U)
#define ICUM_CMDREGICUM_SEMAPE03 (*(volatile uint32_t*)0xE66100ACU)
#define ICUM_CMDREGICUM_SEMAPE04 (*(volatile uint32_t*)0xE66100B0U)
#define ICUM_CMDREGICUM_SEMAPE05 (*(volatile uint32_t*)0xE66100B4U)
#define ICUM_CMDREGICUM_SEMAPE06 (*(volatile uint32_t*)0xE66100B8U)
#define ICUM_CMDREGICUM_SEMAPE07 (*(volatile uint32_t*)0xE66100BCU)
#define ICUM_CMDREGICUM_SEMAPE08 (*(volatile uint32_t*)0xE66100C0U)
#define ICUM_CMDREGICUM_SEMAPE0A (*(volatile uint32_t*)0xE66100C8U)
#define ICUM_CMDREGICUM_SEMAPE0B (*(volatile uint32_t*)0xE66100CCU)
#define ICUM_CMDREGICUM_SEMAPE0C (*(volatile uint32_t*)0xE66100D0U)
#define ICUM_CMDREGICUM_SEMAPE0D (*(volatile uint32_t*)0xE66100D4U)
#define ICUM_CMDREGICUM_SEMAPE0E (*(volatile uint32_t*)0xE66100D8U)
#define ICUM_CMDREGICUM_SEMAPE0F (*(volatile uint32_t*)0xE66100DCU)
#define ICUM_CMDREGICUM_SEMAPE10 (*(volatile uint32_t*)0xE66100E0U)
#define ICUM_CMDREGICUM_SEMAPE11 (*(volatile uint32_t*)0xE66100E4U)
#define ICUM_CMDREGICUM_SEMAPE12 (*(volatile uint32_t*)0xE66100E8U)
/* Bit position of initialization process execution state ( INIT_PROCESS_TYPE ) */
#define PE_QUE_INIT (0U) /* PE queue init */
#define PE_INTC_INIT (4U) /* PE INTC initialization */
#define PE_ICU2PEI_INIT (8U) /* PE ICU2PEI initialization */
/* Execution state of initialization process ( INIT_PROCESS_STATUS ) */
#define INIT_UNPROCESSED (0U)
#define INIT_PROCESSED (1U)
/* Mask pattern of service queue address ( QUE_ADDR_MASK_PATTERN ) */
#define QUE_ADDR_LOWER_24BITS (0x00FFFFFFU)
#define QUE_ADDR_UPPER_8BITS_VALUE (0xFF000000U)
/* Destination PE set value of INTICUP interrupt ( INTICUP_PESEL_PATTERN ) */
#define INTICUP_PESEL_TO_PE0 (0x00000000U) /* Set value (bit 3-0) */
#define INTICUP_PESEL_TO_PE1 (0x00000001U) /* Set value (bit 3-0) */
#define INTICUP_PESEL_TO_PE2 (0x00000002U) /* Set value (bit 3-0) */
#define INTICUP_PESEL_TO_PE3 (0x00000003U) /* Set value (bit 3-0) */
#define INTICUP_PESEL_TO_PE4 (0x00000004U) /* Set value (bit 3-0) */
#define INTICUP_PESEL_TO_PE5 (0x00000006U) /* Set value (bit 3-0) */
#define INTICUP_PESEL_TO_PE6 (0x00000007U) /* Set value (bit 3-0) */
#define INTICUP_PESEL_TO_PE7 (0x00000008U) /* Set value (bit 3-0) */
#define INTICUP_PESEL_TO_PE8 (0x00000009U) /* Set value (bit 3-0) */
/* Mask pattern for non set PESELs */
#define INTICUP_ICH_MASK (0xFFFFFFF8U)
/* Bit position of INTICUP interrupt each PE ( INTICUP_BIT_POSITION ) */
#define INTICUP_EACH_PE_BIT_WIDTH (3U)
/* PE Identifier value ( PEID_VALUE ) */
#define PEID_PE0 (0U)
#define PEID_PE1 (1U)
#define PEID_PE2 (2U)
#define PEID_PE3 (3U)
#define PEID_MASK (0x000000FU)
/* Bit position of PE status information ( PE2ICUS_BIT_POSITION ) */
#define INFO_PE_ST_POSITION (24U)
/* Bit pattern of PE status information ( INFO_PE_ST_BIT_PATTERN ) */
#define INFO_PE_ST_FACIACCDIS_BIT (0x00000001U)
#define INFO_PE_ST_FLS_OPRN_BIT (0x00000001U)
#define INFO_PE_ST_FLS_DF_PRG_BIT (0x00000001U)
#define INFO_PE_ST_FLS_CF_PRG_BIT (0x00000001U)
/* Section address information ( SECTION_ADDRESS_INFO ) */
#define ADDR_START_SHARED_RAM ((uint32_t *)((void *)__ghsbegin_start_gRAM_BANK_A))
#define ADDR_END_PLUS1_SHARED_RAM ((uint32_t *)((void *)__ghsbegin_end_gRAM_BANK_A))
#define PE_SEMAPHORE_RES (0x01000000U)
#define PE_SEMAPHORE_REQ (0x02000000U)
#define PE_SEMAPHORE_ERR (0x20000000U)
#define PE_SEMAPHORE_AUTH_MASK (0xC0000000U)
#define PE_SEMAPHORE_AUTH_FREE (0x00000000U)
#define PE_SEMAPHORE_AUTH_GET1ST (0x00000000U)
#define PE_SEMAPHORE_AUTH_GET2ND (0x80000000U)
#define PE_SEMAPHORE_WAIT (0x0002645CU)
#define PE_SEMAPHORE_ER_SYSTEM (0x00000001U)
#define PE_SEMAPHORE_ER_TIMEOUT (0x00000002U)
#define PE_SEMAPHORE_ON (0x01U)
#define PE_SEMAPHORE_OFF (0x00U)
#define PE_SECURE_MODE_PE0 (0x00000001U)
#define PE_SECURE_MODE_PE5 (0x00000002U)
#define PE_SECURE_MODE_PE6 (0x00000004U)
#define PE_SECURE_MODE_PE1 (0x00000008U)
#define PE_SECURE_MODE_PE2 (0x00000010U)
#define PE_SECURE_MODE_PE3 (0x00000020U)
#define PE_SECURE_MODE_PE4 (0x00000040U)
#define PE_SECURE_MODE_PE7 (0x00000080U)
#define PE_SECURE_MODE_PE8 (0x00000100U)
#define PE_SECURE_MODE_BITOFF (0U)
#define QUEUE_INDEX_FIRST (0x00U)
#define QUEUE_INDEX_MAX (0xFFU)
/* Size of service queue area ( SERVICE_QUEUE_AREA_SIZE ) */
#define SERV_REQUEST_QUEUE_AREA_SIZE (64U)
#define SERV_RESPONSE_QUEUE_AREA_SIZE (64U)
#define TOTAL_SERVICE_QUEUE_AREA_SIZE (SERV_REQUEST_QUEUE_AREA_SIZE + SERV_RESPONSE_QUEUE_AREA_SIZE)
/* Value for checking number of queue requests per VM ( VM_REQ_QUE_CNT_CHECK ) */
#define VM_REQ_QUE_CNT_CHECK_OK (0U)
#define VM_REQ_QUE_CNT_CHECK_REACHED (1U)
/* Value for RAM area check ( CHECK_VALUE ) */
#define VALUE_FOR_RAM_AREA_CHECK (0xA5A5A5A5U)
/*====================================================================================*/
/* Data pattern of alignment check */
/*====================================================================================*/
#define ALIGNMENT_64BYTE_CHECK_PATTERN (0x0000003fU) /* 64 byte alignment */
#define ALIGNMENT_4BYTE_CHECK_PATTERN (0x00000003U) /* 4 byte alignment */
#define ALIGNMENT_2BYTE_CHECK_PATTERN (0x00000001U) /* 2 byte alignment */
/**************************************************************************************/
/* Type definition */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Enumeration */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Structure Definition */
/**************************************************************************************/
typedef struct ICUM_COMM_PE_INFO
{
volatile uint32_t* p_icu2pes;
volatile uint32_t* p_pe2icufs;
volatile uint32_t* p_pe2icuie;
volatile uint32_t* p_icu2pef;
volatile uint32_t* p_icu2pefc;
volatile uint32_t* p_icu2peie;
volatile uint32_t* p_icu2peis;
volatile uint32_t* p_semape;
volatile uint32_t* p_semape_ns;
uint32_t inticup_pesel_to_pe;
uint32_t secure_mode_bit;
} ICUM_COMM_PE_INFO_t;
/*====================================================================================*/
/* Union for pointer manipulation */
/*====================================================================================*/
typedef union ptr_manip
{
void *p_ptr;
uint32_t *p_uint32_ptr;
volatile uint32_t *p_vlt_ptr;
uintptr_t val;
} ptr_manip_t;
/***************************************************************************************/
/* Prototypes */
/***************************************************************************************/
static uint32_t d_COMM_PE_GetSemaphore(uint8_t target_pe, uint8_t request);
static uint32_t d_COMM_PE_FreeSemaphore(uint8_t target_pe, uint8_t response);
static void d_COMM_PE_VmRequestCountCheck(uint32_t *p_queptr, r_icumif_vm_id_t vm_id, uint32_t *p_chk_result);
#endif /* ICUM_D_COMM_PE_H */

View File

@@ -0,0 +1,461 @@
/******************************************************************************/
/* 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.
*******************************************************************************/
/**************************************************************************************/
/* Header files */
/**************************************************************************************/
#include "r_icumif_api.h"
#include "r_icumif_pub.h"
#include "icum_d_comm_pe_pub.h"
#include "r_icumif.h"
/***************************************************************************************
* Function ID : [ICUMFW_CD_L_IF_0001]:[ICUMFW_UD_L_IF_0001]
* Function name: R_ICUMIF_Init
* Description : Initialize the ICU-M interface library
* Arguments : uint32_t *p_request_queue : Pointer to service request queue
* Return Value : int32_t Library initialization result
* 0 : Successful
* Negative values : Parameter error
***************************************************************************************/
int32_t R_ICUMIF_Init(uint32_t *p_request_queue)
{
int32_t ret_val = R_ICUMIF_ER_OK;
uint32_t call_comm_ret;
/* 1. address check using Cluster RAM area check function */
call_comm_ret = D_COMM_PE_CheckMemorySharedRAM((uint32_t)((uintptr_t)p_request_queue), (uint32_t)sizeof(uint32_t) * (uint32_t)TOTAL_QUEUE_LENGTH);
if (ER_OK == call_comm_ret)
{
/* 2. Parameter alignment check */
if (0U != ((uint32_t)((uintptr_t)p_request_queue) & ALIGNMENT_4BYTE_CHECK_PATTERN))
{
ret_val = R_ICUMIF_ER_PARAM_ALIGNMENT;
}
else
{
/* 3. Execute COMM(PE) driver initialization to initialize service queue */
call_comm_ret = D_COMM_PE_Init(p_request_queue);
/* 4. According to result of COMM (PE) driver initialization process, */
/* execute respective corresponding processes */
if (ER_D_COMM_PARAM_NOT_G_RAM == call_comm_ret)
{
/* 4-1. Parameters other than shared RAM area, process is terminated */
ret_val = R_ICUMIF_ER_ADDR_NOT_G_RAM;
}
else if (ER_D_COMM_QUE_NOT_ACCESS == call_comm_ret)
{
/* 4-2. */
ret_val = R_ICUMIF_ER_SOFTWARE_ERROR;
}
else
{
/* 5. Execute interrupt enable process to enable interrupts from ICUP */
D_COMM_SetInterruptEnable();
}
}
}
else if (ER_D_COMM_ALIGN_NG == call_comm_ret)
{
ret_val = R_ICUMIF_ER_PARAM_ALIGNMENT;
}
else
{
/* 6. */
ret_val = R_ICUMIF_ER_ADDR_NOT_G_RAM;
}
/* 7. */
return (ret_val);
}
/***************************************************************************************
* Function ID : [ICUMFW_CD_L_IF_0002]:[ICUMFW_UD_L_IF_0002]
* Function name: R_ICUMIF_ServiceRequest
* Description : Requests ICU-M to execute the service
* Arguments : r_icumif_isd_t *p_ISD : Pointer to ISD where request parameter is set
* Return Value : int32_t Service execution request result
* 0 : Successful
* Negative values : Parameter error, Interface library uninitialized
***************************************************************************************/
int32_t R_ICUMIF_ServiceRequest(r_icumif_isd_t *p_ISD)
{
int32_t ret_val = R_ICUMIF_ER_OK;
uint32_t call_comm_ret;
/* 1. address check using Cluster RAM area check function */
call_comm_ret = D_COMM_PE_CheckMemorySharedRAM((uint32_t)((uintptr_t)p_ISD), (uint32_t)sizeof(r_icumif_isd_t));
if (ER_OK == call_comm_ret)
{
/* 2. Parameter alignment check */
if (0U != ((uint32_t)((uintptr_t)p_ISD) & ALIGNMENT_4BYTE_CHECK_PATTERN))
{
ret_val = R_ICUMIF_ER_PARAM_ALIGNMENT;
}
else
{
/* 3-1. Set ID of service request PE */
p_ISD->requester_id = (r_icumif_requester_id_t)GET_MY_PEID;
/* 3-2. Set channel of service execution response interrupt */
p_ISD->host_int_ch = ICUM_COMM_ICH_FM_SERV_RESPONSE;
/* 3-3. Set initial state to service processing state */
p_ISD->service_result = SERV_NEW_REQUEST;
/* 4. In order to check whether area indicated by p_ISD exists in RAM, */
/* it checks whether service processing state is SERV_NEW_REQUEST */
if (SERV_NEW_REQUEST != p_ISD->service_result)
{
/* Not SERV_NEW_REQUEST, process is terminated */
ret_val = R_ICUMIF_ER_ADDR_NOT_G_RAM;
}
else
{
/* 5. Execute interrupt issue process to issue service execution req interrupt */
call_comm_ret = D_COMM_TriggerInterruptToICUP(ICUM_COMM_ICH_TO_SERV_REQUEST, p_ISD);
/* 6. According to result of interrupt issue process, */
/* execute respective corresponding processes */
switch (call_comm_ret)
{
case ER_OK:
/* 6-1. Do nothing */
break;
case ER_D_COMM_QUE_FULL:
/* 6-2. */
p_ISD->req_res_status = R_ICUMIF_REQRES_PE_RES_DEQUE;
p_ISD->service_result = SERV_REQUEST_QUEUE_FULL;
ret_val = R_ICUMIF_ER_REQ_QUEUE_FULL;
break;
case ER_D_COMM_QUE_NOT_INIT:
/* 6-3. */
ret_val = R_ICUMIF_ER_IF_LIB_NOT_INIT;
break;
case ER_PARAM:
case ER_D_COMM_QUE_NOT_ACCESS:
default:
/* 6-4. */
ret_val = R_ICUMIF_ER_SOFTWARE_ERROR;
break;
}
}
}
}
else if (ER_D_COMM_ALIGN_NG == call_comm_ret)
{
ret_val = R_ICUMIF_ER_PARAM_ALIGNMENT;
}
else
{
/* 7. */
ret_val = R_ICUMIF_ER_ADDR_NOT_G_RAM;
}
/* 8. */
return (ret_val);
}
/***************************************************************************************
* Function ID : [ICUMFW_CD_L_IF_0003]:[ICUMFW_UD_L_IF_0003]
* Function name: R_ICUMIF_ServiceResponse
* Description : Acquires ISD from service response queue for self PE
* Arguments : None
* Return Value : int32_t Service response reception process result
* 0 : Successful
* Negative values : Interface library uninitialized
***************************************************************************************/
int32_t R_ICUMIF_ServiceResponse(void)
{
int32_t ret_val = R_ICUMIF_ER_OK;
uint32_t call_comm_ret;
uint32_t call_comm_ret_isd;
uint32_t exist_isd = 1U;
r_icumif_isd_t *p_isd;
/* Repeat process until there is no ISD in service response queue for self PE */
while (1U == exist_isd)
{
/* 1. Acquires ISD from service response queue for self PE */
call_comm_ret = D_COMM_GetResponseISD(&p_isd);
/* 2. According to result of acquires ISD, */
/* execute respective corresponding processes */
switch (call_comm_ret)
{
case ER_OK:
case ER_D_COMM_EXIST_ISD:
/* 3-1. address check using Cluster RAM area check function */
call_comm_ret_isd = D_COMM_PE_CheckMemorySharedRAM((uint32_t)((uintptr_t)p_isd), (uint32_t)sizeof(r_icumif_isd_t));
if (ER_OK == call_comm_ret_isd)
{
/* 3-1-1. For detect that ICU-M could not update ISD, */
/* check value of service process state in acquired ISD */
if (SERV_NEW_REQUEST == p_isd->service_result)
{
/* 3-1-1-1. ICU-M could not update ISD */
p_isd->service_result = SERV_ISD_NOT_ACCESSIBLE;
}
else
{
/* 3-1-1-2. */
/* do nothing */
}
/* 3-1-2. */
if (NULL != p_isd->ptr.p_callbackfunc)
{
/* 3-1-2-1. If there is registration of callback function, */
/* calling callback function */
p_isd->ptr.p_callbackfunc(p_isd);
}
else
{
/* 3-1-2-2. */
/* do nothing */
}
if (ER_OK == call_comm_ret)
{
exist_isd = 0U;
}
else
{
/* do nothing */
}
}
else if (ER_D_COMM_ALIGN_NG == call_comm_ret_isd)
{
ret_val = R_ICUMIF_ER_PARAM_ALIGNMENT;
exist_isd = 0U;
}
else
{
ret_val = R_ICUMIF_ER_ADDR_NOT_G_RAM;
exist_isd = 0U;
}
break;
case ER_D_COMM_NO_ISD:
/* 3-2. No ISD in service response queue, exit from loop process */
exist_isd = 0U;
break;
case ER_D_COMM_QUE_NOT_INIT:
/* 3-3. Interface library not initialized */
ret_val = R_ICUMIF_ER_IF_LIB_NOT_INIT;
exist_isd = 0U;
break;
case ER_D_COMM_QUE_NOT_ACCESS:
default:
/* 3-4. Software error */
ret_val = R_ICUMIF_ER_SOFTWARE_ERROR;
exist_isd = 0U;
break;
}
}
/* 4. Return the service response reception process result */
return (ret_val);
}
/***************************************************************************************
* Function ID : [ICUMFW_CD_L_IF_0004]:[ICUMFW_UD_L_IF_0004]
* Function name: R_ICUMIF_IsServiceCompleted
* Description : Check state of service execution requested to ICU-M
* Arguments : r_icumif_isd_t *p_ISD : Pointer to ISD that service execution requested
* Return Value : int32_t Service execution state
* 0 : Service running
* Other than 0 : Service execution completion
***************************************************************************************/
int32_t R_ICUMIF_IsServiceCompleted(r_icumif_isd_t *p_ISD)
{
int32_t ret_val;
uint8_t mem_check = ICUM_COMM_MEMCHECK_OK;
uint32_t call_comm_ret;
/* 1. address check using Cluster RAM area check function */
call_comm_ret = D_COMM_PE_CheckMemorySharedRAM((uint32_t)((uintptr_t)p_ISD), (uint32_t)sizeof(r_icumif_isd_t));
if (ER_OK == call_comm_ret)
{
/* 2. Parameter alignment check */
if (0U != ((uint32_t)((uintptr_t)p_ISD) & ALIGNMENT_4BYTE_CHECK_PATTERN))
{
ret_val = R_ICUMIF_ER_PARAM_ALIGNMENT;
}
else
{
if ((p_ISD->service_id == SERVICE_01_AES_CMAC) &&
((uint32_t)p_ISD->service_priority == R_ICUMIF_SERV_PRIORITY_HIGHEST))
{
/* Do nothing */
}
else
{
(void)D_COMM_GetICUMemCheckErrInfo(&mem_check);
}
if (ICUM_COMM_MEMCHECK_OK == (uint32_t)mem_check)
{
/* 3. Check service request / response queue transition state in ISD */
ret_val = R_ICUMIF_RTN_SERV_RUNNING;
/* 4. Service execution completion */
switch ((uint32_t)p_ISD->req_res_status)
{
case R_ICUMIF_REQRES_ICUM_RES_ENQUE:
if ((uint32_t)p_ISD->res_nointerrupt == R_ICUMIF_REQRES_NOINTERRPUT)
{
ret_val = R_ICUMIF_RTN_SERV_COMPLETION;
}
else
{
/* Do nothing */
}
break;
case R_ICUMIF_REQRES_PE_RES_DEQUE:
/* 4-1. Check value of service process state in ISD */
if (SERV_REQUEST > p_ISD->service_result)
{
/* 4-1-1. Service execution completion */
ret_val = R_ICUMIF_RTN_SERV_COMPLETION;
}
else
{
/* Do nothing */
}
break;
case R_ICUMIF_REQRES_PE_REQ_ENQUE:
if ((uint32_t)p_ISD->req_nointerrupt == R_ICUMIF_REQRES_NOINTERRPUT)
{
ret_val = R_ICUMIF_RTN_SERV_COMPLETION;
}
else
{
/* Do nothing */
}
break;
case R_ICUMIF_REQRES_ICUM_REQ_DEQUE:
/* 4-2. Service running */
/* Initial value */
break;
default:
/* 4-3. */
ret_val = R_ICUMIF_ER_SOFTWARE_ERROR;
break;
}
}
else
{
ret_val = R_ICUMIF_ER_ADDR_NOT_G_RAM;
}
}
}
else if (ER_D_COMM_ALIGN_NG == call_comm_ret)
{
ret_val = R_ICUMIF_ER_PARAM_ALIGNMENT;
}
else
{
/* 5. */
ret_val = R_ICUMIF_ER_ADDR_NOT_G_RAM;
}
/* 6. */
return (ret_val);
}
/***************************************************************************************
* Function ID : [ICUMFW_CD_L_IF_0005]:[ICUMFW_UD_L_IF_0005]
* Function name: R_ICUMIF_GetStatus
* Description : Acquire address value of status information of ICU-M Firmware
* Arguments : None
* Return Value : r_icumif_sts_t * Address value of ICU-M Firmware status information
***************************************************************************************/
r_icumif_sts_t *R_ICUMIF_GetStatus(void)
{
r_icumif_sts_t *p_status;
/* 1. Acquire address value of status information of ICU-M Firmware */
p_status = D_COMM_GetICUStatusAddr();
/* 2. */
return (p_status);
}
/***************************************************************************************
* Function ID : [ICUMFW_CD_L_IF_0008]:[ICUMFW_UD_L_IF_0008]
* Function name: R_ICUMIF_SetSystemCallBackFunc
* Description : Register the function to call back when receiving system interrupt
* Arguments : R_ICUMIF_CB_REGIST_t *p_regist_info : Pointer to registration info
* Return Value : int32_t Callback registration result
* 0 : Successful
* Negative values : Parameter error
***************************************************************************************/
int32_t R_ICUMIF_SetSystemCallBackFunc(R_ICUMIF_CB_REGIST_t *p_regist_info)
{
int32_t ret_val = R_ICUMIF_ER_OK;
uint32_t call_comm_ret;
alignment_check_t prm_ptr;
/* 1. Parameter alignment check ( p_regist_info ) */
if (0U != ((uint32_t)((uintptr_t)p_regist_info) & ALIGNMENT_4BYTE_CHECK_PATTERN))
{
ret_val = R_ICUMIF_ER_PARAM_ALIGNMENT;
}
else
{
/* 2. Parameter alignment check ( callback function address ) */
prm_ptr.p_align_check = p_regist_info->p_func_addr;
if (0U != (prm_ptr.val_align_check & ALIGNMENT_2BYTE_CHECK_PATTERN))
{
ret_val = R_ICUMIF_ER_PARAM_ALIGNMENT;
}
else
{
/* 3. Register the function to call back */
call_comm_ret = D_COMM_SetSystemCallBackFunc(p_regist_info);
/* 4. According to result of callback function regist process, */
/* execute respective corresponding processes */
switch (call_comm_ret)
{
case ER_OK:
/* 4-1. Do nothing */
break;
default:
/* 4-2. Software error */
ret_val = R_ICUMIF_ER_SOFTWARE_ERROR;
break;
}
}
}
/* 5. Return callback registration result */
return (ret_val);
}
/***************************************************************************************
* Function ID : [ICUMFW_CD_L_IF_0010]:[ICUMFW_UD_L_IF_0010]
* Function name: R_ICUMIF_IRQ_Handler
* Description : Execute interrupt process of ICUP --> PE (INTICUP)
* Arguments : None
* Return Value : None
***************************************************************************************/
void R_ICUMIF_IRQ_Handler(void)
{
D_COMM_IRQ_Handler();
}

View File

@@ -0,0 +1,60 @@
/******************************************************************************/
/* 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_H)
#define R_ICUMIF_H
/**************************************************************************************/
/* Defines */
/**************************************************************************************/
/*====================================================================================*/
/* Data pattern of alignment check */
/*====================================================================================*/
#define ALIGNMENT_4BYTE_CHECK_PATTERN (0x00000003U) /* 4 byte alignment */
#define ALIGNMENT_2BYTE_CHECK_PATTERN (0x00000001U) /* 2 byte alignment */
/**************************************************************************************/
/* Macros */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Type definition */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Enumeration */
/**************************************************************************************/
/* None */
/**************************************************************************************/
/* Structure Definition */
/**************************************************************************************/
/*====================================================================================*/
/* Union for alignment check of pointer value */
/*====================================================================================*/
typedef union alignment_check
{
void (*p_align_check)(void);
uint32_t val_align_check;
} alignment_check_t;
#endif /* R_ICUMIF_H */

View File

@@ -0,0 +1,103 @@
/******************************************************************************/
/* Component Name Customer-implement component */
/******************************************************************************/
/* Product : ICU-M Firmware */
/******************************************************************************/
/* Copyright(C) 2021-2023 Renesas Electronics Corporation. */
/******************************************************************************/
/**********************************************************************************
* Include
***********************************************************************************/
#include "renesas_types.h"
#include "user_icumif_api.h"
/**********************************************************************************
* Globals
***********************************************************************************/
extern void flush_dcache_range(uintptr_t addr, uint32_t size);
extern void inv_dcache_range(uintptr_t addr, uint32_t size);
/**********************************************************************************
* Define
***********************************************************************************/
#define D_CACHE_LINE_ADDR_MASK (0xFFFFFFC0U)
#define D_CACHE_LIMIT_ADDR (0xFFFFFFC0U)
#define CR52_CPSR_IRQ_DISABLE_STATUS (0x00000080U)
#define CR52_PEID (0x00000000u)
#define CA_CPU_ID_MASK (0x0000FF00U)
#define CA_CPU_ID_SHIT (8u)
#define CA_CLUSTER_ID_MASK (0x00FF0000U)
#define CA_CLUSTER_ID_SHIT (16u)
/**********************************************************************************
* Function
***********************************************************************************/
void USER_ICUMIF_FlushDCache(uint32_t addr, uint32_t size)
{
/* do nothing */
}
void USER_ICUMIF_InvalidateDCache(uint32_t addr, uint32_t size)
{
/* do nothing */
}
uint32_t USER_ICUMIF_GetMyPEID(void)
{
uint32_t peid;
#if defined(TARGET_CORTEX_A)
uintptr_t mpidr;
#if defined(AARCH64)
__asm volatile ("mrs %0, MPIDR_EL1" : "=r" (mpidr));
#else
__asm volatile ("mrc p15, 0, %0, c0, c0, 5" : "=r" (mpidr));
#endif
peid = ((mpidr & CA_CPU_ID_MASK) >> CA_CPU_ID_SHIT) + (((mpidr & CA_CLUSTER_ID_MASK) >> CA_CLUSTER_ID_SHIT) * 2) + CR52_CPU_NUM;
#elif defined(TARGET_DEVICE_S4X)
peid = CR52_PEID;
#else
uintptr_t mpidr;
__asm volatile ("mrc p15, 0, %0, c0, c0, 5" : "=r" (mpidr));
peid = ((mpidr & CA_CPU_ID_MASK) >> CA_CPU_ID_SHIT) + (((mpidr & CA_CLUSTER_ID_MASK) >> CA_CLUSTER_ID_SHIT) * 2);
#endif
return (peid);
}
void USER_ICUMIF_GetLock(uintptr_t *p_saved_psw)
{
uintptr_t saved_psw;
saved_psw = *p_saved_psw;
USER_ICUMIF_GET_LOCK(saved_psw);
*p_saved_psw = saved_psw;
}
void USER_ICUMIF_ReleaseLock(uintptr_t saved_psw)
{
USER_ICUMIF_RELEASE_LOCK(saved_psw);
}
static void USER_ICUMIF_SYNC(void)
{
__asm("dmb sy");
__asm("dsb sy");
__asm("isb");
}
void USER_ICUMIF_Sync(void)
{
USER_ICUMIF_SYNC();
}

View File

@@ -0,0 +1,97 @@
/******************************************************************************/
/* Component Name Customer-implement component */
/******************************************************************************/
/* Product : ICU-M Firmware */
/******************************************************************************/
/* Copyright(C) 2021-2023 Renesas Electronics Corporation. */
/******************************************************************************/
#ifndef USER_ICUMIF_API_H_
#define USER_ICUMIF_API_H_
/* Bit pattern of current program status register */
#define FIQ_BIT (0x00000040U)
#define IRQ_BIT (0x00000080U)
#define FIQ_DISABLE (0x00000040U)
#define IRQ_DISABLE (0x00000080U)
#if defined(TARGET_DEVICE_S4X)
#define CR52_CPU_NUM (1u)
#define CA_CPU_NUM (8u)
#else /* TARGET_DEVICE_V4H */
#define CR52_CPU_NUM (3u)
#define CA_CPU_NUM (4u)
#endif
void USER_ICUMIF_FlushDCache(uint32_t addr, uint32_t size);
void USER_ICUMIF_InvalidateDCache(uint32_t addr, uint32_t size);
uint32_t USER_ICUMIF_GetMyPEID(void);
void USER_ICUMIF_GetLock(uintptr_t *p_saved_psw);
void USER_ICUMIF_ReleaseLock(uintptr_t saved_psw);
void USER_ICUMIF_Sync(void);
#if defined(TARGET_CORTEX_A) && defined(AARCH64)
#define USER_ICUMIF_GET_LOCK(X) \
do\
{\
__asm ("mrs %0, DAIF" : "=r" (X));\
if ((IRQ_DISABLE != ((X) & IRQ_BIT)) || (FIQ_DISABLE != ((X) & FIQ_BIT)))\
{\
__asm ("msr DAIFSet, #0x3");\
}\
} while (0)
#else
#define USER_ICUMIF_GET_LOCK(X) \
do\
{\
__asm volatile ("mrs %0, cpsr" : "=r" (X));\
if ((IRQ_DISABLE != ((X) & IRQ_BIT)) || (FIQ_DISABLE != ((X) & FIQ_BIT)))\
{\
__asm ("cpsid if");\
}\
} while (0)
#endif
#if defined(TARGET_CORTEX_A) && defined(AARCH64)
#define USER_ICUMIF_RELEASE_LOCK(X) \
do\
{\
if (FIQ_DISABLE != ((X) & FIQ_BIT))\
{\
__asm ("msr DAIFClr, #0x1");\
}\
else\
{\
}\
if (IRQ_DISABLE != ((X) & IRQ_BIT))\
{\
__asm ("msr DAIFClr, #0x2");\
}\
else\
{\
}\
} while (0)
#else
#define USER_ICUMIF_RELEASE_LOCK(X) \
do\
{\
if (FIQ_DISABLE != ((X) & FIQ_BIT))\
{\
__asm ("cpsie f");\
}\
else\
{\
}\
if (IRQ_DISABLE != ((X) & IRQ_BIT))\
{\
__asm ("cpsie i");\
}\
else\
{\
}\
} while (0)
#endif
#endif /* USER_ICUMIF_API_H_ */