summaryrefslogtreecommitdiff
path: root/host/lib21/include/host_misc2.h
blob: 5d1679be3f1e5829f312126a0d82724e47dc4e3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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_ */