| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 * | 4 * |
| 5 * Common functions between firmware and kernel verified boot. | 5 * Common functions between firmware and kernel verified boot. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef VBOOT_REFERENCE_VBOOT_COMMON_H_ | 8 #ifndef VBOOT_REFERENCE_VBOOT_COMMON_H_ |
| 9 #define VBOOT_REFERENCE_VBOOT_COMMON_H_ | 9 #define VBOOT_REFERENCE_VBOOT_COMMON_H_ |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 uint64_t member_data_offset, | 48 uint64_t member_data_offset, |
| 49 uint64_t member_data_size); | 49 uint64_t member_data_size); |
| 50 | 50 |
| 51 int VerifyPublicKeyInside(const void* parent, uint64_t parent_size, | 51 int VerifyPublicKeyInside(const void* parent, uint64_t parent_size, |
| 52 const VbPublicKey* key); | 52 const VbPublicKey* key); |
| 53 | 53 |
| 54 int VerifySignatureInside(const void* parent, uint64_t parent_size, | 54 int VerifySignatureInside(const void* parent, uint64_t parent_size, |
| 55 const VbSignature* sig); | 55 const VbSignature* sig); |
| 56 | 56 |
| 57 | 57 |
| 58 /* Initialize a public key to refer to [key_data]. */ |
| 59 void PublicKeyInit(VbPublicKey* key, uint8_t* key_data, uint64_t key_size); |
| 60 |
| 61 |
| 62 /* Copy a public key from [src] to [dest]. |
| 63 * |
| 64 * Returns 0 if success, non-zero if error. */ |
| 65 int PublicKeyCopy(VbPublicKey* dest, const VbPublicKey* src); |
| 66 |
| 67 |
| 58 /* Converts a public key to RsaPublicKey format. The returned key must | 68 /* Converts a public key to RsaPublicKey format. The returned key must |
| 59 * be freed using RSAPublicKeyFree(). | 69 * be freed using RSAPublicKeyFree(). |
| 60 * | 70 * |
| 61 * Returns NULL if error. */ | 71 * Returns NULL if error. */ |
| 62 RSAPublicKey* PublicKeyToRSA(const VbPublicKey* key); | 72 RSAPublicKey* PublicKeyToRSA(const VbPublicKey* key); |
| 63 | 73 |
| 64 | 74 |
| 65 /* Verifies [data] matches signature [sig] using [key]. */ | 75 /* Verifies [data] matches signature [sig] using [key]. */ |
| 66 int VerifyData(const uint8_t* data, const VbSignature* sig, | 76 int VerifyData(const uint8_t* data, const VbSignature* sig, |
| 67 const RSAPublicKey* key); | 77 const RSAPublicKey* key); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 93 * using public key [key]. | 103 * using public key [key]. |
| 94 * | 104 * |
| 95 * Returns VBOOT_SUCCESS if successful. */ | 105 * Returns VBOOT_SUCCESS if successful. */ |
| 96 int VerifyKernelPreamble2(const VbKernelPreambleHeader* preamble, | 106 int VerifyKernelPreamble2(const VbKernelPreambleHeader* preamble, |
| 97 uint64_t size, const RSAPublicKey* key); | 107 uint64_t size, const RSAPublicKey* key); |
| 98 | 108 |
| 99 | 109 |
| 100 | 110 |
| 101 | 111 |
| 102 #endif /* VBOOT_REFERENCE_VBOOT_COMMON_H_ */ | 112 #endif /* VBOOT_REFERENCE_VBOOT_COMMON_H_ */ |
| OLD | NEW |