mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 18:25:10 +00:00
This allows signing using a .pem file using an external program.
It is assumed that the external program reads input from stdin, and outputs signed data on stdout. It takes one argument - the file name for the .pem private key reference. See external_rsa_signer.sh for an example external program.
Example usage:
vbutil_keyblock --pack 4096.keyblock \
--datapubkey 4096.vbpubk \
--signprivate_pem 4096.pem \
--pem_algorithm 8 \
--externalsigner "external_rsa_signer.sh"
I have tried to make the change such that it doesn't impact existing tools/interfaces (since these are used at various places). That said, I am aware of the places where we could just extend an old interface an avoid code duplication but thought I'd put that re-factoring in as a TODO for now. Let me know if you disagree and I can merge them (and changing the existing interface).
BUG=7576
TEST=Extended run_vbutil_tests.sh to test vbutil_keyblock packing using an external signer.
To test, make && make runtests (or just run tests/gen_test_keys.sh; tests/run_vbutils_tests.sh)
Review URL: http://codereview.chromium.org/4194003
Change-Id: I7cc52c8293c04ef9ba074794d046c9a4f19f6bdd
57 lines
1.8 KiB
C
57 lines
1.8 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.
|
|
*
|
|
* Host-side functions for verified boot.
|
|
*/
|
|
|
|
#ifndef VBOOT_REFERENCE_HOST_SIGNATURE_H_
|
|
#define VBOOT_REFERENCE_HOST_SIGNATURE_H_
|
|
|
|
#include "cryptolib.h"
|
|
#include "host_key.h"
|
|
#include "utility.h"
|
|
#include "vboot_struct.h"
|
|
|
|
|
|
/* Initialize a signature struct. */
|
|
void SignatureInit(VbSignature* sig, uint8_t* sig_data,
|
|
uint64_t sig_size, uint64_t data_size);
|
|
|
|
|
|
/* Allocate a new signature with space for a [sig_size] byte signature. */
|
|
VbSignature* SignatureAlloc(uint64_t sig_size, uint64_t data_size);
|
|
|
|
|
|
/* Copy a signature key from [src] to [dest].
|
|
*
|
|
* Returns 0 if success, non-zero if error. */
|
|
int SignatureCopy(VbSignature* dest, const VbSignature* src);
|
|
|
|
|
|
/* Calculates a SHA-512 checksum.
|
|
* Caller owns the returned pointer, and must free it with Free().
|
|
*
|
|
* Returns NULL on error. */
|
|
VbSignature* CalculateChecksum(const uint8_t* data, uint64_t size);
|
|
|
|
|
|
/* Calculates a signature for the data using the specified key.
|
|
* Caller owns the returned pointer, and must free it with Free().
|
|
*
|
|
* Returns NULL on error. */
|
|
VbSignature* CalculateSignature(const uint8_t* data, uint64_t size,
|
|
const VbPrivateKey* key);
|
|
|
|
/* Calculates a signature for the data using the specified key and
|
|
* an external program.
|
|
* Caller owns the returned pointer, and must free it with Free().
|
|
*
|
|
* Returns NULL on error. */
|
|
VbSignature* CalculateSignature_external(const uint8_t* data, uint64_t size,
|
|
const char* key_file,
|
|
uint64_t key_algorithm,
|
|
const char* external_signer);
|
|
|
|
#endif /* VBOOT_REFERENCE_HOST_SIGNATURE_H_ */
|