summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2001-05-15 09:33:22 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2001-05-15 09:33:22 +0000
commitc3b03bf60c538ef1581f11dee39b405ecf3b94a7 (patch)
treef3d8d943bcd0ad3ee32dac6c304054fddbd6a393
parent41462f60113b1d852ee316c2cf395bf5cf940c74 (diff)
downloadgnutls-c3b03bf60c538ef1581f11dee39b405ecf3b94a7.tar.gz
Added libgnutls-config script
gnutls.h is automaticaly generated by configure script Added libgnutls.m4
-rw-r--r--acconfig.h1
-rw-r--r--acinclude.m4164
-rwxr-xr-xchangelog-update.sh2
-rw-r--r--configure.in18
-rw-r--r--lib/Makefile.am7
-rw-r--r--lib/gnutls.c74
-rw-r--r--lib/gnutls.h.in (renamed from lib/gnutls.h)49
-rw-r--r--lib/gnutls_auth.c2
-rw-r--r--lib/gnutls_errors.h39
-rw-r--r--lib/gnutls_errors_int.h36
-rwxr-xr-xlib/libgnutls-config.in93
-rw-r--r--lib/libgnutls.m4160
-rw-r--r--src/Makefile.am6
-rw-r--r--src/serv.c2
14 files changed, 403 insertions, 250 deletions
diff --git a/acconfig.h b/acconfig.h
index cc3a33a79d..ec08fbdeb2 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -19,4 +19,5 @@
#undef USE_DMALLOC
#undef USE_GCRYPT
+#undef GNUTLS_VERSION
\ No newline at end of file
diff --git a/acinclude.m4 b/acinclude.m4
index 90ef457ccb..b606a63548 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,163 +1 @@
-dnl Autoconf macros for libgcrypt
-dnl $id$
-
-# Configure paths for GCRYPT
-# Shamelessly stolen from the one of XDELTA by Owen Taylor
-# Werner Koch 99-12-09
-
-dnl AM_PATH_GCRYPT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
-dnl Test for gcrypt, and define GCRYPT_CFLAGS and GCRYPT_LIBS
-dnl
-AC_DEFUN(AM_PATH_GCRYPT,
-[dnl
-dnl Get the cflags and libraries from the libgcrypt-config script
-dnl
-AC_ARG_WITH(gcrypt-prefix,
- [ --with-gcrypt-prefix=PFX Prefix where gcrypt is installed (optional)],
- gcrypt_config_prefix="$withval", gcrypt_config_prefix="")
-AC_ARG_ENABLE(gcrypttest,
- [ --disable-gcrypttest Do not try to compile and run a test gcrypt program],
- , enable_gcrypttest=yes)
-
- if test x$gcrypt_config_prefix != x ; then
- gcrypt_config_args="$gcrypt_config_args --prefix=$gcrypt_config_prefix"
- if test x${GCRYPT_CONFIG+set} != xset ; then
- GCRYPT_CONFIG=$gcrypt_config_prefix/bin/libgcrypt-config
- fi
- fi
-
- AC_PATH_PROG(GCRYPT_CONFIG, libgcrypt-config, no)
- min_gcrypt_version=ifelse([$1], ,1.1.0,$1)
- AC_MSG_CHECKING(for gcrypt - version >= $min_gcrypt_version)
- no_gcrypt=""
- if test "$GCRYPT_CONFIG" = "no" ; then
- no_gcrypt=yes
- else
- GCRYPT_CFLAGS=`$GCRYPT_CONFIG $gcrypt_config_args --cflags`
- GCRYPT_LIBS=`$GCRYPT_CONFIG $gcrypt_config_args --libs`
- gcrypt_config_version=`$GCRYPT_CONFIG $gcrypt_config_args --version`
- if test "x$enable_gcrypttest" = "xyes" ; then
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GCRYPT_CFLAGS"
- LIBS="$LIBS $GCRYPT_LIBS"
-dnl
-dnl Now check if the installed gcrypt is sufficiently new. Also sanity
-dnl checks the results of libgcrypt-config to some extent
-dnl
- rm -f conf.gcrypttest
- AC_TRY_RUN([
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gcrypt.h>
-
-int
-main ()
-{
- system ("touch conf.gcrypttest");
-
- if( strcmp( gcry_check_version(NULL), "$gcrypt_config_version" ) )
- {
- printf("\n*** 'libgcrypt-config --version' returned %s, but GCRYPT (%s)\n",
- "$gcrypt_config_version", gcry_check_version(NULL) );
- printf("*** was found! If libgcrypt-config was correct, then it is best\n");
- printf("*** to remove the old version of GCRYPT. You may also be able to fix the error\n");
- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
- printf("*** required on your system.\n");
- printf("*** If libgcrypt-config was wrong, set the environment variable GCRYPT_CONFIG\n");
- printf("*** to point to the correct copy of libgcrypt-config, and remove the file config.cache\n");
- printf("*** before re-running configure\n");
- }
- else if ( strcmp(gcry_check_version(NULL), GCRYPT_VERSION ) )
- {
- printf("\n*** GCRYPT header file (version %s) does not match\n", GCRYPT_VERSION);
- printf("*** library (version %s)\n", gcry_check_version(NULL) );
- }
- else
- {
- if ( gcry_check_version( "$min_gcrypt_version" ) )
- {
- return 0;
- }
- else
- {
- printf("no\n*** An old version of GCRYPT (%s) was found.\n",
- gcry_check_version(NULL) );
- printf("*** You need a version of GCRYPT newer than %s. The latest version of\n",
- "$min_gcrypt_version" );
- printf("*** GCRYPT is always available from ftp://ftp.gnupg.org/pub/gcrypt/gnupg.\n");
- printf("*** (It is distributed along with GnuPG).\n");
- printf("*** \n");
- printf("*** If you have already installed a sufficiently new version, this error\n");
- printf("*** probably means that the wrong copy of the libgcrypt-config shell script is\n");
- printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of GCRYPT, but you can also set the GCRYPT_CONFIG environment to point to the\n");
- printf("*** correct copy of libgcrypt-config. (In this case, you will have to\n");
- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
- printf("*** so that the correct libraries are found at run-time))\n");
- }
- }
- return 1;
-}
-],, no_gcrypt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- if test "x$no_gcrypt" = x ; then
- AC_MSG_RESULT(yes)
- ifelse([$2], , :, [$2])
- else
- if test -f conf.gcrypttest ; then
- :
- else
- AC_MSG_RESULT(no)
- fi
- if test "$GCRYPT_CONFIG" = "no" ; then
- echo "*** The libgcrypt-config script installed by GCRYPT could not be found"
- echo "*** If GCRYPT was installed in PREFIX, make sure PREFIX/bin is in"
- echo "*** your path, or set the GCRYPT_CONFIG environment variable to the"
- echo "*** full path to libgcrypt-config."
- else
- if test -f conf.gcrypttest ; then
- :
- else
- echo "*** Could not run gcrypt test program, checking why..."
- CFLAGS="$CFLAGS $GCRYPT_CFLAGS"
- LIBS="$LIBS $GCRYPT_LIBS"
- AC_TRY_LINK([
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gcrypt.h>
-], [ return !!gcry_check_version(NULL); ],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding GCRYPT or finding the wrong"
- echo "*** version of GCRYPT. If it is not finding GCRYPT, you'll need to set your"
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
- echo "*** to the installed location Also, make sure you have run ldconfig if that"
- echo "*** is required on your system"
- echo "***"
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
- echo "***" ],
- [ echo "*** The test program failed to compile or link. See the file config.log for the"
- echo "*** exact error that occured. This usually means GCRYPT was incorrectly installed"
- echo "*** or that you have moved GCRYPT since it was installed. In the latter case, you"
- echo "*** may want to edit the libgcrypt-config script: $GCRYPT_CONFIG" ])
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
- GCRYPT_CFLAGS=""
- GCRYPT_LIBS=""
- ifelse([$3], , :, [$3])
- fi
- AC_SUBST(GCRYPT_CFLAGS)
- AC_SUBST(GCRYPT_LIBS)
- rm -f conf.gcrypttest
-])
-
-dnl *-*wedit:notab*-* Please keep this as the last line.
+include(libgcrypt.m4)
diff --git a/changelog-update.sh b/changelog-update.sh
index 298eca0dbc..f1781ec9d3 100755
--- a/changelog-update.sh
+++ b/changelog-update.sh
@@ -1 +1 @@
-rcs2log -u "nmav Nikos Mavroyanopoulos nmav@hellug.gr" > ChangeLog
+rcs2log -u "nmav Nikos Mavroyanopoulos nmav@hellug.gr" -u "wkoch Werner Koch wk@gnupg.org"> ChangeLog
diff --git a/configure.in b/configure.in
index 3df36b3119..98dd836c08 100644
--- a/configure.in
+++ b/configure.in
@@ -11,9 +11,10 @@ AC_DEFINE_UNQUOTED(T_OS, "$target_os")
GNUTLS_MAJOR_VERSION=0
GNUTLS_MINOR_VERSION=1
-GNUTLS_MICRO_VERSION=1
+GNUTLS_MICRO_VERSION=3
GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION
+AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION")
AM_INIT_AUTOMAKE(gnutls, $GNUTLS_VERSION)
AM_CONFIG_HEADER(config.h)
@@ -23,7 +24,7 @@ GNUTLS_MOST_RECENT_INTERFACE=$GNUTLS_MINOR_VERSION
GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
GNUTLS_OLDEST_INTERFACE=0
-AM_PATH_GCRYPT(1.1.2,,
+AM_PATH_LIBGCRYPT(1.1.2,,
AC_MSG_ERROR([[
***
*** libgcrypt was not found. You may want to get it from
@@ -145,4 +146,15 @@ AC_CHECK_SIZEOF(unsigned char, 1)
AM_PROG_LIBTOOL
-AC_OUTPUT([Makefile src/Makefile lib/Makefile doc/Makefile ])
+LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls"
+LIBGNUTLS_CFLAGS=""
+AC_SUBST(LIBGNUTLS_LIBS)
+AC_SUBST(LIBGNUTLS_CFLAGS)
+
+AC_OUTPUT_COMMANDS([
+ chmod +x lib/libgnutls-config
+ cat lib/gnutls_errors_int.h >> lib/gnutls.h
+ echo "" >> lib/gnutls.h
+])
+
+AC_OUTPUT([Makefile src/Makefile lib/Makefile lib/libgnutls-config lib/gnutls.h doc/Makefile])
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 3924e0d1f9..b7eb51c132 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,4 +1,9 @@
include_HEADERS = gnutls.h
+bin_SCRIPTS = libgnutls-config
+
+m4datadir = $(datadir)/aclocal
+m4data_DATA = libgnutls.m4
+
EXTRA_DIST = debug.h gnutls_compress.h defines.h gnutls_plaintext.h \
gnutls_cipher.h gnutls_buffers.h gnutls_errors.h gnutls_int.h \
gnutls_handshake.h gnutls_num.h gnutls_algorithms.h gnutls_dh.h \
@@ -7,7 +12,7 @@ EXTRA_DIST = debug.h gnutls_compress.h defines.h gnutls_plaintext.h \
auth_anon.h auth_dhe_dss.h gnutls_extensions.h ext_srp.h \
gnutls_auth_int.h crypt_bcrypt.h gnutls_random.h crypt_srpsha1.h \
cert_b64.h gnutls_srp.h auth_srp.h auth_srp_passwd.h gnutls_v2_compat.h \
- crypt.h
+ crypt.h libgnutls-config.in libgnutls.m4 gnutls.h.in gnutls_errors_int.h
lib_LTLIBRARIES = libgnutls.la
libgnutls_la_SOURCES = gnutls.c gnutls_compress.c debug.c gnutls_plaintext.c \
gnutls_cipher.c gnutls_buffers.c gnutls_handshake.c gnutls_num.c \
diff --git a/lib/gnutls.c b/lib/gnutls.c
index 493101519b..e2606aa8a0 100644
--- a/lib/gnutls.c
+++ b/lib/gnutls.c
@@ -41,6 +41,7 @@
# define EAGAIN EWOULDBLOCK
#endif
+const char* _gnutls_version = GNUTLS_VERSION;
GNUTLS_Version gnutls_get_current_version(GNUTLS_STATE state) {
GNUTLS_Version ver;
@@ -882,3 +883,76 @@ MACAlgorithm gnutls_get_current_mac_algorithm( GNUTLS_STATE state) {
CompressionMethod gnutls_get_current_compression_method( GNUTLS_STATE state) {
return state->security_parameters.compression_algorithm;
}
+
+/* Taken from libgcrypt */
+
+static const char*
+parse_version_number( const char *s, int *number )
+{
+ int val = 0;
+
+ if( *s == '0' && isdigit(s[1]) )
+ return NULL; /* leading zeros are not allowed */
+ for ( ; isdigit(*s); s++ ) {
+ val *= 10;
+ val += *s - '0';
+ }
+ *number = val;
+ return val < 0? NULL : s;
+}
+
+
+static const char *
+parse_version_string( const char *s, int *major, int *minor, int *micro )
+{
+ s = parse_version_number( s, major );
+ if( !s || *s != '.' )
+ return NULL;
+ s++;
+ s = parse_version_number( s, minor );
+ if( !s || *s != '.' )
+ return NULL;
+ s++;
+ s = parse_version_number( s, micro );
+ if( !s )
+ return NULL;
+ return s; /* patchlevel */
+}
+
+/****************
+ * Check that the the version of the library is at minimum the requested one
+ * and return the version string; return NULL if the condition is not
+ * satisfied. If a NULL is passed to this function, no check is done,
+ * but the version string is simply returned.
+ */
+const char *
+gcry_check_version( const char *req_version )
+{
+ const char *ver = _gnutls_version;
+ int my_major, my_minor, my_micro;
+ int rq_major, rq_minor, rq_micro;
+ const char *my_plvl, *rq_plvl;
+
+ if ( !req_version )
+ return ver;
+
+ my_plvl = parse_version_string( ver, &my_major, &my_minor, &my_micro );
+ if ( !my_plvl )
+ return NULL; /* very strange our own version is bogus */
+ rq_plvl = parse_version_string( req_version, &rq_major, &rq_minor,
+ &rq_micro );
+ if ( !rq_plvl )
+ return NULL; /* req version string is invalid */
+
+ if ( my_major > rq_major
+ || (my_major == rq_major && my_minor > rq_minor)
+ || (my_major == rq_major && my_minor == rq_minor
+ && my_micro > rq_micro)
+ || (my_major == rq_major && my_minor == rq_minor
+ && my_micro == rq_micro
+ && strcmp( my_plvl, rq_plvl ) >= 0) ) {
+ return ver;
+ }
+ return NULL;
+}
+
diff --git a/lib/gnutls.h b/lib/gnutls.h.in
index fdb7bd96ce..928b5e5e59 100644
--- a/lib/gnutls.h
+++ b/lib/gnutls.h.in
@@ -18,6 +18,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
+#define LIBGNUTLS_VERSION "@VERSION@"
+
enum ContentType { GNUTLS_APPLICATION_DATA=23 };
typedef enum ContentType ContentType;
#define GNUTLS_AES GNUTLS_RIJNDAEL
@@ -63,11 +65,12 @@ char *_gnutls_compression_get_name(CompressionMethod);
char *_gnutls_kx_get_name(KXAlgorithm algorithm);
-
+/* error functions */
int gnutls_is_fatal_error( int error);
void gnutls_perror( int error);
char* gnutls_strerror(int error);
+
#define gnutls_send( x, y, z, w, e) gnutls_send_int( x, y, GNUTLS_APPLICATION_DATA, z, w, e)
#define gnutls_recv( x, y, z, w, e) gnutls_recv_int( x, y, GNUTLS_APPLICATION_DATA, z, w, e)
@@ -100,7 +103,7 @@ int gnutls_clean_db( GNUTLS_STATE state);
int gnutls_clear_creds( GNUTLS_STATE state);
/* cred is a structure defined by the kx algorithm */
int gnutls_set_kx_cred( GNUTLS_STATE, int kx, void* cred);
-void* gnutls_get_auth_info( GNUTLS_STATE);
+const void* gnutls_get_auth_info( GNUTLS_STATE);
/* Credential structures for SRP - used in gnutls_set_cred(); */
typedef struct {
@@ -118,40 +121,8 @@ typedef struct {
} SRP_AUTH_INFO;
-/* these are deprecated must be replaced by gnutls_errors.h */
-#define GNUTLS_E_MAC_FAILED -1
-#define GNUTLS_E_UNKNOWN_CIPHER -2
-#define GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM -3
-#define GNUTLS_E_UNKNOWN_MAC_ALGORITHM -4
-#define GNUTLS_E_UNKNOWN_ERROR -5
-#define GNUTLS_E_UNKNOWN_CIPHER_TYPE -6
-#define GNUTLS_E_LARGE_PACKET -7
-#define GNUTLS_E_UNSUPPORTED_VERSION_PACKET -8
-#define GNUTLS_E_UNEXPECTED_PACKET_LENGTH -9
-#define GNUTLS_E_INVALID_SESSION -10
-#define GNUTLS_E_UNABLE_SEND_DATA -11
-#define GNUTLS_E_FATAL_ALERT_RECEIVED -12
-#define GNUTLS_E_RECEIVED_BAD_MESSAGE -13
-#define GNUTLS_E_RECEIVED_MORE_DATA -14
-#define GNUTLS_E_UNEXPECTED_PACKET -15
-#define GNUTLS_E_WARNING_ALERT_RECEIVED -16
-#define GNUTLS_E_CLOSURE_ALERT_RECEIVED -17
-#define GNUTLS_E_ERROR_IN_FINISHED_PACKET -18
-#define GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET -19
-#define GNUTLS_E_UNKNOWN_KX_ALGORITHM -20
-#define GNUTLS_E_UNKNOWN_CIPHER_SUITE -21
-#define GNUTLS_E_UNWANTED_ALGORITHM -22
-#define GNUTLS_E_MPI_SCAN_FAILED -23
-#define GNUTLS_E_DECRYPTION_FAILED -24
-#define GNUTLS_E_MEMORY_ERROR -25
-#define GNUTLS_E_DECOMPRESSION_FAILED -26
-#define GNUTLS_E_COMPRESSION_FAILED -27
-#define GNUTLS_E_AGAIN -28
-#define GNUTLS_E_EXPIRED -29
-#define GNUTLS_E_DB_ERROR -30
-#define GNUTLS_E_PWD_ERROR -31
-#define GNUTLS_E_INSUFICIENT_CRED -32
-#define GNUTLS_E_HASH_FAILED -33
-#define GNUTLS_E_PARSING_ERROR -34
-#define GNUTLS_E_MPI_PRINT_FAILED -35
-#define GNUTLS_E_UNIMPLEMENTED_FEATURE -50
+/* check gnutls version */
+const char* gnutls_check_version();
+
+
+/* error codes appended here */
diff --git a/lib/gnutls_auth.c b/lib/gnutls_auth.c
index f04e9df78b..5d20de3776 100644
--- a/lib/gnutls_auth.c
+++ b/lib/gnutls_auth.c
@@ -117,6 +117,6 @@ void *_gnutls_get_kx_cred( GNUTLS_KEY key, int kx, int *err) {
return ccred->credentials;
}
-void* gnutls_get_auth_info( GNUTLS_STATE state) {
+const void* gnutls_get_auth_info( GNUTLS_STATE state) {
return &state->gnutls_key->auth_info;
}
diff --git a/lib/gnutls_errors.h b/lib/gnutls_errors.h
index bc373dfd12..62d74d5fda 100644
--- a/lib/gnutls_errors.h
+++ b/lib/gnutls_errors.h
@@ -19,44 +19,7 @@
*/
#include "gnutls_int.h"
-
-#define GNUTLS_E_MAC_FAILED -1
-#define GNUTLS_E_UNKNOWN_CIPHER -2
-#define GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM -3
-#define GNUTLS_E_UNKNOWN_MAC_ALGORITHM -4
-#define GNUTLS_E_UNKNOWN_ERROR -5
-#define GNUTLS_E_UNKNOWN_CIPHER_TYPE -6
-#define GNUTLS_E_LARGE_PACKET -7
-#define GNUTLS_E_UNSUPPORTED_VERSION_PACKET -8
-#define GNUTLS_E_UNEXPECTED_PACKET_LENGTH -9
-#define GNUTLS_E_INVALID_SESSION -10
-#define GNUTLS_E_UNABLE_SEND_DATA -11
-#define GNUTLS_E_FATAL_ALERT_RECEIVED -12
-#define GNUTLS_E_RECEIVED_BAD_MESSAGE -13
-#define GNUTLS_E_RECEIVED_MORE_DATA -14
-#define GNUTLS_E_UNEXPECTED_PACKET -15
-#define GNUTLS_E_WARNING_ALERT_RECEIVED -16
-#define GNUTLS_E_CLOSURE_ALERT_RECEIVED -17
-#define GNUTLS_E_ERROR_IN_FINISHED_PACKET -18
-#define GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET -19
-#define GNUTLS_E_UNKNOWN_KX_ALGORITHM -20
-#define GNUTLS_E_UNKNOWN_CIPHER_SUITE -21
-#define GNUTLS_E_UNWANTED_ALGORITHM -22
-#define GNUTLS_E_MPI_SCAN_FAILED -23
-#define GNUTLS_E_DECRYPTION_FAILED -24
-#define GNUTLS_E_MEMORY_ERROR -25
-#define GNUTLS_E_DECOMPRESSION_FAILED -26
-#define GNUTLS_E_COMPRESSION_FAILED -27
-#define GNUTLS_E_AGAIN -28
-#define GNUTLS_E_EXPIRED -29
-#define GNUTLS_E_DB_ERROR -30
-#define GNUTLS_E_PWD_ERROR -31
-#define GNUTLS_E_INSUFICIENT_CRED -32
-#define GNUTLS_E_HASH_FAILED -33
-#define GNUTLS_E_PARSING_ERROR -34
-#define GNUTLS_E_MPI_PRINT_FAILED -35
-#define GNUTLS_E_UNIMPLEMENTED_FEATURE -50
-
+#include "gnutls_errors_int.h"
#ifdef DEBUG
# ifdef __FILE__
diff --git a/lib/gnutls_errors_int.h b/lib/gnutls_errors_int.h
new file mode 100644
index 0000000000..c0817ebdfe
--- /dev/null
+++ b/lib/gnutls_errors_int.h
@@ -0,0 +1,36 @@
+#define GNUTLS_E_MAC_FAILED -1
+#define GNUTLS_E_UNKNOWN_CIPHER -2
+#define GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM -3
+#define GNUTLS_E_UNKNOWN_MAC_ALGORITHM -4
+#define GNUTLS_E_UNKNOWN_ERROR -5
+#define GNUTLS_E_UNKNOWN_CIPHER_TYPE -6
+#define GNUTLS_E_LARGE_PACKET -7
+#define GNUTLS_E_UNSUPPORTED_VERSION_PACKET -8
+#define GNUTLS_E_UNEXPECTED_PACKET_LENGTH -9
+#define GNUTLS_E_INVALID_SESSION -10
+#define GNUTLS_E_UNABLE_SEND_DATA -11
+#define GNUTLS_E_FATAL_ALERT_RECEIVED -12
+#define GNUTLS_E_RECEIVED_BAD_MESSAGE -13
+#define GNUTLS_E_RECEIVED_MORE_DATA -14
+#define GNUTLS_E_UNEXPECTED_PACKET -15
+#define GNUTLS_E_WARNING_ALERT_RECEIVED -16
+#define GNUTLS_E_CLOSURE_ALERT_RECEIVED -17
+#define GNUTLS_E_ERROR_IN_FINISHED_PACKET -18
+#define GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET -19
+#define GNUTLS_E_UNKNOWN_KX_ALGORITHM -20
+#define GNUTLS_E_UNKNOWN_CIPHER_SUITE -21
+#define GNUTLS_E_UNWANTED_ALGORITHM -22
+#define GNUTLS_E_MPI_SCAN_FAILED -23
+#define GNUTLS_E_DECRYPTION_FAILED -24
+#define GNUTLS_E_MEMORY_ERROR -25
+#define GNUTLS_E_DECOMPRESSION_FAILED -26
+#define GNUTLS_E_COMPRESSION_FAILED -27
+#define GNUTLS_E_AGAIN -28
+#define GNUTLS_E_EXPIRED -29
+#define GNUTLS_E_DB_ERROR -30
+#define GNUTLS_E_PWD_ERROR -31
+#define GNUTLS_E_INSUFICIENT_CRED -32
+#define GNUTLS_E_HASH_FAILED -33
+#define GNUTLS_E_PARSING_ERROR -34
+#define GNUTLS_E_MPI_PRINT_FAILED -35
+#define GNUTLS_E_UNIMPLEMENTED_FEATURE -50
diff --git a/lib/libgnutls-config.in b/lib/libgnutls-config.in
new file mode 100755
index 0000000000..9191ce5f26
--- /dev/null
+++ b/lib/libgnutls-config.in
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+exec_prefix_set=no
+
+gnutls_libs="@LIBGNUTLS_LIBS@"
+gnutls_cflags="@LIBGNUTLS_CFLAGS@"
+
+
+usage()
+{
+ cat <<EOF
+Usage: gnutls-config [OPTIONS]
+Options:
+ [--prefix[=DIR]]
+ [--exec-prefix[=DIR]]
+ [--version]
+ [--libs]
+ [--cflags]
+EOF
+ exit $1
+}
+
+if test $# -eq 0; then
+ usage 1 1>&2
+fi
+
+while test $# -gt 0; do
+ case "$1" in
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ case $1 in
+ --prefix=*)
+ prefix=$optarg
+ if test $exec_prefix_set = no ; then
+ exec_prefix=$optarg
+ fi
+ ;;
+ --prefix)
+ echo_prefix=yes
+ ;;
+ --exec-prefix=*)
+ exec_prefix=$optarg
+ exec_prefix_set=yes
+ ;;
+ --exec-prefix)
+ echo_exec_prefix=yes
+ ;;
+ --version)
+ echo "@VERSION@"
+ exit 0
+ ;;
+ --cflags)
+ echo_cflags=yes
+ ;;
+ --libs)
+ echo_libs=yes
+ ;;
+ *)
+ usage 1 1>&2
+ ;;
+ esac
+ shift
+done
+
+if test "$echo_prefix" = "yes"; then
+ echo $prefix
+fi
+
+if test "$echo_exec_prefix" = "yes"; then
+ echo $exec_prefix
+fi
+
+if test "$echo_cflags" = "yes"; then
+ if test "@includedir@" != "/usr/include" ; then
+ includes="-I@includedir@"
+ for i in $gnutls_cflags ; do
+ if test "$i" = "-I@includedir@" ; then
+ includes=""
+ fi
+ done
+ fi
+ echo $includes $gnutls_cflags
+fi
+
+if test "$echo_libs" = "yes"; then
+ echo ${gnutls_libs}
+fi
+
+
diff --git a/lib/libgnutls.m4 b/lib/libgnutls.m4
new file mode 100644
index 0000000000..904093b06b
--- /dev/null
+++ b/lib/libgnutls.m4
@@ -0,0 +1,160 @@
+dnl Autoconf macros for libgnutls
+dnl $id$
+
+# Modified for LIBGNUTLS -- nmav
+# Configure paths for LIBGCRYPT
+# Shamelessly stolen from the one of XDELTA by Owen Taylor
+# Werner Koch 99-12-09
+
+dnl AM_PATH_LIBGNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+dnl Test for libgnutls, and define GCRYPT_CFLAGS and GCRYPT_LIBS
+dnl
+AC_DEFUN(AM_PATH_LIBGNUTLS,
+[dnl
+dnl Get the cflags and libraries from the libgnutls-config script
+dnl
+AC_ARG_WITH(libgnutls-prefix,
+ [ --with-libgnutls-prefix=PFX Prefix where libgnutls is installed (optional)],
+ libgnutls_config_prefix="$withval", libgnutls_config_prefix="")
+
+ if test x$libgnutls_config_prefix != x ; then
+ libgnutls_config_args="$libgnutls_config_args --prefix=$libgnutls_config_prefix"
+ if test x${LIBGNUTLS_CONFIG+set} != xset ; then
+ LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
+ fi
+ fi
+
+ AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
+ min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
+ AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
+ no_libgnutls=""
+ if test "$LIBGNUTLS_CONFIG" = "no" ; then
+ no_libgnutls=yes
+ else
+ LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
+ LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
+ libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
+ if test "x$enable_libgnutlstest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
+ LIBS="$LIBS $LIBGNUTLS_LIBS"
+dnl
+dnl Now check if the installed libgnutls is sufficiently new. Also sanity
+dnl checks the results of libgnutls-config to some extent
+dnl
+ rm -f conf.libgnutlstest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gcrypt.h>
+
+int
+main ()
+{
+ system ("touch conf.libgnutlstest");
+
+ if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
+ {
+ printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
+ "$libgnutls_config_version", gcry_check_version(NULL) );
+ printf("*** was found! If libgnutls-config was correct, then it is best\n");
+ printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
+ printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+ printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+ printf("*** required on your system.\n");
+ printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
+ printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
+ printf("*** before re-running configure\n");
+ }
+ else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
+ {
+ printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
+ printf("*** library (version %s)\n", gcry_check_version(NULL) );
+ }
+ else
+ {
+ if ( gnutls_check_version( "$min_libgnutls_version" ) )
+ {
+ return 0;
+ }
+ else
+ {
+ printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
+ gcry_check_version(NULL) );
+ printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
+ "$min_libgnutls_version" );
+ printf("*** LIBGNUTLS is always available from ftp://ftp.gnupg.org/pub/libgnutls/gnupg.\n");
+ printf("*** (It is distributed along with GnuPG).\n");
+ printf("*** \n");
+ printf("*** If you have already installed a sufficiently new version, this error\n");
+ printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
+ printf("*** being found. The easiest way to fix this is to remove the old version\n");
+ printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
+ printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
+ printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+ printf("*** so that the correct libraries are found at run-time))\n");
+ }
+ }
+ return 1;
+}
+],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_libgnutls" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ if test -f conf.libgnutlstest ; then
+ :
+ else
+ AC_MSG_RESULT(no)
+ fi
+ if test "$LIBGNUTLS_CONFIG" = "no" ; then
+ echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
+ echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
+ echo "*** full path to libgnutls-config."
+ else
+ if test -f conf.libgnutlstest ; then
+ :
+ else
+ echo "*** Could not run libgnutls test program, checking why..."
+ CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
+ LIBS="$LIBS $LIBGNUTLS_LIBS"
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gcrypt.h>
+], [ return !!gcry_check_version(NULL); ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
+ echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+ echo "***" ],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
+ echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
+ echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ LIBGNUTLS_CFLAGS=""
+ LIBGNUTLS_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(LIBGNUTLS_CFLAGS)
+ AC_SUBST(LIBGNUTLS_LIBS)
+])
+
+dnl *-*wedit:notab*-* Please keep this as the last line.
diff --git a/src/Makefile.am b/src/Makefile.am
index 5b090ecbc6..d38df53923 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,9 +2,9 @@ EXTRA_DIST = port.h crypt.gaa gaa.h README.crypt
INCLUDES = -I../lib
noinst_PROGRAMS = serv cli crypt
serv_SOURCES = serv.c
-serv_LDADD = ../lib/libgnutls.la $(GCRYPT_LIBS)
+serv_LDADD = ../lib/libgnutls.la $(LIBGCRYPT_LIBS)
crypt_SOURCES = crypt.c gaaout.c
-crypt_LDADD = ../lib/libgnutls.la $(GCRYPT_LIBS)
+crypt_LDADD = ../lib/libgnutls.la $(LIBGCRYPT_LIBS)
cli_SOURCES = cli.c
-cli_LDADD = ../lib/libgnutls.la $(GCRYPT_LIBS)
+cli_LDADD = ../lib/libgnutls.la $(LIBGCRYPT_LIBS)
diff --git a/src/serv.c b/src/serv.c
index d678f805c6..40a75b2099 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -46,7 +46,7 @@ int main()
char buffer[MAX_BUF+1];
int optval = 1;
SRP_SERVER_CREDENTIALS cred;
- SRP_AUTH_INFO *info;
+ const SRP_AUTH_INFO *info;
/* this is a password file (created with the included crypt utility)
* Read README.crypt prior to using SRP.