3.2 Authentication
An important feature of secure boot systems is the ability to verify that the image being booted is from a trusted source and has not been tampered with or corrupted. Authentication and integrity are achieved by appending a Message Authentication Code (MAC) or an RSA signature to the end of an image. Appending a MAC to an image is also informally referred to as “signing” the image. The ROM code checks the signature of the at91bootstrap program to ensure that it is authentic. In turn, the at91bootstrap program verifies the signature of U-Boot to confirm its authenticity. U-Boot then verifies the signatures of the Linux® image, the Linux Device Tree and the root filesystem.
A MAC can be created using several methods. Two common methods are Hash-based Message Authentication Code (HMAC) and Cipher-based Message Authentication Code (CMAC). SAM9X7 Series MPUs use either the AES-CMAC algorithm or an RSA + SHA-256 HMAC to perform this verification. The at91bootstrap program uses AES-CMAC to authenticate U-Boot.
