You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2005/07/08 17:55:52 UTC

svn commit: r209825 - in /httpd/httpd/branches/2.0.x/modules/ssl: ssl_engine_init.c ssl_scache_dbm.c ssl_scache_shmcb.c ssl_toolkit_compat.h

Author: wrowe
Date: Fri Jul  8 08:55:51 2005
New Revision: 209825

URL: http://svn.apache.org/viewcvs?rev=209825&view=rev
Log:

  Resolve 0.9.6/0.9.7/0.9.8 OpenSSL const discrepancies

Reviewed by: jorton, bnichols, wrowe

Modified:
    httpd/httpd/branches/2.0.x/modules/ssl/ssl_engine_init.c
    httpd/httpd/branches/2.0.x/modules/ssl/ssl_scache_dbm.c
    httpd/httpd/branches/2.0.x/modules/ssl/ssl_scache_shmcb.c
    httpd/httpd/branches/2.0.x/modules/ssl/ssl_toolkit_compat.h

Modified: httpd/httpd/branches/2.0.x/modules/ssl/ssl_engine_init.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/modules/ssl/ssl_engine_init.c?rev=209825&r1=209824&r2=209825&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/modules/ssl/ssl_engine_init.c (original)
+++ httpd/httpd/branches/2.0.x/modules/ssl/ssl_engine_init.c Fri Jul  8 08:55:51 2005
@@ -705,7 +705,7 @@
 {
     SSLModConfigRec *mc = myModConfig(s);
     ssl_asn1_t *asn1;
-    unsigned char *ptr;
+    MODSSL_D2I_X509_CONST unsigned char *ptr;
     const char *type = ssl_asn1_keystr(idx);
     X509 *cert;
 
@@ -743,7 +743,7 @@
 {
     SSLModConfigRec *mc = myModConfig(s);
     ssl_asn1_t *asn1;
-    unsigned char *ptr;
+    MODSSL_D2I_PrivateKey_CONST unsigned char *ptr;
     const char *type = ssl_asn1_keystr(idx);
     int pkey_type = (idx == SSL_AIDX_RSA) ? EVP_PKEY_RSA : EVP_PKEY_DSA;
     EVP_PKEY *pkey;

Modified: httpd/httpd/branches/2.0.x/modules/ssl/ssl_scache_dbm.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/modules/ssl/ssl_scache_dbm.c?rev=209825&r1=209824&r2=209825&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/modules/ssl/ssl_scache_dbm.c (original)
+++ httpd/httpd/branches/2.0.x/modules/ssl/ssl_scache_dbm.c Fri Jul  8 08:55:51 2005
@@ -193,7 +193,7 @@
     apr_datum_t dbmkey;
     apr_datum_t dbmval;
     SSL_SESSION *sess = NULL;
-    UCHAR *ucpData;
+    MODSSL_D2I_SSL_SESSION_CONST unsigned char *ucpData;
     int nData;
     time_t expiry;
     time_t now;
@@ -234,13 +234,15 @@
 
     /* parse resulting data */
     nData = dbmval.dsize-sizeof(time_t);
-    ucpData = (UCHAR *)malloc(nData);
+    ucpData = malloc(nData);
     if (ucpData == NULL) {
         apr_dbm_close(dbm);
         ssl_mutex_off(s);
         return NULL;
     }
-    memcpy(ucpData, (char *)dbmval.dptr+sizeof(time_t), nData);
+    /* Cast needed, ucpData may be const */
+    memcpy((unsigned char *)ucpData, 
+           (char *)dbmval.dptr + sizeof(time_t), nData);
     memcpy(&expiry, dbmval.dptr, sizeof(time_t));
 
     apr_dbm_close(dbm);

Modified: httpd/httpd/branches/2.0.x/modules/ssl/ssl_scache_shmcb.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/modules/ssl/ssl_scache_shmcb.c?rev=209825&r1=209824&r2=209825&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/modules/ssl/ssl_scache_shmcb.c (original)
+++ httpd/httpd/branches/2.0.x/modules/ssl/ssl_scache_shmcb.c Fri Jul  8 08:55:51 2005
@@ -1203,7 +1203,7 @@
     SHMCBHeader *header;
     SSL_SESSION *pSession = NULL;
     unsigned int curr_pos, loop, count;
-    unsigned char *ptr;
+    MODSSL_D2I_SSL_SESSION_CONST unsigned char *ptr;
     time_t now;
 
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
@@ -1281,7 +1281,7 @@
     SHMCBIndex *idx;
     SHMCBHeader *header;
     unsigned int curr_pos, loop, count;
-    unsigned char *ptr;
+    MODSSL_D2I_SSL_SESSION_CONST unsigned char *ptr;
     BOOL to_return = FALSE;
 
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,

Modified: httpd/httpd/branches/2.0.x/modules/ssl/ssl_toolkit_compat.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/modules/ssl/ssl_toolkit_compat.h?rev=209825&r1=209824&r2=209825&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/modules/ssl/ssl_toolkit_compat.h (original)
+++ httpd/httpd/branches/2.0.x/modules/ssl/ssl_toolkit_compat.h Fri Jul  8 08:55:51 2005
@@ -69,6 +69,21 @@
 #define MODSSL_CLIENT_CERT_CB_ARG_TYPE X509
 #define MODSSL_PCHAR_CAST
 
+/* ...shifting sands of openssl... */
+#if (OPENSSL_VERSION_NUMBER >= 0x0090707f)
+# define MODSSL_D2I_SSL_SESSION_CONST    const
+#else
+# define MODSSL_D2I_SSL_SESSION_CONST
+#endif
+
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000)
+# define MODSSL_D2I_PrivateKey_CONST const
+# define MODSSL_D2I_X509_CONST const
+#else
+# define MODSSL_D2I_PrivateKey_CONST
+# define MODSSL_D2I_X509_CONST
+#endif
+
 #define modssl_X509_verify_cert X509_verify_cert
 
 typedef int (modssl_read_bio_cb_fn)(char*,int,int,void*);
@@ -123,6 +138,9 @@
 #define MODSSL_INFO_CB_ARG_TYPE SSL*
 #define MODSSL_CLIENT_CERT_CB_ARG_TYPE void
 #define MODSSL_PCHAR_CAST (char *)
+#define MODSSL_D2I_SSL_SESSION_CONST
+#define MODSSL_D2I_PrivateKey_CONST
+#define MODSSL_D2I_X509_CONST
 
 typedef int (modssl_read_bio_cb_fn)(char*,int,int);