From: Nikos Mavrogiannopoulos Date: Sun, 2 Jun 2002 20:50:02 +0000 (+0000) Subject: Removed stubs for srp and anonymous authentication. Added test suite directory. X-Git-Tag: gnutls_0_4_with_libtasn1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f9c45f1aa8f2cb437a99588bdaf87d5d72d3ead;p=thirdparty%2Fgnutls.git Removed stubs for srp and anonymous authentication. Added test suite directory. --- diff --git a/Makefile.am b/Makefile.am index bfce46c067..4034696740 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in EXTRA_DIST = ChangeLog NEWS INSTALL README THANKS COPYING PGPKEYS COPYING.LIB -SUBDIRS = lib libextra src doc +SUBDIRS = lib libextra src doc tests ChangeLog: cvs2cl --utc -U .cvsusers --fsf -t -S --prune diff --git a/NEWS b/NEWS index 195a327224..a49a0d488f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +Version ?.?.? +- Added X.509 certificate tests in tests/ directory + Version 0.4.3 (23/05/2002) - The gnutls-extra library now compiles fine, if the opencdk library is not present. diff --git a/configure.in b/configure.in index 72d6c0adce..9b1c3abb87 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ AC_DEFINE_UNQUOTED(T_OS, "$target_os") dnl Gnutls Version GNUTLS_MAJOR_VERSION=0 GNUTLS_MINOR_VERSION=4 -GNUTLS_MICRO_VERSION=3 +GNUTLS_MICRO_VERSION=4 GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION") @@ -341,7 +341,8 @@ AC_CONFIG_COMMANDS([lib/gnutls.h],[[ AC_CONFIG_FILES([Makefile src/Makefile libextra/Makefile lib/Makefile \ lib/libgnutls-config libextra/libgnutls-extra-config \ doc/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \ -doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile ]) +doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile \ +tests/Makefile ]) AC_OUTPUT diff --git a/doc/TODO b/doc/TODO index 269bead0c1..f23d2d6f07 100644 --- a/doc/TODO +++ b/doc/TODO @@ -4,8 +4,6 @@ in order to avoid having people working on the same thing. Current list: * Audit the code -* Optimize functions which now return malloc'd data -* Minimize footprint. * Add function(s) to get the DHE/A parameters * Add function(s) to extract the certificate key's parameters * Add PKCS-12 support diff --git a/lib/gnutls_anon_cred.c b/lib/gnutls_anon_cred.c index 8fc90566d5..00314013ac 100644 --- a/lib/gnutls_anon_cred.c +++ b/lib/gnutls_anon_cred.c @@ -92,24 +92,4 @@ int gnutls_anon_allocate_client_sc( GNUTLS_ANON_CLIENT_CREDENTIALS *sc) { return 0; } -#else /* No ANON: define stubs */ - -void gnutls_anon_free_server_sc( GNUTLS_ANON_SERVER_CREDENTIALS sc) { - return; -} - -int gnutls_anon_allocate_server_sc( GNUTLS_ANON_SERVER_CREDENTIALS *sc) { - - return GNUTLS_E_UNIMPLEMENTED_FEATURE; -} - -void gnutls_anon_free_client_sc( GNUTLS_ANON_CLIENT_CREDENTIALS sc) { - return; -} - - -int gnutls_anon_allocate_client_sc( GNUTLS_ANON_CLIENT_CREDENTIALS *sc) { - return GNUTLS_E_UNIMPLEMENTED_FEATURE; -} - #endif diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index de2d10a797..636b4eaec0 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -978,7 +978,6 @@ static int _gnutls_check_key_cert_match( GNUTLS_CERTIFICATE_CREDENTIALS res) { } #define MAX_FILE_SIZE 100*1024 -#define CERT_SEP "-----BEGIN" /* Reads a DER encoded certificate list from memory and stores it to * a gnutls_cert structure. This is only called if PKCS7 read fails. @@ -1162,13 +1161,13 @@ static int parse_pem_cert_mem( gnutls_cert** cert_list, int* ncerts, gnutls_free(b64); /* now we move ptr after the pem header */ - ptr = strstr(ptr, CERT_SEP); + ptr = strstr(ptr, PEM_CERT_SEP); if (ptr!=NULL) ptr++; i++; count++; - } while ((ptr = strstr(ptr, CERT_SEP)) != NULL); + } while ((ptr = strstr(ptr, PEM_CERT_SEP)) != NULL); *ncerts = i - 1; @@ -2024,101 +2023,6 @@ int _gnutls_check_x509_key_usage(const gnutls_cert * cert, return 0; } -#ifdef DEBUG - -/* Verifies a base64 encoded certificate list from memory - */ -int _gnutls_verify_x509_mem( const char *ca, int ca_size) -{ - int siz, siz2, i; - opaque *b64; - const char *ptr; - int ret; - gnutls_datum tmp; - gnutls_cert* x509_ca_list=NULL; - int x509_ncas; - - siz = ca_size; - - ptr = ca; - - i = 1; - - do { - siz2 = _gnutls_fbase64_decode(ptr, siz, &b64); - siz -= siz2; /* FIXME: this is not enough - */ - - if (siz2 < 0) { - gnutls_assert(); - return GNUTLS_E_PARSING_ERROR; - } - - x509_ca_list = - (gnutls_cert *) gnutls_realloc( x509_ca_list, - i * - sizeof(gnutls_cert)); - if (x509_ca_list == NULL) { - gnutls_assert(); - gnutls_free(b64); - return GNUTLS_E_MEMORY_ERROR; - } - - tmp.data = b64; - tmp.size = siz2; - - if ((ret = - _gnutls_x509_cert2gnutls_cert(&x509_ca_list[i - 1], - tmp)) < 0) { - gnutls_assert(); - gnutls_free(b64); - return ret; - } - gnutls_free(b64); - - /* now we move ptr after the pem header */ - ptr = strstr(ptr, CERT_SEP); - if (ptr!=NULL) - ptr++; - - i++; - } while ((ptr = strstr(ptr, CERT_SEP)) != NULL); - - x509_ncas = i - 1; - - siz = _gnutls_x509_verify_certificate( x509_ca_list, x509_ncas-1, - &x509_ca_list[x509_ncas-1], 1, NULL, 0); - - return siz; -} - - - -/* Reads and verifies a base64 encoded certificate file - */ -int _gnutls_verify_x509_file( char *cafile) -{ - int siz; - char x[MAX_FILE_SIZE]; - FILE *fd1; - - fd1 = fopen(cafile, "rb"); - if (fd1 == NULL) { - gnutls_assert(); - return GNUTLS_E_FILE_ERROR; - } - - siz = fread(x, 1, sizeof(x)-1, fd1); - fclose(fd1); - - x[siz] = 0; - - return _gnutls_verify_x509_mem( x, siz); -} - - - -#endif /** * gnutls_x509_pkcs7_extract_certificate - This function returns a certificate in a PKCS7 certificate set diff --git a/lib/gnutls_x509.h b/lib/gnutls_x509.h index 5e8bba52e8..9c6ef036d4 100644 --- a/lib/gnutls_x509.h +++ b/lib/gnutls_x509.h @@ -4,6 +4,8 @@ int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert); #define MAX_INT_DIGITS 4 void _gnutls_int2str(unsigned int k, char *data); +#define PEM_CERT_SEP "-----BEGIN" + int _gnutls_check_x509_key_usage( const gnutls_cert * cert, KXAlgorithm alg); time_t gnutls_x509_extract_certificate_activation_time( const gnutls_datum*); time_t gnutls_x509_extract_certificate_expiration_time( const gnutls_datum*); diff --git a/libextra/gnutls_srp.c b/libextra/gnutls_srp.c index d1b1a422df..29e7030a86 100644 --- a/libextra/gnutls_srp.c +++ b/libextra/gnutls_srp.c @@ -526,42 +526,4 @@ const char *gnutls_srp_server_get_username(GNUTLS_STATE state) return info->username; } - -#else /* NO SRP: so define stubs */ - -const char *gnutls_srp_server_get_username(GNUTLS_STATE state) -{ - return NULL; -} - -void gnutls_srp_free_client_sc( GNUTLS_SRP_CLIENT_CREDENTIALS sc) { - return; -} - -int gnutls_srp_allocate_client_sc( GNUTLS_SRP_CLIENT_CREDENTIALS *sc) { - return GNUTLS_E_UNIMPLEMENTED_FEATURE; -} - -int gnutls_srp_set_client_cred( GNUTLS_SRP_CLIENT_CREDENTIALS res, char *username, char * password) { - return GNUTLS_E_UNIMPLEMENTED_FEATURE; -} - -void gnutls_srp_free_server_sc( GNUTLS_SRP_SERVER_CREDENTIALS sc) { - return; -} - -int gnutls_srp_allocate_server_sc( GNUTLS_SRP_SERVER_CREDENTIALS *sc) { - return GNUTLS_E_UNIMPLEMENTED_FEATURE; -} - -int gnutls_srp_set_server_cred_file( GNUTLS_SRP_SERVER_CREDENTIALS res, char *password_file, char * password_conf_file) { - return GNUTLS_E_UNIMPLEMENTED_FEATURE; -} - -void gnutls_srp_server_set_select_func(GNUTLS_STATE state, - srp_server_select_func - * func) { - return; -} - #endif /* ENABLE_SRP */