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-07 21:17:45 +0000
commit6dd6292826c3a699ac84ae30cce47174948bfb85 (patch)
treef2ecc897a0900ea0440e249f48c8027813c7f339
parentbd931142b838be17046ffa091ecb7abe26226552 (diff)
downloadchrome-ec-6dd6292826c3a699ac84ae30cce47174948bfb85.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>
-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 {