Detect whether to use const SSL_METHOD * in myssl.c
authorAri Johnson <ari@theari.com>
Wed, 27 Apr 2011 02:32:12 +0000 (22:32 -0400)
committerAri Johnson <ari@theari.com>
Wed, 27 Apr 2011 02:32:12 +0000 (22:32 -0400)
src/myssl.c

index e521c8f82ec64fb28c646d77e6c335d244427ab6..c14560b69597e703bb7069df0ae71b62dcebf3e1 100644 (file)
@@ -70,6 +70,7 @@ void shutdown_checkpoint(void);
 #include <unistd.h>
 #endif
 
+#include <openssl/opensslv.h>
 #include <openssl/ssl.h>
 #include <openssl/err.h>
 #include <openssl/dh.h>
@@ -98,6 +99,12 @@ void shutdown_checkpoint(void);
 #define ssl_debugdump(x)
 #endif
 
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+#define SSL_METHOD_CONST const
+#else
+#define SSL_METHOD_CONST
+#endif
+
 static void ssl_errordump(const char *msg);
 static int client_verify_callback(int preverify_ok, X509_STORE_CTX * x509_ctx);
 static DH *get_dh1024(void);
@@ -112,7 +119,7 @@ static SSL_CTX *ctx = NULL;
 SSL_CTX *
 ssl_init(void)
 {
-  SSL_METHOD *meth;
+  SSL_METHOD_CONST SSL_METHOD *meth;
   unsigned char context[128];
   DH *dh;
   unsigned int reps = 1;