AES-GCM Usage to decrypt Boot Image - 2021.1 English

Xilinx Standalone Library Documentation OS and Libraries Document Collection (UG643)

Document ID
Release Date
2021.1 English

The Multiple key(Key Rolling) or Single key encrypted images will have the same format. The images include:

  • Secure header - This includes the dummy AES key of 32byte + Block 0 IV of 12byte + DLC for Block 0 of 4byte + GCM tag of 16byte(Un-Enc).
  • Block N - This includes the boot image data for the block N of n size + Block N+1 AES key of 32byte + Block N+1 IV of 12byte + GCM tag for Block N of 16byte(Un-Enc).

The Secure header and Block 0 will be decrypted using the device key or user provided key. If more than one block is found then the key and the IV obtained from previous block will be used for decryption.

Following are the instructions to decrypt an image:

  1. Read the first 64 bytes and decrypt 48 bytes using the selected Device key.
  2. Decrypt Block 0 using the IV + Size and the selected Device key.
  3. After decryption, you will get the decrypted data+KEY+IV+Block Size. Store the KEY/IV into KUP/IV registers.
  4. Using Block size, IV and the next Block key information, start decrypting the next block.
  5. If the current image size is greater than the total image length, perform the next step. Else, go back to the previous step.
  6. If there are failures, an error code is returned. Else, the decryption is successful.