Browse Source

openssl version

David Rose 16 years ago
parent
commit
5150c70bfa
3 changed files with 16 additions and 5 deletions
  1. 1 1
      direct/src/plugin/Sources.pp
  2. 3 3
      direct/src/plugin/p3dCert.cxx
  3. 12 1
      direct/src/plugin/p3dCert.h

+ 1 - 1
direct/src/plugin/Sources.pp

@@ -164,7 +164,7 @@
   #define USE_PACKAGES wx openssl
   #define TARGET p3dcert
 
-  #define SOURCES p3dCert.cxx
+  #define SOURCES p3dCert.cxx p3dCert.h
   #define OSX_SYS_FRAMEWORKS Carbon
 
 #end bin_target

+ 3 - 3
direct/src/plugin/p3dCert.cxx

@@ -177,7 +177,7 @@ AuthDialog::
     _cert = NULL;
   }
   if (_stack != NULL) { 
-    sk_free(_stack);
+    sk_X509_free(_stack);
     _stack = NULL;
   }
 }
@@ -273,10 +273,10 @@ read_cert_file(const wxString &cert_filename) {
   }
 
   // Build up a STACK of the remaining certificates in the file.
-  _stack = sk_new(NULL);
+  _stack = sk_X509_new(NULL);
   X509 *c = PEM_read_X509(fp, NULL, NULL, (void *)"");
   while (c != NULL) {
-    sk_push(_stack, (char *)c);
+    sk_X509_push(_stack, c);
     c = PEM_read_X509(fp, NULL, NULL, (void *)"");
   }
 

+ 12 - 1
direct/src/plugin/p3dCert.h

@@ -29,6 +29,17 @@ using namespace std;
 
 class ViewCertDialog;
 
+#ifndef STACK_OF
+  // At some point, presumably in 1.0.0, openssl went to the
+  // STACK_OF() macro system to typedef the contents of a stack.
+  // Unfortunately, that new API is different.  We define some macros
+  // here here for backward compatiblity.
+  #define STACK_OF(type) STACK
+  #define sk_X509_push(stack, item) sk_push((stack), (char *)(item))
+  #define sk_X509_free(stack) sk_free(stack)
+  #define sk_X509_new(cmp) sk_new(cmp)
+#endif
+
 ////////////////////////////////////////////////////////////////////
 //       Class : P3DCertApp
 // Description : This is the wxApp that drives this application.
@@ -84,7 +95,7 @@ private:
 
   wxString _cert_dir;
   X509 *_cert;
-  STACK *_stack;
+  STACK_OF(X509) *_stack;
 
   wxString _friendly_name;
   int _verify_result;