mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 10:14:55 +00:00
This is a first cut at what I envision as a utility we can use to manage our firmware/kernel signing needs. Currently, it implements firmware signing (given a binary image, create a verified boot header) and verification (given a verified boot image, verify it using the given public root key). This CL also fixes the ReadFirmwareImage function from firmware_image to make it more consistent and fixes some bugs. Review URL: http://codereview.chromium.org/652216
38 lines
1.1 KiB
C
38 lines
1.1 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.
|
|
*
|
|
* Utility functions for file and key handling.
|
|
*/
|
|
|
|
#ifndef VBOOT_REFERENCE_FILE_KEYS_H_
|
|
#define VBOOT_REFERENCE_FILE_KEYS_H_
|
|
|
|
#include "rsa.h"
|
|
|
|
/* Read file named [input_file] into a buffer and stores the length into
|
|
* [len].
|
|
*
|
|
* Returns a pointer to the buffer. Caller owns the returned pointer and
|
|
* must free it.
|
|
*/
|
|
uint8_t* BufferFromFile(const char* input_file, uint32_t* len);
|
|
|
|
/* Read a pre-processed RSA Public Key from file [input_file].
|
|
*
|
|
* Returns a pointer to the read key. Caller owns the returned pointer and
|
|
* must free it.
|
|
*/
|
|
RSAPublicKey* RSAPublicKeyFromFile(const char* input_file);
|
|
|
|
/* Helper function to invoke external program to calculate signature on
|
|
* [input_file] using private key [key_file] and signature algorithm
|
|
* [algorithm].
|
|
*
|
|
* Returns the signature. Caller owns the buffer and must Free() it.
|
|
*/
|
|
uint8_t* SignatureFile(const char* input_fie, const char* key_file,
|
|
int algorithm);
|
|
|
|
#endif /* VBOOT_REFERENCE_FILE_KEYS_H_ */
|