--- pgp/src/mdfile.c 2018/04/24 16:39:05 1.1.1.3 +++ pgp/src/mdfile.c 2018/04/24 16:39:56 1.1.1.4 @@ -87,14 +87,16 @@ int MDfile(MD5_CTX *mdContext,char *file return(0); } -/* Finish the MD5 calculation with an extra buffer implicitly appended - * to the data. +/* Add a buffer's worth of data to the MD5 computation. If a digest + * pointer is supplied, complete the computation and write the digest. */ -void MD_addbuffer (MD5_CTX *mdContext, byte *buf, int buflen, boolean finish) +void MD_addbuffer (MD5_CTX *mdContext, byte *buf, int buflen, byte digest[16]) { MD5Update(mdContext,buf,buflen); - if (finish) - MD5Final(mdContext); + if (digest) { + MD5Final(digest, mdContext); + burn(*mdContext); /* Paranoia */ + } } /* End MD5 routines */