openconnect_CFLAGS = $(SSL_CFLAGS) $(DTLS_SSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(ZLIB_CFLAGS)
openconnect_LDADD = libopenconnect.la $(SSL_LIBS) $(DTLS_SSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(ZLIB_LIBS) $(LIBINTL)
-library_srcs = ssl.c http.c auth.c library.c compat.c @SSL_LIBRARY@.c
+library_srcs = ssl.c http.c auth.c library.c compat.c
+lib_srcs_gnutls = gnutls.c gnutls_pkcs12.c
+lib_srcs_openssl = openssl.c
+if OPENCONNECT_GNUTLS
+library_srcs += $(lib_srcs_gnutls)
+endif
+if OPENCONNECT_OPENSSL
+library_srcs += $(lib_srcs_openssl)
+endif
libopenconnect_la_SOURCES = version.c $(library_srcs)
libopenconnect_la_CFLAGS = $(SSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(P11KIT_CFLAGS) $(TSS_CFLAGS)
libopenconnect_la_LIBADD = $(SSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(LIBINTL) $(P11KIT_LIBS) $(TSS_LIBS)
pkgconfig_DATA = openconnect.pc
-EXTRA_DIST = version.sh COPYING.LGPL gnutls_pkcs12.c gnutls.c openssl.c
+EXTRA_DIST = version.sh COPYING.LGPL $(lib_srcs_openssl) $(lib_srcs_gnutls)
DISTCLEANFILES = $(pkgconfig_DATA)
-gnutls.o: gnutls_pkcs12.c
main.o: version.c
-version.c: $(library_srcs) $(openconnect_SOURCES) Makefile.am configure.ac \
+version.c: $(library_srcs) $(lib_openssl_srcs) $(lib_gnutls_srcs) \
+ $(openconnect_SOURCES) Makefile.am configure.ac \
openconnect.h openconnect-internal.h version.sh @GITVERSIONDEPS@
@cd $(srcdir) && ./version.sh $(abs_builddir)/version.c
AC_MSG_ERROR([Neither OpenSSL nor GnuTLS selected for SSL.])
;;
esac
+AM_CONDITIONAL(OPENCONNECT_GNUTLS, [ test "$ssl_library" != "openssl" ])
+AM_CONDITIONAL(OPENCONNECT_OPENSSL, [ test "$ssl_library" = "openssl" ])
# Needs to happen after we default to static/shared libraries based on OpenSSL
AC_PROG_LIBTOOL
void *_vpninfo);
#endif
+#include "gnutls.h"
#include "openconnect-internal.h"
/* Helper functions for reading/writing lines over SSL.
return 0;
}
-#ifndef HAVE_GNUTLS_PKCS12_SIMPLE_PARSE
-/* If we're using a version of GnuTLS from before this was
- exported, pull in our local copy. */
-#include "gnutls_pkcs12.c"
-#endif
-
/* A non-zero, non-error return to make load_certificate() continue and
interpreting the file as other types */
#define NOT_PKCS12 1
--- /dev/null
+/*
+ * OpenConnect (SSL + DTLS) VPN client
+ *
+ * Copyright © 2008-2012 Intel Corporation.
+ *
+ * Author: David Woodhouse <dwmw2@infradead.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1, as published by the Free Software Foundation.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to:
+ *
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef __OPENCONNECT_GNUTLS_H__
+#define __OPENCONNECT_GNUTLS_H__
+
+#include <gnutls/gnutls.h>
+#include <gnutls/pkcs12.h>
+
+#ifndef HAVE_GNUTLS_PKCS12_SIMPLE_PARSE
+/* If we're using a version of GnuTLS from before this was
+ exported, pull in our local copy. */
+int gnutls_pkcs12_simple_parse (gnutls_pkcs12_t p12, const char *password,
+ gnutls_x509_privkey_t * key,
+ gnutls_x509_crt_t ** chain,
+ unsigned int * chain_len,
+ gnutls_x509_crt_t ** extra_certs,
+ unsigned int * extra_certs_len,
+ gnutls_x509_crl_t * crl,
+ unsigned int flags);
+
+#endif /* !HAVE_GNUTLS_PKCS12_SIMPLE_PARSE */
+
+#endif /* __OPENCONNECT_GNUTLS_H__ */
* explicit permission.
*/
+#ifndef HAVE_GNUTLS_PKCS12_SIMPLE_PARSE
+
+#include <string.h>
+#include "gnutls.h"
+
#define opaque unsigned char
#define gnutls_assert() do {} while(0)
#define gnutls_assert_val(x) (x)
*
* Since: 3.1
**/
-static int
+int
gnutls_pkcs12_simple_parse (gnutls_pkcs12_t p12,
const char *password,
gnutls_x509_privkey_t * key,
return ret;
}
+
+#endif /* HAVE_GNUTLS_PKCS12_SIMPLE_PARSE */