# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../qt-qca-tls/openssl098.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
# 
# More information can be found in the files COPYING and README.
# 
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---
diff -Nur qca-tls-1.0.orig/configure qca-tls-1.0/configure
--- qca-tls-1.0.orig/configure	2003-12-18 00:54:50.000000000 +0200
+++ qca-tls-1.0/configure	2005-11-04 14:38:14.000000000 +0200
@@ -174,6 +174,19 @@
 			return false;
 		if(ret == 0)
 			conf->addDefine("OSSL_097");
+			
+		// is it at least openssl 0.9.8?
+		str =
+			"#include<openssl/opensslv.h>\n"
+			"int main()\n"
+			"{\n"
+			"  unsigned long x = OPENSSL_VERSION_NUMBER;\n"
+			"  if(x >= 0x00908000) return 0; else return 1;\n"
+			"}\n";
+		if(!conf->doCompileAndLink(str, ext, &ret))
+			return false;
+		if(ret == 0)
+			conf->addDefine("OSSL_098");
 
 		if(!inc.isEmpty())
 			conf->addIncludePath(inc);
diff -Nur qca-tls-1.0.orig/qca-tls.cpp qca-tls-1.0/qca-tls.cpp
--- qca-tls-1.0.orig/qca-tls.cpp	2003-12-10 18:53:57.000000000 +0200
+++ qca-tls-1.0/qca-tls.cpp	2005-11-04 14:42:35.000000000 +0200
@@ -454,7 +454,11 @@
 			if(!r) {
 				// try this other public function, for whatever reason
 				p = (void *)in;
+#ifdef OSSL_098
+				r = d2i_RSA_PUBKEY(NULL, (const unsigned char **)&p, len);
+#else				
 				r = d2i_RSA_PUBKEY(NULL, (unsigned char **)&p, len);
+#endif
 			}
 			if(r) {
 				if(pub) {
@@ -799,7 +803,11 @@
 	bool createFromDER(const char *in, unsigned int len)
 	{
 		unsigned char *p = (unsigned char *)in;
+#ifdef OSSL_098
+		X509 *t = d2i_X509(NULL, (const unsigned char**)&p, len);
+#else
 		X509 *t = d2i_X509(NULL, &p, len);
+#endif
 		if(!t)
 			return false;
 		fromX509(t);