Browse Source

Support for the latest version of OpenSSL

rdb 16 years ago
parent
commit
d4dcd9cb12

+ 1 - 0
dtool/src/parser-inc/ssl.h

@@ -10,5 +10,6 @@ struct X509;
 struct X509_STORE;
 struct X509_STORE;
 struct X509_NAME;
 struct X509_NAME;
 struct SSL;
 struct SSL;
+#define STACK_OF(num) STACK
 
 
 #endif
 #endif

+ 2 - 2
panda/src/downloader/httpChannel.cxx

@@ -1610,8 +1610,8 @@ run_ssl_handshake() {
     SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
     SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
   }
   }
 
 
-  SSL_CIPHER *cipher = SSL_get_current_cipher(ssl);
-  if (cipher == (SSL_CIPHER *)NULL) {
+  const SSL_CIPHER *cipher = SSL_get_current_cipher(ssl);
+  if (cipher == (const SSL_CIPHER *)NULL) {
     downloader_cat.warning()
     downloader_cat.warning()
       << "No current cipher on SSL connection.\n";
       << "No current cipher on SSL connection.\n";
   } else {
   } else {

+ 8 - 8
panda/src/express/multifile.cxx

@@ -803,15 +803,15 @@ add_signature(const Filename &composite, const string &password) {
 //               needed.  Returns true on success, false on failure.
 //               needed.  Returns true on success, false on failure.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 bool Multifile::
 bool Multifile::
-add_signature(X509 *certificate, STACK *chain, EVP_PKEY *pkey) {
+add_signature(X509 *certificate, STACK_OF(X509) *chain, EVP_PKEY *pkey) {
   // Convert the certificate and chain into our own CertChain
   // Convert the certificate and chain into our own CertChain
   // structure.
   // structure.
   CertChain cert_chain;
   CertChain cert_chain;
   cert_chain.push_back(CertRecord(certificate));
   cert_chain.push_back(CertRecord(certificate));
   if (chain != NULL) {
   if (chain != NULL) {
-    int num = sk_num(chain);
+    int num = sk_X509_num(chain);
     for (int i = 0; i < num; ++i) {
     for (int i = 0; i < num; ++i) {
-      cert_chain.push_back(CertRecord((X509 *)sk_value(chain, i)));
+      cert_chain.push_back(CertRecord((X509 *)sk_X509_value(chain, i)));
     }
     }
   }
   }
 
 
@@ -1129,13 +1129,13 @@ validate_signature_certificate(int n) const {
   OpenSSLWrapper *sslw = OpenSSLWrapper::get_global_ptr();
   OpenSSLWrapper *sslw = OpenSSLWrapper::get_global_ptr();
 
 
   // Copy our CertChain structure into an X509 pointer and
   // Copy our CertChain structure into an X509 pointer and
-  // accompanying STACK pointer.
+  // accompanying STACK_OF(X509) pointer.
   X509 *x509 = chain[0]._cert;
   X509 *x509 = chain[0]._cert;
-  STACK *stack = NULL;
+  STACK_OF(X509) *stack = NULL;
   if (chain.size() > 1) {
   if (chain.size() > 1) {
-    stack = sk_new(NULL);
+    stack = sk_X509_new(NULL);
     for (size_t n = 1; n < chain.size(); ++n) {
     for (size_t n = 1; n < chain.size(); ++n) {
-      sk_push(stack, (char *)chain[n]._cert);
+      sk_X509_push(stack, chain[n]._cert);
     }
     }
   }
   }
 
 
@@ -1156,7 +1156,7 @@ validate_signature_certificate(int n) const {
       << "\n";
       << "\n";
   }
   }
 
 
-  sk_free(stack);
+  sk_X509_free(stack);
   X509_STORE_CTX_cleanup(ctx);
   X509_STORE_CTX_cleanup(ctx);
   X509_STORE_CTX_free(ctx);
   X509_STORE_CTX_free(ctx);
 
 

+ 1 - 1
panda/src/express/multifile.h

@@ -100,7 +100,7 @@ PUBLISHED:
                      const string &password = "");
                      const string &password = "");
   bool add_signature(const Filename &composite, 
   bool add_signature(const Filename &composite, 
                      const string &password = "");
                      const string &password = "");
-  bool add_signature(X509 *certificate, STACK *chain, EVP_PKEY *pkey);
+  bool add_signature(X509 *certificate, STACK_OF(X509) *chain, EVP_PKEY *pkey);
   bool add_signature(const CertChain &chain, EVP_PKEY *pkey);
   bool add_signature(const CertChain &chain, EVP_PKEY *pkey);
 
 
   int get_num_signatures() const;
   int get_num_signatures() const;

+ 3 - 6
panda/src/nativenet/socket_tcp_ssl.h

@@ -28,12 +28,13 @@ struct SSlStartup
 {
 {
    SSlStartup()
    SSlStartup()
    {
    {
-        SSL_METHOD *meth;
+        const SSL_METHOD *meth;
         SSLeay_add_ssl_algorithms();
         SSLeay_add_ssl_algorithms();
         //meth = SSLv23_server_method();
         //meth = SSLv23_server_method();
         meth = SSLv23_method();
         meth = SSLv23_method();
         SSL_load_error_strings();
         SSL_load_error_strings();
-        global_ssl_ctx = SSL_CTX_new (meth);                        
+        // I hate this cast, but older versions of OpenSSL need it.
+        global_ssl_ctx = SSL_CTX_new ((SSL_METHOD *) meth);                        
    }
    }
 
 
    ~SSlStartup()
    ~SSlStartup()
@@ -324,7 +325,3 @@ inline void Socket_TCP_SSL::DetailErrorFormat(void)
 
 
 #endif //__SOCKET_TCP_SSL_H__
 #endif //__SOCKET_TCP_SSL_H__
 
 
-
-
-
-