aboutsummaryrefslogtreecommitdiffstats
path: root/cipher
diff options
context:
space:
mode:
Diffstat (limited to 'cipher')
-rw-r--r--cipher/ChangeLog4
-rw-r--r--cipher/md.c23
-rw-r--r--cipher/md.h2
3 files changed, 12 insertions, 17 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index e915c3bcc..29626e55e 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,7 @@
+Wed Feb 18 14:08:30 1998 Werner Koch ([email protected])
+
+ * md.c, md.h : New debugging support
+
Mon Feb 16 10:08:47 1998 Werner Koch ([email protected])
* misc.c (cipher_algo_to_string): New
diff --git a/cipher/md.c b/cipher/md.c
index 46083960f..fbae09765 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -27,10 +27,6 @@
#include "cipher.h"
#include "errors.h"
-
-
-/*static FILE *dumpfp;*/
-
/****************
* Open a message digest handle for use with algorithm ALGO.
* More algorithms may be added by md_enable(). The initial algorithm
@@ -41,13 +37,6 @@ md_open( int algo, int secure )
{
MD_HANDLE hd;
- #if 0
- if( !dumpfp )
- dumpfp = fopen("md.out", "w");
- if( !dumpfp )
- BUG();
- { int i; for(i=0; i < 16; i++ ) putc('\xff', dumpfp ); }
- #endif
hd = secure ? m_alloc_secure_clear( sizeof *hd )
: m_alloc_clear( sizeof *hd );
hd->secure = secure;
@@ -81,7 +70,6 @@ md_copy( MD_HANDLE a )
{
MD_HANDLE b;
- /*{ int i; for(i=0; i < 16; i++ ) putc('\xee', dumpfp ); }*/
b = a->secure ? m_alloc_secure( sizeof *b )
: m_alloc( sizeof *b );
memcpy( b, a, sizeof *a );
@@ -101,10 +89,12 @@ md_close(MD_HANDLE a)
void
md_write( MD_HANDLE a, byte *inbuf, size_t inlen)
{
- /* if( a->bufcount && fwrite(a->buffer, a->bufcount, 1, dumpfp ) != 1 )
- BUG();
- if( inlen && fwrite(inbuf, inlen, 1, dumpfp ) != 1 )
- BUG(); */
+ if( a->debug ) {
+ if( a->bufcount && fwrite(a->buffer, a->bufcount, 1, a->debug ) != 1 )
+ BUG();
+ if( inlen && fwrite(inbuf, inlen, 1, a->debug ) != 1 )
+ BUG();
+ }
if( a->use_rmd160 ) {
rmd160_write( &a->rmd160, a->buffer, a->bufcount );
rmd160_write( &a->rmd160, inbuf, inlen );
@@ -127,7 +117,6 @@ md_final(MD_HANDLE a)
{
if( a->bufcount )
md_write( a, NULL, 0 );
- /*{ int i; for(i=0; i < 16; i++ ) putc('\xcc', dumpfp ); }*/
if( a->use_rmd160 ) {
byte *p;
rmd160_final( &a->rmd160 );
diff --git a/cipher/md.h b/cipher/md.h
index fc5d28df6..5903946c2 100644
--- a/cipher/md.h
+++ b/cipher/md.h
@@ -20,6 +20,7 @@
#ifndef G10_MD_H
#define G10_MD_H
+#include <stdio.h>
#include "types.h"
#include "rmd.h"
#include "sha1.h"
@@ -37,6 +38,7 @@ typedef struct {
byte buffer[MD_BUFFER_SIZE]; /* primary buffer */
int bufcount;
int secure;
+ FILE *debug;
} *MD_HANDLE;