xref: /aosp_15_r20/external/vboot_reference/host/lib21/include/host_misc21.h (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1 /* Copyright 2015 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 
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 "2id.h"
13 
14 /* Length of string representation, including trailing '\0' */
15 #define VB2_ID_MIN_STRLEN (2 * VB2_ID_NUM_BYTES + 1)
16 
17 /**
18  * Convert hex string to struct vb2_id.
19  *
20  * @param str		Example: "01ABef000042"
21  * @param id            Destination for binary representation
22  * @return VB2_SUCCESS, or non-zero if error.
23  */
24 vb2_error_t vb2_str_to_id(const char *str, struct vb2_id *id);
25 
26 #endif  /* VBOOT_REFERENCE_HOST_MISC2_H_ */
27