diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-05-13 08:27:37 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-05-13 08:27:37 +0000 |
commit | 0a8b936bd02cd6b04f87c9a179532ac8d22655ff (patch) | |
tree | 678b7febcb54ab2f80648a05d9a1bd4e48189412 | |
parent | 962b647a10e13a2098d81faaccca9e4363477c64 (diff) | |
download | gnutls-0a8b936bd02cd6b04f87c9a179532ac8d22655ff.tar.gz |
some fixes in the compilation system.
-rw-r--r-- | configure.in | 18 | ||||
-rw-r--r-- | lib/gnutls_compress_int.c | 23 | ||||
-rw-r--r-- | lib/gnutls_handshake.c | 3 | ||||
-rw-r--r-- | lib/gnutls_priority.c | 2 | ||||
-rw-r--r-- | libextra/Makefile.am | 3 | ||||
-rw-r--r-- | libextra/gnutls_extra.c | 2 | ||||
-rw-r--r-- | libextra/gnutls_openpgp.c | 4 | ||||
-rw-r--r-- | src/cli.c | 4 | ||||
-rw-r--r-- | src/common.c | 4 | ||||
-rw-r--r-- | src/serv.c | 70 |
10 files changed, 39 insertions, 94 deletions
diff --git a/configure.in b/configure.in index ae9bf4f9b0..fbddb6969d 100644 --- a/configure.in +++ b/configure.in @@ -302,22 +302,27 @@ else fi +dnl Check whether to disable OpenPGP authentication completely +dnl from libgnutls-extra. + ac_enable_openpgp=yes AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support]) AC_ARG_ENABLE( openpgp-authentication, [ --disable-openpgp-authentication Disable the OpenPGP authentication support], ac_enable_openpgp=no ) -if test x$ac_enable_openpgp != xno; then - AC_MSG_RESULT(no) -else - AC_DEFINE(HAVE_LIBOPENCDK, 1, [have libopencdk]) +if test x$ac_enable_openpgp = xno; then AC_MSG_RESULT(yes) +else + AC_DEFINE(USE_OPENPGP, 1, [use openpgp authentication]) + AC_MSG_RESULT(no) fi AM_CONDITIONAL(ENABLE_OPENPGP, test "$ac_enable_openpgp" = "yes") -if test x$ac_enable_openpgp != xno; then +dnl Test whether to use the included opencdk library +dnl +if test x$ac_enable_openpgp = xyes; then AC_ARG_WITH(included-opencdk, [ --with-included-opencdk Use the included opencdk], ac_enable_included_opencdk=$withval, @@ -337,11 +342,12 @@ if test x$ac_enable_included_opencdk = xno;then ]]) ) fi -fi AC_MSG_CHECKING([whether to use the included opencdk]) AC_MSG_RESULT($ac_enable_included_opencdk) +fi + AM_CONDITIONAL(ENABLE_INCLUDED_OPENCDK, test "$ac_enable_included_opencdk" = "yes") diff --git a/lib/gnutls_compress_int.c b/lib/gnutls_compress_int.c index 9b98ca84be..2b83f92d4d 100644 --- a/lib/gnutls_compress_int.c +++ b/lib/gnutls_compress_int.c @@ -24,20 +24,24 @@ #include <gnutls_compress.h> #include <gnutls_algorithms.h> #include "gnutls_errors.h" -#ifdef USE_MINILZO -# include "../libextra/minilzo.h" /* get the prototypes only. + +#ifdef USE_LZO +# ifdef USE_MINILZO +# include "../libextra/minilzo.h" /* get the prototypes only. * Since LZO is a GPLed library, the gnutls_global_init_extra() has * to be called, before LZO compression can be used. */ -#else -# include <lzo1x.h> -#endif +# else +# include <lzo1x.h> +# endif typedef int (*LZO_FUNC)(); LZO_FUNC _gnutls_lzo1x_decompress_safe = NULL; LZO_FUNC _gnutls_lzo1x_1_compress = NULL; +#endif + /* The flag d is the direction (compress, decompress). Non zero is * decompress. */ @@ -93,6 +97,7 @@ int err; break; } #endif +#ifdef USE_LZO case GNUTLS_COMP_LZO: if (d) /* LZO does not use memory on decompressor */ { /* ret->handle = NULL; */ } @@ -108,6 +113,7 @@ int err; } break; +#endif } return ret; } @@ -147,6 +153,7 @@ int err; */ switch( handle->algo) { +#ifdef USE_LZO case GNUTLS_COMP_LZO: { lzo_uint out_len; size_t size; @@ -172,7 +179,8 @@ int err; compressed_size = out_len; break; - } + } +#endif #ifdef HAVE_LIBZ case GNUTLS_COMP_DEFLATE: { uLongf size; @@ -238,6 +246,7 @@ int cur_pos; */ switch(handle->algo) { +#ifdef USE_LZO case GNUTLS_COMP_LZO: { lzo_uint out_size; lzo_uint new_size; @@ -272,7 +281,7 @@ int cur_pos; plain_size = new_size; break; } - +#endif #ifdef HAVE_LIBZ case GNUTLS_COMP_DEFLATE: { uLongf out_size; diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index cf4d3e5398..2cbe9a688f 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -2377,7 +2377,7 @@ inline static int check_server_params( gnutls_session session, gnutls_kx_algorit if (remove == 1) return 1; - +#ifdef ENABLE_ANON } else if ( cred_type == GNUTLS_CRD_ANON) { anon_cred = _gnutls_get_cred(session->key, cred_type, NULL); @@ -2385,6 +2385,7 @@ inline static int check_server_params( gnutls_session session, gnutls_kx_algorit if (anon_cred != NULL) { dh_params = _gnutls_anon_get_dh_params(anon_cred, session); } +#endif } else return 0; /* no need for params */ diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c index 3a6a6d9907..7a39b827a1 100644 --- a/lib/gnutls_priority.c +++ b/lib/gnutls_priority.c @@ -191,7 +191,7 @@ int gnutls_protocol_set_priority(gnutls_session session, const int *list) int gnutls_certificate_type_set_priority(gnutls_session session, const int *list) { -#ifdef HAVE_LIBOPENCDK +#ifdef USE_OPENPGP int num = 0, i; diff --git a/libextra/Makefile.am b/libextra/Makefile.am index ed10ceee4b..b8a97332f1 100644 --- a/libextra/Makefile.am +++ b/libextra/Makefile.am @@ -31,6 +31,7 @@ lib_LTLIBRARIES = libgnutls-extra.la endif if ENABLE_OPENPGP +PGP_SOURCES = gnutls_openpgp.c if ENABLE_INCLUDED_OPENCDK SUBDIRS = openpgp opencdk PGP_OBJECTS = openpgp/libpgp.la opencdk/libopencdk.la @@ -53,7 +54,7 @@ endif COBJECTS_EXTRA = ext_srp.c \ gnutls_srp.c auth_srp.c auth_srp_passwd.c auth_srp_sb64.c \ - gnutls_extra.c auth_srp_rsa.c gnutls_openpgp.c + gnutls_extra.c auth_srp_rsa.c $(PGP_SOURCES) libgnutls_extra_la_LDFLAGS = $(libgnutls_extra_version_script_cmd) \ diff --git a/libextra/gnutls_extra.c b/libextra/gnutls_extra.c index ebf6607421..42283cf41c 100644 --- a/libextra/gnutls_extra.c +++ b/libextra/gnutls_extra.c @@ -168,7 +168,7 @@ extern OPENPGP_KEY_DEINIT _E_gnutls_openpgp_key_deinit; extern OPENPGP_PRIVKEY_DEINIT _E_gnutls_openpgp_privkey_deinit; static void _gnutls_add_openpgp_functions(void) { -#ifdef HAVE_LIBOPENCDK +#ifdef USE_OPENPGP _E_gnutls_openpgp_verify_key = _gnutls_openpgp_verify_key; _E_gnutls_openpgp_get_raw_key_expiration_time = _gnutls_openpgp_get_raw_key_expiration_time; _E_gnutls_openpgp_get_raw_key_creation_time = _gnutls_openpgp_get_raw_key_creation_time; diff --git a/libextra/gnutls_openpgp.c b/libextra/gnutls_openpgp.c index d3661e37ba..64aa0ccb21 100644 --- a/libextra/gnutls_openpgp.c +++ b/libextra/gnutls_openpgp.c @@ -26,8 +26,6 @@ #include "gnutls_datum.h" #include "gnutls_global.h" #include <openpgp/gnutls_openpgp.h> - -#ifdef HAVE_LIBOPENCDK #include <strfile.h> #include <gnutls_str.h> #include <stdio.h> @@ -1144,5 +1142,3 @@ int gnutls_certificate_set_openpgp_key(gnutls_certificate_credentials res, } -#endif /* HAVE_LIBOPENCDK */ - @@ -207,7 +207,7 @@ static void load_keys(void) munmap_file(data); } -#ifdef HAVE_LIBOPENCDK +#ifdef USE_OPENPGP if (pgp_certfile != NULL && pgp_keyfile != NULL) { data = mmap_file(pgp_certfile); if (data.data == NULL) { @@ -953,7 +953,7 @@ static void init_global_tls_stuff(void) load_keys(); -#ifdef HAVE_LIBOPENCDK +#ifdef USE_OPENPGP if (pgp_keyring != NULL) { ret = gnutls_certificate_set_openpgp_keyring_file(xcred, diff --git a/src/common.c b/src/common.c index 3a886918e4..2c3bb5fcf7 100644 --- a/src/common.c +++ b/src/common.c @@ -210,7 +210,7 @@ void print_x509_info(gnutls_session session, const char* hostname) } -#ifdef HAVE_LIBOPENCDK +#ifdef USE_OPENPGP void print_openpgp_info(gnutls_session session, const char* hostname) { @@ -460,7 +460,7 @@ void print_cert_info(gnutls_session session, const char* hostname) printf("X.509\n"); print_x509_info(session, hostname); break; -#ifdef HAVE_LIBOPENCDK +#ifdef USE_OPENPGP case GNUTLS_CRT_OPENPGP: printf("OpenPGP\n"); print_openpgp_info(session, hostname); diff --git a/src/serv.c b/src/serv.c index 6cfbd6ca02..f711608c2f 100644 --- a/src/serv.c +++ b/src/serv.c @@ -38,15 +38,6 @@ #include <config.h> #include <list.h> -#ifdef HAVE_LIBOPENCDK -# include <opencdk.h> - -static int -recv_openpgp_key(gnutls_session session, const unsigned char *keyfpr, - unsigned int keyfpr_length, gnutls_datum * key); -#endif - - /* konqueror cannot handle sending the page in multiple * pieces. */ @@ -294,10 +285,6 @@ gnutls_session initialize_session(void) */ gnutls_handshake_set_private_extensions(session, 1); -#if HAVE_LIBOPENCDK - gnutls_openpgp_set_recv_key_function(session, recv_openpgp_key); -#endif - if (nodb == 0) { gnutls_db_set_retrieve_function(session, wrap_db_fetch); gnutls_db_set_remove_function(session, wrap_db_delete); @@ -642,7 +629,7 @@ int main(int argc, char **argv) } #endif -#ifdef HAVE_LIBOPENCDK +#ifdef USE_OPENPGP if (pgp_keyring != NULL) { ret = gnutls_certificate_set_openpgp_keyring_file(cert_cred, @@ -1165,58 +1152,3 @@ void print_serv_license(void) "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n", stdout); } -#ifdef HAVE_LIBOPENCDK - -static int -recv_openpgp_key(gnutls_session session, const unsigned char *keyfpr, - unsigned int keyfpr_length, gnutls_datum * key) -{ - static const char hostname[] = "hkp://wwwkeys.pgp.net"; - static const int port = 11371; - int rc; - cdk_kbnode_t knode = NULL; - unsigned int i; - - fprintf(stderr, "must recv: "); - for (i = 0; i < keyfpr_length; i++) { - fprintf(stderr, "%x", (unsigned char)keyfpr[i]); - } - fprintf(stderr, "\n"); - - /* The key fingerprint should be 20 bytes - * in v4 keys. - */ - if (keyfpr_length != 20) - return -1; - - rc = cdk_keyserver_recv_key(hostname, port, keyfpr, - CDK_DBSEARCH_FPR, &knode); - - if (!rc) { - size_t len; - - cdk_kbnode_write_to_mem(knode, NULL, &len); - - key->data = gnutls_malloc(len); - if (key->data == NULL) { - rc = -1; - goto finish; - } - - key->size = len; - cdk_kbnode_write_to_mem(knode, key->data, &len); - - rc = 0; /* success */ - - } else { - rc = -1; - } - - finish: - - cdk_kbnode_release(knode); - return rc; - -} - -#endif |