Revert "Verified boot wrapper - replace utility functions"

This reverts commit bd81b3a7d3.

Change-Id: I2be2c076a37bf0e49569248691fceac417254f0b
Reviewed-on: http://gerrit.chromium.org/gerrit/3295
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
This commit is contained in:
mukesh agrawal
2011-06-27 20:00:52 -07:00
parent 1c1a883bc7
commit a7b9481f34
15 changed files with 137 additions and 83 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,6 @@
*/
#include "cryptolib.h"
#include "vboot_api.h"
#include "utility.h"
/* a[] -= mod */
@@ -78,9 +77,9 @@ static void montMul(const RSAPublicKey *key,
*/
static void modpowF4(const RSAPublicKey *key,
uint8_t* inout) {
uint32_t* a = (uint32_t*) VbExMalloc(key->len * sizeof(uint32_t));
uint32_t* aR = (uint32_t*) VbExMalloc(key->len * sizeof(uint32_t));
uint32_t* aaR = (uint32_t*) VbExMalloc(key->len * sizeof(uint32_t));
uint32_t* a = (uint32_t*) Malloc(key->len * sizeof(uint32_t));
uint32_t* aR = (uint32_t*) Malloc(key->len * sizeof(uint32_t));
uint32_t* aaR = (uint32_t*) Malloc(key->len * sizeof(uint32_t));
uint32_t* aaa = aaR; /* Re-use location. */
int i;
@@ -117,9 +116,9 @@ static void modpowF4(const RSAPublicKey *key,
*inout++ = (uint8_t)(tmp >> 0);
}
VbExFree(a);
VbExFree(aR);
VbExFree(aaR);
Free(a);
Free(aR);
Free(aaR);
}
/* Verify a RSA PKCS1.5 signature against an expected hash.
@@ -153,7 +152,7 @@ int RSAVerify(const RSAPublicKey *key,
return 0;
}
buf = (uint8_t*) VbExMalloc(sig_len);
buf = (uint8_t*) Malloc(sig_len);
if (!buf)
return 0;
Memcpy(buf, sig, sig_len);
@@ -178,7 +177,7 @@ int RSAVerify(const RSAPublicKey *key,
VBDEBUG(("In RSAVerify(): Hash check failed!\n"));
success = 0;
}
VbExFree(buf);
Free(buf);
return success;
}