Make TF UUID RFC 4122 compliant
authorRoberto Vargas <roberto.vargas@arm.com>
Thu, 26 Apr 2018 12:36:53 +0000 (13:36 +0100)
committerRoberto Vargas <roberto.vargas@arm.com>
Thu, 14 Jun 2018 13:41:00 +0000 (14:41 +0100)
RFC4122 defines that fields are stored in network order (big endian),
but TF-A stores them in machine order (little endian by default in TF-A).
We cannot change the future UUIDs that are already generated, but we can store
all the bytes using arrays and modify fiptool to generate the UUIDs with
the correct byte order.

Change-Id: I97be2d3168d91f4dee7ccfafc533ea55ff33e46f
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
16 files changed:
bl1/bl1_main.c
drivers/io/io_fip.c
include/lib/smccc.h
include/tools_share/firmware_image_package.h
include/tools_share/uuid.h
plat/arm/common/arm_sip_svc.c
plat/hisilicon/hikey/hisi_sip_svc.c
plat/mediatek/common/custom/oem_svc.c
plat/mediatek/common/mtk_sip_svc.c
plat/rockchip/common/rockchip_sip_svc.c
plat/xilinx/zynqmp/sip_svc_setup.c
services/spd/tlkd/tlkd_main.c
services/spd/tspd/tspd_main.c
services/std_svc/std_svc_setup.c
tools/fiptool/fiptool.c
tools/fiptool/tbbr_config.c

index 9f7e2901fc92c12423886becf448147e6eed22d9..64b363c5f0be8b470a713281d3319618d4d14014 100644 (file)
@@ -21,8 +21,8 @@
 #include "bl1_private.h"
 
 /* BL1 Service UUID */
-DEFINE_SVC_UUID(bl1_svc_uid,
-       0xfd3967d4, 0x72cb, 0x4d9a, 0xb5, 0x75,
+DEFINE_SVC_UUID2(bl1_svc_uid,
+       0xd46739fd, 0xcb72, 0x9a4d, 0xb5, 0x75,
        0x67, 0x15, 0xd6, 0xf4, 0xbb, 0x4a);
 
 static void bl1_load_bl2(void);
index 487f58611751320327cae168413be7a039f25993..1754339062919878ad7cf9e72a8d779dc26f708f 100644 (file)
@@ -32,7 +32,7 @@ typedef struct {
        fip_toc_entry_t entry;
 } file_state_t;
 
-static const uuid_t uuid_null = {0};
+static const uuid_t uuid_null = { {0} };
 static file_state_t current_file = {0};
 static uintptr_t backend_dev_handle;
 static uintptr_t backend_image_spec;
index 660c1dbd288b78bef827a8daac6754395d7bcd3c..cb722b0e2e238fc57f7c827e409635ddbaa4a046 100644 (file)
@@ -57,6 +57,7 @@
  * does not equal SMC_UNK. This is to ensure that the caller won't mistake the
  * returned UUID in x0 for an invalid SMC error return
  */
+#if !ERROR_DEPRECATED
 #define DEFINE_SVC_UUID(_name, _tl, _tm, _th, _cl, _ch, \
                _n0, _n1, _n2, _n3, _n4, _n5) \
        CASSERT((uint32_t)(_tl) != (uint32_t) SMC_UNK, invalid_svc_uuid);\
                _tl, _tm, _th, _cl, _ch, \
                { _n0, _n1, _n2, _n3, _n4, _n5 } \
        }
+#endif
+
+
+#define DEFINE_SVC_UUID2(_name, _tl, _tm, _th, _cl, _ch,               \
+               _n0, _n1, _n2, _n3, _n4, _n5)                           \
+       CASSERT((uint32_t)(_tl) != (uint32_t) SMC_UNK, invalid_svc_uuid);\
+       static const uuid_t _name = {                                   \
+               {(_tl >> 24) & 0xFF,                                    \
+                (_tl >> 16) & 0xFF,                                    \
+                (_tl >> 8)  & 0xFF,                                    \
+                (_tl & 0xFF)},                                         \
+               {(_tm >> 8) & 0xFF,                                     \
+                (_tm  & 0xFF)},                                        \
+               {(_th >> 8) & 0xFF,                                     \
+                (_th & 0xFF)},                                         \
+               _cl, _ch,                                               \
+               { _n0, _n1, _n2, _n3, _n4, _n5 }                        \
+       }
 
 #endif /*__ASSEMBLY__*/
 #endif /* __SMCCC_H__ */
