Files
OpenCellular/misclibs/include/signature_digest.h
Gaurav Shah fc70d72aaa VBoot Reference: Refactoring Part 3
Refactor and restructure reference code into individual self-contain modules. I have revamped the way the code is structured to make it easy to determine which parts belong in the firmware and which are used by userland tools.

common/ - common utilities and stub functions (Firmware)
cryptolib/ - crypto library (Firmware)
misclibs/ - miscellaneous userland libraries (Userland)
sctips/ - Miscellaenous scripts (Userland)
tests/ - Tests (Userland)
vfirmware/ - Verified Firmware Implementation
vfirmware/firmware_image_fw.c (Firmware)
vfirmware/firmware_image.c (Userland)

vkernel/ - Verified Kernel Implementation
vkernel/kernel_image_fw.c (Firmware)
vkernel/kernel_image.c (Userland)

Review URL: http://codereview.chromium.org/1581005
2010-03-31 13:26:55 -07:00

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, uint64_t 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, uint64_t len, const char* key_file,
int algorithm);
#endif /* VBOOT_REFERENCE_SIGNATURE_DIGEST_H_ */