1 /*
2  * Copyright 2021 NXP
3  *
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 #ifndef _FSL_NBOOT_H_
8 #define _FSL_NBOOT_H_
9 
10 /*******************************************************************************
11  * Definitions
12  ******************************************************************************/
13 
14 /* sb3 file size definitions*/
15 #define NBOOT_SB3_MANIFEST_MAX_SIZE_IN_BYTES (0x328U)
16 #define NBOOT_SB3_BLOCK_MAX_SIZE_IN_BYTES    (0x134U)
17 #define NBOOT_SB3_CHUNK_SIZE_IN_BYTES        (256U)
18 #define NBOOT_SB3_IMAGE_ALIGNMENT            (16U)
19 
20 /* debug authentication definitions */
21 #define NBOOT_DBG_AUTH_CHALLENGE_SIZE_P256         (104U) /*!< Challenge packet size for P256 */
22 #define NBOOT_DBG_AUTH_CHALLENGE_SIZE_P384         (104U) /*!< Challenge packet size for P384 */
23 #define NBOOT_DBG_AUTH_CHALLENGE_MAX_SIZE_IN_BYTES NBOOT_DBG_AUTH_CHALLENGE_SIZE_P384 /*!< Max challenge packet size*/
24 #define NBOOT_DBG_AUTH_RESPONSE_MAX_SIZE_P256      (444U) /*!< Maximal response packet size for P256 */
25 #define NBOOT_DBG_AUTH_RESPONSE_MAX_SIZE_P384      (636U) /*!< Maximal response packet size for P384 */
26 #define NBOOT_DBG_AUTH_RESPONSE_MAX_SIZE_IN_BYTES                  \
27     NBOOT_DBG_AUTH_RESPONSE_MAX_SIZE_P384 /*!< Max response packet \
28                                              size*/
29 #define NBOOT_DBG_AUTH_ANTI_POLE_BASE_MASK (0x0000FFFFU)
30 
31 /* fault analysis request definitions */
32 #define NBOOT_FA_REQUEST_SIZE_IN_BYTES (784U)
33 
34 /* size of internal nboot context */
35 #define NBOOT_CONTEXT_SIZE (156U)
36 
37 /* definition of return values */
38 #define NBOOT_MEMCMP_EQUAL   (0x5AA53CC3U)
39 #define NBOOT_MEMCMP_UNEQUAL (0xA55AC33CU)
40 
41 /* nboot fuse list */
42 #define NBOOT_FUSEID_TESTER_LOCK                      (0x00)
43 #define NBOOT_FUSEID_NXP_PROD_PRootHSMX_MK_SHARE_LOCK (0x01)
44 #define NBOOT_FUSEID_NXP_DIE_DRootR_MK_SHARE_LOCK     (0x02)
45 #define NBOOT_FUSEID_NXP_PROD_PrivFW_AUTH_PUK_LOCK    (0x03)
46 #define NBOOT_FUSEID_NXP_PROD_nPrivFW_AUTH_PUK_LOCK   (0x04)
47 #define NBOOT_FUSEID_CUST_PROD_OEMFW_AUTH_PUK_LOCK    (0x05)
48 #define NBOOT_FUSEID_CUST_PROD_OEMFW_ENC_SK_LOCK      (0x06)
49 #define NBOOT_FUSEID_OEM_Enablement_Token_LOCK        (0x07)
50 #define NBOOT_FUSEID_DCFG_CC_SOCU_L1_LOCK             (0x08)
51 #define NBOOT_FUSEID_DCFG_CC_SOCU_L2_LOCK             (0x09)
52 #define NBOOT_FUSEID_LIFECYCLE                        (0x0A)
53 #define NBOOT_FUSEID_DBG_EN_LOCK                      (0x0B)
54 #define NBOOT_FUSEID_DBG_AUTH_DIS                     (0x0C)
55 #define NBOOT_FUSEID_TZM_EN                           (0x0D)
56 #define NBOOT_FUSEID_DICE_EN                          (0x0E)
57 #define NBOOT_FUSEID_PUF_SETKEY_DIS                   (0x0F)
58 #define NBOOT_FUSEID_PUF_ENROLL_DIS                   (0x10)
59 #define NBOOT_FUSEID_SERIAL_DIS                       (0x11)
60 #define NBOOT_FUSEID_WAKEUP_DIS                       (0x12)
61 #define NBOOT_FUSEID_CUST_PROD_OEMFW_AUTH_PUK_REVOKE  (0x13)
62 #define NBOOT_FUSEID_SWD_ID                           (0x14)
63 #define NBOOT_FUSEID_DBG_AUTH_VU                      (0x15)
64 #define NBOOT_FUSEID_IMG_KEY_REVOKE                   (0x16)
65 #define NBOOT_FUSEID_PUFD_S3D_TRNGT                   (0x17)
66 #define NBOOT_FUSEID_SECURE_PHANTOM_CONFIG            (0x18)
67 #define NBOOT_FUSEID_ECID                             (0x19)
68 #define NBOOT_FUSEID_ROM_PATCH                        (0x1a)
69 #define NBOOT_FUSEID_NXP_PROD_PRootHSMX_MK_SHARE      (0x1b)
70 #define NBOOT_FUSEID_NXP_DIE_DRootR_MK_SHARE          (0x1c)
71 #define NBOOT_FUSEID_NXP_PROD_PrivFW_AUTH_PUK         (0x1d)
72 #define NBOOT_FUSEID_NXP_PROD_nPrivFW_AUTH_PUK        (0x1e)
73 #define NBOOT_FUSEID_CUST_PROD_OEMFW_AUTH_PUK         (0x1f)
74 #define NBOOT_FUSEID_CUST_PROD_OEMFW_ENC_SK           (0x20)
75 #define NBOOT_FUSEID_OEM_Enablement_Token             (0x21)
76 #define NBOOT_FUSEID_DCFG_CC_SOCU_L1                  (0x22)
77 #define NBOOT_FUSEID_DCFG_CC_SOCU_L2                  (0x23)
78 #define NBOOT_FUSEID_SOC_VER_CNT                      (0x24)
79 #define NBOOT_FUSEID_CM33_S_VER_CNT                   (0x25)
80 #define NBOOT_FUSEID_CM33_NS_VER_CNT                  (0x26)
81 #define NBOOT_FUSEID_RADIO_VER_CNT                    (0x27)
82 #define NBOOT_FUSEID_SNT_VER_CNT                      (0x28)
83 #define NBOOT_FUSEID_CM33_BOOTLOADER_VER_CNT          (0x29)
84 #define NBOOT_FUSEID_LAST                             (0x2a)
85 
86 #define NBOOT_MAX_LIFECYCLE_VALUE (0xffU)
87 
88 /* nboot list of open keys*/
89 #define NBOOT_NPX (0x80000007U)
90 
91 /* nboot property list */
92 #define NBOOT_PROPERTY_ID_DICE_CDI        (0x10U)
93 #define NBOOT_PROPERTY_ID_IMAGE_HASH      (0x20U)
94 #define NBOOT_PROPERTY_ID_PSA_BOOT_SEED   (0x30U)
95 #define NBOOT_PROPERTY_ID_LAST_AUTH_STATE (0x40U)
96 #define NBOOT_PROPERTY_ID_SSS_ROM_VERSION (0x50U)
97 /* if no SSS fw loaded, returns 0xFFFFFFFF as 1st word, else loaded FW version, returns two words, 1st - version, 2nd -
98  * commit id */
99 #define NBOOT_PROPERTY_ID_SSS_FW_VERSION   (0x51)
100 #define NBOOT_PROPERTY_ID_DTRK_ATTEST_PUBK (0x60U)
101 #define NBOOT_PROPERTY_ID_DTRK_ID_PUBK     (0x70U)
102 /* if NXP returns 0x0, if OEM1 returns 0xAABBCCDDu, OEM2 returns 0xaabbccddu*/
103 #define NBOOT_PROPERTY_NBU_NXP            (0x0U)
104 #define NBOOT_PROPERTY_NBU_OEM1           (0xAABBCCDDU)
105 #define NBOOT_PROPERTY_NBU_OEM2           (0xDDCCBBAAU)
106 #define NBOOT_PROPERTY_ID_RADIO_IMG_OWNER (0x80)
107 #define NBOOT_PROPERTY_ID_UUID            (0x90)
108 
109 /* value indicating processing of internal sentinel FW*/
110 #define NBOOT_IGNORE_SB3_COMMANDS (0x4c4c4c4cU)
111 /* tag used for idication of new SB3 command*/
112 #define NBOOT_RANGE_SECTION_TAG (0x55aaaa55U)
113 
114 /* nboot bits to be combined with image type on offsett 0x24 */
115 #define NBOOT_IMAGE_TYPE_MASK                     (0x3FU)
116 #define NBOOT_IMAGE_SUBTYPE_MASK                  (0xC0U)
117 #define NBOOT_IMAGE_TYPE_FULL_MASK                (NBOOT_IMAGE_TYPE_MASK | NBOOT_IMAGE_SUBTYPE_MASK)
118 #define NBOOT_IMAGE_TOTAL_SIZE_OFFSET_IN_WORDS    (0x8U)
119 #define NBOOT_IMAGE_TYPE_OFFSET_IN_WORDS          (0x9U)
120 #define NBOOT_IMAGE_CERTBLOCK_OFFSET_IN_WORDS     (0xAU)
121 #define NBOOT_IMAGE_CERTBLOCKSIZE_OFFSET_IN_BYTES (8U)
122 #define NBOOT_IMAGE_FWVERSION_OFFSET_IN_BYTES     (8U)
123 
124 /* please validate that a is valid pointer before usage of macro*/
125 /* (a) is ponter to MBI start. */
126 #define NBOOT_GET_MBI_IMG_TYPE(a) ((((uint32_t *)a)[NBOOT_IMAGE_TYPE_OFFSET_IN_WORDS]) & NBOOT_IMAGE_TYPE_MASK)
127 /* (a) is ponter to MBI start. */
128 #define NBOOT_GET_MBI_IMG_SUBTYPE(a) ((((uint32_t *)a)[NBOOT_IMAGE_TYPE_OFFSET_IN_WORDS]) & NBOOT_IMAGE_SUBTYPE_MASK)
129 /* a) is ponter to MBI start. */
130 #define NBOOT_GET_MBI_IMG_FULLTYPE(a) ((((uint32_t *)a)[NBOOT_IMAGE_TYPE_OFFSET_IN_WORDS]) & NBOOT_IMAGE_TYPE_FULL_MASK)
131 
132 /* nboot secured memory operations protected by secure counter*/
133 #define nboot_memcpy(ctx, dst, src, len) \
134     nboot_s_memcpy((ctx), (dst), (src), (len), ((uint32_t)(dst) ^ (uint32_t)(src) ^ (len)))
135 #define nboot_memset(ctx, dst, value, len) \
136     nboot_s_memset((ctx), (dst), (value), (len), ((uint32_t)(dst) ^ (value) ^ (len)))
137 #define nboot_memcmp(ctx, dst, src, len) \
138     nboot_s_memcmp((ctx), (dst), (src), (len), ((uint32_t)(dst) ^ (uint32_t)(src) ^ (len)))
139 #define NBOOT_SC_S_MEMCPY (0x2d40U)
140 #define NBOOT_SC_S_MEMSET (0x2a33U)
141 #define NBOOT_SC_S_MEMCMP (0x2b44U)
142 
143 typedef enum
144 {
145     kSB3_COMMAND_none            = 0x0U,
146     kSB3_COMMAND_erase           = 0x1U,
147     kSB3_COMMAND_load            = 0x2U,
148     kSB3_COMMAND_execute         = 0x3U,
149     kSB3_COMMAND_call            = 0x4U,
150     kSB3_COMMAND_programFuses    = 0x5U,
151     kSB3_COMMAND_programIfr      = 0x6U,
152     kSB3_COMMAND_loadCmac        = 0x7U,
153     kSB3_COMMAND_copy            = 0x8U,
154     kSB3_COMMAND_loadHashlocking = 0x9U,
155     kSB3_COMMAND_loadKeyBlob     = 0xAU,
156     kSB3_COMMAND_configMemory    = 0xBU,
157     kSB3_COMMAND_fillMemory      = 0xCU,
158     /*Add new values always before kSB3_COMMAND_end and update the value.*/
159     kSB3_COMMAND_end = 0x4u
160 } nboot_sb3_command_t;
161 
162 typedef enum
163 {
164     kSECURE_TRUE                       = 0xc33cc33cU,
165     kSECURE_FALSE                      = 0x5aa55aa5U,
166     kSECURE_CALLPROTECT_SECURITY_FLAGS = 0xc33c5aa5U,
167     kSECURE_CALLPROTECT_IS_APP_READY   = 0x5aa5c33cU,
168     kSECURE_TRACKER_VERIFIED           = 0x55aacc33U,
169 } secure_bool_t;
170 
171 typedef enum
172 {
173     kNBOOT_TRUE                = 0x3C5AC33CU, /*!< Value for TRUE.  */
174     kNBOOT_TRUE256             = 0x3C5AC35AU, /*!< Value for TRUE when P256 was used to sign the image.  */
175     kNBOOT_TRUE384             = 0x3C5AC3A5U, /*!< Value for TRUE when P384 was used to sign the image.  */
176     kNBOOT_FALSE               = 0x5AA55AA5U, /*!< Value for FALSE. */
177     kNBOOT_OperationAllowed    = 0x3c5a33ccU,
178     kNBOOT_OperationDisallowed = 0x5aa5cc33U,
179 } nboot_bool_t;
180 
181 typedef enum
182 {
183     kStatus_NBOOT_Success                = 0x5a5a5a5aU,
184     kStatus_NBOOT_Fail                   = 0x5a5aa5a5U,
185     kStatus_NBOOT_InvalidArgument        = 0x5a5aa501U,
186     kStatus_NBOOT_RequestTimeout         = 0x5a5aa502U,
187     kStatus_NBOOT_ResourceBusy           = 0x5a5aa503U,
188     kStatus_NBOOT_RomPatchVerifyFail     = 0x5a5aa5a4U,
189     kStatus_NBOOT_OperationNotAvaialable = 0x5a5aa5e5U,
190     kStatus_NBOOT_MemcpyFail             = 0x5a5a845aU,
191 } nboot_status_t;
192 
193 typedef enum
194 {
195     kNBOOT_ImageTypePlain = 0x0,
196     /* Image types with image header compatible with ARM-v7m and ARM-v8m vector
197        table */
198     kNBOOT_ImageTypePlainSigned       = 0x1U,
199     kNBOOT_ImageTypePlainCrc          = 0x2U,
200     kNBOOT_ImageTypeEncryptedSigned   = 0x3U,
201     kNBOOT_ImageTypeXipPlainSigned    = 0x4U,
202     kNBOOT_ImageTypeXipPlainCrc       = 0x5U,
203     kNBOOT_ImageTypeSb3               = 0x6U,
204     kNBOOT_ImageTypeSb3Nxp            = 0x7U,
205     kNBOOT_ImageTypeXipPlainSignedNxp = 0x8U,
206     /*Add new values always before kNBOOT_ImageTypeEnd and update the value.*/
207     kNBOOT_ImageTypeEnd = 0x9u
208 } nboot_image_type_t;
209 
210 /* SoC specific image subtypes definition */
211 typedef enum
212 {
213     kNBOOT_ImageSubtypeDefault = 0x0U,
214     kNBOOT_ImageSubtypeNbu     = 0x40U,
215 } nboot_image_subtype_t;
216 
217 typedef struct
218 {
219     uint32_t magic;                  /*! offset 0x00: Fixed 4-byte string of 'sbv3' without the
220                                         trailing NULL */
221     uint32_t formatVersion;          /*! offset 0x04: (major = 3, minor = 0); The format
222                                         version determines the header block size. */
223     uint32_t flags;                  /*! offset 0x08: not defined yet, keep zero for future
224                                         compatibility */
225     uint32_t blockCount;             /*! offset 0x0C: Number of blocks not including the
226                                         header block. */
227     uint32_t blockSize;              /*! offset 0x10: Size in bytes of all subsequent blocks. */
228     uint32_t timeStamp[2];           /*! offset 0x14: 64-bit timestamp in microseconds since
229                                         1-1-2000 00:00 when the image was created. */
230     uint32_t firmwareVersion;        /*! offset 0x1c: Version number of the included
231                                         firmware */
232     uint32_t imageTotalLength;       /*! offset 0x20: total image length in bytes,
233                                         including signatures etc. */
234     uint32_t imageType;              /*! offset 0x24: image type and flags */
235     uint32_t certificateBlockOffset; /*! offset 0x28: Offset from start of header
236                                         block to the certificate block. This
237                                         allows the signed image verification code
238                                         to verify the signature over the header
239                                         block. */
240     uint8_t decription[16];          /*! text description of SB3.1 file */
241 } nboot_sb3_header_t;
242 
243 /* SB3 commands strutures start */
244 
245 /* basic SB3 command header */
246 typedef struct
247 {
248     uint32_t tag;
249     uint32_t startAddress;
250     uint32_t length;
251     uint32_t cmd;
252 } nboot_range_header_t;
253 
254 /* basic SB3 command header data extension with memory ID */
255 typedef struct
256 {
257     uint32_t memoryId;
258     uint32_t _pad0;
259     uint32_t _pad1;
260     uint32_t _pad2;
261 } nboot_range_header_memory_data_t;
262 
263 /* load key blob command header */
264 typedef struct
265 {
266     uint32_t tag;
267     uint16_t offset;
268     uint16_t keyWrapId;
269     uint32_t length;
270     uint32_t cmd;
271 } nboot_load_key_range_header_t;
272 
273 /* header of fill memory command */
274 typedef struct
275 {
276     uint32_t tag;
277     uint32_t memoryId;
278     uint32_t address;
279     uint32_t cmd;
280 } nboot_config_memory_range_header_t;
281 
282 /* copy command additional data */
283 typedef struct
284 {
285     uint32_t destinationAddress;
286     uint32_t memoryIdFrom;
287     uint32_t memoryIdDest;
288     uint32_t _pad0;
289 } nboot_copy_command_data_t;
290 
291 /* fillMemory command additional data */
292 typedef struct
293 {
294     uint32_t pattern;
295     uint32_t memortId;
296     uint32_t _pad0;
297     uint32_t _pad1;
298 } nboot_fill_command_data_t;
299 /* SB3 commands strutures end*/
300 
301 /* nboot context structure with public and private part (context array)*/
302 typedef struct
303 {
304     uint32_t blockSize;
305     uint32_t totalBlocks;
306     uint32_t processData;
307     uint8_t context[NBOOT_CONTEXT_SIZE];
308 } nboot_context_t;
309 
310 /* ROM API structure*/
311 typedef struct
312 {
313     nboot_status_t (*nboot_context_init)(nboot_context_t *context);
314     nboot_status_t (*nboot_context_free)(nboot_context_t *context);
315     nboot_status_t (*nboot_sb3_load_manifest)(nboot_context_t *context, uint32_t *manifest);
316     nboot_status_t (*nboot_sb3_load_block)(nboot_context_t *context, uint32_t *block);
317     nboot_status_t (*nboot_sb3_load_s200_fw)(nboot_context_t *context, uint32_t *sb3Data);
318     nboot_status_t (*nboot_img_authenticate_ecdsa)(nboot_context_t *context,
319                                                    uint8_t imageStart[],
320                                                    nboot_bool_t *isSignatureVerified);
321     nboot_status_t (*nboot_rng_random)(nboot_context_t *context, void *buf, size_t bufLen);
322     nboot_status_t (*nboot_rng_random_hq)(nboot_context_t *context, void *buf, size_t bufLen);
323     nboot_status_t (*nboot_fuse_program)(nboot_context_t *context,
324                                          uint32_t addr,
325                                          uint32_t *data,
326                                          uint32_t systemClockFrequencyMHz);
327     nboot_status_t (*nboot_fuse_read)(nboot_context_t *context,
328                                       uint32_t addr,
329                                       uint32_t *data,
330                                       uint32_t systemClockFrequencyMHz);
331     nboot_status_t (*nboot_property_get)(nboot_context_t *context,
332                                          uint32_t propertyId,
333                                          uint8_t *destData,
334                                          size_t *dataLen);
335 } nboot_interface_t;
336 
337 /*******************************************************************************
338  * API
339  ******************************************************************************/
340 
341 #if defined(__cplusplus)
342 extern "C" {
343 #endif
344 
345 /*!
346  * @brief The function is used for initializing of the nboot context data structure.
347  *        It should be called prior to any other calls of nboot API.
348  *
349  * @param context Pointer to nboot_context_t structure.
350  *
351  * @retval #kStatus_NBOOT_Success Operation successfully finished.
352  * @retval #kStatus_NBOOT_Fail Error occured during operation.
353  */
354 nboot_status_t NBOOT_ContextInit(nboot_context_t *context);
355 
356 /*!
357  * @brief The function is used to deinitialize nboot context data structure.
358  * Its contents are overwritten with random data so that any sensitive data does not remain in memory.
359  *
360  * @param context Pointer to nboot_context_t structure.
361 
362  * @retval #kStatus_NBOOT_Success Operation successfully finished.
363  * @retval #kStatus_NBOOT_Fail Error occured during operation.
364  */
365 nboot_status_t NBOOT_ContextFree(nboot_context_t *context);
366 
367 /*!
368  * @brief Verify NBOOT SB3.1 manifest (header message).
369  * This function verifies  the NBOOT SB3.1 manifest, initializes the context and loads keys into the.
370  * CSS key store so that they can be used by nboot_sb3_load_block function
371  * The NBOOT context has to be initialized by the function nboot_context_init before calling this function.
372  *
373  * @param context NBOOT context data struct.
374  * @param manifest pointer to the input manifest buffer
375  *
376  * @retval #kStatus_NBOOT_Success Returned when the operation completed successfully
377  * @retval #kStatus_NBOOT_Fail Returned in case of error.
378  */
379 nboot_status_t NBOOT_SB3LoaderManifest(nboot_context_t *context, uint32_t *manifest);
380 
381 /*!
382  * @brief Verify NBOOT SB3.1 block.
383  *
384  * This function verifies and decrypts an NBOOT SB3.1 block. Decryption is performed in-place.
385  * The NBOOT context has to be initialized by the function nboot_context_init before calling this function.
386  *
387  * @param context NBOOT context data struct.
388  * @param block pointer to the input block
389  *
390  * @retval #kStatus_NBOOT_Success Returned when the operation completed successfully
391  * @retval #kStatus_NBOOT_Fail Returned in case of error.
392  */
393 nboot_status_t NBOOT_SB3LoaderBlock(nboot_context_t *context, uint32_t *block);
394 
395 /*!
396  * @brief Authenticate and load Sentinel200 firmware at once
397  *
398  * This function verifies and decrypts SB3.1 file with S200 firmware. Decryption is performed to S200 RAM and firmware
399  * automaticly started after sucessfull load. The NBOOT context has to be initialized by the function nboot_context_init
400  * before calling this function.
401  *
402  * @param context NBOOT context data struct.
403  * @param sb3Data pointer to the sb3.1 block wit s200 firmware
404  *
405  * @retval #kStatus_NBOOT_Success Returned when the operation completed successfully
406  * @retval #kStatus_NBOOT_Fail Returned in case of error.
407  */
408 nboot_status_t NBOOT_SB3LoaderS200Fw(nboot_context_t *context, uint32_t *sb3Data);
409 
410 /*!
411  * @brief Secure boot image authentication.
412  *
413  * This function authenticates image with asymmetric cryptography.
414  *
415  * @param context NBOOT context data struct (work area).
416  * @param imageStart Pointer to start of the image in memory.
417  * @param isSignatureVerified Pointer to memory holding function call result.
418  *        After the function returns, the value will be set to kNBOOT_TRUE when the image is authentic.
419  *        Any other value means the authentication does not pass.
420  *
421  * @retval #kStatus_NBOOT_Success Returned when the image is authentic.
422  * @retval #kStatus_NBOOT_Fail Returned in all other cases. Doesn't always mean invalid image,
423  *                            it could also mean transient error caused by short time environmental conditions.
424  */
425 nboot_status_t NBOOT_ImgAuthenticateEcdsa(nboot_context_t *context,
426                                           uint8_t imageStart[],
427                                           nboot_bool_t *isSignatureVerified);
428 
429 /*!
430  * @brief Get random number in the highest quality, which is currently avaibale, no delay with TRNG initialization.
431  *
432  * @param context NBOOT context data struct (work area).
433  * @param buf Pointer to buffer in memory to store random number.
434  * @param bufLen Buffer length in number of bytes.
435  *
436  * @retval Please refer to nboot_status_t.
437  */
438 nboot_status_t NBOOT_RngRandom(nboot_context_t *context, void *buf, size_t bufLen);
439 
440 /*!
441  * @brief Get high quality random number(s)
442  *
443  * @param context NBOOT context data struct (work area).
444  * @param buf Pointer to buffer in memory to store random number.
445  * @param bufLen Buffer length in number of bytes.
446  *
447  * @retval Please refer to nboot_status_t.
448  */
449 nboot_status_t NBOOT_RngRandomHq(nboot_context_t *context, void *buf, size_t bufLen);
450 
451 /*!
452  * @brief Program a fuse word
453  * Programs a fuse word at given address with new data.
454  *
455  * @param context NBOOT context data struct (work area).
456  * @param addr Fuse index.
457  * @param data Pointer to data expected to be programmed in fuse.
458  * @param systemClockFrequencyMHz Boot frequency.
459  *
460  * @retval Please refer to nboot_status_t.
461  */
462 nboot_status_t NBOOT_FuseProgram(nboot_context_t *context,
463                                  uint32_t addr,
464                                  uint32_t *data,
465                                  uint32_t systemClockFrequencyMHz);
466 
467 /*!
468  * @brief Reads a fuse word
469  * Reads a fuse word.
470  *
471  * @param context NBOOT context data struct (work area).
472  * @param addr Fuse index.
473  * @param data Pointer to data buffer expecting fuse contents after successful read.
474  * @param systemClockFrequencyMHz Boot frequency.
475  *
476  * @retval Please refer to nboot_status_t.
477  */
478 nboot_status_t NBOOT_FuseRead(nboot_context_t *context,
479                               uint32_t addr,
480                               uint32_t *data,
481                               uint32_t systemClockFrequencyMHz);
482 
483 /*!
484  * @brief Read property
485  * One of the important properties that can be read is the property that last
486  * authentication of signed image container has succeeded.
487  *
488  * @param context NBOOT context data struct (work area).
489  * @param propertyId Property ID must be supported by nboot.
490  * @param destData Pointer to data buffer for storing returned contents.
491  * @param dataLen Data buffer length.
492  *
493  * @retval Please refer to nboot_status_t.
494  */
495 nboot_status_t NBOOT_PropertyGet(nboot_context_t *context, uint32_t propertyId, uint8_t *destData, size_t *dataLen);
496 
497 #if defined(__cplusplus)
498 }
499 #endif
500 
501 #endif /* _FSL_NBOOT_H_ */
502