diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-07-10 15:39:12 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-07-31 12:07:37 -0700 |
commit | d6f54b711f64b42f9c4e53f5071a65bef9750f89 (patch) | |
tree | e910934a04d92f13a7c994e624f8b8ea9256de9d /include | |
parent | 143f2808ec04f3fb66b7d5821ec554f41993a7a8 (diff) | |
download | chrome-ec-d6f54b711f64b42f9c4e53f5071a65bef9750f89.tar.gz |
rollback: Add host command to add entropy
To generate a new secret, we add entropy (generated from local
HW TRNG) to the existing secret (sha256(old secret || entropy)).
This essentially re-keys the EC.
On STM32H7, erasing rollback flash block can take up to 4 seconds,
which exceeds the timeout of a normal host command. Therefore,
ADD_ENTROPY command is asynchronous (adding the entropy itself
is performed in a deferred hook), and its status must be checked
repeatedly by the host.
In some cases, it is critical that the old key is not left in
the backup rollback block(s). For this purpose, we add a special
action ADD_ENTROPY_RESET_ASYNC that adds entropy multiple times,
until all the rollback blocks have been overwritten.
BRANCH=none
BUG=b:111190988
TEST=EC> rollbackinfo
DUT> ./ectool --name=cros_fp reboot_ec RO && \
sleep 0.3 && ./ectool --name=cros_fp addentropy
EC> rollbackinfo
=> See that that a single rollback block has been overridden
TEST=Repeat with ./ectool --name=cros_fp addentropy reset
=> See that both rollback blocks have been overridden
Change-Id: I3058b0a91591fab543ba6890f7356e671016edfa
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1132826
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/ec_commands.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h index ee91c80710..f423eca0ca 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -4845,6 +4845,32 @@ struct __ec_align4 ec_response_uptime_info { uint32_t reset_time_ms; } recent_ap_reset[4]; }; + +/* + * Add entropy to the device secret (stored in the rollback region). + * + * Depending on the chip, the operation may take a long time (e.g. to erase + * flash), so the commands are asynchronous. + */ +#define EC_CMD_ADD_ENTROPY 0x0122 + +enum add_entropy_action { + /* Add entropy to the current secret. */ + ADD_ENTROPY_ASYNC = 0, + /* + * Add entropy, and also make sure that the previous secret is erased. + * (this can be implemented by adding entropy multiple times until + * all rolback blocks have been overwritten). + */ + ADD_ENTROPY_RESET_ASYNC = 1, + /* Read back result from the previous operation. */ + ADD_ENTROPY_GET_RESULT = 2, +}; + +struct __ec_align1 ec_params_rollback_add_entropy { + uint8_t action; +}; + /*****************************************************************************/ /* The command range 0x200-0x2FF is reserved for Rotor. */ |