summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2013-04-08 23:12:35 +0800
committerMatt Johnston <matt@ucc.asn.au>2013-04-08 23:12:35 +0800
commita7d1a9cfcb54a29571b504cbfa955b3e34755a72 (patch)
tree02a45cb1b89ad7a34a622ab686cfa41834e2dc62
parent48c83aa9d0f46ec0cdc92a7a3b9cb1e39ffaf2e3 (diff)
add printmpint() for debugging
--HG-- branch : ecc
-rw-r--r--dbutil.c8
-rw-r--r--dbutil.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/dbutil.c b/dbutil.c
index 044388a..f2fe5b9 100644
--- a/dbutil.c
+++ b/dbutil.c
@@ -651,6 +651,14 @@ void printhex(const char * label, const unsigned char * buf, int len) {
}
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
diff --git a/dbutil.h b/dbutil.h
index 0f16bf3..5be3465 100644
--- a/dbutil.h
+++ b/dbutil.h
@@ -58,6 +58,7 @@ void fail_assert(const char* expr, const char* file, int line) ATTRIB_NORETURN;
#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