• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018-2022 NXP
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _PHNXPUCIHAL_FW_H
18 #define _PHNXPUCIHAL_FW_H
19 
20 /****************************************************************************************/
21 /*   GLOBAL FUNCTION PROTOTYPES */
22 /****************************************************************************************/
23 #define PHHBCI_GPIO_TIMEOUT_MS (10000U)
24 #define PHHBCI_GPIO_QBTIMEOUT_MS (5000U)
25 
26 /*FW Versions*/
27 #define PHHBCI_FW_B0_VERSION 0xB0
28 #define PHHBCI_FW_B1_VERSION 0xB1
29 #define PHHBCI_FW_B2_VERSION 0xB2
30 
31 /* Place configuration switches, which overrides values from phDefaultConfig.h,
32  * here. */
33 #if defined(PHFL_BUILD_TYPE_DEBUG)
34 #define PHFL_CONFIG_DEBUG_PRINT 1
35 //#define PHFL_LOG_HOST 1
36 #endif
37 #ifndef PHFL_CONFIG_ENABLE_ASSERTIONS
38 #define PHFL_CONFIG_ENABLE_ASSERTIONS 1
39 #endif
40 #ifndef PHFL_CONFIG_ENABLE_ASSERTIONS_DEBUG
41 #ifndef __QAC__
42 #define PHFL_CONFIG_ENABLE_ASSERTIONS_DEBUG 0
43 #else
44 #define PHFL_CONFIG_ENABLE_ASSERTIONS_DEBUG 1
45 #endif
46 #endif
47 
48 #ifndef PHFL_CONFIG_NORTOS
49 #define PHFL_CONFIG_NORTOS 1
50 #endif
51 
52 #if (PHFL_CONFIG_TARGET_PLATFORM == PHFL_CONFIG_TARGET_PLATFORM_ARM)
53 #include <stdint.h>
54 #else
55 
56 #ifndef __uint8_t_defined
57 #define __uint8_t_defined
58 /**
59 * \brief 8 bit unsigned integer
60 */
61 typedef unsigned char uint8_t;
62 #endif
63 
64 #ifndef __uint16_t_defined
65 #define __uint16_t_defined
66 /**
67 * \brief 16 bit unsigned integer
68 */
69 typedef unsigned short uint16_t;
70 #endif
71 
72 #ifndef __uint32_t_defined
73 #define __uint32_t_defined
74 /**
75 * \brief 32 bit unsigned integer
76 */
77 typedef unsigned long uint32_t;
78 #endif
79 
80 #ifndef __int8_t_defined
81 #define __int8_t_defined
82 /**
83 * \brief 8 bit signed integer
84 */
85 typedef signed char int8_t;
86 #endif
87 
88 #ifndef __int16_t_defined
89 #define __int16_t_defined
90 /**
91 * \brief 16 bit signed integer
92 */
93 typedef signed short int16_t;
94 #endif
95 
96 #ifndef __int32_t_defined
97 #define __int32_t_defined
98 /**
99 * \brief 32 bit signed integer
100 */
101 typedef signed int int32_t;
102 #endif
103 #endif
104 
105 #if !defined(__cplusplus) || defined(__arm__)
106 #ifndef __BOOL_DEFINED
107 #define __BOOL_DEFINED 1
108 /**
109 * \brief Boolean type
110 */
111 #ifndef false
112 #define false 0
113 #endif
114 #ifndef true
115 #define true (!false)
116 #endif
117 // typedef uint8_t bool;
118 #endif
119 #endif
120 
121 #ifndef TRUE
122 #define TRUE true
123 #endif
124 
125 #ifndef FALSE
126 #define FALSE false
127 #endif
128 
129 #ifndef NULL
130 #define NULL ((void*)0) /**< Value used for NULL pointers */
131 #endif
132 
133 #ifdef PHFL_ENABLE_STACK_CHECK
134 #define PH_CALL_DIRECT_FUNCTION(fct) (fct)
135 #else
136 #define PH_CALL_DIRECT_FUNCTION(fct)
137 #endif
138 
139 #if (PHFL_CONFIG_TARGET_PLATFORM == PHFL_CONFIG_TARGET_PLATFORM_ARM) || \
140     defined(__DOXYGEN)
141 /**
142  * \brief Macro used to place given variable as ZI-data to specified section.
143  * \note The section need to be defined in the scatter file.
144  * Example:
145  * \code
146 static uint32_t aBmaBuffer[PH_BOOT_BMA_BUFFER_SIZE]
147 PH_PLACE_ZI_DATA_TO_SECTION("BMA");
148 \endcode
149  */
150 #define PH_PLACE_ZI_DATA_TO_SECTION(SECTIONNAME) \
151   __attribute__((section(SECTIONNAME), zero_init))
152 
153 /**
154  * \brief Macro used to place constant data to specified section.
155  * \note The section need to be defined in the scatter file.
156  * Example:
157  * \code
158 static const uint32_t dwFoo PH_PLACE_RO_DATA_TO_SECTION("FOO");
159 \endcode
160  */
161 #define PH_PLACE_RO_DATA_TO_SECTION(SECTIONNAME) \
162   __attribute__((section(SECTIONNAME)))
163 #define PH_PLACE_FUNCTION_TO_SECTION(SECTIONNAME) \
164   __attribute__((section(SECTIONNAME)))
165 
166 #define STRINGIFY(a) #a
167 
168 #define PH_ZI_DATA_SECTION(SECTIONNAME)                  \
169   _Pragma(STRINGIFY(arm section rwdata = #SECTIONNAME)); \
170   _Pragma(STRINGIFY(arm section zidata = #SECTIONNAME));
171 
172 #define PH_RO_DATA_SECTION(SECTIONNAME) \
173   _Pragma(STRINGIFY(arm section rodata = #SECTIONNAME));
174 
175 #define PH_CODE_SECTION(SECTIONNAME) \
176   _Pragma(STRINGIFY(arm section code = #SECTIONNAME));
177 
178 #define PH_PACK_STRUCT_BEGIN __packed
179 #define PH_PACK_STRUCT_END
180 #define PH_ALIGN __align
181 #define PH_USED __attribute__((used))
182 #else
183 #ifdef __QAC__
184 #define PH_ZI_DATA_SECTION(SECTIONNAME) static void(SECTIONNAME)()
185 #define PH_RO_DATA_SECTION(SECTIONNAME) static void(SECTIONNAME)()
186 #define PH_CODE_SECTION(SECTIONNAME) static void(SECTIONNAME)()
187 #else
188 #define PH_ZI_DATA_SECTION(SECTIONNAME)
189 #define PH_RO_DATA_SECTION(SECTIONNAME)
190 #define PH_CODE_SECTION(SECTIONNAME)
191 #endif
192 #define PH_PLACE_ZI_DATA_TO_SECTION(SECTIONNAME)
193 #define PH_PLACE_RO_DATA_TO_SECTION(SECTIONNAME)
194 #define PH_PLACE_FUNCTION_TO_SECTION(SECTIONNAME)
195 #define PH_ALIGN(a)
196 #define PH_USED
197 #define PH_PACK_STRUCT_BEGIN
198 #define PH_PACK_STRUCT_END __attribute__((__packed__))
199 #endif
200 /*********************************************************************************************************************/
201 /*   GLOBAL DEFINES */
202 /*********************************************************************************************************************/
203 #define PHHBCI_LEN_HDR (4U)
204 #define PHHBCI_LEN_LRC (1U)
205 #define PHHBCI_MAX_LEN_DATA_MOSI (2048U)
206 #define PHHBCI_MAX_LEN_PAYLOAD_MOSI (PHHBCI_MAX_LEN_DATA_MOSI + PHHBCI_LEN_LRC)
207 #define PHHBCI_MAX_LEN_DATA_MISO (256U)
208 #define PHHBCI_MAX_LEN_PAYLOAD_MISO (PHHBCI_MAX_LEN_DATA_MISO + PHHBCI_LEN_LRC)
209 
210 #define PHHBCI_CLASS_MASK (0xF0U)
211 #define PHHBCI_SUBCLASS_MASK (0x0FU)
212 #define PHHBCI_ERROR_STATUS_MASK (0x80U)
213 #define PHHBCI_APDU_SEG_FLAG (0x8000U)
214 
215 #define PHHBCI_HELIOS_CHIP_ID_SZ (16U)
216 #define PHHBCI_HELIOS_ID_SZ (4U)
217 #define PHHBCI_HELIOS_CA_ROOT_PUB_KEY_SZ (64U)
218 #define PHHBCI_HELIOS_NXP_PUB_KEY_SZ (64U)
219 #define PHHBCI_HELIOS_ROM_VERSION_SZ (1U)
220 #define PHHBCI_HELIOS_OTP_AUTOLOAD_INFO_SZ (44U)
221 
222 #define PHHBCI_MODE_LEN_MSB_OFFSET (3U)
223 #define PHHBCI_MODE_LEN_LSB_OFFSET (2U)
224 #define PHHBCI_MODE_CHIP_ID_OFFSET (8U)
225 #define PHHBCI_MODE_DEV_LIFE_CYCLE_INFO_OFFSET (39U)
226 
227 #define PHHBCI_HELIOS_DEV_KEY      0x00
228 #define PHHBCI_HELIOS_PROD_KEY_1   0x0F
229 #define PHHBCI_HELIOS_PROD_KEY_2   0x3F
230 
231 #define HELIOS_MAX_SRAM_SZ (256 * 1024U)
232 
233 
234 /* Patch ROM */
235 #define PHHBCI_PATCHROM_SINGLE_ENTRY_SZ (sizeof(uint32_t) * 3U)
236 #define PHHBCI_PATCHROM_MAX_PATCH_TABLE_ENTRIES (48 + 1U)
237 #define PHHBCI_PATCHROM_MAX_PATCH_CODE_SZ (64 * 1024U)
238 #define PHHBCI_PATCHROM_SIGNATURE_SZ (3072U >> 3)
239 #define PHHBCI_PATCHROM_MAX_PATCH_TABLE_SZ \
240   (PHHBCI_PATCHROM_SINGLE_ENTRY_SZ * PHHBCI_PATCHROM_MAX_PATCH_TABLE_ENTRIES)
241 
242 /*#define PHHBCI_PATCHROM_MAX_IMAGE_SZ                \
243     ( sizeof(phHbci_PatchROMInfo_t)                 \
244     + PHHBCI_PATCHROM_MAX_PATCH_TABLE_SZ            \
245     + PHHBCI_PATCHROM_MAX_PATCH_CODE_SZ             \
246     + PHHBCI_PATCHROM_SIGNATURE_SZ )*/
247 #define PHHBCI_PATCHROM_MAX_IMAGE_SZ HELIOS_MAX_SRAM_SZ
248 
249 typedef enum phHbci_Status {
250   phHbci_Success = 0x00,
251   phHbci_Failure = 0x01,
252   phHbci_File_Not_found = 0x14
253 
254 } phHbci_Status_t;
255 /*********************************************************************************************************************/
256 /*   GLOBAL DATATYPES */
257 /*********************************************************************************************************************/
258 typedef enum phHbci_Class {
259   phHbci_Class_General = 0x00,
260   phHbci_Class_Patch_ROM = 0x20,
261   phHbci_Class_HIF_Image = 0x50,
262   phHbci_Class_IM4_Image = 0x60
263 
264 } phHbci_Class_t;
265 
266 typedef enum phHbci_SubClass {
267   phHbci_SubClass_Query = 0x01,
268   phHbci_SubClass_Answer = 0x02,
269   phHbci_SubClass_Command = 0x03,
270   phHbci_SubClass_Ack = 0x04
271 
272 } phHbci_SubClass_t;
273 
274 typedef enum phHbci_Ack {
275   phHbci_Valid_APDU = 0x01,
276 
277   phHbci_Invalid_LRC = 0x81,
278   phHbci_Invlaid_Class = 0x82,
279   phHbci_Invalid_Instruction = 0x83,
280   phHbci_Invalid_Segment_Length = 0x84
281 
282 } phHbci_Ack_t;
283 typedef struct phHbci_MosiApdu {
284   uint8_t cls;
285   uint8_t ins;
286   uint16_t len;
287   uint8_t payload[PHHBCI_MAX_LEN_PAYLOAD_MOSI];
288 
289 } phHbci_MosiApdu_t;
290 
291 typedef struct phHbci_MisoApdu {
292   uint8_t cls;
293   uint8_t ins;
294   uint16_t len;
295   uint8_t payload[PHHBCI_MAX_LEN_PAYLOAD_MISO];
296 
297 } phHbci_MisoApdu_t;
298 
299 typedef struct phPalSr100_Config {
300   int8_t* pDevName;
301 
302   uint32_t dwBaudRate;
303 
304   void* pDevHandle;
305   /*!< Device handle output */
306 } phPalSr100_Config_t, *pphPalSr100_Config_t;
307 typedef enum Link {
308   Link_SPI,
309   Link_I3C,
310 
311   Link_Default = Link_SPI
312 
313 } Link_t;
314 
315 typedef enum Mode {
316   Mode_Patch_ROM = 1,
317   Mode_HIF_Image,
318 
319   Mode_Default = Mode_HIF_Image
320 
321 } Mode_t;
322 
323 typedef enum Capture {
324   Capture_Off,
325   Capture_Apdu,
326   Capture_Apdu_With_Dummy_Miso,
327 
328   Capture_Default = Capture_Off
329 
330 } Capture_t;
331 
332 typedef struct Options {
333   char* imgFile;
334   FILE* fImg;
335   char* mosiFile;
336   FILE* fMosi;
337   char* misoFile;
338   FILE* fMiso;
339   Link_t link;
340   Mode_t mode;
341   Capture_t capture;
342 
343 } Options_t;
344 
345 /***** eClass_General *****/
346 
347 typedef enum phHbci_General_Query {
348   phHbci_General_Qry_Status = 0x21,
349 
350   phHbci_General_Qry_Chip_ID = 0x31,
351   phHbci_General_Qry_Helios_ID = 0x32,
352   //phHbci_General_Qry_CA_Root_Pub_Key = 0x33,
353   phHbci_General_Qry_NXP_Pub_Key = 0x33,
354   phHbci_General_Qry_ROM_Version = 0x34,
355   phHbci_General_Qry_Fw_Dwnld_Root_Key = 0x35,
356   phHbci_General_Qry_OTP_AutoLoad_Info = 0x36,
357 
358 } phHbci_General_Query_t;
359 
360 typedef enum phHbci_General_Answer {
361   phHbci_General_Ans_HBCI_Ready = phHbci_General_Qry_Status,
362   phHbci_General_Ans_Mode_Patch_ROM_Ready = 0x23,
363   phHbci_General_Ans_Mode_HIF_Image_Ready = 0x24,
364   phHbci_General_Ans_Mode_IM4_Image_Ready = 0x25,
365 
366   phHbci_General_Ans_Chip_ID = phHbci_General_Qry_Chip_ID,
367   phHbci_General_Ans_Helios_ID = phHbci_General_Qry_Helios_ID,
368   //phHbci_General_Ans_CA_Root_Pub_Key = phHbci_General_Qry_CA_Root_Pub_Key,
369   phHbci_General_Ans_NXP_Pub_Key = phHbci_General_Qry_NXP_Pub_Key,
370   phHbci_General_Ans_ROM_Version = phHbci_General_Qry_ROM_Version,
371   phHbci_General_Ans_Fw_Dwnld_Root_Key = phHbci_General_Qry_Fw_Dwnld_Root_Key,
372   phHbci_General_Ans_OTP_AutoLoad_Info = phHbci_General_Qry_OTP_AutoLoad_Info,
373 
374   phHbci_General_Ans_Boot_Success = 0x41,
375 
376   phHbci_General_Ans_Boot_Autoload_Fail = 0xD1,
377   phHbci_General_Ans_Boot_GPIOConf_CRC_Fail = 0xD2,
378   phHbci_General_Ans_Boot_TRIM_CRC_Fail = 0xD3,
379   phHbci_General_Ans_Boot_GPIOTRIM_CRC_Fail = 0xD4,
380 
381   phHbci_General_Ans_HBCI_Fail = 0xE1,
382   phHbci_General_Ans_Mode_Patch_ROM_Fail = 0xE3,
383   phHbci_General_Ans_Mode_HIF_Image_Fail = 0xE4,
384   phHbci_General_Ans_Mode_IM4_Image_Fail = 0xE5
385 
386 } phHbci_General_Answer_t;
387 
388 typedef enum phHbci_General_Command {
389   phHbci_General_Cmd_Mode_Patch_ROM = phHbci_General_Ans_Mode_Patch_ROM_Ready,
390   phHbci_General_Cmd_Mode_HIF_Image = phHbci_General_Ans_Mode_HIF_Image_Ready,
391   phHbci_General_Cmd_Mode_IM4_Image = phHbci_General_Ans_Mode_IM4_Image_Ready
392 
393 } phHbci_General_Command_t;
394 
395 phHbci_MosiApdu_t gphHbci_MosiApdu;
396 phHbci_MisoApdu_t gphHbci_MisoApdu;
397 phPalSr100_Config_t tPalConfig;
398 Options_t gOpts;
399 
400 bool gPasswd, gImg;
401 uint8_t gDummyMiso[PHHBCI_MAX_LEN_PAYLOAD_MISO];
402 
403 static uint8_t gphHbci_ImgHelios[256 * 1024] __attribute__((aligned(4)));
404 
405 phHbci_Status_t phHbci_GetStatus(void);
406 phHbci_Status_t phHbci_GeneralStatus(phHbci_General_Command_t mode);
407 phHbci_Status_t phHbci_QueryInfo(uint8_t* pInfo, uint32_t* pInfoSz,
408                                  uint32_t maxSz, bool matchMaxSz);
409 phHbci_Status_t phHbci_GetGeneralInfo(uint8_t* pInfo, uint32_t* pInfoSz);
410 phHbci_Status_t phHbci_GetInfo(uint8_t* pInfo, uint32_t* pInfoSz);
411 phHbci_Status_t phHbci_PutCommand(uint8_t* pImg, uint32_t imgSz);
412 
413 uint8_t phHbci_CalcLrc(uint8_t* pBuf, uint16_t bufSz);
414 int printUsage(char* pProg);
415 int cMain(int argc, char* argv[]);
416 int cppGetApdu(uint8_t* pApdu, uint16_t sz);
417 int cppPutApdu(uint8_t* pApdu, uint16_t sz);
418 int cppWaitForGPIOEvent(uint32_t timeoutMs);
419 void cppResetGPIOEvent(void);
420 phHbci_Status_t phHbci_GetApdu(uint8_t* pApdu, uint16_t sz);
421 phHbci_Status_t phHbci_PutApdu(uint8_t* pApdu, uint16_t sz);
422 phHbci_Status_t phHbci_Master(phHbci_General_Command_t mode, uint8_t* pImg,
423                               uint32_t imgSz);
424 
425 typedef struct phHbci_PatchROMInfo {
426   uint32_t patchFileMarker;
427   uint32_t offsetRAM;
428   uint32_t szPatchCode;
429   uint16_t numPatchTableEntries;
430   uint16_t szSignatureBuf;
431 
432 } phHbci_PatchROMInfo_t;
433 
434 /* HIF Image */
435 //#define PHHIF_MAX_IMAGE_SZ                  ((256-32)*1024U)
436 #define PHHIF_MAX_IMAGE_SZ HELIOS_MAX_SRAM_SZ
437 
438 /*********************************************************************************************************************/
439 /*   GLOBAL MACROS */
440 /*********************************************************************************************************************/
441 #define PHHBCI_PEEK32(w32, w8)                                    \
442   do {                                                            \
443     w32 = ((uint32_t)(w8[3]) << 24) | ((uint32_t)(w8[2]) << 16) | \
444           ((uint32_t)(w8[1]) << 8) | w8[0];                       \
445   } while (0)
446 
447 #define PHHBCI_READ32(w32, w8) \
448   do {                         \
449     PHHBCI_PEEK32(w32, w8);    \
450     w8 += sizeof(w32);         \
451   } while (0)
452 
453 /***** eClass_Patch_ROM *****/
454 
455 typedef enum phHbci_Patch_ROM_Query {
456   phHbci_Patch_ROM_Qry_Patch_Status = 0x01
457 
458 } phHbci_Patch_ROM_Query_t;
459 
460 typedef enum phHbci_Patch_ROM_Answer {
461   phHbci_Patch_ROM_Ans_Patch_Success = phHbci_Patch_ROM_Qry_Patch_Status,
462 
463   phHbci_Patch_ROM_Ans_File_Too_Large = 0x81,
464   phHbci_Patch_ROM_Ans_Invalid_Patch_File_Marker = 0x82,
465   phHbci_Patch_ROM_Ans_Too_Many_Patch_Table_Entries = 0x83,
466   phHbci_Patch_ROM_Ans_Invalid_Patch_Code_Size = 0x84,
467   phHbci_Patch_ROM_Ans_Invalid_Global_Patch_Marker = 0x85,
468   phHbci_Patch_ROM_Ans_Invalid_Signature_Size = 0x86,
469   phHbci_Patch_ROM_Ans_Invalid_Signature = 0x87
470 
471 } phHbci_Patch_ROM_Answer_t;
472 
473 typedef enum phHbci_Patch_ROM_Command {
474   phHbci_Patch_ROM_Cmd_Download_Patch = phHbci_Patch_ROM_Qry_Patch_Status
475 
476 } phHbci_Patch_ROM_Command_t;
477 
478 /***** eClass_HIF_Image *****/
479 
480 typedef enum phHbci_HIF_Image_Query {
481   phHbci_HIF_Image_Qry_Image_Status = 0x01
482 
483 } phHbci_HIF_Image_Query_t;
484 
485 typedef enum phHbci_HIF_Image_Answer {
486   phHbci_HIF_Image_Ans_Image_Success = phHbci_HIF_Image_Qry_Image_Status,
487   phHbci_HIF_Image_Ans_Header_Success = 0x04,
488   phHbci_HIF_Image_Ans_Quickboot_Settings_Success = 0x05,
489   phHbci_HIF_Image_Ans_Execution_Settings_Success = 0x06,
490 
491   phHbci_HIF_Image_Ans_Header_Too_Large = 0x81,
492   phHbci_HIF_Image_Ans_Header_Parse_Error = 0x82,
493   phHbci_HIF_Image_Ans_Invalid_Cipher_Type_Crypto = 0x83,
494   phHbci_HIF_Image_Ans_Invalid_Cipher_Type_Mode = 0x84,
495   phHbci_HIF_Image_Ans_Invalid_Cipher_Type_Hash = 0x85,
496   phHbci_HIF_Image_Ans_Invalid_Cipher_Type_Curve = 0x86,
497   phHbci_HIF_Image_Ans_Invalid_ECC_Key_Length = 0x87,
498   phHbci_HIF_Image_Ans_Invalid_Payload_Description = 0x88,
499   phHbci_HIF_Image_Ans_Invalid_Firmware_Version = 0x89,
500   phHbci_HIF_Image_Ans_Invalid_ECID_Mask = 0x8A,
501   phHbci_HIF_Image_Ans_Invalid_ECID_Value = 0x8B,
502   phHbci_HIF_Image_Ans_Invalid_Encrypted_Payload_Hash = 0x8C,
503   phHbci_HIF_Image_Ans_Invalid_Header_Signature = 0x8D,
504   phHbci_HIF_Image_Ans_Install_Settings_Too_Large = 0x8E,
505   phHbci_HIF_Image_Ans_Install_Settings_Parse_Error = 0x8F,
506   phHbci_HIF_Image_Ans_Payload_Too_Large = 0x90,
507   phHbci_HIF_Image_Ans_Quickboot_Settings_Parse_Error = 0x91,
508   phHbci_HIF_Image_Ans_Invalid_Static_Hash = 0x92,
509   phHbci_HIF_Image_Ans_Invalid_Dynamic_Hash = 0x93,
510   phHbci_HIF_Image_Ans_Execution_Settings_Parse_Error = 0x94,
511   phHbci_HIF_Image_Ans_Key_Read_Error = 0x95
512 
513 } phHbci_HIF_Image_Answer_t;
514 
515 typedef enum phHbci_HIF_Image_Command {
516   phHbci_HIF_Image_Cmd_Download_Image = phHbci_HIF_Image_Qry_Image_Status
517 
518 } phHbci_HIF_Image_Command_t;
519 
520 /***** eClass_IM4_Image *****/
521 
522 typedef enum phHbci_IM4_Image_Query {
523   phHbci_IM4_Image_Qry_IM4_Status = 0x01,
524   phHbci_IM4_Image_Qry_IM4M_Status = 0x02,
525   phHbci_IM4_Image_Qry_IM4P_Status = 0x03,
526   phHbci_IM4_Image_Qry_File_Descriptor_Status = 0x04,
527   phHbci_IM4_Image_Qry_Payload_Status = 0x05
528 
529 } phHbci_IM4_Image_Query_t;
530 
531 typedef enum phHbci_IM4_Image_Answer {
532   phHbci_IM4_Image_Ans_IM4_Success = phHbci_IM4_Image_Qry_IM4_Status,
533   phHbci_IM4_Image_Ans_IM4M_Success = phHbci_IM4_Image_Qry_IM4M_Status,
534   phHbci_IM4_Image_Ans_IM4P_Success = phHbci_IM4_Image_Qry_IM4P_Status,
535   phHbci_IM4_Image_Ans_File_Descriptor_Success =
536       phHbci_IM4_Image_Qry_File_Descriptor_Status,
537   phHbci_IM4_Image_Ans_Payload_Success = phHbci_IM4_Image_Qry_Payload_Status,
538 
539   phHbci_IM4_Image_Ans_IM4M_Too_Large = 0x81,
540   phHbci_IM4_Image_Ans_IM4M_Parse_Error = 0x82,
541   phHbci_IM4_Image_Ans_Invalid_Chip_ID = 0x83,
542   phHbci_IM4_Image_Ans_Invalid_Helios_ID = 0x84,
543   phHbci_IM4_Image_Ans_Invalid_IM4M_Leaf_Certificate = 0x85,
544   phHbci_IM4_Image_Ans_Invalid_IM4M_Manifest_Signature = 0x86,
545   phHbci_IM4_Image_Ans_IM4P_Too_Large = 0x87,
546   phHbci_IM4_Image_Ans_Invalid_IM4P_Hash = 0x88,
547   phHbci_IM4_Image_Ans_IM4P_Parse_Error = 0x89,
548   phHbci_IM4_Image_Ans_Invalid_IM4P_Signature = 0x8A,
549   phHbci_IM4_Image_Ans_File_Descriptor_Too_Large = 0x8B,
550   phHbci_IM4_Image_Ans_Invalid_File_Descriptor = 0x8C,
551   phHbci_IM4_Image_Ans_Payload_Too_Large = 0x8D,
552   phHbci_IM4_Image_Ans_Invalid_Encrypted_Payload_Hash = 0x8E,
553   phHbci_IM4_Image_Ans_Invalid_Download_Settings = 0x8F
554 
555 } phHbci_IM4_Image_Answer_t;
556 
557 typedef enum phHbci_IM4_Image_Command {
558   phHbci_IM4_Image_Cmd_Download_IM4 = phHbci_IM4_Image_Qry_IM4_Status,
559   phHbci_IM4_Image_Cmd_Download_IM4M = phHbci_IM4_Image_Qry_IM4M_Status,
560   phHbci_IM4_Image_Cmd_Download_IM4P = phHbci_IM4_Image_Qry_IM4P_Status,
561   phHbci_IM4_Image_Cmd_Download_File_Descriptor =
562       phHbci_IM4_Image_Qry_File_Descriptor_Status,
563   phHbci_IM4_Image_Cmd_Download_Payload = phHbci_IM4_Image_Qry_Payload_Status
564 
565 } phHbci_IM4_Image_Command_t;
566 
567 //#pragma pack(push, 1)
568 
569 //#pragma pack(pop)
570 #endif /* _PHNXPUCIHAL_FW_H */
571