aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--include/common/firmware_image_package.h8
-rw-r--r--include/lib/libc/uuid.h17
-rw-r--r--include/runtime_services/secure_el1_payloads/tsp.h7
-rw-r--r--lib/utils/uuid.c13
-rw-r--r--tftf/tests/runtime_services/standard_service/query_std_svc.c7
5 files changed, 28 insertions, 24 deletions
diff --git a/include/common/firmware_image_package.h b/include/common/firmware_image_package.h
index f168f23..aba5b57 100644
--- a/include/common/firmware_image_package.h
+++ b/include/common/firmware_image_package.h
@@ -15,13 +15,13 @@
/* ToC Entry UUIDs */
#define UUID_FIRMWARE_UPDATE_SCP_BL2U \
- {0x03279265, 0x742f, 0x44e6, 0x8d, 0xff, {0x57, 0x9a, 0xc1, 0xff, 0x06, 0x10} }
+ {{0x65, 0x92, 0x27, 0x03}, {0x2f, 0x74}, {0xe6, 0x44}, 0x8d, 0xff, {0x57, 0x9a, 0xc1, 0xff, 0x06, 0x10} }
#define UUID_FIRMWARE_UPDATE_BL2U \
- {0x37ebb360, 0xe5c1, 0x41ea, 0x9d, 0xf3, {0x19, 0xed, 0xa1, 0x1f, 0x68, 0x01} }
+ {{0x60, 0xb3, 0xeb, 0x37}, {0xc1, 0xe5}, {0xea, 0x41}, 0x9d, 0xf3, {0x19, 0xed, 0xa1, 0x1f, 0x68, 0x01} }
#define UUID_FIRMWARE_UPDATE_NS_BL2U \
- {0x111d514f, 0xe52b, 0x494e, 0xb4, 0xc5, {0x83, 0xc2, 0xf7, 0x15, 0x84, 0x0a} }
+ {{0x4f, 0x51, 0x1d, 0x11}, {0x2b, 0xe5}, {0x4e, 0x49}, 0xb4, 0xc5, {0x83, 0xc2, 0xf7, 0x15, 0x84, 0x0a} }
#define UUID_FIRMWARE_UPDATE_FWU_CERT \
- {0xb28a4071, 0xd618, 0x4c87, 0x8b, 0x2e, {0xc6, 0xdc, 0xcd, 0x50, 0xf0, 0x96} }
+ {{0x71, 0x40, 0x8a, 0xb2}, {0x18, 0xd6}, {0x87, 0x4c}, 0x8b, 0x2e, {0xc6, 0xdc, 0xcd, 0x50, 0xf0, 0x96} }
typedef struct fip_toc_header {
uint32_t name;
diff --git a/include/lib/libc/uuid.h b/include/lib/libc/uuid.h
index bdefb91..3a1699b 100644
--- a/include/lib/libc/uuid.h
+++ b/include/lib/libc/uuid.h
@@ -1,4 +1,6 @@
/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
* Copyright (c) 2002 Marcel Moolenaar
* All rights reserved.
*
@@ -27,7 +29,7 @@
*/
/*
- * Portions copyright (c) 2014, ARM Limited and Contributors.
+ * Portions copyright (c) 2014-2020, ARM Limited and Contributors.
* All rights reserved.
*/
@@ -40,17 +42,10 @@
/* Length of a node address (an IEEE 802 address). */
#define _UUID_NODE_LEN 6
-/*
- * See also:
- * http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt
- * http://www.opengroup.org/onlinepubs/009629399/apdxa.htm
- *
- * A DCE 1.1 compatible source representation of UUIDs.
- */
struct uuid {
- uint32_t time_low;
- uint16_t time_mid;
- uint16_t time_hi_and_version;
+ uint8_t time_low[4];
+ uint8_t time_mid[2];
+ uint8_t time_hi_and_version[2];
uint8_t clock_seq_hi_and_reserved;
uint8_t clock_seq_low;
uint8_t node[_UUID_NODE_LEN];
diff --git a/include/runtime_services/secure_el1_payloads/tsp.h b/include/runtime_services/secure_el1_payloads/tsp.h
index 6a4a3d6..87ee6f7 100644
--- a/include/runtime_services/secure_el1_payloads/tsp.h
+++ b/include/runtime_services/secure_el1_payloads/tsp.h
@@ -16,8 +16,11 @@
#include <uuid.h>
static const uuid_t tsp_uuid = {
- 0x5b3056a0, 0x3291, 0x427b, 0x98, 0x11,
- { 0x71, 0x68, 0xca, 0x50, 0xf3, 0xfa }
+ {0xa0, 0x56, 0x30, 0x5b},
+ {0x91, 0x32},
+ {0x7b, 0x42},
+ 0x98, 0x11,
+ {0x71, 0x68, 0xca, 0x50, 0xf3, 0xfa}
};
/*
diff --git a/lib/utils/uuid.c b/lib/utils/uuid.c
index 2c79dfb..52af1e7 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]);
diff --git a/tftf/tests/runtime_services/standard_service/query_std_svc.c b/tftf/tests/runtime_services/standard_service/query_std_svc.c
index 34141d2..c8ce6e9 100644
--- a/tftf/tests/runtime_services/standard_service/query_std_svc.c
+++ b/tftf/tests/runtime_services/standard_service/query_std_svc.c
@@ -15,8 +15,11 @@
* Firmware.
*/
static const uuid_t armtf_std_svc_uuid = {
- 0x108d905b, 0xf863, 0x47e8, 0xae, 0x2d,
- { 0xc0, 0xfb, 0x56, 0x41, 0xf6, 0xe2 }
+ {0x5b, 0x90, 0x8d, 0x10},
+ {0x63, 0xf8},
+ {0xe8, 0x47},
+ 0xae, 0x2d,
+ {0xc0, 0xfb, 0x56, 0x41, 0xf6, 0xe2}
};
/**