changeset 764:2202e854d187 ecc

add printmpint() for debugging
author Matt Johnston <matt@ucc.asn.au>
date Mon, 08 Apr 2013 23:12:35 +0800
parents f744321ac048
children 5503e05ab3a4
files dbutil.c dbutil.h
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dbutil.c	Mon Apr 08 23:12:20 2013 +0800
+++ b/dbutil.c	Mon Apr 08 23:12:35 2013 +0800
@@ -651,6 +651,14 @@
 	}
 	fprintf(stderr, "\n");
 }
+
+void printmpint(const char *label, mp_int *mp) {
+	buffer *buf = buf_new(1000);
+	buf_putmpint(buf, mp);
+	printhex(label, buf->data, buf->len);
+	buf_free(buf);
+
+}
 #endif
 
 /* Strip all control characters from text (a null-terminated string), except
--- a/dbutil.h	Mon Apr 08 23:12:20 2013 +0800
+++ b/dbutil.h	Mon Apr 08 23:12:35 2013 +0800
@@ -58,6 +58,7 @@
 #ifdef DEBUG_TRACE
 void dropbear_trace(const char* format, ...) ATTRIB_PRINTF(1,2);
 void printhex(const char * label, const unsigned char * buf, int len);
+void printmpint(const char *label, mp_int *mp);
 extern int debug_trace;
 #endif