diff options
author | nagendra modadugu <ngm@google.com> | 2016-01-28 09:25:51 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-01-28 14:16:19 -0800 |
commit | 26bbc59b4629f44a93b87ed8c21e5f80699c7779 (patch) | |
tree | 854955a3e08d0fcea5d4d5e5a7dfed3ba03ae27a /chip | |
parent | d60d263b83181aee7544f6e24afa13e441a45177 (diff) | |
download | chrome-ec-26bbc59b4629f44a93b87ed8c21e5f80699c7779.tar.gz |
Fix bug in software sha256_hash()
The implementation for sha256_hash() copied
and incorrect number of bytes to the output.
This change provides a fix and a test.
TEST=added test case
BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
Change-Id: I74e98c6f5005a14dd5c0ca19ea7540622dd6c7d7
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/324391
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/g/dcrypto/sha256.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/chip/g/dcrypto/sha256.c b/chip/g/dcrypto/sha256.c index 20d813bc9d..c884ff2a4a 100644 --- a/chip/g/dcrypto/sha256.c +++ b/chip/g/dcrypto/sha256.c @@ -61,10 +61,7 @@ static const uint8_t *sha256_hash(const uint8_t *data, uint32_t len, sha256_init(&ctx); sha256_update(&ctx, data, len); - sha256_final(&ctx); - - memcpy(digest, ctx.u.sw_sha256.buf, SHA256_DIGEST_WORDS); - + memcpy(digest, sha256_final(&ctx), SHA256_DIGEST_BYTES); return digest; } |