From fd72d1cb02044e3ec19193206e22082fc4faca48 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 9 Nov 2004 22:39:25 +0000 Subject: [PATCH] Add an underscore to the MD5 routine names so they can more easily be replaced by the openssl versions. --- pppd/chap-md5.c | 22 +++++++++++----------- pppd/eap.c | 22 +++++++++++----------- pppd/md5.c | 16 ++++++++-------- pppd/md5.h | 6 +++--- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/pppd/chap-md5.c b/pppd/chap-md5.c index b1f6ca0..bc69778 100644 --- a/pppd/chap-md5.c +++ b/pppd/chap-md5.c @@ -28,7 +28,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: chap-md5.c,v 1.3 2004/11/04 10:02:26 paulus Exp $" +#define RCSID "$Id: chap-md5.c,v 1.4 2004/11/09 22:39:25 paulus Exp $" #include #include @@ -68,11 +68,11 @@ chap_md5_verify_response(int id, char *name, response_len = *response++; if (response_len == MD5_HASH_SIZE) { /* Generate hash of ID, secret, challenge */ - MD5Init(&ctx); - MD5Update(&ctx, &idbyte, 1); - MD5Update(&ctx, secret, secret_len); - MD5Update(&ctx, challenge, challenge_len); - MD5Final(hash, &ctx); + MD5_Init(&ctx); + MD5_Update(&ctx, &idbyte, 1); + MD5_Update(&ctx, secret, secret_len); + MD5_Update(&ctx, challenge, challenge_len); + MD5_Final(hash, &ctx); /* Test if our hash matches the peer's response */ if (memcmp(hash, response, MD5_HASH_SIZE) == 0) { @@ -93,11 +93,11 @@ chap_md5_make_response(unsigned char *response, int id, char *our_name, unsigned char idbyte = id; int challenge_len = *challenge++; - MD5Init(&ctx); - MD5Update(&ctx, &idbyte, 1); - MD5Update(&ctx, secret, secret_len); - MD5Update(&ctx, challenge, challenge_len); - MD5Final(&response[1], &ctx); + MD5_Init(&ctx); + MD5_Update(&ctx, &idbyte, 1); + MD5_Update(&ctx, secret, secret_len); + MD5_Update(&ctx, challenge, challenge_len); + MD5_Final(&response[1], &ctx); response[0] = MD5_HASH_SIZE; } diff --git a/pppd/eap.c b/pppd/eap.c index 6a50a59..6203f94 100644 --- a/pppd/eap.c +++ b/pppd/eap.c @@ -43,7 +43,7 @@ * Based on draft-ietf-pppext-eap-srp-03.txt. */ -#define RCSID "$Id: eap.c,v 1.3 2003/06/11 23:56:26 paulus Exp $" +#define RCSID "$Id: eap.c,v 1.4 2004/11/09 22:39:25 paulus Exp $" /* * TODO: @@ -1445,13 +1445,13 @@ int len; eap_send_nak(esp, id, EAPT_SRP); break; } - MD5Init(&mdContext); + MD5_Init(&mdContext); typenum = id; - MD5Update(&mdContext, &typenum, 1); - MD5Update(&mdContext, secret, secret_len); + MD5_Update(&mdContext, &typenum, 1); + MD5_Update(&mdContext, secret, secret_len); BZERO(secret, sizeof (secret)); - MD5Update(&mdContext, inp, vallen); - MD5Final(hash, &mdContext); + MD5_Update(&mdContext, inp, vallen); + MD5_Final(hash, &mdContext); eap_chap_response(esp, id, hash, esp->es_client.ea_name, esp->es_client.ea_namelen); break; @@ -1871,12 +1871,12 @@ int len; eap_send_failure(esp); break; } - MD5Init(&mdContext); - MD5Update(&mdContext, &esp->es_server.ea_id, 1); - MD5Update(&mdContext, secret, secret_len); + MD5_Init(&mdContext); + MD5_Update(&mdContext, &esp->es_server.ea_id, 1); + MD5_Update(&mdContext, secret, secret_len); BZERO(secret, sizeof (secret)); - MD5Update(&mdContext, esp->es_challenge, esp->es_challen); - MD5Final(hash, &mdContext); + MD5_Update(&mdContext, esp->es_challenge, esp->es_challen); + MD5_Final(hash, &mdContext); if (BCMP(hash, inp, MD5_SIGNATURE_SIZE) != 0) { eap_send_failure(esp); break; diff --git a/pppd/md5.c b/pppd/md5.c index 52c113a..2039760 100644 --- a/pppd/md5.c +++ b/pppd/md5.c @@ -40,9 +40,9 @@ *********************************************************************** ** Message-digest routines: ** ** To form the message digest for a message M ** - ** (1) Initialize a context buffer mdContext using MD5Init ** - ** (2) Call MD5Update on mdContext and M ** - ** (3) Call MD5Final on mdContext ** + ** (1) Initialize a context buffer mdContext using MD5_Init ** + ** (2) Call MD5_Update on mdContext and M ** + ** (3) Call MD5_Final on mdContext ** ** The message digest is now in mdContext->digest[0...15] ** *********************************************************************** */ @@ -99,10 +99,10 @@ static unsigned char PADDING[64] = { #define UL(x) x #endif -/* The routine MD5Init initializes the message-digest context +/* The routine MD5_Init initializes the message-digest context mdContext. All fields are set to zero. */ -void MD5Init (mdContext) +void MD5_Init (mdContext) MD5_CTX *mdContext; { mdContext->i[0] = mdContext->i[1] = (UINT4)0; @@ -119,7 +119,7 @@ MD5_CTX *mdContext; account for the presence of each of the characters inBuf[0..inLen-1] in the message whose digest is being computed. */ -void MD5Update (mdContext, inBuf, inLen) +void MD5_Update (mdContext, inBuf, inLen) MD5_CTX *mdContext; unsigned char *inBuf; unsigned int inLen; @@ -157,7 +157,7 @@ unsigned int inLen; /* The routine MD5Final terminates the message-digest computation and ends with the desired message digest in mdContext->digest[0...15]. */ -void MD5Final (hash, mdContext) +void MD5_Final (hash, mdContext) unsigned char hash[]; MD5_CTX *mdContext; { @@ -175,7 +175,7 @@ MD5_CTX *mdContext; /* pad out to 56 mod 64 */ padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi); - MD5Update (mdContext, PADDING, padLen); + MD5_Update (mdContext, PADDING, padLen); /* append length in bits and transform */ for (i = 0, ii = 0; i < 14; i++, ii += 4) diff --git a/pppd/md5.h b/pppd/md5.h index 57908dd..f7a0c96 100644 --- a/pppd/md5.h +++ b/pppd/md5.h @@ -57,9 +57,9 @@ typedef struct { unsigned char digest[16]; /* actual digest after MD5Final call */ } MD5_CTX; -void MD5Init (); -void MD5Update (); -void MD5Final (); +void MD5_Init (); +void MD5_Update (); +void MD5_Final (); #define __MD5_INCLUDE__ #endif /* __MD5_INCLUDE__ */ -- 2.39.2