1 /*
2 * Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6 
7 /*******************************************************************************************************************//**
8  * @ingroup SCE
9  * @addtogroup SCE_PROC
10  * @{
11  ***********************************************************************************************************************/
12 
13 #ifndef HW_SCE_PRIVATE_H
14 #define HW_SCE_PRIVATE_H
15 
16 /**********************************************************************************************************************
17  * Includes
18  ***********************************************************************************************************************/
19 #include "bsp_api.h"
20 #include "hw_sce_common.h"
21 #include "hw_sce_ra_private.h"
22 
23 /**********************************************************************************************************************
24  * Macro definitions
25  ***********************************************************************************************************************/
26 #define SCE_ECC_CURVE_TYPE_NIST         (0x00000000U)
27 #define SCE_ECC_CURVE_TYPE_BRAINPOOL    (0x01000000U)
28 #define SCE_ECC_CURVE_TYPE_KOBLITZ      (0x02000000U)
29 
30 /**********************************************************************************************************************
31  * Typedef definitions
32  ***********************************************************************************************************************/
33 
34 typedef enum e_crypto_word_endian
35 {
36     CRYPTO_WORD_ENDIAN_BIG    = 0,
37     CRYPTO_WORD_ENDIAN_LITTLE = 1
38 } crypto_word_endian_t;
39 
40 /*
41  * typedef enum e_sce_oem_key_type
42  * {
43  *  SCE_OEM_KEY_TYPE_ENCRYPTED = 0,
44  *  SCE_OEM_KEY_TYPE_PLAIN     = 1
45  * } sce_oem_key_type_t;
46  */
47 
48 /**********************************************************************************************************************
49  * Function Prototypes
50  ***********************************************************************************************************************/
51 
52 /**********************************************************************************************************************
53  * Includes
54  ***********************************************************************************************************************/
55 
56 extern uint32_t S_RAM[];
57 extern uint32_t S_HEAP[];
58 extern uint32_t S_INST[];
59 extern uint32_t S_INST2[];
60 extern uint32_t INST_DATA_SIZE;
61 extern void HW_SCE_SoftReset(void);
62 
63 extern fsp_err_t HW_SCE_Initialization1(void);
64 
65 extern fsp_err_t HW_SCE_Initialization2(void);
66 
67 void      HW_SCE_Initialization1_Subproc1(void);
68 void      HW_SCE_Initialization2_Subproc2(void);
69 void      SC32_Subprc03(void);
70 void      SC32_Subprc04(void);
71 void      SC32_Subprc05(void);
72 fsp_err_t HW_SCE_secureBoot(void);
73 
74 void                 HW_SCE_EndianSetBig(void);
75 void                 HW_SCE_EndianSetLittle(void);
76 crypto_word_endian_t HW_SCE_EndianFlagGet(void);
77 fsp_err_t            HW_SCE_McuSpecificInit(void);
78 
79 fsp_err_t HW_SCE_FW_IntegrityChk(void);
80 fsp_err_t HW_SCE_HUK_Load(uint32_t * InData_LC);
81 fsp_err_t HW_SCE_HUK_Load_LCS(void);
82 fsp_err_t HW_SCE_p07(uint32_t * OutData_KeyIndex);
83 void      HW_SCE_ChangeToLittleEndian(void);
84 
85 fsp_err_t HW_SCE_GenerateOemKeyIndexPrivate(const sce_oem_key_type_t key_type,
86                                             const sce_oem_cmd_t      cmd,
87                                             const uint8_t          * encrypted_provisioning_key,
88                                             const uint8_t          * iv,
89                                             const uint8_t          * encrypted_oem_key,
90                                             uint32_t               * key_index);
91 
92 #endif                                 /* HW_SCE_PRIVATE_H */
93 
94 /*******************************************************************************************************************//**
95  * @} (end addtogroup SCE_PROC)
96  ***********************************************************************************************************************/
97