![]() |
Kinetis Bootloader
2.0.0
Common bootloader for Kinetis devices
|
Data Structures | |
| struct | otfad_kek_t |
| Format of OTFAD key wrap key (KEK). More... | |
| struct | keyblob_t |
| Key Blob format. More... | |
| struct | keyblob_data_t |
Enumerations | |
| enum | _otfad_driver_errors { kStatus_OtfadSecurityViolation = MAKE_STATUS(kStatusGroup_OTFADDriver, 0), kStatus_OtfadLogicallyDisabled = MAKE_STATUS(kStatusGroup_OTFADDriver, 1), kStatus_OtfadInvalidKey = MAKE_STATUS(kStatusGroup_OTFADDriver, 2), kStatus_OtfadInvalidKeyBlob = MAKE_STATUS(kStatusGroup_OTFADDriver, 3) } |
| OTFAD Driver status codes. | |
| enum | _constants { kAesKeySizeBytes = 16, kCtrSizeBytes = 8, kCrc32SizeBytes = 32, kNumKeyBlobs = 4, kKeyBlobSizeBytes = 64, kKeyBlobArraySizeBytes = kKeyBlobSizeBytes * kNumKeyBlobs } |
| Constants. More... | |
Functions | |
| status_t | otfad_init (uint32_t instance, const uint8_t *keyBlobs, const otfad_kek_t *kek) |
| Initialize. More... | |
| static void | program_contexts (OTFAD_Type *baseAddr, uint8_t *keyBlobs, uint32_t *kek) |
| Program context regiters with information from key blobs. More... | |
| static bool | validate_crc (const keyblob_t *keyBlob) |
| Validate CRC32 in key blob. More... | |
Variables | |
| const uint32_t | g_otfadBaseAddr [] = OTFAD_BASE_ADDRS |
| Instance base addresses. | |
| struct otfad_kek_t |
Format of OTFAD key wrap key (KEK).
The four consecutive little-endian memory-mapped registers provide 128 bits of key storage.
| struct keyblob_t |
Key Blob format.
| Data Fields | ||
|---|---|---|
| uint8_t | ctr[kCtrSizeBytes] | |
| uint32_t | endaddr | |
| uint8_t | expanded_wrap_data[8] | |
| uint8_t | key[kAesKeySizeBytes] | |
| uint32_t | key_blob_crc32 | |
| uint32_t | srtaddr | |
| uint8_t | unused_filler[16] | |
| uint32_t | zero_fill | |
| struct keyblob_data_t |
| enum _constants |
| status_t otfad_init | ( | uint32_t | instance, |
| const uint8_t * | keyBlobs, | ||
| const otfad_kek_t * | kek | ||
| ) |
Initialize.
If OTFAD KEY in the SIM module is invalid, or the key blobs are invalid, then the OTFAD will be initialized to bypass mode (no decryption). Otherwise, keyBlobs will be unwrapped and programmed into the OTFAD context registers.
| instance | Module instance |
| keyBlobs | Pointer to array of 4 key blobs |
| kek | Pointer to OTFAD Key Encryption Key (KEK) |
| kStatus_OtfadLogicallyDisabled | OTFAD is disabled |
| kStatus_OtfadSecurityViolation | Security violation detectd |
| kStatus_Success | OTFAD has been initialized |
|
static |
Program context regiters with information from key blobs.
Key blobs are unwrapped first. Each blob is validated with CRC32.
| baseAddr | OTFAD module base address |
| keyBlobs | pointer to array of 4 key blobs |
| kek | KeK words |
|
static |
Validate CRC32 in key blob.
| keyBlob | Pointer to key blob |