mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 18:25:10 +00:00
Futility needs to link against both vboot1/vboot2.0 and vboot2.1 functions. This was easy in the past because it did (vboot1 + vboot2.1) and there's no overlap. In replacing vboot1 function calls and structs with vboot2.0, now there are symbol collisions between vboot2.0 and vboot2.1. For example, both of them use a struct called vb2_signature, but the structs are defined differently. Functions which operate on those structs also overload. Rename the vb2.1 structs to start with vb21_ instead of vb2_. Do the same for vb2.1 functions which operate on vb2.1 data. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: I24defd87cbd9ef64239faf1a8e98ab2372d27539 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/347458 Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
46 lines
1.6 KiB
C
46 lines
1.6 KiB
C
/* Copyright (c) 2014 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.
|
|
*
|
|
* Host-side misc functions for verified boot.
|
|
*/
|
|
|
|
#ifndef VBOOT_REFERENCE_UTIL_MISC_H_
|
|
#define VBOOT_REFERENCE_UTIL_MISC_H_
|
|
|
|
#include "host_key.h"
|
|
#include "vboot_struct.h"
|
|
struct rsa_st;
|
|
|
|
/* Prints the sha1sum of a VbPublicKey to stdout. */
|
|
void PrintPubKeySha1Sum(VbPublicKey *key);
|
|
|
|
/* Prints the sha1sum of a VbPrivateKey to stdout. */
|
|
void PrintPrivKeySha1Sum(VbPrivateKey *key);
|
|
|
|
/*
|
|
* Our packed RSBPublicKey buffer (historically in files ending with ".keyb",
|
|
* but also the part of VbPublicKey and struct vb21_packed_key that is
|
|
* referenced by .key_offset) has this binary format:
|
|
*
|
|
* struct {
|
|
* uint32_t nwords; // size of RSA key in 32-bit words
|
|
* uint32_t N0inv; // -1 / N[0] mod 2^32
|
|
* uint32_t modulus[nwords]; // modulus as a little endian array
|
|
* uint32_t R2[nwords]; // R^2 as little endian array
|
|
* };
|
|
*
|
|
* This function allocates and extracts that binary structure directly
|
|
* from the RSA private key, rather than from a file.
|
|
*
|
|
* @param rsa_private_key RSA private key (duh)
|
|
* @param keyb_data Pointer to newly allocated binary blob
|
|
* @param keyb_size Size of newly allocated binary blob
|
|
*
|
|
* @return 0 on success, non-zero if unable to allocate enough memory.
|
|
*/
|
|
int vb_keyb_from_rsa(struct rsa_st *rsa_private_key,
|
|
uint8_t **keyb_data, uint32_t *keyb_size);
|
|
|
|
#endif /* VBOOT_REFERENCE_UTIL_MISC_H_ */
|