mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 10:14:55 +00:00
This CL does the following: 1) It adds a SignatureBuf function which uses the OpenSSL library to generate RSA signature. This is more robust than the previous way of invoking the command line "openssl" utility and capturing its output. No more unnecessary temporary files for signature operations. 2) It adds functions that allow direct manipulation of binary verified Firmware and Kernel Image blobs in memory. 3) It changes the structure field members for FirmwareImage to make it consistent with KernelImage. Now it's clearer which key is used when. 4) Minor bug fixes and slightly improved API for dealing verified boot firmware and kernel images. 5) Renames the RSA_verify function to prevent conflicts with OpenSSL since it's linked into the firmware utility binary. Review URL: http://codereview.chromium.org/661353
36 lines
1.3 KiB
C
36 lines
1.3 KiB
C
/* 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.
|
|
*/
|
|
|
|
#ifndef VBOOT_REFERENCE_SIGNATURE_DIGEST_H_
|
|
#define VBOOT_REFERENCE_SIGNATURE_DIGEST_H_
|
|
|
|
#include <inttypes.h>
|
|
|
|
/* Returns a buffer with DigestInfo (which depends on [algorithm])
|
|
* prepended to [digest].
|
|
*/
|
|
uint8_t* prepend_digestinfo(int algorithm, uint8_t* digest);
|
|
|
|
/* Function that outputs the message digest of the contents of a buffer in a
|
|
* format that can be used as input to OpenSSL for an RSA signature.
|
|
* Needed until the stable OpenSSL release supports SHA-256/512 digests for
|
|
* RSA signatures.
|
|
*
|
|
* Returns DigestInfo || Digest where DigestInfo is the OID depending on the
|
|
* choice of the hash algorithm (see padding.c). Caller owns the returned
|
|
* pointer and must Free() it.
|
|
*/
|
|
uint8_t* SignatureDigest(const uint8_t* buf, int len, int algorithm);
|
|
|
|
/* Calculates the signature on a buffer [buf] of length [len] using
|
|
* the private RSA key file from [key_file] and signature algorithm
|
|
* [algorithm].
|
|
*
|
|
* Returns the signature. Caller owns the buffer and must Free() it.
|
|
*/
|
|
uint8_t* SignatureBuf(const uint8_t* buf, int len, const char* key_file,
|
|
int algorithm);
|
|
#endif /* VBOOT_REFERENCE_SIGNATURE_DIGEST_H_ */
|