diff options
-rw-r--r-- | include/ec_commands.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h index fe72340fb8..2000afd52a 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -4987,10 +4987,29 @@ struct __ec_align4 ec_response_fp_info { /* constants defining the 'offset' field which also contains the frame index */ #define FP_FRAME_INDEX_SHIFT 28 +/* Frame buffer where the captured image is stored */ #define FP_FRAME_INDEX_RAW_IMAGE 0 -#define FP_FRAME_TEMPLATE_INDEX(offset) ((offset) >> FP_FRAME_INDEX_SHIFT) +/* First frame buffer holding a template */ +#define FP_FRAME_INDEX_TEMPLATE 1 +#define FP_FRAME_GET_BUFFER_INDEX(offset) ((offset) >> FP_FRAME_INDEX_SHIFT) #define FP_FRAME_OFFSET_MASK 0x0FFFFFFF +/* Constants for encryption parameters */ +#define FP_CONTEXT_NONCE_BYTES 12 +#define FP_CONTEXT_USERID_WORDS (32 / sizeof(uint32_t)) +#define FP_CONTEXT_TAG_BYTES 16 +#define FP_CONTEXT_SALT_BYTES 16 + +struct ec_fp_template_encryption_metadata { + /* + * The salt is *only* ever used for key derivation. The nonce is unique, + * a different one is used for every message. + */ + uint8_t nonce[FP_CONTEXT_NONCE_BYTES]; + uint8_t salt[FP_CONTEXT_SALT_BYTES]; + uint8_t tag[FP_CONTEXT_TAG_BYTES]; +}; + struct __ec_align4 ec_params_fp_frame { /* * The offset contains the template index or FP_FRAME_INDEX_RAW_IMAGE @@ -5016,17 +5035,8 @@ struct __ec_align4 ec_params_fp_template { /* Clear the current fingerprint user context and set a new one */ #define EC_CMD_FP_CONTEXT 0x0406 -#define FP_CONTEXT_USERID_WORDS (32 / sizeof(uint32_t)) -#define FP_CONTEXT_NONCE_WORDS (32 / sizeof(uint32_t)) - struct __ec_align4 ec_params_fp_context { uint32_t userid[FP_CONTEXT_USERID_WORDS]; - /* TODO(b/73337313) mostly a placeholder, details to be implemented */ - uint32_t nonce[FP_CONTEXT_NONCE_WORDS]; -}; - -struct __ec_align4 ec_response_fp_context { - uint32_t nonce[FP_CONTEXT_NONCE_WORDS]; }; #define EC_CMD_FP_STATS 0x0407 |