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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 | 24 |
25 /* Read a private key from a .pem file. Caller owns the returned pointer, | 25 /* Read a private key from a .pem file. Caller owns the returned pointer, |
26 * and must free it with PrivateKeyFree(). */ | 26 * and must free it with PrivateKeyFree(). */ |
27 VbPrivateKey* PrivateKeyReadPem(const char* filename, uint64_t algorithm); | 27 VbPrivateKey* PrivateKeyReadPem(const char* filename, uint64_t algorithm); |
28 | 28 |
29 | 29 |
30 /* Free a private key. */ | 30 /* Free a private key. */ |
31 void PrivateKeyFree(VbPrivateKey* key); | 31 void PrivateKeyFree(VbPrivateKey* key); |
32 | 32 |
| 33 /* Write a private key to a file in .vbprivk format. */ |
| 34 int PrivateKeyWrite(const char* filename, const VbPrivateKey* key); |
| 35 |
| 36 /* Read a privake key from a .vbprivk file. Caller owns the returned |
| 37 * pointer, and must free it with PrivateKeyFree(). |
| 38 * |
| 39 * Returns NULL if error. */ |
| 40 VbPrivateKey* PrivateKeyRead(const char* filename); |
| 41 |
| 42 |
33 | 43 |
34 /* Allocate a new public key with space for a [key_size] byte key. */ | 44 /* Allocate a new public key with space for a [key_size] byte key. */ |
35 VbPublicKey* PublicKeyAlloc(uint64_t key_size, uint64_t algorithm, | 45 VbPublicKey* PublicKeyAlloc(uint64_t key_size, uint64_t algorithm, |
36 uint64_t version); | 46 uint64_t version); |
37 | 47 |
38 | 48 |
39 /* Read a public key from a .vbpubk file. Caller owns the returned | 49 /* Read a public key from a .vbpubk file. Caller owns the returned |
40 * pointer, and must free it with Free(). | 50 * pointer, and must free it with Free(). |
41 * | 51 * |
42 * Returns NULL if error. */ | 52 * Returns NULL if error. */ |
43 VbPublicKey* PublicKeyRead(const char* filename); | 53 VbPublicKey* PublicKeyRead(const char* filename); |
44 | 54 |
45 | 55 |
46 /* Read a public key from a .keyb file. Caller owns the returned | 56 /* Read a public key from a .keyb file. Caller owns the returned |
47 * pointer, and must free it with Free(). | 57 * pointer, and must free it with Free(). |
48 * | 58 * |
49 * Returns NULL if error. */ | 59 * Returns NULL if error. */ |
50 VbPublicKey* PublicKeyReadKeyb(const char* filename, uint64_t algorithm, | 60 VbPublicKey* PublicKeyReadKeyb(const char* filename, uint64_t algorithm, |
51 uint64_t version); | 61 uint64_t version); |
52 | 62 |
53 | 63 |
54 /* Write a public key to a file in .vbpubk format. */ | 64 /* Write a public key to a file in .vbpubk format. */ |
55 int PublicKeyWrite(const char* filename, const VbPublicKey* key); | 65 int PublicKeyWrite(const char* filename, const VbPublicKey* key); |
56 | 66 |
57 | 67 |
58 #endif /* VBOOT_REFERENCE_HOST_KEY_H_ */ | 68 #endif /* VBOOT_REFERENCE_HOST_KEY_H_ */ |
OLD | NEW |