1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <device/device.h>
9 void smbios_system_set_uuid(u8
*uuid
)
11 /* Add 3 more bytes: 2 for possible CRLF and third for NULL char */
12 char uuid_str
[UUID_STRLEN
+ 3] = {0};
13 uint8_t system_uuid
[UUID_LEN
];
15 size_t uuid_len
= cbfs_load("system_uuid", uuid_str
, UUID_STRLEN
);
17 if (uuid_len
>= UUID_STRLEN
&& uuid_len
<= UUID_STRLEN
+ 3) {
18 /* Cut off any trailing whitespace like CR or LF */
19 uuid_str
[UUID_STRLEN
] = '\0';
20 if (!parse_uuid(system_uuid
, uuid_str
))
21 memcpy(uuid
, system_uuid
, UUID_LEN
);