index f25855523dd02973be63d2998cd992959f3bd2f0..b1ce56af6a44c423c392a53e547a8ab45aa952e6 100644 (file)
 
 /* ToC Entry UUIDs */
 #define UUID_TRUSTED_UPDATE_FIRMWARE_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_TRUSTED_UPDATE_FIRMWARE_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_TRUSTED_UPDATE_FIRMWARE_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_TRUSTED_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} }
 #define UUID_TRUSTED_BOOT_FIRMWARE_BL2 \
-       {0x0becf95f, 0x224d, 0x4d3e, 0xa5, 0x44, {0xc3, 0x9d, 0x81, 0xc7, 0x3f, 0x0a} }
+       {{0x5f, 0xf9, 0xec, 0x0b}, {0x4d, 0x22}, {0x3e, 0x4d}, 0xa5, 0x44, {0xc3, 0x9d, 0x81, 0xc7, 0x3f, 0x0a} }
 #define UUID_SCP_FIRMWARE_SCP_BL2 \
-       {0x3dfd6697, 0xbe89, 0x49e8, 0xae, 0x5d, {0x78, 0xa1, 0x40, 0x60, 0x82, 0x13} }
+       {{0x97,  0x66, 0xfd, 0x3d}, {0x89, 0xbe}, {0xe8, 0x49}, 0xae, 0x5d, {0x78, 0xa1, 0x40, 0x60, 0x82, 0x13} }
 #define UUID_EL3_RUNTIME_FIRMWARE_BL31 \
-       {0x6d08d447, 0xfe4c, 0x4698, 0x9b, 0x95, {0x29, 0x50, 0xcb, 0xbd, 0x5a, 0x00} }
+       {{0x47,  0xd4, 0x08, 0x6d}, {0x4c, 0xfe}, {0x98, 0x46}, 0x9b, 0x95, {0x29, 0x50, 0xcb, 0xbd, 0x5a, 0x00} }
 #define UUID_SECURE_PAYLOAD_BL32 \
-       {0x89e1d005, 0xdc53, 0x4713, 0x8d, 0x2b, {0x50, 0x0a, 0x4b, 0x7a, 0x3e, 0x38} }
+       {{0x05,  0xd0, 0xe1, 0x89}, {0x53, 0xdc}, {0x13, 0x47}, 0x8d, 0x2b, {0x50, 0x0a, 0x4b, 0x7a, 0x3e, 0x38} }
 #define UUID_SECURE_PAYLOAD_BL32_EXTRA1 \
-       {0x9bc2700b, 0x5a2a, 0x4078, 0x9f, 0x65, {0x0a, 0x56, 0x82, 0x73, 0x82, 0x88} }
+       {{0x0b,  0x70, 0xc2, 0x9b}, {0x2a, 0x5a}, {0x78, 0x40}, 0x9f, 0x65, {0x0a, 0x56, 0x82, 0x73, 0x82, 0x88} }
 #define UUID_SECURE_PAYLOAD_BL32_EXTRA2 \
-       {0xb17ba88e, 0xa2cf, 0x4d3f, 0x85, 0xfd, {0xe7, 0xbb, 0xa5, 0x02, 0x20, 0xd9} }
+       {{0x8e,  0xa8, 0x7b, 0xb1}, {0xcf, 0xa2}, {0x3f, 0x4d}, 0x85, 0xfd, {0xe7, 0xbb, 0xa5, 0x02, 0x20, 0xd9} }
 #define UUID_NON_TRUSTED_FIRMWARE_BL33 \
-       {0xa7eed0d6, 0xeafc, 0x4bd5, 0x97, 0x82, {0x99, 0x34, 0xf2, 0x34, 0xb6, 0xe4} }
+       {{0xd6,  0xd0, 0xee, 0xa7}, {0xfc, 0xea}, {0xd5, 0x4b}, 0x97, 0x82, {0x99, 0x34, 0xf2, 0x34, 0xb6, 0xe4} }
 /* Key certificates */
 #define UUID_ROT_KEY_CERT \
