Tor does not recognise libressl version and fails to compile on OpenBSD 5.6

Compiling tor from git returns:

src/common/tortls.c:1451: undefined reference to SSL_CIPHER_find'`

Latest commit on the git repo is, for reference: 90e07ab338cd59caeaeb31a3d207bb34d433b8ab

User 'mancha' on #tor helped me pin the problem. They supplied the following source code to test the SSL version currently in use:

{{{#include <stdio.h> #include <openssl/crypto.h>

#define OPENSSL_VER(a,b,c,d,e)
(((a)<<28) |
((b)<<20) |
((c)<<12) |
((d)<< 4) |
(e))

#define OPENSSL_V_SERIES(a,b,c) OPENSSL_VER((a),(b),(c),0,0)

int main() { printf("OPENSSL_VERSION_NUMBER : %x\n", OPENSSL_VERSION_NUMBER); printf("OPENSSL_V_SERIES(1,0,2): %x\n", OPENSSL_V_SERIES(1,0,2)); return 0; }

}}}

Compiling with cc -o foo foo.c -lcrypto returns:

OPENSSL_VERSION_NUMBER : 20000000
OPENSSL_V_SERIES(1,0,2): 10002000

Mancha also suggested the following patch:

--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -1440,7 +1440,7 @@ static int
 find_cipher_by_id(const SSL *ssl, const SSL_METHOD *m, uint16_t cipher)
 {
   const SSL_CIPHER *c;
-#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,0,2)
+#if 0
   {
     unsigned char cipherid[3];
     tor_assert(ssl);

Applying the patch makes tor compile successfully.

Trac:
Username: cwk