diff options
author | Louis Collard <louiscollard@chromium.org> | 2019-08-12 15:22:29 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-21 01:44:39 +0000 |
commit | 0e11e62ce7555b87fd95a03d2a59eb803b2a3ccc (patch) | |
tree | c63077491b79ad4412425762bda97cee5632cb87 /board | |
parent | 48c3f0986efb0268f77b31ee38db78b3cef31908 (diff) | |
download | chrome-ec-0e11e62ce7555b87fd95a03d2a59eb803b2a3ccc.tar.gz |
cr50: Add vendor command to set U2F modestabilize-12441.B
The existing U2F command will be deleted, as
it is part of the legacy U2F implementation;
this command is a replacement for it.
BRANCH=none
BUG=b:138578925
TEST=run u2fd with --g2f and --u2f,
check G2F cert to verify mode is respected
Signed-off-by: Louis Collard <louiscollard@chromium.org>
Change-Id: I3956809248bb35baaaecdeef66f2fa35832aa421
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1748846
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/cr50/u2f.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/board/cr50/u2f.c b/board/cr50/u2f.c index bf0bbb8791..9ac009c7d1 100644 --- a/board/cr50/u2f.c +++ b/board/cr50/u2f.c @@ -188,6 +188,23 @@ unsigned u2f_custom_dispatch(uint8_t ins, struct apdu apdu, return U2F_SW_INS_NOT_SUPPORTED; } +static enum vendor_cmd_rc set_u2f_mode(enum vendor_cmd_cc code, void *buf, + size_t input_size, size_t *response_size) +{ + uint8_t *mode = (uint8_t *)buf; + + if (input_size != 1) + return VENDOR_RC_BOGUS_ARGS; + + u2f_mode = *mode; + + *mode = use_u2f() ? u2f_mode : 0; + *response_size = 1; + + return VENDOR_RC_SUCCESS; +} +DECLARE_VENDOR_COMMAND(VENDOR_CC_U2F_MODE, set_u2f_mode); + /* ---- chip-specific U2F crypto ---- */ static int _derive_key(enum dcrypto_appid appid, const uint32_t input[8], |