48 #ifndef ti_dl_dl_keystorectl__include 49 #define ti_dl_dl_keystorectl__include 54 #include <ti/devices/msp/msp.h> 57 #ifdef __MSPM0_HAS_KEYSTORE_CTL__ 70 #define DL_KEYSTORECTL_KEY_SLOT_0 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT0) 73 #define DL_KEYSTORECTL_KEY_SLOT_1 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT1) 76 #define DL_KEYSTORECTL_KEY_SLOT_2 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT2) 79 #define DL_KEYSTORECTL_KEY_SLOT_3 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT3) 82 #define DL_KEYSTORECTL_KEY_SLOT_4 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT4) 85 #define DL_KEYSTORECTL_KEY_SLOT_5 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT5) 88 #define DL_KEYSTORECTL_KEY_SLOT_6 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT6) 91 #define DL_KEYSTORECTL_KEY_SLOT_7 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT7) 95 #define DL_KEYSTORECTL_KEY_SLOT_0_AND_1 ((KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT0) | \ 96 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT1)) 99 #define DL_KEYSTORECTL_KEY_SLOT_2_AND_3 ((KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT2) | \ 100 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT3)) 103 #define DL_KEYSTORECTL_KEY_SLOT_4_AND_5 ((KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT4) | \ 104 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT5)) 107 #define DL_KEYSTORECTL_KEY_SLOT_6_AND_7 ((KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT6) | \ 108 (KEYSTORECTL_KEYWR_KEYSLOTSEL_SLOT7)) 161 KEYSTORECTL_STATUS_STAT_INVALID_NK256,
171 KEYSTORECTL_STATUS_STAT_INVALID_KEYSLOTSELW,
177 KEYSTORECTL_STATUS_STAT_INVALID_KEYSLOTSELR,
229 KEYSTORECTL_Regs *keystorectl, DL_KEYSTORECTL_NUM_256_KEYS numKeys)
232 &keystorectl->CFG, (uint32_t) numKeys, KEYSTORECTL_CFG_NK256_MASK);
245 const KEYSTORECTL_Regs *keystorectl)
247 uint32_t numKeys = (keystorectl->CFG & KEYSTORECTL_CFG_NK256_MASK);
249 return (DL_KEYSTORECTL_NUM_256_KEYS)(numKeys);
273 KEYSTORECTL_Regs *keystorectl, uint32_t keySlot)
276 &keystorectl->KEYWR, keySlot, KEYSTORECTL_KEYWR_KEYSLOTSEL_MASK);
295 const KEYSTORECTL_Regs *keystorectl)
297 return (keystorectl->KEYWR & KEYSTORECTL_KEYWR_KEYSLOTSEL_MASK);
319 KEYSTORECTL_Regs *keystorectl, DL_KEYSTORECTL_KEY_SIZE keySize)
322 KEYSTORECTL_KEYWR_KEYSZSEL_MASK);
338 const KEYSTORECTL_Regs *keystorectl)
340 uint32_t keySize = (keystorectl->KEYWR & KEYSTORECTL_KEYWR_KEYSZSEL_MASK);
342 return (DL_KEYSTORECTL_KEY_SIZE)(keySize);
382 KEYSTORECTL_Regs *keystorectl, uint32_t keySlot)
385 &keystorectl->KEYRD, keySlot, KEYSTORECTL_KEYRD_KEYSLOTSEL_MASK);
401 const KEYSTORECTL_Regs *keystorectl)
403 return (keystorectl->KEYRD & KEYSTORECTL_KEYRD_KEYSLOTSEL_MASK);
422 KEYSTORECTL_Regs *keystorectl, DL_KEYSTORECTL_KEY_SIZE keySize)
425 KEYSTORECTL_KEYRD_KEYSZSEL_MASK);
438 const KEYSTORECTL_Regs *keystorectl)
440 uint32_t keySize = (keystorectl->KEYRD & KEYSTORECTL_KEYRD_KEYSZSEL_MASK);
442 return (DL_KEYSTORECTL_KEY_SIZE)(keySize);
453 const KEYSTORECTL_Regs *keystorectl)
455 uint32_t status = (keystorectl->STATUS & KEYSTORECTL_STATUS_STAT_MASK);
473 const KEYSTORECTL_Regs *keystorectl)
475 return (keystorectl->STATUS & KEYSTORECTL_STATUS_VALID_MASK);
492 const KEYSTORECTL_Regs *keystorectl)
495 (keystorectl->STATUS & KEYSTORECTL_STATUS_NKEYSLOTS_MASK);
497 return (DL_KEYSTORECTL_NUM_SLOTS)(numSlots);
__STATIC_INLINE void DL_Common_updateReg(volatile uint32_t *reg, uint32_t val, uint32_t mask)
Writes value to specified register - retaining bits unaffected by mask.
Definition: dl_common.h:63
Definition: dl_keystorectl.h:143
Definition: dl_keystorectl.h:131
DL_KEYSTORECTL_KEY_SIZE
Definition: dl_keystorectl.h:129
Definition: dl_keystorectl.h:170
Definition: dl_keystorectl.h:149
Definition: dl_keystorectl.h:123
Definition: dl_keystorectl.h:163
Definition: dl_keystorectl.h:165
DL_KEYSTORECTL_STATUS
Definition: dl_keystorectl.h:153
DL_KEYSTORECTL_CRYPTO_SEL
Definition: dl_keystorectl.h:147
DL_KEYSTORECTL_CRYPTO_SEL cryptoSel
Definition: dl_keystorectl.h:208
__STATIC_INLINE DL_KEYSTORECTL_STATUS DL_KEYSTORECTL_getStatus(const KEYSTORECTL_Regs *keystorectl)
Gets the current status of the KEYSTORECTL module.
Definition: dl_keystorectl.h:452
uint32_t * key
Definition: dl_keystorectl.h:194
DL_KEYSTORECTL_STATUS DL_KEYSTORECTL_writeKey(KEYSTORECTL_Regs *keystorectl, DL_KEYSTORECTL_KeyWrConfig *keyWrConfig)
Writes a key into the KEYSTORE.
Definition: dl_keystorectl.h:158
DL_KEYSTORECTL_KEY_SIZE keySize
Definition: dl_keystorectl.h:206
Definition: dl_keystorectl.h:121
Definition: dl_keystorectl.h:176
Definition: dl_keystorectl.h:125
Configuration struct for DL_KEYSTORECTL_transferKey.
Definition: dl_keystorectl.h:200
Definition: dl_keystorectl.h:141
__STATIC_INLINE DL_KEYSTORECTL_NUM_256_KEYS DL_KEYSTORECTL_getNumberOf256Keys(const KEYSTORECTL_Regs *keystorectl)
Returns the current number of combined 256 key slots.
Definition: dl_keystorectl.h:244
Definition: dl_keystorectl.h:155
DL_KEYSTORECTL_NUM_256_KEYS
Definition: dl_keystorectl.h:115
Definition: dl_keystorectl.h:133
uint32_t keySlot
Definition: dl_keystorectl.h:203
__STATIC_INLINE void DL_KEYSTORECTL_setDestinationKeySize(KEYSTORECTL_Regs *keystorectl, DL_KEYSTORECTL_KEY_SIZE keySize)
Sets the intended destination key slot size for next write.
Definition: dl_keystorectl.h:318
__STATIC_INLINE uint32_t DL_KEYSTORECTL_getDestinationKeySlot(const KEYSTORECTL_Regs *keystorectl)
Returns the intended destination key slot for the next write.
Definition: dl_keystorectl.h:294
DL_KEYSTORECTL_KEY_SIZE keySize
Definition: dl_keystorectl.h:192
__STATIC_INLINE void DL_KEYSTORECTL_setSourceKeySize(KEYSTORECTL_Regs *keystorectl, DL_KEYSTORECTL_KEY_SIZE keySize)
Gets the intended source key slot size for next transfer.
Definition: dl_keystorectl.h:421
Definition: dl_keystorectl.h:117
Definition: dl_keystorectl.h:160
Configuration struct for DL_KEYSTORECTL_writeKey.
Definition: dl_keystorectl.h:186
uint32_t keySlot
Definition: dl_keystorectl.h:189
DL_KEYSTORECTL_STATUS DL_KEYSTORECTL_transferKey(KEYSTORECTL_Regs *keystorectl, const DL_KEYSTORECTL_Config *config)
Transfers key loaded in KEYSTORE into intended crypto.
__STATIC_INLINE void DL_KEYSTORECTL_setDestinationKeySlot(KEYSTORECTL_Regs *keystorectl, uint32_t keySlot)
Sets the intended destination key slot for the next write.
Definition: dl_keystorectl.h:272
__STATIC_INLINE DL_KEYSTORECTL_NUM_SLOTS DL_KEYSTORECTL_getNumSlots(const KEYSTORECTL_Regs *keystorectl)
Gets the total number of 128-bit key slots in HW on the device.
Definition: dl_keystorectl.h:491
void DL_KEYSTORECTL_loadKey(KEYSTORECTL_Regs *keystorectl, uint32_t *key)
Sets the intended destination key slot size for next write.
Definition: dl_keystorectl.h:180
__STATIC_INLINE uint32_t DL_KEYSTORECTL_getSourceKeySlot(const KEYSTORECTL_Regs *keystorectl)
Gets the intended source key slot for the next transfer.
Definition: dl_keystorectl.h:400
DL_KEYSTORECTL_NUM_SLOTS
Definition: dl_keystorectl.h:137
Definition: dl_keystorectl.h:139
__STATIC_INLINE DL_KEYSTORECTL_KEY_SIZE DL_KEYSTORECTL_getDestinationKeySize(const KEYSTORECTL_Regs *keystorectl)
Returns the intended destination key size for the next write.
Definition: dl_keystorectl.h:337
Definition: dl_keystorectl.h:119
__STATIC_INLINE uint32_t DL_KEYSTORECTL_getValidKeySlots(const KEYSTORECTL_Regs *keystorectl)
Gets currently written key slots.
Definition: dl_keystorectl.h:472
__STATIC_INLINE void DL_KEYSTORECTL_setNumberOf256Keys(KEYSTORECTL_Regs *keystorectl, DL_KEYSTORECTL_NUM_256_KEYS numKeys)
Sets the number of combined 256 key slots.
Definition: dl_keystorectl.h:228
__STATIC_INLINE DL_KEYSTORECTL_KEY_SIZE DL_KEYSTORECTL_getSourceKeySize(const KEYSTORECTL_Regs *keystorectl)
Gets the intended source key size for the next transfer.
Definition: dl_keystorectl.h:437
__STATIC_INLINE void DL_KEYSTORECTL_setSourceKeySlot(KEYSTORECTL_Regs *keystorectl, uint32_t keySlot)
Gets the intended source key slot for the next transfer.
Definition: dl_keystorectl.h:381