2.3 Encryption and Decryption
Data privacy is enforced using encryption. The data is processed using a cryptographic algorithm along with an encryption key, generating a cipher text that is different from the (plain) original one. Without the required decryption key, the data will look as complete nonsense, preventing anyone unauthorized from reading it.
In practice, a private-key algorithm is used to generate the encrypted firmware. A public-key system cannot be used, as the firmware would then be decipherable by anyone. Therefore, the encryption and decryption keys are identical and shared between the bootloader and the host.
The code encryption does not solve every security issue all by itself. For example, the firmware might still be modified, even if it is pretty difficult. An attacker could manage to pinpoint the location in the code of a significant variable and tweak it until the attacker gets the desired result.
An authentication tag, known as a MAC tag, is a small piece of data appended to a message to verify its integrity and authenticity. It ensures that the message has not been tampered with and truly originates from the claimed source.
Authentication tags integrate naturally with encryption, especially in systems using symmetric encryption algorithms. Because both encryption and authentication can rely on the same underlying algorithm, this not only reduces code size but simplifies implementation. Secure encryption modes, such as AES-GCM (Galois/Counter Mode), combine both processes efficiently, using a single key and cipher to provide confidentiality and integrity in one unified operation.