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

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

Issue 3136017: Add additional sanity checks to RSA verification code. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: Created 10 years, 4 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 | « firmware/lib/cryptolib/include/rsa.h ('k') | firmware/lib/cryptolib/rsa_utility.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firmware/lib/cryptolib/rsa.c
diff --git a/firmware/lib/cryptolib/rsa.c b/firmware/lib/cryptolib/rsa.c
index adc0dc0513fccd8a386a5cfa3549552d447add34..bad01d835d775c541de5ee1d631288d157aa8757 100644
--- a/firmware/lib/cryptolib/rsa.c
+++ b/firmware/lib/cryptolib/rsa.c
@@ -134,6 +134,9 @@ int RSAVerify(const RSAPublicKey *key,
const uint8_t* padding;
int success = 1;
+ if (!key || !sig || !hash)
+ return 0;
+
if (sig_len != (key->len * sizeof(uint32_t))) {
VBDEBUG(("Signature is of incorrect length!\n"));
return 0;
« no previous file with comments | « firmware/lib/cryptolib/include/rsa.h ('k') | firmware/lib/cryptolib/rsa_utility.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698