Skip to content

Commit

Permalink
Format UUID strings correctly
Browse files Browse the repository at this point in the history
Prior to this patch although GlobalPlatform specifies that TAs and such
are identified with UUIDs, we don't format them quite right when turning
them into strings. Per https://www.ietf.org/rfc/rfc4122.txt, there
should be another hyphen after the first two bytes of clockSeqAndNode.

Unfortunately, fixing this breaks compatibility between how TAs are
built, and when the OS loads them.

With this patch UUID string are formated with the additional hyphen as
for instance: f81d4fae-7dec-11d0-a765-00a0c91e6bf6

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Fixes: OP-TEE#857
Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU)
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
jenswi-linaro committed Dec 9, 2016
1 parent 77b4246 commit d2f5c00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/libutils/ext/snprintk.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
#define NOLOCK 0x1000 /* don't acquire a tty lock */

/* max size buffer kprintf needs to print a UUID */
#define KPRINTF_BUFSIZE 36
#define KPRINTF_BUFSIZE 37

/*
* The following macro is used to remove const cast-away warnings
Expand Down Expand Up @@ -220,7 +220,7 @@ static int uuid2str(char *dst, size_t size, void *ptr)
} *uuid = ptr;

return snprintk(dst, size,
"%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x",
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
uuid->lo, uuid->mid, uuid->hi_ver,
uuid->seq_n[0], uuid->seq_n[1],
uuid->seq_n[2], uuid->seq_n[3],
Expand Down

0 comments on commit d2f5c00

Please sign in to comment.