![]() |
RAFW Flexible Software Package Documentation
Release v2.0.1
|
|
Functions | |
| void | init_crypto_primitives (const CRYPTO_PRIMITIVE_TYPE *primitive) |
| Initiaize ROMCrypto Library. More... | |
| void | R_CC312_Debug_SecureBoot (uint32_t mode) |
| Set Debug Mode. More... | |
| uint32_t | R_CC312_Debug_SecureBoot_Mode (void) |
| Set Debug Mode. More... | |
| uint32_t | R_CC312_Debug_Get_ErrorCode (void) |
| Get Error Mode. More... | |
| uint32_t | R_CC312_SecureBoot (uint32_t taddress, uint32_t *jaddress, void(*stopproc)(void *)) |
| Run SecureBoot. More... | |
| uint32_t | R_CC312_SecureDebug (void *fhandler, uint32_t faddress) |
| Run SecureDebug for DCU Protection. More... | |
| uint32_t | R_CC312_SecureSocID (void) |
| Check Soc-ID. More... | |
| uint32_t | R_CC312_SecureSocID_internal (uint8_t *pSocID) |
| Get Soc-ID. More... | |
| uint32_t | R_CC312_SecureBoot_Fatal (uint32_t *rcRmaFlag) |
| Force the Fatal Error for Secure Boot (test only) More... | |
| uint32_t | R_CC312_SecureBoot_RMA (void) |
| Manually run the RMA process to erase the OTP secrets. (test only) More... | |
| uint32_t | R_CC312_SecureBoot_CMPU (uint8_t *pCmpuData, uint32_t rflag) |
| Register CMPU to write HUKey & CMKeys in OTP. More... | |
| uint32_t | R_CC312_SecureBoot_DMPU (uint8_t *pDmpuData) |
| Register DMPU to write DMKeys in OTP. More... | |
| uint32_t | R_CC312_SecureBoot_GetLock (void) |
| Get the OTP flag used to check whether to run a SecureBoot. More... | |
| uint32_t | R_CC312_SecureBoot_SetLock (void) |
| Set the OTP flag to lock the SecureBoot. More... | |
| void | R_CC312_SecureBoot_OTPLock (uint32_t mode) |
| Lock/Unlock the OTP Protection. More... | |
| uint32_t | R_CC312_SecureBoot_SecureLCS (void) |
| Check if current state is a Secure-Lcs. More... | |
| uint32_t | R_CC312_SecureBoot_GetLock2 (void) |
| Get the OTP flag used to check whether to run a SecureBoot (optional). More... | |
| uint32_t | R_CC312_SecureBoot_SetLock2 (void) |
| Set the OTP flag to lock the SecureBoot (optional). More... | |
| uint32_t | R_CC312_Secure_Asset (uint32_t Owner, uint32_t AssetID, uint32_t *InAssetData, uint32_t AssetSize, uint32_t *OutAssetData, uint32_t *OutAssetSize) |
| Decrypt SecureAsset. More... | |
| int32_t | R_CC312_Secure_Asset_RuntimePack (AssetKeyType_t KeyType, uint32_t noncetype, AssetUserKeyData_t *KeyData, uint32_t AssetID, char *title, uint8_t *InAssetData, uint32_t AssetSize, uint8_t *OutAssetPkgData) |
| Encrypt RuntimeAsset. More... | |
| int32_t | R_CC312_Secure_Asset_RuntimeUnpack (AssetKeyType_t KeyType, AssetUserKeyData_t *KeyData, uint32_t AssetID, uint8_t *InAssetPkgData, uint32_t AssetPkgSize, uint8_t *OutAssetData) |
| Decrypt RuntimeAsset. More... | |
| void | R_CC312_Crypto_ClkMgmt (uint32_t mode) |
| Initialize Crypto Clock. More... | |
| uint32_t | R_CC312_Crypto_Init (uint32_t rflag) |
| Initialize Crypto Engine. More... | |
| void | R_CC312_Crypto_ReInit (void) |
| Re-initialize Crypto Engine after wakeup. | |
| void | R_CC312_Crypto_Finish (void) |
| Deinitialize Crypto Engine. | |
| void | R_CC312_SetCryptoCoreClkGating (uint32_t mode) |
| Enable the clock of HW Crypto. More... | |
| int | R_CC312_Crypto_TRNG (uint32_t sampleCount, uint32_t buffSize, uint8_t *pRndWorkBuff) |
Reads requested length of random data from the TRNG. Generate buffSize of random bytes and store them in pRndWorkBuff buffer. More... | |
Data Structures | |
| struct | CRYPTO_PRIMITIVE_TYPE |
| Structure for Retargeted symbols in ROMCrypto. More... | |
| struct | AssetUserKeyData_t |
| User Key Format. More... | |
| struct | AssetInfoData_t |
| Encrypted RunTime Asset Info. More... | |
Macros | |
| #define | CC_RUNASSET_PROV_TOKEN |
| ID code for RunTime Asset. | |
| #define | CC_RUNASSET_PROV_VERSION |
| Version code for RunTime Asset. | |
Enumerations | |
| enum | AssetKeyType_t |
| KEY Type list. More... | |
| struct CRYPTO_PRIMITIVE_TYPE |
Structure for Retargeted symbols in ROMCrypto.
Data Fields | |
| void(* | retarget_dump )(uint16_t tag, void *srcdata, uint16_t len) |
| callback of hexadump function | |
| void(* | retarget_text )(uint16_t tag, void *srcdata, uint16_t len) |
| callback of puts function | |
| void(* | retarget_vprint )(uint16_t tag, const char *format, va_list arg) |
| callback of vprintf function | |
| char(* | retarget_getchar )(uint32_t mode) |
| callback of getchar function | |
| void *(* | raw_malloc )(size_t size) |
| callback of malloc function | |
| void *(* | raw_realloc )(void *Buffer, size_t NewSize) |
| callback of realloc function | |
| void(* | raw_free )(void *f) |
| callback of free function | |
| uint32_t(* | raw_otpread )(uint32_t otpwoffset) |
| callback of OTP read Wrapper | |
| uint32_t(* | raw_otpwrite )(uint32_t otpwoffset, uint32_t otpData) |
| callback of OTP write Wrapper | |
| void *(* | flash_image_open )(uint32_t mode, uint32_t imghdr_offset, void *locker) |
| callback for flash access | |
| void(* | flash_image_close )(void *handler) |
| callback for flash access | |
| uint32_t(* | flash_image_check )(void *handler, uint32_t imgtype, uint32_t imghdr_offset) |
| callback for flash access | |
| void *(* | flash_image_certificate )(void *handler, uint32_t imghdr_offset, uint32_t certindex, uint32_t *certsize) |
| callback for flash access | |
| uint32_t(* | flash_image_extract )(void *handler, uint32_t imghdr_offset, uint32_t *load_addr, uint32_t *jmp_addr) |
| callback for flash access | |
| uint32_t(* | flash_image_load )(void *handler, uint32_t imghdr_offset, uint32_t *load_addr, uint32_t *jmp_addr) |
| callback for flash access | |
| uint32_t(* | flash_image_read )(void *handler, uint32_t img_offset, void *load_addr, uint32_t img_secsize) |
| callback for flash access | |
| void(* | rtosdelay )(uint32_t usec) |
| callback of OS delay function | |
| uint64_t(* | tickmeasure )(uint32_t flag) |
| callback for time measurement | |
| struct AssetUserKeyData_t |
| struct AssetInfoData_t |
| enum AssetKeyType_t |
| void init_crypto_primitives | ( | const CRYPTO_PRIMITIVE_TYPE * | primitive | ) |
Initiaize ROMCrypto Library.
| [in] | primitive | retargeted symbols used in RomCrypto |
| void R_CC312_Debug_SecureBoot | ( | uint32_t | mode | ) |
Set Debug Mode.
| [in] | mode | debug mode |
| uint32_t R_CC312_Debug_SecureBoot_Mode | ( | void | ) |
Set Debug Mode.
| mode | current debug mode |
| uint32_t R_CC312_Debug_Get_ErrorCode | ( | void | ) |
Get Error Mode.
| code | lastest error mode |
| uint32_t R_CC312_SecureBoot | ( | uint32_t | taddress, |
| uint32_t * | jaddress, | ||
| void(*)(void *) | stopproc | ||
| ) |
Run SecureBoot.
| [in] | taddress | flash memory offset of the image |
| [out] | jaddress | entry point address of the bootable image if jaddress == NULL, then CPU will branch into the APP automatically. |
| [in] | stopproc | callback to safely finish a boot sequence before branching APP |
| true | function succeeded |
| false | function failed |
| uint32_t R_CC312_SecureDebug | ( | void * | fhandler, |
| uint32_t | faddress | ||
| ) |
Run SecureDebug for DCU Protection.
| [in] | fhandler | SFLASH handler |
| [out] | faddress | flash memory offset of the image |
| true | function succeeded |
| false | function failed |
| uint32_t R_CC312_SecureSocID | ( | void | ) |
Check Soc-ID.
| In | Secure-Lcs, SocID is returned |
| otherwise | curruent Lcs is returned. |
| uint32_t R_CC312_SecureSocID_internal | ( | uint8_t * | pSocID | ) |
Get Soc-ID.
| [in,out] | pSocID | empty output buffer for storing the SocID |
| uint32_t R_CC312_SecureBoot_Fatal | ( | uint32_t * | rcRmaFlag | ) |
Force the Fatal Error for Secure Boot (test only)
| [in] | rcRmaFlag | RMA flag |
| Zero | function succeeded |
| Non-Zero | function failed |
| uint32_t R_CC312_SecureBoot_RMA | ( | void | ) |
Manually run the RMA process to erase the OTP secrets. (test only)
| true | function succeeded |
| false | function failed |
| uint32_t R_CC312_SecureBoot_CMPU | ( | uint8_t * | pCmpuData, |
| uint32_t | rflag | ||
| ) |
Register CMPU to write HUKey & CMKeys in OTP.
| [in] | pCmpuData | data pointer of CMPU |
| [in] | rflag | TRNG test feature. Set '0' to avoid the collision of HUKey between products. |
| true | function succeeded |
| false | function failed |
| uint32_t R_CC312_SecureBoot_DMPU | ( | uint8_t * | pDmpuData | ) |
Register DMPU to write DMKeys in OTP.
| [in] | pDmpuData | data pointer of DMPU |
| true | function succeeded |
| false | function failed |
| uint32_t R_CC312_SecureBoot_GetLock | ( | void | ) |
Get the OTP flag used to check whether to run a SecureBoot.
| true | SecureBoot locked (enabled) |
| false | SecureBoot unlocked (disabled) |
| uint32_t R_CC312_SecureBoot_SetLock | ( | void | ) |
Set the OTP flag to lock the SecureBoot.
| true | function succeeded |
| false | function failed |
| void R_CC312_SecureBoot_OTPLock | ( | uint32_t | mode | ) |
Lock/Unlock the OTP Protection.
| [in] | mode | lock value (1 : unlock for writing data, 0: lock) |
| uint32_t R_CC312_SecureBoot_SecureLCS | ( | void | ) |
Check if current state is a Secure-Lcs.
| true | function succeeded |
| false | function failed |
| uint32_t R_CC312_SecureBoot_GetLock2 | ( | void | ) |
Get the OTP flag used to check whether to run a SecureBoot (optional).
| true | SecureBoot locked (enabled) |
| false | SecureBoot unlocked (disabled) |
| uint32_t R_CC312_SecureBoot_SetLock2 | ( | void | ) |
Set the OTP flag to lock the SecureBoot (optional).
| true | function succeeded |
| false | function failed |
| uint32_t R_CC312_Secure_Asset | ( | uint32_t | Owner, |
| uint32_t | AssetID, | ||
| uint32_t * | InAssetData, | ||
| uint32_t | AssetSize, | ||
| uint32_t * | OutAssetData, | ||
| uint32_t * | OutAssetSize | ||
| ) |
Decrypt SecureAsset.
| [in] | Owner | key type (1: CMKey - Kpicv, 2: DMKey - Kcp) |
| [in] | AssetID | unique id (part of nonce) |
| [in] | InAssetData | encrypted asset data |
| [in] | AssetSize | size of InAssetData |
| [out] | OutAssetData | decrypted asset data |
| [in,out] | OutAssetSize | size of decrypted asset data |
| Non-Zero | size of OutAssetData |
| Zero | function failed |
| int32_t R_CC312_Secure_Asset_RuntimePack | ( | AssetKeyType_t | KeyType, |
| uint32_t | noncetype, | ||
| AssetUserKeyData_t * | KeyData, | ||
| uint32_t | AssetID, | ||
| char * | title, | ||
| uint8_t * | InAssetData, | ||
| uint32_t | AssetSize, | ||
| uint8_t * | OutAssetPkgData | ||
| ) |
Encrypt RuntimeAsset.
| [in] | KeyType | key type ( |
| [in] | noncetype | method to generate a nonce (0xFFFFFFFF: PRNG, otherwise: TRNG) |
| [in] | KeyData | User Key data |
| [in] | AssetID | unique id of RuntimeAsset |
| [in] | title | unique tag of RuntimeAsset |
| [in] | InAssetData | plaintext of RuntimeAsset |
| [in] | AssetSize | size of the plaintext. it must be multiply of 16 bytes. |
| [in,out] | OutAssetPkgData | empty output buffer for storing the encrypted RuntimeAsset |
| Non-Zero | size of OutAssetData |
| Zero | function failed |
| int32_t R_CC312_Secure_Asset_RuntimeUnpack | ( | AssetKeyType_t | KeyType, |
| AssetUserKeyData_t * | KeyData, | ||
| uint32_t | AssetID, | ||
| uint8_t * | InAssetPkgData, | ||
| uint32_t | AssetPkgSize, | ||
| uint8_t * | OutAssetData | ||
| ) |
Decrypt RuntimeAsset.
| [in] | KeyType | key type ( |
| [in] | KeyData | User Key data |
| [in] | AssetID | unique id of RuntimeAsset |
| [in] | InAssetPkgData | encrypted RuntimeAsset |
| [in] | AssetPkgSize | size of the encrypted RuntimeAsset |
| [in,out] | OutAssetData | empty output buffer for storing the decrypted RuntimeAsset |
| Non-Zero | size of OutAssetData |
| Zero | function failed |
| void R_CC312_Crypto_ClkMgmt | ( | uint32_t | mode | ) |
Initialize Crypto Clock.
| [in] | mode | pll callbak mode TRUE is support the pll callback of Crypto Engine. |
| uint32_t R_CC312_Crypto_Init | ( | uint32_t | rflag | ) |
Initialize Crypto Engine.
| [in] | rflag | parameter for TRNG initialization |
| true | function succeeded |
| false | function failed |
| void R_CC312_SetCryptoCoreClkGating | ( | uint32_t | mode | ) |
Enable the clock of HW Crypto.
| [in] | mode | if true, then the clock is enabled, othersize it is diabled. |
| int R_CC312_Crypto_TRNG | ( | uint32_t | sampleCount, |
| uint32_t | buffSize, | ||
| uint8_t * | pRndWorkBuff | ||
| ) |
Reads requested length of random data from the TRNG. Generate buffSize of random bytes and store them in pRndWorkBuff buffer.
| [in] | sampleCount | set sampling ratio (rng_clocks) between consecutive bits. |
| [in] | buffSize | the length of random bytes. |
| [in,out] | pRndWorkBuff | empty output buffer for storing the random bytes. |
| Zero | function succeeded |
| Non-Zero | function failed |