summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-05-29 17:29:22 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-05-29 17:31:14 +0200
commit09aa8d6267661e8a1b3bbaeb53a91ef9504dacb4 (patch)
tree66a01e7deae6c6744c5f9c6ffa8f121a3fa42a1a
parent9bbf4c92bedf22e2e77aa8d8d4bd9c81f459abea (diff)
downloadgnutls-09aa8d6267661e8a1b3bbaeb53a91ef9504dacb4.tar.gz
Added again _gnutls_dump_mpi() to assist in debugging.
-rw-r--r--lib/debug.c13
-rw-r--r--lib/debug.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/debug.c b/lib/debug.c
index 037b7feaef..726a3d6923 100644
--- a/lib/debug.c
+++ b/lib/debug.c
@@ -28,6 +28,19 @@
#include <stdio.h>
#include <stdlib.h>
#include "debug.h"
+#include <gnutls_mpi.h>
+
+void _gnutls_dump_mpi(const char* prefix, bigint_t a)
+{
+ char buf[400];
+ char buf_hex[2*sizeof(buf)];
+ size_t n = sizeof buf;
+
+ if (_gnutls_mpi_print(a, buf, &n))
+ strcpy(buf, "[can't print value]"); /* Flawfinder: ignore */
+ _gnutls_debug_log( "MPI: length: %d\n\t%s%s\n", (int)n, prefix, _gnutls_bin2hex(buf, n, buf_hex, sizeof(buf_hex), NULL));
+}
+
const char *
_gnutls_packet2str (content_type_t packet)
diff --git a/lib/debug.h b/lib/debug.h
index 341f87cc90..b0279215e4 100644
--- a/lib/debug.h
+++ b/lib/debug.h
@@ -25,3 +25,4 @@
const char *_gnutls_packet2str (content_type_t packet);
const char *_gnutls_handshake2str (gnutls_handshake_description_t handshake);
+void _gnutls_dump_mpi(const char* prefix, bigint_t a);