| 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 * Host-side functions for verified boot. | 5 * Host-side functions for verified boot. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef VBOOT_REFERENCE_HOST_KEY_H_ | 8 #ifndef VBOOT_REFERENCE_HOST_KEY_H_ |
| 9 #define VBOOT_REFERENCE_HOST_KEY_H_ | 9 #define VBOOT_REFERENCE_HOST_KEY_H_ |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 /* Read a private key from a file. Caller owns the returned pointer, | 27 /* Read a private key from a file. Caller owns the returned pointer, |
| 28 * and must free it with PrivateKeyFree(). */ | 28 * and must free it with PrivateKeyFree(). */ |
| 29 VbPrivateKey* PrivateKeyRead(const char* filename, uint64_t algorithm); | 29 VbPrivateKey* PrivateKeyRead(const char* filename, uint64_t algorithm); |
| 30 | 30 |
| 31 | 31 |
| 32 /* Free a private key. */ | 32 /* Free a private key. */ |
| 33 void PrivateKeyFree(VbPrivateKey* key); | 33 void PrivateKeyFree(VbPrivateKey* key); |
| 34 | 34 |
| 35 | 35 |
| 36 /* Initialize a public key to refer to [key_data]. */ | |
| 37 void PublicKeyInit(VbPublicKey* key, uint8_t* key_data, uint64_t key_size); | |
| 38 | |
| 39 | |
| 40 /* Allocate a new public key with space for a [key_size] byte key. */ | 36 /* Allocate a new public key with space for a [key_size] byte key. */ |
| 41 VbPublicKey* PublicKeyAlloc(uint64_t key_size, uint64_t algorithm, | 37 VbPublicKey* PublicKeyAlloc(uint64_t key_size, uint64_t algorithm, |
| 42 uint64_t version); | 38 uint64_t version); |
| 43 | 39 |
| 44 | 40 |
| 45 /* Copy a public key from [src] to [dest]. | |
| 46 * | |
| 47 * Returns 0 if success, non-zero if error. */ | |
| 48 int PublicKeyCopy(VbPublicKey* dest, const VbPublicKey* src); | |
| 49 | |
| 50 | |
| 51 /* Read a public key from a .vbpubk file. Caller owns the returned | 41 /* Read a public key from a .vbpubk file. Caller owns the returned |
| 52 * pointer, and must free it with Free(). | 42 * pointer, and must free it with Free(). |
| 53 * | 43 * |
| 54 * Returns NULL if error. */ | 44 * Returns NULL if error. */ |
| 55 VbPublicKey* PublicKeyRead(const char* filename); | 45 VbPublicKey* PublicKeyRead(const char* filename); |
| 56 | 46 |
| 57 | 47 |
| 58 /* Read a public key from a .keyb file. Caller owns the returned | 48 /* Read a public key from a .keyb file. Caller owns the returned |
| 59 * pointer, and must free it with Free(). | 49 * pointer, and must free it with Free(). |
| 60 * | 50 * |
| 61 * Returns NULL if error. */ | 51 * Returns NULL if error. */ |
| 62 VbPublicKey* PublicKeyReadKeyb(const char* filename, uint64_t algorithm, | 52 VbPublicKey* PublicKeyReadKeyb(const char* filename, uint64_t algorithm, |
| 63 uint64_t version); | 53 uint64_t version); |
| 64 | 54 |
| 65 | 55 |
| 66 /* Write a public key to a file in .vbpubk format. */ | 56 /* Write a public key to a file in .vbpubk format. */ |
| 67 int PublicKeyWrite(const char* filename, const VbPublicKey* key); | 57 int PublicKeyWrite(const char* filename, const VbPublicKey* key); |
| 68 | 58 |
| 69 | 59 |
| 70 #endif /* VBOOT_REFERENCE_HOST_KEY_H_ */ | 60 #endif /* VBOOT_REFERENCE_HOST_KEY_H_ */ |
| OLD | NEW |