Blob Blame History Raw
From cf415ea0a45fc77153dd1969d486aa9a1bf95e6f Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Wed, 29 Apr 2009 19:10:59 +0200
Subject: [PATCH] Fix libgadu and libicq NSS cryptography support

Fixes needed to get it compile with Fedora's nss_ossl_compat
library.
---
 configure.ac      |    2 ++
 libgadu/events.c  |    4 +++-
 libgadu/libgadu.c |    4 +++-
 libgadu/libgadu.h |    6 +++++-
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index a5f3fa0..6ddaa32 100644
--- a/configure.ac
+++ b/configure.ac
@@ -213,6 +213,7 @@ if test "x$with_ssl" != "xno"; then
 		# drags in NSPR as well
                 PKG_CHECK_MODULES(NSS, nss >= 3)
 		CFLAGS="$CFLAGS $NSS_CFLAGS"
+		CXXFLAGS="$CXXFLAGS $NSS_CFLAGS"
 		LIBS="$LIBS $NSS_LIBS"
 
 		# The compatibility layer
@@ -220,6 +221,7 @@ if test "x$with_ssl" != "xno"; then
                 if test -n "$with_nss_compat" -a "x$with_nss_compat" != "xno"; then
                         if test -f "${with_nss_compat}"; then
                                 CFLAGS="$CFLAGS -I${with_nss_compat} -I/usr/include/nspr4"
+                                CXXFLAGS="$CXXFLAGS -I${with_nss_compat} -I/usr/include/nspr4"
                         fi
                         AC_CHECK_LIB(nss_compat_ossl, SSL_CTX_new, [
                                 AC_DEFINE(HAVE_NSS_COMPAT, 1, [use nss_compat])
diff --git a/libgadu/events.c b/libgadu/events.c
index 3242d16..6ebc261 100644
--- a/libgadu/events.c
+++ b/libgadu/events.c
@@ -38,9 +38,11 @@
 #include <stdlib.h>
 #include <time.h>
 #include <unistd.h>
-#if defined(HAVE_OPENSSL) || defined(HAVE_NSS_COMPAT)
+#if defined(HAVE_OPENSSL)
 #  include <openssl/err.h>
 #  include <openssl/x509.h>
+#elif defined(HAVE_NSS_COMPAT)
+#  include <nss_compat_ossl/nss_compat_ossl.h>
 #elif HAVE_GNUTLS
 #  include <gnutls/gnutls.h>
 #endif
diff --git a/libgadu/libgadu.c b/libgadu/libgadu.c
index 58c2df5..b3f5585 100644
--- a/libgadu/libgadu.c
+++ b/libgadu/libgadu.c
@@ -41,10 +41,12 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#if defined(HAVE_OPENSSL) || defined(HAVE_NSS_COMPAT)
+#if defined(HAVE_OPENSSL)
 #define OPENSSL_NO_KRB5 1
 #  include <openssl/err.h>
 #  include <openssl/rand.h>
+#elif defined(HAVE_NSS_COMPAT)
+#  include <nss_compat_ossl/nss_compat_ossl.h>
 #elif HAVE_GNUTLS
 #include <gnutls/gnutls.h>
 #endif
diff --git a/libgadu/libgadu.h b/libgadu/libgadu.h
index 5bd96e7..abb36e1 100644
--- a/libgadu/libgadu.h
+++ b/libgadu/libgadu.h
@@ -37,7 +37,7 @@ extern "C" {
 #include <stdio.h>
 #include <stdarg.h>
 
-#if defined(HAVE_OPENSSL) || defined(HAVE_NSS_COMPAT)
+#if defined(HAVE_OPENSSL)
 
 #ifndef OPENSSL_NO_KRB5
 #define OPENSSL_NO_KRB5 1
@@ -45,6 +45,10 @@ extern "C" {
 
 #include <openssl/ssl.h>
 
+#elif defined(HAVE_NSS_COMPAT)
+
+#include <nss_compat_ossl/nss_compat_ossl.h>
+
 #elif HAVE_GNUTLS
 #include <gnutls/openssl.h>
 #endif
-- 
1.6.2.2