$OpenBSD: patch-src_ne_openssl_c,v 1.1 2010/10/03 13:02:19 dcoppa Exp $
--- src/ne_openssl.c.orig	Tue Aug 18 15:35:23 2009
+++ src/ne_openssl.c	Fri Oct  1 12:32:40 2010
@@ -36,6 +36,7 @@
 #include <openssl/pkcs12.h>
 #include <openssl/x509v3.h>
 #include <openssl/rand.h>
+#include <openssl/opensslv.h>
 
 #ifdef NE_HAVE_TS_SSL
 #include <stdlib.h> /* for abort() */
@@ -603,6 +604,19 @@ void ne_ssl_context_destroy(ne_ssl_context *ctx)
         SSL_SESSION_free(ctx->sess);
     ne_free(ctx);
 }
+
+#if !defined(HAVE_SSL_SESSION_CMP) && !defined(SSL_SESSION_cmp) \
+    && defined(OPENSSL_VERSION_NUMBER) \
+    && OPENSSL_VERSION_NUMBER > 0x10000000L
+/* OpenSSL 1.0 removed SSL_SESSION_cmp for no apparent reason - hoping
+ * it is reasonable to assume that comparing the session IDs is
+ * sufficient. */
+static int SSL_SESSION_cmp(SSL_SESSION *a, SSL_SESSION *b)
+{
+    return a->session_id_length == b->session_id_length
+        && memcmp(a->session_id, b->session_id, a->session_id_length) == 0;
+}
+#endif
 
 /* For internal use only. */
 int ne__negotiate_ssl(ne_session *sess)