-       {0x721d2d86, 0x60f8, 0x11e4, 0x92, 0x0b, {0x8b, 0xe7, 0x62, 0x16, 0x0f, 0x24} }
+       {{0x86,  0x2d, 0x1d, 0x72}, {0xf8, 0x60}, {0xe4, 0x11}, 0x92, 0x0b, {0x8b, 0xe7, 0x62, 0x16, 0x0f, 0x24} }
 #define UUID_TRUSTED_KEY_CERT \
-       {0x90e87e82, 0x60f8, 0x11e4, 0xa1, 0xb4, {0x77, 0x7a, 0x21, 0xb4, 0xf9, 0x4c} }
+       {{0x82,  0x7e, 0xe8, 0x90}, {0xf8, 0x60}, {0xe4, 0x11}, 0xa1, 0xb4, {0x77, 0x7a, 0x21, 0xb4, 0xf9, 0x4c} }
 #define UUID_NON_TRUSTED_WORLD_KEY_CERT \
-       {0x3d87671c, 0x635f, 0x11e4, 0x97, 0x8d, {0x27, 0xc0, 0xc7, 0x14, 0x8a, 0xbd} }
+       {{0x1c,  0x67, 0x87, 0x3d}, {0x5f, 0x63}, {0xe4, 0x11}, 0x97, 0x8d, {0x27, 0xc0, 0xc7, 0x14, 0x8a, 0xbd} }
 #define UUID_SCP_FW_KEY_CERT \
-       {0xa1214202, 0x60f8, 0x11e4, 0x8d, 0x9b, {0xf3, 0x3c, 0x0e, 0x15, 0xa0, 0x14} }
+       {{0x02,  0x42, 0x21, 0xa1}, {0xf8, 0x60}, {0xe4, 0x11}, 0x8d, 0x9b, {0xf3, 0x3c, 0x0e, 0x15, 0xa0, 0x14} }
 #define UUID_SOC_FW_KEY_CERT \
-       {0xccbeb88a, 0x60f9, 0x11e4, 0x9a, 0xd0, {0xeb, 0x48, 0x22, 0xd8, 0xdc, 0xf8} }
+       {{0x8a,  0xb8, 0xbe, 0xcc}, {0xf9, 0x60}, {0xe4, 0x11}, 0x9a, 0xd0, {0xeb, 0x48, 0x22, 0xd8, 0xdc, 0xf8} }
 #define UUID_TRUSTED_OS_FW_KEY_CERT \
-       {0x03d67794, 0x60fb, 0x11e4, 0x85, 0xdd, {0xb7, 0x10, 0x5b, 0x8c, 0xee, 0x04} }
+       {{0x94,  0x77, 0xd6, 0x03}, {0xfb, 0x60}, {0xe4, 0x11}, 0x85, 0xdd, {0xb7, 0x10, 0x5b, 0x8c, 0xee, 0x04} }
 #define UUID_NON_TRUSTED_FW_KEY_CERT \
-       {0x2a83d58a, 0x60fb, 0x11e4, 0x8a, 0xaf, {0xdf, 0x30, 0xbb, 0xc4, 0x98, 0x59} }
+       {{0x8a,  0xd5, 0x83, 0x2a}, {0xfb, 0x60}, {0xe4, 0x11}, 0x8a, 0xaf, {0xdf, 0x30, 0xbb, 0xc4, 0x98, 0x59} }
 /* Content certificates */
 #define UUID_TRUSTED_BOOT_FW_CERT \
-       {0xea69e2d6, 0x635d, 0x11e4, 0x8d, 0x8c, {0x9f, 0xba, 0xbe, 0x99, 0x56, 0xa5} }
+       {{0xd6,  0xe2, 0x69, 0xea}, {0x5d, 0x63}, {0xe4, 0x11}, 0x8d, 0x8c, {0x9f, 0xba, 0xbe, 0x99, 0x56, 0xa5} }
 #define UUID_SCP_FW_CONTENT_CERT \
-       {0x046fbe44, 0x635e, 0x11e4, 0xb2, 0x8b, {0x73, 0xd8, 0xea, 0xae, 0x96, 0x56} }
+       {{0x44,  0xbe, 0x6f, 0x04}, {0x5e, 0x63}, {0xe4, 0x11}, 0xb2, 0x8b, {0x73, 0xd8, 0xea, 0xae, 0x96, 0x56} }
 #define UUID_SOC_FW_CONTENT_CERT \
