aes: Add fault injection checks when writing key to hardware

Vulnerability reported by LimitedResults under Espressif Bug Bounty Program.
This commit is contained in:
Angus Gratton
2019-05-21 18:12:42 +10:00
committed by Angus Gratton
parent 16b300bd7a
commit ae8b2684d7
3 changed files with 92 additions and 24 deletions

View File

@@ -41,17 +41,13 @@ extern "C" {
/**
* \brief AES context structure
*
* \note buf is able to hold 32 extra bytes, which can be used:
* - for alignment purposes if VIA padlock is used, and/or
* - to simplify key expansion in the 256-bit case by
* generating an extra round key
*/
typedef struct {
uint8_t key_bytes;
volatile uint8_t key_in_hardware; /* This variable is used for fault injection checks, so marked volatile to avoid optimisation */
uint8_t key[32];
} esp_aes_context;
/**
* \brief The AES XTS context-type definition.
*/