The AES-GCM also supports the rolling keys feature, where the entire encrypted image is represented in terms of smaller AES encrypted blocks/modules. Each module is encrypted using its own unique key. The initial key is stored at the key source on the device, while keys for each successive module are encrypted (wrapped) in the previous module. The boot images with rolling keys can be generated using Bootgen. The BIF attribute blocks is used to specify the pattern to create multiple smaller blocks for encryption.
image:
{
[keysrc_encryption] bbram_red_key
[
bootloader,
destination_cpu = a53-0,
encryption = aes,
aeskeyfile = aes_p1.nky,
blocks = 1024(2);2048;4096(2);8192(2);4096;2048;1024
] fsbl.elf
[
destination_cpu = a53-3,
encryption = aes,
aeskeyfile = aes_p2.nky,
blocks = 4096(1);1024
] hello.elf
}
Note:
- Number of keys in the key file should always be equal to the
number of blocks to be encrypted.
- If the number of keys are less than the number of blocks to be encrypted, Bootgen returns an error.
- If the number of keys are more than the number of blocks to be encrypted, Bootgen ignores (does not read) the extra keys.
- If you want to specify multiple Key/IV Pairs, you should specify
no. of blocks + 1
pairs- The extra Key/IV pair is to encrypt the secure header.
- No Key/IV pair should be repeated in a any of the aes key files given in a single bif except the Key0 and IV0.