| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 int PublicKeyCopy(VbPublicKey* dest, const VbPublicKey* src); | 63 int PublicKeyCopy(VbPublicKey* dest, const VbPublicKey* src); |
| 64 | 64 |
| 65 | 65 |
| 66 /* Converts a public key to RsaPublicKey format. The returned key must | 66 /* Converts a public key to RsaPublicKey format. The returned key must |
| 67 * be freed using RSAPublicKeyFree(). | 67 * be freed using RSAPublicKeyFree(). |
| 68 * | 68 * |
| 69 * Returns NULL if error. */ | 69 * Returns NULL if error. */ |
| 70 RSAPublicKey* PublicKeyToRSA(const VbPublicKey* key); | 70 RSAPublicKey* PublicKeyToRSA(const VbPublicKey* key); |
| 71 | 71 |
| 72 | 72 |
| 73 /* Verifies [data] matches signature [sig] using [key]. */ | 73 /* Verifies [data] matches signature [sig] using [key]. [size] is the size |
| 74 int VerifyData(const uint8_t* data, const VbSignature* sig, | 74 * of the data buffer; the amount of data to be validated is contained in |
| 75 * sig->data_size. */ |
| 76 int VerifyData(const uint8_t* data, uint64_t size, const VbSignature* sig, |
| 75 const RSAPublicKey* key); | 77 const RSAPublicKey* key); |
| 76 | 78 |
| 77 | 79 |
| 78 /* Verifies a secure hash digest from DigestBuf() or DigestFinal(), | 80 /* Verifies a secure hash digest from DigestBuf() or DigestFinal(), |
| 79 * using [key]. */ | 81 * using [key]. */ |
| 80 int VerifyDigest(const uint8_t* digest, const VbSignature *sig, | 82 int VerifyDigest(const uint8_t* digest, const VbSignature *sig, |
| 81 const RSAPublicKey* key); | 83 const RSAPublicKey* key); |
| 82 | 84 |
| 83 | 85 |
| 84 /* Checks the sanity of a key block of size [size] bytes, using public | 86 /* Checks the sanity of a key block of size [size] bytes, using public |
| 85 * key [key]. If [key]==NULL, uses only the block checksum to verify | 87 * key [key]. If [key]==NULL, uses only the block checksum to verify |
| 86 * the key block. Header fields are also checked for sanity. Does not | 88 * the key block. Header fields are also checked for sanity. Does not |
| 87 * verify key index or key block flags. */ | 89 * verify key index or key block flags. */ |
| 88 int KeyBlockVerify(const VbKeyBlockHeader* block, uint64_t size, | 90 int KeyBlockVerify(const VbKeyBlockHeader* block, uint64_t size, |
| 89 const VbPublicKey *key); | 91 const VbPublicKey *key); |
| 90 | 92 |
| 91 | 93 |
| 92 /* Checks the sanity of a firmware preamble of size [size] bytes, | 94 /* Checks the sanity of a firmware preamble of size [size] bytes, |
| 93 * using public key [key]. | 95 * using public key [key]. |
| 94 * | 96 * |
| 95 * Returns VBOOT_SUCCESS if successful. */ | 97 * Returns VBOOT_SUCCESS if successful. */ |
| 96 int VerifyFirmwarePreamble2(const VbFirmwarePreambleHeader* preamble, | 98 int VerifyFirmwarePreamble(const VbFirmwarePreambleHeader* preamble, |
| 97 uint64_t size, const RSAPublicKey* key); | 99 uint64_t size, const RSAPublicKey* key); |
| 98 | 100 |
| 99 | 101 |
| 100 /* Checks the sanity of a kernel preamble of size [size] bytes, | 102 /* Checks the sanity of a kernel preamble of size [size] bytes, |
| 101 * using public key [key]. | 103 * using public key [key]. |
| 102 * | 104 * |
| 103 * Returns VBOOT_SUCCESS if successful. */ | 105 * Returns VBOOT_SUCCESS if successful. */ |
| 104 int VerifyKernelPreamble2(const VbKernelPreambleHeader* preamble, | 106 int VerifyKernelPreamble(const VbKernelPreambleHeader* preamble, |
| 105 uint64_t size, const RSAPublicKey* key); | 107 uint64_t size, const RSAPublicKey* key); |
| 106 | 108 |
| 107 | 109 |
| 108 | 110 |
| 109 | 111 |
| 110 #endif /* VBOOT_REFERENCE_VBOOT_COMMON_H_ */ | 112 #endif /* VBOOT_REFERENCE_VBOOT_COMMON_H_ */ |
| OLD | NEW |