--- pgp/src/md5.c 2018/04/24 16:39:07 1.1.1.3 +++ pgp/src/md5.c 2018/04/24 16:39:59 1.1.1.4 @@ -8,6 +8,13 @@ */ /* + * Edited 7 May 93 by CP to change the interface to match that + * of the MD5 routines in RSAREF. Due to this alteration, this + * code is "derived from the RSA Data Security, Inc. MD5 Message- + * Digest Algorithm". (See below.) + */ + +/* *********************************************************************** ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** ** ** @@ -40,7 +47,7 @@ ** (1) Initialize a context buffer mdContext using MD5Init ** ** (2) Call MD5Update on mdContext and M ** ** (3) Call MD5Final on mdContext ** - ** The message digest is now in mdContext->digest[0...15] ** + ** The message digest is now in the bugffer passed to MD5Final ** *********************************************************************** */ @@ -142,7 +149,7 @@ void MD5Update (register MD5_CTX *mdCont /* The routine MD5Final terminates the message-digest computation and ends with the desired message digest in mdContext->digest[0...15]. */ -void MD5Final (MD5_CTX *mdContext) +void MD5Final (unsigned char digest[16], MD5_CTX *mdContext) { UINT4 in[16]; int mdi; @@ -170,13 +177,10 @@ void MD5Final (MD5_CTX *mdContext) /* store buffer in digest */ for (i = 0, ii = 0; i < 4; i++, ii += 4) { - mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF); - mdContext->digest[ii+1] = - (unsigned char)((mdContext->buf[i] >> 8) & 0xFF); - mdContext->digest[ii+2] = - (unsigned char)((mdContext->buf[i] >> 16) & 0xFF); - mdContext->digest[ii+3] = - (unsigned char)((mdContext->buf[i] >> 24) & 0xFF); + digest[ii] = (unsigned char) (mdContext->buf[i] & 0xFF); + digest[ii+1] = (unsigned char)((mdContext->buf[i] >> 8) & 0xFF); + digest[ii+2] = (unsigned char)((mdContext->buf[i] >> 16) & 0xFF); + digest[ii+3] = (unsigned char)((mdContext->buf[i] >> 24) & 0xFF); } }