Patch to avoid conflicts with OpenSSL headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm not sure of your preferred process for submitting patches, so
please advise if this isn't it.

The attached git patch renames the MD5_CTX structure to avoid
conflicts with OpenSSL:

    Rename MD5_CTX to SASL_MD5_CTX.

    Both this code and OpenSSL picked up the same MD5 naming from
    twenty-five years ago. Since C doesn't have namespaces, this causes
    conflicts when headers from cyrus-sasl and OpenSSL are included in the
    same file. This is fairly common and, indeed, occurs within several
    plugins included in cyrus-sasl.

    This change renames the MD5_CTX structure in cyrus-sasl to SASL_MD5_CTX
    to avoid this conflict. It also removes the workarounds that several
    plugins needed in order to use OpenSSL.


Cheers

AGL

-- 
Adam Langley agl@xxxxxxxxxxxxxxxxxx http://www.imperialviolet.org
From 52e01415a24c11193271f6de466cac2bae4908e1 Mon Sep 17 00:00:00 2001
From: Adam Langley <agl@xxxxxxxxxx>
Date: Fri, 29 Jan 2016 11:39:57 -0800
Subject: [PATCH] Rename MD5_CTX to SASL_MD5_CTX.

Both this code and OpenSSL picked up the same MD5 naming from
twenty-five years ago. Since C doesn't have namespaces, this causes
conflicts when headers from cyrus-sasl and OpenSSL are included in the
same file. This is fairly common and, indeed, occurs within several
plugins included in cyrus-sasl.

This change renames the MD5_CTX structure in cyrus-sasl to SASL_MD5_CTX
to avoid this conflict. It also removes the workarounds that several
plugins needed in order to use OpenSSL.
---
 COPYING                   |  1 +
 include/hmac-md5.h        |  2 +-
 include/md5.h             |  8 ++++----
 include/saslplug.h        |  8 +++-----
 lib/checkpw.c             |  4 ++--
 lib/md5.c                 | 12 ++++++------
 plugins/digestmd5.c       | 16 ++++++++--------
 plugins/ntlm.c            |  1 -
 plugins/otp.c             |  2 --
 plugins/passdss.c         |  1 -
 plugins/srp.c             |  1 -
 saslauthd/cache.c         |  2 +-
 saslauthd/md5.c           | 12 ++++++------
 saslauthd/saslauthd_md5.h |  8 ++++----
 utils/testsuite.c         |  2 +-
 15 files changed, 37 insertions(+), 43 deletions(-)

diff --git a/COPYING b/COPYING
index 3f56f30..a9f926e 100644
--- a/COPYING
+++ b/COPYING
@@ -1,14 +1,15 @@
 /* CMU libsasl
  * Tim Martin
  * Rob Earhart
  * Rob Siemborski
+ * Google Inc.
  */
 /* 
  * Copyright (c) 1998-2003 Carnegie Mellon University.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer. 
diff --git a/include/hmac-md5.h b/include/hmac-md5.h
index babe003..39d3083 100755
--- a/include/hmac-md5.h
+++ b/include/hmac-md5.h
@@ -1,21 +1,21 @@
 /* hmac-md5.h -- HMAC_MD5 functions
  */
 
 #ifndef HMAC_MD5_H
 #define HMAC_MD5_H 1
 
 #define HMAC_MD5_SIZE 16
 
 /* intermediate MD5 context */
 typedef struct HMAC_MD5_CTX_s {
-    MD5_CTX ictx, octx;
+    SASL_MD5_CTX ictx, octx;
 } HMAC_MD5_CTX;
 
 /* intermediate HMAC state
  *  values stored in network byte order (Big Endian)
  */
 typedef struct HMAC_MD5_STATE_s {
     UINT4 istate[4];
     UINT4 ostate[4];
 } HMAC_MD5_STATE;
 
