summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Yang <hcyang@google.com>2022-11-07 10:58:15 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-15 19:31:17 +0000
commit39046d81904b487b696a485fc34a4842d4de7a12 (patch)
treecac194bc01f01bc4b9c4b00007ad17a64062b1a2
parent3bed9c8f3c6cc506f8d81ca5217e43ecc75a40ad (diff)
downloadchrome-ec-39046d81904b487b696a485fc34a4842d4de7a12.tar.gz
u2f: Fix some constant usage
The size of auth_time_secret_hash should be SHA256_DIGEST_SIZE, not U2F_AUTH_TIME_SECRET_SIZE, though they are the same now. This will make the userland check more consistent with the actual constants used in the header. Also, the CORP_SALT_SIZE is defined incorrectly and never used, fix it to the correct value and use it in the struct field size. BUG=None TEST=make buildall -j Change-Id: I22dcf2cfd46819475ca916e0b0c3dcd5b3369b19 Signed-off-by: Howard Yang <hcyang@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4007998 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> (cherry picked from commit 6dd6292826c3a699ac84ae30cce47174948bfb85) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4011461 Commit-Queue: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit bf6e858867d7af135e66a31c11878a0460bfc28d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4028677
-rw-r--r--include/u2f.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/u2f.h b/include/u2f.h
index 6e7c3e5d5e..2770eb885d 100644
--- a/include/u2f.h
+++ b/include/u2f.h
@@ -48,7 +48,7 @@ extern "C" {
#define U2F_MESSAGE_DIGEST_SIZE SHA256_DIGEST_SIZE
#define CORP_CHAL_SIZE 16
-#define CORP_SALT_SIZE 16
+#define CORP_SALT_SIZE 65
#define ENC_SIZE(x) ((x + 7) & 0xfff8)
@@ -179,7 +179,7 @@ struct u2f_generate_req {
* If generating versioned KH, derive an hmac from it and append to
* the key handle. Otherwise unused.
*/
- uint8_t authTimeSecretHash[U2F_AUTH_TIME_SECRET_SIZE];
+ uint8_t authTimeSecretHash[SHA256_DIGEST_SIZE];
};
struct u2f_generate_resp {
@@ -268,7 +268,7 @@ struct g2f_register_msg_v0 {
struct corp_attest_data {
uint8_t challenge[CORP_CHAL_SIZE];
struct u2f_ec_point public_key;
- uint8_t salt[65];
+ uint8_t salt[CORP_SALT_SIZE];
};
struct corp_register_msg_v0 {