diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-02-10 16:51:18 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-02-10 16:51:18 +0000 |
commit | 2d62af78d73dc21cfd7c7da0a2d19fc400e51106 (patch) | |
tree | 5ba9279da6fcca4b6e293c2c9b7b0b955cd7ade7 /lib | |
parent | fff5ae5d94e48bdc019f354a537d0fdbece4bc53 (diff) | |
download | gnutls-2d62af78d73dc21cfd7c7da0a2d19fc400e51106.tar.gz |
renamed gnutls_x509_fingerprint to gnutls_fingerprint.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/debug.c | 14 | ||||
-rw-r--r-- | lib/debug.h | 1 | ||||
-rw-r--r-- | lib/gnutls.h.in.in | 4 | ||||
-rw-r--r-- | lib/gnutls_errors.c | 1 | ||||
-rw-r--r-- | lib/gnutls_global.c | 6 | ||||
-rw-r--r-- | lib/gnutls_ui.c | 11 | ||||
-rw-r--r-- | lib/gnutls_ui.h | 26 | ||||
-rw-r--r-- | lib/x509/compat.h | 2 | ||||
-rw-r--r-- | lib/x509/rfc2818_hostname.c | 9 | ||||
-rw-r--r-- | lib/x509/x509.c | 5 |
10 files changed, 21 insertions, 58 deletions
diff --git a/lib/debug.c b/lib/debug.c index 643cb1c8ac..4cf1da5296 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -121,17 +121,3 @@ static char str[512]; } #endif -#ifdef DEBUG -int gnutls_x509_extract_certificate_dn( const gnutls_datum*, gnutls_x509_dn*); - -const char* GET_CN( gnutls_datum cert) { -static gnutls_x509_dn dn; - - if (gnutls_x509_extract_certificate_dn( &cert, &dn) >= 0) - return &dn.common_name[0]; - else - return NULL; - -} - -#endif diff --git a/lib/debug.h b/lib/debug.h index 86b9179089..63779a75a8 100644 --- a/lib/debug.h +++ b/lib/debug.h @@ -23,5 +23,4 @@ void _gnutls_print_state(gnutls_session session); void _gnutls_dump_mpi(char* prefix,MPI a); const char* _gnutls_packet2str( int packet); const char* _gnutls_handshake2str( int handshake); -char* GET_CN( gnutls_datum); #endif diff --git a/lib/gnutls.h.in.in b/lib/gnutls.h.in.in index 1b010fce5f..31d297b219 100644 --- a/lib/gnutls.h.in.in +++ b/lib/gnutls.h.in.in @@ -390,6 +390,4 @@ void* gnutls_session_get_ptr(gnutls_session session); void gnutls_openpgp_send_key(gnutls_session session, gnutls_openpgp_key_status status); -int gnutls_x509_fingerprint(gnutls_digest_algorithm algo, const gnutls_datum* data, char* result, size_t* result_size); - - +int gnutls_fingerprint(gnutls_digest_algorithm algo, const gnutls_datum* data, char* result, size_t* result_size); diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c index e7b99de1c1..e3cc2196c7 100644 --- a/lib/gnutls_errors.c +++ b/lib/gnutls_errors.c @@ -273,7 +273,6 @@ void _gnutls_log( const char *fmt, ...) { * be called. This may affect performance. */ void _gnutls_null_log( void* x, ...) { return; } -char* GET_CN( gnutls_datum x) { return NULL; } const char* _gnutls_handshake2str( int handshake) { return NULL; } char * _gnutls_bin2hex(const unsigned char *old, const size_t oldlen) { return NULL; } diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c index 4634f0859e..d8b85462cf 100644 --- a/lib/gnutls_global.c +++ b/lib/gnutls_global.c @@ -61,12 +61,12 @@ void gnutls_global_set_log_function( GNUTLS_LOG_FUNC log_func) { } +#ifdef DEBUG /* default logging function */ static void dlog( const char* str) { -#ifdef DEBUG fputs( str, stderr); -#endif } +#endif extern gnutls_alloc_function gnutls_secure_malloc; extern gnutls_alloc_function gnutls_malloc; @@ -176,7 +176,9 @@ int gnutls_global_init( void) /* set default recv/send functions */ +#ifdef DEBUG gnutls_global_set_log_function( dlog); +#endif /* initialize parser * This should not deal with files in the final diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c index 38a8244348..58f971107d 100644 --- a/lib/gnutls_ui.c +++ b/lib/gnutls_ui.c @@ -220,9 +220,10 @@ const gnutls_datum *gnutls_certificate_get_ours(gnutls_session session) * @session: is a gnutls session * @list_size: is the length of the certificate list * - * This function will return the peer's raw certificate (list) as sent by the peer. - * These certificates are in raw format (DER encoded for X509). - * In case of a X509 then a certificate list may be present. + * This function will return the peer's raw certificate (list) as + * sent by the peer. + * These certificates are in raw format (DER encoded for X.509). + * In case of a X.509 then a certificate list may be present. * The first certificate in the list is the peer's certificate, * following the issuer's certificate, then the issuer's issuer etc. * Returns NULL in case of an error, or if no certificate was sent. @@ -267,7 +268,7 @@ int gnutls_certificate_client_get_request_status(gnutls_session session) typedef gnutls_mac_algorithm gnutls_digest_algorithm; /** - * gnutls_x509_fingerprint - This function calculates the fingerprint of the given data + * gnutls_fingerprint - This function calculates the fingerprint of the given data * @algo: is a digest algorithm * @data: is the data * @result: is the place where the result will be copied. @@ -280,7 +281,7 @@ typedef gnutls_mac_algorithm gnutls_digest_algorithm; * Returns a negative value in case of an error. * **/ -int gnutls_x509_fingerprint(gnutls_digest_algorithm algo, const gnutls_datum* data, char* result, size_t* result_size) +int gnutls_fingerprint(gnutls_digest_algorithm algo, const gnutls_datum* data, char* result, size_t* result_size) { GNUTLS_HASH_HANDLE td; int hash_len = _gnutls_hash_get_algo_len(algo); diff --git a/lib/gnutls_ui.h b/lib/gnutls_ui.h index aea5f2cbb6..b8e793f37d 100644 --- a/lib/gnutls_ui.h +++ b/lib/gnutls_ui.h @@ -1,32 +1,6 @@ #ifndef GNUTLS_UI_H # define GNUTLS_UI_H - -/* Extra definitions */ - -#define GNUTLS_X509_CN_SIZE 256 -#define GNUTLS_X509_C_SIZE 3 -#define GNUTLS_X509_O_SIZE 256 -#define GNUTLS_X509_OU_SIZE 256 -#define GNUTLS_X509_L_SIZE 256 -#define GNUTLS_X509_S_SIZE 256 -#define GNUTLS_X509_EMAIL_SIZE 256 - -typedef struct { - char common_name[GNUTLS_X509_CN_SIZE]; - char country[GNUTLS_X509_C_SIZE]; - char organization[GNUTLS_X509_O_SIZE]; - char organizational_unit_name[GNUTLS_X509_OU_SIZE]; - char locality_name[GNUTLS_X509_L_SIZE]; - char state_or_province_name[GNUTLS_X509_S_SIZE]; - char email[GNUTLS_X509_EMAIL_SIZE]; -} gnutls_x509_dn; - -typedef struct { - char name[GNUTLS_X509_CN_SIZE]; - char email[GNUTLS_X509_CN_SIZE]; -} gnutls_openpgp_name; - typedef enum gnutls_x509_subject_alt_name { GNUTLS_SAN_DNSNAME=1, GNUTLS_SAN_RFC822NAME, GNUTLS_SAN_URI, GNUTLS_SAN_IPADDRESS diff --git a/lib/x509/compat.h b/lib/x509/compat.h index bc2b6212af..7e60f131db 100644 --- a/lib/x509/compat.h +++ b/lib/x509/compat.h @@ -1,3 +1,5 @@ +#include <gnutls/compat8.h> + 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/lib/x509/rfc2818_hostname.c b/lib/x509/rfc2818_hostname.c index d595ed139e..ec857aa829 100644 --- a/lib/x509/rfc2818_hostname.c +++ b/lib/x509/rfc2818_hostname.c @@ -25,6 +25,7 @@ #include <x509.h> #include <dn.h> #include <common.h> +#include <gnutls/compat8.h> static int hostname_compare(const char *certname, const char *hostname); @@ -43,8 +44,8 @@ static int hostname_compare(const char *certname, const char *hostname); int gnutls_x509_check_certificates_hostname(const gnutls_datum * cert, const char *hostname) { - - char dnsname[GNUTLS_X509_CN_SIZE]; +#define MAX_CN 256 + char dnsname[MAX_CN]; int dnsnamesize; int found_dnsname = 0; int ret = 0; @@ -67,7 +68,7 @@ int gnutls_x509_check_certificates_hostname(const gnutls_datum * cert, */ for (i = 0; !(ret < 0); i++) { - dnsnamesize = GNUTLS_X509_CN_SIZE; + dnsnamesize = MAX_CN; ret = gnutls_x509_extract_certificate_subject_alt_name(cert, i, dnsname, @@ -154,7 +155,7 @@ int gnutls_x509_certificate_check_hostname(gnutls_x509_certificate cert, const char *hostname) { - char dnsname[GNUTLS_X509_CN_SIZE]; + char dnsname[MAX_CN]; int dnsnamesize; int found_dnsname = 0; int ret = 0; diff --git a/lib/x509/x509.c b/lib/x509/x509.c index fc45dd872d..abaab1ea49 100644 --- a/lib/x509/x509.c +++ b/lib/x509/x509.c @@ -19,7 +19,6 @@ * */ -#include <libtasn1.h> #include <gnutls_int.h> #include <gnutls_datum.h> #include <gnutls_global.h> @@ -30,6 +29,7 @@ #include <x509.h> #include <dn.h> #include <extensions.h> +#include <libtasn1.h> /** * gnutls_x509_certificate_init - This function initializes a gnutls_crl structure @@ -577,7 +577,7 @@ int gnutls_x509_certificate_get_pk_algorithm( gnutls_x509_certificate cert, int* * error code. * Returns GNUTLS_E_SHORT_MEMORY_BUFFER if ret_size is not enough to hold the alternative * name, or the type of alternative name if everything was ok. The type is - * one of the enumerated GNUTLS_X509_SUBJECT_ALT_NAME. + * one of the enumerated gnutls_x509_subject_alt_name. * * If the certificate does not have an Alternative name with the specified * sequence number then returns GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; @@ -995,3 +995,4 @@ int gnutls_x509_certificate_check_revocation(gnutls_x509_certificate cert, } return 0; /* not revoked. */ } + |