diff options
Diffstat (limited to 'host/lib21/include/host_misc2.h')
-rw-r--r-- | host/lib21/include/host_misc2.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/host/lib21/include/host_misc2.h b/host/lib21/include/host_misc2.h new file mode 100644 index 00000000..5d1679be --- /dev/null +++ b/host/lib21/include/host_misc2.h @@ -0,0 +1,36 @@ +/* Copyright 2015 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef VBOOT_REFERENCE_HOST_MISC2_H_ +#define VBOOT_REFERENCE_HOST_MISC2_H_ + +#include <stdint.h> +#include <stdio.h> + +#include "2guid.h" + +/* Length of string representation, including trailing '\0' */ +#define VB2_GUID_MIN_STRLEN 37 + +/** + * Convert string to struct vb2_guid. + * + * @param str Example: "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" + * @param guid Destination for binary representation + * @return VB2_SUCCESS, or non-zero if error. + */ +int vb2_str_to_guid(const char *str, struct vb2_guid *guid); + +/** + * Convert struct vb2_guid to string. + * + * @param guid Binary representation + * @param str Buffer for result "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" + * @return VB2_SUCCESS, or non-zero if error. + */ +int vb2_guid_to_str(const struct vb2_guid *guid, + char *buf, unsigned int buflen); + +#endif /* VBOOT_REFERENCE_HOST_MISC2_H_ */ |