OLD | NEW |
(Empty) | |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. |
| 4 * |
| 5 * Host-side functions for verified boot. |
| 6 */ |
| 7 |
| 8 #ifndef VBOOT_REFERENCE_HOST_SIGNATURE_H_ |
| 9 #define VBOOT_REFERENCE_HOST_SIGNATURE_H_ |
| 10 |
| 11 #include <stdint.h> |
| 12 |
| 13 #include "cryptolib.h" |
| 14 #include "host_key.h" |
| 15 #include "utility.h" |
| 16 #include "vboot_struct.h" |
| 17 |
| 18 |
| 19 /* Initialize a signature struct. */ |
| 20 void SignatureInit(VbSignature* sig, uint8_t* sig_data, |
| 21 uint64_t sig_size, uint64_t data_size); |
| 22 |
| 23 |
| 24 /* Allocate a new signature with space for a [sig_size] byte signature. */ |
| 25 VbSignature* SignatureAlloc(uint64_t sig_size, uint64_t data_size); |
| 26 |
| 27 |
| 28 /* Copy a signature key from [src] to [dest]. |
| 29 * |
| 30 * Returns 0 if success, non-zero if error. */ |
| 31 int SignatureCopy(VbSignature* dest, const VbSignature* src); |
| 32 |
| 33 |
| 34 /* Calculates a SHA-512 checksum. |
| 35 * Caller owns the returned pointer, and must free it with Free(). |
| 36 * |
| 37 * Returns NULL if error. */ |
| 38 VbSignature* CalculateChecksum(const uint8_t* data, uint64_t size); |
| 39 |
| 40 |
| 41 /* Calculates a signature for the data using the specified key. |
| 42 * Caller owns the returned pointer, and must free it with Free(). |
| 43 * |
| 44 * Returns NULL if error. */ |
| 45 VbSignature* CalculateSignature(const uint8_t* data, uint64_t size, |
| 46 const VbPrivateKey* key); |
| 47 |
| 48 #endif /* VBOOT_REFERENCE_HOST_SIGNATURE_H_ */ |
OLD | NEW |