aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOliver Swede <oli.swede@arm.com>2019-10-01 13:50:36 +0100
committerOliver Swede <oli.swede@arm.com>2020-01-13 16:04:58 +0000
commit35d824e362df862215f987fdf844ccfb8d9ccd92 (patch)
treee7f4d50abc003472cf6e2f8fb6cdc72232b6e45f /lib
parent584b3cb3aba5423c31496a4f46ea6a58e44dd7d9 (diff)
downloadtf-a-tests-35d824e362df862215f987fdf844ccfb8d9ccd92.tar.gz
Make TFTF RFC 4122 compliant
This is a TFTF backport of a change that makes TF RFC 4122-compliant by converting the stored format of UUIDs from machine order (little endian) to network order (big endian). This patch changes the data structure used to store the values in the same way as in the related change in TF: 033648652f2d66abe2454a75ded891a47cb13446. Signed-off-by: Oliver Swede <oli.swede@arm.com> Change-Id: I052e570b80de61f87a049a08e347a2e5da7f841b
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/uuid.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/utils/uuid.c b/lib/utils/uuid.c
index 2c79dfbdc..52af1e70e 100644
--- a/lib/utils/uuid.c
+++ b/lib/utils/uuid.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -10,9 +10,9 @@
#include <uuid_utils.h>
/* Format string to print a UUID */
-static const char *uuid_str_fmt = "{ 0x%08x, 0x%04x, 0x%04x, 0x%02x, 0x%02x, "
- "0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x }";
-
+static const char *uuid_str_fmt = "{ 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, "
+ "0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, "
+ "0x%02x, 0x%02x }";
unsigned int is_uuid_null(const uuid_t *uuid)
{
@@ -27,7 +27,10 @@ char *uuid_to_str(const uuid_t *uuid, char *str)
assert(str != NULL);
snprintf(str, UUID_STR_SIZE, uuid_str_fmt,
- uuid->time_low, uuid->time_mid, uuid->time_hi_and_version,
+ uuid->time_low[0], uuid->time_low[1],
+ uuid->time_low[2], uuid->time_low[3],
+ uuid->time_mid[0], uuid->time_mid[1],
+ uuid->time_hi_and_version[0], uuid->time_hi_and_version[1],
uuid->clock_seq_hi_and_reserved, uuid->clock_seq_low,
uuid->node[0], uuid->node[1], uuid->node[2], uuid->node[3],
uuid->node[4], uuid->node[5]);