![]() |
Kinetis Bootloader Host
2.0.0
Host Tools for Kinetis devices
|
Keyblob specification. More...
#include <Keyblob.h>
Collaboration diagram for elftosb::Keyblob:Public Types | |
| enum | _encryption_constants { k_encryptBlockSize = 16, k_qspiAlignlength } |
| Constants for encryption. More... | |
| typedef std::vector< OptionContext * > | option_vector_t |
| List of options entries. | |
Public Member Functions | |
| Keyblob (uint32_t identifier) | |
| void | setIdentifier (uint32_t identifier) |
| uint32_t | getIdentifier () const |
| void | addOptions (OptionContext *context) |
| Add options. | |
| option_vector_t * | getOptions () |
| Return options vector. | |
| uint8_t * | createWrappedKeyblobData (uint8_t *kek, uint32_t *byteCount) |
| Create and wrap keyblob data based on options. More... | |
| bool | encryptMatchingRange (uint32_t start, uint32_t len, uint8_t *data) |
| Encrypt for OTFAD if range is within a keyblob entry range. More... | |
Static Public Member Functions | |
| static uint32_t | getKekSizeBytes () |
Protected Types | |
| enum | _keywrap_constants { kKeySizeBits = 128, kExpandedKekSizeInts = 64, kNumKeyBlobs = 4, kKeyBlobSizeBytes = 64, kOutputLineSize = 16, kRegionAddrMask = (0x400 - 1), kFlagMask = 0x07, kKeyFlags = 0x03, kAesKeySizeBytes = 16, kCtrSizeBytes = 8, kKekSizeBytes = 16, kNumKeyChars = 32, kNumCtrChars = 16, kCrc32SizeBytes = 32 } |
| Keywrap constants. More... | |
Protected Member Functions | |
| void | populateKeyBlob (keyblob_t *blob, uint32_t start, uint32_t end, const char *keyHex, const char *counterHex) |
| void | encrypt (uint32_t length, uint8_t *data, AESKey< 128 > *key, AESCounter< 128 > *counter) |
| bool | getOptionValues (OptionContext &opt, const char **key, const char **ctr, uint32_t *start, uint32_t *end) |
Protected Attributes | |
| uint32_t | m_id |
| Unique identifier. | |
| option_vector_t | m_options |
| List of option entries. | |
Keyblob specification.
|
protected |
Keywrap constants.
| Enumerator | |
|---|---|
| kKeySizeBits |
AES-128. |
| kExpandedKekSizeInts |
Expanded KeK size. |
| kNumKeyBlobs |
Number of key blobs. |
| kKeyBlobSizeBytes |
Key blob size in bytes. |
| kOutputLineSize |
Number of bytes per output line. |
| kRegionAddrMask |
Region addresses are modulo 1024. |
| kFlagMask |
Key flags mask. |
| kKeyFlags |
Default flags: RO=0, ADE=1, VLD=1. |
| kAesKeySizeBytes |
Number of bytes in AES-128 key. |
| kCtrSizeBytes |
Number of bytes in Ctr. |
| kKekSizeBytes |
Number of bytes in KeK. |
| kNumKeyChars |
Number of characters in key string. |
| kNumCtrChars |
Number of characters in ctr string. |
| kCrc32SizeBytes |
Number of bytes covered by CRC32. |
| uint8_t * Keyblob::createWrappedKeyblobData | ( | uint8_t * | kek, |
| uint32_t * | byteCount | ||
| ) |
Create and wrap keyblob data based on options.
| Pointer | to new wrapped data (caller must delete) |
| Number | of bytes in wrapped data |
| bool Keyblob::encryptMatchingRange | ( | uint32_t | start, |
| uint32_t | len, | ||
| uint8_t * | data | ||
| ) |
Encrypt for OTFAD if range is within a keyblob entry range.
len must be a multiple of k_qspiAlignlength, which is also a multiple of k_encryptBlockSize.
| True | if data was encrypted (range matched) |