mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-26 19:25:02 +00:00
Port vboot_reference to use new wrapper API utility functions
Third time's the charm. Now that we've moved to u-boot-next, this won't break the ARM build. BUG=chromium-os:17006 TEST=make && make runtests; emerge vboot_reference; emerge-tegra2_seaboard chromeos-bootimage Change-Id: Ib4fa26c7a23868dd2ffd2b321ee8dc08c66ea322 Original-Change-Id: I771085dcdf79d9592de64f35e3b758111a80dd9f Original-Reviewed-on: http://gerrit.chromium.org/gerrit/3263 Original-Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/3803 Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||
/* Copyright (c) 2011 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,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "cryptolib.h"
|
||||
#include "vboot_api.h"
|
||||
#include "utility.h"
|
||||
|
||||
/* a[] -= mod */
|
||||
@@ -77,9 +78,9 @@ static void montMul(const RSAPublicKey *key,
|
||||
*/
|
||||
static void modpowF4(const RSAPublicKey *key,
|
||||
uint8_t* inout) {
|
||||
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* 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* aaa = aaR; /* Re-use location. */
|
||||
int i;
|
||||
@@ -116,9 +117,9 @@ static void modpowF4(const RSAPublicKey *key,
|
||||
*inout++ = (uint8_t)(tmp >> 0);
|
||||
}
|
||||
|
||||
Free(a);
|
||||
Free(aR);
|
||||
Free(aaR);
|
||||
VbExFree(a);
|
||||
VbExFree(aR);
|
||||
VbExFree(aaR);
|
||||
}
|
||||
|
||||
/* Verify a RSA PKCS1.5 signature against an expected hash.
|
||||
@@ -152,7 +153,7 @@ int RSAVerify(const RSAPublicKey *key,
|
||||
return 0;
|
||||
}
|
||||
|
||||
buf = (uint8_t*) Malloc(sig_len);
|
||||
buf = (uint8_t*) VbExMalloc(sig_len);
|
||||
if (!buf)
|
||||
return 0;
|
||||
Memcpy(buf, sig, sig_len);
|
||||
@@ -177,7 +178,7 @@ int RSAVerify(const RSAPublicKey *key,
|
||||
VBDEBUG(("In RSAVerify(): Hash check failed!\n"));
|
||||
success = 0;
|
||||
}
|
||||
Free(buf);
|
||||
VbExFree(buf);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user