mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-27 03:33:50 +00:00
RSAVerify() - fail on malloc() failure.
BUG=chrome-os-partner:702 TEST=exists RSA verification tests still pass Review URL: http://codereview.chromium.org/3127013
This commit is contained in:
@@ -150,6 +150,8 @@ int RSAVerify(const RSAPublicKey *key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf = (uint8_t*) Malloc(sig_len);
|
buf = (uint8_t*) Malloc(sig_len);
|
||||||
|
if (!buf)
|
||||||
|
return 0;
|
||||||
Memcpy(buf, sig, sig_len);
|
Memcpy(buf, sig, sig_len);
|
||||||
|
|
||||||
modpowF4(key, buf);
|
modpowF4(key, buf);
|
||||||
@@ -161,7 +163,6 @@ int RSAVerify(const RSAPublicKey *key,
|
|||||||
for (i = 0; i < padding_size_map[sig_type]; ++i) {
|
for (i = 0; i < padding_size_map[sig_type]; ++i) {
|
||||||
if (buf[i] != padding[i]) {
|
if (buf[i] != padding[i]) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
/* TODO(gauravsh): Replace with a macro call for logging. */
|
|
||||||
VBDEBUG(("Padding: Expecting = %02x Got = %02x\n", padding[i], buf[i]));
|
VBDEBUG(("Padding: Expecting = %02x Got = %02x\n", padding[i], buf[i]));
|
||||||
#endif
|
#endif
|
||||||
success = 0;
|
success = 0;
|
||||||
@@ -172,7 +173,6 @@ int RSAVerify(const RSAPublicKey *key,
|
|||||||
for (; i < (int)sig_len; ++i) {
|
for (; i < (int)sig_len; ++i) {
|
||||||
if (buf[i] != *hash++) {
|
if (buf[i] != *hash++) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
/* TODO(gauravsh): Replace with a macro call for logging. */
|
|
||||||
VBDEBUG(("Digest: Expecting = %02x Got = %02x\n", padding[i], buf[i]));
|
VBDEBUG(("Digest: Expecting = %02x Got = %02x\n", padding[i], buf[i]));
|
||||||
#endif
|
#endif
|
||||||
success = 0;
|
success = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user