64 #define CSEC_STATUS_BUSY (0x1U)
66 #define CSEC_STATUS_SECURE_BOOT (0x2U)
69 #define CSEC_STATUS_BOOT_INIT (0x4U)
73 #define CSEC_STATUS_BOOT_FINISHED (0x8U)
76 #define CSEC_STATUS_BOOT_OK (0x10U)
78 #define CSEC_STATUS_RND_INIT (0x20U)
80 #define CSEC_STATUS_EXT_DEBUGGER (0x40U)
83 #define CSEC_STATUS_INT_DEBUGGER (0x80U)
212 #if defined(__cplusplus)
248 const uint8_t *plainText, uint32_t length, uint8_t *cipherText,
268 uint32_t length, uint8_t *plainText, uint32_t timeout);
289 const uint8_t *plainText, uint32_t length,
290 const uint8_t *iv, uint8_t *cipherText, uint32_t timeout);
310 uint32_t length,
const uint8_t* iv, uint8_t *plainText, uint32_t timeout);
327 uint32_t msgLen, uint8_t *cmac, uint32_t timeout);
347 const uint8_t *msg, uint32_t msgLen, uint8_t *cmac);
367 uint32_t msgLen,
const uint8_t *mac, uint16_t macLen,
bool *verifStatus,
391 uint32_t msgLen,
const uint8_t *mac, uint16_t macLen,
bool *verifStatus);
414 const uint8_t *m2,
const uint8_t *m3, uint8_t *m4, uint8_t *m5);
444 uint8_t *m3, uint8_t *m4, uint8_t *m5);
531 return (
FTFC->FCSESTAT);
550 uint8_t *sreg, uint8_t *mac);
597 uint8_t *mpCompress, uint32_t timeout);
616 const uint8_t *plainText,
618 uint8_t *cipherText);
637 const uint8_t *cipherText,
658 const uint8_t *plainText,
661 uint8_t *cipherText);
681 const uint8_t *cipherText,
757 #if defined(__cplusplus)
status_t CSEC_DRV_LoadPlainKey(const uint8_t *plainKey)
Updates the RAM key memory slot with a 128-bit plaintext.
status_t CSEC_DRV_GetAsyncCmdStatus(void)
Checks the status of the execution of an asynchronous command.
security_callback_t callback
void CSEC_DRV_InstallCallback(security_callback_t callbackFunc, void *callbackParam)
Installs a callback function which will be invoked when an asynchronous command finishes its executio...
status_t CSEC_DRV_GetID(const uint8_t *challenge, uint8_t *uid, uint8_t *sreg, uint8_t *mac)
Returns the identity (UID) and the value of the status register protected by a MAC over a challenge a...
Internal driver state information.
status_t CSEC_DRV_DecryptCBC(csec_key_id_t keyId, const uint8_t *cipherText, uint32_t length, const uint8_t *iv, uint8_t *plainText, uint32_t timeout)
Performs the AES-128 decryption in CBC mode.
void CSEC_DRV_Init(csec_state_t *state)
Initializes the internal state of the driver and enables the FTFC interrupt.
status_t CSEC_DRV_DbgAuth(const uint8_t *authorization)
Erases all keys (actual and outdated) stored in NVM Memory if the authorization is confirmed by CSEc...
status_t CSEC_DRV_VerifyMACAsync(csec_key_id_t keyId, const uint8_t *msg, uint32_t msgLen, const uint8_t *mac, uint16_t macLen, bool *verifStatus)
Asynchronously verifies the MAC of a given message using CMAC with AES-128.
csec_key_id_t
Specify the KeyID to be used to implement the requested cryptographic operation.
status_t CSEC_DRV_BootOK(void)
Marks a successful boot verification during later stages of the boot process.
status_t CSEC_DRV_EncryptCBCAsync(csec_key_id_t keyId, const uint8_t *plainText, uint32_t length, const uint8_t *iv, uint8_t *cipherText)
Asynchronously performs the AES-128 encryption in CBC mode.
status_t CSEC_DRV_VerifyMAC(csec_key_id_t keyId, const uint8_t *msg, uint32_t msgLen, const uint8_t *mac, uint16_t macLen, bool *verifStatus, uint32_t timeout)
Verifies the MAC of a given message using CMAC with AES-128.
status_t CSEC_DRV_VerifyMACAddrMode(csec_key_id_t keyId, const uint8_t *msg, uint32_t msgLen, const uint8_t *mac, uint16_t macLen, bool *verifStatus)
Verifies the MAC of a given message (located in Flash) using CMAC with AES-128.
status_t CSEC_DRV_InitRNG(void)
Initializes the seed and derives a key for the PRNG.
static csec_status_t CSEC_DRV_GetStatus(void)
Returns the content of the status register.
uint8_t csec_status_t
Represents the status of the CSEc module. Provides one bit for each status code as per SHE specificat...
status_t CSEC_DRV_ExtendSeed(const uint8_t *entropy)
Extends the seed of the PRNG.
status_t CSEC_DRV_EncryptECB(csec_key_id_t keyId, const uint8_t *plainText, uint32_t length, uint8_t *cipherText, uint32_t timeout)
Performs the AES-128 encryption in ECB mode.
status_t CSEC_DRV_BootFailure(void)
Signals a failure detected during later stages of the boot process.
status_t CSEC_DRV_DecryptECBAsync(csec_key_id_t keyId, const uint8_t *cipherText, uint32_t length, uint8_t *plainText)
Asynchronously performs the AES-128 decryption in ECB mode.
status_t CSEC_DRV_EncryptECBAsync(csec_key_id_t keyId, const uint8_t *plainText, uint32_t length, uint8_t *cipherText)
Asynchronously performs the AES-128 encryption in ECB mode.
status_t CSEC_DRV_DecryptECB(csec_key_id_t keyId, const uint8_t *cipherText, uint32_t length, uint8_t *plainText, uint32_t timeout)
Performs the AES-128 decryption in ECB mode.
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
void(* security_callback_t)(uint32_t completedCmd, void *callbackParam)
Callback for security modules.
status_t CSEC_DRV_EncryptCBC(csec_key_id_t keyId, const uint8_t *plainText, uint32_t length, const uint8_t *iv, uint8_t *cipherText, uint32_t timeout)
Performs the AES-128 encryption in CBC mode.
status_t CSEC_DRV_GenerateMACAddrMode(csec_key_id_t keyId, const uint8_t *msg, uint32_t msgLen, uint8_t *cmac)
Calculates the MAC of a given message (located in Flash) using CMAC with AES-128. ...
void CSEC_DRV_Deinit(void)
Clears the internal state of the driver and disables the FTFC interrupt.
status_t CSEC_DRV_LoadKey(csec_key_id_t keyId, const uint8_t *m1, const uint8_t *m2, const uint8_t *m3, uint8_t *m4, uint8_t *m5)
Updates an internal key per the SHE specification.
status_t CSEC_DRV_MPCompress(const uint8_t *msg, uint16_t msgLen, uint8_t *mpCompress, uint32_t timeout)
Compresses the given messages by accessing the Miyaguchi-Prenell compression feature with in the CSEc...
void CSEC_DRV_CancelCommand(void)
Cancels a previously launched asynchronous command.
csec_boot_flavor_t
Specifies the boot type for the BOOT_DEFINE command.
status_t CSEC_DRV_DecryptCBCAsync(csec_key_id_t keyId, const uint8_t *cipherText, uint32_t length, const uint8_t *iv, uint8_t *plainText)
Asynchronously performs the AES-128 decryption in CBC mode.
csec_call_sequence_t
Specifies if the information is the first or a following function call.
csec_cmd_t
CSEc commands which follow the same values as the SHE command definition.
status_t CSEC_DRV_ExportRAMKey(uint8_t *m1, uint8_t *m2, uint8_t *m3, uint8_t *m4, uint8_t *m5)
Exports the RAM_KEY into a format protected by SECRET_KEY.
status_t CSEC_DRV_GenerateRND(uint8_t *rnd)
Generates a vector of 128 random bits.
status_t CSEC_DRV_GenerateMAC(csec_key_id_t keyId, const uint8_t *msg, uint32_t msgLen, uint8_t *cmac, uint32_t timeout)
Calculates the MAC of a given message using CMAC with AES-128.
const uint8_t * inputBuff
status_t CSEC_DRV_DbgChal(uint8_t *challenge)
Obtains a random number which the user shall use along with the MASTER_ECU_KEY and UID to return an a...
status_t CSEC_DRV_BootDefine(uint32_t bootSize, csec_boot_flavor_t bootFlavor)
Implements an extension of the SHE standard to define both the user boot size and boot method...
status_t CSEC_DRV_GenerateMACAsync(csec_key_id_t keyId, const uint8_t *msg, uint32_t msgLen, uint8_t *cmac)
Asynchronously calculates the MAC of a given message using CMAC with AES-128.