Move print_buf into mbedtls_test_print_buf helper function in sample programs
Reduce code duplication and fix missing-prototype error for print_buf
Signed-off-by: Michael Schuster <michael@schuster.ms>
diff --git a/tests/src/helpers.c b/tests/src/helpers.c
index 065d17d..29b2df5 100644
--- a/tests/src/helpers.c
+++ b/tests/src/helpers.c
@@ -660,6 +660,15 @@
return ret;
}
+void mbedtls_test_print_buf(const char *title, unsigned char *buf, size_t len)
+{
+ printf("%s:", title);
+ for (size_t i = 0; i < len; i++) {
+ printf(" %02x", buf[i]);
+ }
+ printf("\n");
+}
+
#if defined(MBEDTLS_TEST_HOOKS)
void mbedtls_test_err_add_check(int high, int low,
const char *file, int line)