-       {0x200cb2e2, 0x635e, 0x11e4, 0x9c, 0xe8, {0xab, 0xcc, 0xf9, 0x2b, 0xb6, 0x66} }
+       {{0xe2,  0xb2, 0x0c, 0x20}, {0x5e, 0x63}, {0xe4, 0x11}, 0x9c, 0xe8, {0xab, 0xcc, 0xf9, 0x2b, 0xb6, 0x66} }
 #define UUID_TRUSTED_OS_FW_CONTENT_CERT \
-       {0x11449fa4, 0x635e, 0x11e4, 0x87, 0x28, {0x3f, 0x05, 0x72, 0x2a, 0xf3, 0x3d} }
+       {{0xa4,  0x9f, 0x44, 0x11}, {0x5e, 0x63}, {0xe4, 0x11}, 0x87, 0x28, {0x3f, 0x05, 0x72, 0x2a, 0xf3, 0x3d} }
 #define UUID_NON_TRUSTED_FW_CONTENT_CERT \
-       {0xf3c1c48e, 0x635d, 0x11e4, 0xa7, 0xa9, {0x87, 0xee, 0x40, 0xb2, 0x3f, 0xa7} }
+       {{0x8e,  0xc4, 0xc1, 0xf3}, {0x5d, 0x63}, {0xe4, 0x11}, 0xa7, 0xa9, {0x87, 0xee, 0x40, 0xb2, 0x3f, 0xa7} }
 /* Dynamic configs */
 #define UUID_HW_CONFIG \
-       {0xd9f1b808, 0xcfc9, 0x4993, 0xa9, 0x62, {0x6f, 0xbc, 0x6b, 0x72, 0x65, 0xcc} }
+       {{0x08,  0xb8, 0xf1, 0xd9}, {0xc9, 0xcf}, {0x93, 0x49}, 0xa9, 0x62, {0x6f, 0xbc, 0x6b, 0x72, 0x65, 0xcc} }
 #define UUID_TB_FW_CONFIG \
-       {0xff58046c, 0x6baf, 0x4f7d, 0x82, 0xed, {0xaa, 0x27, 0xbc, 0x69, 0xbf, 0xd2} }
+       {{0x6c,  0x04, 0x58, 0xff}, {0xaf, 0x6b}, {0x7d, 0x4f}, 0x82, 0xed, {0xaa, 0x27, 0xbc, 0x69, 0xbf, 0xd2} }
 #define UUID_SOC_FW_CONFIG \
-       {0x4b817999, 0x7603, 0x46fb, 0x8c, 0x8e, {0x8d, 0x26, 0x7f, 0x78, 0x59, 0xe0} }
+       {{0x99,  0x79, 0x81, 0x4b}, {0x03, 0x76}, {0xfb, 0x46}, 0x8c, 0x8e, {0x8d, 0x26, 0x7f, 0x78, 0x59, 0xe0} }
 #define UUID_TOS_FW_CONFIG \
-       {0x1a7c2526, 0xc6bd, 0x477f, 0x8d, 0x96, {0xc4, 0xc4, 0xb0, 0x24, 0x80, 0x21} }
+       {{0x26,  0x25, 0x7c, 0x1a}, {0xdb, 0xc6}, {0x7f, 0x47}, 0x8d, 0x96, {0xc4, 0xc4, 0xb0, 0x24, 0x80, 0x21} }
 #define UUID_NT_FW_CONFIG \
-       {0x1598da28, 0xe893, 0x447e, 0xac, 0x66, {0x1a, 0xaf, 0x80, 0x15, 0x50, 0xf9} }
+       {{0x28,  0xda, 0x98, 0x15}, {0x93, 0xe8}, {0x7e, 0x44}, 0xac, 0x66, {0x1a, 0xaf, 0x80, 0x15, 0x50, 0xf9} }
 
 typedef struct fip_toc_header {
        uint32_t        name;
index 6d935bd6b0f3dcf9d0bb1ae31e7536b69ca4c27c..f3ac4af5fd1c5d8ac950da3ec2973a935a4e5869 100644 (file)
@@ -48,9 +48,9 @@
  * 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];
