RSAVerify() - fail on malloc() failure.
BUG=chrome-os-partner:702
TEST=exists RSA verification tests still pass
Review URL: http://codereview.chromium.org/3127013
diff --git a/firmware/lib/cryptolib/rsa.c b/firmware/lib/cryptolib/rsa.c
index 51fed77..adc0dc0 100644
--- a/firmware/lib/cryptolib/rsa.c
+++ b/firmware/lib/cryptolib/rsa.c
@@ -150,6 +150,8 @@
}
buf = (uint8_t*) Malloc(sig_len);
+ if (!buf)
+ return 0;
Memcpy(buf, sig, sig_len);
modpowF4(key, buf);
@@ -161,7 +163,6 @@
for (i = 0; i < padding_size_map[sig_type]; ++i) {
if (buf[i] != padding[i]) {
#ifndef NDEBUG
-/* TODO(gauravsh): Replace with a macro call for logging. */
VBDEBUG(("Padding: Expecting = %02x Got = %02x\n", padding[i], buf[i]));
#endif
success = 0;
@@ -172,7 +173,6 @@
for (; i < (int)sig_len; ++i) {
if (buf[i] != *hash++) {
#ifndef NDEBUG
-/* TODO(gauravsh): Replace with a macro call for logging. */
VBDEBUG(("Digest: Expecting = %02x Got = %02x\n", padding[i], buf[i]));
#endif
success = 0;