1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

added revcation stuff and fixed a couple of bugs

This commit is contained in:
Werner Koch 1998-02-18 13:58:46 +00:00
parent c8bb57d05d
commit b758180325
24 changed files with 441 additions and 117 deletions

View file

@ -1,3 +1,7 @@
Wed Feb 18 14:08:30 1998 Werner Koch (wk@isil.d.shuttle.de)
* md.c, md.h : New debugging support
Mon Feb 16 10:08:47 1998 Werner Koch (wk@isil.d.shuttle.de)
* misc.c (cipher_algo_to_string): New

View file

@ -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 );

View file

@ -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;