diff --git a/include/md5.h b/include/md5.h
index 2f3745d..56990c8 100644
--- a/include/md5.h
+++ b/include/md5.h
@@ -20,23 +20,23 @@ software for any particular purpose. It is provided "as is"
 without express or implied warranty of any kind.
 These notices must be retained in any copies of any part of this
 documentation and/or software.
  */
 
 /* MD5 context. */
 typedef struct {
   UINT4 state[4];                                   /* state (ABCD) */
   UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */
   unsigned char buffer[64];                         /* input buffer */
-} MD5_CTX;
+} SASL_MD5_CTX;
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void _sasl_MD5Init (MD5_CTX *);
-void _sasl_MD5Update (MD5_CTX *, const unsigned char *, unsigned int);
-void _sasl_MD5Final (unsigned char [16], MD5_CTX *);
+void _sasl_MD5Init (SASL_MD5_CTX *);
+void _sasl_MD5Update (SASL_MD5_CTX *, const unsigned char *, unsigned int);
+void _sasl_MD5Final (unsigned char [16], SASL_MD5_CTX *);
 
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/saslplug.h b/include/saslplug.h
index 29302e8..b75c5cb 100755
--- a/include/saslplug.h
+++ b/include/saslplug.h
@@ -1,22 +1,20 @@
 /* saslplug.h --  API for SASL plug-ins
  */
 
 #ifndef SASLPLUG_H
 #define SASLPLUG_H 1
 
 #ifndef MD5GLOBAL_H
 #include "md5global.h"
 #endif
-#ifndef MD5_H
 #include "md5.h"
