Hi. I have been working on making Qt buildable with LSB compilers so that more 
recent Qt libraries can be used with LSB-compliant applications. To be able to 
include SSL support with the QtNetwork module, we also need to be able to build 
OpenSSL with the LSB compilers. The 1.0.0c version of OpenSSL currently has a 
small number of issues which prevent this from being possible.

NOTE: I am not talking here about including OpenSSL in some future version of 
the LSB. I am aware of the various discussions around this over the years and I 
would prefer not to stir up those threads. Instead, here I am only talking 
about building OpenSSL with LSB compilers and subsequently including OpenSSL 
libraries with an application's package(s).

There are two files which contain source code that the LSB 4.0 compilers don't 
accept due to missing symbols. These are crypto/bio/bss_dgram.c and 
crypto/ui/ui_openssl.c. That latter is the easiest to address since the LSB 
provides TERMIOS support and it appears that the logic in ui_openssl.c simply 
needs an additional test for an LSB symbol to make the correct choice (it 
currently chooses TERMIO instead of TERMIOS for a linux system, for me at least 
anyway). The attached patch does this in a way I believe should be safe.

The issues in bss_dgram.c are a bit harder to address. The problem is that some 
of the MTU_DISCOVER-related symbols used by OpenSSL are not part of the LSB 
spec. Specifically, the setting of the DF bit causes problems, with 
IP_MTU_DISCOVER, IP_PMTUDISC_DO and IPV6_PMTUDISC_DO not being part of the LSB 
spec (and there may be others missing as well). In order to get the file to 
compile, I effectively disabled the BIO_CTRL_DGRAM_MTU_DISCOVER block in the 
dgram_ctrl() function. The attached patch shows how I did this. I'm not sure if 
this is safe though, since I'm not so familiar with the code but it looks like 
there are valid scenarios where this block could essentially be disabled 
anyway, so hopefully the patch is okay.

Any chance of these two patches or some equivalent fixes making it into the 
next OpenSSL release?

-- 
Dr Craig Scott
Computational Software Engineering Team Leader, CSIRO (CMIS)
Melbourne, Australia
--- openssl-1.0.0c/crypto/ui/ui_openssl.c	2009-10-05 03:43:21.000000000 +1100
+++ openssl-1.0.0c-patched/crypto/ui/ui_openssl.c	2010-12-31 11:28:34.000000000 +1100
@@ -214,6 +214,12 @@
 #undef SGTTY
 #endif
 
+#if defined(__LSB_VERSION__)
+# define TERMIOS
+# undef  TERMIO
+# undef  SGTTY
+#endif
+
 #ifdef TERMIOS
 # include <termios.h>
 # define TTY_STRUCT		struct termios
--- openssl-1.0.0c/crypto/bio/bss_dgram.c	2010-01-07 21:44:21.000000000 +1100
+++ openssl-1.0.0c-patched/crypto/bio/bss_dgram.c	2010-12-31 12:15:43.000000000 +1100
@@ -461,7 +461,7 @@
 		break;
 		/* (Linux)kernel sets DF bit on outgoing IP packets */
 	case BIO_CTRL_DGRAM_MTU_DISCOVER:
-#ifdef OPENSSL_SYS_LINUX
+#if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU_DISCOVER)
 		addr_len = (socklen_t)sizeof(addr);
 		memset((void *)&addr, 0, sizeof(addr));
 		if (getsockname(b->num, &addr.sa, &addr_len) < 0)

Reply via email to