Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: firmware/lib/cryptolib/sha2.c

Issue 6750016: Make SHA256_update and SHA512_update if the passed in length is greater than UINT32_MAX (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firmware/lib/cryptolib/sha2.c
diff --git a/firmware/lib/cryptolib/sha2.c b/firmware/lib/cryptolib/sha2.c
index aa2691766d08c834db81c6f461a8196fea70a1db..696b4e78d39a5f5281386075e389d692b0faeec7 100644
--- a/firmware/lib/cryptolib/sha2.c
+++ b/firmware/lib/cryptolib/sha2.c
@@ -337,6 +337,9 @@ void SHA256_update(SHA256_CTX* ctx, const uint8_t* data, uint64_t len) {
unsigned int new_len, rem_len, tmp_len;
const uint8_t *shifted_data;
+ if (len > UINT32_MAX)
+ return;
+
tmp_len = SHA256_BLOCK_SIZE - ctx->len;
rem_len = len < tmp_len ? (unsigned int)len : tmp_len;
@@ -525,6 +528,9 @@ void SHA512_update(SHA512_CTX* ctx, const uint8_t* data,
unsigned int new_len, rem_len, tmp_len;
const uint8_t* shifted_data;
+ if (len > UINT32_MAX)
+ return;
+
tmp_len = SHA512_BLOCK_SIZE - ctx->len;
rem_len = len < tmp_len ? (unsigned int)len : tmp_len;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698