aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'cipher/md.c')
-rw-r--r--cipher/md.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/cipher/md.c b/cipher/md.c
index 0536fc2fe..87e66d995 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -93,6 +93,8 @@ md_close(MD_HANDLE a)
{
if( !a )
return;
+ if( a->debug )
+ md_stop_debug(a);
m_free(a);
}
@@ -255,3 +257,29 @@ md_asn_oid( int algo, size_t *asnlen, size_t *mdlen )
}
+void
+md_start_debug( MD_HANDLE md, const char *suffix )
+{
+ static int index=0;
+ char buf[25];
+
+ if( md->debug ) {
+ log_debug("Oops: md debug already started\n");
+ return;
+ }
+ index++;
+ sprintf(buf, "dbgmd-%05d.%.10s", index, suffix );
+ md->debug = fopen(buf, "w");
+ if( !md->debug )
+ log_debug("md debug: can't open %s\n", buf );
+}
+
+void
+md_stop_debug( MD_HANDLE md )
+{
+ if( md->debug ) {
+ fclose(md->debug);
+ md->debug = NULL;
+ }
+}
+