summaryrefslogtreecommitdiffstats
path: root/cpukit/libtest
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-24 14:45:47 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-26 09:10:09 +0100
commitc96644e873799b4787036b25ff30587697d67b3c (patch)
tree41b5a5bf470addda8e8f3d33431ce05618f23d02 /cpukit/libtest
parentlibtest: Report target hash (diff)
downloadrtems-c96644e873799b4787036b25ff30587697d67b3c.tar.bz2
libtest: Print SHA256 hash in base64url
Diffstat (limited to 'cpukit/libtest')
-rw-r--r--cpukit/libtest/t-test-hash-sha256.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/cpukit/libtest/t-test-hash-sha256.c b/cpukit/libtest/t-test-hash-sha256.c
index 25584cce14..32e946b4cf 100644
--- a/cpukit/libtest/t-test-hash-sha256.c
+++ b/cpukit/libtest/t-test-hash-sha256.c
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (C) 2019 embedded brains GmbH
+ * Copyright (C) 2019, 2021 embedded brains GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,6 +26,9 @@
*/
#include <rtems/test.h>
+#include <rtems/score/io.h>
+
+#include <limits.h>
#if defined(__rtems__)
#include <sha256.h>
@@ -69,16 +72,12 @@ T_report_hash_sha256_finalize(void)
{
T_report_hash_sha256_context *ctx;
unsigned char hash[32];
- size_t i;
ctx = &T_report_hash_sha256_instance;
SHA256_Final(hash, &ctx->sha256);
T_printf("Y:ReportHash:SHA256:");
-
- for (i = 0; i < 32; ++i) {
- T_printf("%02x", hash[i]);
- }
-
+ (void)_IO_Base64url(ctx->putchar, ctx->putchar_arg, hash,
+ sizeof(hash), NULL, INT_MAX);
T_printf("\n");
}