diff options
author | Nicolas Norvez <norvez@chromium.org> | 2018-09-02 01:26:00 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-12-08 02:40:59 +0000 |
commit | 3c441f1c446aa840128e4446b93ecd51db260239 (patch) | |
tree | d29fac7ac40182420f659f0418a44e15701fb92d | |
parent | ee8d4acc70caee32b5515552f4266ee5e1001259 (diff) | |
download | chrome-ec-3c441f1c446aa840128e4446b93ecd51db260239.tar.gz |
fpsensor: Encrypt the FP templates with HW key
We use AES-GCM crypto to encrypt the FP templates between the AP and the
MCU.
For every single template, we generate a nonce/salt that is updated on
every template update (i.e. when the AP requests an encrypted template).
We then derive the symmetric key using HMAC-SHA256 and encrypt/decrypt
the template.
Design doc at go/cros-fp-dd
BUG=b:73337313
BRANCH=nocturne
TEST=enroll a finger, log out, log back in, unlock the device.
TEST=retrieve MQT frame on unlocked system
Change-Id: I29c66c6dc660242a423af02066f5aba671613300
Signed-off-by: Nicolas Norvez <norvez@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1194999
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/1364318
Reviewed-by: YH Lin <yueherngl@chromium.org>
Commit-Queue: YH Lin <yueherngl@chromium.org>
Tested-by: YH Lin <yueherngl@chromium.org>
-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 |