1 /* Copyright 2021 The ChromiumOS Authors 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 * 5 * Functions related to unpacking keys and key buffers. 6 */ 7 8 #ifndef VBOOT_REFERENCE_2PACKED_KEY_H_ 9 #define VBOOT_REFERENCE_2PACKED_KEY_H_ 10 11 /** 12 * Unpack a vboot1-format key buffer for use in verification 13 * 14 * The elements of the unpacked key will point into the source buffer, so don't 15 * free the source buffer until you're done with the key. 16 * 17 * @param key Destintion for unpacked key 18 * @param buf Source buffer containing packed key 19 * @param size Size of buffer in bytes 20 * @return VB2_SUCCESS, or non-zero error code if error. 21 */ 22 vb2_error_t vb2_unpack_key_buffer(struct vb2_public_key *key, 23 const uint8_t *buf, uint32_t size); 24 25 /** 26 * Unpack a vboot1-format key for use in verification 27 * 28 * The elements of the unpacked key will point into the source packed key, so 29 * don't free the source until you're done with the public key. 30 * 31 * @param key Destintion for unpacked key 32 * @param packed_key Source packed key 33 * @param size Size of buffer in bytes 34 * @return VB2_SUCCESS, or non-zero error code if error. 35 */ 36 vb2_error_t vb2_unpack_key(struct vb2_public_key *key, 37 const struct vb2_packed_key *packed_key); 38 39 #endif /* VBOOT_REFERENCE_2PACKED_KEY_H_ */ 40