masqmail

diff src/md5/hmac_md5.c @ 209:10da50168dab

replaced the MD5 implementation with the one of Solar Designer Until now, the sample code of RFC 1321 was used. It had an ugly license. Now we use the implementation of Solar Designer, which is in the Public Domain. http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
author meillo@marmaro.de
date Sun, 18 Jul 2010 21:58:15 +0200
parents 26e34ae9a3e3
children 0f36c0a46f82
line diff
     1.1 --- a/src/md5/hmac_md5.c	Sun Jul 18 21:49:15 2010 +0200
     1.2 +++ b/src/md5/hmac_md5.c	Sun Jul 18 21:58:15 2010 +0200
     1.3 @@ -3,7 +3,6 @@
     1.4  */
     1.5  
     1.6  #include <string.h>
     1.7 -#include "global.h"
     1.8  #include "md5.h"
     1.9  #include "hmac_md5.h"
    1.10  
    1.11 @@ -25,9 +24,9 @@
    1.12  
    1.13  		MD5_CTX tctx;
    1.14  
    1.15 -		MD5Init(&tctx);
    1.16 -		MD5Update(&tctx, key, key_len);
    1.17 -		MD5Final(tk, &tctx);
    1.18 +		MD5_Init(&tctx);
    1.19 +		MD5_Update(&tctx, key, key_len);
    1.20 +		MD5_Final(tk, &tctx);
    1.21  
    1.22  		key = tk;
    1.23  		key_len = 16;
    1.24 @@ -58,15 +57,15 @@
    1.25  	/*
    1.26  	 * perform inner MD5
    1.27  	 */
    1.28 -	MD5Init(&context);  /* init context for 1st pass */
    1.29 -	MD5Update(&context, k_ipad, 64);  /* start with inner pad */
    1.30 -	MD5Update(&context, text, text_len);  /* then text of datagram */
    1.31 -	MD5Final(digest, &context);  /* finish up 1st pass */
    1.32 +	MD5_Init(&context);  /* init context for 1st pass */
    1.33 +	MD5_Update(&context, k_ipad, 64);  /* start with inner pad */
    1.34 +	MD5_Update(&context, text, text_len);  /* then text of datagram */
    1.35 +	MD5_Final(digest, &context);  /* finish up 1st pass */
    1.36  	/*
    1.37  	 * perform outer MD5
    1.38  	 */
    1.39 -	MD5Init(&context);  /* init context for 2nd pass */
    1.40 -	MD5Update(&context, k_opad, 64);  /* start with outer pad */
    1.41 -	MD5Update(&context, digest, 16);  /* then results of 1st hash */
    1.42 -	MD5Final(digest, &context); /* finish up 2nd pass */
    1.43 +	MD5_Init(&context);  /* init context for 2nd pass */
    1.44 +	MD5_Update(&context, k_opad, 64);  /* start with outer pad */
    1.45 +	MD5_Update(&context, digest, 16);  /* then results of 1st hash */
    1.46 +	MD5_Final(digest, &context); /* finish up 2nd pass */
    1.47  }