]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Added again _gnutls_dump_mpi() to assist in debugging.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 29 May 2010 15:29:22 +0000 (17:29 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Thu, 3 Jun 2010 17:55:00 +0000 (19:55 +0200)
lib/debug.c
lib/debug.h

index 037b7feaef6795c82bb018974624fa6b83b54359..726a3d6923ca7e3484721f82bfbb20f2b24153a2 100644 (file)
 #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)
index 341f87cc9011634926cffca177f43969a8053d7f..b0279215e4b88d414fc9deb92e71eaef6ab105bf 100644 (file)
@@ -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);