15#include "fsl_common.h"
60#define FSL_PUF_DRIVER_VERSION (MAKE_VERSION(2, 1, 6))
63typedef enum _puf_key_index_register
65 kPUF_KeyIndex_00 = 0x00U,
66 kPUF_KeyIndex_01 = 0x01U,
67 kPUF_KeyIndex_02 = 0x02U,
68 kPUF_KeyIndex_03 = 0x03U,
69 kPUF_KeyIndex_04 = 0x04U,
70 kPUF_KeyIndex_05 = 0x05U,
71 kPUF_KeyIndex_06 = 0x06U,
72 kPUF_KeyIndex_07 = 0x07U,
73 kPUF_KeyIndex_08 = 0x08U,
74 kPUF_KeyIndex_09 = 0x09U,
75 kPUF_KeyIndex_10 = 0x0AU,
76 kPUF_KeyIndex_11 = 0x0BU,
77 kPUF_KeyIndex_12 = 0x0CU,
78 kPUF_KeyIndex_13 = 0x0DU,
79 kPUF_KeyIndex_14 = 0x0EU,
80 kPUF_KeyIndex_15 = 0x0FU,
81} puf_key_index_register_t;
83typedef enum _puf_min_max
86 kPUF_KeySizeMax = 512u,
87 kPUF_KeyIndexMax = kPUF_KeyIndex_15,
95#if defined(PUF_KEYMASK_COUNT) && (PUF_KEYMASK_COUNT > 2)
103 uint32_t dischargeTimeMsec;
104 uint32_t coreClockFrequencyHz;
105#if defined(FSL_FEATURE_PUF_HAS_SRAM_CTRL) && (FSL_FEATURE_PUF_HAS_SRAM_CTRL > 0)
107 PUF_SRAM_CTRL_Type *puf_sram_base;
112#define PUF_GET_KEY_CODE_SIZE_FOR_KEY_SIZE(x) ((160u + (((((x) << 3) + 255u) >> 8) << 8)) >> 3)
113#define PUF_MIN_KEY_CODE_SIZE PUF_GET_KEY_CODE_SIZE_FOR_KEY_SIZE(8UL)
114#define PUF_ACTIVATION_CODE_SIZE 1192U
115#define KEYSTORE_PUF_DISCHARGE_TIME_FIRST_TRY_MS 50
116#define KEYSTORE_PUF_DISCHARGE_TIME_MAX_MS 400
130#if defined(__cplusplus)
210 PUF_Type *base, puf_key_index_register_t keyIndex,
size_t keySize, uint8_t *keyCode,
size_t keyCodeSize);
229 puf_key_index_register_t keyIndex,
230 const uint8_t *userKey,
292#if defined(PUF_CFG_BLOCKKEYOUTPUT_MASK) && PUF_CFG_BLOCKKEYOUTPUT_MASK
293static inline void PUF_BlockSetKey(
PUF_Type *base)
295 base->CFG |= PUF_CFG_BLOCKKEYOUTPUT_MASK;
299#if defined(PUF_CFG_PUF_BLOCK_SET_KEY_MASK) && PUF_CFG_PUF_BLOCK_SET_KEY_MASK
300static inline void PUF_BlockSetKey(
PUF_Type *base)
302 base->CFG |= PUF_CFG_PUF_BLOCK_SET_KEY_MASK;
306#if defined(PUF_CFG_BLOCKENROLL_SETKEY_MASK) && PUF_CFG_BLOCKENROLL_SETKEY_MASK
307static inline void PUF_BlockEnroll(
PUF_Type *base)
309 base->CFG |= PUF_CFG_BLOCKENROLL_SETKEY_MASK;
313#if defined(PUF_CFG_PUF_BLOCK_ENROLL_MASK) && PUF_CFG_PUF_BLOCK_ENROLL_MASK
314static inline void PUF_BlockEnroll(
PUF_Type *base)
316 base->CFG |= PUF_CFG_PUF_BLOCK_ENROLL_MASK;
331#if defined(__cplusplus)
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:47
@ kStatusGroup_PUF
Definition: fsl_common.h:160
status_t PUF_SetUserKey(PUF_Type *base, puf_key_index_register_t keyIndex, const uint8_t *userKey, size_t userKeySize, uint8_t *keyCode, size_t keyCodeSize)
Set user key.
Definition: fsl_puf.c:528
status_t PUF_PowerCycle(PUF_Type *base, puf_config_t *conf)
Powercycle PUF.
Definition: fsl_puf.c:110
status_t PUF_Zeroize(PUF_Type *base)
Zeroize PUF.
Definition: fsl_puf.c:935
status_t PUF_SetIntrinsicKey(PUF_Type *base, puf_key_index_register_t keyIndex, size_t keySize, uint8_t *keyCode, size_t keyCodeSize)
Set intrinsic key.
Definition: fsl_puf.c:438
status_t PUF_GetHwKey(PUF_Type *base, const uint8_t *keyCode, size_t keyCodeSize, puf_key_slot_t keySlot, uint32_t keyMask)
Reconstruct hw bus key from a key code.
Definition: fsl_puf.c:705
_puf_key_slot
PUF key slot.
Definition: fsl_puf.h:92
void PUF_Deinit(PUF_Type *base, puf_config_t *conf)
Denitialize PUF.
Definition: fsl_puf.c:251
bool PUF_IsGetKeyAllowed(PUF_Type *base)
Checks if Get Key operation is allowed.
Definition: fsl_puf.c:813
void PUF_GetDefaultConfig(puf_config_t *conf)
Sets the default configuration of PUF.
Definition: fsl_puf.c:174
status_t PUF_GetKey(PUF_Type *base, const uint8_t *keyCode, size_t keyCodeSize, uint8_t *key, size_t keySize)
Reconstruct key from a key code.
Definition: fsl_puf.c:839
status_t PUF_Start(PUF_Type *base, const uint8_t *activationCode, size_t activationCodeSize)
Start PUF.
Definition: fsl_puf.c:363
enum _puf_key_slot puf_key_slot_t
PUF key slot.
status_t PUF_Enroll(PUF_Type *base, uint8_t *activationCode, size_t activationCodeSize)
Enroll PUF.
Definition: fsl_puf.c:294
status_t PUF_Init(PUF_Type *base, puf_config_t *conf)
Initialize PUF.
Definition: fsl_puf.c:199
@ kPUF_KeySlot0
Definition: fsl_puf.h:93
@ kPUF_KeySlot1
Definition: fsl_puf.h:94
Definition: MIMXRT1166_cm4.h:67912
Definition: fsl_puf.h:102