Skip to content

Commit e00c923

Browse files
rizlikdanielinux
authored andcommitted
tpm: print_hexstr: workaround for minimal printf implementations
To make wolfBoot_print_hexstr work if printf does not implemenbt width formatters.
1 parent 5191828 commit e00c923

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tpm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ void wolfBoot_print_hexstr(const unsigned char* bin, unsigned long sz,
5050
unsigned long i;
5151
if (maxLine == 0) maxLine = sz;
5252
for (i = 0; i < sz; i++) {
53-
wolfBoot_printf("%02x", bin[i]);
53+
if (bin[i]<=15)
54+
wolfBoot_printf("0");
55+
wolfBoot_printf("%x", bin[i]);
5456
if (((i+1) % maxLine) == 0 && i+1 != sz)
5557
wolfBoot_printf("\n");
5658
}

0 commit comments

Comments
 (0)