index 7fe61019e28c1e92e76be811dfcfe0953c2de6ae..bb5b5c6b9befc4fa13e133a6e17a132e4070a073 100644 (file)
@@ -14,9 +14,9 @@
 
 
 /* ARM SiP Service UUID */
-DEFINE_SVC_UUID(arm_sip_svc_uid,
-               0xe2756d55, 0x3360, 0x4bb5, 0xbf, 0xf3,
-               0x62, 0x79, 0xfd, 0x11, 0x37, 0xff);
+DEFINE_SVC_UUID2(arm_sip_svc_uid,
+       0x556d75e2, 0x6033, 0xb54b, 0xb5, 0x75,
+       0x62, 0x79, 0xfd, 0x11, 0x37, 0xff);
 
 static int arm_sip_setup(void)
 {
index b3109d611358c08b30fcc63e87f846e785ad6345..ffa4903769df49433d4d4348545df81aa05c3f24 100644 (file)
@@ -13,9 +13,9 @@
 
 
 /* Hisi SiP Service UUID */
-DEFINE_SVC_UUID(hisi_sip_svc_uid,
-               0xe599df74, 0x7682, 0x40aa, 0x9f, 0xf8,
-               0xc0, 0x85, 0x52, 0xbc, 0x39, 0x3f);
+DEFINE_SVC_UUID2(hisi_sip_svc_uid,
+       0x74df99e5, 0x8276, 0xaa40, 0x9f, 0xf8,
+       0xc0, 0x85, 0x52, 0xbc, 0x39, 0x3f);
 
 static int hisi_sip_setup(void)
 {
index c396e2d99c8bd4329c0363cae995bd324b9ca817..18bda515a460a99d2c1c2a1a58f33be0a69fe3dc 100644 (file)
 #include <uuid.h>
 
 /* OEM Service UUID */
-DEFINE_SVC_UUID(oem_svc_uid,
-               0xb943add0, 0x069d, 0x11e4, 0x91, 0x91,
-               0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66);
-
+DEFINE_SVC_UUID2(oem_svc_uid,
+       0xd0ad43b9, 0x9b06, 0xe411, 0x91, 0x91,
+       0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66);
 
 /* Setup OEM Services */
 static int32_t oem_svc_setup(void)
index ea8cea0072b6ba1da806e6bfe6ad992a4afe1084..71eddca310fcae6ef4755031fe32b7baeed7a07c 100644 (file)
@@ -14,9 +14,9 @@
 #include <uuid.h>
 
 /* Mediatek SiP Service UUID */
-DEFINE_SVC_UUID(mtk_sip_svc_uid,
-               0xf7582ba4, 0x4262, 0x4d7d, 0x80, 0xe5,
-               0x8f, 0x95, 0x05, 0x00, 0x0f, 0x3d);
+DEFINE_SVC_UUID2(mtk_sip_svc_uid,
+       0xa42b58f7, 0x6242, 0x7d4d, 0x80, 0xe5,
+       0x8f, 0x95, 0x05, 0x00, 0x0f, 0x3d);
 
 #pragma weak mediatek_plat_sip_handler
 uintptr_t mediatek_plat_sip_handler(uint32_t smc_fid,
index 24805994b090f3a41f450a8deb159f61e9a13786..d690e92fc92810311a7c7624929b34a19fa47718 100644 (file)
@@ -13,9 +13,9 @@
 #include <uuid.h>
 
 /* Rockchip SiP Service UUID */
-DEFINE_SVC_UUID(rk_sip_svc_uid,
-               0xe86fc7e2, 0x313e, 0x11e6, 0xb7, 0x0d,
-               0x8f, 0x88, 0xee, 0x74, 0x7b, 0x72);
+DEFINE_SVC_UUID2(rk_sip_svc_uid,
+       0xe2c76fe8, 0x3e31, 0xe611, 0xb7, 0x0d,
+       0x8f, 0x88, 0xee, 0x74, 0x7b, 0x72);
 
 #pragma weak rockchip_plat_sip_handler
 uintptr_t rockchip_plat_sip_handler(uint32_t smc_fid,
index c7996ce7ea7ceb6c523dbced910f098c9522209b..9fe709db90769cba0aaae4fb1713d0ace9827ead 100644 (file)
@@ -29,9 +29,9 @@
 #define is_ipi_fid(_fid) (((_fid) & PM_FID_MASK) == IPI_FID_VALUE)
 
 /* SiP Service UUID */
-DEFINE_SVC_UUID(zynqmp_sip_uuid,
-               0x2a1d9b5c, 0x8605, 0x4023, 0xa6, 0x1b,
-               0xb9, 0x25, 0x82, 0x2d, 0xe3, 0xa5);
+DEFINE_SVC_UUID2(zynqmp_sip_uuid,
+       0x5c9b1b2a, 0x0586, 0x2340, 0xa6, 0x1b,
+       0xb9, 0x25, 0x82, 0x2d, 0xe3, 0xa5);
 
 /**
  * sip_svc_setup() - Setup SiP Service
index 5090f063fefe071edf79e38a591a2274464831c1..cee7ef865deb476cdfef782a7fb9771f59df6fb4 100644 (file)
@@ -40,9 +40,9 @@ tlk_context_t tlk_ctx;
 static uint32_t boot_cpu;
 
 /* TLK UID: RFC-4122 compliant UUID (version-5, sha-1) */
-DEFINE_SVC_UUID(tlk_uuid,
-               0xbd11e9c9, 0x2bba, 0x52ee, 0xb1, 0x72,
-               0x46, 0x1f, 0xba, 0x97, 0x7f, 0x63);
+DEFINE_SVC_UUID2(tlk_uuid,
+       0xc9e911bd, 0xba2b, 0xee52, 0xb1, 0x72,
+       0x46, 0x1f, 0xba, 0x97, 0x7f, 0x63);
 
 static int32_t tlkd_init(void);
 
index 8cb23b966153615576e0fc1897995abc80183472..3ec98d6875445f7fec1947f5d9c06e471d565532 100644 (file)
@@ -43,9 +43,9 @@ tsp_context_t tspd_sp_context[TSPD_CORE_COUNT];
 
 
 /* TSP UID */
-DEFINE_SVC_UUID(tsp_uuid,
-               0x5b3056a0, 0x3291, 0x427b, 0x98, 0x11,
-               0x71, 0x68, 0xca, 0x50, 0xf3, 0xfa);
+DEFINE_SVC_UUID2(tsp_uuid,
+       0xa056305b, 0x9132, 0x7b42, 0x98, 0x11,
+       0x71, 0x68, 0xca, 0x50, 0xf3, 0xfa);
 
 int32_t tspd_init(void);
 
index 41befe5b2d4cfee8e6f2f73ae32d6b6c3061ef72..1a81a0a34f1b872044b483da59ce2f6c36569968 100644 (file)
 #include <uuid.h>
 
 /* Standard Service UUID */
-DEFINE_SVC_UUID(arm_svc_uid,
-               0x108d905b, 0xf863, 0x47e8, 0xae, 0x2d,
-               0xc0, 0xfb, 0x56, 0x41, 0xf6, 0xe2);
+static uuid_t arm_svc_uid = {
+       {0x5b, 0x90, 0x8d, 0x10},
+       {0x63, 0xf8},
+       {0xe8, 0x47},
+       0xae, 0x2d,
+       {0xc0, 0xfb, 0x56, 0x41, 0xf6, 0xe2}
+};
 
 /* Setup Standard Services */
 static int32_t std_svc_setup(void)
index e4348ee857b7a597f7c704eb8ca9b2f7d04c529a..0d4f929bb582d25d68c9f923f0c57d65bad7529a 100644 (file)
@@ -51,7 +51,7 @@ static cmd_t cmds[] = {
 
 static image_desc_t *image_desc_head;
 static size_t nr_image_descs;
-static uuid_t uuid_null = { 0 };
+static const uuid_t uuid_null;
 static int verbose;
 
 static void vlog(int prio, const char *msg, va_list ap)
@@ -241,14 +241,15 @@ static void uuid_to_str(char *s, size_t len, const uuid_t *u)
 {
        assert(len >= (_UUID_STR_LEN + 1));
 
-       snprintf(s, len, "%08X-%04X-%04X-%04X-%04X%04X%04X",
-           u->time_low,
-           u->time_mid,
-           u->time_hi_and_version,
-           ((uint16_t)u->clock_seq_hi_and_reserved << 8) | u->clock_seq_low,
-           ((uint16_t)u->node[0] << 8) | u->node[1],
-           ((uint16_t)u->node[2] << 8) | u->node[3],
-           ((uint16_t)u->node[4] << 8) | u->node[5]);
+       snprintf(s, len,
+           "%02X%02X%02X%02X-%02X%02X-%02X%02X-%04X-%04X%04X%04X",
+           u->time_low[0], u->time_low[1], u->time_low[2], u->time_low[3],
+           u->time_mid[0], u->time_mid[1],
+           u->time_hi_and_version[0], u->time_hi_and_version[1],
+           (u->clock_seq_hi_and_reserved << 8) | u->clock_seq_low,
+           (u->node[0] << 8) | u->node[1],
+           (u->node[2] << 8) | u->node[3],
+           (u->node[4] << 8) | u->node[5]);
 }
 
 static void uuid_from_str(uuid_t *u, const char *s)
@@ -261,10 +262,14 @@ static void uuid_from_str(uuid_t *u, const char *s)
                log_errx("Invalid UUID: %s", s);
 
        n = sscanf(s,
-           "%8x-%4hx-%4hx-%2hhx%2hhx-%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
-           &u->time_low, &u->time_mid, &u->time_hi_and_version,
-           &u->clock_seq_hi_and_reserved, &u->clock_seq_low, &u->node[0],
-           &u->node[1], &u->node[2], &u->node[3], &u->node[4], &u->node[5]);
+           "%2hhx%2hhx%2hhx%2hhx-%2hhx%2hhx-%2hhx%2hhx-%2hhx%2hhx-%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
+           &u->time_low[0], &u->time_low[1], &u->time_low[2], &u->time_low[3],
+           &u->time_mid[0], &u->time_mid[1],
+           &u->time_hi_and_version[0], &u->time_hi_and_version[1],
+           &u->clock_seq_hi_and_reserved, &u->clock_seq_low,
+           &u->node[0], &u->node[1],
+           &u->node[2], &u->node[3],
+           &u->node[4], &u->node[5]);
        /*
         * Given the format specifier above, we expect 11 items to be scanned
         * for a properly formatted UUID.
@@ -697,7 +702,7 @@ static int create_cmd(int argc, char *argv[])
                case 'b': {
                        char name[_UUID_STR_LEN + 1];
                        char filename[PATH_MAX] = { 0 };
-                       uuid_t uuid = { 0 };
+                       uuid_t uuid = uuid_null;
                        image_desc_t *desc;
 
                        parse_blob_opt(optarg, &uuid,
@@ -794,7 +799,7 @@ static int update_cmd(int argc, char *argv[])
                case 'b': {
                        char name[_UUID_STR_LEN + 1];
                        char filename[PATH_MAX] = { 0 };
-                       uuid_t uuid = { 0 };
+                       uuid_t uuid = uuid_null;
                        image_desc_t *desc;
 
                        parse_blob_opt(optarg, &uuid,
@@ -902,7 +907,7 @@ static int unpack_cmd(int argc, char *argv[])
                case 'b': {
                        char name[_UUID_STR_LEN + 1];
                        char filename[PATH_MAX] = { 0 };
-                       uuid_t uuid = { 0 };
+                       uuid_t uuid = uuid_null;
                        image_desc_t *desc;
 
                        parse_blob_opt(optarg, &uuid,
@@ -1041,7 +1046,7 @@ static int remove_cmd(int argc, char *argv[])
                        break;
                case 'b': {
                        char name[_UUID_STR_LEN + 1], filename[PATH_MAX];
-                       uuid_t uuid = { 0 };
+                       uuid_t uuid = uuid_null;
                        image_desc_t *desc;
 
                        parse_blob_opt(optarg, &uuid,
index c7df243a72356f8149e62b7d30e8c8f6c30322cd..86b8581f8615f75985c2021ac6a92a9191506ce5 100644 (file)
@@ -153,7 +153,7 @@ toc_entry_t toc_entries[] = {
        },
        {
                .name = NULL,
-               .uuid = { 0 },
+               .uuid = { {0} },
                .cmdline_name = NULL,
        }
 };