vboot: fix name-collision with OpenSSL.

vboot currently uses the |SHA256_CTX| name, which is claimed by OpenSSL.
To work around this, it defines OPENSSL_NO_SHA, but that can't be done
at compile time:

The OPENSSL_NO_* defines are set by OpenSSL to reflect the configuration
that it was built with so that users of OpenSSL can disable features as
needed. They can affect the contents of structures any thus the ABI of
the library.

If these defines are set outside of OpenSSL, then the library and the
code that uses it will have incompatible ABIs. At that point it's only
functioning by blind luck.

This change renames the name-collisions so that this hack isn't needed.
This is the same change as was made internally in cl/85758149.

BUG=none
BRANCH=none
TEST=emerge-samus coreboot; make runtests

Change-Id: I709da2507f341896d89d50129ce30ffb111a20d1
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/263506
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Adam Langley
2015-04-01 11:29:03 -07:00
committed by ChromeOS Commit Bot
parent b5a439241f
commit 9978e0aa00
13 changed files with 26 additions and 33 deletions

View File

@@ -151,7 +151,7 @@ static const uint64_t sha512_k[80] = {
/* SHA-512 implementation */
void SHA512_init(SHA512_CTX *ctx) {
void SHA512_init(VB_SHA512_CTX *ctx) {
#ifdef UNROLL_LOOPS_SHA512
ctx->h[0] = sha512_h0[0]; ctx->h[1] = sha512_h0[1];
ctx->h[2] = sha512_h0[2]; ctx->h[3] = sha512_h0[3];
@@ -169,7 +169,7 @@ void SHA512_init(SHA512_CTX *ctx) {
}
static void SHA512_transform(SHA512_CTX* ctx, const uint8_t* message,
static void SHA512_transform(VB_SHA512_CTX* ctx, const uint8_t* message,
unsigned int block_nb) {
uint64_t w[80];
uint64_t wv[8];
@@ -263,7 +263,7 @@ static void SHA512_transform(SHA512_CTX* ctx, const uint8_t* message,
}
void SHA512_update(SHA512_CTX* ctx, const uint8_t* data,
void SHA512_update(VB_SHA512_CTX* ctx, const uint8_t* data,
uint32_t len) {
unsigned int block_nb;
unsigned int new_len, rem_len, tmp_len;
@@ -296,7 +296,7 @@ void SHA512_update(SHA512_CTX* ctx, const uint8_t* data,
ctx->tot_len += (block_nb + 1) << 7;
}
uint8_t* SHA512_final(SHA512_CTX* ctx)
uint8_t* SHA512_final(VB_SHA512_CTX* ctx)
{
unsigned int block_nb;
unsigned int pm_len;
@@ -341,7 +341,7 @@ uint8_t* internal_SHA512(const uint8_t* data, uint64_t len, uint8_t* digest) {
const uint8_t* result;
uint64_t remaining_len;
int i;
SHA512_CTX ctx;
VB_SHA512_CTX ctx;
SHA512_init(&ctx);
input_ptr = data;