1 /* Copyright 2015 The Chromium OS Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 #ifndef VBOOT_REFERENCE_HOST_MISC2_H_ 7 #define VBOOT_REFERENCE_HOST_MISC2_H_ 8 9 #include <stdint.h> 10 #include <stdio.h> 11 12 #include "2guid.h" 13 14 /* Length of string representation, including trailing '\0' */ 15 #define VB2_GUID_MIN_STRLEN 37 16 17 /** 18 * Convert string to struct vb2_guid. 19 * 20 * @param str Example: "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" 21 * @param guid Destination for binary representation 22 * @return VB2_SUCCESS, or non-zero if error. 23 */ 24 int vb2_str_to_guid(const char *str, struct vb2_guid *guid); 25 26 /** 27 * Convert struct vb2_guid to string. 28 * 29 * @param guid Binary representation 30 * @param str Buffer for result "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" 31 * @return VB2_SUCCESS, or non-zero if error. 32 */ 33 int vb2_guid_to_str(const struct vb2_guid *guid, 34 char *buf, unsigned int buflen); 35 36 #endif /* VBOOT_REFERENCE_HOST_MISC2_H_ */ 37