summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2008-08-21 18:34:24 +0000
committerWerner Koch <wk@gnupg.org>2008-08-21 18:34:24 +0000
commit393d3b3b0cb80223cde9be75a6a10169e37c5778 (patch)
treec0b11bfebc8687f8fe888d6502fe1eede1857ade /src/misc.c
parent2f818ed3f919a9f8f565b67007b194fa953e7d9b (diff)
downloadlibgcrypt-393d3b3b0cb80223cde9be75a6a10169e37c5778.tar.gz
Finished the X9.31 RNG implementations.
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/misc.c b/src/misc.c
index cbb59e1d..545463bd 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -250,6 +250,7 @@ _gcry_log_debug( const char *fmt, ... )
va_end(arg_ptr);
}
+
void
_gcry_log_printf (const char *fmt, ...)
{
@@ -263,6 +264,26 @@ _gcry_log_printf (const char *fmt, ...)
}
}
+/* Print a hexdump of BUFFER. With TEXT of NULL print just the raw
+ dump, with TEXT an empty string, print a trailing linefeed,
+ otherwise print an entire debug line. */
+void
+_gcry_log_printhex (const char *text, const void *buffer, size_t length)
+{
+ if (text && *text)
+ log_debug ("%s ", text);
+ if (length)
+ {
+ const unsigned char *p = buffer;
+ log_printf ("%02X", *p);
+ for (length--, p++; length--; p++)
+ log_printf (" %02X", *p);
+ }
+ if (text)
+ log_printf ("\n");
+}
+
+
void
_gcry_burn_stack (int bytes)
{