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

Unified Diff: src/platform/vboot_reference/crypto/rsa_utility.c

Issue 1519008: VBoot Reference: 18 Exabytes ought to be enough for everybody (Closed)
Patch Set: Use symbolic constants. Created 10 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
Index: src/platform/vboot_reference/crypto/rsa_utility.c
diff --git a/src/platform/vboot_reference/crypto/rsa_utility.c b/src/platform/vboot_reference/crypto/rsa_utility.c
index 3559dfde30c0f1bd9470c64383c89cda7028bf45..5ac2db4b628fc0c12831af92da883f3816f48112 100644
--- a/src/platform/vboot_reference/crypto/rsa_utility.c
+++ b/src/platform/vboot_reference/crypto/rsa_utility.c
@@ -42,6 +42,8 @@ RSAPublicKey* RSAPublicKeyFromBuf(const uint8_t* buf, int len) {
st.remaining_buf = (uint8_t*) buf;
st.remaining_len = len;
+ st.overrun = 0;
+
StatefulMemcpy(&st, &key->len, sizeof(key->len));
key_len = key->len * sizeof(uint32_t); /* key length in bytes. */
@@ -60,7 +62,7 @@ RSAPublicKey* RSAPublicKeyFromBuf(const uint8_t* buf, int len) {
StatefulMemcpy(&st, &key->n0inv, sizeof(key->n0inv));
StatefulMemcpy(&st, key->n, key_len);
StatefulMemcpy(&st, key->rr, key_len);
- if (st.remaining_len != 0) { /* Underrun or overrun. */
+ if (st.overrun || st.remaining_len != 0) { /* Underrun or overrun. */
RSAPublicKeyFree(key);
return NULL;
}
@@ -71,7 +73,7 @@ RSAPublicKey* RSAPublicKeyFromBuf(const uint8_t* buf, int len) {
int RSAVerifyBinary_f(const uint8_t* key_blob,
const RSAPublicKey* key,
const uint8_t* buf,
- int len,
+ uint64_t len,
const uint8_t* sig,
int algorithm) {
RSAPublicKey* verification_key = NULL;
« no previous file with comments | « src/platform/vboot_reference/common/utility_stub.c ('k') | src/platform/vboot_reference/include/firmware_image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698