-#endif
 #ifndef HMAC_MD5_H
 #include "hmac-md5.h"
 #endif
 #ifndef PROP_H
 #include "prop.h"
 #endif
 
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -64,23 +62,23 @@ typedef struct sasl_utils {
     sasl_realloc_t *realloc;
     sasl_free_t *free;
 
     /* mutex functions: */
     sasl_mutex_alloc_t *mutex_alloc;
     sasl_mutex_lock_t *mutex_lock;
     sasl_mutex_unlock_t *mutex_unlock;
     sasl_mutex_free_t *mutex_free;
 
     /* MD5 hash and HMAC functions */
-    void (*MD5Init)(MD5_CTX *);
-    void (*MD5Update)(MD5_CTX *, const unsigned char *text, unsigned int len);
-    void (*MD5Final)(unsigned char [16], MD5_CTX *);
+    void (*MD5Init)(SASL_MD5_CTX *);
+    void (*MD5Update)(SASL_MD5_CTX *, const unsigned char *text, unsigned int len);
+    void (*MD5Final)(unsigned char [16], SASL_MD5_CTX *);
     void (*hmac_md5)(const unsigned char *text, int text_len,
 		     const unsigned char *key, int key_len,
 		     unsigned char [16]);
     void (*hmac_md5_init)(HMAC_MD5_CTX *, const unsigned char *key, int len);
     /* hmac_md5_update() is just a call to MD5Update on inner context */
     void (*hmac_md5_final)(unsigned char [16], HMAC_MD5_CTX *);
     void (*hmac_md5_precalc)(HMAC_MD5_STATE *,
 			     const unsigned char *key, int len);
     void (*hmac_md5_import)(HMAC_MD5_CTX *, HMAC_MD5_STATE *);
 
diff --git a/lib/checkpw.c b/lib/checkpw.c
index d371f3f..a78267e 100644
--- a/lib/checkpw.c
+++ b/lib/checkpw.c
@@ -99,21 +99,21 @@
 /* we store the following secret to check plaintext passwords:
  *
  * <salt> \0 <secret>
  *
  * where <secret> = MD5(<salt>, "sasldb", <pass>)
  */
 static int _sasl_make_plain_secret(const char *salt, 
 				   const char *passwd, size_t passlen,
 				   sasl_secret_t **secret)
 {
-    MD5_CTX ctx;
+    SASL_MD5_CTX ctx;
     unsigned sec_len = 16 + 1 + 16; /* salt + "\0" + hash */
 
     *secret = (sasl_secret_t *) sasl_ALLOC(sizeof(sasl_secret_t) +
 					   sec_len * sizeof(char));
     if (*secret == NULL) {
 	return SASL_NOMEM;
     }
 
     _sasl_MD5Init(&ctx);
     _sasl_MD5Update(&ctx, salt, 16);
@@ -337,21 +337,21 @@ int _sasl_auxprop_verify_apop(sasl_conn_t *conn,
 			      const char *user_realm __attribute__((unused)))
 {
     int ret = SASL_BADAUTH;
     char *userid = NULL;
     char *realm = NULL;
     unsigned char digest[16];
     char digeststr[33];
     const char *password_request[] = { SASL_AUX_PASSWORD, NULL };
     struct propval auxprop_values[2];
     sasl_server_conn_t *sconn = (sasl_server_conn_t *)conn;
-    MD5_CTX ctx;
+    SASL_MD5_CTX ctx;
     int i;
 
     if (!conn || !userstr || !challenge || !response)
        PARAMERROR(conn)
 
     /* We've done the auxprop lookup already (in our caller) */
     /* sadly, APOP has no provision for storing secrets */
     ret = prop_getnames(sconn->sparams->propctx, password_request,
 			auxprop_values);
     if(ret < 0) {
diff --git a/lib/md5.c b/lib/md5.c
index fbe7ae8..fd0da9f 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -92,37 +92,37 @@ Rotation is separate from addition to prevent recomputation.
 
 #define FF(a, b, c, d, x, s, ac) { (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s));        (a) += (b);        } 
 #define GG(a, b, c, d, x, s, ac) {        (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac);        (a) = ROTATE_LEFT ((a), (s));        (a) += (b);         } 
 #define HH(a, b, c, d, x, s, ac) {        (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac);        (a) = ROTATE_LEFT ((a), (s));        (a) += (b);        } 
 #define II(a, b, c, d, x, s, ac) {        (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac);        (a) = ROTATE_LEFT ((a), (s));        (a) += (b);        } 
 
 /* MD5 initialization. Begins an MD5 operation, writing a new context.
 */
 
 void _sasl_MD5Init (context)
-MD5_CTX *context; /* context */
+SASL_MD5_CTX *context; /* context */
 {
        context->count[0] = context->count[1] = 0; 
 
        /* Load magic initialization constants. */
        context->state[0] = 0x67452301; 
        context->state[1] = 0xefcdab89; 
        context->state[2] = 0x98badcfe; 
        context->state[3] = 0x10325476; 
 }
 
 /* MD5 block update operation. Continues an MD5 message-digest
        operation, processing another message block, and updating the context. 
 */
 
 void _sasl_MD5Update (context, input, inputLen)
-MD5_CTX *context; /* context */
+SASL_MD5_CTX *context; /* context */
 const unsigned char *input; /* input block */
 unsigned int inputLen; /* length of input block */
 {
        unsigned int i, index, partLen; 
 
          /* Compute number of bytes mod 64 */
          index = (unsigned int)((context->count[0] >> 3) & 0x3F);
 
          /* Update number of bits */
          if ((context->count[0] += ((UINT4)inputLen << 3))
@@ -154,21 +154,21 @@ unsigned int inputLen; /* length of input block */
          inputLen-i);
 
 }
 
 /* MD5 finalization. Ends an MD5 message-digest operation, writing the
        the message digest and zeroizing the context. 
 */
 
 void _sasl_MD5Final (digest, context)
 unsigned char digest[16]; /* message digest */
-MD5_CTX *context; /* context */
+SASL_MD5_CTX *context; /* context */
 {
        unsigned char bits[8]; 
        unsigned int index, padLen; 
 
          /* Save number of bits */
          Encode (bits, context->count, 8);
 
          /* Pad out to 56 mod 64. */
 	 index = (unsigned int)((context->count[0] >> 3) & 0x3f); 
 	 padLen = (index < 56) ? (56 - index) : (120 - index); 
@@ -350,21 +350,21 @@ void _sasl_hmac_md5_init(HMAC_MD5_CTX *hmac,
 				* key XORd with ipad
 				*/
   unsigned char k_opad[65];    /* outer padding -
 				* key XORd with opad
 				*/
   unsigned char tk[16];
   int i;
   /* if key is longer than 64 bytes reset it to key=MD5(key) */
   if (key_len > 64) {
     
-    MD5_CTX      tctx;
+    SASL_MD5_CTX      tctx;
 
     _sasl_MD5Init(&tctx); 
     _sasl_MD5Update(&tctx, key, key_len); 
     _sasl_MD5Final(tk, &tctx); 
 
     key = tk; 
     key_len = 16; 
   } 
 
   /*
@@ -452,34 +452,34 @@ void _sasl_hmac_md5_final(unsigned char digest[HMAC_MD5_SIZE],
 }
 
 
 void _sasl_hmac_md5(text, text_len, key, key_len, digest)
 const unsigned char* text; /* pointer to data stream */
 int text_len; /* length of data stream */
 const unsigned char* key; /* pointer to authentication key */
 int key_len; /* length of authentication key */
 unsigned char *digest; /* caller digest to be filled in */
 {
-  MD5_CTX context; 
+  SASL_MD5_CTX context;
 
   unsigned char k_ipad[65];    /* inner padding -
 				* key XORd with ipad
 				*/
   unsigned char k_opad[65];    /* outer padding -
 				* key XORd with opad
 				*/
   unsigned char tk[16];
   int i;
   /* if key is longer than 64 bytes reset it to key=MD5(key) */
   if (key_len > 64) {
     
-    MD5_CTX      tctx;
+    SASL_MD5_CTX      tctx;
 
     _sasl_MD5Init(&tctx); 
     _sasl_MD5Update(&tctx, key, key_len); 
     _sasl_MD5Final(tk, &tctx); 
 
     key = tk; 
     key_len = 16; 
   } 
 
   /*
diff --git a/plugins/digestmd5.c b/plugins/digestmd5.c
index 2fb0550..c8aac62 100644
--- a/plugins/digestmd5.c
+++ b/plugins/digestmd5.c
@@ -331,21 +331,21 @@ DigestCalcResponse(const sasl_utils_t * utils,
 		   unsigned int pszNonceCount,	/* 8 hex digits */
 		   unsigned char *pszCNonce,	/* client nonce */
 		   unsigned char *pszQop,	/* qop-value: "", "auth",
 						 * "auth-int" */
 		   unsigned char *pszDigestUri,	/* requested URL */
 		   unsigned char *pszMethod,
 		   HASHHEX HEntity,	/* H(entity body) if qop="auth-int" */
 		   HASHHEX Response	/* request-digest or response-digest */
     )
 {
-    MD5_CTX         Md5Ctx;
+    SASL_MD5_CTX         Md5Ctx;
     HASH            HA2;
     HASH            RespHash;
     HASHHEX         HA2Hex;
     unsigned char ncvalue[10];
     
     /* calculate H(A2) */
     utils->MD5Init(&Md5Ctx);
     
     if (pszMethod != NULL) {
 	utils->MD5Update(&Md5Ctx, pszMethod, (unsigned) strlen((char *) pszMethod));
@@ -398,21 +398,21 @@ static bool UTF8_In_8859_1(const unsigned char *base, size_t len)
     
     /* if scan >= end, then this is a 8859-1 string. */
     return (scan >= end);
 }
 
 /*
  * if the string is entirely in the 8859-1 subset of UTF-8, then translate to
  * 8859-1 prior to MD5
  */
 static void MD5_UTF8_8859_1(const sasl_utils_t * utils,
-			    MD5_CTX * ctx,
+			    SASL_MD5_CTX * ctx,
 			    bool In_ISO_8859_1,
 			    const unsigned char *base,
 			    int len)
 {
     const unsigned char *scan, *end;
     unsigned char   cbuf;
     
     end = base + len;
     
     /* if we found a character outside 8859-1, don't alter string */
@@ -440,21 +440,21 @@ static void MD5_UTF8_8859_1(const sasl_utils_t * utils,
 static bool DigestCalcSecret(const sasl_utils_t * utils,
 		            unsigned char *pszUserName,
 		            unsigned char *pszRealm,
 		            unsigned char *Password,
 		            int PasswordLen,
 		            bool Ignore_8859,
 		            HASH HA1)
 {
     bool            In_8859_1;
     bool            Any_8859_1 = FALSE;
-    MD5_CTX         Md5Ctx;
+    SASL_MD5_CTX         Md5Ctx;
     
     /* Chris Newman clarified that the following text in DIGEST-MD5 spec
        is bogus: "if name and password are both in ISO 8859-1 charset"
        We shoud use code example instead */
     
     utils->MD5Init(&Md5Ctx);
     
     /* We have to convert UTF-8 to ISO-8859-1 if possible */
     if (Ignore_8859 == FALSE) {
 	In_8859_1 = UTF8_In_8859_1(pszUserName, strlen((char *) pszUserName));
@@ -1308,21 +1308,21 @@ struct digest_cipher available_ciphers[] =
 #endif
     { NULL, 0, 0, 0, NULL, NULL, NULL, NULL }
 };
 
 static int create_layer_keys(context_t *text,
 			     const sasl_utils_t *utils,
 			     HASH key, int keylen,
 			     unsigned char enckey[16],
 			     unsigned char deckey[16])
 {
-    MD5_CTX Md5Ctx;
+    SASL_MD5_CTX Md5Ctx;
     
     utils->log(utils->conn, SASL_LOG_DEBUG,
 	       "DIGEST-MD5 create_layer_keys()");
 
     utils->MD5Init(&Md5Ctx);
     utils->MD5Update(&Md5Ctx, key, keylen);
     if (text->i_am == SERVER) {
 	utils->MD5Update(&Md5Ctx, (const unsigned char *) SEALING_SERVER_CLIENT, 
 			 (unsigned) strlen(SEALING_SERVER_CLIENT));
     } else {
@@ -1687,21 +1687,21 @@ typedef struct server_context {
 static digest_glob_context_t server_glob_context;
 
 static void DigestCalcHA1FromSecret(context_t * text,
 				    const sasl_utils_t * utils,
 				    HASH HA1,
 				    unsigned char *authorization_id,
 				    unsigned char *pszNonce,
 				    unsigned char *pszCNonce,
 				    HASHHEX SessionKey)
 {
-    MD5_CTX Md5Ctx;
+    SASL_MD5_CTX Md5Ctx;
     
     /* calculate session key */
     utils->MD5Init(&Md5Ctx);
     if (text->http_mode) {
 	/* per RFC 2617 Errata ID 1649 */
 	HASHHEX HA1Hex;
     
 	CvtHex(HA1, HA1Hex);
 	utils->MD5Update(&Md5Ctx, HA1Hex, HASHHEXLEN);
     }
@@ -1749,21 +1749,21 @@ static char *create_response(context_t * text,
     DigestCalcHA1FromSecret(text,
 			    utils,
 			    Secret,
 			    (unsigned char *) authorization_id,
 			    nonce,
 			    cnonce,
 			    SessionKey);
 
     if (text->http_mode) {
 	/* per RFC 2617 */
-	MD5_CTX Md5Ctx;
+	SASL_MD5_CTX Md5Ctx;
 
 	utils->MD5Init(&Md5Ctx);
 	utils->MD5Update(&Md5Ctx, request->entity, request->elen);
 	utils->MD5Final(EntityHash, &Md5Ctx);
     }
     else {
 	/* per RFC 2831 */
 	memset(EntityHash, 0, HASHLEN);
     }
     CvtHex(EntityHash, HEntity);
@@ -3195,21 +3195,21 @@ static void DigestCalcHA1(context_t * text,
 			  const sasl_utils_t * utils,
 			  char *pszAlg,
 			  unsigned char *pszUserName,
 			  unsigned char *pszRealm,
 			  sasl_secret_t * pszPassword,
 			  unsigned char *pszAuthorization_id,
 			  unsigned char *pszNonce,
 			  unsigned char *pszCNonce,
 			  HASHHEX SessionKey)
 {
-    MD5_CTX         Md5Ctx;
+    SASL_MD5_CTX         Md5Ctx;
     HASH            HA1;
     
     DigestCalcSecret(utils,
 		     pszUserName,
 		     pszRealm,
 		     (unsigned char *) pszPassword->data,
 		     pszPassword->len,
 		     FALSE,
 		     HA1);
     
@@ -3291,21 +3291,21 @@ static char *calculate_response(context_t * text,
 		  username,
 		  realm,
 		  passwd,
 		  authorization_id,
 		  nonce,
 		  cnonce,
 		  SessionKey);
     
     if (text->http_mode) {
 	/* per RFC 2617 */
-	MD5_CTX Md5Ctx;
+	SASL_MD5_CTX Md5Ctx;
 
 	utils->MD5Init(&Md5Ctx);
 	utils->MD5Update(&Md5Ctx, request->entity, request->elen);
 	utils->MD5Final(EntityHash, &Md5Ctx);
     }
     else {
 	/* per RFC 2831 */
 	memset(EntityHash, 0, HASHLEN);
     }
     CvtHex(EntityHash, HEntity);
diff --git a/plugins/ntlm.c b/plugins/ntlm.c
index 79ea47c..700d505 100644
--- a/plugins/ntlm.c
+++ b/plugins/ntlm.c
@@ -86,21 +86,20 @@
 	 DES_set_odd_parity((k))
 # define des_set_key(k,ks) \
 	 DES_set_key((k),&(ks))
 # define des_key_sched(k,ks) \
          DES_key_sched((k),&(ks))
 # define des_ecb_encrypt(i,o,k,e) \
 	 DES_ecb_encrypt((i),(o),&(k),(e))
 #endif /* OpenSSL 0.9.7+ w/o old DES support */
 
 #include <sasl.h>
-#define MD5_H  /* suppress internal MD5 */
 #include <saslplug.h>
 
 #include "plugin_common.h"
 
 /*****************************  Common Section  *****************************/
 
 static const char plugin_id[] = "$Id: ntlm.c,v 1.37 2011/11/08 17:31:55 murch Exp $";
 
 #ifdef WIN32
 static ssize_t writev (SOCKET fd, const struct iovec *iov, size_t iovcnt);
diff --git a/plugins/otp.c b/plugins/otp.c
index dd73065..a1b21c4 100644
--- a/plugins/otp.c
+++ b/plugins/otp.c
@@ -47,24 +47,22 @@
 #include <stdlib.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <errno.h>
 #include <string.h> 
 #include <ctype.h>
 #include <assert.h>
 
 #include <openssl/evp.h>
-#include <openssl/md5.h> /* XXX hack for OpenBSD/OpenSSL cruftiness */
 
 #include <sasl.h>
-#define MD5_H  /* suppress internal MD5 */
 #include <saslplug.h>
 
 #include "plugin_common.h"
 
 #ifdef macintosh 
 #include <sasl_otp_plugin_decl.h> 
 #endif 
 
 /*****************************  Common Section  *****************************/
 
diff --git a/plugins/passdss.c b/plugins/passdss.c
index 4304f48..bf316f6 100644
--- a/plugins/passdss.c
+++ b/plugins/passdss.c
@@ -65,21 +65,20 @@
 #include <openssl/dh.h>
 
 /* for digest and cipher support */
 #include <openssl/evp.h>
 #include <openssl/hmac.h>
 #include <openssl/md5.h>
 #include <openssl/sha.h>
 #include <openssl/dsa.h>
 
 #include <sasl.h>
-#define MD5_H  /* suppress internal MD5 */
 #include <saslplug.h>
 
 #include "plugin_common.h"
 
 #ifdef macintosh 
 #include <sasl_passdss_plugin_decl.h> 
 #endif 
 
 /*****************************  Common Section  *****************************/
 
diff --git a/plugins/srp.c b/plugins/srp.c
index a07561c..1ef5df2 100644
--- a/plugins/srp.c
+++ b/plugins/srp.c
@@ -83,21 +83,20 @@ typedef unsigned short uint32;
 
 /* for big number support */
 #include <openssl/bn.h>
 
 /* for digest and cipher support */
 #include <openssl/evp.h>
 #include <openssl/hmac.h>
 #include <openssl/md5.h>
 
 #include <sasl.h>
-#define MD5_H  /* suppress internal MD5 */
 #include <saslplug.h>
 
 #include "plugin_common.h"
 
 #ifdef macintosh
 #include <sasl_srp_plugin_decl.h>
 #endif 
 
 /*****************************  Common Section  *****************************/
 
diff --git a/saslauthd/cache.c b/saslauthd/cache.c
index 543e176..95aecba 100644
--- a/saslauthd/cache.c
+++ b/saslauthd/cache.c
@@ -157,21 +157,21 @@ int cache_init(void) {
  * the result pointer and expect a later call to
  * cache_commit() to flush the bucket into the table.
  **************************************************************/
 int cache_lookup(const char *user, const char *realm, const char *service, const char *password, struct cache_result *result) {
 
 	int			user_length = 0;
 	int			realm_length = 0;
 	int			service_length = 0;
 	int			hash_offset;
 	unsigned char		pwd_digest[16];
-	MD5_CTX			md5_context;
+	SASL_MD5_CTX			md5_context;
 	time_t			epoch;
 	time_t			epoch_timeout;
 	struct bucket		*ref_bucket;
 	struct bucket		*low_bucket;
 	struct bucket		*high_bucket;
 	struct bucket		*read_bucket = NULL;
 	char			userrealmserv[CACHE_MAX_CREDS_LENGTH];
 	static char		*debug = "[login=%s] [service=%s] [realm=%s]: %s";
 
 
diff --git a/saslauthd/md5.c b/saslauthd/md5.c
index d38425d..6a2345e 100644
--- a/saslauthd/md5.c
+++ b/saslauthd/md5.c
@@ -92,37 +92,37 @@ Rotation is separate from addition to prevent recomputation.
 
 #define FF(a, b, c, d, x, s, ac) { (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s));        (a) += (b);        } 
 #define GG(a, b, c, d, x, s, ac) {        (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac);        (a) = ROTATE_LEFT ((a), (s));        (a) += (b);         } 
 #define HH(a, b, c, d, x, s, ac) {        (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac);        (a) = ROTATE_LEFT ((a), (s));        (a) += (b);        } 
 #define II(a, b, c, d, x, s, ac) {        (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac);        (a) = ROTATE_LEFT ((a), (s));        (a) += (b);        } 
 
 /* MD5 initialization. Begins an MD5 operation, writing a new context.
 */
 
 void _saslauthd_MD5Init (context)
-MD5_CTX *context; /* context */
+SASL_MD5_CTX *context; /* context */
 {
        context->count[0] = context->count[1] = 0; 
 
        /* Load magic initialization constants. */
        context->state[0] = 0x67452301; 
        context->state[1] = 0xefcdab89; 
        context->state[2] = 0x98badcfe; 
        context->state[3] = 0x10325476; 
 }
 
 /* MD5 block update operation. Continues an MD5 message-digest
        operation, processing another message block, and updating the context. 
 */
 
 void _saslauthd_MD5Update (context, input, inputLen)
-MD5_CTX *context; /* context */
+SASL_MD5_CTX *context; /* context */
 unsigned char *input; /* input block */
 unsigned int inputLen; /* length of input block */
 {
        unsigned int i, index, partLen; 
 
          /* Compute number of bytes mod 64 */
          index = (unsigned int)((context->count[0] >> 3) & 0x3F);
 
          /* Update number of bits */
          if ((context->count[0] += ((UINT4)inputLen << 3))
@@ -154,21 +154,21 @@ unsigned int inputLen; /* length of input block */
          inputLen-i);
 
 }
 
 /* MD5 finalization. Ends an MD5 message-digest operation, writing the
        the message digest and zeroizing the context. 
 */
 
 void _saslauthd_MD5Final (digest, context)
 unsigned char digest[16]; /* message digest */
-MD5_CTX *context; /* context */
+SASL_MD5_CTX *context; /* context */
 {
        unsigned char bits[8]; 
        unsigned int index, padLen; 
 
          /* Save number of bits */
          Encode (bits, context->count, 8);
 
          /* Pad out to 56 mod 64. */
 	 index = (unsigned int)((context->count[0] >> 3) & 0x3f); 
 	 padLen = (index < 56) ? (56 - index) : (120 - index); 
@@ -350,21 +350,21 @@ void _saslauthd_hmac_md5_init(HMAC_MD5_CTX *hmac,
 				* key XORd with ipad
 				*/
   unsigned char k_opad[65];    /* outer padding -
 				* key XORd with opad
 				*/
   unsigned char tk[16];
   int i;
   /* if key is longer than 64 bytes reset it to key=MD5(key) */
   if (key_len > 64) {
     
-    MD5_CTX      tctx;
+    SASL_MD5_CTX      tctx;
 
     _saslauthd_MD5Init(&tctx); 
     _saslauthd_MD5Update(&tctx, key, key_len); 
     _saslauthd_MD5Final(tk, &tctx); 
 
     key = tk; 
     key_len = 16; 
   } 
 
   /*
@@ -452,34 +452,34 @@ void _saslauthd_hmac_md5_final(unsigned char digest[HMAC_MD5_SIZE],
 }
 
 
 void _saslauthd_hmac_md5(text, text_len, key, key_len, digest)
 const unsigned char* text; /* pointer to data stream */
 int text_len; /* length of data stream */
 const unsigned char* key; /* pointer to authentication key */
 int key_len; /* length of authentication key */
 unsigned char *digest; /* caller digest to be filled in */
 {
-  MD5_CTX context; 
+  SASL_MD5_CTX context;
 
   unsigned char k_ipad[65];    /* inner padding -
 				* key XORd with ipad
 				*/
   unsigned char k_opad[65];    /* outer padding -
 				* key XORd with opad
 				*/
   unsigned char tk[16];
   int i;
   /* if key is longer than 64 bytes reset it to key=MD5(key) */
   if (key_len > 64) {
     
-    MD5_CTX      tctx;
+    SASL_MD5_CTX      tctx;
 
     _saslauthd_MD5Init(&tctx); 
     _saslauthd_MD5Update(&tctx, key, key_len); 
     _saslauthd_MD5Final(tk, &tctx); 
 
     key = tk; 
     key_len = 16; 
   } 
 
   /*
diff --git a/saslauthd/saslauthd_md5.h b/saslauthd/saslauthd_md5.h
index 1d25449..751dad7 100644
--- a/saslauthd/saslauthd_md5.h
+++ b/saslauthd/saslauthd_md5.h
@@ -20,18 +20,18 @@ software for any particular purpose. It is provided "as is"
 without express or implied warranty of any kind.
 These notices must be retained in any copies of any part of this
 documentation and/or software.
  */
 
 /* MD5 context. */
 typedef struct {
   UINT4 state[4];                                   /* state (ABCD) */
   UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */
   unsigned char buffer[64];                         /* input buffer */
-} MD5_CTX;
+} SASL_MD5_CTX;
 
-void _saslauthd_MD5Init PROTO_LIST ((MD5_CTX *));
+void _saslauthd_MD5Init PROTO_LIST ((SASL_MD5_CTX *));
 void _saslauthd_MD5Update PROTO_LIST
-  ((MD5_CTX *, unsigned char *, unsigned int));
-void _saslauthd_MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
+  ((SASL_MD5_CTX *, unsigned char *, unsigned int));
+void _saslauthd_MD5Final PROTO_LIST ((unsigned char [16], SASL_MD5_CTX *));
 
 void _saslauthd_hmac_md5 PROTO_LIST ((unsigned char *, int, unsigned char *, int, caddr_t));
diff --git a/utils/testsuite.c b/utils/testsuite.c
index 7e4e852..5b595a5 100644
--- a/utils/testsuite.c
+++ b/utils/testsuite.c
@@ -2700,21 +2700,21 @@ void test_seclayer()
 void create_ids(void)
 {
     sasl_conn_t *saslconn;
     int result;
     struct sockaddr_in addr;
     struct hostent *hp;
     char buf[8192];
 #ifdef DO_SASL_CHECKAPOP
     int i;
     const char challenge[] = "<1896.697170952@xxxxxxxxxxxxxxxxxxxx>";
-    MD5_CTX ctx;
+    SASL_MD5_CTX ctx;
     unsigned char digest[16];
     char digeststr[32];
 #endif
 
     if (sasl_server_init(goodsasl_cb,"TestSuite")!=SASL_OK)
 	fatal("can't sasl_server_init in create_ids");
 
     if ((hp = gethostbyname(myhostname)) == NULL) {
         perror("gethostbyname");
         fatal("can't gethostbyname in create_ids");
-- 
2.7.0


[Index of Archives]     [Info Cyrus]     [Squirrel Mail]     [Linux Media]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux