diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-06-21 15:22:49 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-06-21 08:14:32 -0700 |
commit | b8fc9a03a8e41602469f4476a9db9e81031f2187 (patch) | |
tree | 0b5c0c3647dadb0db15bc98ae93b8d27b8b47f1e /test/sha256.c | |
parent | aef1ae66381a414a98dcba8efe55990bdd8d5324 (diff) | |
download | chrome-ec-b8fc9a03a8e41602469f4476a9db9e81031f2187.tar.gz |
test/sha256: Fix parameter to memcmp
clang spots an issue with the parameter, we really want to compare
the whole SHA256 digest.
test/sha256.c:167:33: error: 'memcmp' call operates on objects of type
'const uint8_t' (aka 'const unsigned char') while the size is based
on a different type 'const uint8_t *' (aka 'const unsigned char *')
[-Werror,-Wsizeof-pointer-memaccess]
if (memcmp(tmp, output, sizeof(output)) != 0) {
~~~~~~ ^~~~~~
test/sha256.c:167:33: note: did you mean to provide an explicit length?
if (memcmp(tmp, output, sizeof(output)) != 0) {
BRANCH=none
BUG=chromium:854924
TEST=make CC=clang run-sha256 -j
Change-Id: I7ca875a3981f987b60d62a12be7a4ca8b870b376
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1109659
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'test/sha256.c')
-rw-r--r-- | test/sha256.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/sha256.c b/test/sha256.c index 9bb99bb6ab..6af3fb1343 100644 --- a/test/sha256.c +++ b/test/sha256.c @@ -164,7 +164,7 @@ static int test_hmac(const uint8_t *key, int key_len, hmac_SHA256(tmp, key, key_len, input, input_len); - if (memcmp(tmp, output, sizeof(output)) != 0) { + if (memcmp(tmp, output, SHA256_DIGEST_SIZE) != 0) { ccprintf("hmac_SHA256 test failed\n"); return 0; } |