From 33bd83d038345528dc3ca02219e2613f24475984 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Mon, 31 Oct 2011 13:00:34 +0200 Subject: [PATCH] build: make NSS mandatory TLS-DSK support will require a complete cryptographic suite, like NSS. Change build to make NSS a mandatory build requirement. Removed the libpurple crypt/digest implementation. --- ChangeLog | 3 + README | 5 ++ configure.ac | 21 +---- contrib/debian/control.debian | 2 +- contrib/debian/control.maemo | 3 +- contrib/opensuse-build-service/debian.control | 3 +- ...dgin-sipe.dsc => pidgin-sipe-xUbuntu_11.10.dsc} | 3 +- contrib/opensuse-build-service/pidgin-sipe.dsc | 3 +- contrib/opensuse-build-service/pidgin-sipe.spec | 6 +- contrib/rpm/pidgin-sipe.spec | 5 +- siplcs.vcproj | 18 ++-- .../SIPEAdiumPlugin.xcodeproj/project.pbxproj | 8 -- src/api/Makefile.am | 2 - src/core/Makefile.am | 16 ++-- src/core/Makefile.mingw | 29 +++---- src/core/sip-sec-ntlm-tests.c | 20 ++--- src/core/sipe-core.c | 8 +- src/{api => core}/sipe-crypt.h | 0 src/{api => core}/sipe-digest.h | 0 src/purple/Makefile.am | 11 +-- src/purple/purple-crypt.c | 80 ------------------ src/purple/purple-digest.c | 97 ---------------------- 22 files changed, 64 insertions(+), 279 deletions(-) copy contrib/opensuse-build-service/{pidgin-sipe.dsc => pidgin-sipe-xUbuntu_11.10.dsc} (65%) rename src/{api => core}/sipe-crypt.h (100%) rename src/{api => core}/sipe-digest.h (100%) delete mode 100644 src/purple/purple-crypt.c delete mode 100644 src/purple/purple-digest.c diff --git a/ChangeLog b/ChangeLog index 3d3df079..90c8ebae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +version 1.XX.0 "TLSDSK" (201X-XX-XX) + - NSS is now a mandatory build requirement (Stefan Becker) + version 1.12.0 "Group Chat" (2011-08-29) - Feature #3064877: Add support for OCS2007R2 Group Chat (Stefan Becker) - Feature #3311026: Support for HTTP/1.1 Transfer-Encoding: chunked (Stefan Becker) diff --git a/README b/README index fb6b0413..3f7b9c2f 100644 --- a/README +++ b/README @@ -97,7 +97,12 @@ following packages libtool intltool libglib2.0-dev + libglib2-devel libxml2-dev + libxml2-devel + libnss3-dev + nss-devel + mozilla-nss-devel gettext-devel Now you should be able to compile the source code with diff --git a/configure.ac b/configure.ac index 8306414b..96475d3e 100644 --- a/configure.ac +++ b/configure.ac @@ -180,17 +180,14 @@ AS_IF([test "x$ac_have_gmime" = xyes], dnl check for NSS PKG_CHECK_MODULES(NSS, [nss], - [ac_have_nss=yes], + [], [PKG_CHECK_MODULES(NSS, [mozilla-nss], - [ac_have_nss=yes], + [], [PKG_CHECK_MODULES(NSS, [microb-engine-nss], - [ac_have_nss=yes], - [ac_have_nss=no]) + [], + [AC_ERROR([nss, mozilla-nss or microb-engine-nss package is required])]) ]) ]) -AM_CONDITIONAL(SIPE_CRYPTO_NSS, [test "x$ac_have_nss" = xyes]) -AS_IF([test "x$ac_have_nss" = xyes], - [AC_DEFINE(HAVE_NSS, 1, [Define if nss should be used in sipe.])]) dnl check for libxml2 PKG_CHECK_MODULES(LIBXML2, [libxml-2.0]) @@ -379,11 +376,6 @@ AS_IF([test "x$enable_telepathy" != xno], [], [AC_ERROR(GMIME package is required for telepathy plugin)]) - dnl NSS is a build requirement - AS_IF([test "x$ac_have_nss" = xyes], - [], - [AC_ERROR(NSS package is required for telepathy plugin)]) - dnl NOTHING IMPLEMENTED YET!!! ], [enable_telepathy=no])]) @@ -400,11 +392,6 @@ AS_IF([test "x$enable_kopete" != xno], [], [AC_ERROR(GMIME package is required for kopete plugin)]) - dnl NSS is a build requirement - AS_IF([test "x$ac_have_nss" = xyes], - [], - [AC_ERROR(NSS package is required for kopete plugin)]) - dnl NOTHING IMPLEMENTED YET!!! ], [enable_kopete=no]) diff --git a/contrib/debian/control.debian b/contrib/debian/control.debian index 7b17c1ce..1ab469ff 100644 --- a/contrib/debian/control.debian +++ b/contrib/debian/control.debian @@ -3,7 +3,7 @@ Section: misc Priority: optional Maintainer: Anibal Avelar Homepage: http://sipe.sourceforge.net/ -Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 5), pkg-config, libglib2.0-dev (>= 2.12.0), libxml2-dev, libpurple-dev (>= 2.4.0), libtool, intltool, libkrb5-dev, libzephyr-dev, libnss3-dev +Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 5), pkg-config, libglib2.0-dev (>= 2.12.0), libxml2-dev, libnss3-dev, libpurple-dev (>= 2.4.0), libtool, intltool, libkrb5-dev, libzephyr-dev Standards-Version: 3.9.1 Package: pidgin-sipe diff --git a/contrib/debian/control.maemo b/contrib/debian/control.maemo index ea50b20c..79816c9e 100644 --- a/contrib/debian/control.maemo +++ b/contrib/debian/control.maemo @@ -5,8 +5,7 @@ Maintainer: Stefan Becker XSBC-Original-Maintainer: Anibal Avelar Homepage: http://sipe.sourceforge.net/ # Maemo 4: pidgin-dev needed for libpurple-dev -Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 5), pkg-config, libglib2.0-dev (>= 2.12.0), libxml2-dev, pidgin-dev, libpurple-dev (>= 2.4.0), libtool, intltool -# Not in use yet: libnss3-dev +Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 5), pkg-config, libglib2.0-dev (>= 2.12.0), libxml2-dev, libnss3-dev, pidgin-dev, libpurple-dev (>= 2.4.0), libtool, intltool Standards-Version: 3.9.1 Package: pidgin-sipe diff --git a/contrib/opensuse-build-service/debian.control b/contrib/opensuse-build-service/debian.control index 560362f3..e7cdfe39 100644 --- a/contrib/opensuse-build-service/debian.control +++ b/contrib/opensuse-build-service/debian.control @@ -5,8 +5,7 @@ Maintainer: pidgin-sipe Homepage: http://sipe.sourceforge.net/ # Debian 5: libzephyr-dev needed for libpurple0 # Maemo 4: pidgin-dev needed for libpurple-dev -Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 5), pkg-config, libglib2.0-dev (>= 2.12.0), libxml2-dev, pidgin-dev, libpurple-dev (>= 2.4.0), libtool, intltool, libkrb5-dev, libzephyr-dev -# Not in use yet: libnss3-dev +Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 5), pkg-config, libglib2.0-dev (>= 2.12.0), libxml2-dev, libnss3-dev, pidgin-dev, libpurple-dev (>= 2.4.0), libtool, intltool, libkrb5-dev, libzephyr-dev Standards-Version: 3.9.1 Package: pidgin-sipe diff --git a/contrib/opensuse-build-service/pidgin-sipe.dsc b/contrib/opensuse-build-service/pidgin-sipe-xUbuntu_11.10.dsc similarity index 65% copy from contrib/opensuse-build-service/pidgin-sipe.dsc copy to contrib/opensuse-build-service/pidgin-sipe-xUbuntu_11.10.dsc index b2a0c801..038fa8d6 100644 --- a/contrib/opensuse-build-service/pidgin-sipe.dsc +++ b/contrib/opensuse-build-service/pidgin-sipe-xUbuntu_11.10.dsc @@ -5,8 +5,7 @@ Binary: pidgin-sipe Maintainer: pidgin-sipe Architecture: any Standards-Version: 3.9.1 -Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 5), pkg-config, libglib2.0-dev (>= 2.12.0), libxml2-dev, pidgin-dev, libpurple-dev (>= 2.4.0), libtool, intltool, libkrb5-dev, libzephyr-dev -# Not in use yet: libnss3-dev +Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 5), pkg-config, libglib2.0-dev (>= 2.28.0), libxml2-dev, libnss3-dev, pidgin-dev, libpurple-dev (>= 2.8.0), libtool, intltool, libkrb5-dev, libzephyr-dev, libnice-dev (>= 0.1.0), libgstreamer0.10-dev Homepage: http://sipe.sourceforge.net/ Files: 2a05700b1f105d7bbc630b92a1de5ecf 513579 pidgin-sipe_1.12.0.orig.tar.gz diff --git a/contrib/opensuse-build-service/pidgin-sipe.dsc b/contrib/opensuse-build-service/pidgin-sipe.dsc index b2a0c801..f32430f9 100644 --- a/contrib/opensuse-build-service/pidgin-sipe.dsc +++ b/contrib/opensuse-build-service/pidgin-sipe.dsc @@ -5,8 +5,7 @@ Binary: pidgin-sipe Maintainer: pidgin-sipe Architecture: any Standards-Version: 3.9.1 -Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 5), pkg-config, libglib2.0-dev (>= 2.12.0), libxml2-dev, pidgin-dev, libpurple-dev (>= 2.4.0), libtool, intltool, libkrb5-dev, libzephyr-dev -# Not in use yet: libnss3-dev +Build-Depends: cdbs (>= 0.4.23-1.1), autotools-dev, debhelper (>= 5), pkg-config, libglib2.0-dev (>= 2.12.0), libxml2-dev, libnss3-dev, pidgin-dev, libpurple-dev (>= 2.4.0), libtool, intltool, libkrb5-dev, libzephyr-dev Homepage: http://sipe.sourceforge.net/ Files: 2a05700b1f105d7bbc630b92a1de5ecf 513579 pidgin-sipe_1.12.0.orig.tar.gz diff --git a/contrib/opensuse-build-service/pidgin-sipe.spec b/contrib/opensuse-build-service/pidgin-sipe.spec index 79bca206..67347ca1 100644 --- a/contrib/opensuse-build-service/pidgin-sipe.spec +++ b/contrib/opensuse-build-service/pidgin-sipe.spec @@ -152,6 +152,7 @@ BuildRequires: %{mingw_prefix}gettext-runtime BuildRequires: %{mingw_prefix}cross-pkg-config BuildRequires: %{mingw_prefix}glib2-devel >= 2.12.0 BuildRequires: %{mingw_prefix}libxml2-devel +BuildRequires: %{mingw_prefix}mozilla-nss-devel BuildRequires: %{mingw_prefix}libpurple-devel >= 2.4.0 BuildRequires: %{mingw_prefix}cross-nsis @@ -164,7 +165,7 @@ BuildRequires: %{mingw_prefix}pidgin # BuildRequires: %{purple_develname} >= 2.4.0 BuildRequires: libxml2-devel -#BuildRequires: %{nss_develname} +BuildRequires: %{nss_develname} BuildRequires: gettext-devel # The following two are required to enable Voice & Video features %if 0%{?has_libnice:1} @@ -410,6 +411,9 @@ rm -rf %{buildroot} %changelog +* Mon Oct 31 2011 J. D. User 1.12.0-*git* +- add BR nss-devel + * Sat Oct 01 2011 J. D. User 1.12.0-*git* - add NSIS package for mingw builds diff --git a/contrib/rpm/pidgin-sipe.spec b/contrib/rpm/pidgin-sipe.spec index 689c9ed9..eca1e79f 100644 --- a/contrib/rpm/pidgin-sipe.spec +++ b/contrib/rpm/pidgin-sipe.spec @@ -40,7 +40,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libpurple-devel >= 2.4.0 BuildRequires: glib2-devel >= 2.12.0 BuildRequires: libxml2-devel -#BuildRequires: nss-devel +BuildRequires: nss-devel BuildRequires: libtool BuildRequires: intltool BuildRequires: gettext-devel @@ -133,6 +133,9 @@ rm -rf %{buildroot} %changelog +* Mon Oct 31 2011 J. D. User 1.12.0-*git* +- add BR nss-devel + * Mon Aug 29 2011 J. D. User 1.12.0 - update to 1.12.0 diff --git a/siplcs.vcproj b/siplcs.vcproj index 940ae20b..4ba18ef1 100755 --- a/siplcs.vcproj +++ b/siplcs.vcproj @@ -251,7 +251,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""$(SolutionDir)/../include";"$(ProjectDir)/src/core";"$(ProjectDir)/src/api";"$(ProjectDir)/src/"" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;PACKAGE_NAME=\"pidgin-sipe\";PACKAGE_VERSION=\"1.12.0\";PACKAGE_URL=\"http://sipe.sourceforge.net/\";PACKAGE_BUGREPORT=\"https://sourceforge.net/tracker/?atid=949931&amp;group_id=194563\";SIPE_VERSION=\"1.12.0\";_CRT_SECURE_NO_WARNINGS;HAVE_NSS;HAVE_GMIME;HAVE_VV;ENABLE_NLS;MIRANDA" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;PACKAGE_NAME=\"pidgin-sipe\";PACKAGE_VERSION=\"1.12.0\";PACKAGE_URL=\"http://sipe.sourceforge.net/\";PACKAGE_BUGREPORT=\"https://sourceforge.net/tracker/?atid=949931&amp;group_id=194563\";SIPE_VERSION=\"1.12.0\";_CRT_SECURE_NO_WARNINGS;HAVE_GMIME;HAVE_VV;ENABLE_NLS;MIRANDA" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -408,6 +408,10 @@ > + + @@ -420,6 +424,10 @@ > + + @@ -588,14 +596,6 @@ > - - - - diff --git a/src/adium/SIPEAdiumPlugin.xcodeproj/project.pbxproj b/src/adium/SIPEAdiumPlugin.xcodeproj/project.pbxproj index b7a81b86..4dacc3c6 100644 --- a/src/adium/SIPEAdiumPlugin.xcodeproj/project.pbxproj +++ b/src/adium/SIPEAdiumPlugin.xcodeproj/project.pbxproj @@ -42,9 +42,7 @@ 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; B13FAAE4119D3D2E001CE037 /* libintl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B13FAAE3119D3D2E001CE037 /* libintl.framework */; }; B13FAB5F119D5155001CE037 /* purple-connection.c in Sources */ = {isa = PBXBuildFile; fileRef = B13FAB4F119D5155001CE037 /* purple-connection.c */; }; - B13FAB60119D5155001CE037 /* purple-crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = B13FAB50119D5155001CE037 /* purple-crypt.c */; }; B13FAB61119D5155001CE037 /* purple-debug.c in Sources */ = {isa = PBXBuildFile; fileRef = B13FAB51119D5155001CE037 /* purple-debug.c */; }; - B13FAB62119D5155001CE037 /* purple-digest.c in Sources */ = {isa = PBXBuildFile; fileRef = B13FAB52119D5155001CE037 /* purple-digest.c */; }; B13FAB63119D5155001CE037 /* purple-dnsquery.c in Sources */ = {isa = PBXBuildFile; fileRef = B13FAB53119D5155001CE037 /* purple-dnsquery.c */; }; B13FAB64119D5155001CE037 /* purple-markup.c in Sources */ = {isa = PBXBuildFile; fileRef = B13FAB54119D5155001CE037 /* purple-markup.c */; }; B13FAB66119D5155001CE037 /* purple-mime.c in Sources */ = {isa = PBXBuildFile; fileRef = B13FAB56119D5155001CE037 /* purple-mime.c */; }; @@ -132,9 +130,7 @@ 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; B13FAAE3119D3D2E001CE037 /* libintl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libintl.framework; path = /Users/mduggan/src/adium/Frameworks/libintl.framework; sourceTree = ""; }; B13FAB4F119D5155001CE037 /* purple-connection.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "purple-connection.c"; sourceTree = ""; }; - B13FAB50119D5155001CE037 /* purple-crypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "purple-crypt.c"; sourceTree = ""; }; B13FAB51119D5155001CE037 /* purple-debug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "purple-debug.c"; sourceTree = ""; }; - B13FAB52119D5155001CE037 /* purple-digest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "purple-digest.c"; sourceTree = ""; }; B13FAB53119D5155001CE037 /* purple-dnsquery.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "purple-dnsquery.c"; sourceTree = ""; }; B13FAB54119D5155001CE037 /* purple-markup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "purple-markup.c"; sourceTree = ""; }; B13FAB56119D5155001CE037 /* purple-mime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "purple-mime.c"; sourceTree = ""; }; @@ -321,9 +317,7 @@ 1CF260F712C2DFA00045B6CC /* purple-notify.c */, 1CF260F812C2DFA00045B6CC /* purple-user.c */, B13FAB4F119D5155001CE037 /* purple-connection.c */, - B13FAB50119D5155001CE037 /* purple-crypt.c */, B13FAB51119D5155001CE037 /* purple-debug.c */, - B13FAB52119D5155001CE037 /* purple-digest.c */, B13FAB53119D5155001CE037 /* purple-dnsquery.c */, B13FAB54119D5155001CE037 /* purple-markup.c */, B13FAB56119D5155001CE037 /* purple-mime.c */, @@ -494,9 +488,7 @@ buildActionMask = 2147483647; files = ( B13FAB5F119D5155001CE037 /* purple-connection.c in Sources */, - B13FAB60119D5155001CE037 /* purple-crypt.c in Sources */, B13FAB61119D5155001CE037 /* purple-debug.c in Sources */, - B13FAB62119D5155001CE037 /* purple-digest.c in Sources */, B13FAB63119D5155001CE037 /* purple-dnsquery.c in Sources */, B13FAB64119D5155001CE037 /* purple-markup.c in Sources */, B13FAB66119D5155001CE037 /* purple-mime.c in Sources */, diff --git a/src/api/Makefile.am b/src/api/Makefile.am index a929eda7..5555df60 100644 --- a/src/api/Makefile.am +++ b/src/api/Makefile.am @@ -6,7 +6,5 @@ EXTRA_DIST = \ sipe-backend.h \ sipe-common.h \ sipe-core.h \ - sipe-crypt.h \ - sipe-digest.h \ sipe-mime.h \ sipe-nls.h diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 3dd6e087..a31d89ba 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -8,6 +8,8 @@ MAINTAINERCLEANFILES = \ libsipe_core_la_SOURCES = \ http-conn.h \ http-conn.c \ + md4.h \ + md4.c \ sipmsg.h \ sipmsg.c \ sip-csta.h \ @@ -27,8 +29,12 @@ libsipe_core_la_SOURCES = \ sipe-conf.c \ sipe-core-private.h \ sipe-core.c \ + sipe-crypt.h \ + sipe-crypt.c \ sipe-dialog.h \ sipe-dialog.c \ + sipe-digest.h \ + sipe-digest.c \ sipe-domino.h \ sipe-domino.c \ sipe-ews.h \ @@ -96,6 +102,7 @@ libsipe_core_la_CFLAGS = \ $(DEBUG_CFLAGS) \ $(QUALITY_CFLAGS) \ $(LIBXML2_CFLAGS) \ + $(NSS_CFLAGS) \ $(GLIB_CFLAGS) \ $(LOCALE_CPPFLAGS) \ -I$(srcdir)/../api @@ -114,15 +121,6 @@ libsipe_core_la_SOURCES += sipe-mime.c libsipe_core_la_CFLAGS += $(GMIME_CFLAGS) endif -if SIPE_CRYPTO_NSS -libsipe_core_la_SOURCES += \ - md4.h \ - md4.c \ - sipe-crypt.c \ - sipe-digest.c -libsipe_core_la_CFLAGS += $(NSS_CFLAGS) -endif - if SIPE_OS_WIN32 # HAVE_LIBKRB5 activates the code in sip-sec-sspi.c instead of sip-sec-ntlm.c libsipe_core_la_CFLAGS += -DHAVE_LIBKRB5=1 diff --git a/src/core/Makefile.mingw b/src/core/Makefile.mingw index a6b5ade6..1c0beeaa 100644 --- a/src/core/Makefile.mingw +++ b/src/core/Makefile.mingw @@ -53,7 +53,6 @@ ifdef USE_SSPI DEFINES += -DHAVE_LIBKRB5=1 else DEFINES += -DHAVE_GMIME=1 -DEFINES += -DHAVE_NSS=1 endif @@ -67,7 +66,9 @@ INCLUDE_PATHS += -I. \ -I$(GTK_TOP)/include/glib-2.0 \ -I$(GTK_TOP)/lib/glib-2.0/include \ -I$(LIBICONV_TOP)/include \ - -I$(LIBXML2_TOP)/include/libxml2 + -I$(LIBXML2_TOP)/include/libxml2 \ + -I$(NSPR_TOP)/include \ + -I$(NSS_TOP)/include PURPLE_INCLUDE_PATHS += -I$(PURPLE_TOP) \ -I$(PURPLE_TOP)/win32 \ @@ -76,15 +77,14 @@ PURPLE_INCLUDE_PATHS += -I$(PURPLE_TOP) \ ifdef USE_SSPI # nothing needed else -INCLUDE_PATHS += -I$(GMIME_TOP)/include/gmime-2.4 \ - -I$(NSPR_TOP)/include \ - -I$(NSS_TOP)/include +INCLUDE_PATHS += -I$(GMIME_TOP)/include/gmime-2.4 endif ## ## SOURCES, OBJECTS ## CLEAN_C_SRC = http-conn.c \ + md4.c \ sip-transport.c \ sipe-conf.c \ sipe-core.c \ @@ -92,7 +92,9 @@ CLEAN_C_SRC = http-conn.c \ sipe-buddy.c \ sipe-cal.c \ sipe-chat.c \ + sipe-crypt.c \ sipe-dialog.c \ + sipe-digest.c \ sipe-ft.c \ sipe-ft-tftp.c \ sipe-group.c \ @@ -135,15 +137,10 @@ C_TEST_SRC = sipe-xml-tests.c ifdef USE_SSPI CLEAN_C_SRC += sip-sec-sspi.c -PURPLE_C_SRC += ../purple/purple-crypt.c \ - ../purple/purple-digest.c \ - ../purple/purple-mime.c +PURPLE_C_SRC += ../purple/purple-mime.c else -CLEAN_C_SRC += md4.c \ - sip-sec-ntlm.c \ - sipe-crypt.c \ - sipe-digest.c \ +CLEAN_C_SRC += sip-sec-ntlm.c \ sipe-mime.c C_TEST_SRC += sip-sec-ntlm-tests.c \ @@ -166,12 +163,14 @@ TEST_OBJECTS = $(C_TEST_SRC:%.c=%.o) ## LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(LIBXML2_TOP)/lib \ + -L$(NSS_TOP)/lib \ -L$(PURPLE_TOP) LIBS = -lglib-2.0 \ -lgobject-2.0 \ -lintl \ -lxml2 \ + -lnss3 \ -lws2_32 \ -lpurple @@ -180,10 +179,8 @@ LIB_PATHS += $(LIBICONV_TOP)/lib/libiconv.a LIBS += -lsecur32 else LIB_PATHS += $(GMIME_TOP)/lib/libgmime-2.4.a \ - -L$(LIBICONV_TOP)/lib \ - -L$(NSS_TOP)/lib -LIBS += -lnss3 \ - -liconv + -L$(LIBICONV_TOP)/lib +LIBS += -liconv endif # These flags are used in mingw build diff --git a/src/core/sip-sec-ntlm-tests.c b/src/core/sip-sec-ntlm-tests.c index cfe01bf3..82af3b7b 100644 --- a/src/core/sip-sec-ntlm-tests.c +++ b/src/core/sip-sec-ntlm-tests.c @@ -28,18 +28,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include -#ifdef HAVE_NSS #include "nss.h" -#endif #include "sipmsg.h" #include "sipe-sign.h" @@ -137,14 +131,12 @@ gboolean sip_sec_ntlm_tests(void) const gchar *response_sig; printf ("Starting Tests\n"); - + /* Initialization for NSS */ -#ifdef HAVE_NSS if (!NSS_IsInitialized()) { NSS_NoDB_Init("."); SIPE_DEBUG_INFO_NOFORMAT("NSS initialised"); } -#endif /* Initialization for NTLM */ sip_sec_init__ntlm(); @@ -393,7 +385,7 @@ Response: */ - { + { const guint64 time_val = 0; const guint8 target_info [] = { 0x02, 0x00, 0x0C, 0x00, //NetBIOS Domain name, 4 bytes @@ -488,7 +480,7 @@ Response: // Verify signature of SIPE message received from OCS 2007 after authenticating with pidgin-sipe printf ("\n\nTesting MS-SIPE Example Message Signing\n"); { - char * msg2; + char * msg2; char * msg1 = "<0878F41B><1><8592g5DCBa1694i5887m0D0Bt2247b3F38xAE9Fx><3><2947328781><900><200>"; guchar exported_session_key2 [] = { 0x5F, 0x02, 0x91, 0x53, 0xBC, 0x02, 0x50, 0x58, 0x96, 0x95, 0x48, 0x61, 0x5E, 0x70, 0x99, 0xBA }; @@ -834,7 +826,7 @@ Message (length 352): printf ("\n\nTesting Authentication Algorithm's v4 Signature String\n"); { - char *response_symbian = + char *response_symbian = "SIP/2.0 180 Ringing\r\n" "Authentication-Info: NTLM rspauth=\"010000003EA8D688BA51D5CD64000000\", srand=\"1B6D47A1\", snum=\"11\", opaque=\"357E6F72\", qop=\"auth\", targetname=\"LOC-COMPANYT-FE03.COMPANY.COM\", realm=\"SIP Communications Service\"\r\n" "Via: SIP/2.0/tls 192.168.44.10:50230;received=10.117.245.254;ms-received-port=50230;ms-received-cid=37ABE00\r\n" @@ -859,10 +851,10 @@ Message (length 352): msg_str = sipmsg_breakdown_get_string(4, &msgbd); assert_equal (response_sig, (guchar *)msg_str, strlen(response_sig), FALSE); - + sipmsg_breakdown_free(&msgbd); } - + ////// UUID tests /////// /* begin tests from MS-SIPRE */ { diff --git a/src/core/sipe-core.c b/src/core/sipe-core.c index 14a60ae3..fcef8e16 100644 --- a/src/core/sipe-core.c +++ b/src/core/sipe-core.c @@ -44,9 +44,7 @@ #include "sipe-media.h" #include "sipe.h" -#ifdef HAVE_NSS #include "nss.h" -#endif #ifdef HAVE_GMIME #include #endif @@ -64,12 +62,10 @@ void sipe_core_init(SIPE_UNUSED_PARAMETER const char *locale_dir) bind_textdomain_codeset(PACKAGE_NAME, "UTF-8")); textdomain(PACKAGE_NAME); #endif -#ifdef HAVE_NSS if (!NSS_IsInitialized()) { NSS_NoDB_Init("."); SIPE_DEBUG_INFO_NOFORMAT("NSS initialised"); } -#endif #ifdef HAVE_GMIME g_mime_init(0); #endif @@ -78,12 +74,10 @@ void sipe_core_init(SIPE_UNUSED_PARAMETER const char *locale_dir) void sipe_core_destroy(void) { sipe_chat_destroy(); -#ifdef HAVE_NSS - /* do nothing. + /* do nothing for NSS. * We don't want accedently switch off NSS possibly used by other plugin - * ssl-nss in Pidgin for example. */ -#endif #ifdef HAVE_GMIME g_mime_shutdown(); #endif diff --git a/src/api/sipe-crypt.h b/src/core/sipe-crypt.h similarity index 100% rename from src/api/sipe-crypt.h rename to src/core/sipe-crypt.h diff --git a/src/api/sipe-digest.h b/src/core/sipe-digest.h similarity index 100% rename from src/api/sipe-digest.h rename to src/core/sipe-digest.h diff --git a/src/purple/Makefile.am b/src/purple/Makefile.am index 3d913021..0dc45fc9 100644 --- a/src/purple/Makefile.am +++ b/src/purple/Makefile.am @@ -52,6 +52,7 @@ libsipe_la_LIBADD = \ ../core/libsipe_core_purple.la \ libsipe_backend.la \ $(LIBXML2_LIBS) \ + $(NSS_LIBS) \ $(GLIB_LIBS) \ $(PURPLE_LIBS) @@ -78,6 +79,7 @@ tests_LDADD = \ ../core/libsipe_core_tests.la \ ../core/libsipe_core.la \ libsipe_backend.la \ + $(NSS_LIBS) \ $(PURPLE_LIBS) endif @@ -90,15 +92,6 @@ else libsipe_backend_la_SOURCES += purple-mime.c endif -if SIPE_CRYPTO_NSS -libsipe_la_LIBADD += $(NSS_LIBS) -if !SIPE_OS_WIN32 -tests_LDADD += $(NSS_LIBS) -endif -else -libsipe_backend_la_SOURCES += purple-crypt.c purple-digest.c -endif - if SIPE_WITH_VV libsipe_backend_la_SOURCES += purple-media.c libsipe_backend_la_CFLAGS += $(NICE_CFLAGS) $(GSTREAMER_CFLAGS) diff --git a/src/purple/purple-crypt.c b/src/purple/purple-crypt.c deleted file mode 100644 index cc015ba4..00000000 --- a/src/purple/purple-crypt.c +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @file purple-crypt.c - * - * pidgin-sipe - * - * Copyright (C) 2010 SIPE Project - * - * This program is free software; you can redistribute it and/or modify - * it 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "glib.h" -#include "cipher.h" - -#include "sipe-crypt.h" - -void sipe_crypt_des(const guchar *key, - const guchar *plaintext, gsize plaintext_length, - guchar *encrypted_text) -{ - gsize dummy; - PurpleCipherContext *context = purple_cipher_context_new_by_name("des", NULL); - purple_cipher_context_set_key(context, key); - purple_cipher_context_encrypt(context, plaintext, plaintext_length, encrypted_text, &dummy); - purple_cipher_context_destroy(context); -} - -void sipe_crypt_rc4(const guchar *key, gsize key_length, - const guchar *plaintext, gsize plaintext_length, - guchar *encrypted_text) -{ - gsize dummy; - PurpleCipherContext *context = purple_cipher_context_new_by_name("rc4", NULL); - purple_cipher_context_set_option(context, "key_len", (gpointer)key_length); - purple_cipher_context_set_key(context, key); - purple_cipher_context_encrypt(context, plaintext, plaintext_length, encrypted_text, &dummy); - purple_cipher_context_destroy(context); -} - -/* Stream RC4 cipher for file transfer */ -gpointer sipe_crypt_ft_start(const guchar *key) -{ - PurpleCipherContext *context = purple_cipher_context_new_by_name("rc4", NULL); - /* only use first 16 characters of the key */ - purple_cipher_context_set_option(context, "key_len", (gpointer)16); - purple_cipher_context_set_key(context, key); - return(context); -} - -void sipe_crypt_ft_stream(gpointer context, - const guchar *in, gsize length, - guchar *out) -{ - purple_cipher_context_encrypt(context, in, length, out, NULL); -} - -void sipe_crypt_ft_destroy(gpointer context) -{ - purple_cipher_context_destroy(context); -} - -/* - Local Variables: - mode: c - c-file-style: "bsd" - indent-tabs-mode: t - tab-width: 8 - End: -*/ diff --git a/src/purple/purple-digest.c b/src/purple/purple-digest.c deleted file mode 100644 index cbecc29e..00000000 --- a/src/purple/purple-digest.c +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @file purple-digest.c - * - * pidgin-sipe - * - * Copyright (C) 2010 SIPE Project - * - * This program is free software; you can redistribute it and/or modify - * it 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "glib.h" -#include "cipher.h" - -#include "sipe-digest.h" - -void sipe_digest_hmac_md5(const guchar *key, gsize key_length, - const guchar *data, gsize data_length, - guchar *digest) -{ - PurpleCipherContext *context = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(context, "hash", "md5"); - purple_cipher_context_set_key_with_len(context, key, key_length); - purple_cipher_context_append(context, data, data_length); - purple_cipher_context_digest(context, SIPE_DIGEST_HMAC_MD5_LENGTH, digest, NULL); - purple_cipher_context_destroy(context); -} - -static void purple_digest(const gchar *algorithm, - const guchar *data, gsize data_length, - guchar *digest, gsize digest_length) -{ - PurpleCipherContext *ctx = purple_cipher_context_new_by_name(algorithm, NULL); - purple_cipher_context_append(ctx, data, data_length); - purple_cipher_context_digest(ctx, digest_length, digest, NULL); - purple_cipher_context_destroy(ctx); -} - -void sipe_digest_md4(const guchar *data, gsize length, guchar *digest) -{ - purple_digest("md4", data, length, digest, SIPE_DIGEST_MD4_LENGTH); -} - -void sipe_digest_md5(const guchar *data, gsize length, guchar *digest) -{ - purple_digest("md5", data, length, digest, SIPE_DIGEST_MD5_LENGTH); -} - -void sipe_digest_sha1(const guchar *data, gsize length, guchar *digest) -{ - purple_digest("sha1", data, length, digest, SIPE_DIGEST_SHA1_LENGTH); -} - -/* Stream HMAC(SHA1) digest for file transfer */ -gpointer sipe_digest_ft_start(const guchar *sha1_digest) -{ - PurpleCipherContext *context = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(context, "hash", "sha1"); - /* used only the first 16 bytes of the 20 byte SHA1 digest */ - purple_cipher_context_set_key_with_len(context, sha1_digest, 16); - return(context); -} - -void sipe_digest_ft_update(gpointer context, const guchar *data, gsize length) -{ - purple_cipher_context_append(context, data, length); -} - -void sipe_digest_ft_end(gpointer context, guchar *digest) -{ - purple_cipher_context_digest(context, SIPE_DIGEST_FILETRANSFER_LENGTH, digest, NULL); -} - -void sipe_digest_ft_destroy(gpointer context) -{ - purple_cipher_context_destroy(context); -} - -/* - Local Variables: - mode: c - c-file-style: "bsd" - indent-tabs-mode: t - tab-width: 8 - End: -*/ -- 2.11.4.GIT