diff options
-rw-r--r-- | doc/examples/ex-cert-select.c | 6 | ||||
-rw-r--r-- | includes/gnutls/gnutls.h.in | 6 | ||||
-rw-r--r-- | includes/gnutls/gnutlsxx.h | 10 | ||||
-rw-r--r-- | includes/gnutls/openpgp.h | 24 | ||||
-rw-r--r-- | includes/gnutls/pkcs12.h | 8 | ||||
-rw-r--r-- | lib/auth_dh_common.c | 4 | ||||
-rw-r--r-- | lib/auth_dhe_psk.c | 4 | ||||
-rw-r--r-- | lib/auth_psk.c | 10 | ||||
-rw-r--r-- | lib/auth_psk.h | 8 | ||||
-rw-r--r-- | lib/auth_psk_passwd.c | 8 | ||||
-rw-r--r-- | lib/auth_psk_passwd.h | 4 | ||||
-rw-r--r-- | lib/gnutls_psk.c | 4 | ||||
-rw-r--r-- | lib/gnutls_session.c | 4 | ||||
-rw-r--r-- | lib/gnutls_session_pack.c | 34 | ||||
-rw-r--r-- | lib/gnutls_x509.c | 14 | ||||
-rw-r--r-- | lib/gnutlsxx.cpp | 6 | ||||
-rw-r--r-- | lib/x509/output.c | 4 | ||||
-rw-r--r-- | src/certtool-cfg.c | 38 | ||||
-rw-r--r-- | src/certtool-cfg.h | 38 | ||||
-rw-r--r-- | src/certtool.c | 194 | ||||
-rw-r--r-- | src/cli.c | 36 | ||||
-rw-r--r-- | src/common.c | 30 | ||||
-rw-r--r-- | src/common.h | 4 | ||||
-rw-r--r-- | src/crypt.c | 30 | ||||
-rw-r--r-- | src/prime.c | 6 | ||||
-rw-r--r-- | src/psk.c | 4 | ||||
-rw-r--r-- | src/serv.c | 44 | ||||
-rw-r--r-- | src/tests.c | 112 | ||||
-rw-r--r-- | src/tests.h | 66 | ||||
-rw-r--r-- | src/tls_test.c | 14 |
30 files changed, 389 insertions, 385 deletions
diff --git a/doc/examples/ex-cert-select.c b/doc/examples/ex-cert-select.c index ac31fd70fc..038adc13c0 100644 --- a/doc/examples/ex-cert-select.c +++ b/doc/examples/ex-cert-select.c @@ -39,11 +39,11 @@ gnutls_x509_privkey_t key; /* Helper functions to load a certificate and key * files into memory. */ -static gnutls_datum +static gnutls_datum_t load_file (const char *file) { FILE *f; - gnutls_datum loaded_file = { NULL, 0 }; + gnutls_datum_t loaded_file = { NULL, 0 }; long filelen; void *ptr; @@ -62,7 +62,7 @@ load_file (const char *file) return loaded_file; } -static void unload_file(gnutls_datum data) +static void unload_file(gnutls_datum_t data) { free(data.data); } diff --git a/includes/gnutls/gnutls.h.in b/includes/gnutls/gnutls.h.in index 801c82cafe..e448a03ebd 100644 --- a/includes/gnutls/gnutls.h.in +++ b/includes/gnutls/gnutls.h.in @@ -539,7 +539,7 @@ extern "C" int gnutls_session_get_data (gnutls_session_t session, void *session_data, size_t * session_data_size); int gnutls_session_get_data2 (gnutls_session_t session, - gnutls_datum * data); + gnutls_datum_t * data); /* returns the session ID */ #define GNUTLS_MAX_SESSION_ID 32 @@ -924,7 +924,7 @@ extern "C" * sc); int gnutls_psk_set_client_credentials (gnutls_psk_client_credentials_t res, const char *username, - const gnutls_datum * key, + const gnutls_datum_t * key, gnutls_psk_key_flags format); void gnutls_psk_free_server_credentials (gnutls_psk_server_credentials_t @@ -946,7 +946,7 @@ extern "C" typedef int gnutls_psk_client_credentials_function (gnutls_session_t, char **username, - gnutls_datum * key); + gnutls_datum_t * key); void gnutls_psk_set_client_credentials_function (gnutls_psk_client_credentials_t cred, diff --git a/includes/gnutls/gnutlsxx.h b/includes/gnutls/gnutlsxx.h index 555900a4d8..be1fe5a0e3 100644 --- a/includes/gnutls/gnutlsxx.h +++ b/includes/gnutls/gnutlsxx.h @@ -172,10 +172,10 @@ class session unsigned int get_dh_prime_bits() const; void get_dh_group( gnutls_datum_t & gen, gnutls_datum_t & prime) const; void get_dh_pubkey( gnutls_datum_t & raw_key) const; - void get_rsa_export_pubkey( gnutls_datum& exponent, gnutls_datum& modulus) const; + void get_rsa_export_pubkey( gnutls_datum_t& exponent, gnutls_datum_t& modulus) const; unsigned int get_rsa_export_modulus_bits() const; - void get_our_certificate(gnutls_datum & cert) const; + void get_our_certificate(gnutls_datum_t & cert) const; bool get_peers_certificate(std::vector<gnutls_datum_t> &out_certs) const; bool get_peers_certificate(const gnutls_datum_t** certs, unsigned int *certs_size) const; @@ -190,9 +190,9 @@ class DB { public: virtual ~DB()=0; - virtual bool store( const gnutls_datum& key, const gnutls_datum& data)=0; - virtual bool retrieve( const gnutls_datum& key, gnutls_datum& data)=0; - virtual bool remove( const gnutls_datum& key)=0; + virtual bool store( const gnutls_datum_t& key, const gnutls_datum_t& data)=0; + virtual bool retrieve( const gnutls_datum_t& key, gnutls_datum_t& data)=0; + virtual bool remove( const gnutls_datum_t& key)=0; }; class server_session: public session diff --git a/includes/gnutls/openpgp.h b/includes/gnutls/openpgp.h index be7a2b5297..229e58176e 100644 --- a/includes/gnutls/openpgp.h +++ b/includes/gnutls/openpgp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation + * Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -43,14 +43,16 @@ extern "C" typedef enum gnutls_openpgp_key_fmt { GNUTLS_OPENPGP_FMT_RAW, GNUTLS_OPENPGP_FMT_BASE64 - } gnutls_openpgp_key_fmt; + } gnutls_openpgp_key_fmt_t; - int gnutls_openpgp_key_init (gnutls_openpgp_key * key); /* initializes the memory for gnutls_openpgp_key_t struct */ - void gnutls_openpgp_key_deinit (gnutls_openpgp_key_t key); /* frees all memory */ + /* initializes the memory for gnutls_openpgp_key_t struct */ + int gnutls_openpgp_key_init (gnutls_openpgp_key_t * key); + /* frees all memory */ + void gnutls_openpgp_key_deinit (gnutls_openpgp_key_t key); int gnutls_openpgp_key_import (gnutls_openpgp_key_t key, const gnutls_datum_t * data, - gnutls_openpgp_key_fmt format); + gnutls_openpgp_key_fmt_t format); int gnutls_openpgp_key_export (gnutls_openpgp_key_t key, gnutls_openpgp_key_fmt_t format, void *output_data, @@ -94,20 +96,20 @@ extern "C" unsigned int *bits); int gnutls_openpgp_privkey_import (gnutls_openpgp_privkey_t key, const gnutls_datum_t * data, - gnutls_openpgp_key_fmt format, + gnutls_openpgp_key_fmt_t format, const char *pass, unsigned int flags); /* Keyring stuff. */ struct gnutls_openpgp_keyring_int; /* object to hold (parsed) openpgp keyrings */ - typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring; + typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring_t; - int gnutls_openpgp_keyring_init (gnutls_openpgp_keyring * keyring); + int gnutls_openpgp_keyring_init (gnutls_openpgp_keyring_t * keyring); void gnutls_openpgp_keyring_deinit (gnutls_openpgp_keyring_t keyring); int gnutls_openpgp_keyring_import (gnutls_openpgp_keyring_t keyring, const gnutls_datum_t * data, - gnutls_openpgp_key_fmt format); + gnutls_openpgp_key_fmt_t format); int gnutls_openpgp_keyring_check_id (gnutls_openpgp_keyring_t ring, const unsigned char keyid[8], @@ -116,9 +118,9 @@ extern "C" /* Trustdb functions. */ struct gnutls_openpgp_trustdb_int; /* object to hold (parsed) openpgp trustdbs */ - typedef struct gnutls_openpgp_trustdb_int *gnutls_openpgp_trustdb; + typedef struct gnutls_openpgp_trustdb_int *gnutls_openpgp_trustdb_t; - int gnutls_openpgp_trustdb_init (gnutls_openpgp_trustdb * trustdb); + int gnutls_openpgp_trustdb_init (gnutls_openpgp_trustdb_t * trustdb); void gnutls_openpgp_trustdb_deinit (gnutls_openpgp_trustdb_t trustdb); int gnutls_openpgp_trustdb_import (gnutls_openpgp_trustdb_t trustdb, diff --git a/includes/gnutls/pkcs12.h b/includes/gnutls/pkcs12.h index c46da6f3bc..ba330a4ddb 100644 --- a/includes/gnutls/pkcs12.h +++ b/includes/gnutls/pkcs12.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2004, 2005 Free Software Foundation + * Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -44,9 +44,11 @@ extern "C" void gnutls_pkcs12_deinit (gnutls_pkcs12_t pkcs12); int gnutls_pkcs12_import (gnutls_pkcs12_t pkcs12, const gnutls_datum_t * data, - gnutls_x509_crt_fmt format, unsigned int flags); + gnutls_x509_crt_fmt_t format, + unsigned int flags); int gnutls_pkcs12_export (gnutls_pkcs12_t pkcs12, - gnutls_x509_crt_fmt format, void *output_data, + gnutls_x509_crt_fmt_t format, + void *output_data, size_t * output_data_size); int gnutls_pkcs12_get_bag (gnutls_pkcs12_t pkcs12, diff --git a/lib/auth_dh_common.c b/lib/auth_dh_common.c index 7310cb8eab..d636aeba76 100644 --- a/lib/auth_dh_common.c +++ b/lib/auth_dh_common.c @@ -96,7 +96,7 @@ _gnutls_proc_dh_common_client_kx (gnutls_session_t session, } else /* In DHE_PSK the key is set differently */ { - gnutls_datum tmp_dh_key; + gnutls_datum_t tmp_dh_key; ret = _gnutls_mpi_dprint (&tmp_dh_key, session->key->KEY); if (ret < 0) { @@ -179,7 +179,7 @@ _gnutls_gen_dh_common_client_kx (gnutls_session_t session, opaque ** data) } else /* In DHE_PSK the key is set differently */ { - gnutls_datum tmp_dh_key; + gnutls_datum_t tmp_dh_key; ret = _gnutls_mpi_dprint (&tmp_dh_key, session->key->KEY); if (ret < 0) { diff --git a/lib/auth_dhe_psk.c b/lib/auth_dhe_psk.c index 2586604eca..3345e53421 100644 --- a/lib/auth_dhe_psk.c +++ b/lib/auth_dhe_psk.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Free Software Foundation + * Copyright (C) 2005, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -176,7 +176,7 @@ proc_psk_client_kx (gnutls_session_t session, opaque * data, const mpi_t *mpis; gnutls_psk_server_credentials_t cred; psk_auth_info_t info; - gnutls_datum username; + gnutls_datum_t username; ssize_t data_size = _data_size; cred = (gnutls_psk_server_credentials_t) diff --git a/lib/auth_psk.c b/lib/auth_psk.c index 60c83873f5..f1ef0c1164 100644 --- a/lib/auth_psk.c +++ b/lib/auth_psk.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Free Software Foundation + * Copyright (C) 2005, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -61,10 +61,10 @@ const mod_auth_st psk_auth_struct = { */ int _gnutls_set_psk_session_key (gnutls_session_t session, - gnutls_datum * dh_secret) + gnutls_datum_t * dh_secret) { - gnutls_datum pwd_psk = { NULL, 0 }; - gnutls_datum *ppsk; + gnutls_datum_t pwd_psk = { NULL, 0 }; + gnutls_datum_t *ppsk; size_t dh_secret_size; int ret; @@ -198,7 +198,7 @@ _gnutls_proc_psk_client_kx (gnutls_session_t session, opaque * data, { ssize_t data_size = _data_size; int ret; - gnutls_datum username; + gnutls_datum_t username; gnutls_psk_server_credentials_t cred; psk_auth_info_t info; diff --git a/lib/auth_psk.h b/lib/auth_psk.h index 6e086c3974..6d2174319f 100644 --- a/lib/auth_psk.h +++ b/lib/auth_psk.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Free Software Foundation + * Copyright (C) 2005, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -30,8 +30,8 @@ typedef struct gnutls_psk_client_credentials_st { - gnutls_datum username; - gnutls_datum key; + gnutls_datum_t username; + gnutls_datum_t key; gnutls_psk_client_credentials_function *get_function; } psk_client_credentials_st; @@ -64,7 +64,7 @@ typedef struct psk_auth_info_st typedef struct psk_auth_info_st psk_auth_info_st; int -_gnutls_set_psk_session_key (gnutls_session_t session, gnutls_datum * psk2); +_gnutls_set_psk_session_key (gnutls_session_t session, gnutls_datum_t * psk2); #else # define _gnutls_set_psk_session_key(x,y) GNUTLS_E_INTERNAL_ERROR #endif /* ENABLE_PSK */ diff --git a/lib/auth_psk_passwd.c b/lib/auth_psk_passwd.c index 6bb523113e..a82ade6a23 100644 --- a/lib/auth_psk_passwd.c +++ b/lib/auth_psk_passwd.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Free Software Foundation + * Copyright (C) 2005, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -44,7 +44,7 @@ * string(username):hex(passwd) */ static int -pwd_put_values (gnutls_datum * psk, char *str) +pwd_put_values (gnutls_datum_t * psk, char *str) { char *p; int len, ret; @@ -93,7 +93,7 @@ pwd_put_values (gnutls_datum * psk, char *str) * Returns 0 on success. */ static int -_randomize_psk (gnutls_datum * psk) +_randomize_psk (gnutls_datum_t * psk) { psk->data = gnutls_malloc (16); if (psk->data == NULL) @@ -117,7 +117,7 @@ _randomize_psk (gnutls_datum * psk) */ int _gnutls_psk_pwd_find_entry (gnutls_session_t session, char *username, - gnutls_datum * psk) + gnutls_datum_t * psk) { gnutls_psk_server_credentials_t cred; FILE *fd; diff --git a/lib/auth_psk_passwd.h b/lib/auth_psk_passwd.h index fe1726dbab..6eca95b25a 100644 --- a/lib/auth_psk_passwd.h +++ b/lib/auth_psk_passwd.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Free Software Foundation + * Copyright (C) 2005, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -26,6 +26,6 @@ /* this is locally allocated. It should be freed using the provided function */ int _gnutls_psk_pwd_find_entry (gnutls_session_t, char *username, - gnutls_datum * key); + gnutls_datum_t * key); #endif /* ENABLE_SRP */ diff --git a/lib/gnutls_psk.c b/lib/gnutls_psk.c index 9fa091cae3..a6be1a5e05 100644 --- a/lib/gnutls_psk.c +++ b/lib/gnutls_psk.c @@ -93,7 +93,7 @@ gnutls_psk_allocate_client_credentials (gnutls_psk_client_credentials_t * sc) int gnutls_psk_set_client_credentials (gnutls_psk_client_credentials_t res, const char *username, - const gnutls_datum * key, + const gnutls_datum_t * key, gnutls_psk_key_flags flags) { int ret; @@ -260,7 +260,7 @@ gnutls_psk_set_server_credentials_function (gnutls_psk_server_credentials_t * password for client PSK authentication. * The callback's function form is: * int (*callback)(gnutls_session_t, char** username, - * gnutls_datum* key); + * gnutls_datum_t* key); * * The @username and @key must be allocated using gnutls_malloc(). * @username should be ASCII strings or UTF-8 strings diff --git a/lib/gnutls_session.c b/lib/gnutls_session.c index 1d500e28ec..0da2c04abe 100644 --- a/lib/gnutls_session.c +++ b/lib/gnutls_session.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2003, 2004, 2005 Free Software Foundation + * Copyright (C) 2000, 2003, 2004, 2005, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -83,7 +83,7 @@ gnutls_session_get_data (gnutls_session_t session, * Resuming sessions is really useful and speedups connections after a succesful one. **/ int -gnutls_session_get_data2 (gnutls_session_t session, gnutls_datum * data) +gnutls_session_get_data2 (gnutls_session_t session, gnutls_datum_t * data) { int ret; diff --git a/lib/gnutls_session_pack.c b/lib/gnutls_session_pack.c index 6bbe5162b0..0dbdc13d16 100644 --- a/lib/gnutls_session_pack.c +++ b/lib/gnutls_session_pack.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2004, 2005 Free Software Foundation + * Copyright (C) 2000, 2004, 2005, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -50,24 +50,24 @@ static int unpack_certificate_auth_info (gnutls_session_t, packed_session); static int unpack_srp_auth_info (gnutls_session_t session, - const gnutls_datum * packed_session); + const gnutls_datum_t * packed_session); static int pack_srp_auth_info (gnutls_session_t session, - gnutls_datum * packed_session); + gnutls_datum_t * packed_session); static int unpack_psk_auth_info (gnutls_session_t session, - const gnutls_datum * packed_session); + const gnutls_datum_t * packed_session); static int pack_psk_auth_info (gnutls_session_t session, - gnutls_datum * packed_session); + gnutls_datum_t * packed_session); static int unpack_anon_auth_info (gnutls_session_t session, - const gnutls_datum * packed_session); + const gnutls_datum_t * packed_session); static int pack_anon_auth_info (gnutls_session_t session, - gnutls_datum * packed_session); + gnutls_datum_t * packed_session); static int unpack_security_parameters (gnutls_session_t session, - const gnutls_datum * packed_session); + const gnutls_datum_t * packed_session); static int pack_security_parameters (gnutls_session_t session, - gnutls_datum * packed_session); + gnutls_datum_t * packed_session); /* Since auth_info structures contain malloced data, this function @@ -505,7 +505,7 @@ error: * x bytes the SRP username */ static int -pack_srp_auth_info (gnutls_session_t session, gnutls_datum * packed_session) +pack_srp_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) { srp_server_auth_info_t info = _gnutls_get_auth_info (session); int pack_size; @@ -547,7 +547,7 @@ pack_srp_auth_info (gnutls_session_t session, gnutls_datum * packed_session) static int unpack_srp_auth_info (gnutls_session_t session, - const gnutls_datum * packed_session) + const gnutls_datum_t * packed_session) { size_t username_size; int ret; @@ -613,7 +613,7 @@ unpack_srp_auth_info (gnutls_session_t session, * x bytes the public key */ static int -pack_anon_auth_info (gnutls_session_t session, gnutls_datum * packed_session) +pack_anon_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) { anon_auth_info_t info = _gnutls_get_auth_info (session); int pos = 0; @@ -668,7 +668,7 @@ pack_anon_auth_info (gnutls_session_t session, gnutls_datum * packed_session) static int unpack_anon_auth_info (gnutls_session_t session, - const gnutls_datum * packed_session) + const gnutls_datum_t * packed_session) { size_t pack_size; int pos = 0, size, ret; @@ -776,7 +776,7 @@ error: * x bytes the public key */ static int -pack_psk_auth_info (gnutls_session_t session, gnutls_datum * packed_session) +pack_psk_auth_info (gnutls_session_t session, gnutls_datum_t * packed_session) { psk_auth_info_t info; int pack_size, username_size = 0, pos; @@ -847,7 +847,7 @@ pack_psk_auth_info (gnutls_session_t session, gnutls_datum * packed_session) static int unpack_psk_auth_info (gnutls_session_t session, - const gnutls_datum * packed_session) + const gnutls_datum_t * packed_session) { size_t username_size; size_t pack_size; @@ -995,7 +995,7 @@ error: */ static int pack_security_parameters (gnutls_session_t session, - gnutls_datum * packed_session) + gnutls_datum_t * packed_session) { int pos = 0; size_t len, init, i; @@ -1099,7 +1099,7 @@ pack_security_parameters (gnutls_session_t session, static int unpack_security_parameters (gnutls_session_t session, - const gnutls_datum * packed_session) + const gnutls_datum_t * packed_session) { size_t pack_size, init, i; int pos = 0, len; diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index 352f0028d0..b07d4473b4 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -1702,10 +1702,10 @@ static int parse_pkcs12 (gnutls_certificate_credentials_t res, gnutls_pkcs12_t p12, const char *password, - gnutls_x509_privkey * key, + gnutls_x509_privkey_t * key, gnutls_x509_crt_t * cert, gnutls_x509_crl_t * crl) { - gnutls_pkcs12_bag bag = NULL; + gnutls_pkcs12_bag_t bag = NULL; int index = 0; int ret; @@ -1758,7 +1758,7 @@ parse_pkcs12 (gnutls_certificate_credentials_t res, for (i = 0; i < elements_in_bag; i++) { int type; - gnutls_datum data; + gnutls_datum_t data; type = gnutls_pkcs12_bag_get_type (bag, i); if (type < 0) @@ -1883,13 +1883,13 @@ done: * Return value: Returns 0 on success, or an error code. **/ int - gnutls_certificate_set_x509_simple_pkcs12_file - (gnutls_certificate_credentials_t res, const char *pkcs12file, - gnutls_x509_crt_fmt_t type, const char *password) +gnutls_certificate_set_x509_simple_pkcs12_file +(gnutls_certificate_credentials_t res, const char *pkcs12file, + gnutls_x509_crt_fmt_t type, const char *password) { gnutls_pkcs12_t p12; gnutls_datum_t p12blob; - gnutls_x509_privkey key = NULL; + gnutls_x509_privkey_t key = NULL; gnutls_x509_crt_t cert = NULL; gnutls_x509_crl_t crl = NULL; int ret; diff --git a/lib/gnutlsxx.cpp b/lib/gnutlsxx.cpp index b350c050ab..9680dbb452 100644 --- a/lib/gnutlsxx.cpp +++ b/lib/gnutlsxx.cpp @@ -257,7 +257,7 @@ bool session::get_peers_certificate(const gnutls_datum_t** certs, unsigned int * return true; } -void session::get_our_certificate(gnutls_datum& cert) const +void session::get_our_certificate(gnutls_datum_t& cert) const { const gnutls_datum_t *d; @@ -485,7 +485,7 @@ void session::get_dh_pubkey( gnutls_datum_t & raw_key) const RETWRAP(gnutls_dh_get_pubkey( this->s, &raw_key)); } -void session::get_rsa_export_pubkey( gnutls_datum& exponent, gnutls_datum& modulus) const +void session::get_rsa_export_pubkey( gnutls_datum_t& exponent, gnutls_datum_t& modulus) const { RETWRAP( gnutls_rsa_export_get_pubkey( this->s, &exponent, &modulus)); } @@ -807,7 +807,7 @@ void psk_client_credentials::set_ptr(void* p) } void psk_client_credentials::set_credentials(const char* username, - const gnutls_datum& key, gnutls_psk_key_flags flags) + const gnutls_datum_t& key, gnutls_psk_key_flags flags) { RETWRAP(gnutls_psk_set_client_credentials( this->cred, username, &key, flags)); } diff --git a/lib/x509/output.c b/lib/x509/output.c index f6dfff8fb2..4ea4d24c8e 100644 --- a/lib/x509/output.c +++ b/lib/x509/output.c @@ -613,7 +613,7 @@ print_cert (gnutls_string * str, gnutls_x509_crt_t cert, int notsigned) { case GNUTLS_PK_RSA: { - gnutls_datum m, e; + gnutls_datum_t m, e; err = gnutls_x509_crt_get_pk_rsa_raw (cert, &m, &e); if (err < 0) @@ -634,7 +634,7 @@ print_cert (gnutls_string * str, gnutls_x509_crt_t cert, int notsigned) case GNUTLS_PK_DSA: { - gnutls_datum p, q, g, y; + gnutls_datum_t p, q, g, y; err = gnutls_x509_crt_get_pk_dsa_raw (cert, &p, &q, &g, &y); if (err < 0) diff --git a/src/certtool-cfg.c b/src/certtool-cfg.c index 18090f2a05..33c28730e0 100644 --- a/src/certtool-cfg.c +++ b/src/certtool-cfg.c @@ -175,7 +175,7 @@ template_parse (const char *template) } void -read_crt_set (gnutls_x509_crt crt, const char *input_str, const char *oid) +read_crt_set (gnutls_x509_crt_t crt, const char *input_str, const char *oid) { char input[128]; int ret; @@ -196,7 +196,7 @@ read_crt_set (gnutls_x509_crt crt, const char *input_str, const char *oid) } void -read_crq_set (gnutls_x509_crq crq, const char *input_str, const char *oid) +read_crq_set (gnutls_x509_crq_t crq, const char *input_str, const char *oid) { char input[128]; int ret; @@ -322,7 +322,7 @@ get_crl_dist_point_url (void) } void -get_country_crt_set (gnutls_x509_crt crt) +get_country_crt_set (gnutls_x509_crt_t crt) { int ret; @@ -349,7 +349,7 @@ get_country_crt_set (gnutls_x509_crt crt) } void -get_organization_crt_set (gnutls_x509_crt crt) +get_organization_crt_set (gnutls_x509_crt_t crt) { int ret; @@ -378,7 +378,7 @@ get_organization_crt_set (gnutls_x509_crt crt) } void -get_unit_crt_set (gnutls_x509_crt crt) +get_unit_crt_set (gnutls_x509_crt_t crt) { int ret; @@ -406,7 +406,7 @@ get_unit_crt_set (gnutls_x509_crt crt) } void -get_state_crt_set (gnutls_x509_crt crt) +get_state_crt_set (gnutls_x509_crt_t crt) { int ret; @@ -433,7 +433,7 @@ get_state_crt_set (gnutls_x509_crt crt) } void -get_locality_crt_set (gnutls_x509_crt crt) +get_locality_crt_set (gnutls_x509_crt_t crt) { int ret; @@ -459,7 +459,7 @@ get_locality_crt_set (gnutls_x509_crt crt) } void -get_cn_crt_set (gnutls_x509_crt crt) +get_cn_crt_set (gnutls_x509_crt_t crt) { int ret; @@ -484,7 +484,7 @@ get_cn_crt_set (gnutls_x509_crt crt) } void -get_uid_crt_set (gnutls_x509_crt crt) +get_uid_crt_set (gnutls_x509_crt_t crt) { int ret; @@ -508,7 +508,7 @@ get_uid_crt_set (gnutls_x509_crt crt) } void -get_oid_crt_set (gnutls_x509_crt crt) +get_oid_crt_set (gnutls_x509_crt_t crt) { int ret, i; @@ -540,7 +540,7 @@ get_oid_crt_set (gnutls_x509_crt crt) void -get_pkcs9_email_crt_set (gnutls_x509_crt crt) +get_pkcs9_email_crt_set (gnutls_x509_crt_t crt) { int ret; @@ -897,7 +897,7 @@ get_proxy_policy (char **policy, size_t *policylen) /* CRQ stuff. */ void -get_country_crq_set (gnutls_x509_crq crq) +get_country_crq_set (gnutls_x509_crq_t crq) { int ret; @@ -924,7 +924,7 @@ get_country_crq_set (gnutls_x509_crq crq) } void -get_organization_crq_set (gnutls_x509_crq crq) +get_organization_crq_set (gnutls_x509_crq_t crq) { int ret; @@ -953,7 +953,7 @@ get_organization_crq_set (gnutls_x509_crq crq) } void -get_unit_crq_set (gnutls_x509_crq crq) +get_unit_crq_set (gnutls_x509_crq_t crq) { int ret; @@ -981,7 +981,7 @@ get_unit_crq_set (gnutls_x509_crq crq) } void -get_state_crq_set (gnutls_x509_crq crq) +get_state_crq_set (gnutls_x509_crq_t crq) { int ret; @@ -1008,7 +1008,7 @@ get_state_crq_set (gnutls_x509_crq crq) } void -get_locality_crq_set (gnutls_x509_crq crq) +get_locality_crq_set (gnutls_x509_crq_t crq) { int ret; @@ -1034,7 +1034,7 @@ get_locality_crq_set (gnutls_x509_crq crq) } void -get_cn_crq_set (gnutls_x509_crq crq) +get_cn_crq_set (gnutls_x509_crq_t crq) { int ret; @@ -1059,7 +1059,7 @@ get_cn_crq_set (gnutls_x509_crq crq) } void -get_uid_crq_set (gnutls_x509_crq crq) +get_uid_crq_set (gnutls_x509_crq_t crq) { int ret; @@ -1083,7 +1083,7 @@ get_uid_crq_set (gnutls_x509_crq crq) } void -get_oid_crq_set (gnutls_x509_crq crq) +get_oid_crq_set (gnutls_x509_crq_t crq) { int ret, i; diff --git a/src/certtool-cfg.h b/src/certtool-cfg.h index 667c3819cd..81c48e9fbf 100644 --- a/src/certtool-cfg.h +++ b/src/certtool-cfg.h @@ -12,9 +12,9 @@ extern int time_stamping_key, crl_next_update; void cfg_init (void); int template_parse (const char *template); -void read_crt_set (gnutls_x509_crt crt, const char *input_str, +void read_crt_set (gnutls_x509_crt_t crt, const char *input_str, const char *oid); -void read_crq_set (gnutls_x509_crq crq, const char *input_str, +void read_crq_set (gnutls_x509_crq_t crq, const char *input_str, const char *oid); int read_int (const char *input_str); const char *read_str (const char *input_str); @@ -23,15 +23,15 @@ int read_yesno (const char *input_str); const char *get_pass (void); const char *get_challenge_pass (void); const char *get_crl_dist_point_url (void); -void get_country_crt_set (gnutls_x509_crt crt); -void get_organization_crt_set (gnutls_x509_crt crt); -void get_unit_crt_set (gnutls_x509_crt crt); -void get_state_crt_set (gnutls_x509_crt crt); -void get_locality_crt_set (gnutls_x509_crt crt); -void get_cn_crt_set (gnutls_x509_crt crt); -void get_uid_crt_set (gnutls_x509_crt crt); -void get_pkcs9_email_crt_set (gnutls_x509_crt crt); -void get_oid_crt_set (gnutls_x509_crt crt); +void get_country_crt_set (gnutls_x509_crt_t crt); +void get_organization_crt_set (gnutls_x509_crt_t crt); +void get_unit_crt_set (gnutls_x509_crt_t crt); +void get_state_crt_set (gnutls_x509_crt_t crt); +void get_locality_crt_set (gnutls_x509_crt_t crt); +void get_cn_crt_set (gnutls_x509_crt_t crt); +void get_uid_crt_set (gnutls_x509_crt_t crt); +void get_pkcs9_email_crt_set (gnutls_x509_crt_t crt); +void get_oid_crt_set (gnutls_x509_crt_t crt); int get_serial (void); int get_days (void); int get_ca_status (void); @@ -52,12 +52,12 @@ const char *get_dns_name (void); const char *get_ip_addr (void); -void get_cn_crq_set (gnutls_x509_crq crq); -void get_uid_crq_set (gnutls_x509_crq crq); -void get_locality_crq_set (gnutls_x509_crq crq); -void get_state_crq_set (gnutls_x509_crq crq); -void get_unit_crq_set (gnutls_x509_crq crq); -void get_organization_crq_set (gnutls_x509_crq crq); -void get_country_crq_set (gnutls_x509_crq crq); -void get_oid_crq_set (gnutls_x509_crq crq); +void get_cn_crq_set (gnutls_x509_crq_t crq); +void get_uid_crq_set (gnutls_x509_crq_t crq); +void get_locality_crq_set (gnutls_x509_crq_t crq); +void get_state_crq_set (gnutls_x509_crq_t crq); +void get_unit_crq_set (gnutls_x509_crq_t crq); +void get_organization_crq_set (gnutls_x509_crq_t crq); +void get_country_crq_set (gnutls_x509_crq_t crq); +void get_oid_crq_set (gnutls_x509_crq_t crq); const char *get_proxy_policy (char **policy, size_t *policylen); diff --git a/src/certtool.c b/src/certtool.c index 24c2e5f9e2..5749600d66 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -41,7 +41,7 @@ #include <progname.h> #include <version-etc.h> -static void print_crl_info (gnutls_x509_crl crl, FILE *out); +static void print_crl_info (gnutls_x509_crl_t crl, FILE *out); int generate_prime (int bits, int how); void pkcs7_info (void); void smime_to_pkcs7 (void); @@ -49,20 +49,20 @@ void pkcs12_info (void); void generate_pkcs12 (void); void verify_chain (void); void verify_crl (void); -gnutls_x509_privkey load_private_key (int mand); -gnutls_x509_crq load_request (void); -gnutls_x509_privkey load_ca_private_key (void); -gnutls_x509_crt load_ca_cert (void); -gnutls_x509_crt load_cert (int mand); +gnutls_x509_privkey_t load_private_key (int mand); +gnutls_x509_crq_t load_request (void); +gnutls_x509_privkey_t load_ca_private_key (void); +gnutls_x509_crt_t load_ca_cert (void); +gnutls_x509_crt_t load_cert (int mand); void certificate_info (void); void crl_info (void); void privkey_info (void); -static void print_certificate_info (gnutls_x509_crt crt, FILE *out, +static void print_certificate_info (gnutls_x509_crt_t crt, FILE *out, unsigned int); static void gaa_parser (int argc, char **argv); void generate_self_signed (void); void generate_request (void); -gnutls_x509_crt *load_cert_list (int mand, int *size); +gnutls_x509_crt_t *load_cert_list (int mand, int *size); static gaainfo info; FILE *outfile; @@ -115,10 +115,10 @@ raw_to_string (const unsigned char *raw, size_t raw_size) return buf; } -static gnutls_x509_privkey +static gnutls_x509_privkey_t generate_private_key_int (void) { - gnutls_x509_privkey key; + gnutls_x509_privkey_t key; int ret, key_type; if (info.dsa) @@ -146,7 +146,7 @@ generate_private_key_int (void) } static void -print_private_key (gnutls_x509_privkey key) +print_private_key (gnutls_x509_privkey_t key) { int ret; size_t size; @@ -190,7 +190,7 @@ print_private_key (gnutls_x509_privkey key) void generate_private_key (void) { - gnutls_x509_privkey key; + gnutls_x509_privkey_t key; key = generate_private_key_int (); @@ -200,13 +200,13 @@ generate_private_key (void) } -gnutls_x509_crt -generate_certificate (gnutls_x509_privkey * ret_key, - gnutls_x509_crt ca_crt, +gnutls_x509_crt_t +generate_certificate (gnutls_x509_privkey_t * ret_key, + gnutls_x509_crt_t ca_crt, int proxy) { - gnutls_x509_crt crt; - gnutls_x509_privkey key = NULL; + gnutls_x509_crt_t crt; + gnutls_x509_privkey_t key = NULL; size_t size; int ret; int serial, client; @@ -215,7 +215,7 @@ generate_certificate (gnutls_x509_privkey * ret_key, int vers = 3; /* the default version in the certificate */ unsigned int usage = 0, server; - gnutls_x509_crq crq; /* request */ + gnutls_x509_crq_t crq; /* request */ ret = gnutls_x509_crt_init (&crt); if (ret < 0) @@ -507,11 +507,11 @@ generate_certificate (gnutls_x509_privkey * ret_key, } -gnutls_x509_crl +gnutls_x509_crl_t generate_crl (void) { - gnutls_x509_crl crl; - gnutls_x509_crt *crts; + gnutls_x509_crl_t crl; + gnutls_x509_crt_t *crts; int size; int days, result, i; time_t now = time (NULL); @@ -550,8 +550,8 @@ generate_crl (void) void generate_self_signed (void) { - gnutls_x509_crt crt; - gnutls_x509_privkey key; + gnutls_x509_crt_t crt; + gnutls_x509_privkey_t key; size_t size; int result; const char *uri; @@ -596,12 +596,12 @@ generate_self_signed (void) void generate_signed_certificate (void) { - gnutls_x509_crt crt; - gnutls_x509_privkey key; + gnutls_x509_crt_t crt; + gnutls_x509_privkey_t key; size_t size; int result; - gnutls_x509_privkey ca_key; - gnutls_x509_crt ca_crt; + gnutls_x509_privkey_t ca_key; + gnutls_x509_crt_t ca_crt; fprintf (stderr, "Generating a signed certificate...\n"); @@ -638,8 +638,8 @@ generate_signed_certificate (void) void generate_proxy_certificate (void) { - gnutls_x509_crt crt, eecrt; - gnutls_x509_privkey key, eekey; + gnutls_x509_crt_t crt, eecrt; + gnutls_x509_privkey_t key, eekey; size_t size; int result; @@ -672,10 +672,10 @@ generate_proxy_certificate (void) void generate_signed_crl (void) { - gnutls_x509_crl crl; + gnutls_x509_crl_t crl; int result; - gnutls_x509_privkey ca_key; - gnutls_x509_crt ca_crt; + gnutls_x509_privkey_t ca_key; + gnutls_x509_crt_t ca_crt; fprintf (stderr, "Generating a signed CRL...\n"); @@ -697,11 +697,11 @@ generate_signed_crl (void) void update_signed_certificate (void) { - gnutls_x509_crt crt; + gnutls_x509_crt_t crt; size_t size; int result; - gnutls_x509_privkey ca_key; - gnutls_x509_crt ca_crt; + gnutls_x509_privkey_t ca_key; + gnutls_x509_crt_t ca_crt; int days; time_t tim = time (NULL); @@ -878,10 +878,10 @@ gaa_parser (int argc, char **argv) void certificate_info (void) { - gnutls_x509_crt crt[MAX_CRTS]; + gnutls_x509_crt_t crt[MAX_CRTS]; size_t size; int ret, i, count; - gnutls_datum pem; + gnutls_datum_t pem; unsigned int crt_num; pem.data = fread_file (infile, &size); @@ -931,7 +931,7 @@ certificate_info (void) } else { - gnutls_datum xml; + gnutls_datum_t xml; ret = gnutls_x509_crt_to_xml (crt[i], &xml, GNUTLS_XML_SHOW_ALL); if (ret < 0) @@ -945,7 +945,7 @@ certificate_info (void) } static void -print_hex_datum (gnutls_datum * dat) +print_hex_datum (gnutls_datum_t * dat) { unsigned int j; #define SPACE "\t" @@ -961,7 +961,7 @@ print_hex_datum (gnutls_datum * dat) static void -print_certificate_info (gnutls_x509_crt crt, FILE *out, unsigned int all) +print_certificate_info (gnutls_x509_crt_t crt, FILE *out, unsigned int all) { gnutls_datum_t info; int ret; @@ -984,7 +984,7 @@ print_certificate_info (gnutls_x509_crt crt, FILE *out, unsigned int all) } static void -print_crl_info (gnutls_x509_crl crl, FILE *out) +print_crl_info (gnutls_x509_crl_t crl, FILE *out) { gnutls_datum_t info; int ret; @@ -1009,7 +1009,7 @@ print_crl_info (gnutls_x509_crl crl, FILE *out) void crl_info (void) { - gnutls_x509_crl crl; + gnutls_x509_crl_t crl; int ret; size_t size; gnutls_datum_t pem; @@ -1036,10 +1036,10 @@ crl_info (void) void privkey_info (void) { - gnutls_x509_privkey key; + gnutls_x509_privkey_t key; size_t size; int ret; - gnutls_datum pem; + gnutls_datum_t pem; const char *cprint; const char *pass; @@ -1083,7 +1083,7 @@ privkey_info (void) */ if (ret == GNUTLS_PK_RSA) { - gnutls_datum m, e, d, p, q, u; + gnutls_datum_t m, e, d, p, q, u; ret = gnutls_x509_privkey_export_rsa_raw (key, &m, &e, &d, &p, &q, &u); if (ret < 0) @@ -1108,7 +1108,7 @@ privkey_info (void) } else if (ret == GNUTLS_PK_DSA) { - gnutls_datum p, q, g, y, x; + gnutls_datum_t p, q, g, y, x; ret = gnutls_x509_privkey_export_dsa_raw (key, &p, &q, &g, &y, &x); if (ret < 0) @@ -1160,12 +1160,12 @@ privkey_info (void) /* Load the private key. * @mand should be non zero if it is required to read a private key. */ -gnutls_x509_privkey +gnutls_x509_privkey_t load_private_key (int mand) { - gnutls_x509_privkey key; + gnutls_x509_privkey_t key; int ret; - gnutls_datum dat; + gnutls_datum_t dat; size_t size; if (!info.privkey && !mand) @@ -1203,12 +1203,12 @@ load_private_key (int mand) /* Load the Certificate Request. */ -gnutls_x509_crq +gnutls_x509_crq_t load_request (void) { - gnutls_x509_crq crq; + gnutls_x509_crq_t crq; int ret; - gnutls_datum dat; + gnutls_datum_t dat; size_t size; if (!info.request) @@ -1236,12 +1236,12 @@ load_request (void) /* Load the CA's private key. */ -gnutls_x509_privkey +gnutls_x509_privkey_t load_ca_private_key (void) { - gnutls_x509_privkey key; + gnutls_x509_privkey_t key; int ret; - gnutls_datum dat; + gnutls_datum_t dat; size_t size; if (info.ca_privkey == NULL) @@ -1276,12 +1276,12 @@ load_ca_private_key (void) /* Loads the CA's certificate */ -gnutls_x509_crt +gnutls_x509_crt_t load_ca_cert (void) { - gnutls_x509_crt crt; + gnutls_x509_crt_t crt; int ret; - gnutls_datum dat; + gnutls_datum_t dat; size_t size; if (info.ca == NULL) @@ -1311,10 +1311,10 @@ load_ca_cert (void) * If mand is non zero then a certificate is mandatory. Otherwise * null will be returned if the certificate loading fails. */ -gnutls_x509_crt +gnutls_x509_crt_t load_cert (int mand) { - gnutls_x509_crt *crt; + gnutls_x509_crt_t *crt; int size; crt = load_cert_list (mand, &size); @@ -1326,14 +1326,14 @@ load_cert (int mand) /* Loads a certificate list */ -gnutls_x509_crt * +gnutls_x509_crt_t * load_cert_list (int mand, int *crt_size) { FILE *fd; - static gnutls_x509_crt crt[MAX_CERTS]; + static gnutls_x509_crt_t crt[MAX_CERTS]; char *ptr; int ret, i; - gnutls_datum dat; + gnutls_datum_t dat; size_t size; int ptr_size; @@ -1400,8 +1400,8 @@ load_cert_list (int mand, int *crt_size) void generate_request (void) { - gnutls_x509_crq crq; - gnutls_x509_privkey key; + gnutls_x509_crq_t crq; + gnutls_x509_privkey_t key; int ret; const char *pass; size_t size; @@ -1462,9 +1462,9 @@ generate_request (void) } -static void print_verification_res (gnutls_x509_crt crt, - gnutls_x509_crt issuer, - gnutls_x509_crl * crl_list, +static void print_verification_res (gnutls_x509_crt_t crt, + gnutls_x509_crt_t issuer, + gnutls_x509_crl_t * crl_list, int crl_list_size); #define CERT_SEP "-----BEGIN CERT" @@ -1479,9 +1479,9 @@ _verify_x509_mem (const void *cert, int cert_size) char issuer_name[256]; size_t name_size; size_t issuer_name_size; - gnutls_datum tmp; - gnutls_x509_crt *x509_cert_list = NULL; - gnutls_x509_crl *x509_crl_list = NULL; + gnutls_datum_t tmp; + gnutls_x509_crt_t *x509_cert_list = NULL; + gnutls_x509_crl_t *x509_crl_list = NULL; int x509_ncerts, x509_ncrls; @@ -1499,8 +1499,8 @@ _verify_x509_mem (const void *cert, int cert_size) do { x509_crl_list = - (gnutls_x509_crl *) realloc (x509_crl_list, - i * sizeof (gnutls_x509_crl)); + (gnutls_x509_crl_t *) realloc (x509_crl_list, + i * sizeof (gnutls_x509_crl_t)); if (x509_crl_list == NULL) error (EXIT_FAILURE, 0, "memory error"); @@ -1540,8 +1540,8 @@ _verify_x509_mem (const void *cert, int cert_size) do { x509_cert_list = - (gnutls_x509_crt *) realloc (x509_cert_list, - i * sizeof (gnutls_x509_crt)); + (gnutls_x509_crt_t *) realloc (x509_cert_list, + i * sizeof (gnutls_x509_crt_t)); if (x509_cert_list == NULL) error (EXIT_FAILURE, 0, "memory error"); @@ -1672,9 +1672,9 @@ _verify_x509_mem (const void *cert, int cert_size) } static void -print_verification_res (gnutls_x509_crt crt, - gnutls_x509_crt issuer, - gnutls_x509_crl * crl_list, int crl_list_size) +print_verification_res (gnutls_x509_crt_t crt, + gnutls_x509_crt_t issuer, + gnutls_x509_crl_t * crl_list, int crl_list_size) { unsigned int output; int comma = 0; @@ -1765,10 +1765,10 @@ verify_crl (void) unsigned int output; int comma = 0; int ret; - gnutls_datum pem; - gnutls_x509_crl crl; + gnutls_datum_t pem; + gnutls_x509_crl_t crl; time_t now = time (0); - gnutls_x509_crt issuer; + gnutls_x509_crt_t issuer; issuer = load_ca_cert (); @@ -1855,16 +1855,16 @@ verify_crl (void) void generate_pkcs12 (void) { - gnutls_pkcs12 pkcs12; - gnutls_x509_crt *crts; - gnutls_x509_privkey key; + gnutls_pkcs12_t pkcs12; + gnutls_x509_crt_t *crts; + gnutls_x509_privkey_t key; int result; size_t size; - gnutls_datum data; + gnutls_datum_t data; const char *password; const char *name; unsigned int flags; - gnutls_datum key_id; + gnutls_datum_t key_id; unsigned char _key_id[20]; int index; int ncrts; @@ -1888,7 +1888,7 @@ generate_pkcs12 (void) for (i = 0; i < ncrts; i++) { - gnutls_pkcs12_bag bag; + gnutls_pkcs12_bag_t bag; result = gnutls_pkcs12_bag_init (&bag); if (result < 0) @@ -1933,7 +1933,7 @@ generate_pkcs12 (void) if (key) { - gnutls_pkcs12_bag kbag; + gnutls_pkcs12_bag_t kbag; result = gnutls_pkcs12_bag_init (&kbag); if (result < 0) @@ -1997,7 +1997,7 @@ generate_pkcs12 (void) } const char * -BAGTYPE (gnutls_pkcs12_bag_type x) +BAGTYPE (gnutls_pkcs12_bag_type_t x) { switch (x) { @@ -2019,13 +2019,13 @@ BAGTYPE (gnutls_pkcs12_bag_type x) } void -print_bag_data (gnutls_pkcs12_bag bag) +print_bag_data (gnutls_pkcs12_bag_t bag) { int result; int count, i, type; - gnutls_datum cdata, id; + gnutls_datum_t cdata, id; const char *str, *name; - gnutls_datum out; + gnutls_datum_t out; count = gnutls_pkcs12_bag_get_count (bag); if (count < 0) @@ -2094,11 +2094,11 @@ print_bag_data (gnutls_pkcs12_bag bag) void pkcs12_info (void) { - gnutls_pkcs12 pkcs12; - gnutls_pkcs12_bag bag; + gnutls_pkcs12_t pkcs12; + gnutls_pkcs12_bag_t bag; int result; size_t size; - gnutls_datum data; + gnutls_datum_t data; const char *password; int index; @@ -2171,10 +2171,10 @@ pkcs12_info (void) void pkcs7_info (void) { - gnutls_pkcs7 pkcs7; + gnutls_pkcs7_t pkcs7; int result; size_t size; - gnutls_datum data, b64; + gnutls_datum_t data, b64; int index, count; result = gnutls_pkcs7_init (&pkcs7); @@ -83,7 +83,7 @@ static int x509ctype; static int disable_extensions; char *psk_username = NULL; -gnutls_datum psk_key = { NULL, 0 }; +gnutls_datum_t psk_key = { NULL, 0 }; static gnutls_srp_client_credentials_t srp_cred; static gnutls_psk_client_credentials_t psk_cred; @@ -118,7 +118,7 @@ static int authz_server_formats[PRI_MAX] = { typedef struct { int fd; - gnutls_session session; + gnutls_session_t session; int secure; char *hostname; char *ip; @@ -145,11 +145,11 @@ static void init_global_tls_stuff (void); /* Helper functions to load a certificate and key * files into memory. */ -static gnutls_datum +static gnutls_datum_t load_file (const char *file) { FILE *f; - gnutls_datum loaded_file = { NULL, 0 }; + gnutls_datum_t loaded_file = { NULL, 0 }; long filelen; void *ptr; @@ -169,18 +169,18 @@ load_file (const char *file) } static void -unload_file (gnutls_datum data) +unload_file (gnutls_datum_t data) { free (data.data); } #define MAX_CRT 6 static unsigned int x509_crt_size; -static gnutls_x509_crt x509_crt[MAX_CRT]; -static gnutls_x509_privkey x509_key = NULL; +static gnutls_x509_crt_t x509_crt[MAX_CRT]; +static gnutls_x509_privkey_t x509_key = NULL; -static gnutls_openpgp_key pgp_crt = NULL; -static gnutls_openpgp_privkey pgp_key = NULL; +static gnutls_openpgp_key_t pgp_crt = NULL; +static gnutls_openpgp_privkey_t pgp_key = NULL; /* Load the certificate and the private key. */ @@ -189,7 +189,7 @@ load_keys (void) { unsigned int crt_num; int ret; - gnutls_datum data; + gnutls_datum_t data; if (x509_certfile != NULL && x509_keyfile != NULL) { @@ -307,9 +307,9 @@ load_keys (void) */ static int -cert_callback (gnutls_session session, - const gnutls_datum * req_ca_rdn, int nreqs, - const gnutls_pk_algorithm * sign_algos, +cert_callback (gnutls_session_t session, + const gnutls_datum_t * req_ca_rdn, int nreqs, + const gnutls_pk_algorithm_t * sign_algos, int sign_algos_length, gnutls_retr_st * st) { char issuer_dn[256]; @@ -470,12 +470,12 @@ authz_recv_callback (gnutls_session_t session, #endif -/* initializes a gnutls_session with some defaults. +/* initializes a gnutls_session_t with some defaults. */ -static gnutls_session +static gnutls_session_t init_tls_session (const char *hostname) { - gnutls_session session; + gnutls_session_t session; gnutls_init (&session, GNUTLS_CLIENT); @@ -962,7 +962,7 @@ do_handshake (socket_st * socket) { int ret; gnutls_transport_set_ptr (socket->session, - (gnutls_transport_ptr) socket->fd); + (gnutls_transport_ptr_t) socket->fd); do { ret = gnutls_handshake (socket->session); @@ -1000,7 +1000,7 @@ do_handshake (socket_st * socket) } static int -srp_username_callback (gnutls_session session, +srp_username_callback (gnutls_session_t session, unsigned int times, char **username, char **password) { if (srp_username == NULL || srp_passwd == NULL) diff --git a/src/common.c b/src/common.c index f7cfebfdad..70adb244b9 100644 --- a/src/common.c +++ b/src/common.c @@ -84,10 +84,10 @@ my_ctime (const time_t * tv) void -print_x509_info (gnutls_session session, const char *hostname) +print_x509_info (gnutls_session_t session, const char *hostname) { - gnutls_x509_crt crt; - const gnutls_datum *cert_list; + gnutls_x509_crt_t crt; + const gnutls_datum_t *cert_list; size_t cert_list_size = 0; int ret; char digest[20]; @@ -168,7 +168,7 @@ print_x509_info (gnutls_session session, const char *hostname) if (xml) { #ifdef ENABLE_PKI - gnutls_datum xml_data; + gnutls_datum_t xml_data; ret = gnutls_x509_crt_to_xml (crt, &xml_data, 0); if (ret < 0) @@ -238,7 +238,7 @@ print_x509_info (gnutls_session session, const char *hostname) #ifdef ENABLE_PKI if (algo == GNUTLS_PK_RSA) { - gnutls_datum e, m; + gnutls_datum_t e, m; ret = gnutls_x509_crt_get_pk_rsa_raw (crt, &m, &e); if (ret >= 0) @@ -255,7 +255,7 @@ print_x509_info (gnutls_session session, const char *hostname) } else if (algo == GNUTLS_PK_DSA) { - gnutls_datum p, q, g, y; + gnutls_datum_t p, q, g, y; ret = gnutls_x509_crt_get_pk_dsa_raw (crt, &p, &q, &g, &y); if (ret >= 0) @@ -303,7 +303,7 @@ print_x509_info (gnutls_session session, const char *hostname) #ifdef ENABLE_OPENPGP void -print_openpgp_info (gnutls_session session, const char *hostname) +print_openpgp_info (gnutls_session_t session, const char *hostname) { char digest[20]; @@ -313,8 +313,8 @@ print_openpgp_info (gnutls_session session, const char *hostname) const char *cstr; char name[256]; size_t name_len = sizeof (name); - gnutls_openpgp_key crt; - const gnutls_datum *cert_list; + gnutls_openpgp_key_t crt; + const gnutls_datum_t *cert_list; int cert_list_size = 0; time_t expiret; time_t activet; @@ -374,7 +374,7 @@ print_openpgp_info (gnutls_session session, const char *hostname) if (xml) { - gnutls_datum xml_data; + gnutls_datum_t xml_data; ret = gnutls_openpgp_key_to_xml (crt, &xml_data, 0); if (ret < 0) @@ -437,7 +437,7 @@ print_openpgp_info (gnutls_session session, const char *hostname) #endif void -print_cert_vrfy (gnutls_session session) +print_cert_vrfy (gnutls_session_t session) { int rc; unsigned int status; @@ -479,11 +479,11 @@ print_cert_vrfy (gnutls_session session) } int -print_info (gnutls_session session, const char *hostname) +print_info (gnutls_session_t session, const char *hostname) { const char *tmp; - gnutls_credentials_type cred; - gnutls_kx_algorithm kx; + gnutls_credentials_type_t cred; + gnutls_kx_algorithm_t kx; /* print the key exchange's algorithm name @@ -570,7 +570,7 @@ print_info (gnutls_session session, const char *hostname) } void -print_cert_info (gnutls_session session, const char *hostname) +print_cert_info (gnutls_session_t session, const char *hostname) { if (gnutls_certificate_client_get_request_status( session) != 0) diff --git a/src/common.h b/src/common.h index 966077146a..d22d995c13 100644 --- a/src/common.h +++ b/src/common.h @@ -23,8 +23,8 @@ extern const char str_unknown[]; -int print_info (gnutls_session state, const char *hostname); -void print_cert_info (gnutls_session state, const char *hostname); +int print_info (gnutls_session_t state, const char *hostname); +void print_cert_info (gnutls_session_t state, const char *hostname); void print_list (int verbose); void parse_comp (char **comp, int ncomp, int *comp_priority); diff --git a/src/crypt.c b/src/crypt.c index 8f46fe116d..e45b90ca9a 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -73,11 +73,11 @@ srptool_version (void) int crypt_int (const char *username, const char *passwd, int salt, char *tpasswd_conf, char *tpasswd, int uindex); -static int read_conf_values (gnutls_datum * g, gnutls_datum * n, char *str); +static int read_conf_values (gnutls_datum_t * g, gnutls_datum_t * n, char *str); static int _verify_passwd_int (const char *username, const char *passwd, char *verifier, char *salt, - const gnutls_datum * g, - const gnutls_datum * n); + const gnutls_datum_t * g, + const gnutls_datum_t * n); void srptool_version (void) @@ -91,7 +91,7 @@ srptool_version (void) static void -print_num (const char *msg, const gnutls_datum * num) +print_num (const char *msg, const gnutls_datum_t * num) { unsigned int i; @@ -115,8 +115,8 @@ generate_create_conf (char *tpasswd_conf) FILE *fd; char line[5 * 1024]; int index = 1; - gnutls_datum g, n; - gnutls_datum str_g, str_n; + gnutls_datum_t g, n; + gnutls_datum_t str_g, str_n; fd = fopen (tpasswd_conf, "w"); if (fd == NULL) @@ -183,10 +183,10 @@ generate_create_conf (char *tpasswd_conf) static int _verify_passwd_int (const char *username, const char *passwd, char *verifier, char *salt, - const gnutls_datum * g, const gnutls_datum * n) + const gnutls_datum_t * g, const gnutls_datum_t * n) { char _salt[1024]; - gnutls_datum tmp, raw_salt, new_verifier; + gnutls_datum_t tmp, raw_salt, new_verifier; size_t salt_size; char *pos; @@ -327,7 +327,7 @@ verify_passwd (char *conffile, char *tpasswd, char *username, FILE *fd; char line[5 * 1024]; unsigned int i; - gnutls_datum g, n; + gnutls_datum_t g, n; int iindex; char *p, *pos; @@ -498,12 +498,12 @@ main (int argc, char **argv) char * _srp_crypt (const char *username, const char *passwd, int salt_size, - const gnutls_datum * g, const gnutls_datum * n) + const gnutls_datum_t * g, const gnutls_datum_t * n) { char salt[128]; static char result[1024]; - gnutls_datum dat_salt, txt_salt; - gnutls_datum verifier, txt_verifier; + gnutls_datum_t dat_salt, txt_salt; + gnutls_datum_t verifier, txt_verifier; if ((unsigned) salt_size > sizeof (salt)) return NULL; @@ -556,7 +556,7 @@ crypt_int (const char *username, const char *passwd, int salt_size, { FILE *fd; char *cr; - gnutls_datum g, n; + gnutls_datum_t g, n; char line[5 * 1024]; char *p, *pp; int iindex; @@ -686,12 +686,12 @@ crypt_int (const char *username, const char *passwd, int salt_size, * int(index):base64(n):base64(g) */ static int -read_conf_values (gnutls_datum * g, gnutls_datum * n, char *str) +read_conf_values (gnutls_datum_t * g, gnutls_datum_t * n, char *str) { char *p; int len; int index, ret; - gnutls_datum dat; + gnutls_datum_t dat; index = atoi (str); diff --git a/src/prime.c b/src/prime.c index 6945abed54..cfd282abb3 100644 --- a/src/prime.c +++ b/src/prime.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004,2005 Free Software Foundation + * Copyright (C) 2004,2005,2007 Free Software Foundation * Copyright (C) 2001,2002,2003 Nikos Mavroyanopoulos * * This file is part of GNUTLS. @@ -47,8 +47,8 @@ generate_prime (int bits, int how) { unsigned int i; int ret; - gnutls_dh_params dh_params; - gnutls_datum p, g; + gnutls_dh_params_t dh_params; + gnutls_datum_t p, g; gnutls_dh_params_init (&dh_params); @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Free Software Foundation + * Copyright (C) 2005, 2007 Free Software Foundation * * This file is part of GNUTLS. * @@ -85,7 +85,7 @@ main (int argc, char **argv) struct passwd *pwd; unsigned char key[MAX_KEY_SIZE]; char hex_key[MAX_KEY_SIZE * 2 + 1]; - gnutls_datum dkey; + gnutls_datum_t dkey; size_t hex_key_size = sizeof (hex_key); if ((ret = gnutls_global_init ()) < 0) diff --git a/src/serv.c b/src/serv.c index c210597517..9f195e00bc 100644 --- a/src/serv.c +++ b/src/serv.c @@ -120,9 +120,9 @@ const int ssl_session_cache = 128; static void wrap_db_init (void); static void wrap_db_deinit (void); -static int wrap_db_store (void *dbf, gnutls_datum key, gnutls_datum data); -static gnutls_datum wrap_db_fetch (void *dbf, gnutls_datum key); -static int wrap_db_delete (void *dbf, gnutls_datum key); +static int wrap_db_store (void *dbf, gnutls_datum_t key, gnutls_datum_t data); +static gnutls_datum_t wrap_db_fetch (void *dbf, gnutls_datum_t key); +static int wrap_db_delete (void *dbf, gnutls_datum_t key); #define HTTP_STATE_REQUEST 1 @@ -133,7 +133,7 @@ LIST_TYPE_DECLARE (listener_item, char *http_request; char *http_response; int request_length; int response_length; int response_written; int http_state; - int fd; gnutls_session tls_session; int handshake_ok;); + int fd; gnutls_session_t tls_session; int handshake_ok;); static const char * safe_strerror (int value) @@ -166,8 +166,8 @@ listener_free (listener_item * j) * otherwise we should add them here. */ -gnutls_dh_params dh_params = NULL; -gnutls_rsa_params rsa_params = NULL; +gnutls_dh_params_t dh_params = NULL; +gnutls_rsa_params_t rsa_params = NULL; static int generate_dh_primes (void) @@ -204,7 +204,7 @@ read_dh_params (void) { char tmpdata[2048]; int size; - gnutls_datum params; + gnutls_datum_t params; FILE *fd; if (gnutls_dh_params_init (&dh_params) < 0) @@ -253,7 +253,7 @@ static char pkcs3[] = static int static_dh_params (void) { - gnutls_datum params = { pkcs3, sizeof (pkcs3) }; + gnutls_datum_t params = { pkcs3, sizeof (pkcs3) }; int ret; if (gnutls_dh_params_init (&dh_params) < 0) @@ -276,7 +276,7 @@ static_dh_params (void) } static int -get_params (gnutls_session session, gnutls_params_type type, +get_params (gnutls_session_t session, gnutls_params_type_t type, gnutls_params_st * st) { @@ -433,10 +433,10 @@ authz_recv_callback (gnutls_session_t session, } #endif -gnutls_session +gnutls_session_t initialize_session (void) { - gnutls_session session; + gnutls_session_t session; gnutls_init (&session, GNUTLS_SERVER); @@ -502,13 +502,13 @@ static const char DEFAULT_DATA[] = */ #define tmp2 &http_buffer[strlen(http_buffer)] char * -peer_print_info (gnutls_session session, int *ret_length, const char *header) +peer_print_info (gnutls_session_t session, int *ret_length, const char *header) { const char *tmp; unsigned char sesid[32]; size_t i, sesid_size; char *http_buffer; - gnutls_kx_algorithm kx_alg; + gnutls_kx_algorithm_t kx_alg; size_t len = 5 * 1024 + strlen (header); char *crtinfo = NULL; size_t ncrtinfo = 0; @@ -758,7 +758,7 @@ listen_socket (const char *name, int listen_port) } static void -get_response (gnutls_session session, char *request, +get_response (gnutls_session_t session, char *request, char **response, int *response_length) { char *p, *h; @@ -806,7 +806,7 @@ terminate (int sig) static void -check_alert (gnutls_session session, int ret) +check_alert (gnutls_session_t session, int ret) { if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED || ret == GNUTLS_E_FATAL_ALERT_RECEIVED) @@ -1117,7 +1117,7 @@ main (int argc, char **argv) /* a new connection has arrived */ if (FD_ISSET (h, &rd)) { - gnutls_session tls_session; + gnutls_session_t tls_session; tls_session = initialize_session (); @@ -1143,7 +1143,7 @@ main (int argc, char **argv) j->tls_session = tls_session; gnutls_transport_set_ptr (tls_session, - (gnutls_transport_ptr) accept_fd); + (gnutls_transport_ptr_t) accept_fd); j->handshake_ok = 0; if (verbose == 0) @@ -1509,7 +1509,7 @@ wrap_db_deinit (void) } static int -wrap_db_store (void *dbf, gnutls_datum key, gnutls_datum data) +wrap_db_store (void *dbf, gnutls_datum_t key, gnutls_datum_t data) { if (cache_db == NULL) @@ -1532,10 +1532,10 @@ wrap_db_store (void *dbf, gnutls_datum key, gnutls_datum data) return 0; } -static gnutls_datum -wrap_db_fetch (void *dbf, gnutls_datum key) +static gnutls_datum_t +wrap_db_fetch (void *dbf, gnutls_datum_t key) { - gnutls_datum res = { NULL, 0 }; + gnutls_datum_t res = { NULL, 0 }; int i; if (cache_db == NULL) @@ -1563,7 +1563,7 @@ wrap_db_fetch (void *dbf, gnutls_datum key) } static int -wrap_db_delete (void *dbf, gnutls_datum key) +wrap_db_delete (void *dbf, gnutls_datum_t key) { int i; diff --git a/src/tests.c b/src/tests.c index 9a68923780..9c36b20b99 100644 --- a/src/tests.c +++ b/src/tests.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006 Free Software Foundation + * Copyright (C) 2004, 2006, 2007 Free Software Foundation * Copyright (C) 2000,2001,2002,2003 Nikos Mavroyanopoulos * * This file is part of GNUTLS. @@ -37,9 +37,9 @@ #include <common.h> #include <tests.h> -extern gnutls_srp_client_credentials srp_cred; -extern gnutls_anon_client_credentials anon_cred; -extern gnutls_certificate_credentials xcred; +extern gnutls_srp_client_credentials_t srp_cred; +extern gnutls_anon_client_credentials_t anon_cred; +extern gnutls_certificate_credentials_t xcred; extern int verbose; @@ -55,7 +55,7 @@ static int sfree = 0; static int handshake_output = 0; int -do_handshake (gnutls_session session) +do_handshake (gnutls_session_t session) { int ret, alert; @@ -126,7 +126,7 @@ static const int cert_type_priority[16] = { GNUTLS_CRT_X509, 0 }; #define ADD_ALL_CERTTYPES(session) gnutls_certificate_type_set_priority(session, cert_type_priority) static void -ADD_KX (gnutls_session session, int kx) +ADD_KX (gnutls_session_t session, int kx) { static int _kx_priority[] = { 0, 0 }; _kx_priority[0] = kx; @@ -135,7 +135,7 @@ ADD_KX (gnutls_session session, int kx) } static void -ADD_KX2 (gnutls_session session, int kx1, int kx2) +ADD_KX2 (gnutls_session_t session, int kx1, int kx2) { static int _kx_priority[] = { 0, 0, 0 }; _kx_priority[0] = kx1; @@ -145,7 +145,7 @@ ADD_KX2 (gnutls_session session, int kx1, int kx2) } static void -ADD_CIPHER (gnutls_session session, int cipher) +ADD_CIPHER (gnutls_session_t session, int cipher) { static int _cipher_priority[] = { 0, 0 }; _cipher_priority[0] = cipher; @@ -154,7 +154,7 @@ ADD_CIPHER (gnutls_session session, int cipher) } static void -ADD_CIPHER3 (gnutls_session session, int cipher1, int cipher2, int cipher3) +ADD_CIPHER3 (gnutls_session_t session, int cipher1, int cipher2, int cipher3) { static int _cipher_priority[] = { 0, 0, 0, 0 }; _cipher_priority[0] = cipher1; @@ -165,7 +165,7 @@ ADD_CIPHER3 (gnutls_session session, int cipher1, int cipher2, int cipher3) } static void -ADD_MAC (gnutls_session session, int mac) +ADD_MAC (gnutls_session_t session, int mac) { static int _mac_priority[] = { 0, 0 }; _mac_priority[0] = mac; @@ -174,7 +174,7 @@ ADD_MAC (gnutls_session session, int mac) } static void -ADD_COMP (gnutls_session session, int c) +ADD_COMP (gnutls_session_t session, int c) { static int _comp_priority[] = { 0, 0 }; _comp_priority[0] = c; @@ -183,7 +183,7 @@ ADD_COMP (gnutls_session session, int c) } static void -ADD_CERTTYPE (gnutls_session session, int ctype) +ADD_CERTTYPE (gnutls_session_t session, int ctype) { static int _ct_priority[] = { 0, 0 }; _ct_priority[0] = ctype; @@ -192,7 +192,7 @@ ADD_CERTTYPE (gnutls_session session, int ctype) } static void -ADD_PROTOCOL (gnutls_session session, int protocol) +ADD_PROTOCOL (gnutls_session_t session, int protocol) { static int _proto_priority[] = { 0, 0 }; _proto_priority[0] = protocol; @@ -201,7 +201,7 @@ ADD_PROTOCOL (gnutls_session session, int protocol) } static void -ADD_PROTOCOL3 (gnutls_session session, int p1, int p2, int p3) +ADD_PROTOCOL3 (gnutls_session_t session, int p1, int p2, int p3) { static int _proto_priority[] = { 0, 0, 0, 0 }; _proto_priority[0] = p1; @@ -215,7 +215,7 @@ ADD_PROTOCOL3 (gnutls_session session, int p1, int p2, int p3) static int srp_detected; int -_test_srp_username_callback (gnutls_session session, unsigned int times, +_test_srp_username_callback (gnutls_session_t session, unsigned int times, char **username, char **password) { if (times == 1) @@ -227,7 +227,7 @@ _test_srp_username_callback (gnutls_session session, unsigned int times, } test_code_t -test_srp (gnutls_session session) +test_srp (gnutls_session_t session) { int ret; @@ -257,7 +257,7 @@ test_srp (gnutls_session session) #endif test_code_t -test_server (gnutls_session session) +test_server (gnutls_session_t session) { int ret, i = 0; char buf[5 * 1024]; @@ -308,13 +308,13 @@ test_server (gnutls_session session) static int export_true = 0; -static gnutls_datum exp = { NULL, 0 }, mod = +static gnutls_datum_t exp = { NULL, 0 }, mod = { NULL, 0}; test_code_t -test_export (gnutls_session session) +test_export (gnutls_session_t session) { int ret; @@ -339,10 +339,10 @@ test_export (gnutls_session session) } test_code_t -test_export_info (gnutls_session session) +test_export_info (gnutls_session_t session) { int ret2, ret; - gnutls_datum exp2, mod2; + gnutls_datum_t exp2, mod2; const char *print; if (verbose == 0 || export_true == 0) @@ -388,10 +388,10 @@ test_export_info (gnutls_session session) } -static gnutls_datum pubkey = { NULL, 0 }; +static gnutls_datum_t pubkey = { NULL, 0 }; test_code_t -test_dhe (gnutls_session session) +test_dhe (gnutls_session_t session) { int ret; @@ -412,10 +412,10 @@ test_dhe (gnutls_session session) } test_code_t -test_dhe_group (gnutls_session session) +test_dhe_group (gnutls_session_t session) { int ret, ret2; - gnutls_datum gen, prime, pubkey2; + gnutls_datum_t gen, prime, pubkey2; const char *print; if (verbose == 0 || pubkey.data == NULL) @@ -460,7 +460,7 @@ test_dhe_group (gnutls_session session) } test_code_t -test_ssl3 (gnutls_session session) +test_ssl3 (gnutls_session_t session) { int ret; ADD_ALL_CIPHERS (session); @@ -486,7 +486,7 @@ got_alarm (int k) } test_code_t -test_bye (gnutls_session session) +test_bye (gnutls_session_t session) { int ret; char data[20]; @@ -545,7 +545,7 @@ test_bye (gnutls_session session) test_code_t -test_aes (gnutls_session session) +test_aes (gnutls_session_t session) { int ret; ADD_CIPHER (session, GNUTLS_CIPHER_AES_128_CBC); @@ -561,7 +561,7 @@ test_aes (gnutls_session session) } test_code_t -test_openpgp1 (gnutls_session session) +test_openpgp1 (gnutls_session_t session) { int ret; ADD_ALL_CIPHERS (session); @@ -583,7 +583,7 @@ test_openpgp1 (gnutls_session session) } test_code_t -test_unknown_ciphersuites (gnutls_session session) +test_unknown_ciphersuites (gnutls_session_t session) { int ret; ADD_CIPHER3 (session, GNUTLS_CIPHER_AES_128_CBC, @@ -600,7 +600,7 @@ test_unknown_ciphersuites (gnutls_session session) } test_code_t -test_md5 (gnutls_session session) +test_md5 (gnutls_session_t session) { int ret; ADD_ALL_CIPHERS (session); @@ -617,7 +617,7 @@ test_md5 (gnutls_session session) #ifdef HAVE_LIBZ test_code_t -test_zlib (gnutls_session session) +test_zlib (gnutls_session_t session) { int ret; ADD_ALL_CIPHERS (session); @@ -634,7 +634,7 @@ test_zlib (gnutls_session session) #endif test_code_t -test_lzo (gnutls_session session) +test_lzo (gnutls_session_t session) { int ret; gnutls_handshake_set_private_extensions (session, 1); @@ -653,7 +653,7 @@ test_lzo (gnutls_session session) } test_code_t -test_sha (gnutls_session session) +test_sha (gnutls_session_t session) { int ret; ADD_ALL_CIPHERS (session); @@ -669,7 +669,7 @@ test_sha (gnutls_session session) } test_code_t -test_3des (gnutls_session session) +test_3des (gnutls_session_t session) { int ret; ADD_CIPHER (session, GNUTLS_CIPHER_3DES_CBC); @@ -685,7 +685,7 @@ test_3des (gnutls_session session) } test_code_t -test_arcfour (gnutls_session session) +test_arcfour (gnutls_session_t session) { int ret; ADD_CIPHER (session, GNUTLS_CIPHER_ARCFOUR_128); @@ -701,7 +701,7 @@ test_arcfour (gnutls_session session) } test_code_t -test_arcfour_40 (gnutls_session session) +test_arcfour_40 (gnutls_session_t session) { int ret; ADD_CIPHER (session, GNUTLS_CIPHER_ARCFOUR_40); @@ -717,7 +717,7 @@ test_arcfour_40 (gnutls_session session) } test_code_t -test_tls1 (gnutls_session session) +test_tls1 (gnutls_session_t session) { int ret; ADD_ALL_CIPHERS (session); @@ -737,7 +737,7 @@ test_tls1 (gnutls_session session) } test_code_t -test_tls1_1 (gnutls_session session) +test_tls1_1 (gnutls_session_t session) { int ret; ADD_ALL_CIPHERS (session); @@ -757,7 +757,7 @@ test_tls1_1 (gnutls_session session) } test_code_t -test_tls1_1_fallback (gnutls_session session) +test_tls1_1_fallback (gnutls_session_t session) { int ret; if (tls1_1_ok) @@ -788,7 +788,7 @@ test_tls1_1_fallback (gnutls_session session) * but the previous SSL 3.0 test succeeded then disable TLS 1.0. */ test_code_t -test_tls_disable (gnutls_session session) +test_tls_disable (gnutls_session_t session) { int ret; if (tls1_ok != 0) @@ -817,7 +817,7 @@ test_tls_disable (gnutls_session session) } test_code_t -test_rsa_pms (gnutls_session session) +test_rsa_pms (gnutls_session_t session) { int ret; @@ -844,7 +844,7 @@ test_rsa_pms (gnutls_session session) } test_code_t -test_max_record_size (gnutls_session session) +test_max_record_size (gnutls_session_t session) { int ret; ADD_ALL_CIPHERS (session); @@ -868,7 +868,7 @@ test_max_record_size (gnutls_session session) } test_code_t -test_hello_extension (gnutls_session session) +test_hello_extension (gnutls_session_t session) { int ret; ADD_ALL_CIPHERS (session); @@ -884,12 +884,12 @@ test_hello_extension (gnutls_session session) return ret; } -void _gnutls_record_set_default_version (gnutls_session session, +void _gnutls_record_set_default_version (gnutls_session_t session, unsigned char major, unsigned char minor); test_code_t -test_version_rollback (gnutls_session session) +test_version_rollback (gnutls_session_t session) { int ret; if (tls1_ok == 0) @@ -926,7 +926,7 @@ test_version_rollback (gnutls_session session) * message. */ test_code_t -test_version_oob (gnutls_session session) +test_version_oob (gnutls_session_t session) { int ret; /* here we enable both SSL 3.0 and TLS 1.0 @@ -945,11 +945,11 @@ test_version_oob (gnutls_session session) return ret; } -void _gnutls_rsa_pms_set_version (gnutls_session session, +void _gnutls_rsa_pms_set_version (gnutls_session_t session, unsigned char major, unsigned char minor); test_code_t -test_rsa_pms_version_check (gnutls_session session) +test_rsa_pms_version_check (gnutls_session_t session) { int ret; /* here we use an arbitary version in the RSA PMS @@ -973,7 +973,7 @@ test_rsa_pms_version_check (gnutls_session session) #ifdef ENABLE_ANON test_code_t -test_anonymous (gnutls_session session) +test_anonymous (gnutls_session_t session) { int ret; @@ -995,7 +995,7 @@ test_anonymous (gnutls_session session) #endif test_code_t -test_session_resume2 (gnutls_session session) +test_session_resume2 (gnutls_session_t session) { int ret; char tmp_session_id[32]; @@ -1044,7 +1044,7 @@ test_session_resume2 (gnutls_session session) extern char *hostname; test_code_t -test_certificate (gnutls_session session) +test_certificate (gnutls_session_t session) { int ret; @@ -1073,9 +1073,9 @@ test_certificate (gnutls_session session) /* A callback function to be used at the certificate selection time. */ static int -cert_callback (gnutls_session session, - const gnutls_datum * req_ca_rdn, int nreqs, - const gnutls_pk_algorithm * sign_algos, +cert_callback (gnutls_session_t session, + const gnutls_datum_t * req_ca_rdn, int nreqs, + const gnutls_pk_algorithm_t * sign_algos, int sign_algos_length, gnutls_retr_st * st) { char issuer_dn[256]; @@ -1113,7 +1113,7 @@ cert_callback (gnutls_session session, * if the server sends a certificate request packet. */ test_code_t -test_server_cas (gnutls_session session) +test_server_cas (gnutls_session_t session) { int ret; diff --git a/src/tests.h b/src/tests.h index 77e9be3cd6..072b2cae97 100644 --- a/src/tests.h +++ b/src/tests.h @@ -3,37 +3,37 @@ typedef enum TEST_SUCCEED, TEST_FAILED, TEST_UNSURE, TEST_IGNORE } test_code_t; -test_code_t test_srp (gnutls_session state); -test_code_t test_server (gnutls_session state); -test_code_t test_export (gnutls_session state); -test_code_t test_export_info (gnutls_session state); -test_code_t test_hello_extension (gnutls_session state); -test_code_t test_dhe (gnutls_session state); -test_code_t test_dhe_group (gnutls_session state); -test_code_t test_ssl3 (gnutls_session state); -test_code_t test_aes (gnutls_session state); -test_code_t test_md5 (gnutls_session state); -test_code_t test_sha (gnutls_session state); -test_code_t test_3des (gnutls_session state); -test_code_t test_arcfour (gnutls_session state); -test_code_t test_arcfour_40 (gnutls_session state); -test_code_t test_tls1 (gnutls_session state); -test_code_t test_tls1_1 (gnutls_session state); -test_code_t test_tls1_1_fallback (gnutls_session state); -test_code_t test_tls_disable (gnutls_session state); -test_code_t test_rsa_pms (gnutls_session state); -test_code_t test_max_record_size (gnutls_session state); -test_code_t test_version_rollback (gnutls_session state); -test_code_t test_anonymous (gnutls_session state); -test_code_t test_unknown_ciphersuites (gnutls_session state); -test_code_t test_openpgp1 (gnutls_session state); -test_code_t test_bye (gnutls_session state); -test_code_t test_certificate (gnutls_session state); -test_code_t test_server_cas (gnutls_session state); -test_code_t test_session_resume2 (gnutls_session state); -test_code_t test_rsa_pms_version_check (gnutls_session session); -test_code_t test_version_oob (gnutls_session session); -test_code_t test_zlib (gnutls_session session); -test_code_t test_lzo (gnutls_session session); -int _test_srp_username_callback (gnutls_session session, unsigned int times, +test_code_t test_srp (gnutls_session_t state); +test_code_t test_server (gnutls_session_t state); +test_code_t test_export (gnutls_session_t state); +test_code_t test_export_info (gnutls_session_t state); +test_code_t test_hello_extension (gnutls_session_t state); +test_code_t test_dhe (gnutls_session_t state); +test_code_t test_dhe_group (gnutls_session_t state); +test_code_t test_ssl3 (gnutls_session_t state); +test_code_t test_aes (gnutls_session_t state); +test_code_t test_md5 (gnutls_session_t state); +test_code_t test_sha (gnutls_session_t state); +test_code_t test_3des (gnutls_session_t state); +test_code_t test_arcfour (gnutls_session_t state); +test_code_t test_arcfour_40 (gnutls_session_t state); +test_code_t test_tls1 (gnutls_session_t state); +test_code_t test_tls1_1 (gnutls_session_t state); +test_code_t test_tls1_1_fallback (gnutls_session_t state); +test_code_t test_tls_disable (gnutls_session_t state); +test_code_t test_rsa_pms (gnutls_session_t state); +test_code_t test_max_record_size (gnutls_session_t state); +test_code_t test_version_rollback (gnutls_session_t state); +test_code_t test_anonymous (gnutls_session_t state); +test_code_t test_unknown_ciphersuites (gnutls_session_t state); +test_code_t test_openpgp1 (gnutls_session_t state); +test_code_t test_bye (gnutls_session_t state); +test_code_t test_certificate (gnutls_session_t state); +test_code_t test_server_cas (gnutls_session_t state); +test_code_t test_session_resume2 (gnutls_session_t state); +test_code_t test_rsa_pms_version_check (gnutls_session_t session); +test_code_t test_version_oob (gnutls_session_t session); +test_code_t test_zlib (gnutls_session_t session); +test_code_t test_lzo (gnutls_session_t session); +int _test_srp_username_callback (gnutls_session_t session, unsigned int times, char **username, char **password); diff --git a/src/tls_test.c b/src/tls_test.c index 7c2d53d73a..ab79257c95 100644 --- a/src/tls_test.c +++ b/src/tls_test.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2001,2002,2003,2006 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001,2002,2003,2006,2007 Nikos Mavroyanopoulos * Copyright (C) 2004,2005 Free Software Foundation * * This file is part of GNUTLS. @@ -52,9 +52,9 @@ int record_max_size; int fingerprint; static int debug; -gnutls_srp_client_credentials srp_cred; -gnutls_anon_client_credentials anon_cred; -gnutls_certificate_credentials xcred; +gnutls_srp_client_credentials_t srp_cred; +gnutls_anon_client_credentials_t anon_cred; +gnutls_certificate_credentials_t xcred; /* end of global stuff */ @@ -71,7 +71,7 @@ tls_log_func (int level, const char *str) fprintf (stderr, "|<%d>| %s", level, str); } -typedef test_code_t (*TEST_FUNC) (gnutls_session); +typedef test_code_t (*TEST_FUNC) (gnutls_session_t); typedef struct { @@ -162,7 +162,7 @@ main (int argc, char **argv) { int err, ret; int sd, i; - gnutls_session state; + gnutls_session_t state; char buffer[MAX_BUF + 1]; char portname[6]; struct addrinfo hints, *res, *ptr; @@ -267,7 +267,7 @@ main (int argc, char **argv) ERR(err, "connect") gnutls_init (&state, GNUTLS_CLIENT); - gnutls_transport_set_ptr (state, (gnutls_transport_ptr) sd); + gnutls_transport_set_ptr (state, (gnutls_transport_ptr_t) sd); do { |