diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-06-13 21:32:00 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-06-13 21:32:00 +0000 |
commit | 933c12dd1b0b7af1e6b0d9de9a5037d0990d2be0 (patch) | |
tree | 353eda85d53bbac1a632cc59004bd86674818adf /lib | |
parent | 906958f81d6057f2bbc0bb628c9b6425f45a4779 (diff) | |
download | gnutls-933c12dd1b0b7af1e6b0d9de9a5037d0990d2be0.tar.gz |
Added the '_t' suffix to all exported symbols.
Diffstat (limited to 'lib')
113 files changed, 2326 insertions, 2391 deletions
diff --git a/lib/auth_anon.c b/lib/auth_anon.c index 6d2feecd5b..efddc5c773 100644 --- a/lib/auth_anon.c +++ b/lib/auth_anon.c @@ -38,9 +38,9 @@ #include <gnutls_state.h> #include <auth_dh_common.h> -static int gen_anon_server_kx(gnutls_session, opaque **); -static int proc_anon_client_kx(gnutls_session, opaque *, size_t); -static int proc_anon_server_kx(gnutls_session, opaque *, size_t); +static int gen_anon_server_kx(gnutls_session_t, opaque **); +static int proc_anon_client_kx(gnutls_session_t, opaque *, size_t); +static int proc_anon_server_kx(gnutls_session_t, opaque *, size_t); const mod_auth_st anon_auth_struct = { "ANON", @@ -59,13 +59,13 @@ const mod_auth_st anon_auth_struct = { NULL }; -static int gen_anon_server_kx(gnutls_session session, opaque ** data) +static int gen_anon_server_kx(gnutls_session_t session, opaque ** data) { mpi_t g, p; const mpi_t *mpis; int ret; - gnutls_dh_params dh_params; - const gnutls_anon_server_credentials cred; + gnutls_dh_params_t dh_params; + const gnutls_anon_server_credentials_t cred; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_ANON, NULL); if (cred == NULL) { @@ -101,14 +101,14 @@ static int gen_anon_server_kx(gnutls_session session, opaque ** data) } -static int proc_anon_client_kx(gnutls_session session, opaque * data, +static int proc_anon_client_kx(gnutls_session_t session, opaque * data, size_t _data_size) { - const gnutls_anon_server_credentials cred; + const gnutls_anon_server_credentials_t cred; int bits; int ret; mpi_t p, g; - gnutls_dh_params dh_params; + gnutls_dh_params_t dh_params; const mpi_t *mpis; bits = _gnutls_dh_get_allowed_prime_bits(session); @@ -136,7 +136,7 @@ static int proc_anon_client_kx(gnutls_session session, opaque * data, } -int proc_anon_server_kx(gnutls_session session, opaque * data, +int proc_anon_server_kx(gnutls_session_t session, opaque * data, size_t _data_size) { diff --git a/lib/auth_anon.h b/lib/auth_anon.h index c722826663..32fbfdfa25 100644 --- a/lib/auth_anon.h +++ b/lib/auth_anon.h @@ -3,15 +3,15 @@ #include <auth_dh_common.h> typedef struct { - gnutls_dh_params dh_params; + gnutls_dh_params_t dh_params; /* this callback is used to retrieve the DH or RSA * parameters. */ gnutls_params_function *params_func; } anon_server_credentials_st; -#define gnutls_anon_server_credentials anon_server_credentials_st* +#define gnutls_anon_server_credentials_t anon_server_credentials_st* -#define gnutls_anon_client_credentials void* +#define gnutls_anon_client_credentials_t void* typedef struct anon_client_auth_info_st { dh_info_t dh; @@ -22,6 +22,6 @@ typedef anon_client_auth_info_t anon_server_auth_info_t; typedef struct anon_client_auth_info_st anon_client_auth_info_st; typedef anon_client_auth_info_st anon_server_auth_info_st; -gnutls_dh_params _gnutls_anon_get_dh_params(const - gnutls_anon_server_credentials - sc, gnutls_session session); +gnutls_dh_params_t _gnutls_anon_get_dh_params(const + gnutls_anon_server_credentials_t + sc, gnutls_session_t session); diff --git a/lib/auth_cert.c b/lib/auth_cert.c index 57cfc4c62f..e67678e80a 100644 --- a/lib/auth_cert.c +++ b/lib/auth_cert.c @@ -45,11 +45,11 @@ #include <gnutls_extra.h> #include "debug.h" -static gnutls_cert *alloc_and_load_x509_certs(gnutls_x509_crt * certs, +static gnutls_cert *alloc_and_load_x509_certs(gnutls_x509_crt_t * certs, uint); -static gnutls_privkey *alloc_and_load_x509_key(gnutls_x509_privkey key); -static gnutls_cert *alloc_and_load_pgp_certs(gnutls_openpgp_key cert); -static gnutls_privkey *alloc_and_load_pgp_key(const gnutls_openpgp_privkey +static gnutls_privkey *alloc_and_load_x509_key(gnutls_x509_privkey_t key); +static gnutls_cert *alloc_and_load_pgp_certs(gnutls_openpgp_key_t cert); +static gnutls_privkey *alloc_and_load_pgp_key(const gnutls_openpgp_privkey_t key); @@ -71,7 +71,7 @@ int _gnutls_copy_certificate_auth_info(cert_auth_info_t info, } info->raw_certificate_list = - gnutls_calloc(1, sizeof(gnutls_datum) * ncerts); + gnutls_calloc(1, sizeof(gnutls_datum_t) * ncerts); if (info->raw_certificate_list == NULL) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; @@ -111,9 +111,9 @@ int _gnutls_copy_certificate_auth_info(cert_auth_info_t info, * -1 otherwise. */ inline - static int _gnutls_check_pk_algo_in_list(const gnutls_pk_algorithm * + static int _gnutls_check_pk_algo_in_list(const gnutls_pk_algorithm_t * pk_algos, int pk_algos_length, - gnutls_pk_algorithm + gnutls_pk_algorithm_t algo_to_check) { int i; @@ -130,7 +130,7 @@ inline * specified in cert. */ static int _gnutls_cert_get_issuer_dn(gnutls_cert * cert, - gnutls_datum * odn) + gnutls_datum_t * odn) { ASN1_TYPE dn; int len, result; @@ -177,13 +177,13 @@ static int _gnutls_cert_get_issuer_dn(gnutls_cert * cert, * That is to guess which certificate to use, based on the * CAs and sign algorithms supported by the peer server. */ -static int _find_x509_cert(const gnutls_certificate_credentials cred, +static int _find_x509_cert(const gnutls_certificate_credentials_t cred, opaque * _data, size_t _data_size, - const gnutls_pk_algorithm * pk_algos, + const gnutls_pk_algorithm_t * pk_algos, int pk_algos_length, int *indx) { uint size; - gnutls_datum odn; + gnutls_datum_t odn; opaque *data = _data; ssize_t data_size = _data_size; uint i, j; @@ -242,8 +242,8 @@ static int _find_x509_cert(const gnutls_certificate_credentials cred, /* Locates the most appropriate openpgp cert */ -static int _find_openpgp_cert(const gnutls_certificate_credentials cred, - gnutls_pk_algorithm * pk_algos, +static int _find_openpgp_cert(const gnutls_certificate_credentials_t cred, + gnutls_pk_algorithm_t * pk_algos, int pk_algos_length, int *indx) { uint i, j; @@ -274,7 +274,7 @@ static int _find_openpgp_cert(const gnutls_certificate_credentials cred, /* Returns the number of issuers in the server's * certificate request packet. */ -static int get_issuers_num(gnutls_session session, opaque * data, +static int get_issuers_num(gnutls_session_t session, opaque * data, ssize_t data_size) { int issuers_dn_len = 0, result; @@ -320,8 +320,8 @@ static int get_issuers_num(gnutls_session session, opaque * data, /* Returns the issuers in the server's certificate request * packet. */ -static int get_issuers(gnutls_session session, - gnutls_datum * issuers_dn, int issuers_len, +static int get_issuers(gnutls_session_t session, + gnutls_datum_t * issuers_dn, int issuers_len, opaque * data, size_t data_size) { int i; @@ -362,10 +362,10 @@ OPENPGP_PRIVKEY_DEINIT _E_gnutls_openpgp_privkey_deinit; /* Calls the client get callback. */ -static int call_get_cert_callback(gnutls_session session, - gnutls_datum * issuers_dn, +static int call_get_cert_callback(gnutls_session_t session, + gnutls_datum_t * issuers_dn, int issuers_dn_length, - gnutls_pk_algorithm * pk_algos, + gnutls_pk_algorithm_t * pk_algos, int pk_algos_length) { uint i; @@ -373,8 +373,8 @@ static int call_get_cert_callback(gnutls_session session, gnutls_privkey *local_key = NULL; gnutls_retr_st st; int ret; - gnutls_certificate_type type = gnutls_certificate_type_get(session); - const gnutls_certificate_credentials cred; + gnutls_certificate_type_t type = gnutls_certificate_type_get(session); + const gnutls_certificate_credentials_t cred; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); if (cred == NULL) { @@ -464,18 +464,18 @@ static int call_get_cert_callback(gnutls_session session, * 20020128: added ability to select a certificate depending on the SIGN * algorithm (only in automatic mode). */ -static int _select_client_cert(gnutls_session session, +static int _select_client_cert(gnutls_session_t session, opaque * _data, size_t _data_size, - gnutls_pk_algorithm * pk_algos, + gnutls_pk_algorithm_t * pk_algos, int pk_algos_length) { int result; int indx = -1; - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; opaque *data = _data; ssize_t data_size = _data_size; int issuers_dn_length; - gnutls_datum *issuers_dn = NULL; + gnutls_datum_t *issuers_dn = NULL; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); if (cred == NULL) { @@ -498,7 +498,7 @@ static int _select_client_cert(gnutls_session session, if (issuers_dn_length > 0) { issuers_dn = - gnutls_malloc(sizeof(gnutls_datum) * + gnutls_malloc(sizeof(gnutls_datum_t) * issuers_dn_length); if (issuers_dn == NULL) { gnutls_assert(); @@ -561,7 +561,7 @@ static int _select_client_cert(gnutls_session session, /* Generate client certificate */ -int _gnutls_gen_x509_crt(gnutls_session session, opaque ** data) +int _gnutls_gen_x509_crt(gnutls_session_t session, opaque ** data) { int ret, i; opaque *pdata; @@ -614,7 +614,7 @@ int _gnutls_gen_x509_crt(gnutls_session session, opaque ** data) enum PGPKeyDescriptorType { PGP_KEY_FINGERPRINT, PGP_KEY }; -int _gnutls_gen_openpgp_certificate(gnutls_session session, opaque ** data) +int _gnutls_gen_openpgp_certificate(gnutls_session_t session, opaque ** data) { int ret; opaque *pdata; @@ -663,7 +663,7 @@ OPENPGP_FINGERPRINT _E_gnutls_openpgp_fingerprint = NULL; OPENPGP_KEY_REQUEST _E_gnutls_openpgp_request_key = NULL; extern OPENPGP_RAW_KEY_TO_GCERT _E_gnutls_openpgp_raw_key_to_gcert; -int _gnutls_gen_openpgp_certificate_fpr(gnutls_session session, +int _gnutls_gen_openpgp_certificate_fpr(gnutls_session_t session, opaque ** data) { int ret, packet_size; @@ -727,7 +727,7 @@ int _gnutls_gen_openpgp_certificate_fpr(gnutls_session session, -int _gnutls_gen_cert_client_certificate(gnutls_session session, +int _gnutls_gen_cert_client_certificate(gnutls_session_t session, opaque ** data) { switch (session->security_parameters.cert_type) { @@ -746,7 +746,7 @@ int _gnutls_gen_cert_client_certificate(gnutls_session session, } } -int _gnutls_gen_cert_server_certificate(gnutls_session session, +int _gnutls_gen_cert_server_certificate(gnutls_session_t session, opaque ** data) { switch (session->security_parameters.cert_type) { @@ -764,18 +764,18 @@ int _gnutls_gen_cert_server_certificate(gnutls_session session, */ #define CLEAR_CERTS for(x=0;x<peer_certificate_list_size;x++) _gnutls_gcert_deinit(&peer_certificate_list[x]) -int _gnutls_proc_x509_server_certificate(gnutls_session session, +int _gnutls_proc_x509_server_certificate(gnutls_session_t session, opaque * data, size_t data_size) { int size, len, ret; opaque *p = data; cert_auth_info_t info; - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; ssize_t dsize = data_size; int i, j, x; gnutls_cert *peer_certificate_list; int peer_certificate_list_size = 0; - gnutls_datum tmp; + gnutls_datum_t tmp; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); if (cred == NULL) { @@ -891,19 +891,19 @@ int _gnutls_proc_x509_server_certificate(gnutls_session session, } #define CLEAR_CERTS for(x=0;x<peer_certificate_list_size;x++) _gnutls_gcert_deinit(&peer_certificate_list[x]) -int _gnutls_proc_openpgp_server_certificate(gnutls_session session, +int _gnutls_proc_openpgp_server_certificate(gnutls_session_t session, opaque * data, size_t data_size) { int size, ret, len; opaque *p = data; cert_auth_info_t info; - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; ssize_t dsize = data_size; int i, x; gnutls_cert *peer_certificate_list = NULL; int peer_certificate_list_size = 0; - gnutls_datum tmp, akey = { NULL, 0 }; + gnutls_datum_t tmp, akey = { NULL, 0 }; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); if (cred == NULL) { @@ -1052,7 +1052,7 @@ int _gnutls_proc_openpgp_server_certificate(gnutls_session session, } -int _gnutls_proc_cert_server_certificate(gnutls_session session, +int _gnutls_proc_cert_server_certificate(gnutls_session_t session, opaque * data, size_t data_size) { switch (session->security_parameters.cert_type) { @@ -1073,7 +1073,7 @@ typedef enum CertificateSigType { RSA_SIGN = 1, DSA_SIGN } CertificateSigType; /* Checks if we support the given signature algorithm - * (RSA or DSA). Returns the corresponding gnutls_pk_algorithm + * (RSA or DSA). Returns the corresponding gnutls_pk_algorithm_t * if true; */ inline static @@ -1089,16 +1089,16 @@ int _gnutls_check_supported_sign_algo(CertificateSigType algo) return -1; } -int _gnutls_proc_cert_cert_req(gnutls_session session, opaque * data, +int _gnutls_proc_cert_cert_req(gnutls_session_t session, opaque * data, size_t data_size) { int size, ret; opaque *p; - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; cert_auth_info_t info; ssize_t dsize; int i, j; - gnutls_pk_algorithm pk_algos[MAX_SIGN_ALGOS]; + gnutls_pk_algorithm_t pk_algos[MAX_SIGN_ALGOS]; int pk_algos_length; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); @@ -1169,14 +1169,14 @@ int _gnutls_proc_cert_cert_req(gnutls_session session, opaque * data, return 0; } -int _gnutls_gen_cert_client_cert_vrfy(gnutls_session session, +int _gnutls_gen_cert_client_cert_vrfy(gnutls_session_t session, opaque ** data) { int ret; gnutls_cert *apr_cert_list; gnutls_privkey *apr_pkey; int apr_cert_list_length, size; - gnutls_datum signature; + gnutls_datum_t signature; *data = NULL; @@ -1216,13 +1216,13 @@ int _gnutls_gen_cert_client_cert_vrfy(gnutls_session session, return size + 2; } -int _gnutls_proc_cert_client_cert_vrfy(gnutls_session session, +int _gnutls_proc_cert_client_cert_vrfy(gnutls_session_t session, opaque * data, size_t data_size) { int size, ret; ssize_t dsize = data_size; opaque *pdata = data; - gnutls_datum sig; + gnutls_datum_t sig; cert_auth_info_t info = _gnutls_get_auth_info(session); gnutls_cert peer_cert; @@ -1262,10 +1262,10 @@ int _gnutls_proc_cert_client_cert_vrfy(gnutls_session session, } #define CERTTYPE_SIZE 3 -int _gnutls_gen_cert_server_cert_req(gnutls_session session, +int _gnutls_gen_cert_server_cert_req(gnutls_session_t session, opaque ** data) { - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; int size; opaque *pdata; @@ -1280,7 +1280,7 @@ int _gnutls_gen_cert_server_cert_req(gnutls_session session, return GNUTLS_E_INSUFFICIENT_CREDENTIALS; } - size = CERTTYPE_SIZE + 2; /* 2 for gnutls_certificate_type + 2 for size of rdn_seq + size = CERTTYPE_SIZE + 2; /* 2 for gnutls_certificate_type_t + 2 for size of rdn_seq */ if (session->security_parameters.cert_type == GNUTLS_CRT_X509 && @@ -1318,7 +1318,7 @@ int _gnutls_gen_cert_server_cert_req(gnutls_session session, * It is normal to return 0 with no certificates in client side. * */ -int _gnutls_get_selected_cert(gnutls_session session, +int _gnutls_get_selected_cert(gnutls_session_t session, gnutls_cert ** apr_cert_list, int *apr_cert_list_length, gnutls_privkey ** apr_pkey) @@ -1358,7 +1358,7 @@ int _gnutls_get_selected_cert(gnutls_session session, /* converts the given x509 certificate to gnutls_cert* and allocates * space for them. */ -static gnutls_cert *alloc_and_load_x509_certs(gnutls_x509_crt * certs, +static gnutls_cert *alloc_and_load_x509_certs(gnutls_x509_crt_t * certs, uint ncerts) { gnutls_cert *local_certs; @@ -1395,7 +1395,7 @@ static gnutls_cert *alloc_and_load_x509_certs(gnutls_x509_crt * certs, /* converts the given x509 key to gnutls_privkey* and allocates * space for it. */ -static gnutls_privkey *alloc_and_load_x509_key(gnutls_x509_privkey key) +static gnutls_privkey *alloc_and_load_x509_key(gnutls_x509_privkey_t key) { gnutls_privkey *local_key; int ret = 0; @@ -1425,7 +1425,7 @@ OPENPGP_PRIVKEY_TO_GKEY _E_gnutls_openpgp_privkey_to_gkey; /* converts the given pgp certificate to gnutls_cert* and allocates * space for them. */ -static gnutls_cert *alloc_and_load_pgp_certs(gnutls_openpgp_key cert) +static gnutls_cert *alloc_and_load_pgp_certs(gnutls_openpgp_key_t cert) { gnutls_cert *local_certs; int ret = 0; @@ -1463,7 +1463,7 @@ static gnutls_cert *alloc_and_load_pgp_certs(gnutls_openpgp_key cert) /* converts the given raw key to gnutls_privkey* and allocates * space for it. */ -static gnutls_privkey *alloc_and_load_pgp_key(const gnutls_openpgp_privkey +static gnutls_privkey *alloc_and_load_pgp_key(const gnutls_openpgp_privkey_t key) { gnutls_privkey *local_key; @@ -1493,7 +1493,7 @@ static gnutls_privkey *alloc_and_load_pgp_key(const gnutls_openpgp_privkey } -void _gnutls_selected_certs_deinit(gnutls_session session) +void _gnutls_selected_certs_deinit(gnutls_session_t session) { if (session->internals.selected_need_free != 0) { int i; @@ -1511,7 +1511,7 @@ void _gnutls_selected_certs_deinit(gnutls_session session) return; } -void _gnutls_selected_certs_set(gnutls_session session, +void _gnutls_selected_certs_set(gnutls_session_t session, gnutls_cert * certs, int ncerts, gnutls_privkey * key, int need_free) { @@ -1535,12 +1535,12 @@ void _gnutls_selected_certs_set(gnutls_session session, * selected certificate will be in session->internals.selected_*. * */ -int _gnutls_server_select_cert(gnutls_session session, - gnutls_pk_algorithm requested_algo) +int _gnutls_server_select_cert(gnutls_session_t session, + gnutls_pk_algorithm_t requested_algo) { uint i; int index, ret; - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); if (cred == NULL) { diff --git a/lib/auth_cert.h b/lib/auth_cert.h index d7a0ebcb33..11a3197756 100644 --- a/lib/auth_cert.h +++ b/lib/auth_cert.h @@ -7,43 +7,35 @@ #include "../libextra/openpgp/openpgp.h" typedef struct retr_st { - gnutls_certificate_type type; + gnutls_certificate_type_t type; union cert { - gnutls_x509_crt *x509; - gnutls_openpgp_key pgp; + gnutls_x509_crt_t *x509; + gnutls_openpgp_key_t pgp; } cert; uint ncerts; union key { - gnutls_x509_privkey x509; - gnutls_openpgp_privkey pgp; + gnutls_x509_privkey_t x509; + gnutls_openpgp_privkey_t pgp; } key; uint deinit_all; } gnutls_retr_st; -typedef int gnutls_certificate_client_retrieve_function(gnutls_session, - const gnutls_datum - * req_ca_rdn, - int nreqs, - const - gnutls_pk_algorithm - * pk_algos, - int - pk_algos_length, - gnutls_retr_st *); +typedef int gnutls_certificate_client_retrieve_function(gnutls_session_t, + const gnutls_datum_t *req_ca_rdn, int nreqs, + const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, + gnutls_retr_st *); typedef int gnutls_certificate_server_retrieve_function(struct - gnutls_session_int - *, - gnutls_retr_st *); + gnutls_session_int*, gnutls_retr_st *); /* This structure may be complex, but it's the only way to * support a server that has multiple certificates */ typedef struct { - gnutls_dh_params dh_params; - gnutls_rsa_params rsa_params; + gnutls_dh_params_t dh_params; + gnutls_rsa_params_t rsa_params; /* this callback is used to retrieve the DH or RSA * parameters. */ @@ -71,7 +63,7 @@ typedef struct { /* OpenPGP specific stuff */ - gnutls_datum keyring; + gnutls_datum_t keyring; char *pgp_key_server; int pgp_key_server_port; @@ -79,11 +71,11 @@ typedef struct { /* X509 specific stuff */ - gnutls_x509_crt *x509_ca_list; + gnutls_x509_crt_t *x509_ca_list; uint x509_ncas; /* number of CAs in the ca_list */ - gnutls_x509_crl *x509_crl_list; + gnutls_x509_crl_t *x509_crl_list; uint x509_ncrls; /* number of CRLs in the crl_list */ @@ -96,13 +88,13 @@ typedef struct { * This is better than * generating on every handshake. */ - gnutls_datum x509_rdn_sequence; + gnutls_datum_t x509_rdn_sequence; gnutls_certificate_client_retrieve_function *client_get_cert_callback; gnutls_certificate_server_retrieve_function *server_get_cert_callback; } certificate_credentials_st; -#define gnutls_certificate_credentials certificate_credentials_st* +#define gnutls_certificate_credentials_t certificate_credentials_st* typedef struct rsa_info_st { opaque modulus[65]; @@ -118,7 +110,7 @@ typedef struct cert_auth_info_st { dh_info_t dh; rsa_info_t rsa_export; - gnutls_datum *raw_certificate_list; /* holds the raw certificate of the + gnutls_datum_t *raw_certificate_list; /* holds the raw certificate of the * peer. */ unsigned int ncerts; /* holds the size of the list above */ @@ -127,35 +119,29 @@ typedef struct cert_auth_info_st { typedef struct cert_auth_info_st cert_auth_info_st; /* AUTH X509 functions */ -int _gnutls_gen_cert_server_certificate(gnutls_session, opaque **); -int _gnutls_gen_cert_client_certificate(gnutls_session, opaque **); -int _gnutls_gen_cert_client_cert_vrfy(gnutls_session, opaque **); -int _gnutls_gen_cert_server_cert_req(gnutls_session, opaque **); -int _gnutls_proc_cert_cert_req(gnutls_session, opaque *, size_t); -int _gnutls_proc_cert_client_cert_vrfy(gnutls_session, opaque *, size_t); -int _gnutls_proc_cert_server_certificate(gnutls_session, opaque *, size_t); -int _gnutls_get_selected_cert(gnutls_session session, - gnutls_cert ** apr_cert_list, - int *apr_cert_list_length, - gnutls_privkey ** apr_pkey); +int _gnutls_gen_cert_server_certificate(gnutls_session_t, opaque **); +int _gnutls_gen_cert_client_certificate(gnutls_session_t, opaque **); +int _gnutls_gen_cert_client_cert_vrfy(gnutls_session_t, opaque **); +int _gnutls_gen_cert_server_cert_req(gnutls_session_t, opaque **); +int _gnutls_proc_cert_cert_req(gnutls_session_t, opaque *, size_t); +int _gnutls_proc_cert_client_cert_vrfy(gnutls_session_t, opaque *, size_t); +int _gnutls_proc_cert_server_certificate(gnutls_session_t, opaque *, size_t); +int _gnutls_get_selected_cert(gnutls_session_t session, + gnutls_cert ** apr_cert_list, int *apr_cert_list_length, + gnutls_privkey ** apr_pkey); int _gnutls_server_select_cert(struct gnutls_session_int *, - gnutls_pk_algorithm); -void _gnutls_selected_certs_deinit(gnutls_session session); -void _gnutls_selected_certs_set(gnutls_session session, - gnutls_cert * certs, int ncerts, - gnutls_privkey * key, int need_free); + gnutls_pk_algorithm_t); +void _gnutls_selected_certs_deinit(gnutls_session_t session); +void _gnutls_selected_certs_set(gnutls_session_t session, + gnutls_cert * certs, int ncerts, + gnutls_privkey * key, int need_free); #define _gnutls_proc_cert_client_certificate _gnutls_proc_cert_server_certificate -gnutls_rsa_params _gnutls_certificate_get_rsa_params(const - gnutls_certificate_credentials - sc, - gnutls_session - session); -gnutls_dh_params _gnutls_certificate_get_dh_params(const - gnutls_certificate_credentials - sc, - gnutls_session session); +gnutls_rsa_params_t _gnutls_certificate_get_rsa_params(const + gnutls_certificate_credentials_t sc, gnutls_session_t); +gnutls_dh_params_t _gnutls_certificate_get_dh_params(const + gnutls_certificate_credentials_t sc, gnutls_session_t session); #endif diff --git a/lib/auth_dh_common.c b/lib/auth_dh_common.c index 3114435eeb..52de93fe65 100644 --- a/lib/auth_dh_common.c +++ b/lib/auth_dh_common.c @@ -37,7 +37,7 @@ #include <gnutls_state.h> #include <auth_dh_common.h> -int _gnutls_proc_dh_common_client_kx(gnutls_session session, opaque * data, +int _gnutls_proc_dh_common_client_kx(gnutls_session_t session, opaque * data, size_t _data_size, mpi_t g, mpi_t p) { uint16 n_Y; @@ -80,7 +80,7 @@ int _gnutls_proc_dh_common_client_kx(gnutls_session session, opaque * data, return 0; } -int _gnutls_gen_dh_common_client_kx(gnutls_session session, opaque ** data) +int _gnutls_gen_dh_common_client_kx(gnutls_session_t session, opaque ** data) { mpi_t x = NULL, X = NULL; size_t n_X; @@ -147,7 +147,7 @@ int _gnutls_gen_dh_common_client_kx(gnutls_session session, opaque ** data) return ret; } -int _gnutls_proc_dh_common_server_kx(gnutls_session session, opaque * data, +int _gnutls_proc_dh_common_server_kx(gnutls_session_t session, opaque * data, size_t _data_size) { uint16 n_Y, n_g, n_p; @@ -224,7 +224,7 @@ int _gnutls_proc_dh_common_server_kx(gnutls_session session, opaque * data, return n_Y + n_p + n_g + 6; } -int _gnutls_dh_common_print_server_kx(gnutls_session session, +int _gnutls_dh_common_print_server_kx(gnutls_session_t session, mpi_t g, mpi_t p, opaque ** data) { mpi_t x, X; diff --git a/lib/auth_dh_common.h b/lib/auth_dh_common.h index a1400cac2c..bcc6647f29 100644 --- a/lib/auth_dh_common.h +++ b/lib/auth_dh_common.h @@ -12,12 +12,12 @@ typedef struct dh_info_st { size_t public_key_size; } dh_info_t; -int _gnutls_gen_dh_common_client_kx(gnutls_session, opaque **); -int _gnutls_proc_dh_common_client_kx(gnutls_session session, opaque * data, +int _gnutls_gen_dh_common_client_kx(gnutls_session_t, opaque **); +int _gnutls_proc_dh_common_client_kx(gnutls_session_t session, opaque * data, size_t _data_size, mpi_t p, mpi_t g); -int _gnutls_dh_common_print_server_kx(gnutls_session, mpi_t g, +int _gnutls_dh_common_print_server_kx(gnutls_session_t, mpi_t g, mpi_t p, opaque ** data); -int _gnutls_proc_dh_common_server_kx(gnutls_session session, opaque * data, +int _gnutls_proc_dh_common_server_kx(gnutls_session_t session, opaque * data, size_t _data_size); #endif diff --git a/lib/auth_dhe.c b/lib/auth_dhe.c index 386545eb13..55d6b26e25 100644 --- a/lib/auth_dhe.c +++ b/lib/auth_dhe.c @@ -38,9 +38,9 @@ #include <gnutls_state.h> #include <auth_dh_common.h> -static int gen_dhe_server_kx(gnutls_session, opaque **); -static int proc_dhe_server_kx(gnutls_session, opaque *, size_t); -static int proc_dhe_client_kx(gnutls_session, opaque *, size_t); +static int gen_dhe_server_kx(gnutls_session_t, opaque **); +static int proc_dhe_server_kx(gnutls_session_t, opaque *, size_t); +static int proc_dhe_client_kx(gnutls_session_t, opaque *, size_t); const mod_auth_st dhe_rsa_auth_struct = { "DHE_RSA", @@ -77,7 +77,7 @@ const mod_auth_st dhe_dss_auth_struct = { }; -static int gen_dhe_server_kx(gnutls_session session, opaque ** data) +static int gen_dhe_server_kx(gnutls_session_t session, opaque ** data) { mpi_t g, p; const mpi_t *mpis; @@ -86,9 +86,9 @@ static int gen_dhe_server_kx(gnutls_session session, opaque ** data) gnutls_cert *apr_cert_list; gnutls_privkey *apr_pkey; int apr_cert_list_length; - gnutls_datum signature, ddata; - const gnutls_certificate_credentials cred; - gnutls_dh_params dh_params; + gnutls_datum_t signature, ddata; + const gnutls_certificate_credentials_t cred; + gnutls_dh_params_t dh_params; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); if (cred == NULL) { @@ -165,11 +165,11 @@ static int gen_dhe_server_kx(gnutls_session session, opaque ** data) return data_size; } -static int proc_dhe_server_kx(gnutls_session session, opaque * data, +static int proc_dhe_server_kx(gnutls_session_t session, opaque * data, size_t _data_size) { int sigsize; - gnutls_datum vparams, signature; + gnutls_datum_t vparams, signature; int ret; cert_auth_info_t info = _gnutls_get_auth_info(session); ssize_t data_size = _data_size; @@ -223,14 +223,14 @@ static int proc_dhe_server_kx(gnutls_session session, opaque * data, -static int proc_dhe_client_kx(gnutls_session session, opaque * data, +static int proc_dhe_client_kx(gnutls_session_t session, opaque * data, size_t _data_size) { - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; int ret; mpi_t p, g; const mpi_t *mpis; - gnutls_dh_params dh_params; + gnutls_dh_params_t dh_params; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); if (cred == NULL) { diff --git a/lib/auth_rsa.c b/lib/auth_rsa.c index f62c7e5684..70dc42365a 100644 --- a/lib/auth_rsa.c +++ b/lib/auth_rsa.c @@ -41,8 +41,8 @@ #include <gnutls_x509.h> #include <gnutls_extra.h> -int _gnutls_gen_rsa_client_kx(gnutls_session, opaque **); -int _gnutls_proc_rsa_client_kx(gnutls_session, opaque *, size_t); +int _gnutls_gen_rsa_client_kx(gnutls_session_t, opaque **); +int _gnutls_proc_rsa_client_kx(gnutls_session_t, opaque *, size_t); const mod_auth_st rsa_auth_struct = { "RSA", @@ -63,7 +63,7 @@ const mod_auth_st rsa_auth_struct = { /* This function reads the RSA parameters from peer's certificate; */ -int _gnutls_get_public_rsa_params(gnutls_session session, +int _gnutls_get_public_rsa_params(gnutls_session_t session, mpi_t params[MAX_PUBLIC_PARAMS_SIZE], int *params_len) { @@ -136,12 +136,12 @@ int _gnutls_get_public_rsa_params(gnutls_session session, /* This function reads the RSA parameters from the private key */ -int _gnutls_get_private_rsa_params(gnutls_session session, mpi_t ** params, +int _gnutls_get_private_rsa_params(gnutls_session_t session, mpi_t ** params, int *params_size) { int bits; - const gnutls_certificate_credentials cred; - gnutls_rsa_params rsa_params; + const gnutls_certificate_credentials_t cred; + gnutls_rsa_params_t rsa_params; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); if (cred == NULL) { @@ -196,11 +196,11 @@ int _gnutls_get_private_rsa_params(gnutls_session session, mpi_t ** params, return GNUTLS_E_MEMORY_ERROR; \ } -int _gnutls_proc_rsa_client_kx(gnutls_session session, opaque * data, +int _gnutls_proc_rsa_client_kx(gnutls_session_t session, opaque * data, size_t _data_size) { - gnutls_datum plaintext; - gnutls_datum ciphertext; + gnutls_datum_t plaintext; + gnutls_datum_t ciphertext; int ret, dsize; mpi_t *params; int params_len; @@ -284,14 +284,14 @@ int _gnutls_proc_rsa_client_kx(gnutls_session session, opaque * data, /* return RSA(random) using the peers public key */ -int _gnutls_gen_rsa_client_kx(gnutls_session session, opaque ** data) +int _gnutls_gen_rsa_client_kx(gnutls_session_t session, opaque ** data) { cert_auth_info_t auth = session->key->auth_info; - gnutls_datum sdata; /* data to send */ + gnutls_datum_t sdata; /* data to send */ mpi_t params[MAX_PUBLIC_PARAMS_SIZE]; int params_len = MAX_PUBLIC_PARAMS_SIZE; int ret, i; - gnutls_protocol_version ver; + gnutls_protocol_t ver; if (auth == NULL) { /* this shouldn't have happened. The proc_certificate diff --git a/lib/auth_rsa_export.c b/lib/auth_rsa_export.c index 3246eacb77..5b2e6ab801 100644 --- a/lib/auth_rsa_export.c +++ b/lib/auth_rsa_export.c @@ -43,10 +43,10 @@ #include <gnutls_rsa_export.h> #include <gnutls_state.h> -int _gnutls_gen_rsa_client_kx(gnutls_session, opaque **); -int _gnutls_proc_rsa_client_kx(gnutls_session, opaque *, size_t); -static int gen_rsa_export_server_kx(gnutls_session, opaque **); -static int proc_rsa_export_server_kx(gnutls_session, opaque *, size_t); +int _gnutls_gen_rsa_client_kx(gnutls_session_t, opaque **); +int _gnutls_proc_rsa_client_kx(gnutls_session_t, opaque *, size_t); +static int gen_rsa_export_server_kx(gnutls_session_t, opaque **); +static int proc_rsa_export_server_kx(gnutls_session_t, opaque *, size_t); const mod_auth_st rsa_export_auth_struct = { "RSA EXPORT", @@ -65,9 +65,9 @@ const mod_auth_st rsa_export_auth_struct = { _gnutls_proc_cert_cert_req /* proc server cert request */ }; -static int gen_rsa_export_server_kx(gnutls_session session, opaque ** data) +static int gen_rsa_export_server_kx(gnutls_session_t session, opaque ** data) { - gnutls_rsa_params rsa_params; + gnutls_rsa_params_t rsa_params; const mpi_t *rsa_mpis; size_t n_e, n_m; uint8 *data_e, *data_m; @@ -75,9 +75,9 @@ static int gen_rsa_export_server_kx(gnutls_session session, opaque ** data) gnutls_cert *apr_cert_list; gnutls_privkey *apr_pkey; int apr_cert_list_length; - gnutls_datum signature, ddata; + gnutls_datum_t signature, ddata; cert_auth_info_t info; - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); if (cred == NULL) { @@ -175,7 +175,7 @@ static int gen_rsa_export_server_kx(gnutls_session session, opaque ** data) /* if the peer's certificate is of 512 bits or less, returns non zero. */ -int _gnutls_peers_cert_less_512(gnutls_session session) +int _gnutls_peers_cert_less_512(gnutls_session_t session) { gnutls_cert peer_cert; int ret; @@ -213,7 +213,7 @@ int _gnutls_peers_cert_less_512(gnutls_session session) return 0; } -static int proc_rsa_export_server_kx(gnutls_session session, opaque * data, +static int proc_rsa_export_server_kx(gnutls_session_t session, opaque * data, size_t _data_size) { uint16 n_m, n_e; @@ -221,7 +221,7 @@ static int proc_rsa_export_server_kx(gnutls_session session, opaque * data, uint8 *data_m; uint8 *data_e; int i, sigsize; - gnutls_datum vparams, signature; + gnutls_datum_t vparams, signature; int ret; ssize_t data_size = _data_size; cert_auth_info_t info; diff --git a/lib/debug.c b/lib/debug.c index 1a9d519586..dada997704 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -28,7 +28,7 @@ #ifdef DEBUG -void _gnutls_print_state(gnutls_session session) +void _gnutls_print_state(gnutls_session_t session) { _gnutls_debug_log("GNUTLS State:\n"); @@ -65,7 +65,7 @@ const char *_gnutls_packet2str(content_type_t packet) } } -const char *_gnutls_handshake2str(HandshakeType handshake) +const char *_gnutls_handshake2str(handshake_t handshake) { switch (handshake) { diff --git a/lib/debug.h b/lib/debug.h index e49190af01..cee2b799dd 100644 --- a/lib/debug.h +++ b/lib/debug.h @@ -19,8 +19,8 @@ */ #ifdef DEBUG -void _gnutls_print_state(gnutls_session session); +void _gnutls_print_state(gnutls_session_t session); #endif const char *_gnutls_packet2str(content_type_t packet); -const char *_gnutls_handshake2str(HandshakeType handshake); +const char *_gnutls_handshake2str(handshake_t handshake); void _gnutls_dump_mpi(const char *prefix, mpi_t a); diff --git a/lib/ext_cert_type.c b/lib/ext_cert_type.c index 1f927654f3..ad8f7893fb 100644 --- a/lib/ext_cert_type.c +++ b/lib/ext_cert_type.c @@ -43,7 +43,7 @@ inline static int _gnutls_cert_type2num(int record_size); * */ -int _gnutls_cert_type_recv_params(gnutls_session session, +int _gnutls_cert_type_recv_params(gnutls_session_t session, const opaque * data, size_t _data_size) { int new_type = -1, ret, i; @@ -126,7 +126,7 @@ int _gnutls_cert_type_recv_params(gnutls_session session, /* returns data_size or a negative number on failure */ -int _gnutls_cert_type_send_params(gnutls_session session, opaque * data, +int _gnutls_cert_type_send_params(gnutls_session_t session, opaque * data, size_t data_size) { uint len, i; diff --git a/lib/ext_cert_type.h b/lib/ext_cert_type.h index 287125da3f..56c9efcc02 100644 --- a/lib/ext_cert_type.h +++ b/lib/ext_cert_type.h @@ -1,7 +1,7 @@ /* Maps record size to numbers according to the * extensions draft. */ -int _gnutls_cert_type_recv_params(gnutls_session session, +int _gnutls_cert_type_recv_params(gnutls_session_t session, const opaque * data, size_t data_size); -int _gnutls_cert_type_send_params(gnutls_session session, opaque * data, +int _gnutls_cert_type_send_params(gnutls_session_t session, opaque * data, size_t); diff --git a/lib/ext_max_record.c b/lib/ext_max_record.c index 52e9a72876..a82a466d5a 100644 --- a/lib/ext_max_record.c +++ b/lib/ext_max_record.c @@ -38,7 +38,7 @@ * */ -int _gnutls_max_record_recv_params(gnutls_session session, +int _gnutls_max_record_recv_params(gnutls_session_t session, const opaque * data, size_t _data_size) { ssize_t new_size; @@ -88,7 +88,7 @@ int _gnutls_max_record_recv_params(gnutls_session session, /* returns data_size or a negative number on failure */ -int _gnutls_max_record_send_params(gnutls_session session, opaque * data, +int _gnutls_max_record_send_params(gnutls_session_t session, opaque * data, size_t data_size) { uint16 len; diff --git a/lib/ext_max_record.h b/lib/ext_max_record.h index b6f158f353..2b4569cdaf 100644 --- a/lib/ext_max_record.h +++ b/lib/ext_max_record.h @@ -3,7 +3,7 @@ */ int _gnutls_mre_num2record(int num); int _gnutls_mre_record2num(uint16 record_size); -int _gnutls_max_record_recv_params(gnutls_session session, +int _gnutls_max_record_recv_params(gnutls_session_t session, const opaque * data, size_t data_size); -int _gnutls_max_record_send_params(gnutls_session session, opaque * data, +int _gnutls_max_record_send_params(gnutls_session_t session, opaque * data, size_t); diff --git a/lib/ext_server_name.c b/lib/ext_server_name.c index 7b83240f0e..cf3d7ddba4 100644 --- a/lib/ext_server_name.c +++ b/lib/ext_server_name.c @@ -35,7 +35,7 @@ * */ -int _gnutls_server_name_recv_params(gnutls_session session, +int _gnutls_server_name_recv_params(gnutls_session_t session, const opaque * data, size_t _data_size) { int i; @@ -113,7 +113,7 @@ int _gnutls_server_name_recv_params(gnutls_session session, /* returns data_size or a negative number on failure */ -int _gnutls_server_name_send_params(gnutls_session session, opaque * data, +int _gnutls_server_name_send_params(gnutls_session_t session, opaque * data, size_t _data_size) { uint16 len; @@ -198,7 +198,7 @@ int _gnutls_server_name_send_params(gnutls_session session, opaque * data, /** * gnutls_server_name_get - Used to get the server name indicator send by a client - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @data: will hold the data * @data_length: will hold the data length. Must hold the maximum size of data. * @type: will hold the server name indicator type @@ -206,7 +206,7 @@ int _gnutls_server_name_send_params(gnutls_session session, opaque * data, * * This function will allow you to get the name indication (if any), * a client has sent. The name indication may be any of the enumeration - * gnutls_server_name_type. + * gnutls_server_name_type_t. * * If @type is GNUTLS_NAME_DNS, then this function is to be used by servers * that support virtual hosting, and the data will be a null terminated UTF-8 string. @@ -219,7 +219,7 @@ int _gnutls_server_name_send_params(gnutls_session session, opaque * data, * index exists GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned. * **/ -int gnutls_server_name_get(gnutls_session session, void *data, +int gnutls_server_name_get(gnutls_session_t session, void *data, size_t * data_length, unsigned int *type, unsigned int indx) { @@ -263,7 +263,7 @@ int gnutls_server_name_get(gnutls_session session, void *data, /** * gnutls_server_name_set - Used to set a name indicator to be sent as an extension - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @type: specifies the indicator type * @name: is a string that contains the server name. * @name_length: holds the length of name @@ -278,8 +278,8 @@ int gnutls_server_name_get(gnutls_session session, void *data, * IPv4 or IPv6 addresses are not permitted. * **/ -int gnutls_server_name_set(gnutls_session session, - gnutls_server_name_type type, +int gnutls_server_name_set(gnutls_session_t session, + gnutls_server_name_type_t type, const void *name, size_t name_length) { int server_names; diff --git a/lib/ext_server_name.h b/lib/ext_server_name.h index a6eb92d94d..56ed33aad3 100644 --- a/lib/ext_server_name.h +++ b/lib/ext_server_name.h @@ -1,11 +1,11 @@ -int _gnutls_server_name_recv_params(gnutls_session session, +int _gnutls_server_name_recv_params(gnutls_session_t session, const opaque * data, size_t data_size); -int _gnutls_server_name_send_params(gnutls_session session, opaque * data, +int _gnutls_server_name_send_params(gnutls_session_t session, opaque * data, size_t); -int gnutls_get_server_name(gnutls_session session, void *data, +int gnutls_get_server_name(gnutls_session_t session, void *data, int *data_length, int *type, int indx); -int gnutls_set_server_name(gnutls_session session, - gnutls_server_name_type type, +int gnutls_set_server_name(gnutls_session_t session, + gnutls_server_name_type_t type, const void *name, int name_length); diff --git a/lib/gnutls.h.in.in b/lib/gnutls.h.in.in index 883c80f865..26b6b7bb01 100644 --- a/lib/gnutls.h.in.in +++ b/lib/gnutls.h.in.in @@ -55,36 +55,38 @@ extern "C" { @DEFINE_TIME_T@ #endif +#include <gnutls/compat.h> + #define GNUTLS_CIPHER_RIJNDAEL_128_CBC GNUTLS_CIPHER_AES_128_CBC #define GNUTLS_CIPHER_RIJNDAEL_256_CBC GNUTLS_CIPHER_AES_256_CBC #define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC #define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128 -typedef enum gnutls_cipher_algorithm { GNUTLS_CIPHER_NULL=1, +typedef enum { GNUTLS_CIPHER_NULL=1, GNUTLS_CIPHER_ARCFOUR_128, GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_AES_128_CBC, GNUTLS_CIPHER_AES_256_CBC, GNUTLS_CIPHER_ARCFOUR_40 -} gnutls_cipher_algorithm; +} gnutls_cipher_algorithm_t; -typedef enum gnutls_kx_algorithm { GNUTLS_KX_RSA=1, GNUTLS_KX_DHE_DSS, +typedef enum { GNUTLS_KX_RSA=1, GNUTLS_KX_DHE_DSS, GNUTLS_KX_DHE_RSA, GNUTLS_KX_ANON_DH, GNUTLS_KX_SRP, GNUTLS_KX_RSA_EXPORT, GNUTLS_KX_SRP_RSA, GNUTLS_KX_SRP_DSS -} gnutls_kx_algorithm; +} gnutls_kx_algorithm_t; -typedef enum gnutls_params_type { GNUTLS_PARAMS_RSA_EXPORT=1, +typedef enum { GNUTLS_PARAMS_RSA_EXPORT=1, GNUTLS_PARAMS_DH -} gnutls_params_type; +} gnutls_params_type_t; -typedef enum gnutls_credentials_type { GNUTLS_CRD_CERTIFICATE=1, GNUTLS_CRD_ANON, GNUTLS_CRD_SRP } gnutls_credentials_type; +typedef enum { GNUTLS_CRD_CERTIFICATE=1, GNUTLS_CRD_ANON, GNUTLS_CRD_SRP } gnutls_credentials_type_t; -typedef enum gnutls_mac_algorithm { GNUTLS_MAC_NULL=1, +typedef enum { GNUTLS_MAC_NULL=1, GNUTLS_MAC_MD5, GNUTLS_MAC_SHA, GNUTLS_MAC_RMD160 -} gnutls_mac_algorithm; +} gnutls_mac_algorithm_t; -/* The enumerations here should have the same value with gnutls_mac_algorithm. +/* The enumerations here should have the same value with gnutls_mac_algorithm_t. */ -typedef enum gnutls_digest_algorithm { GNUTLS_DIG_NULL=1, GNUTLS_DIG_MD5, +typedef enum { GNUTLS_DIG_NULL=1, GNUTLS_DIG_MD5, GNUTLS_DIG_SHA, GNUTLS_DIG_RIPEMD160 -} gnutls_digest_algorithm; +} gnutls_digest_algorithm_t; /* exported for other gnutls headers. This is the maximum number * of algorithms (ciphers, kx or macs). @@ -92,17 +94,17 @@ typedef enum gnutls_digest_algorithm { GNUTLS_DIG_NULL=1, GNUTLS_DIG_MD5, #define GNUTLS_MAX_ALGORITHM_NUM 16 #define GNUTLS_COMP_ZLIB GNUTLS_COMP_DEFLATE -typedef enum gnutls_compression_method { GNUTLS_COMP_NULL=1, +typedef enum { GNUTLS_COMP_NULL=1, GNUTLS_COMP_DEFLATE, GNUTLS_COMP_LZO /* only available if gnutls-extra has been initialized */ -} gnutls_compression_method; +} gnutls_compression_method_t; -typedef enum gnutls_connection_end { GNUTLS_SERVER=1, GNUTLS_CLIENT } gnutls_connection_end; +typedef enum { GNUTLS_SERVER=1, GNUTLS_CLIENT } gnutls_connection_end_t; -typedef enum gnutls_alert_level { GNUTLS_AL_WARNING=1, GNUTLS_AL_FATAL } gnutls_alert_level; +typedef enum { GNUTLS_AL_WARNING=1, GNUTLS_AL_FATAL } gnutls_alert_level_t; -typedef enum gnutls_alert_description { GNUTLS_A_CLOSE_NOTIFY, +typedef enum { GNUTLS_A_CLOSE_NOTIFY, GNUTLS_A_UNEXPECTED_MESSAGE=10, GNUTLS_A_BAD_RECORD_MAC=20, GNUTLS_A_DECRYPTION_FAILED, GNUTLS_A_RECORD_OVERFLOW, GNUTLS_A_DECOMPRESSION_FAILURE=30, GNUTLS_A_HANDSHAKE_FAILURE=40, GNUTLS_A_SSL3_NO_CERTIFICATE=41, @@ -114,20 +116,20 @@ typedef enum gnutls_alert_description { GNUTLS_A_CLOSE_NOTIFY, GNUTLS_A_NO_RENEGOTIATION=100, GNUTLS_A_UNSUPPORTED_EXTENSION=110, GNUTLS_A_CERTIFICATE_UNOBTAINABLE=111, GNUTLS_A_UNRECOGNIZED_NAME=112, GNUTLS_A_UNKNOWN_SRP_USERNAME=120, GNUTLS_A_MISSING_SRP_USERNAME=121 -} gnutls_alert_description; +} gnutls_alert_description_t; -typedef enum gnutls_handshake_description { GNUTLS_HANDSHAKE_HELLO_REQUEST, +typedef enum { GNUTLS_HANDSHAKE_HELLO_REQUEST, GNUTLS_HANDSHAKE_CLIENT_HELLO, GNUTLS_HANDSHAKE_SERVER_HELLO, GNUTLS_HANDSHAKE_CERTIFICATE_PKT=11, GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE, GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST, GNUTLS_HANDSHAKE_SERVER_HELLO_DONE, GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY, GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE, GNUTLS_HANDSHAKE_FINISHED=20 -} gnutls_handshake_description; +} gnutls_handshake_description_t; /* Note that the status bits have different meanings * in openpgp keys and x.509 certificate verification. */ -typedef enum gnutls_certificate_status { +typedef enum { GNUTLS_CERT_INVALID=2, /* will be set if the certificate * was not verified. */ @@ -140,90 +142,90 @@ typedef enum gnutls_certificate_status { */ GNUTLS_CERT_SIGNER_NOT_FOUND=64, GNUTLS_CERT_SIGNER_NOT_CA=128 -} gnutls_certificate_status; +} gnutls_certificate_status_t; -typedef enum gnutls_certificate_request { GNUTLS_CERT_IGNORE, GNUTLS_CERT_REQUEST=1, GNUTLS_CERT_REQUIRE } gnutls_certificate_request; +typedef enum { GNUTLS_CERT_IGNORE, GNUTLS_CERT_REQUEST=1, GNUTLS_CERT_REQUIRE } gnutls_certificate_request_t; -typedef enum gnutls_openpgp_key_status { GNUTLS_OPENPGP_KEY, +typedef enum { GNUTLS_OPENPGP_KEY, GNUTLS_OPENPGP_KEY_FINGERPRINT -} gnutls_openpgp_key_status; +} gnutls_openpgp_key_status_t; -typedef enum gnutls_close_request { GNUTLS_SHUT_RDWR=0, GNUTLS_SHUT_WR=1 } gnutls_close_request; +typedef enum { GNUTLS_SHUT_RDWR=0, GNUTLS_SHUT_WR=1 } gnutls_close_request_t; #define GNUTLS_TLS1 GNUTLS_TLS1_0 -typedef enum gnutls_protocol_version { GNUTLS_SSL3=1, GNUTLS_TLS1_0, - GNUTLS_TLS1_1 } gnutls_protocol_version; +typedef enum { GNUTLS_SSL3=1, GNUTLS_TLS1_0, + GNUTLS_TLS1_1 } gnutls_protocol_t; -typedef enum gnutls_certificate_type { GNUTLS_CRT_X509=1, GNUTLS_CRT_OPENPGP -} gnutls_certificate_type; +typedef enum { GNUTLS_CRT_X509=1, GNUTLS_CRT_OPENPGP +} gnutls_certificate_type_t; -typedef enum gnutls_x509_crt_fmt { GNUTLS_X509_FMT_DER, - GNUTLS_X509_FMT_PEM } gnutls_x509_crt_fmt; +typedef enum { GNUTLS_X509_FMT_DER, + GNUTLS_X509_FMT_PEM } gnutls_x509_crt_fmt_t; -typedef enum gnutls_pk_algorithm { GNUTLS_PK_RSA = 1, GNUTLS_PK_DSA, +typedef enum { GNUTLS_PK_RSA = 1, GNUTLS_PK_DSA, GNUTLS_PK_UNKNOWN = 0xff -} gnutls_pk_algorithm; +} gnutls_pk_algorithm_t; -const char *gnutls_pk_algorithm_get_name( gnutls_pk_algorithm algorithm); +const char *gnutls_pk_algorithm_get_name( gnutls_pk_algorithm_t algorithm); -typedef enum gnutls_sign_algorithm { GNUTLS_SIGN_RSA_SHA = 1, GNUTLS_SIGN_DSA_SHA, +typedef enum { GNUTLS_SIGN_RSA_SHA = 1, GNUTLS_SIGN_DSA_SHA, GNUTLS_SIGN_RSA_MD5, GNUTLS_SIGN_RSA_MD2, GNUTLS_SIGN_UNKNOWN = 0xff -} gnutls_sign_algorithm; +} gnutls_sign_algorithm_t; -const char *gnutls_sign_algorithm_get_name( gnutls_sign_algorithm algorithm); +const char *gnutls_sign_algorithm_get_name( gnutls_sign_algorithm_t algorithm); /* If you want to change this, then also change the * define in gnutls_int.h, and recompile. */ -typedef void * gnutls_transport_ptr; +typedef void * gnutls_transport_ptr_t; struct gnutls_session_int; -typedef struct gnutls_session_int* gnutls_session; +typedef struct gnutls_session_int* gnutls_session_t; struct gnutls_dh_params_int; -typedef struct gnutls_dh_params_int* gnutls_dh_params; +typedef struct gnutls_dh_params_int* gnutls_dh_params_t; struct gnutls_rsa_params_int; -typedef struct gnutls_rsa_params_int* gnutls_rsa_params; +typedef struct gnutls_rsa_params_int* gnutls_rsa_params_t; typedef struct { unsigned char * data; unsigned int size; -} gnutls_datum; +} gnutls_datum_t; /* internal functions */ -int gnutls_init(gnutls_session * session, gnutls_connection_end con_end); -void gnutls_deinit(gnutls_session session); +int gnutls_init(gnutls_session_t * session, gnutls_connection_end_t con_end); +void gnutls_deinit(gnutls_session_t session); #define _gnutls_deinit(x) gnutls_deinit(x) -int gnutls_bye( gnutls_session session, gnutls_close_request how); +int gnutls_bye( gnutls_session_t session, gnutls_close_request_t how); -int gnutls_handshake( gnutls_session session); -int gnutls_rehandshake( gnutls_session session); +int gnutls_handshake( gnutls_session_t session); +int gnutls_rehandshake( gnutls_session_t session); -gnutls_alert_description gnutls_alert_get( gnutls_session session); -int gnutls_alert_send( gnutls_session, gnutls_alert_level, gnutls_alert_description); -int gnutls_alert_send_appropriate( gnutls_session session, int err); -const char* gnutls_alert_get_name( gnutls_alert_description alert); +gnutls_alert_description_t gnutls_alert_get( gnutls_session_t session); +int gnutls_alert_send( gnutls_session_t, gnutls_alert_level_t, gnutls_alert_description_t); +int gnutls_alert_send_appropriate( gnutls_session_t session, int err); +const char* gnutls_alert_get_name( gnutls_alert_description_t alert); /* get information on the current session */ -gnutls_cipher_algorithm gnutls_cipher_get( gnutls_session session); -gnutls_kx_algorithm gnutls_kx_get( gnutls_session session); -gnutls_mac_algorithm gnutls_mac_get( gnutls_session session); -gnutls_compression_method gnutls_compression_get( gnutls_session session); -gnutls_certificate_type gnutls_certificate_type_get( gnutls_session session); +gnutls_cipher_algorithm_t gnutls_cipher_get( gnutls_session_t session); +gnutls_kx_algorithm_t gnutls_kx_get( gnutls_session_t session); +gnutls_mac_algorithm_t gnutls_mac_get( gnutls_session_t session); +gnutls_compression_method_t gnutls_compression_get( gnutls_session_t session); +gnutls_certificate_type_t gnutls_certificate_type_get( gnutls_session_t session); -size_t gnutls_cipher_get_key_size( gnutls_cipher_algorithm algorithm); +size_t gnutls_cipher_get_key_size( gnutls_cipher_algorithm_t algorithm); /* the name of the specified algorithms */ -const char *gnutls_cipher_get_name( gnutls_cipher_algorithm); -const char *gnutls_mac_get_name( gnutls_mac_algorithm); -const char *gnutls_compression_get_name( gnutls_compression_method); -const char *gnutls_kx_get_name( gnutls_kx_algorithm algorithm); -const char *gnutls_certificate_type_get_name( gnutls_certificate_type type); +const char *gnutls_cipher_get_name( gnutls_cipher_algorithm_t); +const char *gnutls_mac_get_name( gnutls_mac_algorithm_t); +const char *gnutls_compression_get_name( gnutls_compression_method_t); +const char *gnutls_kx_get_name( gnutls_kx_algorithm_t algorithm); +const char *gnutls_certificate_type_get_name( gnutls_certificate_type_t type); /* error functions */ @@ -235,88 +237,88 @@ const char* gnutls_strerror( int error); /* Semi-internal functions. */ -void gnutls_handshake_set_private_extensions(gnutls_session session, int allow); -gnutls_handshake_description gnutls_handshake_get_last_out( gnutls_session session); -gnutls_handshake_description gnutls_handshake_get_last_in( gnutls_session session); +void gnutls_handshake_set_private_extensions(gnutls_session_t session, int allow); +gnutls_handshake_description_t gnutls_handshake_get_last_out( gnutls_session_t session); +gnutls_handshake_description_t gnutls_handshake_get_last_in( gnutls_session_t session); /* Record layer functions. */ -ssize_t gnutls_record_send( gnutls_session session, const void *data, size_t sizeofdata); -ssize_t gnutls_record_recv( gnutls_session session, void *data, size_t sizeofdata); +ssize_t gnutls_record_send( gnutls_session_t session, const void *data, size_t sizeofdata); +ssize_t gnutls_record_recv( gnutls_session_t session, void *data, size_t sizeofdata); #define gnutls_read gnutls_record_recv #define gnutls_write gnutls_record_send -int gnutls_record_get_direction(gnutls_session session); +int gnutls_record_get_direction(gnutls_session_t session); -size_t gnutls_record_get_max_size( gnutls_session session); -ssize_t gnutls_record_set_max_size( gnutls_session session, size_t size); +size_t gnutls_record_get_max_size( gnutls_session_t session); +ssize_t gnutls_record_set_max_size( gnutls_session_t session, size_t size); -size_t gnutls_record_check_pending(gnutls_session session); +size_t gnutls_record_check_pending(gnutls_session_t session); /* TLS Extensions */ -typedef enum gnutls_server_name_type { GNUTLS_NAME_DNS=1 -} gnutls_server_name_type; +typedef enum { GNUTLS_NAME_DNS=1 +} gnutls_server_name_type_t; -int gnutls_server_name_set(gnutls_session session, - gnutls_server_name_type type, +int gnutls_server_name_set(gnutls_session_t session, + gnutls_server_name_type_t type, const void *name, size_t name_length); -int gnutls_server_name_get(gnutls_session session, +int gnutls_server_name_get(gnutls_session_t session, void *data, size_t *data_length, unsigned int * type, int unsigned indx); /* functions to set priority of cipher suites */ -int gnutls_cipher_set_priority( gnutls_session session, const int*); -int gnutls_mac_set_priority( gnutls_session session, const int*); -int gnutls_compression_set_priority( gnutls_session session, const int*); -int gnutls_kx_set_priority( gnutls_session session, const int*); -int gnutls_protocol_set_priority( gnutls_session session, const int*); -int gnutls_certificate_type_set_priority( gnutls_session session, const int*); +int gnutls_cipher_set_priority( gnutls_session_t session, const int*); +int gnutls_mac_set_priority( gnutls_session_t session, const int*); +int gnutls_compression_set_priority( gnutls_session_t session, const int*); +int gnutls_kx_set_priority( gnutls_session_t session, const int*); +int gnutls_protocol_set_priority( gnutls_session_t session, const int*); +int gnutls_certificate_type_set_priority( gnutls_session_t session, const int*); /* if you just want some defaults, use the following. */ -int gnutls_set_default_priority(gnutls_session session); -int gnutls_set_default_export_priority(gnutls_session session); +int gnutls_set_default_priority(gnutls_session_t session); +int gnutls_set_default_export_priority(gnutls_session_t session); /* Returns the name of a cipher suite */ -const char *gnutls_cipher_suite_get_name(gnutls_kx_algorithm kx_algorithm, - gnutls_cipher_algorithm cipher_algorithm, gnutls_mac_algorithm mac_algorithm); +const char *gnutls_cipher_suite_get_name(gnutls_kx_algorithm_t kx_algorithm, + gnutls_cipher_algorithm_t cipher_algorithm, gnutls_mac_algorithm_t mac_algorithm); /* get the currently used protocol version */ -gnutls_protocol_version gnutls_protocol_get_version(gnutls_session session); +gnutls_protocol_t gnutls_protocol_get_version(gnutls_session_t session); -const char *gnutls_protocol_get_name(gnutls_protocol_version version); +const char *gnutls_protocol_get_name(gnutls_protocol_t version); /* get/set session */ -int gnutls_session_set_data( gnutls_session session, const void* session_data, size_t session_data_size); -int gnutls_session_get_data( gnutls_session session, void* session_data, size_t *session_data_size); +int gnutls_session_set_data( gnutls_session_t session, const void* session_data, size_t session_data_size); +int gnutls_session_get_data( gnutls_session_t session, void* session_data, size_t *session_data_size); /* returns the session ID */ #define GNUTLS_MAX_SESSION_ID 32 -int gnutls_session_get_id( gnutls_session session, void* session_id, size_t *session_id_size); +int gnutls_session_get_id( gnutls_session_t session, void* session_id, size_t *session_id_size); /* checks if this session is a resumed one */ -int gnutls_session_is_resumed(gnutls_session session); +int gnutls_session_is_resumed(gnutls_session_t session); -typedef int (*gnutls_db_store_func)(void*, gnutls_datum key, gnutls_datum data); -typedef int (*gnutls_db_remove_func)(void*, gnutls_datum key); -typedef gnutls_datum (*gnutls_db_retr_func)(void*, gnutls_datum key); +typedef int (*gnutls_db_store_func)(void*, gnutls_datum_t key, gnutls_datum_t data); +typedef int (*gnutls_db_remove_func)(void*, gnutls_datum_t key); +typedef gnutls_datum_t (*gnutls_db_retr_func)(void*, gnutls_datum_t key); -void gnutls_db_set_cache_expiration( gnutls_session session, int seconds); +void gnutls_db_set_cache_expiration( gnutls_session_t session, int seconds); -void gnutls_db_remove_session( gnutls_session session); -void gnutls_db_set_retrieve_function( gnutls_session, gnutls_db_retr_func); -void gnutls_db_set_remove_function( gnutls_session, gnutls_db_remove_func); -void gnutls_db_set_store_function( gnutls_session, gnutls_db_store_func); -void gnutls_db_set_ptr( gnutls_session, void* db_ptr); -void* gnutls_db_get_ptr( gnutls_session); -int gnutls_db_check_entry( gnutls_session session, gnutls_datum session_entry); +void gnutls_db_remove_session( gnutls_session_t session); +void gnutls_db_set_retrieve_function( gnutls_session_t, gnutls_db_retr_func); +void gnutls_db_set_remove_function( gnutls_session_t, gnutls_db_remove_func); +void gnutls_db_set_store_function( gnutls_session_t, gnutls_db_store_func); +void gnutls_db_set_ptr( gnutls_session_t, void* db_ptr); +void* gnutls_db_get_ptr( gnutls_session_t); +int gnutls_db_check_entry( gnutls_session_t session, gnutls_datum_t session_entry); -void gnutls_handshake_set_max_packet_length( gnutls_session session, int max); +void gnutls_handshake_set_max_packet_length( gnutls_session_t session, int max); /* returns libgnutls version (call it with a NULL argument) */ @@ -324,82 +326,82 @@ const char* gnutls_check_version( const char*); /* Functions for setting/clearing credentials */ -int gnutls_credentials_clear( gnutls_session session); +int gnutls_credentials_clear( gnutls_session_t session); /* cred is a structure defined by the kx algorithm */ -int gnutls_credentials_set( gnutls_session, gnutls_credentials_type type, void* cred); +int gnutls_credentials_set( gnutls_session_t, gnutls_credentials_type_t type, void* cred); #define gnutls_cred_set gnutls_credentials_set /* Credential structures for SRP - used in gnutls_credentials_set(); */ struct DSTRUCT; -typedef struct DSTRUCT* gnutls_certificate_credentials; -typedef gnutls_certificate_credentials gnutls_certificate_server_credentials; -typedef gnutls_certificate_credentials gnutls_certificate_client_credentials; +typedef struct DSTRUCT* gnutls_certificate_credentials_t; +typedef gnutls_certificate_credentials_t gnutls_certificate_server_credentials; +typedef gnutls_certificate_credentials_t gnutls_certificate_client_credentials; -typedef struct DSTRUCT* gnutls_anon_server_credentials; -typedef struct DSTRUCT* gnutls_anon_client_credentials; +typedef struct DSTRUCT* gnutls_anon_server_credentials_t; +typedef struct DSTRUCT* gnutls_anon_client_credentials_t; -void gnutls_anon_free_server_credentials( gnutls_anon_server_credentials sc); -int gnutls_anon_allocate_server_credentials( gnutls_anon_server_credentials *sc); +void gnutls_anon_free_server_credentials( gnutls_anon_server_credentials_t sc); +int gnutls_anon_allocate_server_credentials( gnutls_anon_server_credentials_t *sc); -void gnutls_anon_set_server_dh_params( gnutls_anon_server_credentials res, gnutls_dh_params dh_params); +void gnutls_anon_set_server_dh_params( gnutls_anon_server_credentials_t res, gnutls_dh_params_t dh_params); -void gnutls_anon_free_client_credentials( gnutls_anon_client_credentials sc); -int gnutls_anon_allocate_client_credentials( gnutls_anon_client_credentials *sc); +void gnutls_anon_free_client_credentials( gnutls_anon_client_credentials_t sc); +int gnutls_anon_allocate_client_credentials( gnutls_anon_client_credentials_t *sc); /* CERTFILE is an x509 certificate in PEM form. * KEYFILE is a pkcs-1 private key in PEM form (for RSA keys). */ -void gnutls_certificate_free_credentials( gnutls_certificate_credentials sc); -int gnutls_certificate_allocate_credentials( gnutls_certificate_credentials *sc); +void gnutls_certificate_free_credentials( gnutls_certificate_credentials_t sc); +int gnutls_certificate_allocate_credentials( gnutls_certificate_credentials_t *sc); -void gnutls_certificate_free_keys(gnutls_certificate_credentials sc); -void gnutls_certificate_free_cas(gnutls_certificate_credentials sc); -void gnutls_certificate_free_ca_names(gnutls_certificate_credentials sc); -void gnutls_certificate_free_crls(gnutls_certificate_credentials sc); +void gnutls_certificate_free_keys(gnutls_certificate_credentials_t sc); +void gnutls_certificate_free_cas(gnutls_certificate_credentials_t sc); +void gnutls_certificate_free_ca_names(gnutls_certificate_credentials_t sc); +void gnutls_certificate_free_crls(gnutls_certificate_credentials_t sc); -void gnutls_certificate_set_dh_params(gnutls_certificate_credentials res, gnutls_dh_params); -void gnutls_certificate_set_rsa_export_params(gnutls_certificate_credentials res, gnutls_rsa_params rsa_params); -void gnutls_certificate_set_verify_flags(gnutls_certificate_credentials res, unsigned int flags); +void gnutls_certificate_set_dh_params(gnutls_certificate_credentials_t res, gnutls_dh_params_t); +void gnutls_certificate_set_rsa_export_params(gnutls_certificate_credentials_t res, gnutls_rsa_params_t rsa_params); +void gnutls_certificate_set_verify_flags(gnutls_certificate_credentials_t res, unsigned int flags); -int gnutls_certificate_set_x509_trust_file( gnutls_certificate_credentials res, const char* CAFILE, - gnutls_x509_crt_fmt); -int gnutls_certificate_set_x509_trust_mem(gnutls_certificate_credentials res, - const gnutls_datum *CA, gnutls_x509_crt_fmt); +int gnutls_certificate_set_x509_trust_file( gnutls_certificate_credentials_t res, const char* CAFILE, + gnutls_x509_crt_fmt_t); +int gnutls_certificate_set_x509_trust_mem(gnutls_certificate_credentials_t res, + const gnutls_datum_t *CA, gnutls_x509_crt_fmt_t); -int gnutls_certificate_set_x509_crl_file(gnutls_certificate_credentials res, - const char *crlfile, gnutls_x509_crt_fmt type); -int gnutls_certificate_set_x509_crl_mem(gnutls_certificate_credentials res, - const gnutls_datum *CRL, gnutls_x509_crt_fmt type); +int gnutls_certificate_set_x509_crl_file(gnutls_certificate_credentials_t res, + const char *crlfile, gnutls_x509_crt_fmt_t type); +int gnutls_certificate_set_x509_crl_mem(gnutls_certificate_credentials_t res, + const gnutls_datum_t *CRL, gnutls_x509_crt_fmt_t type); -int gnutls_certificate_set_x509_key_file( gnutls_certificate_credentials res, - const char *CERTFILE, const char* KEYFILE, gnutls_x509_crt_fmt); -int gnutls_certificate_set_x509_key_mem(gnutls_certificate_credentials res, - const gnutls_datum* CERT, const gnutls_datum* KEY, - gnutls_x509_crt_fmt); +int gnutls_certificate_set_x509_key_file( gnutls_certificate_credentials_t res, + const char *CERTFILE, const char* KEYFILE, gnutls_x509_crt_fmt_t); +int gnutls_certificate_set_x509_key_mem(gnutls_certificate_credentials_t res, + const gnutls_datum_t* CERT, const gnutls_datum_t* KEY, + gnutls_x509_crt_fmt_t); /* New functions to allow setting already parsed X.509 stuff. */ struct gnutls_x509_privkey_int; -typedef struct gnutls_x509_privkey_int* gnutls_x509_privkey; +typedef struct gnutls_x509_privkey_int* gnutls_x509_privkey_t; struct gnutls_x509_crl_int; -typedef struct gnutls_x509_crl_int* gnutls_x509_crl; +typedef struct gnutls_x509_crl_int* gnutls_x509_crl_t; struct gnutls_x509_crt_int; -typedef struct gnutls_x509_crt_int* gnutls_x509_crt; +typedef struct gnutls_x509_crt_int* gnutls_x509_crt_t; -int gnutls_certificate_set_x509_key(gnutls_certificate_credentials res, - gnutls_x509_crt *cert_list, int cert_list_size, - gnutls_x509_privkey key); -int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials res, - gnutls_x509_crt * ca_list, int ca_list_size); -int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials res, - gnutls_x509_crl* crl_list, int crl_list_size); +int gnutls_certificate_set_x509_key(gnutls_certificate_credentials_t res, + gnutls_x509_crt_t *cert_list, int cert_list_size, + gnutls_x509_privkey_t key); +int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials_t res, + gnutls_x509_crt_t * ca_list, int ca_list_size); +int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials_t res, + gnutls_x509_crl_t* crl_list, int crl_list_size); /* global state functions @@ -429,69 +431,69 @@ void gnutls_global_set_log_level( int level); /* Diffie Hellman parameter handling. */ -int gnutls_dh_params_init( gnutls_dh_params*); -void gnutls_dh_params_deinit( gnutls_dh_params); -int gnutls_dh_params_import_raw(gnutls_dh_params dh_params, const gnutls_datum *prime, - const gnutls_datum* generator); -int gnutls_dh_params_import_pkcs3(gnutls_dh_params params, - const gnutls_datum * pkcs3_params, gnutls_x509_crt_fmt format); -int gnutls_dh_params_generate2(gnutls_dh_params params, int bits); -int gnutls_dh_params_export_pkcs3( gnutls_dh_params params, - gnutls_x509_crt_fmt format, unsigned char* params_data, size_t* params_data_size); -int gnutls_dh_params_export_raw(gnutls_dh_params params, - gnutls_datum * prime, gnutls_datum * generator, unsigned int *bits); -int gnutls_dh_params_cpy(gnutls_dh_params dst, gnutls_dh_params src); +int gnutls_dh_params_init( gnutls_dh_params_t*); +void gnutls_dh_params_deinit( gnutls_dh_params_t); +int gnutls_dh_params_import_raw(gnutls_dh_params_t dh_params, const gnutls_datum_t *prime, + const gnutls_datum_t* generator); +int gnutls_dh_params_import_pkcs3(gnutls_dh_params_t params, + const gnutls_datum_t * pkcs3_params, gnutls_x509_crt_fmt_t format); +int gnutls_dh_params_generate2(gnutls_dh_params_t params, int bits); +int gnutls_dh_params_export_pkcs3( gnutls_dh_params_t params, + gnutls_x509_crt_fmt_t format, unsigned char* params_data, size_t* params_data_size); +int gnutls_dh_params_export_raw(gnutls_dh_params_t params, + gnutls_datum_t * prime, gnutls_datum_t * generator, unsigned int *bits); +int gnutls_dh_params_cpy(gnutls_dh_params_t dst, gnutls_dh_params_t src); /* RSA params */ -int gnutls_rsa_params_init(gnutls_rsa_params * rsa_params); -void gnutls_rsa_params_deinit(gnutls_rsa_params rsa_params); -int gnutls_rsa_params_cpy(gnutls_rsa_params dst, gnutls_rsa_params src); -int gnutls_rsa_params_import_raw(gnutls_rsa_params rsa_params, - const gnutls_datum *m, const gnutls_datum *e, - const gnutls_datum *d, const gnutls_datum *p, - const gnutls_datum *q, const gnutls_datum *u); -int gnutls_rsa_params_generate2(gnutls_rsa_params params, int bits); -int gnutls_rsa_params_export_raw(gnutls_rsa_params params, - gnutls_datum * m, gnutls_datum *e, - gnutls_datum *d, gnutls_datum *p, gnutls_datum* q, - gnutls_datum* u, unsigned int *bits); -int gnutls_rsa_params_export_pkcs1( gnutls_rsa_params params, - gnutls_x509_crt_fmt format, unsigned char* params_data, +int gnutls_rsa_params_init(gnutls_rsa_params_t * rsa_params); +void gnutls_rsa_params_deinit(gnutls_rsa_params_t rsa_params); +int gnutls_rsa_params_cpy(gnutls_rsa_params_t dst, gnutls_rsa_params_t src); +int gnutls_rsa_params_import_raw(gnutls_rsa_params_t rsa_params, + const gnutls_datum_t *m, const gnutls_datum_t *e, + const gnutls_datum_t *d, const gnutls_datum_t *p, + const gnutls_datum_t *q, const gnutls_datum_t *u); +int gnutls_rsa_params_generate2(gnutls_rsa_params_t params, int bits); +int gnutls_rsa_params_export_raw(gnutls_rsa_params_t params, + gnutls_datum_t * m, gnutls_datum_t *e, + gnutls_datum_t *d, gnutls_datum_t *p, gnutls_datum_t* q, + gnutls_datum_t* u, unsigned int *bits); +int gnutls_rsa_params_export_pkcs1( gnutls_rsa_params_t params, + gnutls_x509_crt_fmt_t format, unsigned char* params_data, size_t* params_data_size); -int gnutls_rsa_params_import_pkcs1(gnutls_rsa_params params, - const gnutls_datum * pkcs1_params, gnutls_x509_crt_fmt format); +int gnutls_rsa_params_import_pkcs1(gnutls_rsa_params_t params, + const gnutls_datum_t * pkcs1_params, gnutls_x509_crt_fmt_t format); /* Session stuff */ -typedef ssize_t (*gnutls_pull_func)(gnutls_transport_ptr, void*, size_t); -typedef ssize_t (*gnutls_push_func)(gnutls_transport_ptr, const void*, size_t); -void gnutls_transport_set_ptr(gnutls_session session, gnutls_transport_ptr ptr); -void gnutls_transport_set_ptr2(gnutls_session session, gnutls_transport_ptr recv_ptr, - gnutls_transport_ptr send_ptr); +typedef ssize_t (*gnutls_pull_func)(gnutls_transport_ptr_t, void*, size_t); +typedef ssize_t (*gnutls_push_func)(gnutls_transport_ptr_t, const void*, size_t); +void gnutls_transport_set_ptr(gnutls_session_t session, gnutls_transport_ptr_t ptr); +void gnutls_transport_set_ptr2(gnutls_session_t session, gnutls_transport_ptr_t recv_ptr, + gnutls_transport_ptr_t send_ptr); -gnutls_transport_ptr gnutls_transport_get_ptr(gnutls_session session); -void gnutls_transport_get_ptr2(gnutls_session session, - gnutls_transport_ptr *recv_ptr, - gnutls_transport_ptr *send_ptr); +gnutls_transport_ptr_t gnutls_transport_get_ptr(gnutls_session_t session); +void gnutls_transport_get_ptr2(gnutls_session_t session, + gnutls_transport_ptr_t *recv_ptr, + gnutls_transport_ptr_t *send_ptr); -void gnutls_transport_set_lowat( gnutls_session session, int num); +void gnutls_transport_set_lowat( gnutls_session_t session, int num); -void gnutls_transport_set_push_function( gnutls_session, gnutls_push_func push_func); -void gnutls_transport_set_pull_function( gnutls_session, gnutls_pull_func pull_func); +void gnutls_transport_set_push_function( gnutls_session_t, gnutls_push_func push_func); +void gnutls_transport_set_pull_function( gnutls_session_t, gnutls_pull_func pull_func); /* session specific */ -void gnutls_session_set_ptr(gnutls_session session, void* ptr); -void* gnutls_session_get_ptr(gnutls_session session); +void gnutls_session_set_ptr(gnutls_session_t session, void* ptr); +void* gnutls_session_get_ptr(gnutls_session_t session); -void gnutls_openpgp_send_key(gnutls_session session, gnutls_openpgp_key_status status); +void gnutls_openpgp_send_key(gnutls_session_t session, gnutls_openpgp_key_status_t status); /* fingerprint * Actually this function returns the hash of the given data. */ -int gnutls_fingerprint(gnutls_digest_algorithm algo, const gnutls_datum* data, +int gnutls_fingerprint(gnutls_digest_algorithm_t algo, const gnutls_datum_t* data, void* result, size_t* result_size); diff --git a/lib/gnutls_alert.c b/lib/gnutls_alert.c index 3e70b46027..3bd3f83e86 100644 --- a/lib/gnutls_alert.c +++ b/lib/gnutls_alert.c @@ -27,7 +27,7 @@ #include <debug.h> typedef struct { - gnutls_alert_description alert; + gnutls_alert_description_t alert; const char *desc; } gnutls_alert_entry; @@ -75,13 +75,13 @@ static const gnutls_alert_entry sup_alerts[] = { /** * gnutls_alert_get_name - Returns a string describing the alert number given - * @alert: is an alert number &gnutls_session structure. + * @alert: is an alert number &gnutls_session_t structure. * * Returns a string that describes the given alert number or NULL. * See gnutls_alert_get(). * **/ -const char *gnutls_alert_get_name(gnutls_alert_level alert) +const char *gnutls_alert_get_name(gnutls_alert_level_t alert) { const char *ret = NULL; @@ -92,7 +92,7 @@ const char *gnutls_alert_get_name(gnutls_alert_level alert) /** * gnutls_alert_send - This function sends an alert message to the peer - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @level: is the level of the alert * @desc: is the alert description * @@ -107,8 +107,8 @@ const char *gnutls_alert_get_name(gnutls_alert_level alert) * Returns 0 on success. * **/ -int gnutls_alert_send(gnutls_session session, gnutls_alert_level level, - gnutls_alert_description desc) +int gnutls_alert_send(gnutls_session_t session, gnutls_alert_level_t level, + gnutls_alert_description_t desc) { uint8 data[2]; int ret; @@ -244,7 +244,7 @@ int gnutls_error_to_alert(int err, int *level) */ /*- * gnutls_alert_send_appropriate - This function sends an alert to the peer depending on the error code - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @err: is an integer * * Sends an alert to the peer depending on the error code returned by a gnutls @@ -257,7 +257,7 @@ int gnutls_error_to_alert(int err, int *level) * been sent to the peer. * -*/ -int gnutls_alert_send_appropriate(gnutls_session session, int err) +int gnutls_alert_send_appropriate(gnutls_session_t session, int err) { int alert; int level; @@ -272,7 +272,7 @@ int gnutls_alert_send_appropriate(gnutls_session session, int err) /** * gnutls_alert_get - Returns the last alert number received. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the last alert number received. This function * should be called if GNUTLS_E_WARNING_ALERT_RECEIVED or @@ -280,7 +280,7 @@ int gnutls_alert_send_appropriate(gnutls_session session, int err) * The peer may send alerts if he thinks some things were not * right. Check gnutls.h for the available alert descriptions. **/ -gnutls_alert_description gnutls_alert_get(gnutls_session session) +gnutls_alert_description_t gnutls_alert_get(gnutls_session_t session) { return session->internals.last_alert; } diff --git a/lib/gnutls_alert.h b/lib/gnutls_alert.h index b042c5a85a..ed1f122182 100644 --- a/lib/gnutls_alert.h +++ b/lib/gnutls_alert.h @@ -1,5 +1,5 @@ -typedef enum gnutls_alert_level { GNUTLS_AL_WARNING = 1, GNUTLS_AL_FATAL -} gnutls_alert_level; +typedef enum gnutls_alert_level_t { GNUTLS_AL_WARNING = 1, GNUTLS_AL_FATAL +} gnutls_alert_level_t; typedef enum AlertDescription { GNUTLS_A_CLOSE_NOTIFY, GNUTLS_A_UNEXPECTED_MESSAGE = 10, @@ -19,9 +19,9 @@ typedef enum AlertDescription { 112, GNUTLS_A_UNKNOWN_SRP_USERNAME = 120, GNUTLS_A_MISSING_SRP_USERNAME = 121 -} gnutls_alert_description; +} gnutls_alert_description_t; -gnutls_alert_description gnutls_alert_get(gnutls_session session); -int gnutls_alert_send(gnutls_session session, gnutls_alert_level level, - gnutls_alert_description desc); -const char *gnutls_alert_get_name(gnutls_alert_level alert); +gnutls_alert_description_t gnutls_alert_get(gnutls_session_t session); +int gnutls_alert_send(gnutls_session_t session, gnutls_alert_level_t level, + gnutls_alert_description_t desc); +const char *gnutls_alert_get_name(gnutls_alert_level_t alert); diff --git a/lib/gnutls_algorithms.c b/lib/gnutls_algorithms.c index d0d3d8384e..e0ee6000db 100644 --- a/lib/gnutls_algorithms.c +++ b/lib/gnutls_algorithms.c @@ -31,9 +31,9 @@ * more than one credentials type. */ typedef struct { - gnutls_kx_algorithm algorithm; - gnutls_credentials_type client_type; - gnutls_credentials_type server_type; /* The type of credentials a server + gnutls_kx_algorithm_t algorithm; + gnutls_credentials_type_t client_type; + gnutls_credentials_type_t server_type; /* The type of credentials a server * needs to set */ } gnutls_cred_map; @@ -61,8 +61,8 @@ static const gnutls_cred_map cred_mappings[] = { /* KX mappings to PK algorithms */ typedef struct { - gnutls_kx_algorithm kx_algorithm; - gnutls_pk_algorithm pk_algorithm; + gnutls_kx_algorithm_t kx_algorithm; + gnutls_pk_algorithm_t pk_algorithm; enum encipher_type encipher_type; /* CIPHER_ENCRYPT if this algorithm is to be used * for encryption, CIPHER_SIGN if signature only, * CIPHER_IGN if this does not apply at all. @@ -100,7 +100,7 @@ static const gnutls_pk_map pk_mappings[] = { typedef struct { const char *name; - gnutls_protocol_version id; /* gnutls internal version number */ + gnutls_protocol_t id; /* gnutls internal version number */ int major; /* defined by the protocol */ int minor; /* defined by the protocol */ int supported; /* 0 not supported, > 0 is supported */ @@ -123,7 +123,7 @@ static const gnutls_version_entry sup_versions[] = { struct gnutls_cipher_entry { const char *name; - gnutls_cipher_algorithm id; + gnutls_cipher_algorithm_t id; uint16 blocksize; uint16 keysize; cipher_type_t block; @@ -161,7 +161,7 @@ static const gnutls_cipher_entry algorithms[] = { struct gnutls_hash_entry { const char *name; - gnutls_mac_algorithm id; + gnutls_mac_algorithm_t id; }; typedef struct gnutls_hash_entry gnutls_hash_entry; @@ -252,10 +252,10 @@ gnutls_kx_algo_entry _gnutls_kx_algorithms[MAX_KX_ALGOS] = { typedef struct { const char *name; cipher_suite_st id; - gnutls_cipher_algorithm block_algorithm; - gnutls_kx_algorithm kx_algorithm; - gnutls_mac_algorithm mac_algorithm; - gnutls_protocol_version version; /* this cipher suite is supported + gnutls_cipher_algorithm_t block_algorithm; + gnutls_kx_algorithm_t kx_algorithm; + gnutls_mac_algorithm_t mac_algorithm; + gnutls_protocol_t version; /* this cipher suite is supported * from 'version' and above; */ } gnutls_cipher_suite_entry; @@ -485,8 +485,8 @@ static const gnutls_cipher_suite_entry cs_algorithms[] = { /* Generic Functions */ -inline int _gnutls_mac_priority(gnutls_session session, - gnutls_mac_algorithm algorithm) +inline int _gnutls_mac_priority(gnutls_session_t session, + gnutls_mac_algorithm_t algorithm) { /* actually returns the priority */ unsigned int i; for (i = 0; @@ -505,7 +505,7 @@ inline int _gnutls_mac_priority(gnutls_session session, * Returns a string that contains the name * of the specified MAC algorithm or NULL. **/ -const char *gnutls_mac_get_name(gnutls_mac_algorithm algorithm) +const char *gnutls_mac_get_name(gnutls_mac_algorithm_t algorithm) { const char *ret = NULL; @@ -515,7 +515,7 @@ const char *gnutls_mac_get_name(gnutls_mac_algorithm algorithm) return ret; } -int _gnutls_mac_is_ok(gnutls_mac_algorithm algorithm) +int _gnutls_mac_is_ok(gnutls_mac_algorithm_t algorithm) { ssize_t ret = -1; GNUTLS_HASH_ALG_LOOP(ret = p->id); @@ -528,8 +528,8 @@ int _gnutls_mac_is_ok(gnutls_mac_algorithm algorithm) /* Compression Functions */ inline - int _gnutls_compression_priority(gnutls_session session, - gnutls_compression_method algorithm) + int _gnutls_compression_priority(gnutls_session_t session, + gnutls_compression_method_t algorithm) { /* actually returns the priority */ unsigned int i; for (i = 0; @@ -549,7 +549,7 @@ inline * Returns a pointer to a string that contains the name * of the specified compression algorithm or NULL. **/ -const char *gnutls_compression_get_name(gnutls_compression_method +const char *gnutls_compression_get_name(gnutls_compression_method_t algorithm) { const char *ret = NULL; @@ -562,7 +562,7 @@ const char *gnutls_compression_get_name(gnutls_compression_method } /* return the tls number of the specified algorithm */ -int _gnutls_compression_get_num(gnutls_compression_method algorithm) +int _gnutls_compression_get_num(gnutls_compression_method_t algorithm) { int ret = -1; @@ -572,7 +572,7 @@ int _gnutls_compression_get_num(gnutls_compression_method algorithm) return ret; } -int _gnutls_compression_get_wbits(gnutls_compression_method algorithm) +int _gnutls_compression_get_wbits(gnutls_compression_method_t algorithm) { int ret = -1; /* avoid prefix */ @@ -580,7 +580,7 @@ int _gnutls_compression_get_wbits(gnutls_compression_method algorithm) return ret; } -int _gnutls_compression_get_mem_level(gnutls_compression_method algorithm) +int _gnutls_compression_get_mem_level(gnutls_compression_method_t algorithm) { int ret = -1; /* avoid prefix */ @@ -588,7 +588,7 @@ int _gnutls_compression_get_mem_level(gnutls_compression_method algorithm) return ret; } -int _gnutls_compression_get_comp_level(gnutls_compression_method algorithm) +int _gnutls_compression_get_comp_level(gnutls_compression_method_t algorithm) { int ret = -1; /* avoid prefix */ @@ -599,9 +599,9 @@ int _gnutls_compression_get_comp_level(gnutls_compression_method algorithm) /* returns the gnutls internal ID of the TLS compression * method num */ -gnutls_compression_method _gnutls_compression_get_id(int num) +gnutls_compression_method_t _gnutls_compression_get_id(int num) { - gnutls_compression_method ret = -1; + gnutls_compression_method_t ret = -1; /* avoid prefix */ GNUTLS_COMPRESSION_ALG_LOOP_NUM(ret = p->id); @@ -609,7 +609,7 @@ gnutls_compression_method _gnutls_compression_get_id(int num) return ret; } -int _gnutls_compression_is_ok(gnutls_compression_method algorithm) +int _gnutls_compression_is_ok(gnutls_compression_method_t algorithm) { ssize_t ret = -1; GNUTLS_COMPRESSION_ALG_LOOP(ret = p->id); @@ -623,7 +623,7 @@ int _gnutls_compression_is_ok(gnutls_compression_method algorithm) /* CIPHER functions */ -int _gnutls_cipher_get_block_size(gnutls_cipher_algorithm algorithm) +int _gnutls_cipher_get_block_size(gnutls_cipher_algorithm_t algorithm) { size_t ret = 0; GNUTLS_ALG_LOOP(ret = p->blocksize); @@ -634,8 +634,8 @@ int _gnutls_cipher_get_block_size(gnutls_cipher_algorithm algorithm) /* returns the priority */ inline int -_gnutls_cipher_priority(gnutls_session session, - gnutls_cipher_algorithm algorithm) +_gnutls_cipher_priority(gnutls_session_t session, + gnutls_cipher_algorithm_t algorithm) { unsigned int i; for (i = 0; @@ -649,7 +649,7 @@ _gnutls_cipher_priority(gnutls_session session, } -int _gnutls_cipher_is_block(gnutls_cipher_algorithm algorithm) +int _gnutls_cipher_is_block(gnutls_cipher_algorithm_t algorithm) { size_t ret = 0; @@ -666,7 +666,7 @@ int _gnutls_cipher_is_block(gnutls_cipher_algorithm algorithm) * Returns 0 if the given cipher is invalid. * **/ -size_t gnutls_cipher_get_key_size(gnutls_cipher_algorithm algorithm) +size_t gnutls_cipher_get_key_size(gnutls_cipher_algorithm_t algorithm) { /* In bytes */ size_t ret = 0; GNUTLS_ALG_LOOP(ret = p->keysize); @@ -674,7 +674,7 @@ size_t gnutls_cipher_get_key_size(gnutls_cipher_algorithm algorithm) } -int _gnutls_cipher_get_iv_size(gnutls_cipher_algorithm algorithm) +int _gnutls_cipher_get_iv_size(gnutls_cipher_algorithm_t algorithm) { /* In bytes */ size_t ret = 0; GNUTLS_ALG_LOOP(ret = p->iv); @@ -682,7 +682,7 @@ int _gnutls_cipher_get_iv_size(gnutls_cipher_algorithm algorithm) } -int _gnutls_cipher_get_export_flag(gnutls_cipher_algorithm algorithm) +int _gnutls_cipher_get_export_flag(gnutls_cipher_algorithm_t algorithm) { /* In bytes */ size_t ret = 0; GNUTLS_ALG_LOOP(ret = p->export_flag); @@ -697,7 +697,7 @@ int _gnutls_cipher_get_export_flag(gnutls_cipher_algorithm algorithm) * Returns a pointer to a string that contains the name * of the specified cipher or NULL. **/ -const char *gnutls_cipher_get_name(gnutls_cipher_algorithm algorithm) +const char *gnutls_cipher_get_name(gnutls_cipher_algorithm_t algorithm) { const char *ret = NULL; @@ -707,7 +707,7 @@ const char *gnutls_cipher_get_name(gnutls_cipher_algorithm algorithm) return ret; } -int _gnutls_cipher_is_ok(gnutls_cipher_algorithm algorithm) +int _gnutls_cipher_is_ok(gnutls_cipher_algorithm_t algorithm) { ssize_t ret = -1; GNUTLS_ALG_LOOP(ret = p->id); @@ -720,7 +720,7 @@ int _gnutls_cipher_is_ok(gnutls_cipher_algorithm algorithm) /* Key EXCHANGE functions */ -mod_auth_st *_gnutls_kx_auth_struct(gnutls_kx_algorithm algorithm) +mod_auth_st *_gnutls_kx_auth_struct(gnutls_kx_algorithm_t algorithm) { mod_auth_st *ret = NULL; GNUTLS_KX_ALG_LOOP(ret = p->auth_struct); @@ -729,8 +729,8 @@ mod_auth_st *_gnutls_kx_auth_struct(gnutls_kx_algorithm algorithm) } -inline int _gnutls_kx_priority(gnutls_session session, - gnutls_kx_algorithm algorithm) +inline int _gnutls_kx_priority(gnutls_session_t session, + gnutls_kx_algorithm_t algorithm) { unsigned int i; for (i = 0; @@ -749,7 +749,7 @@ inline int _gnutls_kx_priority(gnutls_session session, * Returns a pointer to a string that contains the name * of the specified key exchange algorithm or NULL. **/ -const char *gnutls_kx_get_name(gnutls_kx_algorithm algorithm) +const char *gnutls_kx_get_name(gnutls_kx_algorithm_t algorithm) { const char *ret = NULL; @@ -759,7 +759,7 @@ const char *gnutls_kx_get_name(gnutls_kx_algorithm algorithm) return ret; } -int _gnutls_kx_is_ok(gnutls_kx_algorithm algorithm) +int _gnutls_kx_is_ok(gnutls_kx_algorithm_t algorithm) { ssize_t ret = -1; GNUTLS_KX_ALG_LOOP(ret = p->algorithm); @@ -770,14 +770,14 @@ int _gnutls_kx_is_ok(gnutls_kx_algorithm algorithm) return ret; } -int _gnutls_kx_needs_rsa_params(gnutls_kx_algorithm algorithm) +int _gnutls_kx_needs_rsa_params(gnutls_kx_algorithm_t algorithm) { ssize_t ret = 0; GNUTLS_KX_ALG_LOOP(ret = p->needs_rsa_params); return ret; } -int _gnutls_kx_needs_dh_params(gnutls_kx_algorithm algorithm) +int _gnutls_kx_needs_dh_params(gnutls_kx_algorithm_t algorithm) { ssize_t ret = 0; GNUTLS_KX_ALG_LOOP(ret = p->needs_dh_params); @@ -786,8 +786,8 @@ int _gnutls_kx_needs_dh_params(gnutls_kx_algorithm algorithm) /* Version */ -int _gnutls_version_priority(gnutls_session session, - gnutls_protocol_version version) +int _gnutls_version_priority(gnutls_session_t session, + gnutls_protocol_t version) { /* actually returns the priority */ unsigned int i; @@ -803,7 +803,7 @@ int _gnutls_version_priority(gnutls_session session, return -1; } -gnutls_protocol_version _gnutls_version_lowest(gnutls_session session) +gnutls_protocol_t _gnutls_version_lowest(gnutls_session_t session) { /* returns the lowest version supported */ unsigned int i, min = 0xff; @@ -822,7 +822,7 @@ gnutls_protocol_version _gnutls_version_lowest(gnutls_session session) return min; } -gnutls_protocol_version _gnutls_version_max(gnutls_session session) +gnutls_protocol_t _gnutls_version_max(gnutls_session_t session) { /* returns the maximum version supported */ unsigned int i, max = 0x00; @@ -849,7 +849,7 @@ gnutls_protocol_version _gnutls_version_max(gnutls_session session) * Returns a string that contains the name * of the specified TLS version or NULL. **/ -const char *gnutls_protocol_get_name(gnutls_protocol_version version) +const char *gnutls_protocol_get_name(gnutls_protocol_t version) { const char *ret = NULL; @@ -858,7 +858,7 @@ const char *gnutls_protocol_get_name(gnutls_protocol_version version) return ret; } -int _gnutls_version_get_minor(gnutls_protocol_version version) +int _gnutls_version_get_minor(gnutls_protocol_t version) { int ret = -1; @@ -866,7 +866,7 @@ int _gnutls_version_get_minor(gnutls_protocol_version version) return ret; } -gnutls_protocol_version _gnutls_version_get(int major, int minor) +gnutls_protocol_t _gnutls_version_get(int major, int minor) { int ret = -1; @@ -875,7 +875,7 @@ gnutls_protocol_version _gnutls_version_get(int major, int minor) return ret; } -int _gnutls_version_get_major(gnutls_protocol_version version) +int _gnutls_version_get_major(gnutls_protocol_t version) { int ret = -1; @@ -886,8 +886,8 @@ int _gnutls_version_get_major(gnutls_protocol_version version) /* Version Functions */ int -_gnutls_version_is_supported(gnutls_session session, - const gnutls_protocol_version version) +_gnutls_version_is_supported(gnutls_session_t session, + const gnutls_protocol_t version) { int ret = 0; @@ -902,10 +902,10 @@ _gnutls_version_is_supported(gnutls_session session, } /* Type to KX mappings */ -gnutls_kx_algorithm _gnutls_map_kx_get_kx(gnutls_credentials_type type, +gnutls_kx_algorithm_t _gnutls_map_kx_get_kx(gnutls_credentials_type_t type, int server) { - gnutls_kx_algorithm ret = -1; + gnutls_kx_algorithm_t ret = -1; if (server) { GNUTLS_KX_MAP_ALG_LOOP_SERVER(ret = p->algorithm); @@ -915,10 +915,10 @@ gnutls_kx_algorithm _gnutls_map_kx_get_kx(gnutls_credentials_type type, return ret; } -gnutls_credentials_type _gnutls_map_kx_get_cred(gnutls_kx_algorithm +gnutls_credentials_type_t _gnutls_map_kx_get_cred(gnutls_kx_algorithm_t algorithm, int server) { - gnutls_credentials_type ret = -1; + gnutls_credentials_type_t ret = -1; if (server) { GNUTLS_KX_MAP_LOOP(if (p->algorithm == algorithm) ret = p->server_type); @@ -932,7 +932,7 @@ gnutls_credentials_type _gnutls_map_kx_get_cred(gnutls_kx_algorithm /* Cipher Suite's functions */ -gnutls_cipher_algorithm +gnutls_cipher_algorithm_t _gnutls_cipher_suite_get_cipher_algo(const cipher_suite_st * suite) { int ret = 0; @@ -940,7 +940,7 @@ _gnutls_cipher_suite_get_cipher_algo(const cipher_suite_st * suite) return ret; } -gnutls_protocol_version +gnutls_protocol_t _gnutls_cipher_suite_get_version(const cipher_suite_st * suite) { int ret = 0; @@ -948,7 +948,7 @@ _gnutls_cipher_suite_get_version(const cipher_suite_st * suite) return ret; } -gnutls_kx_algorithm _gnutls_cipher_suite_get_kx_algo(const cipher_suite_st +gnutls_kx_algorithm_t _gnutls_cipher_suite_get_kx_algo(const cipher_suite_st * suite) { int ret = 0; @@ -958,7 +958,7 @@ gnutls_kx_algorithm _gnutls_cipher_suite_get_kx_algo(const cipher_suite_st } -gnutls_mac_algorithm +gnutls_mac_algorithm_t _gnutls_cipher_suite_get_mac_algo(const cipher_suite_st * suite) { /* In bytes */ int ret = 0; @@ -990,10 +990,10 @@ const char *_gnutls_cipher_suite_get_name(cipher_suite_st * suite) * by TLS or SSL depending of the protocol in use. * **/ -const char *gnutls_cipher_suite_get_name(gnutls_kx_algorithm kx_algorithm, - gnutls_cipher_algorithm +const char *gnutls_cipher_suite_get_name(gnutls_kx_algorithm_t kx_algorithm, + gnutls_cipher_algorithm_t cipher_algorithm, - gnutls_mac_algorithm + gnutls_mac_algorithm_t mac_algorithm) { const char *ret = NULL; @@ -1027,9 +1027,9 @@ inline static int _gnutls_cipher_suite_is_ok(cipher_suite_st * suite) #define MAX_ELEM_SIZE 4 inline - static int _gnutls_partition(gnutls_session session, void *_base, + static int _gnutls_partition(gnutls_session_t session, void *_base, size_t nmemb, size_t size, - int (*compar) (gnutls_session, + int (*compar) (gnutls_session_t, const void *, const void *)) { @@ -1068,8 +1068,8 @@ inline } static void -_gnutls_qsort(gnutls_session session, void *_base, size_t nmemb, - size_t size, int (*compar) (gnutls_session, const void *, +_gnutls_qsort(gnutls_session_t session, void *_base, size_t nmemb, + size_t size, int (*compar) (gnutls_session_t, const void *, const void *)) { unsigned int pivot; @@ -1099,23 +1099,23 @@ _gnutls_qsort(gnutls_session session, void *_base, size_t nmemb, * For use with qsort */ static int -_gnutls_compare_algo(gnutls_session session, const void *i_A1, +_gnutls_compare_algo(gnutls_session_t session, const void *i_A1, const void *i_A2) { - gnutls_kx_algorithm kA1 = + gnutls_kx_algorithm_t kA1 = _gnutls_cipher_suite_get_kx_algo((const cipher_suite_st *) i_A1); - gnutls_kx_algorithm kA2 = + gnutls_kx_algorithm_t kA2 = _gnutls_cipher_suite_get_kx_algo((const cipher_suite_st *) i_A2); - gnutls_cipher_algorithm cA1 = + gnutls_cipher_algorithm_t cA1 = _gnutls_cipher_suite_get_cipher_algo((const cipher_suite_st *) i_A1); - gnutls_cipher_algorithm cA2 = + gnutls_cipher_algorithm_t cA2 = _gnutls_cipher_suite_get_cipher_algo((const cipher_suite_st *) i_A2); - gnutls_mac_algorithm mA1 = + gnutls_mac_algorithm_t mA1 = _gnutls_cipher_suite_get_mac_algo((const cipher_suite_st *) i_A1); - gnutls_mac_algorithm mA2 = + gnutls_mac_algorithm_t mA2 = _gnutls_cipher_suite_get_mac_algo((const cipher_suite_st *) i_A2); @@ -1138,8 +1138,8 @@ _gnutls_compare_algo(gnutls_session session, const void *i_A1, #ifdef SORT_DEBUG static void -_gnutls_bsort(gnutls_session session, void *_base, size_t nmemb, - size_t size, int (*compar) (gnutls_session, const void *, +_gnutls_bsort(gnutls_session_t session, void *_base, size_t nmemb, + size_t size, int (*compar) (gnutls_session_t, const void *, const void *)) { unsigned int i, j; @@ -1159,7 +1159,7 @@ _gnutls_bsort(gnutls_session session, void *_base, size_t nmemb, #endif int -_gnutls_supported_ciphersuites_sorted(gnutls_session session, +_gnutls_supported_ciphersuites_sorted(gnutls_session_t session, cipher_suite_st ** ciphers) { @@ -1194,7 +1194,7 @@ _gnutls_supported_ciphersuites_sorted(gnutls_session session, } int -_gnutls_supported_ciphersuites(gnutls_session session, +_gnutls_supported_ciphersuites(gnutls_session_t session, cipher_suite_st ** _ciphers) { @@ -1202,7 +1202,7 @@ _gnutls_supported_ciphersuites(gnutls_session session, unsigned int count = CIPHER_SUITES_COUNT; cipher_suite_st *tmp_ciphers; cipher_suite_st *ciphers; - gnutls_protocol_version version; + gnutls_protocol_t version; if (count == 0) { return 0; @@ -1294,7 +1294,7 @@ _gnutls_supported_ciphersuites(gnutls_session session, */ #define SUPPORTED_COMPRESSION_METHODS session->internals.compression_method_priority.algorithms int -_gnutls_supported_compression_methods(gnutls_session session, +_gnutls_supported_compression_methods(gnutls_session_t session, uint8 ** comp) { unsigned int i, j; @@ -1336,7 +1336,7 @@ _gnutls_supported_compression_methods(gnutls_session session, * Returns a string (or NULL) that contains the name * of the specified certificate type. **/ -const char *gnutls_certificate_type_get_name(gnutls_certificate_type type) +const char *gnutls_certificate_type_get_name(gnutls_certificate_type_t type) { const char *ret = NULL; @@ -1348,12 +1348,12 @@ const char *gnutls_certificate_type_get_name(gnutls_certificate_type type) return ret; } -/* returns the gnutls_pk_algorithm which is compatible with - * the given gnutls_kx_algorithm. +/* returns the gnutls_pk_algorithm_t which is compatible with + * the given gnutls_kx_algorithm_t. */ -gnutls_pk_algorithm _gnutls_map_pk_get_pk(gnutls_kx_algorithm kx_algorithm) +gnutls_pk_algorithm_t _gnutls_map_pk_get_pk(gnutls_kx_algorithm_t kx_algorithm) { - gnutls_pk_algorithm ret = -1; + gnutls_pk_algorithm_t ret = -1; GNUTLS_PK_MAP_ALG_LOOP(ret = p->pk_algorithm) return ret; @@ -1364,7 +1364,7 @@ gnutls_pk_algorithm _gnutls_map_pk_get_pk(gnutls_kx_algorithm kx_algorithm) * * ex. GNUTLS_KX_RSA requires a certificate able to encrypt... so returns CIPHER_ENCRYPT. */ -enum encipher_type _gnutls_kx_encipher_type(gnutls_kx_algorithm +enum encipher_type _gnutls_kx_encipher_type(gnutls_kx_algorithm_t kx_algorithm) { int ret = CIPHER_IGN; @@ -1377,7 +1377,7 @@ enum encipher_type _gnutls_kx_encipher_type(gnutls_kx_algorithm */ struct gnutls_sign_entry { const char *name; - gnutls_sign_algorithm id; + gnutls_sign_algorithm_t id; }; typedef struct gnutls_sign_entry gnutls_sign_entry; @@ -1405,7 +1405,7 @@ static const gnutls_sign_entry sign_algorithms[] = { * Returns a string that contains the name * of the specified sign algorithm or NULL. **/ -const char *gnutls_sign_algorithm_get_name(gnutls_sign_algorithm algorithm) +const char *gnutls_sign_algorithm_get_name(gnutls_sign_algorithm_t algorithm) { const char *ret = NULL; @@ -1419,7 +1419,7 @@ const char *gnutls_sign_algorithm_get_name(gnutls_sign_algorithm algorithm) */ struct gnutls_pk_entry { const char *name; - gnutls_pk_algorithm id; + gnutls_pk_algorithm_t id; }; typedef struct gnutls_pk_entry gnutls_pk_entry; @@ -1445,7 +1445,7 @@ static const gnutls_pk_entry pk_algorithms[] = { * Returns a string that contains the name * of the specified public key algorithm or NULL. **/ -const char *gnutls_pk_algorithm_get_name(gnutls_pk_algorithm algorithm) +const char *gnutls_pk_algorithm_get_name(gnutls_pk_algorithm_t algorithm) { const char *ret = NULL; diff --git a/lib/gnutls_algorithms.h b/lib/gnutls_algorithms.h index b43398a10d..409a0e2740 100644 --- a/lib/gnutls_algorithms.h +++ b/lib/gnutls_algorithms.h @@ -22,98 +22,98 @@ /* functions for version */ -gnutls_protocol_version _gnutls_version_lowest(gnutls_session session); -gnutls_protocol_version _gnutls_version_max(gnutls_session session); -int _gnutls_version_priority(gnutls_session session, - gnutls_protocol_version version); -int _gnutls_version_is_supported(gnutls_session session, - const gnutls_protocol_version version); -int _gnutls_version_get_major(gnutls_protocol_version ver); -int _gnutls_version_get_minor(gnutls_protocol_version ver); -gnutls_protocol_version _gnutls_version_get(int major, int minor); +gnutls_protocol_t _gnutls_version_lowest(gnutls_session_t session); +gnutls_protocol_t _gnutls_version_max(gnutls_session_t session); +int _gnutls_version_priority(gnutls_session_t session, + gnutls_protocol_t version); +int _gnutls_version_is_supported(gnutls_session_t session, + const gnutls_protocol_t version); +int _gnutls_version_get_major(gnutls_protocol_t ver); +int _gnutls_version_get_minor(gnutls_protocol_t ver); +gnutls_protocol_t _gnutls_version_get(int major, int minor); /* functions for macs */ -const char *gnutls_mac_get_name(gnutls_mac_algorithm algorithm); -int _gnutls_mac_is_ok(gnutls_mac_algorithm algorithm); -int _gnutls_mac_priority(gnutls_session session, - gnutls_mac_algorithm algorithm); +const char *gnutls_mac_get_name(gnutls_mac_algorithm_t algorithm); +int _gnutls_mac_is_ok(gnutls_mac_algorithm_t algorithm); +int _gnutls_mac_priority(gnutls_session_t session, + gnutls_mac_algorithm_t algorithm); /* functions for cipher suites */ -int _gnutls_supported_ciphersuites(gnutls_session session, +int _gnutls_supported_ciphersuites(gnutls_session_t session, cipher_suite_st ** ciphers); -int _gnutls_supported_ciphersuites_sorted(gnutls_session session, +int _gnutls_supported_ciphersuites_sorted(gnutls_session_t session, cipher_suite_st ** ciphers); -int _gnutls_supported_compression_methods(gnutls_session session, +int _gnutls_supported_compression_methods(gnutls_session_t session, uint8 ** comp); const char *_gnutls_cipher_suite_get_name(cipher_suite_st * algorithm); -gnutls_cipher_algorithm _gnutls_cipher_suite_get_cipher_algo(const +gnutls_cipher_algorithm_t _gnutls_cipher_suite_get_cipher_algo(const cipher_suite_st * algorithm); -gnutls_kx_algorithm _gnutls_cipher_suite_get_kx_algo(const cipher_suite_st +gnutls_kx_algorithm_t _gnutls_cipher_suite_get_kx_algo(const cipher_suite_st * algorithm); -gnutls_mac_algorithm _gnutls_cipher_suite_get_mac_algo(const +gnutls_mac_algorithm_t _gnutls_cipher_suite_get_mac_algo(const cipher_suite_st * algorithm); -gnutls_protocol_version _gnutls_cipher_suite_get_version(const +gnutls_protocol_t _gnutls_cipher_suite_get_version(const cipher_suite_st * algorithm); cipher_suite_st _gnutls_cipher_suite_get_suite_name(cipher_suite_st * algorithm); /* functions for ciphers */ -int _gnutls_cipher_priority(gnutls_session session, - gnutls_cipher_algorithm algorithm); -int _gnutls_cipher_get_block_size(gnutls_cipher_algorithm algorithm); -int _gnutls_cipher_is_block(gnutls_cipher_algorithm algorithm); -int _gnutls_cipher_is_ok(gnutls_cipher_algorithm algorithm); -size_t gnutls_cipher_get_key_size(gnutls_cipher_algorithm algorithm); -int _gnutls_cipher_get_iv_size(gnutls_cipher_algorithm algorithm); -int _gnutls_cipher_get_export_flag(gnutls_cipher_algorithm algorithm); -const char *gnutls_cipher_get_name(gnutls_cipher_algorithm algorithm); +int _gnutls_cipher_priority(gnutls_session_t session, + gnutls_cipher_algorithm_t algorithm); +int _gnutls_cipher_get_block_size(gnutls_cipher_algorithm_t algorithm); +int _gnutls_cipher_is_block(gnutls_cipher_algorithm_t algorithm); +int _gnutls_cipher_is_ok(gnutls_cipher_algorithm_t algorithm); +size_t gnutls_cipher_get_key_size(gnutls_cipher_algorithm_t algorithm); +int _gnutls_cipher_get_iv_size(gnutls_cipher_algorithm_t algorithm); +int _gnutls_cipher_get_export_flag(gnutls_cipher_algorithm_t algorithm); +const char *gnutls_cipher_get_name(gnutls_cipher_algorithm_t algorithm); /* functions for key exchange */ -int _gnutls_kx_priority(gnutls_session session, - gnutls_kx_algorithm algorithm); -int _gnutls_kx_needs_dh_params(gnutls_kx_algorithm algorithm); -int _gnutls_kx_needs_rsa_params(gnutls_kx_algorithm algorithm); +int _gnutls_kx_priority(gnutls_session_t session, + gnutls_kx_algorithm_t algorithm); +int _gnutls_kx_needs_dh_params(gnutls_kx_algorithm_t algorithm); +int _gnutls_kx_needs_rsa_params(gnutls_kx_algorithm_t algorithm); -mod_auth_st *_gnutls_kx_auth_struct(gnutls_kx_algorithm algorithm); -const char *gnutls_kx_get_name(gnutls_kx_algorithm algorithm); -int _gnutls_kx_is_ok(gnutls_kx_algorithm algorithm); +mod_auth_st *_gnutls_kx_auth_struct(gnutls_kx_algorithm_t algorithm); +const char *gnutls_kx_get_name(gnutls_kx_algorithm_t algorithm); +int _gnutls_kx_is_ok(gnutls_kx_algorithm_t algorithm); /* functions for compression */ -int _gnutls_compression_priority(gnutls_session session, - gnutls_compression_method algorithm); -int _gnutls_compression_is_ok(gnutls_compression_method algorithm); -int _gnutls_compression_get_num(gnutls_compression_method algorithm); -gnutls_compression_method _gnutls_compression_get_id(int num); -const char *gnutls_compression_get_name(gnutls_compression_method +int _gnutls_compression_priority(gnutls_session_t session, + gnutls_compression_method_t algorithm); +int _gnutls_compression_is_ok(gnutls_compression_method_t algorithm); +int _gnutls_compression_get_num(gnutls_compression_method_t algorithm); +gnutls_compression_method_t _gnutls_compression_get_id(int num); +const char *gnutls_compression_get_name(gnutls_compression_method_t algorithm); -int _gnutls_compression_get_mem_level(gnutls_compression_method algorithm); -int _gnutls_compression_get_comp_level(gnutls_compression_method +int _gnutls_compression_get_mem_level(gnutls_compression_method_t algorithm); +int _gnutls_compression_get_comp_level(gnutls_compression_method_t algorithm); -int _gnutls_compression_get_wbits(gnutls_compression_method algorithm); +int _gnutls_compression_get_wbits(gnutls_compression_method_t algorithm); /* Type to KX mappings */ -gnutls_kx_algorithm _gnutls_map_kx_get_kx(gnutls_credentials_type type, +gnutls_kx_algorithm_t _gnutls_map_kx_get_kx(gnutls_credentials_type_t type, int server); -gnutls_credentials_type _gnutls_map_kx_get_cred(gnutls_kx_algorithm +gnutls_credentials_type_t _gnutls_map_kx_get_cred(gnutls_kx_algorithm_t algorithm, int server); /* KX to PK mapping */ -gnutls_pk_algorithm _gnutls_map_pk_get_pk(gnutls_kx_algorithm +gnutls_pk_algorithm_t _gnutls_map_pk_get_pk(gnutls_kx_algorithm_t kx_algorithm); enum encipher_type { CIPHER_ENCRYPT = 0, CIPHER_SIGN = 1, CIPHER_IGN }; -enum encipher_type _gnutls_kx_encipher_type(gnutls_kx_algorithm algorithm); +enum encipher_type _gnutls_kx_encipher_type(gnutls_kx_algorithm_t algorithm); struct gnutls_kx_algo_entry { const char *name; - gnutls_kx_algorithm algorithm; + gnutls_kx_algorithm_t algorithm; mod_auth_st *auth_struct; int needs_dh_params; int needs_rsa_params; @@ -122,7 +122,7 @@ typedef struct gnutls_kx_algo_entry gnutls_kx_algo_entry; struct gnutls_compression_entry { const char *name; - gnutls_compression_method id; + gnutls_compression_method_t id; int num; /* the number reserved in TLS for the specific compression method */ /* used in zlib compressor */ diff --git a/lib/gnutls_anon_cred.c b/lib/gnutls_anon_cred.c index 55e088c06e..c2ac568ed4 100644 --- a/lib/gnutls_anon_cred.c +++ b/lib/gnutls_anon_cred.c @@ -34,13 +34,13 @@ static const int anon_dummy; /** - * gnutls_anon_free_server_credentials - Used to free an allocated gnutls_anon_server_credentials structure - * @sc: is an &gnutls_anon_server_credentials structure. + * gnutls_anon_free_server_credentials - Used to free an allocated gnutls_anon_server_credentials_t structure + * @sc: is an &gnutls_anon_server_credentials_t structure. * * This structure is complex enough to manipulate directly thus * this helper function is provided in order to free (deallocate) it. **/ -void gnutls_anon_free_server_credentials(gnutls_anon_server_credentials sc) +void gnutls_anon_free_server_credentials(gnutls_anon_server_credentials_t sc) { gnutls_free(sc); @@ -48,14 +48,14 @@ void gnutls_anon_free_server_credentials(gnutls_anon_server_credentials sc) /*- * _gnutls_anon_get_dh_params - Returns the DH parameters pointer - * @sc: is an &gnutls_certificate_credentials structure. + * @sc: is an &gnutls_certificate_credentials_t structure. * * This function will return the dh parameters pointer. * -*/ -gnutls_dh_params _gnutls_anon_get_dh_params(const - gnutls_anon_server_credentials - sc, gnutls_session session) +gnutls_dh_params_t _gnutls_anon_get_dh_params(const + gnutls_anon_server_credentials_t + sc, gnutls_session_t session) { gnutls_params_st params; int ret; @@ -77,13 +77,13 @@ gnutls_dh_params _gnutls_anon_get_dh_params(const } /** - * gnutls_anon_allocate_server_credentials - Used to allocate an gnutls_anon_server_credentials structure - * @sc: is a pointer to an &gnutls_anon_server_credentials structure. + * gnutls_anon_allocate_server_credentials - Used to allocate an gnutls_anon_server_credentials_t structure + * @sc: is a pointer to an &gnutls_anon_server_credentials_t structure. * * This structure is complex enough to manipulate directly thus * this helper function is provided in order to allocate it. **/ -int gnutls_anon_allocate_server_credentials(gnutls_anon_server_credentials +int gnutls_anon_allocate_server_credentials(gnutls_anon_server_credentials_t * sc) { @@ -94,24 +94,24 @@ int gnutls_anon_allocate_server_credentials(gnutls_anon_server_credentials /** - * gnutls_anon_free_client_credentials - Used to free an allocated gnutls_anon_client_credentials structure - * @sc: is an &gnutls_anon_client_credentials structure. + * gnutls_anon_free_client_credentials - Used to free an allocated gnutls_anon_client_credentials_t structure + * @sc: is an &gnutls_anon_client_credentials_t structure. * * This structure is complex enough to manipulate directly thus * this helper function is provided in order to free (deallocate) it. **/ -void gnutls_anon_free_client_credentials(gnutls_anon_client_credentials sc) +void gnutls_anon_free_client_credentials(gnutls_anon_client_credentials_t sc) { } /** * gnutls_allocate_anon_client_credentials - Used to allocate a credentials structure - * @sc: is a pointer to an &gnutls_anon_client_credentials structure. + * @sc: is a pointer to an &gnutls_anon_client_credentials_t structure. * * This structure is complex enough to manipulate directly thus * this helper function is provided in order to allocate it. **/ -int gnutls_anon_allocate_client_credentials(gnutls_anon_client_credentials +int gnutls_anon_allocate_client_credentials(gnutls_anon_client_credentials_t * sc) { /* anon_dummy is only there for *sc not to be null. diff --git a/lib/gnutls_auth.c b/lib/gnutls_auth.c index 1819a6ab76..c4b547a4a8 100644 --- a/lib/gnutls_auth.c +++ b/lib/gnutls_auth.c @@ -36,12 +36,12 @@ /** * gnutls_credentials_clear - Clears all the credentials previously set - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Clears all the credentials previously set in this session. * **/ -void gnutls_credentials_clear(gnutls_session session) +void gnutls_credentials_clear(gnutls_session_t session) { if (session->key && session->key->cred) { /* beginning of the list */ auth_cred_st *ccred, *ncred; @@ -61,7 +61,7 @@ void gnutls_credentials_clear(gnutls_session session) */ /** * gnutls_credentials_set - Sets the needed credentials for the specified authentication algorithm. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @type: is the type of the credentials * @cred: is a pointer to a structure. * @@ -74,18 +74,18 @@ void gnutls_credentials_clear(gnutls_session session) * structure. Thus you will have to keep the structure allocated until * you call gnutls_deinit(). ] * - * For GNUTLS_CRD_ANON cred should be gnutls_anon_client_credentials in case of a client. - * In case of a server it should be gnutls_anon_server_credentials. + * For GNUTLS_CRD_ANON cred should be gnutls_anon_client_credentials_t in case of a client. + * In case of a server it should be gnutls_anon_server_credentials_t. * - * For GNUTLS_CRD_SRP cred should be gnutls_srp_client_credentials - * in case of a client, and gnutls_srp_server_credentials, in case + * For GNUTLS_CRD_SRP cred should be gnutls_srp_client_credentials_t + * in case of a client, and gnutls_srp_server_credentials_t, in case * of a server. * - * For GNUTLS_CRD_CERTIFICATE cred should be gnutls_certificate_credentials. + * For GNUTLS_CRD_CERTIFICATE cred should be gnutls_certificate_credentials_t. * **/ -int gnutls_credentials_set(gnutls_session session, - gnutls_credentials_type type, void *cred) +int gnutls_credentials_set(gnutls_session_t session, + gnutls_credentials_type_t type, void *cred) { auth_cred_st *ccred = NULL, *pcred = NULL; int exists = 0; @@ -137,7 +137,7 @@ int gnutls_credentials_set(gnutls_session session, /** * gnutls_auth_get_type - Returns the type of credentials for the current authentication schema. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns type of credentials for the current authentication schema. * The returned information is to be used to distinguish the function used @@ -146,7 +146,7 @@ int gnutls_credentials_set(gnutls_session session, * Eg. for CERTIFICATE ciphersuites (key exchange algorithms: KX_RSA, KX_DHE_RSA), * the same function are to be used to access the authentication data. **/ -gnutls_credentials_type gnutls_auth_get_type(gnutls_session session) +gnutls_credentials_type_t gnutls_auth_get_type(gnutls_session_t session) { /* This is not the credentials we must set, but the authentication data * we get by the peer, so it should be reversed. @@ -162,14 +162,14 @@ gnutls_credentials_type gnutls_auth_get_type(gnutls_session session) /** * gnutls_auth_server_get_type - Returns the type of credentials for the server authentication schema. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the type of credentials that were used for server authentication. * The returned information is to be used to distinguish the function used * to access authentication data. * **/ -gnutls_credentials_type gnutls_auth_server_get_type(gnutls_session session) +gnutls_credentials_type_t gnutls_auth_server_get_type(gnutls_session_t session) { return _gnutls_map_kx_get_cred(_gnutls_cipher_suite_get_kx_algo @@ -179,14 +179,14 @@ gnutls_credentials_type gnutls_auth_server_get_type(gnutls_session session) /** * gnutls_auth_client_get_type - Returns the type of credentials for the client authentication schema. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the type of credentials that were used for client authentication. * The returned information is to be used to distinguish the function used * to access authentication data. * **/ -gnutls_credentials_type gnutls_auth_client_get_type(gnutls_session session) +gnutls_credentials_type_t gnutls_auth_client_get_type(gnutls_session_t session) { return _gnutls_map_kx_get_cred(_gnutls_cipher_suite_get_kx_algo @@ -199,8 +199,8 @@ gnutls_credentials_type gnutls_auth_client_get_type(gnutls_session session) * This returns a pointer to the linked list. Don't * free that!!! */ -const void *_gnutls_get_kx_cred(gnutls_session session, - gnutls_kx_algorithm algo, int *err) +const void *_gnutls_get_kx_cred(gnutls_session_t session, + gnutls_kx_algorithm_t algo, int *err) { int server = session->security_parameters.entity == GNUTLS_SERVER ? 1 : 0; @@ -210,7 +210,7 @@ const void *_gnutls_get_kx_cred(gnutls_session session, } const void *_gnutls_get_cred(gnutls_key_st key, - gnutls_credentials_type type, int *err) + gnutls_credentials_type_t type, int *err) { const void *retval = NULL; int _err = -1; @@ -240,7 +240,7 @@ const void *_gnutls_get_cred(gnutls_key_st key, /*- * _gnutls_get_auth_info - Returns a pointer to authentication information. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function must be called after a succesful gnutls_handshake(). * Returns a pointer to authentication information. That information @@ -251,20 +251,20 @@ const void *_gnutls_get_cred(gnutls_key_st key, * In case of GNUTLS_CRD_CERTIFICATE returns a type of &cert_auth_info_t; * In case of GNUTLS_CRD_SRP returns a type of &srp_(server/client)_auth_info_t; -*/ -void *_gnutls_get_auth_info(gnutls_session session) +void *_gnutls_get_auth_info(gnutls_session_t session) { return session->key->auth_info; } /*- * _gnutls_free_auth_info - Frees the auth info structure - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function frees the auth info structure and sets it to * null. It must be called since some structures contain malloced * elements. -*/ -void _gnutls_free_auth_info(gnutls_session session) +void _gnutls_free_auth_info(gnutls_session_t session) { if (session == NULL || session->key == NULL) { gnutls_assert(); @@ -310,8 +310,8 @@ void _gnutls_free_auth_info(gnutls_session session) * If allow change is !=0 then this will allow changing the auth * info structure to a different type. */ -int _gnutls_auth_info_set(gnutls_session session, - gnutls_credentials_type type, int size, +int _gnutls_auth_info_set(gnutls_session_t session, + gnutls_credentials_type_t type, int size, int allow_change) { if (session->key->auth_info == NULL) { diff --git a/lib/gnutls_auth.h b/lib/gnutls_auth.h index 1012ad0b0d..28ac50a9dd 100644 --- a/lib/gnutls_auth.h +++ b/lib/gnutls_auth.h @@ -3,24 +3,19 @@ typedef struct mod_auth_st_int { const char *name; /* null terminated */ - int (*gnutls_generate_server_certificate) (gnutls_session, opaque **); - int (*gnutls_generate_client_certificate) (gnutls_session, opaque **); - int (*gnutls_generate_server_kx) (gnutls_session, opaque **); - int (*gnutls_generate_client_kx) (gnutls_session, opaque **); /* used in SRP */ - int (*gnutls_generate_client_cert_vrfy) (gnutls_session, opaque **); - int (*gnutls_generate_server_certificate_request) (gnutls_session, - opaque **); + int (*gnutls_generate_server_certificate) (gnutls_session_t, opaque **); + int (*gnutls_generate_client_certificate) (gnutls_session_t, opaque **); + int (*gnutls_generate_server_kx) (gnutls_session_t, opaque **); + int (*gnutls_generate_client_kx) (gnutls_session_t, opaque **); /* used in SRP */ + int (*gnutls_generate_client_cert_vrfy) (gnutls_session_t, opaque **); + int (*gnutls_generate_server_certificate_request) (gnutls_session_t, opaque **); - int (*gnutls_process_server_certificate) (gnutls_session, opaque *, - size_t); - int (*gnutls_process_client_certificate) (gnutls_session, opaque *, - size_t); - int (*gnutls_process_server_kx) (gnutls_session, opaque *, size_t); - int (*gnutls_process_client_kx) (gnutls_session, opaque *, size_t); - int (*gnutls_process_client_cert_vrfy) (gnutls_session, opaque *, - size_t); - int (*gnutls_process_server_certificate_request) (gnutls_session, - opaque *, size_t); + int (*gnutls_process_server_certificate) (gnutls_session_t, opaque *, size_t); + int (*gnutls_process_client_certificate) (gnutls_session_t, opaque *, size_t); + int (*gnutls_process_server_kx) (gnutls_session_t, opaque *, size_t); + int (*gnutls_process_client_kx) (gnutls_session_t, opaque *, size_t); + int (*gnutls_process_client_cert_vrfy) (gnutls_session_t, opaque *, size_t); + int (*gnutls_process_server_certificate_request) (gnutls_session_t, opaque *, size_t); } mod_auth_st; #endif diff --git a/lib/gnutls_auth_int.h b/lib/gnutls_auth_int.h index e0de2f440a..d4e690d6a7 100644 --- a/lib/gnutls_auth_int.h +++ b/lib/gnutls_auth_int.h @@ -1,13 +1,13 @@ -void gnutls_credentials_clear(gnutls_session session); -int gnutls_credentials_set(gnutls_session session, - gnutls_credentials_type type, void *cred); -const void *_gnutls_get_cred(gnutls_key_st key, gnutls_credentials_type kx, +void gnutls_credentials_clear(gnutls_session_t session); +int gnutls_credentials_set(gnutls_session_t session, + gnutls_credentials_type_t type, void *cred); +const void *_gnutls_get_cred(gnutls_key_st key, gnutls_credentials_type_t kx, int *err); -const void *_gnutls_get_kx_cred(gnutls_session session, - gnutls_kx_algorithm algo, int *err); +const void *_gnutls_get_kx_cred(gnutls_session_t session, + gnutls_kx_algorithm_t algo, int *err); int _gnutls_generate_session_key(gnutls_key_st key); -gnutls_credentials_type gnutls_auth_get_type(gnutls_session session); -void *_gnutls_get_auth_info(gnutls_session session); -int _gnutls_auth_info_set(gnutls_session session, - gnutls_credentials_type type, int size, +gnutls_credentials_type_t gnutls_auth_get_type(gnutls_session_t session); +void *_gnutls_get_auth_info(gnutls_session_t session); +int _gnutls_auth_info_set(gnutls_session_t session, + gnutls_credentials_type_t type, int size, int allow_change); diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c index 13fb79035f..ec48505118 100644 --- a/lib/gnutls_buffers.c +++ b/lib/gnutls_buffers.c @@ -77,7 +77,7 @@ inline static int RET(int err) /* Buffers received packets of type APPLICATION DATA and * HANDSHAKE DATA. */ -int _gnutls_record_buffer_put(content_type_t type, gnutls_session session, +int _gnutls_record_buffer_put(content_type_t type, gnutls_session_t session, opaque * data, size_t length) { if (length == 0) @@ -118,7 +118,7 @@ int _gnutls_record_buffer_put(content_type_t type, gnutls_session session, } int _gnutls_record_buffer_get_size(content_type_t type, - gnutls_session session) + gnutls_session_t session) { switch (type) { case GNUTLS_APPLICATION_DATA: @@ -134,7 +134,7 @@ int _gnutls_record_buffer_get_size(content_type_t type, /** * gnutls_record_check_pending - checks if there are any data to receive in gnutls buffers. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function checks if there are any data to receive * in the gnutls buffers. Returns the size of that data or 0. @@ -143,13 +143,13 @@ int _gnutls_record_buffer_get_size(content_type_t type, * (gnutls leaves some data in the tcp buffer in order for select * to work). **/ -size_t gnutls_record_check_pending(gnutls_session session) +size_t gnutls_record_check_pending(gnutls_session_t session) { return _gnutls_record_buffer_get_size(GNUTLS_APPLICATION_DATA, session); } -int _gnutls_record_buffer_get(content_type_t type, gnutls_session session, +int _gnutls_record_buffer_get(content_type_t type, gnutls_session_t session, opaque * data, size_t length) { if (length == 0 || data == NULL) { @@ -215,14 +215,14 @@ int _gnutls_record_buffer_get(content_type_t type, gnutls_session session, * * Flags are only used if the default recv() function is being used. */ -static ssize_t _gnutls_read(gnutls_session session, void *iptr, +static ssize_t _gnutls_read(gnutls_session_t session, void *iptr, size_t sizeOfPtr, int flags) { size_t left; ssize_t i = 0; char *ptr = iptr; uint j, x, sum = 0; - gnutls_transport_ptr fd = session->internals.transport_recv_ptr; + gnutls_transport_ptr_t fd = session->internals.transport_recv_ptr; session->internals.direction = 0; @@ -302,7 +302,7 @@ static ssize_t _gnutls_read(gnutls_session session, void *iptr, /* This function is only used with berkeley style sockets. * Clears the peeked data (read with MSG_PEEK). */ -int _gnutls_io_clear_peeked_data(gnutls_session session) +int _gnutls_io_clear_peeked_data(gnutls_session_t session) { char *peekdata; int ret, sum; @@ -338,7 +338,7 @@ int _gnutls_io_clear_peeked_data(gnutls_session session) } -void _gnutls_io_clear_read_buffer(gnutls_session session) +void _gnutls_io_clear_read_buffer(gnutls_session_t session) { session->internals.record_recv_buffer.length = 0; } @@ -352,7 +352,7 @@ void _gnutls_io_clear_read_buffer(gnutls_session session) * which are stored in a local (in the session) buffer. A pointer (iptr) to this buffer is returned. * */ -ssize_t _gnutls_io_read_buffered(gnutls_session session, opaque ** iptr, +ssize_t _gnutls_io_read_buffered(gnutls_session_t session, opaque ** iptr, size_t sizeOfPtr, content_type_t recv_type) { @@ -577,7 +577,7 @@ inline * to decrypt and verify the integrity. * */ -ssize_t _gnutls_io_write_buffered(gnutls_session session, const void *iptr, +ssize_t _gnutls_io_write_buffered(gnutls_session_t session, const void *iptr, size_t n) { size_t left; @@ -585,7 +585,7 @@ ssize_t _gnutls_io_write_buffered(gnutls_session session, const void *iptr, ssize_t retval, i; const opaque *ptr; int ret; - gnutls_transport_ptr fd = session->internals.transport_send_ptr; + gnutls_transport_ptr_t fd = session->internals.transport_send_ptr; /* to know where the procedure was interrupted. */ @@ -701,7 +701,7 @@ ssize_t _gnutls_io_write_buffered(gnutls_session session, const void *iptr, /* This is exactly like write_buffered, but will use two buffers to read * from. */ -ssize_t _gnutls_io_write_buffered2(gnutls_session session, +ssize_t _gnutls_io_write_buffered2(gnutls_session_t session, const void *iptr, size_t n, const void *iptr2, size_t n2) { @@ -733,7 +733,7 @@ ssize_t _gnutls_io_write_buffered2(gnutls_session session, * TLS write buffer (ie. because the previous write was * interrupted. */ -ssize_t _gnutls_io_write_flush(gnutls_session session) +ssize_t _gnutls_io_write_flush(gnutls_session_t session) { ssize_t ret; @@ -751,7 +751,7 @@ ssize_t _gnutls_io_write_flush(gnutls_session session) * Handshake write buffer (ie. because the previous write was * interrupted. */ -ssize_t _gnutls_handshake_io_write_flush(gnutls_session session) +ssize_t _gnutls_handshake_io_write_flush(gnutls_session_t session) { ssize_t ret; ret = _gnutls_handshake_io_send_int(session, 0, 0, NULL, 0); @@ -774,9 +774,9 @@ ssize_t _gnutls_handshake_io_write_flush(gnutls_session session) /* This is a send function for the gnutls handshake * protocol. Just makes sure that all data have been sent. */ -ssize_t _gnutls_handshake_io_send_int(gnutls_session session, +ssize_t _gnutls_handshake_io_send_int(gnutls_session_t session, content_type_t type, - HandshakeType htype, + handshake_t htype, const void *iptr, size_t n) { size_t left; @@ -892,9 +892,9 @@ ssize_t _gnutls_handshake_io_send_int(gnutls_session session, /* This is a receive function for the gnutls handshake * protocol. Makes sure that we have received all data. */ -ssize_t _gnutls_handshake_io_recv_int(gnutls_session session, +ssize_t _gnutls_handshake_io_recv_int(gnutls_session_t session, content_type_t type, - HandshakeType htype, void *iptr, + handshake_t htype, void *iptr, size_t sizeOfPtr) { size_t left; @@ -988,7 +988,7 @@ ssize_t _gnutls_handshake_io_recv_int(gnutls_session session, * for finished messages to use them. Used in HMAC calculation * and finished messages. */ -int _gnutls_handshake_buffer_put(gnutls_session session, opaque * data, +int _gnutls_handshake_buffer_put(gnutls_session_t session, opaque * data, size_t length) { @@ -1013,7 +1013,7 @@ int _gnutls_handshake_buffer_put(gnutls_session session, opaque * data, return 0; } -int _gnutls_handshake_buffer_get_size(gnutls_session session) +int _gnutls_handshake_buffer_get_size(gnutls_session_t session) { return session->internals.handshake_hash_buffer.length; @@ -1022,7 +1022,7 @@ int _gnutls_handshake_buffer_get_size(gnutls_session session) /* this function does not touch the buffer * and returns data from it (peek mode!) */ -int _gnutls_handshake_buffer_peek(gnutls_session session, opaque * data, +int _gnutls_handshake_buffer_peek(gnutls_session_t session, opaque * data, size_t length) { if (length > session->internals.handshake_hash_buffer.length) { @@ -1038,7 +1038,7 @@ int _gnutls_handshake_buffer_peek(gnutls_session session, opaque * data, /* this function does not touch the buffer * and returns data from it (peek mode!) */ -int _gnutls_handshake_buffer_get_ptr(gnutls_session session, +int _gnutls_handshake_buffer_get_ptr(gnutls_session_t session, opaque ** data_ptr, size_t * length) { if (length != NULL) @@ -1054,7 +1054,7 @@ int _gnutls_handshake_buffer_get_ptr(gnutls_session session, /* Does not free the buffer */ -int _gnutls_handshake_buffer_empty(gnutls_session session) +int _gnutls_handshake_buffer_empty(gnutls_session_t session) { _gnutls_buffers_log("BUF[HSK]: Emptied buffer\n"); @@ -1065,7 +1065,7 @@ int _gnutls_handshake_buffer_empty(gnutls_session session) } -int _gnutls_handshake_buffer_clear(gnutls_session session) +int _gnutls_handshake_buffer_clear(gnutls_session_t session) { _gnutls_buffers_log("BUF[HSK]: Cleared Data from buffer\n"); diff --git a/lib/gnutls_buffers.h b/lib/gnutls_buffers.h index b858d10860..c73a225c02 100644 --- a/lib/gnutls_buffers.h +++ b/lib/gnutls_buffers.h @@ -18,30 +18,30 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -int _gnutls_record_buffer_put(content_type_t type, gnutls_session session, +int _gnutls_record_buffer_put(content_type_t type, gnutls_session_t session, opaque * data, size_t length); int _gnutls_record_buffer_get_size(content_type_t type, - gnutls_session session); -int _gnutls_record_buffer_get(content_type_t type, gnutls_session session, + gnutls_session_t session); +int _gnutls_record_buffer_get(content_type_t type, gnutls_session_t session, opaque * data, size_t length); -ssize_t _gnutls_io_read_buffered(gnutls_session, opaque ** iptr, size_t n, +ssize_t _gnutls_io_read_buffered(gnutls_session_t, opaque ** iptr, size_t n, content_type_t); -void _gnutls_io_clear_read_buffer(gnutls_session); -int _gnutls_io_clear_peeked_data(gnutls_session session); +void _gnutls_io_clear_read_buffer(gnutls_session_t); +int _gnutls_io_clear_peeked_data(gnutls_session_t session); -ssize_t _gnutls_io_write_buffered(gnutls_session, const void *iptr, +ssize_t _gnutls_io_write_buffered(gnutls_session_t, const void *iptr, size_t n); -ssize_t _gnutls_io_write_buffered2(gnutls_session, const void *iptr, +ssize_t _gnutls_io_write_buffered2(gnutls_session_t, const void *iptr, size_t n, const void *iptr2, size_t n2); -int _gnutls_handshake_buffer_get_size(gnutls_session session); -int _gnutls_handshake_buffer_peek(gnutls_session session, opaque * data, +int _gnutls_handshake_buffer_get_size(gnutls_session_t session); +int _gnutls_handshake_buffer_peek(gnutls_session_t session, opaque * data, size_t length); -int _gnutls_handshake_buffer_put(gnutls_session session, opaque * data, +int _gnutls_handshake_buffer_put(gnutls_session_t session, opaque * data, size_t length); -int _gnutls_handshake_buffer_clear(gnutls_session session); -int _gnutls_handshake_buffer_empty(gnutls_session session); -int _gnutls_handshake_buffer_get_ptr(gnutls_session session, +int _gnutls_handshake_buffer_clear(gnutls_session_t session); +int _gnutls_handshake_buffer_empty(gnutls_session_t session); +int _gnutls_handshake_buffer_get_ptr(gnutls_session_t session, opaque ** data_ptr, size_t * length); #define _gnutls_handshake_io_buffer_clear( session) \ @@ -49,11 +49,11 @@ int _gnutls_handshake_buffer_get_ptr(gnutls_session session, _gnutls_buffer_clear( &session->internals.handshake_recv_buffer); \ session->internals.handshake_send_buffer_prev_size = 0 -ssize_t _gnutls_handshake_io_recv_int(gnutls_session, content_type_t, - HandshakeType, void *, size_t); -ssize_t _gnutls_handshake_io_send_int(gnutls_session, content_type_t, - HandshakeType, const void *, size_t); -ssize_t _gnutls_io_write_flush(gnutls_session session); -ssize_t _gnutls_handshake_io_write_flush(gnutls_session session); +ssize_t _gnutls_handshake_io_recv_int(gnutls_session_t, content_type_t, + handshake_t, void *, size_t); +ssize_t _gnutls_handshake_io_send_int(gnutls_session_t, content_type_t, + handshake_t, const void *, size_t); +ssize_t _gnutls_io_write_flush(gnutls_session_t session); +ssize_t _gnutls_handshake_io_write_flush(gnutls_session_t session); -size_t gnutls_record_check_pending(gnutls_session session); +size_t gnutls_record_check_pending(gnutls_session_t session); diff --git a/lib/gnutls_cert.c b/lib/gnutls_cert.c index b2a9a942fe..a6bd211d9c 100644 --- a/lib/gnutls_cert.c +++ b/lib/gnutls_cert.c @@ -43,18 +43,18 @@ #include "x509/x509.h" #include "x509/mpi.h" -void gnutls_certificate_free_crls(gnutls_certificate_credentials sc); +void gnutls_certificate_free_crls(gnutls_certificate_credentials_t sc); /** - * gnutls_certificate_free_keys - Used to free all the keys from a gnutls_certificate_credentials structure - * @sc: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_free_keys - Used to free all the keys from a gnutls_certificate_credentials_t structure + * @sc: is an &gnutls_certificate_credentials_t structure. * * This function will delete all the keys and the certificates associated * with the given credentials. This function must not be called when a * TLS negotiation that uses the credentials is in progress. * **/ -void gnutls_certificate_free_keys(gnutls_certificate_credentials sc) +void gnutls_certificate_free_keys(gnutls_certificate_credentials_t sc) { uint i, j; @@ -83,8 +83,8 @@ void gnutls_certificate_free_keys(gnutls_certificate_credentials sc) } /** - * gnutls_certificate_free_cas - Used to free all the CAs from a gnutls_certificate_credentials structure - * @sc: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_free_cas - Used to free all the CAs from a gnutls_certificate_credentials_t structure + * @sc: is an &gnutls_certificate_credentials_t structure. * * This function will delete all the CAs associated * with the given credentials. Servers that do not use @@ -92,7 +92,7 @@ void gnutls_certificate_free_keys(gnutls_certificate_credentials sc) * save some memory. * **/ -void gnutls_certificate_free_cas(gnutls_certificate_credentials sc) +void gnutls_certificate_free_cas(gnutls_certificate_credentials_t sc) { uint j; @@ -108,8 +108,8 @@ void gnutls_certificate_free_cas(gnutls_certificate_credentials sc) } /** - * gnutls_certificate_free_ca_names - Used to free all the CA names from a gnutls_certificate_credentials structure - * @sc: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_free_ca_names - Used to free all the CA names from a gnutls_certificate_credentials_t structure + * @sc: is an &gnutls_certificate_credentials_t structure. * * This function will delete all the CA name in the * given credentials. Clients may call this to save some memory @@ -119,24 +119,24 @@ void gnutls_certificate_free_cas(gnutls_certificate_credentials sc) * support to clients. * **/ -void gnutls_certificate_free_ca_names(gnutls_certificate_credentials sc) +void gnutls_certificate_free_ca_names(gnutls_certificate_credentials_t sc) { _gnutls_free_datum(&sc->x509_rdn_sequence); } /*- * _gnutls_certificate_get_dh_params - Returns the DH parameters pointer - * @sc: is an &gnutls_certificate_credentials structure. + * @sc: is an &gnutls_certificate_credentials_t structure. * * This function will return the dh parameters pointer. This will read the * credentials structure, and cache the output to the session, so later * calls would not examine the credentials (or call a callback). * -*/ -gnutls_dh_params _gnutls_certificate_get_dh_params(const - gnutls_certificate_credentials +gnutls_dh_params_t _gnutls_certificate_get_dh_params(const + gnutls_certificate_credentials_t sc, - gnutls_session session) + gnutls_session_t session) { gnutls_params_st params; int ret; @@ -160,16 +160,13 @@ gnutls_dh_params _gnutls_certificate_get_dh_params(const /*- * _gnutls_certificate_get_rsa_params - Returns the RSA parameters pointer - * @sc: is an &gnutls_certificate_credentials structure. + * @sc: is an &gnutls_certificate_credentials_t structure. * * This function will return the rsa parameters pointer. * -*/ -gnutls_rsa_params _gnutls_certificate_get_rsa_params(const - gnutls_certificate_credentials - sc, - gnutls_session - session) +gnutls_rsa_params_t _gnutls_certificate_get_rsa_params(const + gnutls_certificate_credentials_t sc, gnutls_session_t session) { gnutls_params_st params; int ret; @@ -194,8 +191,8 @@ gnutls_rsa_params _gnutls_certificate_get_rsa_params(const /** - * gnutls_certificate_free_credentials - Used to free an allocated gnutls_certificate_credentials structure - * @sc: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_free_credentials - Used to free an allocated gnutls_certificate_credentials_t structure + * @sc: is an &gnutls_certificate_credentials_t structure. * * This structure is complex enough to manipulate directly thus * this helper function is provided in order to free (deallocate) it. @@ -204,7 +201,7 @@ gnutls_rsa_params _gnutls_certificate_get_rsa_params(const * with this structure (ie RSA and DH parameters are not freed by * this function). **/ -void gnutls_certificate_free_credentials(gnutls_certificate_credentials sc) +void gnutls_certificate_free_credentials(gnutls_certificate_credentials_t sc) { gnutls_certificate_free_keys(sc); gnutls_certificate_free_cas(sc); @@ -219,15 +216,15 @@ void gnutls_certificate_free_credentials(gnutls_certificate_credentials sc) /** - * gnutls_certificate_allocate_credentials - Used to allocate a gnutls_certificate_credentials structure - * @res: is a pointer to an &gnutls_certificate_credentials structure. + * gnutls_certificate_allocate_credentials - Used to allocate a gnutls_certificate_credentials_t structure + * @res: is a pointer to an &gnutls_certificate_credentials_t structure. * * This structure is complex enough to manipulate directly thus * this helper function is provided in order to allocate it. * * Returns 0 on success. **/ -int gnutls_certificate_allocate_credentials(gnutls_certificate_credentials +int gnutls_certificate_allocate_credentials(gnutls_certificate_credentials_t * res) { *res = gnutls_calloc(1, sizeof(certificate_credentials_st)); @@ -245,13 +242,13 @@ int gnutls_certificate_allocate_credentials(gnutls_certificate_credentials * This function also uses the KeyUsage field of the certificate * extensions in order to disable unneded algorithms. */ -int _gnutls_selected_cert_supported_kx(gnutls_session session, - gnutls_kx_algorithm ** alg, +int _gnutls_selected_cert_supported_kx(gnutls_session_t session, + gnutls_kx_algorithm_t ** alg, int *alg_size) { - gnutls_kx_algorithm kx; - gnutls_pk_algorithm pk; - gnutls_kx_algorithm kxlist[MAX_ALGOS]; + gnutls_kx_algorithm_t kx; + gnutls_pk_algorithm_t pk; + gnutls_kx_algorithm_t kxlist[MAX_ALGOS]; gnutls_cert *cert; int i; @@ -280,13 +277,13 @@ int _gnutls_selected_cert_supported_kx(gnutls_session session, return GNUTLS_E_INVALID_REQUEST; } - *alg = gnutls_calloc(1, sizeof(gnutls_kx_algorithm) * i); + *alg = gnutls_calloc(1, sizeof(gnutls_kx_algorithm_t) * i); if (*alg == NULL) return GNUTLS_E_MEMORY_ERROR; *alg_size = i; - memcpy(*alg, kxlist, i * sizeof(gnutls_kx_algorithm)); + memcpy(*alg, kxlist, i * sizeof(gnutls_kx_algorithm_t)); return 0; } @@ -294,7 +291,7 @@ int _gnutls_selected_cert_supported_kx(gnutls_session session, /** * gnutls_certificate_server_set_request - Used to set whether to request a client certificate - * @session: is an &gnutls_session structure. + * @session: is an &gnutls_session_t structure. * @req: is one of GNUTLS_CERT_REQUEST, GNUTLS_CERT_REQUIRE * * This function specifies if we (in case of a server) are going @@ -304,22 +301,22 @@ int _gnutls_selected_cert_supported_kx(gnutls_session session, * call this function then the client will not be asked to * send a certificate. **/ -void gnutls_certificate_server_set_request(gnutls_session session, - gnutls_certificate_request req) +void gnutls_certificate_server_set_request(gnutls_session_t session, + gnutls_certificate_request_t req) { session->internals.send_cert_req = req; } /** * gnutls_certificate_client_set_retrieve_function - Used to set a callback to retrieve the certificate - * @cred: is a &gnutls_certificate_credentials structure. + * @cred: is a &gnutls_certificate_credentials_t structure. * @func: is the callback function * * This function sets a callback to be called in order to retrieve the certificate * to be used in the handshake. * The callback's function prototype is: - * int (*callback)(gnutls_session, const gnutls_datum* req_ca_dn, int nreqs, - * gnutls_pk_algorithm* pk_algos, int pk_algos_length, gnutls_retr_st st); + * int (*callback)(gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs, + * gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_retr_st st); * * @st should contain the certificates and private keys. * @@ -341,21 +338,21 @@ void gnutls_certificate_server_set_request(gnutls_session session, * will be terminated. **/ void gnutls_certificate_client_set_retrieve_function - (gnutls_certificate_credentials cred, + (gnutls_certificate_credentials_t cred, gnutls_certificate_client_retrieve_function * func) { cred->client_get_cert_callback = func; } /** * gnutls_certificate_server_set_retrieve_function - Used to set a callback to retrieve the certificate - * @cred: is a &gnutls_certificate_credentials structure. + * @cred: is a &gnutls_certificate_credentials_t structure. * @func: is the callback function * * This function sets a callback to be called in order to retrieve the certificate * to be used in the handshake. * The callback's function prototype is: - * int (*callback)(gnutls_session, const gnutls_datum* req_ca_dn, int nreqs, - * gnutls_pk_algorithm* pk_algos, int pk_algos_length, gnutls_retr_st st); + * int (*callback)(gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs, + * gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_retr_st st); * * @st should contain the certificates and private keys. * @@ -367,7 +364,7 @@ void gnutls_certificate_client_set_retrieve_function * will be terminated. **/ void gnutls_certificate_server_set_retrieve_function - (gnutls_certificate_credentials cred, + (gnutls_certificate_credentials_t cred, gnutls_certificate_server_retrieve_function * func) { cred->server_get_cert_callback = func; } @@ -390,10 +387,10 @@ OPENPGP_VERIFY_KEY_FUNC _E_gnutls_openpgp_verify_key = NULL; * Returns a negative error code in case of an error, or GNUTLS_E_NO_CERTIFICATE_FOUND if no certificate was sent. * -*/ -int _gnutls_openpgp_cert_verify_peers(gnutls_session session) +int _gnutls_openpgp_cert_verify_peers(gnutls_session_t session) { cert_auth_info_t info; - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; int verify; int peer_certificate_list_size; @@ -450,13 +447,13 @@ int _gnutls_openpgp_cert_verify_peers(gnutls_session session) * However you must also check the peer's name in order to check if the verified certificate belongs to the * actual peer. * - * The return value should be one or more of the gnutls_certificate_status + * The return value should be one or more of the gnutls_certificate_status_t * enumerated elements bitwise or'd. * * This is the same as gnutls_x509_verify_certificate(). * **/ -int gnutls_certificate_verify_peers(gnutls_session session) +int gnutls_certificate_verify_peers(gnutls_session_t session) { cert_auth_info_t info; @@ -489,7 +486,7 @@ int gnutls_certificate_verify_peers(gnutls_session session) * Returns (time_t) -1 on error. * **/ -time_t gnutls_certificate_expiration_time_peers(gnutls_session session) +time_t gnutls_certificate_expiration_time_peers(gnutls_session_t session) { cert_auth_info_t info; @@ -531,7 +528,7 @@ time_t gnutls_certificate_expiration_time_peers(gnutls_session session) * Returns (time_t) -1 on error. * **/ -time_t gnutls_certificate_activation_time_peers(gnutls_session session) +time_t gnutls_certificate_activation_time_peers(gnutls_session_t session) { cert_auth_info_t info; @@ -567,8 +564,8 @@ OPENPGP_RAW_KEY_TO_GCERT _E_gnutls_openpgp_raw_key_to_gcert; OPENPGP_RAW_PRIVKEY_TO_GKEY _E_gnutls_openpgp_raw_privkey_to_gkey; int _gnutls_raw_cert_to_gcert(gnutls_cert * gcert, - gnutls_certificate_type type, - const gnutls_datum * raw_cert, + gnutls_certificate_type_t type, + const gnutls_datum_t * raw_cert, int flags /* OR of ConvFlags */ ) { switch (type) { @@ -587,8 +584,8 @@ int _gnutls_raw_cert_to_gcert(gnutls_cert * gcert, } int _gnutls_raw_privkey_to_gkey(gnutls_privkey * key, - gnutls_certificate_type type, - const gnutls_datum * raw_key, + gnutls_certificate_type_t type, + const gnutls_datum_t * raw_key, int key_enc /* DER or PEM */ ) { switch (type) { @@ -617,11 +614,10 @@ int _gnutls_raw_privkey_to_gkey(gnutls_privkey * key, * The critical extensions will be catched by the verification functions. */ int _gnutls_x509_raw_cert_to_gcert(gnutls_cert * gcert, - const gnutls_datum * derCert, - int flags /* OR of ConvFlags */ ) + const gnutls_datum_t * derCert, int flags /* OR of ConvFlags */ ) { int ret; - gnutls_x509_crt cert; + gnutls_x509_crt_t cert; ret = gnutls_x509_crt_init(&cert); if (ret < 0) { @@ -644,7 +640,7 @@ int _gnutls_x509_raw_cert_to_gcert(gnutls_cert * gcert, /* Like above but it accepts a parsed certificate instead. */ -int _gnutls_x509_crt_to_gcert(gnutls_cert * gcert, gnutls_x509_crt cert, +int _gnutls_x509_crt_to_gcert(gnutls_cert * gcert, gnutls_x509_crt_t cert, unsigned int flags) { int ret = 0; diff --git a/lib/gnutls_cert.h b/lib/gnutls_cert.h index 37e1a821f6..82c5e260ee 100644 --- a/lib/gnutls_cert.h +++ b/lib/gnutls_cert.h @@ -37,7 +37,7 @@ typedef struct gnutls_cert { */ int params_size; /* holds the size of MPI params */ - gnutls_pk_algorithm subject_pk_algorithm; + gnutls_pk_algorithm_t subject_pk_algorithm; unsigned int keyUsage; /* bits from KEY_* */ @@ -45,9 +45,9 @@ typedef struct gnutls_cert { unsigned int version; /* holds the type (PGP, X509) */ - gnutls_certificate_type cert_type; + gnutls_certificate_type_t cert_type; - gnutls_datum raw; + gnutls_datum_t raw; } gnutls_cert; @@ -70,10 +70,10 @@ typedef struct gnutls_privkey_int { */ int params_size; /* holds the number of params */ - gnutls_pk_algorithm pk_algorithm; + gnutls_pk_algorithm_t pk_algorithm; } gnutls_privkey; -struct gnutls_session_int; /* because gnutls_session is not defined when this file is included */ +struct gnutls_session_int; /* because gnutls_session_t is not defined when this file is included */ typedef enum ConvFlags { CERT_NO_COPY = 2, @@ -82,25 +82,25 @@ typedef enum ConvFlags { } ConvFlags; int _gnutls_x509_raw_cert_to_gcert(gnutls_cert * gcert, - const gnutls_datum * derCert, + const gnutls_datum_t * derCert, int flags); -int _gnutls_x509_crt_to_gcert(gnutls_cert * gcert, gnutls_x509_crt cert, +int _gnutls_x509_crt_to_gcert(gnutls_cert * gcert, gnutls_x509_crt_t cert, unsigned int flags); void _gnutls_gkey_deinit(gnutls_privkey * key); void _gnutls_gcert_deinit(gnutls_cert * cert); int _gnutls_selected_cert_supported_kx(struct gnutls_session_int *session, - gnutls_kx_algorithm ** alg, + gnutls_kx_algorithm_t ** alg, int *alg_size); int _gnutls_raw_cert_to_gcert(gnutls_cert * gcert, - gnutls_certificate_type type, - const gnutls_datum * raw_cert, + gnutls_certificate_type_t type, + const gnutls_datum_t * raw_cert, int flags /* OR of ConvFlags */ ); int _gnutls_raw_privkey_to_gkey(gnutls_privkey * key, - gnutls_certificate_type type, - const gnutls_datum * raw_key, + gnutls_certificate_type_t type, + const gnutls_datum_t * raw_key, int key_enc /* DER or PEM */ ); #endif diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c index 259a752abc..d59935bb8c 100644 --- a/lib/gnutls_cipher.c +++ b/lib/gnutls_cipher.c @@ -39,7 +39,7 @@ #include "gnutls_record.h" #include "gnutls_constate.h" -inline static int is_write_comp_null(gnutls_session session) +inline static int is_write_comp_null(gnutls_session_t session) { if (session->security_parameters.write_compression_algorithm == GNUTLS_COMP_NULL) @@ -48,7 +48,7 @@ inline static int is_write_comp_null(gnutls_session session) return 1; } -inline static int is_read_comp_null(gnutls_session session) +inline static int is_read_comp_null(gnutls_session_t session) { if (session->security_parameters.read_compression_algorithm == GNUTLS_COMP_NULL) @@ -63,14 +63,14 @@ inline static int is_read_comp_null(gnutls_session session) * * If random pad != 0 then the random pad data will be appended. */ -int _gnutls_encrypt(gnutls_session session, const opaque * headers, +int _gnutls_encrypt(gnutls_session_t session, const opaque * headers, size_t headers_size, const opaque * data, size_t data_size, opaque * ciphertext, size_t ciphertext_size, content_type_t type, int random_pad) { - gnutls_datum plain; - gnutls_datum comp; + gnutls_datum_t plain; + gnutls_datum_t comp; int ret; int free_comp = 1; @@ -114,12 +114,12 @@ int _gnutls_encrypt(gnutls_session session, const opaque * headers, /* Decrypts the given data. * Returns the decrypted data length. */ -int _gnutls_decrypt(gnutls_session session, opaque * ciphertext, +int _gnutls_decrypt(gnutls_session_t session, opaque * ciphertext, size_t ciphertext_size, uint8 * data, size_t max_data_size, content_type_t type) { - gnutls_datum gtxt; - gnutls_datum gcipher; + gnutls_datum_t gtxt; + gnutls_datum_t gcipher; int ret; if (ciphertext_size == 0) @@ -139,7 +139,7 @@ int _gnutls_decrypt(gnutls_session session, opaque * ciphertext, /* ret == ret */ } else { - gnutls_datum gcomp; + gnutls_datum_t gcomp; /* compression has this malloc overhead. */ @@ -171,7 +171,7 @@ int _gnutls_decrypt(gnutls_session session, opaque * ciphertext, inline static mac_hd_t -mac_init(gnutls_mac_algorithm mac, opaque * secret, int secret_size, +mac_init(gnutls_mac_algorithm_t mac, opaque * secret, int secret_size, int ver) { mac_hd_t td; @@ -198,7 +198,7 @@ inline static void mac_deinit(mac_hd_t td, opaque * res, int ver) } inline - static int calc_enc_length(gnutls_session session, int data_size, + static int calc_enc_length(gnutls_session_t session, int data_size, int hash_size, uint8 * pad, int random_pad, cipher_type_t block_algo, uint16 blocksize) { @@ -253,9 +253,9 @@ inline * which has cipher_size size. * return the actual encrypted data length. */ -int _gnutls_compressed2ciphertext(gnutls_session session, +int _gnutls_compressed2ciphertext(gnutls_session_t session, opaque * cipher_data, int cipher_size, - gnutls_datum compressed, + gnutls_datum_t compressed, content_type_t _type, int random_pad) { uint8 MAC[MAX_HASH_SIZE]; @@ -268,7 +268,7 @@ int _gnutls_compressed2ciphertext(gnutls_session session, int hash_size = _gnutls_hash_get_algo_len(session->security_parameters. write_mac_algorithm); - gnutls_protocol_version ver; + gnutls_protocol_t ver; int blocksize = _gnutls_cipher_get_block_size(session->security_parameters. write_bulk_cipher_algorithm); @@ -370,10 +370,10 @@ int _gnutls_compressed2ciphertext(gnutls_session session, /* Deciphers the ciphertext packet, and puts the result to compress_data, of compress_size. * Returns the actual compressed packet size. */ -int _gnutls_ciphertext2compressed(gnutls_session session, +int _gnutls_ciphertext2compressed(gnutls_session_t session, opaque * compress_data, int compress_size, - gnutls_datum ciphertext, uint8 type) + gnutls_datum_t ciphertext, uint8 type) { uint8 MAC[MAX_HASH_SIZE]; uint16 c_length; @@ -383,7 +383,7 @@ int _gnutls_ciphertext2compressed(gnutls_session session, uint16 blocksize; int ret, i, pad_failed = 0; uint8 major, minor; - gnutls_protocol_version ver; + gnutls_protocol_t ver; int hash_size = _gnutls_hash_get_algo_len(session->security_parameters. read_mac_algorithm); diff --git a/lib/gnutls_cipher.h b/lib/gnutls_cipher.h index 972c01cf87..78414a98f0 100644 --- a/lib/gnutls_cipher.h +++ b/lib/gnutls_cipher.h @@ -18,20 +18,20 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -int _gnutls_encrypt(gnutls_session session, const opaque * headers, +int _gnutls_encrypt(gnutls_session_t session, const opaque * headers, size_t headers_size, const opaque * data, size_t data_size, opaque * ciphertext, size_t ciphertext_size, content_type_t type, int random_pad); -int _gnutls_decrypt(gnutls_session session, opaque * ciphertext, +int _gnutls_decrypt(gnutls_session_t session, opaque * ciphertext, size_t ciphertext_size, uint8 * data, size_t data_size, content_type_t type); -int _gnutls_compressed2ciphertext(gnutls_session session, +int _gnutls_compressed2ciphertext(gnutls_session_t session, opaque * cipher_data, int cipher_size, - gnutls_datum compressed, + gnutls_datum_t compressed, content_type_t _type, int random_pad); -int _gnutls_ciphertext2compressed(gnutls_session session, +int _gnutls_ciphertext2compressed(gnutls_session_t session, opaque * compress_data, int compress_size, - gnutls_datum ciphertext, uint8 type); + gnutls_datum_t ciphertext, uint8 type); diff --git a/lib/gnutls_cipher_int.c b/lib/gnutls_cipher_int.c index 24ff0370ee..07cff67a67 100644 --- a/lib/gnutls_cipher_int.c +++ b/lib/gnutls_cipher_int.c @@ -25,9 +25,9 @@ #include <gnutls_cipher_int.h> #include <gnutls_datum.h> -cipher_hd_t _gnutls_cipher_init(gnutls_cipher_algorithm cipher, - const gnutls_datum * key, - const gnutls_datum * iv) +cipher_hd_t _gnutls_cipher_init(gnutls_cipher_algorithm_t cipher, + const gnutls_datum_t * key, + const gnutls_datum_t * iv) { cipher_hd_t ret = NULL; gcry_error_t err = GPG_ERR_GENERAL; /* doesn't matter */ diff --git a/lib/gnutls_cipher_int.h b/lib/gnutls_cipher_int.h index c27631a319..3e51b7b421 100644 --- a/lib/gnutls_cipher_int.h +++ b/lib/gnutls_cipher_int.h @@ -24,12 +24,11 @@ #define cipher_hd_t gcry_cipher_hd_t #define GNUTLS_CIPHER_FAILED NULL -cipher_hd_t _gnutls_cipher_init(gnutls_cipher_algorithm cipher, - const gnutls_datum * key, - const gnutls_datum * iv); +cipher_hd_t _gnutls_cipher_init(gnutls_cipher_algorithm_t cipher, + const gnutls_datum_t * key, const gnutls_datum_t * iv); int _gnutls_cipher_encrypt(cipher_hd_t handle, void *text, int textlen); int _gnutls_cipher_decrypt(cipher_hd_t handle, void *ciphertext, - int ciphertextlen); + int ciphertextlen); void _gnutls_cipher_deinit(cipher_hd_t handle); -#endif /* GNUTLS_CIPHER_INT */ +#endif /* GNUTLS_CIPHER_INT */ diff --git a/lib/gnutls_compress.c b/lib/gnutls_compress.c index 80b3036110..26ff373e0c 100644 --- a/lib/gnutls_compress.c +++ b/lib/gnutls_compress.c @@ -31,9 +31,9 @@ /* These functions allocate the return value internally */ -int _gnutls_m_plaintext2compressed(gnutls_session session, - gnutls_datum * - compress, gnutls_datum plaintext) +int _gnutls_m_plaintext2compressed(gnutls_session_t session, + gnutls_datum_t * + compress, gnutls_datum_t plaintext) { int size; opaque *data; @@ -52,9 +52,9 @@ int _gnutls_m_plaintext2compressed(gnutls_session session, return 0; } -int _gnutls_m_compressed2plaintext(gnutls_session session, - gnutls_datum * plain, - gnutls_datum compressed) +int _gnutls_m_compressed2plaintext(gnutls_session_t session, + gnutls_datum_t * plain, + gnutls_datum_t compressed) { int size; opaque *data; diff --git a/lib/gnutls_compress.h b/lib/gnutls_compress.h index 865344b982..2b6e25a490 100644 --- a/lib/gnutls_compress.h +++ b/lib/gnutls_compress.h @@ -18,9 +18,9 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -int _gnutls_m_plaintext2compressed(gnutls_session session, - gnutls_datum * compress, - gnutls_datum plaintext); -int _gnutls_m_compressed2plaintext(gnutls_session session, - gnutls_datum * plain, - gnutls_datum compressed); +int _gnutls_m_plaintext2compressed(gnutls_session_t session, + gnutls_datum_t * compress, + gnutls_datum_t plaintext); +int _gnutls_m_compressed2plaintext(gnutls_session_t session, + gnutls_datum_t * plain, + gnutls_datum_t compressed); diff --git a/lib/gnutls_compress_int.c b/lib/gnutls_compress_int.c index bee6454f79..66bf42dd13 100644 --- a/lib/gnutls_compress_int.c +++ b/lib/gnutls_compress_int.c @@ -45,7 +45,7 @@ LZO_FUNC _gnutls_lzo1x_1_compress = NULL; /* The flag d is the direction (compress, decompress). Non zero is * decompress. */ -comp_hd_t _gnutls_comp_init(gnutls_compression_method method, int d) +comp_hd_t _gnutls_comp_init(gnutls_compression_method_t method, int d) { comp_hd_t ret; int err; diff --git a/lib/gnutls_compress_int.h b/lib/gnutls_compress_int.h index f285ce828f..803747cc0b 100644 --- a/lib/gnutls_compress_int.h +++ b/lib/gnutls_compress_int.h @@ -29,10 +29,10 @@ typedef struct comp_hd_t_STRUCT { void *handle; - gnutls_compression_method algo; + gnutls_compression_method_t algo; } *comp_hd_t; -comp_hd_t _gnutls_comp_init(gnutls_compression_method, int d); +comp_hd_t _gnutls_comp_init(gnutls_compression_method_t, int d); void _gnutls_comp_deinit(comp_hd_t handle, int d); int _gnutls_decompress(comp_hd_t handle, opaque * compressed, diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c index 78fee15e2b..be5c83f1b3 100644 --- a/lib/gnutls_constate.c +++ b/lib/gnutls_constate.c @@ -52,7 +52,7 @@ static const int servwrite_length = sizeof(servwrite) - 1; * This function creates the keys and stores them into pending session. * (session->cipher_specs) */ -int _gnutls_set_keys(gnutls_session session, int hash_size, int IV_size, +int _gnutls_set_keys(gnutls_session_t session, int hash_size, int IV_size, int key_size, int export_flag) { @@ -349,13 +349,13 @@ int _gnutls_set_keys(gnutls_session session, int hash_size, int IV_size, return 0; } -int _gnutls_set_read_keys(gnutls_session session) +int _gnutls_set_read_keys(gnutls_session_t session) { int hash_size; int IV_size; int key_size, export_flag; - gnutls_cipher_algorithm algo; - gnutls_mac_algorithm mac_algo; + gnutls_cipher_algorithm_t algo; + gnutls_mac_algorithm_t mac_algo; mac_algo = session->security_parameters.read_mac_algorithm; algo = session->security_parameters.read_bulk_cipher_algorithm; @@ -369,13 +369,13 @@ int _gnutls_set_read_keys(gnutls_session session) export_flag); } -int _gnutls_set_write_keys(gnutls_session session) +int _gnutls_set_write_keys(gnutls_session_t session) { int hash_size; int IV_size; int key_size, export_flag; - gnutls_cipher_algorithm algo; - gnutls_mac_algorithm mac_algo; + gnutls_cipher_algorithm_t algo; + gnutls_mac_algorithm_t mac_algo; mac_algo = session->security_parameters.write_mac_algorithm; algo = session->security_parameters.write_bulk_cipher_algorithm; @@ -434,7 +434,7 @@ static void _gnutls_cpy_write_security_parameters(security_parameters_st * * secrets and random numbers to have been negotiated) * This is to be called after sending the Change Cipher Spec packet. */ -int _gnutls_connection_state_init(gnutls_session session) +int _gnutls_connection_state_init(gnutls_session_t session) { int ret; @@ -453,7 +453,7 @@ int _gnutls_connection_state_init(gnutls_session session) /* Initializes the read connection session * (read encrypted data) */ -int _gnutls_read_connection_state_init(gnutls_session session) +int _gnutls_read_connection_state_init(gnutls_session_t session) { int mac_size; int rc; @@ -632,7 +632,7 @@ int _gnutls_read_connection_state_init(gnutls_session session) /* Initializes the write connection session * (write encrypted data) */ -int _gnutls_write_connection_state_init(gnutls_session session) +int _gnutls_write_connection_state_init(gnutls_session_t session) { int mac_size; int rc; @@ -812,8 +812,8 @@ int _gnutls_write_connection_state_init(gnutls_session session) /* Sets the specified cipher into the pending session */ -int _gnutls_set_read_cipher(gnutls_session session, - gnutls_cipher_algorithm algo) +int _gnutls_set_read_cipher(gnutls_session_t session, + gnutls_cipher_algorithm_t algo) { if (_gnutls_cipher_is_ok(algo) == 0) { @@ -833,8 +833,8 @@ int _gnutls_set_read_cipher(gnutls_session session, } -int _gnutls_set_write_cipher(gnutls_session session, - gnutls_cipher_algorithm algo) +int _gnutls_set_write_cipher(gnutls_session_t session, + gnutls_cipher_algorithm_t algo) { if (_gnutls_cipher_is_ok(algo) == 0) { @@ -857,8 +857,8 @@ int _gnutls_set_write_cipher(gnutls_session session, /* Sets the specified algorithm into pending compression session */ -int _gnutls_set_read_compression(gnutls_session session, - gnutls_compression_method algo) +int _gnutls_set_read_compression(gnutls_session_t session, + gnutls_compression_method_t algo) { if (_gnutls_compression_is_ok(algo) == 0) { @@ -871,8 +871,8 @@ int _gnutls_set_read_compression(gnutls_session session, } -int _gnutls_set_write_compression(gnutls_session session, - gnutls_compression_method algo) +int _gnutls_set_write_compression(gnutls_session_t session, + gnutls_compression_method_t algo) { if (_gnutls_compression_is_ok(algo) == 0) { @@ -887,7 +887,7 @@ int _gnutls_set_write_compression(gnutls_session session, /* Sets the specified kx algorithm into pending session */ -int _gnutls_set_kx(gnutls_session session, gnutls_kx_algorithm algo) +int _gnutls_set_kx(gnutls_session_t session, gnutls_kx_algorithm_t algo) { if (_gnutls_kx_is_ok(algo) == 0) { @@ -907,7 +907,7 @@ int _gnutls_set_kx(gnutls_session session, gnutls_kx_algorithm algo) } /* Sets the specified mac algorithm into pending session */ -int _gnutls_set_read_mac(gnutls_session session, gnutls_mac_algorithm algo) +int _gnutls_set_read_mac(gnutls_session_t session, gnutls_mac_algorithm_t algo) { if (_gnutls_mac_is_ok(algo) == 0) { @@ -926,8 +926,8 @@ int _gnutls_set_read_mac(gnutls_session session, gnutls_mac_algorithm algo) } -int _gnutls_set_write_mac(gnutls_session session, - gnutls_mac_algorithm algo) +int _gnutls_set_write_mac(gnutls_session_t session, + gnutls_mac_algorithm_t algo) { if (_gnutls_mac_is_ok(algo) == 0) { diff --git a/lib/gnutls_constate.h b/lib/gnutls_constate.h index 8a0e3deb70..57874af241 100644 --- a/lib/gnutls_constate.h +++ b/lib/gnutls_constate.h @@ -1,16 +1,16 @@ -int _gnutls_connection_state_init(gnutls_session session); -int _gnutls_read_connection_state_init(gnutls_session session); -int _gnutls_write_connection_state_init(gnutls_session session); -int _gnutls_set_write_cipher(gnutls_session session, - gnutls_cipher_algorithm algo); -int _gnutls_set_write_mac(gnutls_session session, - gnutls_mac_algorithm algo); -int _gnutls_set_read_cipher(gnutls_session session, - gnutls_cipher_algorithm algo); -int _gnutls_set_read_mac(gnutls_session session, - gnutls_mac_algorithm algo); -int _gnutls_set_read_compression(gnutls_session session, - gnutls_compression_method algo); -int _gnutls_set_write_compression(gnutls_session session, - gnutls_compression_method algo); -int _gnutls_set_kx(gnutls_session session, gnutls_kx_algorithm algo); +int _gnutls_connection_state_init(gnutls_session_t session); +int _gnutls_read_connection_state_init(gnutls_session_t session); +int _gnutls_write_connection_state_init(gnutls_session_t session); +int _gnutls_set_write_cipher(gnutls_session_t session, + gnutls_cipher_algorithm_t algo); +int _gnutls_set_write_mac(gnutls_session_t session, + gnutls_mac_algorithm_t algo); +int _gnutls_set_read_cipher(gnutls_session_t session, + gnutls_cipher_algorithm_t algo); +int _gnutls_set_read_mac(gnutls_session_t session, + gnutls_mac_algorithm_t algo); +int _gnutls_set_read_compression(gnutls_session_t session, + gnutls_compression_method_t algo); +int _gnutls_set_write_compression(gnutls_session_t session, + gnutls_compression_method_t algo); +int _gnutls_set_kx(gnutls_session_t session, gnutls_kx_algorithm_t algo); diff --git a/lib/gnutls_datum.c b/lib/gnutls_datum.c index 667e88fbf4..b9ccc85ad8 100644 --- a/lib/gnutls_datum.c +++ b/lib/gnutls_datum.c @@ -31,32 +31,32 @@ #include <gnutls_errors.h> -void _gnutls_write_datum16(opaque * dest, gnutls_datum dat) +void _gnutls_write_datum16(opaque * dest, gnutls_datum_t dat) { _gnutls_write_uint16(dat.size, dest); memcpy(&dest[2], dat.data, dat.size); } -void _gnutls_write_datum24(opaque * dest, gnutls_datum dat) +void _gnutls_write_datum24(opaque * dest, gnutls_datum_t dat) { _gnutls_write_uint24(dat.size, dest); memcpy(&dest[3], dat.data, dat.size); } -void _gnutls_write_datum32(opaque * dest, gnutls_datum dat) +void _gnutls_write_datum32(opaque * dest, gnutls_datum_t dat) { _gnutls_write_uint32(dat.size, dest); memcpy(&dest[4], dat.data, dat.size); } -void _gnutls_write_datum8(opaque * dest, gnutls_datum dat) +void _gnutls_write_datum8(opaque * dest, gnutls_datum_t dat) { dest[0] = (uint8) dat.size; memcpy(&dest[1], dat.data, dat.size); } -int _gnutls_set_datum_m(gnutls_datum * dat, const void *data, +int _gnutls_set_datum_m(gnutls_datum_t * dat, const void *data, int data_size, gnutls_alloc_function galloc_func) { if (data_size == 0) { @@ -75,7 +75,7 @@ int _gnutls_set_datum_m(gnutls_datum * dat, const void *data, return 0; } -int _gnutls_datum_append_m(gnutls_datum * dst, const void *data, +int _gnutls_datum_append_m(gnutls_datum_t * dst, const void *data, int data_size, gnutls_realloc_function grealloc_func) { @@ -90,7 +90,7 @@ int _gnutls_datum_append_m(gnutls_datum * dst, const void *data, return 0; } -void _gnutls_free_datum_m(gnutls_datum * dat, +void _gnutls_free_datum_m(gnutls_datum_t * dat, gnutls_free_function gfree_func) { if (dat->data != NULL && dat->size != 0) diff --git a/lib/gnutls_datum.h b/lib/gnutls_datum.h index 8c6ee283de..cf0fdde7ab 100644 --- a/lib/gnutls_datum.h +++ b/lib/gnutls_datum.h @@ -1,16 +1,16 @@ -void _gnutls_write_datum16(opaque * dest, gnutls_datum dat); -void _gnutls_write_datum24(opaque * dest, gnutls_datum dat); -void _gnutls_write_datum32(opaque * dest, gnutls_datum dat); -void _gnutls_write_datum8(opaque * dest, gnutls_datum dat); +void _gnutls_write_datum16(opaque * dest, gnutls_datum_t dat); +void _gnutls_write_datum24(opaque * dest, gnutls_datum_t dat); +void _gnutls_write_datum32(opaque * dest, gnutls_datum_t dat); +void _gnutls_write_datum8(opaque * dest, gnutls_datum_t dat); -int _gnutls_set_datum_m(gnutls_datum * dat, const void *data, +int _gnutls_set_datum_m(gnutls_datum_t * dat, const void *data, int data_size, gnutls_alloc_function); #define _gnutls_set_datum( x, y, z) _gnutls_set_datum_m(x,y,z, gnutls_malloc) #define _gnutls_sset_datum( x, y, z) _gnutls_set_datum_m(x,y,z, gnutls_secure_malloc) -int _gnutls_datum_append_m(gnutls_datum * dat, const void *data, +int _gnutls_datum_append_m(gnutls_datum_t * dat, const void *data, int data_size, gnutls_realloc_function); #define _gnutls_datum_append(x,y,z) _gnutls_datum_append_m(x,y,z, gnutls_realloc) -void _gnutls_free_datum_m(gnutls_datum * dat, gnutls_free_function); +void _gnutls_free_datum_m(gnutls_datum_t * dat, gnutls_free_function); #define _gnutls_free_datum(x) _gnutls_free_datum_m(x, gnutls_free) diff --git a/lib/gnutls_db.c b/lib/gnutls_db.c index ee90096491..a519190cca 100644 --- a/lib/gnutls_db.c +++ b/lib/gnutls_db.c @@ -33,12 +33,12 @@ /** * gnutls_db_set_retrieve_function - Sets the function that will be used to get data - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @retr_func: is the function. * * Sets the function that will be used to retrieve data from the resumed - * sessions database. This function must return a gnutls_datum containing the - * data on success, or a gnutls_datum containing null and 0 on failure. + * sessions database. This function must return a gnutls_datum_t containing the + * data on success, or a gnutls_datum_t containing null and 0 on failure. * * The datum's data must be allocated using the function * gnutls_malloc(). @@ -47,7 +47,7 @@ * has been called. * **/ -void gnutls_db_set_retrieve_function(gnutls_session session, +void gnutls_db_set_retrieve_function(gnutls_session_t session, gnutls_db_retr_func retr_func) { session->internals.db_retrieve_func = retr_func; @@ -55,7 +55,7 @@ void gnutls_db_set_retrieve_function(gnutls_session session, /** * gnutls_db_set_remove_function - Sets the function that will be used to remove data - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @rem_func: is the function. * * Sets the function that will be used to remove data from the resumed @@ -65,7 +65,7 @@ void gnutls_db_set_retrieve_function(gnutls_session session, * has been called. * **/ -void gnutls_db_set_remove_function(gnutls_session session, +void gnutls_db_set_remove_function(gnutls_session_t session, gnutls_db_remove_func rem_func) { session->internals.db_remove_func = rem_func; @@ -73,7 +73,7 @@ void gnutls_db_set_remove_function(gnutls_session session, /** * gnutls_db_set_store_function - Sets the function that will be used to put data - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @store_func: is the function * * Sets the function that will be used to store data from the resumed @@ -83,7 +83,7 @@ void gnutls_db_set_remove_function(gnutls_session session, * has been called. * **/ -void gnutls_db_set_store_function(gnutls_session session, +void gnutls_db_set_store_function(gnutls_session_t session, gnutls_db_store_func store_func) { session->internals.db_store_func = store_func; @@ -91,47 +91,47 @@ void gnutls_db_set_store_function(gnutls_session session, /** * gnutls_db_set_ptr - Sets a pointer to be sent to db functions - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @ptr: is the pointer * * Sets the pointer that will be provided to db store, retrieve and delete functions, as * the first argument. * **/ -void gnutls_db_set_ptr(gnutls_session session, void *ptr) +void gnutls_db_set_ptr(gnutls_session_t session, void *ptr) { session->internals.db_ptr = ptr; } /** * gnutls_db_get_ptr - Returns the pointer which is sent to db functions - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the pointer that will be sent to db store, retrieve and delete functions, as * the first argument. * **/ -void *gnutls_db_get_ptr(gnutls_session session) +void *gnutls_db_get_ptr(gnutls_session_t session) { return session->internals.db_ptr; } /** * gnutls_db_set_cache_expiration - Sets the expiration time for resumed sessions. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @seconds: is the number of seconds. * * Sets the expiration time for resumed sessions. The default is 3600 (one hour) * at the time writing this. **/ -void gnutls_db_set_cache_expiration(gnutls_session session, int seconds) +void gnutls_db_set_cache_expiration(gnutls_session_t session, int seconds) { session->internals.expire_time = seconds; } /** * gnutls_db_check_entry - checks if the given db entry has expired - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @session_entry: is the session data (not key) * * This function returns GNUTLS_E_EXPIRED, if the database entry @@ -140,8 +140,8 @@ void gnutls_db_set_cache_expiration(gnutls_session session, int seconds) * backend. * **/ -int gnutls_db_check_entry(gnutls_session session, - gnutls_datum session_entry) +int gnutls_db_check_entry(gnutls_session_t session, + gnutls_datum_t session_entry) { time_t timestamp; @@ -163,10 +163,10 @@ int gnutls_db_check_entry(gnutls_session session, /* The format of storing data is: * (forget it). Check gnutls_session_pack.c */ -int _gnutls_server_register_current_session(gnutls_session session) +int _gnutls_server_register_current_session(gnutls_session_t session) { - gnutls_datum key; - gnutls_datum content; + gnutls_datum_t key; + gnutls_datum_t content; int ret = 0; key.data = session->security_parameters.session_id; @@ -215,7 +215,7 @@ int _gnutls_server_register_current_session(gnutls_session session) /* Checks if both db_store and db_retrieve functions have * been set up. */ -static int _gnutls_db_func_is_ok(gnutls_session session) +static int _gnutls_db_func_is_ok(gnutls_session_t session) { if (session->internals.db_store_func != NULL && session->internals.db_retrieve_func != NULL && @@ -226,11 +226,11 @@ static int _gnutls_db_func_is_ok(gnutls_session session) } -int _gnutls_server_restore_session(gnutls_session session, +int _gnutls_server_restore_session(gnutls_session_t session, uint8 * session_id, int session_id_size) { - gnutls_datum data; - gnutls_datum key; + gnutls_datum_t data; + gnutls_datum_t key; int ret; key.data = session_id; @@ -260,10 +260,10 @@ int _gnutls_server_restore_session(gnutls_session session, return 0; } -int _gnutls_db_remove_session(gnutls_session session, uint8 * session_id, +int _gnutls_db_remove_session(gnutls_session_t session, uint8 * session_id, int session_id_size) { - gnutls_datum key; + gnutls_datum_t key; key.data = session_id; key.size = session_id_size; @@ -274,8 +274,8 @@ int _gnutls_db_remove_session(gnutls_session session, uint8 * session_id, /* Stores session data to the db backend. */ -int _gnutls_store_session(gnutls_session session, gnutls_datum session_id, - gnutls_datum session_data) +int _gnutls_store_session(gnutls_session_t session, gnutls_datum_t session_id, + gnutls_datum_t session_data) { int ret = 0; @@ -310,10 +310,10 @@ int _gnutls_store_session(gnutls_session session, gnutls_datum session_id, /* Retrieves session data from the db backend. */ -gnutls_datum _gnutls_retrieve_session(gnutls_session session, - gnutls_datum session_id) +gnutls_datum_t _gnutls_retrieve_session(gnutls_session_t session, + gnutls_datum_t session_id) { - gnutls_datum ret = { NULL, 0 }; + gnutls_datum_t ret = { NULL, 0 }; if (session_id.data == NULL || session_id.size == 0) { gnutls_assert(); @@ -331,7 +331,7 @@ gnutls_datum _gnutls_retrieve_session(gnutls_session session, /* Removes session data from the db backend. */ -int _gnutls_remove_session(gnutls_session session, gnutls_datum session_id) +int _gnutls_remove_session(gnutls_session_t session, gnutls_datum_t session_id) { int ret = 0; @@ -354,7 +354,7 @@ int _gnutls_remove_session(gnutls_session session, gnutls_datum session_id) /** * gnutls_db_remove_session - This function will remove the current session data from the database - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function will remove the current session data from the session * database. This will prevent future handshakes reusing these session @@ -364,7 +364,7 @@ int _gnutls_remove_session(gnutls_session session, gnutls_datum session_id) * Normally gnutls_deinit() will remove abnormally terminated sessions. * **/ -void gnutls_db_remove_session(gnutls_session session) +void gnutls_db_remove_session(gnutls_session_t session) { /* if the session has failed abnormally it has * to be removed from the db diff --git a/lib/gnutls_db.h b/lib/gnutls_db.h index 1d0f4a717c..d18fcf4444 100644 --- a/lib/gnutls_db.h +++ b/lib/gnutls_db.h @@ -18,19 +18,19 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -void gnutls_set_cache_expiration(gnutls_session session, int seconds); -int gnutls_db_set_name(gnutls_session session, const char *filename); -int _gnutls_server_register_current_session(gnutls_session session); -int _gnutls_server_restore_session(gnutls_session session, +void gnutls_set_cache_expiration(gnutls_session_t session, int seconds); +int gnutls_db_set_name(gnutls_session_t session, const char *filename); +int _gnutls_server_register_current_session(gnutls_session_t session); +int _gnutls_server_restore_session(gnutls_session_t session, uint8 * session_id, int session_id_size); -int gnutls_db_clean(gnutls_session session); -int _gnutls_db_remove_session(gnutls_session session, uint8 * session_id, +int gnutls_db_clean(gnutls_session_t session); +int _gnutls_db_remove_session(gnutls_session_t session, uint8 * session_id, int session_id_size); -void gnutls_db_remove_session(gnutls_session session); -int _gnutls_store_session(gnutls_session session, gnutls_datum session_id, - gnutls_datum session_data); -gnutls_datum _gnutls_retrieve_session(gnutls_session session, - gnutls_datum session_id); -int _gnutls_remove_session(gnutls_session session, - gnutls_datum session_id); +void gnutls_db_remove_session(gnutls_session_t session); +int _gnutls_store_session(gnutls_session_t session, gnutls_datum_t session_id, + gnutls_datum_t session_data); +gnutls_datum_t _gnutls_retrieve_session(gnutls_session_t session, + gnutls_datum_t session_id); +int _gnutls_remove_session(gnutls_session_t session, + gnutls_datum_t session_id); diff --git a/lib/gnutls_dh.h b/lib/gnutls_dh.h index 9336a31230..781cf08e04 100644 --- a/lib/gnutls_dh.h +++ b/lib/gnutls_dh.h @@ -18,8 +18,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -const mpi_t *_gnutls_get_dh_params(gnutls_dh_params); +const mpi_t *_gnutls_get_dh_params(gnutls_dh_params_t); mpi_t gnutls_calc_dh_secret(mpi_t * ret_x, mpi_t g, mpi_t prime); mpi_t gnutls_calc_dh_key(mpi_t f, mpi_t x, mpi_t prime); int _gnutls_dh_generate_prime(mpi_t * ret_g, mpi_t * ret_n, uint bits); -void gnutls_dh_params_deinit(gnutls_dh_params dh_params); +void gnutls_dh_params_deinit(gnutls_dh_params_t dh_params); diff --git a/lib/gnutls_dh_primes.c b/lib/gnutls_dh_primes.c index e6da92c4ae..6eda6a1a11 100644 --- a/lib/gnutls_dh_primes.c +++ b/lib/gnutls_dh_primes.c @@ -32,7 +32,7 @@ /* returns the prime and the generator of DH params. */ -const mpi_t *_gnutls_get_dh_params(gnutls_dh_params dh_primes) +const mpi_t *_gnutls_get_dh_params(gnutls_dh_params_t dh_primes) { if (dh_primes == NULL || dh_primes->params[1] == NULL || dh_primes->params[0] == NULL) { @@ -138,9 +138,9 @@ int _gnutls_dh_generate_prime(mpi_t * ret_g, mpi_t * ret_n, * appropriate gnutls_datum. * **/ -int gnutls_dh_params_import_raw(gnutls_dh_params dh_params, - const gnutls_datum * prime, - const gnutls_datum * generator) +int gnutls_dh_params_import_raw(gnutls_dh_params_t dh_params, + const gnutls_datum_t * prime, + const gnutls_datum_t * generator) { mpi_t tmp_prime, tmp_g; size_t siz; @@ -174,7 +174,7 @@ int gnutls_dh_params_import_raw(gnutls_dh_params dh_params, * This function will initialize the DH parameters structure. * **/ -int gnutls_dh_params_init(gnutls_dh_params * dh_params) +int gnutls_dh_params_init(gnutls_dh_params_t * dh_params) { (*dh_params) = gnutls_calloc(1, sizeof(dh_params_st)); @@ -194,7 +194,7 @@ int gnutls_dh_params_init(gnutls_dh_params * dh_params) * This function will deinitialize the DH parameters structure. * **/ -void gnutls_dh_params_deinit(gnutls_dh_params dh_params) +void gnutls_dh_params_deinit(gnutls_dh_params_t dh_params) { if (dh_params == NULL) return; @@ -215,7 +215,7 @@ void gnutls_dh_params_deinit(gnutls_dh_params dh_params) * to destination. * **/ -int gnutls_dh_params_cpy(gnutls_dh_params dst, gnutls_dh_params src) +int gnutls_dh_params_cpy(gnutls_dh_params_t dst, gnutls_dh_params_t src) { if (src == NULL) return GNUTLS_E_INVALID_REQUEST; @@ -246,7 +246,7 @@ int gnutls_dh_params_cpy(gnutls_dh_params dst, gnutls_dh_params src) * no use to call this in client side. * **/ -int gnutls_dh_params_generate2(gnutls_dh_params params, unsigned int bits) +int gnutls_dh_params_generate2(gnutls_dh_params_t params, unsigned int bits) { int ret; @@ -276,13 +276,13 @@ int gnutls_dh_params_generate2(gnutls_dh_params params, unsigned int bits) * 0 on success. * **/ -int gnutls_dh_params_import_pkcs3(gnutls_dh_params params, - const gnutls_datum * pkcs3_params, - gnutls_x509_crt_fmt format) +int gnutls_dh_params_import_pkcs3(gnutls_dh_params_t params, + const gnutls_datum_t * pkcs3_params, + gnutls_x509_crt_fmt_t format) { ASN1_TYPE c2; int result, need_free = 0; - gnutls_datum _params; + gnutls_datum_t _params; if (format == GNUTLS_X509_FMT_PEM) { opaque *out; @@ -378,8 +378,8 @@ int gnutls_dh_params_import_pkcs3(gnutls_dh_params params, * 0 on success. * **/ -int gnutls_dh_params_export_pkcs3(gnutls_dh_params params, - gnutls_x509_crt_fmt format, +int gnutls_dh_params_export_pkcs3(gnutls_dh_params_t params, + gnutls_x509_crt_fmt_t format, unsigned char *params_data, size_t * params_data_size) { @@ -534,10 +534,8 @@ int gnutls_dh_params_export_pkcs3(gnutls_dh_params params, * gnutls_malloc() and will be stored in the appropriate datum. * **/ -int gnutls_dh_params_export_raw(gnutls_dh_params params, - gnutls_datum * prime, - gnutls_datum * generator, - unsigned int *bits) +int gnutls_dh_params_export_raw(gnutls_dh_params_t params, + gnutls_datum_t * prime, gnutls_datum_t * generator, unsigned int *bits) { size_t size; diff --git a/lib/gnutls_extensions.c b/lib/gnutls_extensions.c index 868cd9ca7c..adfd109552 100644 --- a/lib/gnutls_extensions.c +++ b/lib/gnutls_extensions.c @@ -93,7 +93,7 @@ const char *_gnutls_extension_get_name(uint16 type) /* Checks if the extension we just received is one of the * requested ones. Otherwise it's a fatal error. */ -static int _gnutls_extension_list_check(gnutls_session session, +static int _gnutls_extension_list_check(gnutls_session_t session, uint16 type) { if (session->security_parameters.entity == GNUTLS_CLIENT) { @@ -108,7 +108,7 @@ static int _gnutls_extension_list_check(gnutls_session session, return 0; } -int _gnutls_parse_extensions(gnutls_session session, const opaque * data, +int _gnutls_parse_extensions(gnutls_session_t session, const opaque * data, int data_size) { int next, ret; @@ -177,7 +177,7 @@ int _gnutls_parse_extensions(gnutls_session session, const opaque * data, * This list is used to check whether the (later) received * extensions are the ones we requested. */ -static void _gnutls_extension_list_add(gnutls_session session, uint16 type) +static void _gnutls_extension_list_add(gnutls_session_t session, uint16 type) { if (session->security_parameters.entity == GNUTLS_CLIENT) { @@ -192,7 +192,7 @@ static void _gnutls_extension_list_add(gnutls_session session, uint16 type) } } -int _gnutls_gen_extensions(gnutls_session session, opaque * data, +int _gnutls_gen_extensions(gnutls_session_t session, opaque * data, size_t data_size) { int next, size; diff --git a/lib/gnutls_extensions.h b/lib/gnutls_extensions.h index 288ec183be..0d97c7ef3e 100644 --- a/lib/gnutls_extensions.h +++ b/lib/gnutls_extensions.h @@ -21,12 +21,12 @@ #include <gnutls_int.h> const char *_gnutls_extension_get_name(uint16 type); -int _gnutls_parse_extensions(gnutls_session, const opaque *, int); -int _gnutls_gen_extensions(gnutls_session session, opaque * data, +int _gnutls_parse_extensions(gnutls_session_t, const opaque *, int); +int _gnutls_gen_extensions(gnutls_session_t session, opaque * data, size_t data_size); -typedef int (*ext_recv_func) (gnutls_session, const opaque *, size_t); /* recv data */ -typedef int (*ext_send_func) (gnutls_session, opaque *, size_t); /* send data */ +typedef int (*ext_recv_func) (gnutls_session_t, const opaque *, size_t); /* recv data */ +typedef int (*ext_send_func) (gnutls_session_t, opaque *, size_t); /* send data */ ext_send_func _gnutls_ext_func_send(uint16 type); ext_recv_func _gnutls_ext_func_recv(uint16 type); diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c index c3bf7d334e..90de8b969d 100644 --- a/lib/gnutls_global.c +++ b/lib/gnutls_global.c @@ -267,9 +267,9 @@ void gnutls_global_deinit(void) * probably be ok. * This function should be called once and after gnutls_global_init(). * PULL_FUNC is of the form, - * ssize_t (*gnutls_pull_func)(gnutls_transport_ptr, const void*, size_t); + * ssize_t (*gnutls_pull_func)(gnutls_transport_ptr_t, const void*, size_t); **/ -void gnutls_transport_set_pull_function(gnutls_session session, +void gnutls_transport_set_pull_function(gnutls_session_t session, gnutls_pull_func pull_func) { session->internals._gnutls_pull_func = pull_func; @@ -288,9 +288,9 @@ void gnutls_transport_set_pull_function(gnutls_session session, * * This function should be called once and after gnutls_global_init(). * PUSH_FUNC is of the form, - * ssize_t (*gnutls_push_func)(gnutls_transport_ptr, const void*, size_t); + * ssize_t (*gnutls_push_func)(gnutls_transport_ptr_t, const void*, size_t); **/ -void gnutls_transport_set_push_function(gnutls_session session, +void gnutls_transport_set_push_function(gnutls_session_t session, gnutls_push_func push_func) { session->internals._gnutls_push_func = push_func; diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index 7c9351336e..25aa741230 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -48,7 +48,7 @@ #include <gnutls_state.h> #include <ext_srp.h> #include <gnutls_rsa_export.h> /* for gnutls_get_rsa_params() */ -#include <auth_anon.h> /* for gnutls_anon_server_credentials */ +#include <auth_anon.h> /* for gnutls_anon_server_credentials_t */ #ifdef HANDSHAKE_DEBUG #define ERR(x, y) _gnutls_handshake_log( "HSK[%x]: %s (%d)\n", session, x,y) @@ -59,14 +59,14 @@ #define TRUE 1 #define FALSE 0 -int _gnutls_server_select_comp_method(gnutls_session session, +int _gnutls_server_select_comp_method(gnutls_session_t session, opaque * data, int datalen); /* Clears the handshake hash buffers and handles. */ inline static -void _gnutls_handshake_hash_buffers_clear(gnutls_session session) +void _gnutls_handshake_hash_buffers_clear(gnutls_session_t session) { _gnutls_hash_deinit(session->internals.handshake_mac_handle_md5, NULL); _gnutls_hash_deinit(session->internals.handshake_mac_handle_sha, NULL); @@ -79,7 +79,7 @@ void _gnutls_handshake_hash_buffers_clear(gnutls_session session) * internals, and to security_parameters. * this will keep as less data to security_parameters. */ -static void resume_copy_required_values(gnutls_session session) +static void resume_copy_required_values(gnutls_session_t session) { /* get the new random values */ memcpy(session->internals.resumed_security_parameters. @@ -122,13 +122,13 @@ static void resume_copy_required_values(gnutls_session session) session->internals.resumed_security_parameters.session_id_size; } -void _gnutls_set_server_random(gnutls_session session, uint8 * random) +void _gnutls_set_server_random(gnutls_session_t session, uint8 * random) { memcpy(session->security_parameters.server_random, random, TLS_RANDOM_SIZE); } -void _gnutls_set_client_random(gnutls_session session, uint8 * random) +void _gnutls_set_client_random(gnutls_session_t session, uint8 * random) { memcpy(session->security_parameters.client_random, random, TLS_RANDOM_SIZE); @@ -139,7 +139,7 @@ void _gnutls_set_client_random(gnutls_session session, uint8 * random) #define SSL3_CLIENT_MSG "CLNT" #define SSL3_SERVER_MSG "SRVR" #define SSL_MSG_LEN 4 -static int _gnutls_ssl3_finished(gnutls_session session, int type, +static int _gnutls_ssl3_finished(gnutls_session_t session, int type, opaque * ret) { const int siz = SSL_MSG_LEN; @@ -186,7 +186,7 @@ static int _gnutls_ssl3_finished(gnutls_session session, int type, #define SERVER_MSG "server finished" #define CLIENT_MSG "client finished" #define TLS_MSG_LEN 15 -int _gnutls_finished(gnutls_session session, int type, void *ret) +int _gnutls_finished(gnutls_session_t session, int type, void *ret) { const int siz = TLS_MSG_LEN; opaque concat[36]; @@ -255,16 +255,16 @@ int _gnutls_tls_create_random(opaque * dst) * or version 2.0 client hello (only for compatibility * since SSL version 2.0 is not supported). */ -int _gnutls_read_client_hello(gnutls_session session, opaque * data, +int _gnutls_read_client_hello(gnutls_session_t session, opaque * data, int datalen) { uint8 session_id_len, z; int pos = 0, ret; uint16 suite_size; - gnutls_protocol_version version; + gnutls_protocol_t version; int len = datalen; opaque random[TLS_RANDOM_SIZE], *suite_ptr; - gnutls_protocol_version ver; + gnutls_protocol_t ver; if (session->internals.v2_hello != 0) { /* version 2.0 */ return _gnutls_read_client_hello_v2(session, data, datalen); @@ -382,7 +382,7 @@ int _gnutls_read_client_hello(gnutls_session session, opaque * data, /* here we hash all pending data. */ -inline static int _gnutls_handshake_hash_pending(gnutls_session session) +inline static int _gnutls_handshake_hash_pending(gnutls_session_t session) { size_t siz; int ret; @@ -418,7 +418,7 @@ inline static int _gnutls_handshake_hash_pending(gnutls_session session) * and initializing encryption. This is the first encrypted message * we send. */ -int _gnutls_send_finished(gnutls_session session, int again) +int _gnutls_send_finished(gnutls_session_t session, int again) { uint8 data[36]; int ret; @@ -465,7 +465,7 @@ int _gnutls_send_finished(gnutls_session session, int again) /* This is to be called after sending our finished message. If everything * went fine we have negotiated a secure connection */ -int _gnutls_recv_finished(gnutls_session session) +int _gnutls_recv_finished(gnutls_session_t session) { uint8 data[36], *vrfy; int data_size; @@ -528,8 +528,8 @@ static int _gnutls_server_find_pk_algos_in_ciphersuites(const opaque * data, int datalen) { int j; - gnutls_pk_algorithm algo = GNUTLS_PK_NONE, prev_algo = 0; - gnutls_kx_algorithm kx; + gnutls_pk_algorithm_t algo = GNUTLS_PK_NONE, prev_algo = 0; + gnutls_kx_algorithm_t kx; cipher_suite_st cs; if (datalen % 2 != 0) { @@ -557,13 +557,13 @@ static int _gnutls_server_find_pk_algos_in_ciphersuites(const opaque * /* This selects the best supported ciphersuite from the given ones. Then * it adds the suite to the session and performs some checks. */ -int _gnutls_server_select_suite(gnutls_session session, opaque * data, +int _gnutls_server_select_suite(gnutls_session_t session, opaque * data, int datalen) { int x, i, j; cipher_suite_st *ciphers, cs; int retval, err; - gnutls_pk_algorithm pk_algo; /* will hold the pk algorithms + gnutls_pk_algorithm_t pk_algo; /* will hold the pk algorithms * supported by the peer. */ @@ -676,7 +676,7 @@ int _gnutls_server_select_suite(gnutls_session session, opaque * data, /* This selects the best supported compression method from the ones provided */ -int _gnutls_server_select_comp_method(gnutls_session session, +int _gnutls_server_select_comp_method(gnutls_session_t session, opaque * data, int datalen) { int x, i, j; @@ -689,12 +689,12 @@ int _gnutls_server_select_comp_method(gnutls_session session, } memset(&session->internals.compression_method, 0, - sizeof(gnutls_compression_method)); + sizeof(gnutls_compression_method_t)); for (j = 0; j < datalen; j++) { for (i = 0; i < x; i++) { if (comps[i] == data[j]) { - gnutls_compression_method method = + gnutls_compression_method_t method = _gnutls_compression_get_id(comps[i]); session->internals.compression_method = method; @@ -725,8 +725,8 @@ int _gnutls_server_select_comp_method(gnutls_session session, * GNUTLS_E_AGAIN or GNUTLS_E_INTERRUPTED, then it must be called again * (until it returns ok), with NULL parameters. */ -int _gnutls_send_empty_handshake(gnutls_session session, - HandshakeType type, int again) +int _gnutls_send_empty_handshake(gnutls_session_t session, + handshake_t type, int again) { opaque data = 0; opaque *ptr; @@ -743,8 +743,8 @@ int _gnutls_send_empty_handshake(gnutls_session session, /* This function will hash the handshake message we sent. */ static -int _gnutls_handshake_hash_add_sent(gnutls_session session, - HandshakeType type, opaque * dataptr, +int _gnutls_handshake_hash_add_sent(gnutls_session_t session, + handshake_t type, opaque * dataptr, uint32 datalen) { int ret; @@ -770,8 +770,8 @@ int _gnutls_handshake_hash_add_sent(gnutls_session session, * GNUTLS_E_AGAIN or GNUTLS_E_INTERRUPTED, then it must be called again * (until it returns ok), with NULL parameters. */ -int _gnutls_send_handshake(gnutls_session session, void *i_data, - uint32 i_datasize, HandshakeType type) +int _gnutls_send_handshake(gnutls_session_t session, void *i_data, + uint32 i_datasize, handshake_t type) { int ret; uint8 *data; @@ -840,9 +840,8 @@ int _gnutls_send_handshake(gnutls_session session, void *i_data, * FIXME: This function is complex. */ #define SSL2_HEADERS 1 -static int _gnutls_recv_handshake_header(gnutls_session session, - HandshakeType type, - HandshakeType * recv_type) +static int _gnutls_recv_handshake_header(gnutls_session_t session, + handshake_t type, handshake_t * recv_type) { int ret; uint32 length32 = 0; @@ -965,10 +964,9 @@ static int _gnutls_recv_handshake_header(gnutls_session session, * handshake data. */ static -int _gnutls_handshake_hash_add_recvd(gnutls_session session, - HandshakeType recv_type, - opaque * header, uint16 header_size, - opaque * dataptr, uint32 datalen) +int _gnutls_handshake_hash_add_recvd(gnutls_session_t session, + handshake_t recv_type, opaque * header, uint16 header_size, + opaque * dataptr, uint32 datalen) { int ret; @@ -1010,14 +1008,14 @@ int _gnutls_handshake_hash_add_recvd(gnutls_session session, * E.g. for the SERVER_HELLO message (if it is expected), it will be * passed to _gnutls_recv_hello(). */ -int _gnutls_recv_handshake(gnutls_session session, uint8 ** data, - int *datalen, HandshakeType type, +int _gnutls_recv_handshake(gnutls_session_t session, uint8 ** data, + int *datalen, handshake_t type, Optional optional) { int ret; uint32 length32 = 0; opaque *dataptr = NULL; - HandshakeType recv_type; + handshake_t recv_type; ret = _gnutls_recv_handshake_header(session, type, &recv_type); if (ret < 0) { @@ -1134,7 +1132,7 @@ int _gnutls_recv_handshake(gnutls_session session, uint8 ** data, /* This function checks if the given cipher suite is supported, and sets it * to the session; */ -static int _gnutls_client_set_ciphersuite(gnutls_session session, +static int _gnutls_client_set_ciphersuite(gnutls_session_t session, opaque suite[2]) { uint8 z; @@ -1210,7 +1208,7 @@ static int _gnutls_client_set_ciphersuite(gnutls_session session, /* This function sets the given comp method to the session. */ -static int _gnutls_client_set_comp_method(gnutls_session session, +static int _gnutls_client_set_comp_method(gnutls_session_t session, opaque comp_method) { int comp_methods_num; @@ -1249,7 +1247,7 @@ static int _gnutls_client_set_comp_method(gnutls_session session, * This also sets the variables in the session. Used only while reading a server * hello. */ -static int _gnutls_client_check_if_resuming(gnutls_session session, +static int _gnutls_client_check_if_resuming(gnutls_session_t session, opaque * session_id, int session_id_len) { @@ -1292,13 +1290,13 @@ static int _gnutls_client_check_if_resuming(gnutls_session session, * This function also restores resumed parameters if we are resuming a * session. */ -static int _gnutls_read_server_hello(gnutls_session session, opaque * data, +static int _gnutls_read_server_hello(gnutls_session_t session, opaque * data, int datalen) { uint8 session_id_len = 0; int pos = 0; int ret = 0; - gnutls_protocol_version version; + gnutls_protocol_t version; int len = datalen; if (datalen < 38) { @@ -1386,7 +1384,7 @@ static int _gnutls_read_server_hello(gnutls_session session, opaque * data, /* This function copies the appropriate ciphersuites to a locally allocated buffer * Needed in client hello messages. Returns the new data length. */ -static int _gnutls_copy_ciphersuites(gnutls_session session, +static int _gnutls_copy_ciphersuites(gnutls_session_t session, opaque * ret_data, size_t ret_data_size) { @@ -1451,7 +1449,7 @@ static int _gnutls_copy_ciphersuites(gnutls_session session, /* This function copies the appropriate compression methods, to a locally allocated buffer * Needed in hello messages. Returns the new data length. */ -static int _gnutls_copy_comp_methods(gnutls_session session, +static int _gnutls_copy_comp_methods(gnutls_session_t session, opaque * ret_data, size_t ret_data_size) { @@ -1495,14 +1493,14 @@ static int _gnutls_copy_comp_methods(gnutls_session session, /* This function sends the client hello handshake message. */ -static int _gnutls_send_client_hello(gnutls_session session, int again) +static int _gnutls_send_client_hello(gnutls_session_t session, int again) { opaque *data = NULL; int extdatalen; int pos = 0; int datalen = 0, ret = 0; opaque random[TLS_RANDOM_SIZE]; - gnutls_protocol_version hver; + gnutls_protocol_t hver; opaque extdata[MAX_EXT_DATA_LENGTH]; opaque *SessionID = @@ -1660,7 +1658,7 @@ static int _gnutls_send_client_hello(gnutls_session session, int again) return ret; } -static int _gnutls_send_server_hello(gnutls_session session, int again) +static int _gnutls_send_server_hello(gnutls_session_t session, int again) { opaque *data = NULL; opaque extdata[MAX_EXT_DATA_LENGTH]; @@ -1766,7 +1764,7 @@ static int _gnutls_send_server_hello(gnutls_session session, int again) return ret; } -int _gnutls_send_hello(gnutls_session session, int again) +int _gnutls_send_hello(gnutls_session_t session, int again) { int ret; @@ -1784,7 +1782,7 @@ int _gnutls_send_hello(gnutls_session session, int again) * hello message is expected. It uses the security_parameters.current_cipher_suite * and internals.compression_method. */ -int _gnutls_recv_hello(gnutls_session session, opaque * data, int datalen) +int _gnutls_recv_hello(gnutls_session_t session, opaque * data, int datalen) { int ret; @@ -1831,7 +1829,7 @@ int _gnutls_recv_hello(gnutls_session session, opaque * data, int datalen) /** * gnutls_rehandshake - This function will renegotiate security parameters - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function will renegotiate security parameters with the * client. This should only be called in case of a server. @@ -1850,7 +1848,7 @@ int _gnutls_recv_hello(gnutls_session session, opaque * data, int datalen) * this message. * **/ -int gnutls_rehandshake(gnutls_session session) +int gnutls_rehandshake(gnutls_session_t session) { int ret; @@ -1872,7 +1870,7 @@ int gnutls_rehandshake(gnutls_session session) return 0; } -inline static int _gnutls_abort_handshake(gnutls_session session, int ret) +inline static int _gnutls_abort_handshake(gnutls_session_t session, int ret) { if (((ret == GNUTLS_E_WARNING_ALERT_RECEIVED) && (gnutls_alert_get(session) == GNUTLS_A_NO_RENEGOTIATION)) @@ -1887,7 +1885,7 @@ inline static int _gnutls_abort_handshake(gnutls_session session, int ret) /* This function initialized the handshake hash session. * required for finished messages. */ -inline static int _gnutls_handshake_hash_init(gnutls_session session) +inline static int _gnutls_handshake_hash_init(gnutls_session_t session) { if (session->internals.handshake_mac_handle_md5 == NULL) { @@ -1916,7 +1914,7 @@ inline static int _gnutls_handshake_hash_init(gnutls_session session) /** * gnutls_handshake - This is the main function in the handshake protocol. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function does the handshake of the TLS/SSL protocol, * and initializes the TLS connection. @@ -1938,7 +1936,7 @@ inline static int _gnutls_handshake_hash_init(gnutls_session session) * rejected the rehandshake request. * **/ -int gnutls_handshake(gnutls_session session) +int gnutls_handshake(gnutls_session_t session) { int ret; @@ -2007,7 +2005,7 @@ int gnutls_handshake(gnutls_session session) * _gnutls_handshake_client * This function performs the client side of the handshake of the TLS/SSL protocol. */ -int _gnutls_handshake_client(gnutls_session session) +int _gnutls_handshake_client(gnutls_session_t session) { int ret = 0; @@ -2108,7 +2106,7 @@ int _gnutls_handshake_client(gnutls_session session) /* This function sends the final handshake packets and initializes connection */ -static int _gnutls_send_handshake_final(gnutls_session session, int init) +static int _gnutls_send_handshake_final(gnutls_session_t session, int init) { int ret = 0; @@ -2163,7 +2161,7 @@ static int _gnutls_send_handshake_final(gnutls_session session, int init) * And executes the appropriate function to initialize the * read session. */ -static int _gnutls_recv_handshake_final(gnutls_session session, int init) +static int _gnutls_recv_handshake_final(gnutls_session_t session, int init) { int ret = 0; uint8 ch; @@ -2218,7 +2216,7 @@ static int _gnutls_recv_handshake_final(gnutls_session session, int init) * This function does the server stuff of the handshake protocol. */ -int _gnutls_handshake_server(gnutls_session session) +int _gnutls_handshake_server(gnutls_session_t session) { int ret = 0; @@ -2304,7 +2302,7 @@ int _gnutls_handshake_server(gnutls_session session) return 0; } -int _gnutls_handshake_common(gnutls_session session) +int _gnutls_handshake_common(gnutls_session_t session) { int ret = 0; @@ -2354,7 +2352,7 @@ int _gnutls_generate_session_id(opaque * session_id, uint8 * len) return 0; } -int _gnutls_recv_hello_request(gnutls_session session, void *data, +int _gnutls_recv_hello_request(gnutls_session_t session, void *data, uint32 data_size) { uint8 type; @@ -2379,16 +2377,16 @@ int _gnutls_recv_hello_request(gnutls_session session, void *data, /* Returns 1 if the given KX has not the corresponding parameters * (DH or RSA) set up. Otherwise returns 0. */ -inline static int check_server_params(gnutls_session session, - gnutls_kx_algorithm kx, - gnutls_kx_algorithm * alg, +inline static int check_server_params(gnutls_session_t session, + gnutls_kx_algorithm_t kx, + gnutls_kx_algorithm_t * alg, int alg_size) { int cred_type; - const gnutls_certificate_credentials x509_cred; - const gnutls_anon_server_credentials anon_cred; - gnutls_dh_params dh_params = NULL; - gnutls_rsa_params rsa_params = NULL; + const gnutls_certificate_credentials_t x509_cred; + const gnutls_anon_server_credentials_t anon_cred; + gnutls_dh_params_t dh_params = NULL; + gnutls_rsa_params_t rsa_params = NULL; int j, remove; cred_type = _gnutls_map_kx_get_cred(kx, 1); @@ -2456,21 +2454,21 @@ inline static int check_server_params(gnutls_session session, * This does a more high level check than gnutls_supported_ciphersuites(), * by checking certificates etc. */ -int _gnutls_remove_unwanted_ciphersuites(gnutls_session session, +int _gnutls_remove_unwanted_ciphersuites(gnutls_session_t session, cipher_suite_st ** cipherSuites, int numCipherSuites, - gnutls_pk_algorithm + gnutls_pk_algorithm_t requested_pk_algo) { int ret = 0; cipher_suite_st *newSuite, cs; int newSuiteSize = 0, i, remove; - const gnutls_certificate_credentials x509_cred; - gnutls_kx_algorithm kx; + const gnutls_certificate_credentials_t x509_cred; + gnutls_kx_algorithm_t kx; int server = session->security_parameters.entity == GNUTLS_SERVER ? 1 : 0; - gnutls_kx_algorithm *alg; + gnutls_kx_algorithm_t *alg; int alg_size; /* if we should use a specific certificate, @@ -2564,7 +2562,7 @@ int _gnutls_remove_unwanted_ciphersuites(gnutls_session session, /** * gnutls_handshake_set_max_packet_length - This function will set the maximum length of a handshake message - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @max: is the maximum number. * * This function will set the maximum size of a handshake message. @@ -2573,20 +2571,20 @@ int _gnutls_remove_unwanted_ciphersuites(gnutls_session session, * to set an upper limit. * **/ -void gnutls_handshake_set_max_packet_length(gnutls_session session, +void gnutls_handshake_set_max_packet_length(gnutls_session_t session, int max) { session->internals.max_handshake_data_buffer_size = max; } -void _gnutls_set_adv_version(gnutls_session session, - gnutls_protocol_version ver) +void _gnutls_set_adv_version(gnutls_session_t session, + gnutls_protocol_t ver) { set_adv_version(session, _gnutls_version_get_major(ver), _gnutls_version_get_minor(ver)); } -gnutls_protocol_version _gnutls_get_adv_version(gnutls_session session) +gnutls_protocol_t _gnutls_get_adv_version(gnutls_session_t session) { return _gnutls_version_get(_gnutls_get_adv_version_major(session), _gnutls_get_adv_version_minor(session)); @@ -2594,7 +2592,7 @@ gnutls_protocol_version _gnutls_get_adv_version(gnutls_session session) /** * gnutls_handshake_get_last_in - Returns the last handshake message received. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the last handshake message received. This function is only useful * to check where the last performed handshake failed. If the previous handshake @@ -2602,15 +2600,14 @@ gnutls_protocol_version _gnutls_get_adv_version(gnutls_session session) * * Check gnutls.h for the available handshake descriptions. **/ -gnutls_handshake_description gnutls_handshake_get_last_in(gnutls_session - session) +gnutls_handshake_description_t gnutls_handshake_get_last_in(gnutls_session_t session) { return session->internals.last_handshake_in; } /** * gnutls_handshake_get_last_out - Returns the last handshake message sent. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the last handshake message sent. This function is only useful * to check where the last performed handshake failed. If the previous handshake @@ -2619,8 +2616,7 @@ gnutls_handshake_description gnutls_handshake_get_last_in(gnutls_session * Check gnutls.h for the available handshake descriptions. * **/ -gnutls_handshake_description gnutls_handshake_get_last_out(gnutls_session - session) +gnutls_handshake_description_t gnutls_handshake_get_last_out(gnutls_session_t session) { return session->internals.last_handshake_out; } diff --git a/lib/gnutls_handshake.h b/lib/gnutls_handshake.h index 52bb61dc9d..a93d5a71dc 100644 --- a/lib/gnutls_handshake.h +++ b/lib/gnutls_handshake.h @@ -20,31 +20,31 @@ typedef enum Optional { OPTIONAL_PACKET, MANDATORY_PACKET } Optional; -int _gnutls_send_handshake(gnutls_session session, void *i_data, - uint32 i_datasize, HandshakeType type); -int gnutls_send_hello_request(gnutls_session session); -int _gnutls_recv_hello_request(gnutls_session session, void *data, +int _gnutls_send_handshake(gnutls_session_t session, void *i_data, + uint32 i_datasize, handshake_t type); +int gnutls_send_hello_request(gnutls_session_t session); +int _gnutls_recv_hello_request(gnutls_session_t session, void *data, uint32 data_size); -int _gnutls_send_hello(gnutls_session session, int again); -int _gnutls_recv_hello(gnutls_session session, opaque * data, int datalen); -int gnutls_handshake(gnutls_session session); -int _gnutls_recv_handshake(gnutls_session session, uint8 **, int *, - HandshakeType, Optional optional); +int _gnutls_send_hello(gnutls_session_t session, int again); +int _gnutls_recv_hello(gnutls_session_t session, opaque * data, int datalen); +int gnutls_handshake(gnutls_session_t session); +int _gnutls_recv_handshake(gnutls_session_t session, uint8 **, int *, + handshake_t, Optional optional); int _gnutls_generate_session_id(opaque * session_id, uint8 * len); -int _gnutls_handshake_common(gnutls_session session); -int _gnutls_handshake_client(gnutls_session session); -int _gnutls_handshake_server(gnutls_session session); -void _gnutls_set_server_random(gnutls_session session, uint8 * random); -void _gnutls_set_client_random(gnutls_session session, uint8 * random); +int _gnutls_handshake_common(gnutls_session_t session); +int _gnutls_handshake_client(gnutls_session_t session); +int _gnutls_handshake_server(gnutls_session_t session); +void _gnutls_set_server_random(gnutls_session_t session, uint8 * random); +void _gnutls_set_client_random(gnutls_session_t session, uint8 * random); int _gnutls_tls_create_random(opaque * dst); -int _gnutls_remove_unwanted_ciphersuites(gnutls_session session, +int _gnutls_remove_unwanted_ciphersuites(gnutls_session_t session, cipher_suite_st ** cipherSuites, int numCipherSuites, - gnutls_pk_algorithm); -void gnutls_handshake_set_max_packet_length(gnutls_session session, + gnutls_pk_algorithm_t); +void gnutls_handshake_set_max_packet_length(gnutls_session_t session, int max); int _gnutls_find_pk_algos_in_ciphersuites(opaque * data, int datalen); -int _gnutls_server_select_suite(gnutls_session session, opaque * data, +int _gnutls_server_select_suite(gnutls_session_t session, opaque * data, int datalen); #define STATE session->internals.handshake_state diff --git a/lib/gnutls_hash_int.c b/lib/gnutls_hash_int.c index af09e431e1..81872edb2a 100644 --- a/lib/gnutls_hash_int.c +++ b/lib/gnutls_hash_int.c @@ -29,12 +29,12 @@ #include <gnutls_hash_int.h> #include <gnutls_errors.h> -GNUTLS_HASH_HANDLE _gnutls_hash_init(gnutls_mac_algorithm algorithm) +GNUTLS_HASH_HANDLE _gnutls_hash_init(gnutls_mac_algorithm_t algorithm) { mac_hd_t ret; gcry_error_t result; - ret = gnutls_malloc(sizeof(mac_hd_t_INT)); + ret = gnutls_malloc(sizeof(mac_hd_st)); if (ret == NULL) { gnutls_assert(); return GNUTLS_HASH_FAILED; @@ -66,7 +66,7 @@ GNUTLS_HASH_HANDLE _gnutls_hash_init(gnutls_mac_algorithm algorithm) return ret; } -int _gnutls_hash_get_algo_len(gnutls_mac_algorithm algorithm) +int _gnutls_hash_get_algo_len(gnutls_mac_algorithm_t algorithm) { int ret; @@ -102,7 +102,7 @@ GNUTLS_HASH_HANDLE _gnutls_hash_copy(GNUTLS_HASH_HANDLE handle) GNUTLS_HASH_HANDLE ret; gcry_error_t result; - ret = gnutls_malloc(sizeof(mac_hd_t_INT)); + ret = gnutls_malloc(sizeof(mac_hd_st)); if (ret == NULL) return GNUTLS_HASH_FAILED; @@ -139,13 +139,13 @@ void _gnutls_hash_deinit(GNUTLS_HASH_HANDLE handle, void *digest) } -mac_hd_t _gnutls_hmac_init(gnutls_mac_algorithm algorithm, +mac_hd_t _gnutls_hmac_init(gnutls_mac_algorithm_t algorithm, const void *key, int keylen) { mac_hd_t ret; gcry_error_t result; - ret = gnutls_malloc(sizeof(mac_hd_t_INT)); + ret = gnutls_malloc(sizeof(mac_hd_st)); if (ret == NULL) return GNUTLS_MAC_FAILED; @@ -200,7 +200,7 @@ void _gnutls_hmac_deinit(mac_hd_t handle, void *digest) gnutls_free(handle); } -inline static int get_padsize(gnutls_mac_algorithm algorithm) +inline static int get_padsize(gnutls_mac_algorithm_t algorithm) { switch (algorithm) { case GNUTLS_MAC_MD5: @@ -212,7 +212,7 @@ inline static int get_padsize(gnutls_mac_algorithm algorithm) } } -mac_hd_t _gnutls_mac_init_ssl3(gnutls_mac_algorithm algorithm, void *key, +mac_hd_t _gnutls_mac_init_ssl3(gnutls_mac_algorithm_t algorithm, void *key, int keylen) { mac_hd_t ret; diff --git a/lib/gnutls_hash_int.h b/lib/gnutls_hash_int.h index 2e626c9f8e..caa989bf21 100644 --- a/lib/gnutls_hash_int.h +++ b/lib/gnutls_hash_int.h @@ -27,28 +27,28 @@ typedef struct { gcry_md_hd_t handle; - gnutls_mac_algorithm algorithm; + gnutls_mac_algorithm_t algorithm; const void *key; int keysize; -} mac_hd_t_INT; -typedef mac_hd_t_INT *mac_hd_t; +} mac_hd_st; +typedef mac_hd_st *mac_hd_t; typedef mac_hd_t GNUTLS_HASH_HANDLE; #define GNUTLS_HASH_FAILED NULL #define GNUTLS_MAC_FAILED NULL -mac_hd_t _gnutls_hmac_init(gnutls_mac_algorithm algorithm, const void *key, +mac_hd_t _gnutls_hmac_init(gnutls_mac_algorithm_t algorithm, const void *key, int keylen); #define _gnutls_hmac_get_algo_len _gnutls_hash_get_algo_len #define _gnutls_hmac _gnutls_hash void _gnutls_hmac_deinit(mac_hd_t handle, void *digest); -mac_hd_t _gnutls_mac_init_ssl3(gnutls_mac_algorithm algorithm, void *key, +mac_hd_t _gnutls_mac_init_ssl3(gnutls_mac_algorithm_t algorithm, void *key, int keylen); void _gnutls_mac_deinit_ssl3(mac_hd_t handle, void *digest); -GNUTLS_HASH_HANDLE _gnutls_hash_init(gnutls_mac_algorithm algorithm); -int _gnutls_hash_get_algo_len(gnutls_mac_algorithm algorithm); +GNUTLS_HASH_HANDLE _gnutls_hash_init(gnutls_mac_algorithm_t algorithm); +int _gnutls_hash_get_algo_len(gnutls_mac_algorithm_t algorithm); int _gnutls_hash(GNUTLS_HASH_HANDLE handle, const void *text, size_t textlen); void _gnutls_hash_deinit(GNUTLS_HASH_HANDLE handle, void *digest); diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index 8f7e13dbc5..525dae2159 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -41,7 +41,7 @@ /* It might be a good idea to replace int with void* * here. */ -typedef void *gnutls_transport_ptr; +typedef void *gnutls_transport_ptr_t; #define MAX32 4294967295 #define MAX24 16777215 @@ -107,12 +107,11 @@ typedef struct { typedef struct { opaque *data; unsigned int size; -} gnutls_datum; +} gnutls_datum_t; #include <gnutls_mpi.h> -typedef enum ChangeCipherSpecType { GNUTLS_TYPE_CHANGE_CIPHER_SPEC = - 1 } ChangeCipherSpecType; +typedef enum change_cipher_spec_t { GNUTLS_TYPE_CHANGE_CIPHER_SPEC = 1 } change_cipher_spec_t; typedef enum gnutls_certificate_status { GNUTLS_CERT_INVALID = 2, /* will be set if the certificate @@ -127,35 +126,35 @@ typedef enum gnutls_certificate_status { */ GNUTLS_CERT_SIGNER_NOT_FOUND = 64, GNUTLS_CERT_SIGNER_NOT_CA = 128 -} gnutls_certificate_status; +} gnutls_certificate_status_t; typedef enum gnutls_certificate_request { GNUTLS_CERT_IGNORE, - GNUTLS_CERT_REQUEST = - 1, GNUTLS_CERT_REQUIRE } gnutls_certificate_request; + GNUTLS_CERT_REQUEST = 1, GNUTLS_CERT_REQUIRE +} gnutls_certificate_request_t; typedef enum gnutls_openpgp_key_status { GNUTLS_OPENPGP_KEY, GNUTLS_OPENPGP_KEY_FINGERPRINT -} gnutls_openpgp_key_status; +} gnutls_openpgp_key_status_t; -typedef enum gnutls_close_request { +typedef enum gnutls_close_request_t { GNUTLS_SHUT_RDWR = 0, GNUTLS_SHUT_WR = 1 -} gnutls_close_request; +} gnutls_close_request_t; -typedef enum HandshakeState { STATE0 = 0, STATE1, STATE2, +typedef enum handshake_state_t { STATE0 = 0, STATE1, STATE2, STATE3, STATE4, STATE5, STATE6, STATE7, STATE8, STATE9, STATE20 = 20, STATE21, STATE30 = 30, STATE31, STATE50 = 50, STATE60 = 60, STATE61, STATE62 -} HandshakeState; +} handshake_state_t; -typedef enum HandshakeType { GNUTLS_HELLO_REQUEST, +typedef enum handshake_t { GNUTLS_HELLO_REQUEST, GNUTLS_CLIENT_HELLO, GNUTLS_SERVER_HELLO, GNUTLS_CERTIFICATE_PKT = 11, GNUTLS_SERVER_KEY_EXCHANGE, GNUTLS_CERTIFICATE_REQUEST, GNUTLS_SERVER_HELLO_DONE, GNUTLS_CERTIFICATE_VERIFY, GNUTLS_CLIENT_KEY_EXCHANGE, GNUTLS_FINISHED = 20 -} HandshakeType; +} handshake_t; -typedef HandshakeType gnutls_handshake_description; +typedef handshake_t gnutls_handshake_description_t; #include <gnutls_buffer.h> @@ -166,38 +165,37 @@ typedef HandshakeType gnutls_handshake_description; #define MAX_CIPHERSUITES 256 -/* STATE */ typedef enum gnutls_cipher_algorithm { GNUTLS_CIPHER_NULL = 1, GNUTLS_CIPHER_ARCFOUR_128, GNUTLS_CIPHER_3DES_CBC, GNUTLS_CIPHER_AES_128_CBC, GNUTLS_CIPHER_AES_256_CBC, GNUTLS_CIPHER_ARCFOUR_40, GNUTLS_CIPHER_RC2_40_CBC = 90, GNUTLS_CIPHER_DES_CBC -} gnutls_cipher_algorithm; +} gnutls_cipher_algorithm_t; typedef enum gnutls_kx_algorithm { GNUTLS_KX_RSA = 1, GNUTLS_KX_DHE_DSS, GNUTLS_KX_DHE_RSA, GNUTLS_KX_ANON_DH, GNUTLS_KX_SRP, GNUTLS_KX_RSA_EXPORT, GNUTLS_KX_SRP_RSA, GNUTLS_KX_SRP_DSS -} gnutls_kx_algorithm; +} gnutls_kx_algorithm_t; typedef enum gnutls_params_type { GNUTLS_PARAMS_RSA_EXPORT = 1, GNUTLS_PARAMS_DH -} gnutls_params_type; +} gnutls_params_type_t; typedef enum gnutls_mac_algorithm { GNUTLS_MAC_UNKNOWN = 0, GNUTLS_MAC_NULL = 1, GNUTLS_MAC_MD5, GNUTLS_MAC_SHA, GNUTLS_MAC_RMD160 -} gnutls_mac_algorithm; -typedef gnutls_mac_algorithm gnutls_digest_algorithm; +} gnutls_mac_algorithm_t; +typedef gnutls_mac_algorithm_t gnutls_digest_algorithm_t; typedef enum gnutls_compression_method { GNUTLS_COMP_NULL = 1, GNUTLS_COMP_DEFLATE, GNUTLS_COMP_LZO -} gnutls_compression_method; +} gnutls_compression_method_t; typedef enum gnutls_connection_end { GNUTLS_SERVER = 1, GNUTLS_CLIENT -} gnutls_connection_end; +} gnutls_connection_end_t; typedef enum extensions_t { GNUTLS_EXTENSION_SERVER_NAME = 0, GNUTLS_EXTENSION_MAX_RECORD_SIZE = 1, GNUTLS_EXTENSION_SRP = 6, @@ -207,11 +205,11 @@ typedef enum extensions_t { GNUTLS_EXTENSION_SERVER_NAME = 0, typedef enum gnutls_credentials_type { GNUTLS_CRD_CERTIFICATE = 1, GNUTLS_CRD_ANON, GNUTLS_CRD_SRP -} gnutls_credentials_type; +} gnutls_credentials_type_t; typedef enum gnutls_certificate_type { GNUTLS_CRT_X509 = 1, GNUTLS_CRT_OPENPGP -} gnutls_certificate_type; +} gnutls_certificate_type_t; typedef enum { CIPHER_STREAM, CIPHER_BLOCK } cipher_type_t; @@ -227,21 +225,21 @@ typedef enum content_type_t { typedef enum gnutls_x509_crt_fmt { GNUTLS_X509_FMT_DER, GNUTLS_X509_FMT_PEM -} gnutls_x509_crt_fmt; +} gnutls_x509_crt_fmt_t; typedef enum gnutls_pk_algorithm { GNUTLS_PK_RSA = 1, GNUTLS_PK_DSA, GNUTLS_PK_UNKNOWN = 0xff -} gnutls_pk_algorithm; +} gnutls_pk_algorithm_t; -#define GNUTLS_PK_ANY (gnutls_pk_algorithm)-1 -#define GNUTLS_PK_NONE (gnutls_pk_algorithm)0 +#define GNUTLS_PK_ANY (gnutls_pk_algorithm_t)-1 +#define GNUTLS_PK_NONE (gnutls_pk_algorithm_t)0 typedef enum gnutls_sign_algorithm { GNUTLS_SIGN_RSA_SHA = 1, GNUTLS_SIGN_DSA_SHA, GNUTLS_SIGN_RSA_MD5, GNUTLS_SIGN_RSA_MD2, GNUTLS_SIGN_UNKNOWN = 0xff -} gnutls_sign_algorithm; +} gnutls_sign_algorithm_t; /* STATE (stop) */ @@ -249,20 +247,20 @@ typedef void (*LOG_FUNC) (int, const char *); /* Pull & Push functions defines: */ -typedef ssize_t(*gnutls_pull_func) (gnutls_transport_ptr, void *, size_t); -typedef ssize_t(*gnutls_push_func) (gnutls_transport_ptr, const void *, - size_t); +typedef ssize_t(*gnutls_pull_func) (gnutls_transport_ptr_t, void *, size_t); +typedef ssize_t(*gnutls_push_func) (gnutls_transport_ptr_t, const void *, + size_t); /* Store & Retrieve functions defines: */ -typedef int (*gnutls_db_store_func) (void *, gnutls_datum key, - gnutls_datum data); -typedef int (*gnutls_db_remove_func) (void *, gnutls_datum key); -typedef gnutls_datum(*gnutls_db_retr_func) (void *, gnutls_datum key); +typedef int (*gnutls_db_store_func) (void *, gnutls_datum_t key, + gnutls_datum_t data); +typedef int (*gnutls_db_remove_func) (void *, gnutls_datum_t key); +typedef gnutls_datum_t(*gnutls_db_retr_func) (void *, gnutls_datum_t key); typedef struct auth_cred_st { - gnutls_credentials_type algorithm; + gnutls_credentials_type_t algorithm; /* the type of credentials depends on algorithm */ @@ -273,7 +271,7 @@ typedef struct auth_cred_st { struct gnutls_key_st { /* For DH KX */ - gnutls_datum key; + gnutls_datum_t key; mpi_t KEY; mpi_t client_Y; mpi_t client_g; @@ -297,7 +295,7 @@ struct gnutls_key_st { * Rememember that this should be calloced! */ void *auth_info; - gnutls_credentials_type auth_info_type; + gnutls_credentials_type_t auth_info_type; int auth_info_size; /* needed in order to store to db for restoring */ uint8 crypt_algo; @@ -335,20 +333,20 @@ typedef struct { typedef enum gnutls_protocol_version { GNUTLS_SSL3 = 1, GNUTLS_TLS1_0, GNUTLS_TLS1_1, GNUTLS_VERSION_UNKNOWN = 0xff -} gnutls_protocol_version; +} gnutls_protocol_t; /* This structure holds parameters got from TLS extension * mechanism. (some extensions may hold parameters in auth_info_t * structures also - see SRP). */ -typedef enum gnutls_server_name_type { GNUTLS_NAME_DNS = 1 -} gnutls_server_name_type; +typedef enum { GNUTLS_NAME_DNS = 1 +} gnutls_server_name_type_t; typedef struct { opaque name[MAX_SERVER_NAME_SIZE]; uint name_length; - gnutls_server_name_type type; + gnutls_server_name_type_t type; } server_name_st; #define MAX_SERVER_NAME_EXTENSIONS 3 @@ -379,19 +377,19 @@ typedef struct { * the handshake is in progress is the cipher suite value. */ typedef struct { - gnutls_connection_end entity; - gnutls_kx_algorithm kx_algorithm; + gnutls_connection_end_t entity; + gnutls_kx_algorithm_t kx_algorithm; /* we've got separate write/read bulk/macs because * there is a time in handshake where the peer has * null cipher and we don't */ - gnutls_cipher_algorithm read_bulk_cipher_algorithm; - gnutls_mac_algorithm read_mac_algorithm; - gnutls_compression_method read_compression_algorithm; + gnutls_cipher_algorithm_t read_bulk_cipher_algorithm; + gnutls_mac_algorithm_t read_mac_algorithm; + gnutls_compression_method_t read_compression_algorithm; - gnutls_cipher_algorithm write_bulk_cipher_algorithm; - gnutls_mac_algorithm write_mac_algorithm; - gnutls_compression_method write_compression_algorithm; + gnutls_cipher_algorithm_t write_bulk_cipher_algorithm; + gnutls_mac_algorithm_t write_mac_algorithm; + gnutls_compression_method_t write_compression_algorithm; /* this is the ciphersuite we are going to use * moved here from internals in order to be restored @@ -412,19 +410,19 @@ typedef struct { uint16 max_record_send_size; uint16 max_record_recv_size; /* holds the negotiated certificate type */ - gnutls_certificate_type cert_type; - gnutls_protocol_version version; /* moved here */ + gnutls_certificate_type_t cert_type; + gnutls_protocol_t version; /* moved here */ } security_parameters_st; /* This structure holds the generated keys */ typedef struct { - gnutls_datum server_write_mac_secret; - gnutls_datum client_write_mac_secret; - gnutls_datum server_write_IV; - gnutls_datum client_write_IV; - gnutls_datum server_write_key; - gnutls_datum client_write_key; + gnutls_datum_t server_write_mac_secret; + gnutls_datum_t client_write_mac_secret; + gnutls_datum_t server_write_IV; + gnutls_datum_t client_write_IV; + gnutls_datum_t server_write_key; + gnutls_datum_t client_write_key; int generated_keys; /* zero if keys have not * been generated. Non zero * otherwise. @@ -437,8 +435,8 @@ typedef struct { cipher_hd_t read_cipher_state; comp_hd_t read_compression_state; comp_hd_t write_compression_state; - gnutls_datum read_mac_secret; - gnutls_datum write_mac_secret; + gnutls_datum_t read_mac_secret; + gnutls_datum_t write_mac_secret; uint64 read_sequence_number; uint64 write_sequence_number; } conn_stat_st; @@ -457,24 +455,24 @@ typedef struct { mpi_t params[2]; } dh_params_st; -#define gnutls_dh_params dh_params_st* +#define gnutls_dh_params_t dh_params_st* -#define gnutls_rsa_params gnutls_x509_privkey +#define gnutls_rsa_params_t gnutls_x509_privkey_t typedef struct { - gnutls_dh_params anon_dh_params; + gnutls_dh_params_t anon_dh_params; int free_anon_dh_params; - gnutls_dh_params cert_dh_params; + gnutls_dh_params_t cert_dh_params; int free_cert_dh_params; - gnutls_rsa_params rsa_params; + gnutls_rsa_params_t rsa_params; int free_rsa_params; } internal_params_st; typedef struct gnutls_params_st { - gnutls_params_type type; + gnutls_params_type_t type; union params { - gnutls_dh_params dh; - gnutls_rsa_params rsa_export; + gnutls_dh_params_t dh; + gnutls_rsa_params_t rsa_export; } params; int deinit; } gnutls_params_st; @@ -487,14 +485,14 @@ typedef struct { size_t header_size; /* this holds the length of the handshake packet */ size_t packet_length; - HandshakeType recv_type; + handshake_t recv_type; } handshake_header_buffer_st; /* Openpgp key retrieval callback */ typedef int (*gnutls_openpgp_recv_key_func) (struct gnutls_session_int *, const unsigned char *keyfpr, unsigned int keyfpr_length, - gnutls_datum *); + gnutls_datum_t *); typedef struct { gnutls_buffer application_data_buffer; /* holds data to be delivered to application layer */ @@ -505,7 +503,7 @@ typedef struct { gnutls_buffer handshake_data_buffer; /* this is a buffer that holds the current handshake message */ resumable_session_t resumable; /* TRUE or FALSE - if we can resume that session */ - HandshakeState handshake_state; /* holds + handshake_state_t handshake_state; /* holds * a number which indicates where * the handshake procedure has been * interrupted. If it is 0 then @@ -527,7 +525,7 @@ typedef struct { int last_handshake_out; /* this is the compression method we are going to use */ - gnutls_compression_method compression_method; + gnutls_compression_method_t compression_method; /* priorities */ priority_st cipher_algorithm_priority; priority_st mac_algorithm_priority; @@ -549,9 +547,9 @@ typedef struct { gnutls_buffer handshake_send_buffer; size_t handshake_send_buffer_prev_size; content_type_t handshake_send_buffer_type; - HandshakeType handshake_send_buffer_htype; + handshake_t handshake_send_buffer_htype; content_type_t handshake_recv_buffer_type; - HandshakeType handshake_recv_buffer_htype; + handshake_t handshake_recv_buffer_htype; gnutls_buffer handshake_recv_buffer; /* this buffer holds a record packet -mostly used for @@ -612,8 +610,8 @@ typedef struct { /* Holds the first argument of PUSH and PULL * functions; */ - gnutls_transport_ptr transport_recv_ptr; - gnutls_transport_ptr transport_send_ptr; + gnutls_transport_ptr_t transport_recv_ptr; + gnutls_transport_ptr_t transport_send_ptr; /* STORE & RETRIEVE functions. Only used if other * backend than gdbm is used. @@ -699,7 +697,7 @@ typedef struct { /* This buffer is used by the record recv functions, * as a temporary store buffer. */ - gnutls_datum recv_buffer; + gnutls_datum_t recv_buffer; /* If you add anything here, check _gnutls_handshake_internal_state_clear(). */ @@ -713,17 +711,16 @@ struct gnutls_session_int { gnutls_key_st key; }; -typedef struct gnutls_session_int *gnutls_session; +typedef struct gnutls_session_int *gnutls_session_t; /* functions */ -void _gnutls_set_current_version(gnutls_session session, - gnutls_protocol_version version); -gnutls_protocol_version gnutls_protocol_get_version(gnutls_session - session); -void _gnutls_free_auth_info(gnutls_session session); +void _gnutls_set_current_version(gnutls_session_t session, + gnutls_protocol_t version); +gnutls_protocol_t gnutls_protocol_get_version(gnutls_session_t session); +void _gnutls_free_auth_info(gnutls_session_t session); /* These two macros return the advertized TLS version of * the peer. @@ -738,14 +735,14 @@ void _gnutls_free_auth_info(gnutls_session session); session->internals.adv_version_major = major; \ session->internals.adv_version_minor = minor -void _gnutls_set_adv_version(gnutls_session, gnutls_protocol_version); -gnutls_protocol_version _gnutls_get_adv_version(gnutls_session); +void _gnutls_set_adv_version(gnutls_session_t, gnutls_protocol_t); +gnutls_protocol_t _gnutls_get_adv_version(gnutls_session_t); -int gnutls_fingerprint(gnutls_digest_algorithm algo, - const gnutls_datum * data, void *result, - size_t * result_size); +int gnutls_fingerprint(gnutls_digest_algorithm_t algo, + const gnutls_datum_t * data, void *result, + size_t * result_size); -typedef int gnutls_params_function(gnutls_session, gnutls_params_type, - gnutls_params_st *); +typedef int gnutls_params_function(gnutls_session_t, gnutls_params_type_t, + gnutls_params_st *); #endif /* GNUTLS_INT_H */ diff --git a/lib/gnutls_kx.c b/lib/gnutls_kx.c index 0de4eaff99..69330cf58d 100644 --- a/lib/gnutls_kx.c +++ b/lib/gnutls_kx.c @@ -41,9 +41,9 @@ */ #define MASTER_SECRET "master secret" -static int generate_normal_master(gnutls_session session, int); +static int generate_normal_master(gnutls_session_t session, int); -int _gnutls_generate_master(gnutls_session session, int keep_premaster) +int _gnutls_generate_master(gnutls_session_t session, int keep_premaster) { if (session->internals.resumed == RESUME_FALSE) return generate_normal_master(session, keep_premaster); @@ -53,7 +53,7 @@ int _gnutls_generate_master(gnutls_session session, int keep_premaster) /* here we generate the TLS Master secret. */ #define PREMASTER session->key->key -static int generate_normal_master(gnutls_session session, +static int generate_normal_master(gnutls_session_t session, int keep_premaster) { int ret = 0; @@ -110,7 +110,7 @@ static int generate_normal_master(gnutls_session session, * server. It does nothing if this type of message is not required * by the selected ciphersuite. */ -int _gnutls_send_server_kx_message(gnutls_session session, int again) +int _gnutls_send_server_kx_message(gnutls_session_t session, int again) { uint8 *data = NULL; int data_size = 0; @@ -153,7 +153,7 @@ int _gnutls_send_server_kx_message(gnutls_session session, int again) /* This function sends a certificate request message to the * client. */ -int _gnutls_send_server_certificate_request(gnutls_session session, +int _gnutls_send_server_certificate_request(gnutls_session_t session, int again) { uint8 *data = NULL; @@ -196,7 +196,7 @@ int _gnutls_send_server_certificate_request(gnutls_session session, /* This is the function for the client to send the key * exchange message */ -int _gnutls_send_client_kx_message(gnutls_session session, int again) +int _gnutls_send_client_kx_message(gnutls_session_t session, int again) { uint8 *data; int data_size; @@ -235,7 +235,7 @@ int _gnutls_send_client_kx_message(gnutls_session session, int again) /* This is the function for the client to send the certificate * verify message */ -int _gnutls_send_client_certificate_verify(gnutls_session session, +int _gnutls_send_client_certificate_verify(gnutls_session_t session, int again) { uint8 *data; @@ -283,7 +283,7 @@ int _gnutls_send_client_certificate_verify(gnutls_session session, } -int _gnutls_recv_server_kx_message(gnutls_session session) +int _gnutls_recv_server_kx_message(gnutls_session_t session) { uint8 *data = NULL; int datasize; @@ -323,7 +323,7 @@ int _gnutls_recv_server_kx_message(gnutls_session session) return ret; } -int _gnutls_recv_server_certificate_request(gnutls_session session) +int _gnutls_recv_server_certificate_request(gnutls_session_t session) { uint8 *data; int datasize; @@ -355,7 +355,7 @@ int _gnutls_recv_server_certificate_request(gnutls_session session) return ret; } -int _gnutls_recv_client_kx_message(gnutls_session session) +int _gnutls_recv_client_kx_message(gnutls_session_t session) { uint8 *data; int datasize; @@ -388,7 +388,7 @@ int _gnutls_recv_client_kx_message(gnutls_session session) /* This is called when we want send our certificate */ -int _gnutls_send_client_certificate(gnutls_session session, int again) +int _gnutls_send_client_certificate(gnutls_session_t session, int again) { uint8 *data = NULL; int data_size = 0; @@ -450,7 +450,7 @@ int _gnutls_send_client_certificate(gnutls_session session, int again) /* This is called when we want send our certificate */ -int _gnutls_send_server_certificate(gnutls_session session, int again) +int _gnutls_send_server_certificate(gnutls_session_t session, int again) { uint8 *data = NULL; int data_size = 0; @@ -488,7 +488,7 @@ int _gnutls_send_server_certificate(gnutls_session session, int again) } -int _gnutls_recv_client_certificate(gnutls_session session) +int _gnutls_recv_client_certificate(gnutls_session_t session) { int datasize; opaque *data; @@ -567,7 +567,7 @@ int _gnutls_recv_client_certificate(gnutls_session session) return ret; } -int _gnutls_recv_server_certificate(gnutls_session session) +int _gnutls_recv_server_certificate(gnutls_session_t session) { int datasize; opaque *data; @@ -603,7 +603,7 @@ int _gnutls_recv_server_certificate(gnutls_session session) /* Recv the client certificate verify. This packet may not * arrive if the peer did not send us a certificate. */ -int _gnutls_recv_client_certificate_verify_message(gnutls_session session) +int _gnutls_recv_client_certificate_verify_message(gnutls_session_t session) { uint8 *data; int datasize; diff --git a/lib/gnutls_kx.h b/lib/gnutls_kx.h index 41f9ad4506..f6a6e4eb6a 100644 --- a/lib/gnutls_kx.h +++ b/lib/gnutls_kx.h @@ -18,18 +18,18 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -int _gnutls_send_server_kx_message(gnutls_session session, int again); -int _gnutls_send_client_kx_message(gnutls_session session, int again); -int _gnutls_recv_server_kx_message(gnutls_session session); -int _gnutls_recv_client_kx_message(gnutls_session session); -int _gnutls_send_client_certificate_verify(gnutls_session session, +int _gnutls_send_server_kx_message(gnutls_session_t session, int again); +int _gnutls_send_client_kx_message(gnutls_session_t session, int again); +int _gnutls_recv_server_kx_message(gnutls_session_t session); +int _gnutls_recv_client_kx_message(gnutls_session_t session); +int _gnutls_send_client_certificate_verify(gnutls_session_t session, int again); -int _gnutls_send_server_certificate(gnutls_session session, int again); -int _gnutls_generate_master(gnutls_session session, int keep_premaster); -int _gnutls_recv_client_certificate(gnutls_session session); -int _gnutls_recv_server_certificate(gnutls_session session); -int _gnutls_send_client_certificate(gnutls_session session, int again); -int _gnutls_recv_server_certificate_request(gnutls_session session); -int _gnutls_send_server_certificate_request(gnutls_session session, +int _gnutls_send_server_certificate(gnutls_session_t session, int again); +int _gnutls_generate_master(gnutls_session_t session, int keep_premaster); +int _gnutls_recv_client_certificate(gnutls_session_t session); +int _gnutls_recv_server_certificate(gnutls_session_t session); +int _gnutls_send_client_certificate(gnutls_session_t session, int again); +int _gnutls_recv_server_certificate_request(gnutls_session_t session); +int _gnutls_send_server_certificate_request(gnutls_session_t session, int again); -int _gnutls_recv_client_certificate_verify_message(gnutls_session session); +int _gnutls_recv_client_certificate_verify_message(gnutls_session_t session); diff --git a/lib/gnutls_mpi.c b/lib/gnutls_mpi.c index 2ba9ac7713..7a8154cc67 100644 --- a/lib/gnutls_mpi.c +++ b/lib/gnutls_mpi.c @@ -109,7 +109,7 @@ int _gnutls_mpi_print_lz(void *buffer, size_t * nbytes, const mpi_t a) } /* Always has the first bit zero */ -int _gnutls_mpi_dprint_lz(gnutls_datum * dest, const mpi_t a) +int _gnutls_mpi_dprint_lz(gnutls_datum_t * dest, const mpi_t a) { int ret; opaque *buf = NULL; diff --git a/lib/gnutls_mpi.h b/lib/gnutls_mpi.h index 41a05bf7ee..46058b1d94 100644 --- a/lib/gnutls_mpi.h +++ b/lib/gnutls_mpi.h @@ -6,7 +6,6 @@ # include <gnutls_int.h> typedef gcry_mpi_t mpi_t; -typedef mpi_t GNUTLS_MPI; #define _gnutls_mpi_cmp gcry_mpi_cmp #define _gnutls_mpi_cmp_ui gcry_mpi_cmp_ui @@ -44,7 +43,7 @@ int _gnutls_mpi_scan_pgp(mpi_t * ret_mpi, const opaque * buffer, int _gnutls_mpi_print(void *buffer, size_t * nbytes, const mpi_t a); int _gnutls_mpi_print_lz(void *buffer, size_t * nbytes, const mpi_t a); -int _gnutls_mpi_dprint_lz(gnutls_datum * dest, const mpi_t a); +int _gnutls_mpi_dprint_lz(gnutls_datum_t * dest, const mpi_t a); #define _gnutls_mpi_dprint _gnutls_mpi_dprint_lz #endif diff --git a/lib/gnutls_pk.c b/lib/gnutls_pk.c index fce507b6de..ad59220a38 100644 --- a/lib/gnutls_pk.c +++ b/lib/gnutls_pk.c @@ -49,8 +49,8 @@ static int _gnutls_pk_decrypt(int algo, mpi_t * resarr, mpi_t data, /* Do PKCS-1 RSA encryption. * params is modulus, public exp. */ -int _gnutls_pkcs1_rsa_encrypt(gnutls_datum * ciphertext, - const gnutls_datum * plaintext, +int _gnutls_pkcs1_rsa_encrypt(gnutls_datum_t * ciphertext, + const gnutls_datum_t * plaintext, mpi_t * params, uint params_len, uint btype) { unsigned int i, pad; @@ -210,8 +210,8 @@ int _gnutls_pkcs1_rsa_encrypt(gnutls_datum * ciphertext, * params is modulus, public exp., private key * Can decrypt block type 1 and type 2 packets. */ -int _gnutls_pkcs1_rsa_decrypt(gnutls_datum * plaintext, - const gnutls_datum * ciphertext, +int _gnutls_pkcs1_rsa_decrypt(gnutls_datum_t * plaintext, + const gnutls_datum_t * ciphertext, mpi_t * params, uint params_len, uint btype) { uint k, i; @@ -325,12 +325,12 @@ int _gnutls_pkcs1_rsa_decrypt(gnutls_datum * plaintext, } -int _gnutls_rsa_verify(const gnutls_datum * vdata, - const gnutls_datum * ciphertext, mpi_t * params, +int _gnutls_rsa_verify(const gnutls_datum_t * vdata, + const gnutls_datum_t * ciphertext, mpi_t * params, int params_len, int btype) { - gnutls_datum plain; + gnutls_datum_t plain; int ret; /* decrypt signature */ @@ -360,7 +360,7 @@ int _gnutls_rsa_verify(const gnutls_datum * vdata, /* encodes the Dss-Sig-Value structure */ -static int encode_ber_rs(gnutls_datum * sig_value, mpi_t r, mpi_t s) +static int encode_ber_rs(gnutls_datum_t * sig_value, mpi_t r, mpi_t s) { ASN1_TYPE sig; int result, tot_len; @@ -404,7 +404,7 @@ static int encode_ber_rs(gnutls_datum * sig_value, mpi_t r, mpi_t s) /* Do DSA signature calculation. params is p, q, g, y, x in that order. */ -int _gnutls_dsa_sign(gnutls_datum * signature, const gnutls_datum * hash, +int _gnutls_dsa_sign(gnutls_datum_t * signature, const gnutls_datum_t * hash, mpi_t * params, uint params_len) { mpi_t rs[2], mdata; @@ -447,7 +447,7 @@ int _gnutls_dsa_sign(gnutls_datum * signature, const gnutls_datum * hash, /* decodes the Dss-Sig-Value structure */ -static int decode_ber_rs(const gnutls_datum * sig_value, mpi_t * r, +static int decode_ber_rs(const gnutls_datum_t * sig_value, mpi_t * r, mpi_t * s) { ASN1_TYPE sig; @@ -491,8 +491,8 @@ static int decode_ber_rs(const gnutls_datum * sig_value, mpi_t * r, /* params is p, q, g, y in that order */ -int _gnutls_dsa_verify(const gnutls_datum * vdata, - const gnutls_datum * sig_value, mpi_t * params, +int _gnutls_dsa_verify(const gnutls_datum_t * vdata, + const gnutls_datum_t * sig_value, mpi_t * params, int params_len) { diff --git a/lib/gnutls_pk.h b/lib/gnutls_pk.h index 9378706af0..54fac1f8c2 100644 --- a/lib/gnutls_pk.h +++ b/lib/gnutls_pk.h @@ -1,20 +1,19 @@ #ifndef GNUTLS_PK_H # define GNUTLS_PK_H -int _gnutls_pkcs1_rsa_encrypt(gnutls_datum * ciphertext, - const gnutls_datum * plaintext, +int _gnutls_pkcs1_rsa_encrypt(gnutls_datum_t * ciphertext, + const gnutls_datum_t * plaintext, mpi_t * params, uint params_len, uint btype); -int _gnutls_dsa_sign(gnutls_datum * signature, - const gnutls_datum * plaintext, mpi_t * params, +int _gnutls_dsa_sign(gnutls_datum_t * signature, + const gnutls_datum_t * plaintext, mpi_t * params, uint params_len); -int _gnutls_pkcs1_rsa_decrypt(gnutls_datum * plaintext, - const gnutls_datum * ciphertext, +int _gnutls_pkcs1_rsa_decrypt(gnutls_datum_t * plaintext, + const gnutls_datum_t * ciphertext, mpi_t * params, uint params_len, uint btype); -int _gnutls_rsa_verify(const gnutls_datum * vdata, - const gnutls_datum * ciphertext, mpi_t * params, +int _gnutls_rsa_verify(const gnutls_datum_t * vdata, + const gnutls_datum_t * ciphertext, mpi_t * params, int params_len, int btype); -int _gnutls_dsa_verify(const gnutls_datum * vdata, - const gnutls_datum * sig_value, mpi_t * params, - int params_len); +int _gnutls_dsa_verify(const gnutls_datum_t * vdata, + const gnutls_datum_t * sig_value, mpi_t * params, int params_len); #endif /* GNUTLS_PK_H */ diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c index e3fa10e409..2dd3215873 100644 --- a/lib/gnutls_priority.c +++ b/lib/gnutls_priority.c @@ -30,8 +30,8 @@ /** * gnutls_cipher_set_priority - Sets the priority on the ciphers supported by gnutls. - * @session: is a &gnutls_session structure. - * @list: is a 0 terminated list of gnutls_cipher_algorithm elements. + * @session: is a &gnutls_session_t structure. + * @list: is a 0 terminated list of gnutls_cipher_algorithm_t elements. * * Sets the priority on the ciphers supported by gnutls. * Priority is higher for ciphers specified before others. @@ -40,7 +40,7 @@ * not use the algorithm's priority except for disabling * algorithms that were not specified. **/ -int gnutls_cipher_set_priority(gnutls_session session, const int *list) +int gnutls_cipher_set_priority(gnutls_session_t session, const int *list) { int num = 0, i; @@ -59,8 +59,8 @@ int gnutls_cipher_set_priority(gnutls_session session, const int *list) /** * gnutls_kx_set_priority - Sets the priority on the key exchange algorithms supported by gnutls. - * @session: is a &gnutls_session structure. - * @list: is a 0 terminated list of gnutls_kx_algorithm elements. + * @session: is a &gnutls_session_t structure. + * @list: is a 0 terminated list of gnutls_kx_algorithm_t elements. * * Sets the priority on the key exchange algorithms supported by gnutls. * Priority is higher for algorithms specified before others. @@ -69,7 +69,7 @@ int gnutls_cipher_set_priority(gnutls_session session, const int *list) * not use the algorithm's priority except for disabling * algorithms that were not specified. **/ -int gnutls_kx_set_priority(gnutls_session session, const int *list) +int gnutls_kx_set_priority(gnutls_session_t session, const int *list) { int num = 0, i; @@ -88,8 +88,8 @@ int gnutls_kx_set_priority(gnutls_session session, const int *list) /** * gnutls_mac_set_priority - Sets the priority on the mac algorithms supported by gnutls. - * @session: is a &gnutls_session structure. - * @list: is a 0 terminated list of gnutls_mac_algorithm elements. + * @session: is a &gnutls_session_t structure. + * @list: is a 0 terminated list of gnutls_mac_algorithm_t elements. * * Sets the priority on the mac algorithms supported by gnutls. * Priority is higher for algorithms specified before others. @@ -98,7 +98,7 @@ int gnutls_kx_set_priority(gnutls_session session, const int *list) * not use the algorithm's priority except for disabling * algorithms that were not specified. **/ -int gnutls_mac_set_priority(gnutls_session session, const int *list) +int gnutls_mac_set_priority(gnutls_session_t session, const int *list) { int num = 0, i; @@ -117,8 +117,8 @@ int gnutls_mac_set_priority(gnutls_session session, const int *list) /** * gnutls_compression_set_priority - Sets the priority on the compression algorithms supported by gnutls. - * @session: is a &gnutls_session structure. - * @list: is a 0 terminated list of gnutls_compression_method elements. + * @session: is a &gnutls_session_t structure. + * @list: is a 0 terminated list of gnutls_compression_method_t elements. * * Sets the priority on the compression algorithms supported by gnutls. * Priority is higher for algorithms specified before others. @@ -132,7 +132,7 @@ int gnutls_mac_set_priority(gnutls_session session, const int *list) * as gnutls extensions. * **/ -int gnutls_compression_set_priority(gnutls_session session, +int gnutls_compression_set_priority(gnutls_session_t session, const int *list) { int num = 0, i; @@ -152,15 +152,15 @@ int gnutls_compression_set_priority(gnutls_session session, /** * gnutls_protocol_set_priority - Sets the priority on the protocol versions supported by gnutls. - * @session: is a &gnutls_session structure. - * @list: is a 0 terminated list of gnutls_protocol_version elements. + * @session: is a &gnutls_session_t structure. + * @list: is a 0 terminated list of gnutls_protocol_t elements. * * Sets the priority on the protocol versions supported by gnutls. * This function actually enables or disables protocols. Newer protocol * versions always have highest priority. * **/ -int gnutls_protocol_set_priority(gnutls_session session, const int *list) +int gnutls_protocol_set_priority(gnutls_session_t session, const int *list) { int num = 0, i; @@ -185,8 +185,8 @@ int gnutls_protocol_set_priority(gnutls_session session, const int *list) /** * gnutls_certificate_type_set_priority - Sets the priority on the certificate types supported by gnutls. - * @session: is a &gnutls_session structure. - * @list: is a 0 terminated list of gnutls_certificate_type elements. + * @session: is a &gnutls_session_t structure. + * @list: is a 0 terminated list of gnutls_certificate_type_t elements. * * Sets the priority on the certificate types supported by gnutls. * Priority is higher for types specified before others. @@ -195,7 +195,7 @@ int gnutls_protocol_set_priority(gnutls_session session, const int *list) * The server does not use the cert type priority except for disabling * types that were not specified. **/ -int gnutls_certificate_type_set_priority(gnutls_session session, +int gnutls_certificate_type_set_priority(gnutls_session_t session, const int *list) { #ifdef USE_OPENPGP @@ -223,7 +223,7 @@ int gnutls_certificate_type_set_priority(gnutls_session session, /** * gnutls_set_default_priority - Sets some default priority on the cipher suites supported by gnutls. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Sets some default priority on the ciphers, key exchange methods, macs * and compression methods. This is to avoid using the gnutls_*_priority() functions, if @@ -237,7 +237,7 @@ int gnutls_certificate_type_set_priority(gnutls_session session, * and ARCFOUR_128 for ciphers. * **/ -int gnutls_set_default_priority(gnutls_session session) +int gnutls_set_default_priority(gnutls_session_t session) { static const int protocol_priority[] = { GNUTLS_TLS1, GNUTLS_SSL3, 0 }; static const int kx_priority[] = @@ -261,7 +261,7 @@ int gnutls_set_default_priority(gnutls_session session) /** * gnutls_set_default_export_priority - Sets some default priority on the cipher suites supported by gnutls. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Sets some default priority on the ciphers, key exchange methods, macs * and compression methods. This is to avoid using the gnutls_*_priority() functions, if @@ -273,7 +273,7 @@ int gnutls_set_default_priority(gnutls_session session) * and 3DES_CBC, ARCFOUR_128, ARCFOUR_40 for ciphers. * **/ -int gnutls_set_default_export_priority(gnutls_session session) +int gnutls_set_default_export_priority(gnutls_session_t session) { static const int protocol_priority[] = { GNUTLS_TLS1, GNUTLS_SSL3, 0 diff --git a/lib/gnutls_priority.h b/lib/gnutls_priority.h index 45b84c35d1..099ed23e95 100644 --- a/lib/gnutls_priority.h +++ b/lib/gnutls_priority.h @@ -18,10 +18,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -int gnutls_cipher_set_priority(gnutls_session session, const int *); -int gnutls_kx_set_priority(gnutls_session session, const int *); -int gnutls_mac_set_priority(gnutls_session session, const int *); -int gnutls_compression_set_priority(gnutls_session session, const int *); -int gnutls_protocol_set_priority(gnutls_session session, const int *); -int gnutls_certificate_type_set_priority(gnutls_session session, +int gnutls_cipher_set_priority(gnutls_session_t session, const int *); +int gnutls_kx_set_priority(gnutls_session_t session, const int *); +int gnutls_mac_set_priority(gnutls_session_t session, const int *); +int gnutls_compression_set_priority(gnutls_session_t session, const int *); +int gnutls_protocol_set_priority(gnutls_session_t session, const int *); +int gnutls_certificate_type_set_priority(gnutls_session_t session, const int *); diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c index 1ec13724e3..e3a842aebb 100644 --- a/lib/gnutls_record.c +++ b/lib/gnutls_record.c @@ -46,25 +46,25 @@ /** * gnutls_protocol_get_version - Returns the version of the currently used protocol - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the version of the currently used protocol. * **/ -gnutls_protocol_version gnutls_protocol_get_version(gnutls_session session) +gnutls_protocol_t gnutls_protocol_get_version(gnutls_session_t session) { return session->security_parameters.version; } -void _gnutls_set_current_version(gnutls_session session, - gnutls_protocol_version version) +void _gnutls_set_current_version(gnutls_session_t session, + gnutls_protocol_t version) { session->security_parameters.version = version; } /** * gnutls_transport_set_lowat - Used to set the lowat value in order for select to check for pending data. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @num: is the low water value. * * Used to set the lowat value in order for select to check @@ -75,14 +75,14 @@ void _gnutls_set_current_version(gnutls_session session, * Otherwise it must be called and set lowat to zero. * **/ -void gnutls_transport_set_lowat(gnutls_session session, int num) +void gnutls_transport_set_lowat(gnutls_session_t session, int num) { session->internals.lowat = num; } /** * gnutls_transport_set_ptr - Used to set first argument of the transport functions - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @ptr: is the value. * * Used to set the first argument of the transport function (like PUSH and @@ -90,8 +90,8 @@ void gnutls_transport_set_lowat(gnutls_session session, int num) * handle. * **/ -void gnutls_transport_set_ptr(gnutls_session session, - gnutls_transport_ptr ptr) +void gnutls_transport_set_ptr(gnutls_session_t session, + gnutls_transport_ptr_t ptr) { session->internals.transport_recv_ptr = ptr; session->internals.transport_send_ptr = ptr; @@ -100,7 +100,7 @@ void gnutls_transport_set_ptr(gnutls_session session, /** * gnutls_transport_set_ptr2 - Used to set first argument of the transport functions - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @recv_ptr: is the value for the pull function * @send_ptr: is the value for the push function * @@ -110,9 +110,9 @@ void gnutls_transport_set_ptr(gnutls_session session, * receiving and sending. * **/ -void gnutls_transport_set_ptr2(gnutls_session session, - gnutls_transport_ptr recv_ptr, - gnutls_transport_ptr send_ptr) +void gnutls_transport_set_ptr2(gnutls_session_t session, + gnutls_transport_ptr_t recv_ptr, + gnutls_transport_ptr_t send_ptr) { session->internals.transport_send_ptr = send_ptr; session->internals.transport_recv_ptr = recv_ptr; @@ -120,20 +120,20 @@ void gnutls_transport_set_ptr2(gnutls_session session, /** * gnutls_transport_get_ptr - Used to return the first argument of the transport functions - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Used to get the first argument of the transport function (like PUSH and * PULL). This must have been set using gnutls_transport_set_ptr(). * **/ -gnutls_transport_ptr gnutls_transport_get_ptr(gnutls_session session) +gnutls_transport_ptr_t gnutls_transport_get_ptr(gnutls_session_t session) { return session->internals.transport_recv_ptr; } /** * gnutls_transport_get_ptr2 - Used to return the first argument of the transport functions - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @recv_ptr: will hold the value for the pull function * @send_ptr: will hold the value for the push function * @@ -141,9 +141,9 @@ gnutls_transport_ptr gnutls_transport_get_ptr(gnutls_session session) * PULL). These should have been set using gnutls_transport_set_ptr2(). * **/ -void gnutls_transport_get_ptr2(gnutls_session session, - gnutls_transport_ptr * recv_ptr, - gnutls_transport_ptr * send_ptr) +void gnutls_transport_get_ptr2(gnutls_session_t session, + gnutls_transport_ptr_t * recv_ptr, + gnutls_transport_ptr_t * send_ptr) { *recv_ptr = session->internals.transport_recv_ptr; @@ -152,7 +152,7 @@ void gnutls_transport_get_ptr2(gnutls_session session, /** * gnutls_bye - This function terminates the current TLS/SSL connection. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @how: is an integer * * Terminates the current TLS/SSL connection. The connection should @@ -174,7 +174,7 @@ void gnutls_transport_get_ptr2(gnutls_session session, * gnutls_record_get_direction(). * **/ -int gnutls_bye(gnutls_session session, gnutls_close_request how) +int gnutls_bye(gnutls_session_t session, gnutls_close_request_t how) { int ret = 0; @@ -222,20 +222,20 @@ int gnutls_bye(gnutls_session session, gnutls_close_request how) return 0; } -inline static void session_invalidate(gnutls_session session) +inline static void session_invalidate(gnutls_session_t session) { session->internals.valid_connection = VALID_FALSE; } -inline static void session_unresumable(gnutls_session session) +inline static void session_unresumable(gnutls_session_t session) { session->internals.resumable = RESUME_FALSE; } /* returns 0 if session is valid */ -inline static int session_is_valid(gnutls_session session) +inline static int session_is_valid(gnutls_session_t session) { if (session->internals.valid_connection == VALID_FALSE) return GNUTLS_E_INVALID_SESSION; @@ -247,10 +247,10 @@ inline static int session_is_valid(gnutls_session session) * version must have 2 bytes at least. */ inline static -void copy_record_version(gnutls_session session, HandshakeType htype, +void copy_record_version(gnutls_session_t session, handshake_t htype, opaque version[2]) { - gnutls_protocol_version lver; + gnutls_protocol_t lver; if (htype != GNUTLS_CLIENT_HELLO || session->internals.default_record_version[0] == 0) { @@ -265,7 +265,7 @@ void copy_record_version(gnutls_session session, HandshakeType htype, } /* This function behaves exactly like write(). The only difference is - * that it accepts, the gnutls_session and the content_type_t of data to + * that it accepts, the gnutls_session_t and the content_type_t of data to * send (if called by the user the Content is specific) * It is intended to transfer data, under the current session. * @@ -278,8 +278,8 @@ void copy_record_version(gnutls_session session, HandshakeType htype, * and only if the previous send was interrupted for some reason. * */ -ssize_t _gnutls_send_int(gnutls_session session, content_type_t type, - HandshakeType htype, const void *_data, +ssize_t _gnutls_send_int(gnutls_session_t session, content_type_t type, + handshake_t htype, const void *_data, size_t sizeofdata) { uint8 *cipher; @@ -420,7 +420,7 @@ ssize_t _gnutls_send_int(gnutls_session session, content_type_t type, /* This function is to be called if the handshake was successfully * completed. This sends a Change Cipher Spec packet to the peer. */ -ssize_t _gnutls_send_change_cipher_spec(gnutls_session session, int again) +ssize_t _gnutls_send_change_cipher_spec(gnutls_session_t session, int again) { static const opaque data[1] = { GNUTLS_TYPE_CHANGE_CIPHER_SPEC }; @@ -453,7 +453,7 @@ static int check_recv_type(content_type_t recv_type) /* Checks if there are pending data in the record buffers. If there are * then it copies the data. */ -static int check_buffers(gnutls_session session, content_type_t type, +static int check_buffers(gnutls_session_t session, content_type_t type, opaque * data, int sizeofdata) { if ((type == GNUTLS_APPLICATION_DATA || type == GNUTLS_HANDSHAKE) @@ -486,9 +486,9 @@ static int check_buffers(gnutls_session session, content_type_t type, * content type. */ static -int record_check_headers(gnutls_session session, +int record_check_headers(gnutls_session_t session, uint8 headers[RECORD_HEADER_SIZE], - content_type_t type, HandshakeType htype, + content_type_t type, handshake_t htype, /*output */ content_type_t * recv_type, opaque version[2], uint16 * length, uint16 * header_size) @@ -542,8 +542,8 @@ int record_check_headers(gnutls_session session, */ #ifdef CHECK_RECORD_VERSION inline - static int record_check_version(gnutls_session session, - HandshakeType htype, opaque version[2]) + static int record_check_version(gnutls_session_t session, + handshake_t htype, opaque version[2]) { if ((htype != GNUTLS_CLIENT_HELLO && htype != GNUTLS_SERVER_HELLO) && gnutls_protocol_get_version(session) != @@ -565,9 +565,9 @@ inline /* This function will check if the received record type is * the one we actually expect. */ -static int record_check_type(gnutls_session session, +static int record_check_type(gnutls_session_t session, content_type_t recv_type, content_type_t type, - HandshakeType htype, opaque * data, + handshake_t htype, opaque * data, int data_size) { @@ -683,8 +683,8 @@ static int record_check_type(gnutls_session session, * also initialize it. */ inline - static int get_temp_recv_buffer(gnutls_session session, - gnutls_datum * tmp) + static int get_temp_recv_buffer(gnutls_session_t session, + gnutls_datum_t * tmp) { /* We allocate MAX_RECORD_RECV_SIZE length @@ -719,17 +719,17 @@ inline #define MAX_EMPTY_PACKETS_SEQUENCE 4 /* This function behaves exactly like read(). The only difference is - * that it accepts the gnutls_session and the content_type_t of data to + * that it accepts the gnutls_session_t and the content_type_t of data to * receive (if called by the user the Content is Userdata only) * It is intended to receive data, under the current session. * - * The HandshakeType was introduced to support SSL V2.0 client hellos. + * The handshake_t was introduced to support SSL V2.0 client hellos. */ -ssize_t _gnutls_recv_int(gnutls_session session, content_type_t type, - HandshakeType htype, opaque * data, +ssize_t _gnutls_recv_int(gnutls_session_t session, content_type_t type, + handshake_t htype, opaque * data, size_t sizeofdata) { - gnutls_datum tmp; + gnutls_datum_t tmp; int decrypted_length; opaque version[2]; uint8 *headers; @@ -964,7 +964,7 @@ ssize_t _gnutls_recv_int(gnutls_session session, content_type_t type, /** * gnutls_record_send - sends to the peer the specified data - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @data: contains the data to send * @sizeofdata: is the length of the data * @@ -986,7 +986,7 @@ ssize_t _gnutls_recv_int(gnutls_session session, content_type_t type, * maximum record size. * **/ -ssize_t gnutls_record_send(gnutls_session session, const void *data, +ssize_t gnutls_record_send(gnutls_session_t session, const void *data, size_t sizeofdata) { return _gnutls_send_int(session, GNUTLS_APPLICATION_DATA, -1, data, @@ -995,7 +995,7 @@ ssize_t gnutls_record_send(gnutls_session session, const void *data, /** * gnutls_record_recv - reads data from the TLS record protocol - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @data: contains the data to send * @sizeofdata: is the length of the data * @@ -1015,7 +1015,7 @@ ssize_t gnutls_record_send(gnutls_session session, const void *data, * A negative error code is returned in case of an error. * **/ -ssize_t gnutls_record_recv(gnutls_session session, void *data, +ssize_t gnutls_record_recv(gnutls_session_t session, void *data, size_t sizeofdata) { return _gnutls_recv_int(session, GNUTLS_APPLICATION_DATA, -1, data, @@ -1024,14 +1024,14 @@ ssize_t gnutls_record_recv(gnutls_session session, void *data, /** * gnutls_record_get_max_size - returns the maximum record size - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function returns the maximum record packet size in this connection. * The maximum record size is negotiated by the client after the * first handshake message. * **/ -size_t gnutls_record_get_max_size(gnutls_session session) +size_t gnutls_record_get_max_size(gnutls_session_t session) { /* Recv will hold the negotiated max record size * always. @@ -1042,7 +1042,7 @@ size_t gnutls_record_get_max_size(gnutls_session session) /** * gnutls_record_set_max_size - sets the maximum record size - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @size: is the new size * * This function sets the maximum record packet size in this connection. @@ -1058,7 +1058,7 @@ size_t gnutls_record_get_max_size(gnutls_session session) * Not all TLS implementations use or even understand this extension. * **/ -ssize_t gnutls_record_set_max_size(gnutls_session session, size_t size) +ssize_t gnutls_record_set_max_size(gnutls_session_t session, size_t size) { ssize_t new_size; diff --git a/lib/gnutls_record.h b/lib/gnutls_record.h index 1952f487da..5e38a2de5d 100644 --- a/lib/gnutls_record.h +++ b/lib/gnutls_record.h @@ -1,7 +1,7 @@ -ssize_t _gnutls_send_int(gnutls_session session, content_type_t type, - HandshakeType htype, const void *data, +ssize_t _gnutls_send_int(gnutls_session_t session, content_type_t type, + handshake_t htype, const void *data, size_t sizeofdata); -ssize_t _gnutls_recv_int(gnutls_session session, content_type_t type, - HandshakeType, opaque * data, size_t sizeofdata); -ssize_t _gnutls_send_change_cipher_spec(gnutls_session session, int again); -void gnutls_transport_set_lowat(gnutls_session session, int num); +ssize_t _gnutls_recv_int(gnutls_session_t session, content_type_t type, + handshake_t, opaque * data, size_t sizeofdata); +ssize_t _gnutls_send_change_cipher_spec(gnutls_session_t session, int again); +void gnutls_transport_set_lowat(gnutls_session_t session, int num); diff --git a/lib/gnutls_rsa_export.c b/lib/gnutls_rsa_export.c index 84d25436d9..3777f752d7 100644 --- a/lib/gnutls_rsa_export.c +++ b/lib/gnutls_rsa_export.c @@ -42,7 +42,7 @@ /* returns e and m, depends on the requested bits. * We only support limited key sizes. */ -const mpi_t *_gnutls_get_rsa_params(gnutls_rsa_params rsa_params) +const mpi_t *_gnutls_get_rsa_params(gnutls_rsa_params_t rsa_params) { if (rsa_params == NULL) { return NULL; @@ -168,13 +168,13 @@ int _gnutls_rsa_generate_params(mpi_t * resarr, int *resarr_len, int bits) * The new parameters should be stored in the appropriate gnutls_datum. * **/ -int gnutls_rsa_params_import_raw(gnutls_rsa_params rsa_params, - const gnutls_datum * m, - const gnutls_datum * e, - const gnutls_datum * d, - const gnutls_datum * p, - const gnutls_datum * q, - const gnutls_datum * u) +int gnutls_rsa_params_import_raw(gnutls_rsa_params_t rsa_params, + const gnutls_datum_t * m, + const gnutls_datum_t * e, + const gnutls_datum_t * d, + const gnutls_datum_t * p, + const gnutls_datum_t * q, + const gnutls_datum_t * u) { return gnutls_x509_privkey_import_rsa_raw(rsa_params, m, e, d, p, q, u); @@ -187,7 +187,7 @@ int gnutls_rsa_params_import_raw(gnutls_rsa_params rsa_params, * This function will initialize the temporary RSA parameters structure. * **/ -int gnutls_rsa_params_init(gnutls_rsa_params * rsa_params) +int gnutls_rsa_params_init(gnutls_rsa_params_t * rsa_params) { int ret; @@ -209,7 +209,7 @@ int gnutls_rsa_params_init(gnutls_rsa_params * rsa_params) * This function will deinitialize the RSA parameters structure. * **/ -void gnutls_rsa_params_deinit(gnutls_rsa_params rsa_params) +void gnutls_rsa_params_deinit(gnutls_rsa_params_t rsa_params) { gnutls_x509_privkey_deinit(rsa_params); } @@ -223,7 +223,7 @@ void gnutls_rsa_params_deinit(gnutls_rsa_params rsa_params) * to destination. * **/ -int gnutls_rsa_params_cpy(gnutls_rsa_params dst, gnutls_rsa_params src) +int gnutls_rsa_params_cpy(gnutls_rsa_params_t dst, gnutls_rsa_params_t src) { return gnutls_x509_privkey_cpy(dst, src); } @@ -243,7 +243,7 @@ int gnutls_rsa_params_cpy(gnutls_rsa_params dst, gnutls_rsa_params src) * no use calling this in client side. * **/ -int gnutls_rsa_params_generate2(gnutls_rsa_params params, +int gnutls_rsa_params_generate2(gnutls_rsa_params_t params, unsigned int bits) { return gnutls_x509_privkey_generate(params, GNUTLS_PK_RSA, bits, 0); @@ -265,9 +265,9 @@ int gnutls_rsa_params_generate2(gnutls_rsa_params params, * 0 on success. * **/ -int gnutls_rsa_params_import_pkcs1(gnutls_rsa_params params, - const gnutls_datum * pkcs1_params, - gnutls_x509_crt_fmt format) +int gnutls_rsa_params_import_pkcs1(gnutls_rsa_params_t params, + const gnutls_datum_t * pkcs1_params, + gnutls_x509_crt_fmt_t format) { return gnutls_x509_privkey_import(params, pkcs1_params, format); } @@ -291,8 +291,8 @@ int gnutls_rsa_params_import_pkcs1(gnutls_rsa_params params, * 0 on success. * **/ -int gnutls_rsa_params_export_pkcs1(gnutls_rsa_params params, - gnutls_x509_crt_fmt format, +int gnutls_rsa_params_export_pkcs1(gnutls_rsa_params_t params, + gnutls_x509_crt_fmt_t format, unsigned char *params_data, size_t * params_data_size) { @@ -317,11 +317,10 @@ int gnutls_rsa_params_export_pkcs1(gnutls_rsa_params params, * gnutls_malloc() and will be stored in the appropriate datum. * **/ -int gnutls_rsa_params_export_raw(gnutls_rsa_params params, - gnutls_datum * m, gnutls_datum * e, - gnutls_datum * d, gnutls_datum * p, - gnutls_datum * q, gnutls_datum * u, - unsigned int *bits) +int gnutls_rsa_params_export_raw(gnutls_rsa_params_t params, + gnutls_datum_t * m, gnutls_datum_t * e, + gnutls_datum_t * d, gnutls_datum_t * p, + gnutls_datum_t * q, gnutls_datum_t * u, unsigned int *bits) { int ret; diff --git a/lib/gnutls_rsa_export.h b/lib/gnutls_rsa_export.h index 0d18464982..f68f4afcf6 100644 --- a/lib/gnutls_rsa_export.h +++ b/lib/gnutls_rsa_export.h @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -const mpi_t *_gnutls_get_rsa_params(gnutls_rsa_params); -int _gnutls_peers_cert_less_512(gnutls_session session); +const mpi_t *_gnutls_get_rsa_params(gnutls_rsa_params_t); +int _gnutls_peers_cert_less_512(gnutls_session_t session); int _gnutls_rsa_generate_params(mpi_t * resarr, int *resarr_len, int bits); -void gnutls_rsa_params_deinit(gnutls_rsa_params rsa_params); +void gnutls_rsa_params_deinit(gnutls_rsa_params_t rsa_params); diff --git a/lib/gnutls_session.c b/lib/gnutls_session.c index 9eabfa043f..19af8cd482 100644 --- a/lib/gnutls_session.c +++ b/lib/gnutls_session.c @@ -28,7 +28,7 @@ /** * gnutls_session_get_data - Returns all session parameters. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @session_data: is a pointer to space to hold the session. * @session_data_size: is the session_data's size, or it will be set by the function. * @@ -39,11 +39,11 @@ * * Resuming sessions is really useful and speedups connections after a succesful one. **/ -int gnutls_session_get_data(gnutls_session session, +int gnutls_session_get_data(gnutls_session_t session, void *session_data, size_t * session_data_size) { - gnutls_datum psession; + gnutls_datum_t psession; int ret; if (*session_data_size < SESSION_SIZE || session_data == NULL) { @@ -73,7 +73,7 @@ int gnutls_session_get_data(gnutls_session session, /** * gnutls_session_get_id - Returns session id. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @session_id: is a pointer to space to hold the session id. * @session_id_size: is the session id's size, or it will be set by the function. * @@ -85,7 +85,7 @@ int gnutls_session_get_data(gnutls_session session, * Session id is some data set by the server, that identify the current session. * In TLS 1.0 and SSL 3.0 session id is always less than 32 bytes. **/ -int gnutls_session_get_id(gnutls_session session, +int gnutls_session_get_id(gnutls_session_t session, void *session_id, size_t * session_id_size) { @@ -103,7 +103,7 @@ int gnutls_session_get_id(gnutls_session session, /** * gnutls_session_set_data - Sets all session parameters - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @session_data: is a pointer to space to hold the session. * @session_data_size: is the session's size * @@ -118,12 +118,12 @@ int gnutls_session_get_id(gnutls_session session, * Returns a negative value on error. * **/ -int gnutls_session_set_data(gnutls_session session, +int gnutls_session_set_data(gnutls_session_t session, const void *session_data, size_t session_data_size) { int ret; - gnutls_datum psession; + gnutls_datum_t psession; psession.data = (opaque *) session_data; psession.size = session_data_size; diff --git a/lib/gnutls_session.h b/lib/gnutls_session.h index 882d56fed0..1ff8e2b210 100644 --- a/lib/gnutls_session.h +++ b/lib/gnutls_session.h @@ -18,8 +18,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -int gnutls_session_set_data(gnutls_session session, +int gnutls_session_set_data(gnutls_session_t session, const opaque * session_data, int session_data_size); -int gnutls_session_get_data(gnutls_session session, opaque * session_data, +int gnutls_session_get_data(gnutls_session_t session, opaque * session_data, int *session_data_size); diff --git a/lib/gnutls_session_pack.c b/lib/gnutls_session_pack.c index ff0c990621..7edc36ae42 100644 --- a/lib/gnutls_session_pack.c +++ b/lib/gnutls_session_pack.c @@ -36,9 +36,9 @@ #define PACK_HEADER_SIZE 1 int _gnutls_pack_certificate_auth_info(cert_auth_info_t info, - gnutls_datum * packed_session); + gnutls_datum_t * packed_session); int _gnutls_unpack_certificate_auth_info(cert_auth_info_t info, - const gnutls_datum * + const gnutls_datum_t * packed_session); static int _gnutls_pack_certificate_auth_info_size(cert_auth_info_t info); @@ -47,8 +47,8 @@ static int _gnutls_pack_certificate_auth_info_size(cert_auth_info_t info); * is required in order to pack these structures in a vector in * order to store them to the DB. */ -int _gnutls_session_pack(gnutls_session session, - gnutls_datum * packed_session) +int _gnutls_session_pack(gnutls_session_t session, + gnutls_datum_t * packed_session) { uint32 pack_size; int ret; @@ -147,7 +147,7 @@ int _gnutls_session_pack(gnutls_session session, /* Returns the size needed to hold the current session. */ -uint _gnutls_session_size(gnutls_session session) +uint _gnutls_session_size(gnutls_session_t session) { uint32 pack_size; @@ -173,8 +173,8 @@ uint _gnutls_session_size(gnutls_session session) return pack_size; } -int _gnutls_session_unpack(gnutls_session session, - const gnutls_datum * packed_session) +int _gnutls_session_unpack(gnutls_session_t session, + const gnutls_datum_t * packed_session) { uint32 pack_size; int ret; @@ -321,7 +321,7 @@ int _gnutls_session_unpack(gnutls_session session, } int _gnutls_pack_certificate_auth_info(cert_auth_info_t info, - gnutls_datum * packed_session) + gnutls_datum_t * packed_session) { unsigned int pos, i; int info_size; @@ -378,7 +378,7 @@ static int _gnutls_pack_certificate_auth_info_size(cert_auth_info_t info) int _gnutls_unpack_certificate_auth_info(cert_auth_info_t info, - const gnutls_datum * + const gnutls_datum_t * packed_session) { unsigned int i, j, pos; @@ -392,7 +392,7 @@ int _gnutls_unpack_certificate_auth_info(cert_auth_info_t info, pos = PACK_HEADER_SIZE + sizeof(uint32) + sizeof(cert_auth_info_st); if (info->ncerts > 0) { info->raw_certificate_list = - gnutls_calloc(1, info->ncerts * sizeof(gnutls_datum)); + gnutls_calloc(1, info->ncerts * sizeof(gnutls_datum_t)); if (info->raw_certificate_list == NULL) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; diff --git a/lib/gnutls_session_pack.h b/lib/gnutls_session_pack.h index 0956beb758..d49e972b17 100644 --- a/lib/gnutls_session_pack.h +++ b/lib/gnutls_session_pack.h @@ -1,5 +1,5 @@ -int _gnutls_session_pack(gnutls_session session, - gnutls_datum * packed_session); -int _gnutls_session_unpack(gnutls_session session, - const gnutls_datum * packed_session); -uint _gnutls_session_size(gnutls_session session); +int _gnutls_session_pack(gnutls_session_t session, + gnutls_datum_t * packed_session); +int _gnutls_session_unpack(gnutls_session_t session, + const gnutls_datum_t * packed_session); +uint _gnutls_session_size(gnutls_session_t session); diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c index e84508b3a9..f9987de062 100644 --- a/lib/gnutls_sig.c +++ b/lib/gnutls_sig.c @@ -37,23 +37,23 @@ static int _gnutls_tls_sign(gnutls_cert * cert, gnutls_privkey * pkey, - const gnutls_datum * hash_concat, - gnutls_datum * signature); + const gnutls_datum_t * hash_concat, + gnutls_datum_t * signature); /* Generates a signature of all the previous sent packets in the * handshake procedure. (20040227: now it works for SSL 3.0 as well) */ -int _gnutls_tls_sign_hdata(gnutls_session session, +int _gnutls_tls_sign_hdata(gnutls_session_t session, gnutls_cert * cert, gnutls_privkey * pkey, - gnutls_datum * signature) + gnutls_datum_t * signature) { - gnutls_datum dconcat; + gnutls_datum_t dconcat; int ret; opaque concat[36]; mac_hd_t td_md5; mac_hd_t td_sha; - gnutls_protocol_version ver = gnutls_protocol_get_version(session); + gnutls_protocol_t ver = gnutls_protocol_get_version(session); td_sha = _gnutls_hash_copy(session->internals.handshake_mac_handle_sha); @@ -116,11 +116,11 @@ int _gnutls_tls_sign_hdata(gnutls_session session, /* Generates a signature of all the random data and the parameters. * Used in DHE_* ciphersuites. */ -int _gnutls_tls_sign_params(gnutls_session session, gnutls_cert * cert, - gnutls_privkey * pkey, gnutls_datum * params, - gnutls_datum * signature) +int _gnutls_tls_sign_params(gnutls_session_t session, gnutls_cert * cert, + gnutls_privkey * pkey, gnutls_datum_t * params, + gnutls_datum_t * signature) { - gnutls_datum dconcat; + gnutls_datum_t dconcat; int ret; mac_hd_t td_md5; mac_hd_t td_sha; @@ -182,8 +182,8 @@ int _gnutls_tls_sign_params(gnutls_session session, gnutls_cert * cert, /* This will create a PKCS1 or DSA signature, using the given parameters, and the * given data. The output will be allocated and be put in signature. */ -int _gnutls_sign(gnutls_pk_algorithm algo, mpi_t * params, int params_size, - const gnutls_datum * data, gnutls_datum * signature) +int _gnutls_sign(gnutls_pk_algorithm_t algo, mpi_t * params, int params_size, + const gnutls_datum_t * data, gnutls_datum_t * signature) { int ret; @@ -220,8 +220,8 @@ int _gnutls_sign(gnutls_pk_algorithm algo, mpi_t * params, int params_size, */ static int _gnutls_tls_sign(gnutls_cert * cert, gnutls_privkey * pkey, - const gnutls_datum * hash_concat, - gnutls_datum * signature) + const gnutls_datum_t * hash_concat, + gnutls_datum_t * signature) { /* If our certificate supports signing @@ -242,11 +242,11 @@ int _gnutls_tls_sign(gnutls_cert * cert, gnutls_privkey * pkey, static int _gnutls_pkcs1_rsa_verify_sig(gnutls_cert * cert, - const gnutls_datum * hash_concat, - gnutls_datum * signature) + const gnutls_datum_t * hash_concat, + gnutls_datum_t * signature) { int ret; - gnutls_datum vdata; + gnutls_datum_t vdata; if (cert->version == 0 || cert == NULL) { /* this is the only way to check * if it is initialized @@ -306,15 +306,15 @@ int _gnutls_pkcs1_rsa_verify_sig(gnutls_cert * cert, /* Verifies a TLS signature (like the one in the client certificate * verify message). */ -int _gnutls_verify_sig_hdata(gnutls_session session, gnutls_cert * cert, - gnutls_datum * signature) +int _gnutls_verify_sig_hdata(gnutls_session_t session, gnutls_cert * cert, + gnutls_datum_t * signature) { int ret; opaque concat[36]; mac_hd_t td_md5; mac_hd_t td_sha; - gnutls_datum dconcat; - gnutls_protocol_version ver = gnutls_protocol_get_version(session); + gnutls_datum_t dconcat; + gnutls_protocol_t ver = gnutls_protocol_get_version(session); td_md5 = _gnutls_hash_copy(session->internals.handshake_mac_handle_md5); @@ -365,11 +365,11 @@ int _gnutls_verify_sig_hdata(gnutls_session session, gnutls_cert * cert, /* Generates a signature of all the random data and the parameters. * Used in DHE_* ciphersuites. */ -int _gnutls_verify_sig_params(gnutls_session session, gnutls_cert * cert, - const gnutls_datum * params, - gnutls_datum * signature) +int _gnutls_verify_sig_params(gnutls_session_t session, gnutls_cert * cert, + const gnutls_datum_t * params, + gnutls_datum_t * signature) { - gnutls_datum dconcat; + gnutls_datum_t dconcat; int ret; mac_hd_t td_md5; mac_hd_t td_sha; diff --git a/lib/gnutls_sig.h b/lib/gnutls_sig.h index 4cc217fb77..c7b79a14ea 100644 --- a/lib/gnutls_sig.h +++ b/lib/gnutls_sig.h @@ -2,21 +2,17 @@ # define GNUTLS_SIG_H # include <auth_cert.h> -gnutls_certificate_status gnutls_x509_verify_signature(gnutls_cert * cert, - gnutls_cert * - issuer); -int _gnutls_tls_sign_hdata(gnutls_session session, gnutls_cert * cert, - gnutls_privkey * pkey, - gnutls_datum * signature); -int _gnutls_tls_sign_params(gnutls_session session, gnutls_cert * cert, - gnutls_privkey * pkey, gnutls_datum * params, - gnutls_datum * signature); -int _gnutls_verify_sig_hdata(gnutls_session session, gnutls_cert * cert, - gnutls_datum * signature); -int _gnutls_verify_sig_params(gnutls_session session, gnutls_cert * cert, - const gnutls_datum * params, - gnutls_datum * signature); -int _gnutls_sign(gnutls_pk_algorithm algo, mpi_t * params, int params_size, - const gnutls_datum * data, gnutls_datum * signature); +gnutls_certificate_status_t gnutls_x509_verify_signature(gnutls_cert * cert, + gnutls_cert * issuer); +int _gnutls_tls_sign_hdata(gnutls_session_t session, gnutls_cert * cert, + gnutls_privkey * pkey, gnutls_datum_t * signature); +int _gnutls_tls_sign_params(gnutls_session_t session, gnutls_cert * cert, + gnutls_privkey * pkey, gnutls_datum_t * params, gnutls_datum_t * signature); +int _gnutls_verify_sig_hdata(gnutls_session_t session, gnutls_cert * cert, + gnutls_datum_t * signature); +int _gnutls_verify_sig_params(gnutls_session_t session, gnutls_cert * cert, + const gnutls_datum_t * params, gnutls_datum_t * signature); +int _gnutls_sign(gnutls_pk_algorithm_t algo, mpi_t * params, int params_size, + const gnutls_datum_t * data, gnutls_datum_t * signature); #endif diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index 2e1b78dcc7..246ab4d87d 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -47,65 +47,65 @@ return ret; \ } -void _gnutls_session_cert_type_set(gnutls_session session, - gnutls_certificate_type ct) +void _gnutls_session_cert_type_set(gnutls_session_t session, + gnutls_certificate_type_t ct) { session->security_parameters.cert_type = ct; } /** * gnutls_cipher_get - Returns the currently used cipher. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the currently used cipher. **/ -gnutls_cipher_algorithm gnutls_cipher_get(gnutls_session session) +gnutls_cipher_algorithm_t gnutls_cipher_get(gnutls_session_t session) { return session->security_parameters.read_bulk_cipher_algorithm; } /** * gnutls_certificate_type_get - Returns the currently used certificate type. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the currently used certificate type. The certificate type * is by default X.509, unless it is negotiated as a TLS extension. * **/ -gnutls_certificate_type gnutls_certificate_type_get(gnutls_session session) +gnutls_certificate_type_t gnutls_certificate_type_get(gnutls_session_t session) { return session->security_parameters.cert_type; } /** * gnutls_kx_get - Returns the key exchange algorithm. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the key exchange algorithm used in the last handshake. **/ -gnutls_kx_algorithm gnutls_kx_get(gnutls_session session) +gnutls_kx_algorithm_t gnutls_kx_get(gnutls_session_t session) { return session->security_parameters.kx_algorithm; } /** * gnutls_mac_get - Returns the currently used mac algorithm. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the currently used mac algorithm. **/ -gnutls_mac_algorithm gnutls_mac_get(gnutls_session session) +gnutls_mac_algorithm_t gnutls_mac_get(gnutls_session_t session) { return session->security_parameters.read_mac_algorithm; } /** * gnutls_compression_get - Returns the currently used compression algorithm. - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * Returns the currently used compression method. **/ -gnutls_compression_method gnutls_compression_get(gnutls_session session) +gnutls_compression_method_t gnutls_compression_get(gnutls_session_t session) { return session->security_parameters.read_compression_algorithm; } @@ -114,12 +114,12 @@ gnutls_compression_method gnutls_compression_get(gnutls_session session) * This means that it is enabled by the priority functions, * and a matching certificate exists. */ -int _gnutls_session_cert_type_supported(gnutls_session session, - gnutls_certificate_type cert_type) +int _gnutls_session_cert_type_supported(gnutls_session_t session, + gnutls_certificate_type_t cert_type) { uint i; uint cert_found = 0; - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; if (session->security_parameters.entity == GNUTLS_SERVER) { cred = @@ -158,7 +158,7 @@ int _gnutls_session_cert_type_supported(gnutls_session session, /* this function deinitializes all the internal parameters stored * in a session struct. */ -inline static void deinit_internal_params(gnutls_session session) +inline static void deinit_internal_params(gnutls_session_t session) { if (session->internals.params.free_anon_dh_params) gnutls_dh_params_deinit(session->internals.params.anon_dh_params); @@ -177,7 +177,7 @@ inline static void deinit_internal_params(gnutls_session session) * structure within the session, which depend on the current handshake. * This is used to allow further handshakes. */ -void _gnutls_handshake_internal_state_clear(gnutls_session session) +void _gnutls_handshake_internal_state_clear(gnutls_session_t session) { session->internals.extensions_sent_size = 0; @@ -212,14 +212,14 @@ void _gnutls_handshake_internal_state_clear(gnutls_session session) * gnutls_init - This function initializes the session to null (null encryption etc...). * @con_end: is used to indicate if this session is to be used for server or * client. Can be one of GNUTLS_CLIENT and GNUTLS_SERVER. - * @session: is a pointer to a &gnutls_session structure. + * @session: is a pointer to a &gnutls_session_t structure. * * This function initializes the current session to null. Every session * must be initialized before use, so internal structures can be allocated. * This function allocates structures which can only be free'd * by calling gnutls_deinit(). Returns zero on success. **/ -int gnutls_init(gnutls_session * session, gnutls_connection_end con_end) +int gnutls_init(gnutls_session_t * session, gnutls_connection_end_t con_end) { *session = gnutls_calloc(1, sizeof(struct gnutls_session_int)); if (*session == NULL) @@ -287,8 +287,8 @@ int gnutls_init(gnutls_session * session, gnutls_connection_end con_end) /* set the socket pointers to -1; */ - (*session)->internals.transport_recv_ptr = (gnutls_transport_ptr) - 1; - (*session)->internals.transport_send_ptr = (gnutls_transport_ptr) - 1; + (*session)->internals.transport_recv_ptr = (gnutls_transport_ptr_t) - 1; + (*session)->internals.transport_send_ptr = (gnutls_transport_ptr_t) - 1; /* set the default maximum record size for TLS */ @@ -308,7 +308,7 @@ int gnutls_init(gnutls_session * session, gnutls_connection_end con_end) /* returns RESUME_FALSE or RESUME_TRUE. */ -int _gnutls_session_is_resumable(gnutls_session session) +int _gnutls_session_is_resumable(gnutls_session_t session) { return session->internals.resumable; } @@ -316,14 +316,14 @@ int _gnutls_session_is_resumable(gnutls_session session) /** * gnutls_deinit - This function clears all buffers associated with the &session - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function clears all buffers associated with the &session. * This function will also remove session data from the session database * if the session was terminated abnormally. * **/ -void gnutls_deinit(gnutls_session session) +void gnutls_deinit(gnutls_session_t session) { if (session == NULL) @@ -404,12 +404,12 @@ void gnutls_deinit(gnutls_session session) /* Returns the minimum prime bits that are acceptable. */ -int _gnutls_dh_get_allowed_prime_bits(gnutls_session session) +int _gnutls_dh_get_allowed_prime_bits(gnutls_session_t session) { return session->internals.dh_prime_bits; } -int _gnutls_dh_set_peer_public(gnutls_session session, mpi_t public) +int _gnutls_dh_set_peer_public(gnutls_session_t session, mpi_t public) { dh_info_t *dh; int ret; @@ -451,7 +451,7 @@ int _gnutls_dh_set_peer_public(gnutls_session session, mpi_t public) return 0; } -int _gnutls_dh_set_secret_bits(gnutls_session session, uint bits) +int _gnutls_dh_set_secret_bits(gnutls_session_t session, uint bits) { switch (gnutls_auth_get_type(session)) { case GNUTLS_CRD_ANON:{ @@ -483,7 +483,7 @@ int _gnutls_dh_set_secret_bits(gnutls_session session, uint bits) /* This function will set in the auth info structure the * RSA exponent and the modulus. */ -int _gnutls_rsa_export_set_pubkey(gnutls_session session, mpi_t exp, +int _gnutls_rsa_export_set_pubkey(gnutls_session_t session, mpi_t exp, mpi_t mod) { cert_auth_info_t info; @@ -520,7 +520,7 @@ int _gnutls_rsa_export_set_pubkey(gnutls_session session, mpi_t exp, /* Sets the prime and the generator in the auth info structure. */ -int _gnutls_dh_set_group(gnutls_session session, mpi_t gen, mpi_t prime) +int _gnutls_dh_set_group(gnutls_session_t session, mpi_t gen, mpi_t prime) { dh_info_t *dh; int ret; @@ -572,7 +572,7 @@ int _gnutls_dh_set_group(gnutls_session session, mpi_t gen, mpi_t prime) /** * gnutls_openpgp_send_key - This function will order gnutls to send the openpgp fingerprint instead of the key - * @session: is a pointer to a &gnutls_session structure. + * @session: is a pointer to a &gnutls_session_t structure. * @status: is one of OPENPGP_KEY, or OPENPGP_KEY_FINGERPRINT * * This function will order gnutls to send the key fingerprint instead @@ -581,15 +581,15 @@ int _gnutls_dh_set_group(gnutls_session session, mpi_t gen, mpi_t prime) * server can obtain the client's key. * **/ -void gnutls_openpgp_send_key(gnutls_session session, - gnutls_openpgp_key_status status) +void gnutls_openpgp_send_key(gnutls_session_t session, + gnutls_openpgp_key_status_t status) { session->internals.pgp_fingerprint = status; } /** * gnutls_certificate_send_x509_rdn_sequence - This function will order gnutls to or not to send the x.509 rdn sequence - * @session: is a pointer to a &gnutls_session structure. + * @session: is a pointer to a &gnutls_session_t structure. * @status: is 0 or 1 * * If status is non zero, this function will order gnutls not to send the rdnSequence @@ -601,20 +601,20 @@ void gnutls_openpgp_send_key(gnutls_session session, * certificate with X.509 certificates. * **/ -void gnutls_certificate_send_x509_rdn_sequence(gnutls_session session, +void gnutls_certificate_send_x509_rdn_sequence(gnutls_session_t session, int status) { session->internals.ignore_rdn_sequence = status; } -int _gnutls_openpgp_send_fingerprint(gnutls_session session) +int _gnutls_openpgp_send_fingerprint(gnutls_session_t session) { return session->internals.pgp_fingerprint; } /*- * _gnutls_record_set_default_version - Used to set the default version for the first record packet - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @major: is a tls major version * @minor: is a tls minor version * @@ -623,7 +623,7 @@ int _gnutls_openpgp_send_fingerprint(gnutls_session session) * that know TLS internals and want to debug other implementations. * -*/ -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) { @@ -633,7 +633,7 @@ void _gnutls_record_set_default_version(gnutls_session session, /** * gnutls_handshake_set_private_extensions - Used to enable the private cipher suites - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @allow: is an integer (0 or 1) * * This function will enable or disable the use of private @@ -649,14 +649,14 @@ void _gnutls_record_set_default_version(gnutls_session session, * servers and clients may cause interoperability problems. * **/ -void gnutls_handshake_set_private_extensions(gnutls_session session, +void gnutls_handshake_set_private_extensions(gnutls_session_t session, int allow) { session->internals.enable_private = allow; } inline - static int _gnutls_cal_PRF_A(gnutls_mac_algorithm algorithm, + static int _gnutls_cal_PRF_A(gnutls_mac_algorithm_t algorithm, const void *secret, int secret_size, const void *seed, int seed_size, void *result) @@ -680,7 +680,7 @@ inline /* Produces "total_bytes" bytes using the hash algorithm specified. * (used in the PRF function) */ -static int _gnutls_P_hash(gnutls_mac_algorithm algorithm, +static int _gnutls_P_hash(gnutls_mac_algorithm_t algorithm, const opaque * secret, int secret_size, const opaque * seed, int seed_size, int total_bytes, opaque * ret) @@ -825,13 +825,13 @@ int _gnutls_PRF(const opaque * secret, int secret_size, const char *label, /** * gnutls_session_is_resumed - Used to check whether this session is a resumed one - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function will return non zero if this session is a resumed one, * or a zero if this is a new session. * **/ -int gnutls_session_is_resumed(gnutls_session session) +int gnutls_session_is_resumed(gnutls_session_t session) { if (session->security_parameters.entity == GNUTLS_CLIENT) { if (session->security_parameters.session_id_size > 0 && @@ -851,14 +851,14 @@ int gnutls_session_is_resumed(gnutls_session session) /*- * _gnutls_session_is_export - Used to check whether this session is of export grade - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function will return non zero if this session is of export grade. * -*/ -int _gnutls_session_is_export(gnutls_session session) +int _gnutls_session_is_export(gnutls_session_t session) { - gnutls_cipher_algorithm cipher; + gnutls_cipher_algorithm_t cipher; cipher = _gnutls_cipher_suite_get_cipher_algo(&session->security_parameters. @@ -872,27 +872,27 @@ int _gnutls_session_is_export(gnutls_session session) /** * gnutls_session_get_ptr - Used to get the user pointer from the session structure - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function will return the user given pointer from the session structure. * This is the pointer set with gnutls_session_set_ptr(). * **/ -void *gnutls_session_get_ptr(gnutls_session session) +void *gnutls_session_get_ptr(gnutls_session_t session) { return session->internals.user_ptr; } /** * gnutls_session_set_ptr - Used to set the user pointer to the session structure - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @ptr: is the user pointer * * This function will set (assosiate) the user given pointer to the session structure. * This is pointer can be accessed with gnutls_session_get_ptr(). * **/ -void gnutls_session_set_ptr(gnutls_session session, void *ptr) +void gnutls_session_set_ptr(gnutls_session_t session, void *ptr) { session->internals.user_ptr = ptr; } @@ -900,7 +900,7 @@ void gnutls_session_set_ptr(gnutls_session session, void *ptr) /** * gnutls_record_get_direction - This function will return the direction of the last interrupted function call - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * * This function provides information about the internals of the record * protocol and is only useful if a prior gnutls function call (e.g. @@ -913,14 +913,14 @@ void gnutls_session_set_ptr(gnutls_session session, void *ptr) * write data. * **/ -int gnutls_record_get_direction(gnutls_session session) +int gnutls_record_get_direction(gnutls_session_t session) { return session->internals.direction; } /*- * _gnutls_rsa_pms_set_version - Sets a version to be used at the RSA PMS - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @major: is the major version to use * @minor: is the minor version to use * @@ -929,7 +929,7 @@ int gnutls_record_get_direction(gnutls_session session) * test server's capabilities. * -*/ -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) { session->internals.rsa_pms_version[0] = major; diff --git a/lib/gnutls_state.h b/lib/gnutls_state.h index 19433fef05..e7053370aa 100644 --- a/lib/gnutls_state.h +++ b/lib/gnutls_state.h @@ -3,12 +3,11 @@ #include <gnutls_int.h> -void _gnutls_session_cert_type_set(gnutls_session session, - gnutls_certificate_type); -gnutls_kx_algorithm gnutls_kx_get(gnutls_session session); -gnutls_cipher_algorithm gnutls_cipher_get(gnutls_session session); -gnutls_certificate_type gnutls_certificate_type_get(gnutls_session - session); +void _gnutls_session_cert_type_set(gnutls_session_t session, + gnutls_certificate_type_t); +gnutls_kx_algorithm_t gnutls_kx_get(gnutls_session_t session); +gnutls_cipher_algorithm_t gnutls_cipher_get(gnutls_session_t session); +gnutls_certificate_type_t gnutls_certificate_type_get(gnutls_session_t); #include <gnutls_auth_int.h> @@ -19,28 +18,27 @@ gnutls_certificate_type gnutls_certificate_type_get(gnutls_session #endif -int _gnutls_session_cert_type_supported(gnutls_session, - gnutls_certificate_type); +int _gnutls_session_cert_type_supported(gnutls_session_t, gnutls_certificate_type_t); -int _gnutls_dh_set_secret_bits(gnutls_session session, uint bits); +int _gnutls_dh_set_secret_bits(gnutls_session_t session, uint bits); -int _gnutls_dh_set_peer_public(gnutls_session session, mpi_t public); -int _gnutls_dh_set_group(gnutls_session session, mpi_t gen, mpi_t prime); +int _gnutls_dh_set_peer_public(gnutls_session_t session, mpi_t public); +int _gnutls_dh_set_group(gnutls_session_t session, mpi_t gen, mpi_t prime); -int _gnutls_dh_get_allowed_prime_bits(gnutls_session session); -void gnutls_dh_set_prime_bits(gnutls_session session, unsigned int bits); -void _gnutls_handshake_internal_state_clear(gnutls_session); +int _gnutls_dh_get_allowed_prime_bits(gnutls_session_t session); +void gnutls_dh_set_prime_bits(gnutls_session_t session, unsigned int bits); +void _gnutls_handshake_internal_state_clear(gnutls_session_t); -int _gnutls_rsa_export_set_pubkey(gnutls_session session, mpi_t exp, - mpi_t mod); +int _gnutls_rsa_export_set_pubkey(gnutls_session_t session, mpi_t exp, + mpi_t mod); -int _gnutls_session_is_resumable(gnutls_session session); -int _gnutls_session_is_export(gnutls_session session); +int _gnutls_session_is_resumable(gnutls_session_t session); +int _gnutls_session_is_export(gnutls_session_t session); -int _gnutls_openpgp_send_fingerprint(gnutls_session session); +int _gnutls_openpgp_send_fingerprint(gnutls_session_t session); int _gnutls_PRF(const opaque * secret, int secret_size, const char *label, - int label_size, opaque * seed, int seed_size, - int total_bytes, void *ret); + int label_size, opaque * seed, int seed_size, + int total_bytes, void *ret); #define DEFAULT_CERT_TYPE GNUTLS_CRT_X509 diff --git a/lib/gnutls_str.c b/lib/gnutls_str.c index 0e55c35d9a..ad30a94799 100644 --- a/lib/gnutls_str.c +++ b/lib/gnutls_str.c @@ -100,9 +100,9 @@ void _gnutls_string_clear(gnutls_string * str) /* This one does not copy the string. */ -gnutls_datum _gnutls_string2datum(gnutls_string * str) +gnutls_datum_t _gnutls_string2datum(gnutls_string * str) { - gnutls_datum ret; + gnutls_datum_t ret; ret.data = str->data; ret.size = str->length; diff --git a/lib/gnutls_str.h b/lib/gnutls_str.h index ec94878593..3162b8ff9c 100644 --- a/lib/gnutls_str.h +++ b/lib/gnutls_str.h @@ -24,7 +24,7 @@ void _gnutls_string_clear(gnutls_string *); /* Beware, do not clear the string, after calling this * function */ -gnutls_datum _gnutls_string2datum(gnutls_string * str); +gnutls_datum_t _gnutls_string2datum(gnutls_string * str); int _gnutls_string_copy_str(gnutls_string * dest, const char *src); int _gnutls_string_append_str(gnutls_string *, const char *str); diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c index d65011df4f..4956283eb4 100644 --- a/lib/gnutls_ui.c +++ b/lib/gnutls_ui.c @@ -37,7 +37,7 @@ /** * gnutls_dh_set_prime_bits - Used to set the bits for a DH ciphersuite - * @session: is a &gnutls_session structure. + * @session: is a &gnutls_session_t structure. * @bits: is the number of bits * * This function sets the number of bits, for use in an @@ -51,7 +51,7 @@ * handshake. * **/ -void gnutls_dh_set_prime_bits(gnutls_session session, unsigned int bits) +void gnutls_dh_set_prime_bits(gnutls_session_t session, unsigned int bits) { session->internals.dh_prime_bits = bits; } @@ -71,8 +71,8 @@ void gnutls_dh_set_prime_bits(gnutls_session session, unsigned int bits) * Returns a negative value in case of an error. * **/ -int gnutls_dh_get_group(gnutls_session session, - gnutls_datum * raw_gen, gnutls_datum * raw_prime) +int gnutls_dh_get_group(gnutls_session_t session, + gnutls_datum_t * raw_gen, gnutls_datum_t * raw_prime) { dh_info_t *dh; int ret; @@ -125,7 +125,7 @@ int gnutls_dh_get_group(gnutls_session session, * Returns a negative value in case of an error. * **/ -int gnutls_dh_get_pubkey(gnutls_session session, gnutls_datum * raw_key) +int gnutls_dh_get_pubkey(gnutls_session_t session, gnutls_datum_t * raw_key) { dh_info_t *dh; anon_server_auth_info_t anon_info; @@ -167,8 +167,8 @@ int gnutls_dh_get_pubkey(gnutls_session session, gnutls_datum * raw_key) * Returns a negative value in case of an error. * **/ -int gnutls_rsa_export_get_pubkey(gnutls_session session, - gnutls_datum * exp, gnutls_datum * mod) +int gnutls_rsa_export_get_pubkey(gnutls_session_t session, + gnutls_datum_t * exp, gnutls_datum_t * mod) { cert_auth_info_t info; int ret; @@ -209,7 +209,7 @@ int gnutls_rsa_export_get_pubkey(gnutls_session session, * Returns a negative value in case of an error. * **/ -int gnutls_dh_get_secret_bits(gnutls_session session) +int gnutls_dh_get_secret_bits(gnutls_session_t session) { switch (gnutls_auth_get_type(session)) { case GNUTLS_CRD_ANON:{ @@ -245,7 +245,7 @@ int gnutls_dh_get_secret_bits(gnutls_session session) * Returns a negative value in case of an error. * **/ -int gnutls_dh_get_prime_bits(gnutls_session session) +int gnutls_dh_get_prime_bits(gnutls_session_t session) { dh_info_t *dh; @@ -287,7 +287,7 @@ int gnutls_dh_get_prime_bits(gnutls_session session) * Returns a negative value in case of an error. * **/ -int gnutls_rsa_export_get_modulus_bits(gnutls_session session) +int gnutls_rsa_export_get_modulus_bits(gnutls_session_t session) { cert_auth_info_t info; @@ -307,7 +307,7 @@ int gnutls_rsa_export_get_modulus_bits(gnutls_session session) * Returns a negative value in case of an error. * **/ -int gnutls_dh_get_peers_public_bits(gnutls_session session) +int gnutls_dh_get_peers_public_bits(gnutls_session_t session) { dh_info_t *dh; @@ -354,9 +354,9 @@ int gnutls_dh_get_peers_public_bits(gnutls_session session) * Returns NULL in case of an error, or if no certificate was used. * **/ -const gnutls_datum *gnutls_certificate_get_ours(gnutls_session session) +const gnutls_datum_t *gnutls_certificate_get_ours(gnutls_session_t session) { - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; CHECK_AUTH(GNUTLS_CRD_CERTIFICATE, NULL); @@ -389,7 +389,7 @@ const gnutls_datum *gnutls_certificate_get_ours(gnutls_session session) * Returns NULL in case of an error, or if no certificate was sent. * **/ -const gnutls_datum *gnutls_certificate_get_peers(gnutls_session session, +const gnutls_datum_t *gnutls_certificate_get_peers(gnutls_session_t session, unsigned int *list_size) { cert_auth_info_t info; @@ -414,7 +414,7 @@ const gnutls_datum *gnutls_certificate_get_peers(gnutls_session session, * Returns a negative value in case of an error. * **/ -int gnutls_certificate_client_get_request_status(gnutls_session session) +int gnutls_certificate_client_get_request_status(gnutls_session_t session) { cert_auth_info_t info; @@ -446,8 +446,8 @@ int gnutls_certificate_client_get_request_status(gnutls_session session) * Returns a negative value in case of an error. * **/ -int gnutls_fingerprint(gnutls_digest_algorithm algo, - const gnutls_datum * data, void *result, +int gnutls_fingerprint(gnutls_digest_algorithm_t algo, + const gnutls_datum_t * data, void *result, size_t * result_size) { GNUTLS_HASH_HANDLE td; @@ -474,7 +474,7 @@ int gnutls_fingerprint(gnutls_digest_algorithm algo, /** * gnutls_anon_set_server_dh_params - This function will set the DH parameters for a server to use - * @res: is a gnutls_anon_server_credentials structure + * @res: is a gnutls_anon_server_credentials_t structure * @dh_params: is a structure that holds diffie hellman parameters. * * This function will set the diffie hellman parameters for an anonymous @@ -482,15 +482,15 @@ int gnutls_fingerprint(gnutls_digest_algorithm algo, * cipher suites. * **/ -void gnutls_anon_set_server_dh_params(gnutls_anon_server_credentials res, - gnutls_dh_params dh_params) +void gnutls_anon_set_server_dh_params(gnutls_anon_server_credentials_t res, + gnutls_dh_params_t dh_params) { res->dh_params = dh_params; } /** * gnutls_certificate_set_dh_params - This function will set the DH parameters for a server to use - * @res: is a gnutls_certificate_credentials structure + * @res: is a gnutls_certificate_credentials_t structure * @dh_params: is a structure that holds diffie hellman parameters. * * This function will set the diffie hellman parameters for a certificate @@ -498,15 +498,15 @@ void gnutls_anon_set_server_dh_params(gnutls_anon_server_credentials res, * cipher suites. * **/ -void gnutls_certificate_set_dh_params(gnutls_certificate_credentials res, - gnutls_dh_params dh_params) +void gnutls_certificate_set_dh_params(gnutls_certificate_credentials_t res, + gnutls_dh_params_t dh_params) { res->dh_params = dh_params; } /** * gnutls_certificate_set_params_function - This function will set the DH or RSA parameters callback - * @res: is a gnutls_certificate_credentials structure + * @res: is a gnutls_certificate_credentials_t structure * @func: is the function to be called * * This function will set a callback in order for the server to get the @@ -514,7 +514,7 @@ void gnutls_certificate_set_dh_params(gnutls_certificate_credentials res, * should return zero on success. * **/ -void gnutls_certificate_set_params_function(gnutls_certificate_credentials +void gnutls_certificate_set_params_function(gnutls_certificate_credentials_t res, gnutls_params_function * func) { @@ -523,7 +523,7 @@ void gnutls_certificate_set_params_function(gnutls_certificate_credentials /** * gnutls_anon_set_params_function - This function will set the DH parameters callback - * @res: is a gnutls_certificate_credentials structure + * @res: is a gnutls_certificate_credentials_t structure * @func: is the function to be called * * This function will set a callback in order for the server to get the @@ -531,7 +531,7 @@ void gnutls_certificate_set_params_function(gnutls_certificate_credentials * return zero on success. * **/ -void gnutls_anon_set_params_function(gnutls_anon_server_credentials res, +void gnutls_anon_set_params_function(gnutls_anon_server_credentials_t res, gnutls_params_function * func) { res->params_func = func; @@ -540,14 +540,14 @@ void gnutls_anon_set_params_function(gnutls_anon_server_credentials res, /** * gnutls_certificate_set_verify_flags - This function will set the flags to be used at certificate verification - * @res: is a gnutls_certificate_credentials structure + * @res: is a gnutls_certificate_credentials_t structure * @flags: are the flagsis a structure that holds diffie hellman parameters. * * This function will set the flags to be used at verification of the certificates. * Flags must be OR of the gnutls_certificate_verify_flags enumerations. * **/ -void gnutls_certificate_set_verify_flags(gnutls_certificate_credentials +void gnutls_certificate_set_verify_flags(gnutls_certificate_credentials_t res, unsigned int flags) { res->verify_flags = flags; @@ -555,7 +555,7 @@ void gnutls_certificate_set_verify_flags(gnutls_certificate_credentials /** * gnutls_certificate_set_rsa_export_params - This function will set the RSA parameters for a server to use - * @res: is a gnutls_certificate_credentials structure + * @res: is a gnutls_certificate_credentials_t structure * @rsa_params: is a structure that holds temporary RSA parameters. * * This function will set the temporary RSA parameters for a certificate @@ -564,8 +564,8 @@ void gnutls_certificate_set_verify_flags(gnutls_certificate_credentials * **/ void -gnutls_certificate_set_rsa_export_params(gnutls_certificate_credentials - res, gnutls_rsa_params rsa_params) +gnutls_certificate_set_rsa_export_params(gnutls_certificate_credentials_t + res, gnutls_rsa_params_t rsa_params) { res->rsa_params = rsa_params; } diff --git a/lib/gnutls_ui.h b/lib/gnutls_ui.h index 29f6baa8b3..455625870c 100644 --- a/lib/gnutls_ui.h +++ b/lib/gnutls_ui.h @@ -1,128 +1,110 @@ #ifndef GNUTLS_UI_H # define GNUTLS_UI_H -typedef enum gnutls_x509_subject_alt_name { +typedef enum gnutls_x509_subject_alt_name_t { GNUTLS_SAN_DNSNAME = 1, GNUTLS_SAN_RFC822NAME, GNUTLS_SAN_URI, GNUTLS_SAN_IPADDRESS -} gnutls_x509_subject_alt_name; +} gnutls_x509_subject_alt_name_t; # ifdef LIBGNUTLS_VERSION /* These are defined only in gnutls.h */ struct gnutls_openpgp_key_int; -typedef struct gnutls_openpgp_key_int *gnutls_openpgp_key; +typedef struct gnutls_openpgp_key_int *gnutls_openpgp_key_t; struct gnutls_openpgp_privkey_int; -typedef struct gnutls_openpgp_privkey_int *gnutls_openpgp_privkey; +typedef struct gnutls_openpgp_privkey_int *gnutls_openpgp_privkey_t; typedef struct gnutls_retr_st { - gnutls_certificate_type type; + gnutls_certificate_type_t type; union cert { - gnutls_x509_crt *x509; - gnutls_openpgp_key pgp; + gnutls_x509_crt_t *x509; + gnutls_openpgp_key_t pgp; } cert; unsigned int ncerts; /* one for pgp keys */ union key { - gnutls_x509_privkey x509; - gnutls_openpgp_privkey pgp; + gnutls_x509_privkey_t x509; + gnutls_openpgp_privkey_t pgp; } key; unsigned int deinit_all; /* if non zero all keys will be deinited */ } gnutls_retr_st; -typedef int gnutls_certificate_client_retrieve_function(gnutls_session, - const gnutls_datum - * req_ca_rdn, - int nreqs, - const - gnutls_pk_algorithm - * pk_algos, - int - pk_algos_length, - gnutls_retr_st *); -typedef int gnutls_certificate_server_retrieve_function(gnutls_session, - gnutls_retr_st *); +typedef int gnutls_certificate_client_retrieve_function(gnutls_session_t, + const gnutls_datum_t* req_ca_rdn, int nreqs, + const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_retr_st *); +typedef int gnutls_certificate_server_retrieve_function(gnutls_session_t, + gnutls_retr_st *); /* Functions that allow auth_info_t structures handling */ -gnutls_credentials_type gnutls_auth_get_type(gnutls_session session); -gnutls_credentials_type gnutls_auth_server_get_type(gnutls_session - session); -gnutls_credentials_type gnutls_auth_client_get_type(gnutls_session - session); +gnutls_credentials_type_t gnutls_auth_get_type(gnutls_session_t session); +gnutls_credentials_type_t gnutls_auth_server_get_type(gnutls_session_t session); +gnutls_credentials_type_t gnutls_auth_client_get_type(gnutls_session_t session); /* DH */ -void gnutls_dh_set_prime_bits(gnutls_session session, int bits); -int gnutls_dh_get_secret_bits(gnutls_session); -int gnutls_dh_get_peers_public_bits(gnutls_session); -int gnutls_dh_get_prime_bits(gnutls_session); +void gnutls_dh_set_prime_bits(gnutls_session_t session, int bits); +int gnutls_dh_get_secret_bits(gnutls_session_t); +int gnutls_dh_get_peers_public_bits(gnutls_session_t); +int gnutls_dh_get_prime_bits(gnutls_session_t); -int gnutls_dh_get_group(gnutls_session, gnutls_datum * gen, - gnutls_datum * prime); -int gnutls_dh_get_pubkey(gnutls_session, gnutls_datum * pub); +int gnutls_dh_get_group(gnutls_session_t, gnutls_datum_t * gen, + gnutls_datum_t * prime); +int gnutls_dh_get_pubkey(gnutls_session_t, gnutls_datum_t * pub); /* RSA */ -int gnutls_rsa_export_get_pubkey(gnutls_session session, - gnutls_datum * exp, gnutls_datum * mod); -int gnutls_rsa_export_get_modulus_bits(gnutls_session session); +int gnutls_rsa_export_get_pubkey(gnutls_session_t session, + gnutls_datum_t * exp, gnutls_datum_t * mod); +int gnutls_rsa_export_get_modulus_bits(gnutls_session_t session); /* X509PKI */ /* These are set on the credentials structure. */ void -gnutls_certificate_client_set_retrieve_function -(gnutls_certificate_client_credentials, -gnutls_certificate_client_retrieve_function *); -void -gnutls_certificate_server_set_retrieve_function -(gnutls_certificate_server_credentials, -gnutls_certificate_server_retrieve_function *); +gnutls_certificate_client_set_retrieve_function( gnutls_certificate_credentials_t, + gnutls_certificate_client_retrieve_function *); +void gnutls_certificate_server_set_retrieve_function(gnutls_certificate_credentials_t, + gnutls_certificate_server_retrieve_function *); -void gnutls_certificate_server_set_request(gnutls_session, - gnutls_certificate_request); +void gnutls_certificate_server_set_request(gnutls_session_t, + gnutls_certificate_request_t); /* X.509 certificate handling functions */ -int gnutls_pkcs3_extract_dh_params(const gnutls_datum * params, - gnutls_x509_crt_fmt format, - gnutls_datum * prime, - gnutls_datum * generator, - int *prime_bits); -int gnutls_pkcs3_export_dh_params(const gnutls_datum * prime, - const gnutls_datum * generator, - gnutls_x509_crt_fmt format, - unsigned char *params_data, - int *params_data_size); +int gnutls_pkcs3_extract_dh_params(const gnutls_datum_t * params, + gnutls_x509_crt_fmt_t format, + gnutls_datum_t * prime, gnutls_datum_t * generator, int *prime_bits); +int gnutls_pkcs3_export_dh_params(const gnutls_datum_t * prime, + const gnutls_datum_t * generator, gnutls_x509_crt_fmt_t format, + unsigned char *params_data, int *params_data_size); /* get data from the session */ -const gnutls_datum *gnutls_certificate_get_peers(gnutls_session, - unsigned int *list_size); -const gnutls_datum *gnutls_certificate_get_ours(gnutls_session session); +const gnutls_datum_t *gnutls_certificate_get_peers(gnutls_session_t, + unsigned int *list_size); +const gnutls_datum_t *gnutls_certificate_get_ours(gnutls_session_t session); -time_t gnutls_certificate_activation_time_peers(gnutls_session session); -time_t gnutls_certificate_expiration_time_peers(gnutls_session session); +time_t gnutls_certificate_activation_time_peers(gnutls_session_t session); +time_t gnutls_certificate_expiration_time_peers(gnutls_session_t session); -int gnutls_certificate_client_get_request_status(gnutls_session); -int gnutls_certificate_verify_peers(gnutls_session); +int gnutls_certificate_client_get_request_status(gnutls_session_t); +int gnutls_certificate_verify_peers(gnutls_session_t); -int gnutls_pem_base64_encode(const char *header, const gnutls_datum * data, - char *result, size_t * result_size); +int gnutls_pem_base64_encode(const char *header, const gnutls_datum_t * data, + char *result, size_t * result_size); int gnutls_pem_base64_decode(const char *header, - const gnutls_datum * b64_data, - unsigned char *result, size_t * result_size); + const gnutls_datum_t * b64_data, + unsigned char *result, size_t * result_size); int gnutls_pem_base64_encode_alloc(const char *header, - const gnutls_datum * data, - gnutls_datum * result); + const gnutls_datum_t * data, gnutls_datum_t * result); int gnutls_pem_base64_decode_alloc(const char *header, - const gnutls_datum * b64_data, - gnutls_datum * result); + const gnutls_datum_t * b64_data, gnutls_datum_t * result); /* key_usage will be an OR of the following values: */ @@ -141,21 +123,21 @@ int gnutls_pem_base64_decode_alloc(const char *header, #define GNUTLS_KEY_DECIPHER_ONLY 32768 typedef struct gnutls_params_st { - gnutls_params_type type; + gnutls_params_type_t type; union params { - gnutls_dh_params dh; - gnutls_rsa_params rsa_export; + gnutls_dh_params_t dh; + gnutls_rsa_params_t rsa_export; } params; int deinit; } gnutls_params_st; -typedef int gnutls_params_function(gnutls_session, gnutls_params_type, +typedef int gnutls_params_function(gnutls_session_t, gnutls_params_type_t, gnutls_params_st *); -void gnutls_certificate_set_params_function(gnutls_certificate_credentials +void gnutls_certificate_set_params_function(gnutls_certificate_credentials_t res, gnutls_params_function * func); -void gnutls_anon_set_params_function(gnutls_certificate_credentials res, +void gnutls_anon_set_params_function(gnutls_certificate_credentials_t res, gnutls_params_function * func); diff --git a/lib/gnutls_v2_compat.c b/lib/gnutls_v2_compat.c index 0cda405a00..983c631475 100644 --- a/lib/gnutls_v2_compat.c +++ b/lib/gnutls_v2_compat.c @@ -41,7 +41,7 @@ #include "gnutls_auth_int.h" /* This selects the best supported ciphersuite from the ones provided */ -static int _gnutls_handshake_select_v2_suite(gnutls_session session, +static int _gnutls_handshake_select_v2_suite(gnutls_session_t session, opaque * data, int datalen) { int i, j, ret; @@ -82,20 +82,20 @@ static int _gnutls_handshake_select_v2_suite(gnutls_session session, /* Read a v2 client hello. Some browsers still use that beast! * However they set their version to 3.0 or 3.1. */ -int _gnutls_read_client_hello_v2(gnutls_session session, opaque * data, +int _gnutls_read_client_hello_v2(gnutls_session_t session, opaque * data, int datalen) { uint16 session_id_len = 0; int pos = 0; int ret = 0; uint16 sizeOfSuites; - gnutls_protocol_version version; + gnutls_protocol_t version; opaque random[TLS_RANDOM_SIZE]; int len = datalen; int err; uint16 challenge; opaque session_id[TLS_MAX_SESSION_ID_SIZE]; - gnutls_protocol_version ver; + gnutls_protocol_t ver; /* we only want to get here once - only in client hello */ session->internals.v2_hello = 0; diff --git a/lib/gnutls_v2_compat.h b/lib/gnutls_v2_compat.h index ce935d5782..1573e7549e 100644 --- a/lib/gnutls_v2_compat.h +++ b/lib/gnutls_v2_compat.h @@ -1,2 +1,2 @@ -int _gnutls_read_client_hello_v2(gnutls_session session, opaque * data, +int _gnutls_read_client_hello_v2(gnutls_session_t session, opaque * data, int datalen); diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index 6e6ca037c5..4c4dd71a2d 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -64,17 +64,17 @@ * @session: is a gnutls session * * This function will try to verify the peer's certificate and return its status (TRUSTED, REVOKED etc.). - * The return value (status) should be one of the gnutls_certificate_status enumerated elements. + * The return value (status) should be one of the gnutls_certificate_status_t enumerated elements. * However you must also check the peer's name in order to check if the verified certificate belongs to the * actual peer. Returns a negative error code in case of an error, or GNUTLS_E_NO_CERTIFICATE_FOUND if no certificate was sent. * -*/ -int _gnutls_x509_cert_verify_peers(gnutls_session session) +int _gnutls_x509_cert_verify_peers(gnutls_session_t session) { cert_auth_info_t info; - const gnutls_certificate_credentials cred; + const gnutls_certificate_credentials_t cred; unsigned int verify; - gnutls_x509_crt *peer_certificate_list; + gnutls_x509_crt_t *peer_certificate_list; int peer_certificate_list_size, i, x, ret; CHECK_AUTH(GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); @@ -101,7 +101,7 @@ int _gnutls_x509_cert_verify_peers(gnutls_session session) peer_certificate_list = gnutls_calloc(1, peer_certificate_list_size * - sizeof(gnutls_x509_crt)); + sizeof(gnutls_x509_crt_t)); if (peer_certificate_list == NULL) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; @@ -153,10 +153,10 @@ int _gnutls_x509_cert_verify_peers(gnutls_session session) /* returns error if the certificate has different algorithm than * the given key parameters. */ -static int _gnutls_check_key_cert_match(gnutls_certificate_credentials res) +static int _gnutls_check_key_cert_match(gnutls_certificate_credentials_t res) { - gnutls_datum cid; - gnutls_datum kid; + gnutls_datum_t cid; + gnutls_datum_t kid; uint pk = res->cert_list[res->ncerts - 1][0].subject_pk_algorithm; if (res->pkey[res->ncerts - 1].pk_algorithm != pk) { @@ -212,7 +212,7 @@ static int _gnutls_check_key_cert_match(gnutls_certificate_credentials res) * returns the number of certificates parsed (1) */ static int parse_crt_mem(gnutls_cert ** cert_list, uint * ncerts, - gnutls_x509_crt cert) + gnutls_x509_crt_t cert) { int i; int ret; @@ -246,8 +246,8 @@ static int parse_crt_mem(gnutls_cert ** cert_list, uint * ncerts, static int parse_der_cert_mem(gnutls_cert ** cert_list, uint * ncerts, const void *input_cert, int input_cert_size) { - gnutls_datum tmp; - gnutls_x509_crt cert; + gnutls_datum_t tmp; + gnutls_x509_crt_t cert; int ret; ret = gnutls_x509_crt_init(&cert); @@ -285,11 +285,11 @@ static int parse_pkcs7_cert_mem(gnutls_cert ** cert_list, uint * ncerts, const { #ifdef ENABLE_PKI int i, j, count; - gnutls_datum tmp, tmp2; + gnutls_datum_t tmp, tmp2; int ret; opaque *pcert = NULL; size_t pcert_size; - gnutls_pkcs7 pkcs7; + gnutls_pkcs7_t pkcs7; ret = gnutls_pkcs7_init(&pkcs7); if (ret < 0) { @@ -400,7 +400,7 @@ static int parse_pem_cert_mem(gnutls_cert ** cert_list, uint * ncerts, int size, siz2, i; const char *ptr; opaque *ptr2; - gnutls_datum tmp; + gnutls_datum_t tmp; int ret, count; #ifdef ENABLE_PKI @@ -490,8 +490,8 @@ static int parse_pem_cert_mem(gnutls_cert ** cert_list, uint * ncerts, /* Reads a DER or PEM certificate from memory */ static -int read_cert_mem(gnutls_certificate_credentials res, const void *cert, - int cert_size, gnutls_x509_crt_fmt type) +int read_cert_mem(gnutls_certificate_credentials_t res, const void *cert, + int cert_size, gnutls_x509_crt_fmt_t type) { int ret; @@ -538,7 +538,7 @@ int read_cert_mem(gnutls_certificate_credentials res, const void *cert, int _gnutls_x509_privkey_to_gkey(gnutls_privkey * dest, - gnutls_x509_privkey src) + gnutls_x509_privkey_t src) { int i, ret; @@ -578,10 +578,10 @@ void _gnutls_gkey_deinit(gnutls_privkey * key) } int _gnutls_x509_raw_privkey_to_gkey(gnutls_privkey * privkey, - const gnutls_datum * raw_key, - gnutls_x509_crt_fmt type) + const gnutls_datum_t * raw_key, + gnutls_x509_crt_fmt_t type) { - gnutls_x509_privkey tmpkey; + gnutls_x509_privkey_t tmpkey; int ret; ret = gnutls_x509_privkey_init(&tmpkey); @@ -613,12 +613,12 @@ int _gnutls_x509_raw_privkey_to_gkey(gnutls_privkey * privkey, * 2002-01-26: Added ability to read DSA keys. * type indicates the certificate format. */ -static int read_key_mem(gnutls_certificate_credentials res, +static int read_key_mem(gnutls_certificate_credentials_t res, const void *key, int key_size, - gnutls_x509_crt_fmt type) + gnutls_x509_crt_fmt_t type) { int ret; - gnutls_datum tmp; + gnutls_datum_t tmp; /* allocate space for the pkey list */ @@ -752,8 +752,8 @@ strfile _gnutls_file_to_str(const char *file) /* Reads a certificate file */ -static int read_cert_file(gnutls_certificate_credentials res, - const char *certfile, gnutls_x509_crt_fmt type) +static int read_cert_file(gnutls_certificate_credentials_t res, + const char *certfile, gnutls_x509_crt_fmt_t type) { int ret; strfile x; @@ -776,8 +776,8 @@ static int read_cert_file(gnutls_certificate_credentials res, /* Reads PKCS-1 RSA private key file or a DSA file (in the format openssl * stores it). */ -static int read_key_file(gnutls_certificate_credentials res, - const char *keyfile, gnutls_x509_crt_fmt type) +static int read_key_file(gnutls_certificate_credentials_t res, + const char *keyfile, gnutls_x509_crt_fmt_t type) { int ret; strfile x; @@ -795,14 +795,14 @@ static int read_key_file(gnutls_certificate_credentials res, } /** - * gnutls_certificate_set_x509_key_mem - Used to set keys in a gnutls_certificate_credentials structure - * @res: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_set_x509_key_mem - Used to set keys in a gnutls_certificate_credentials_t structure + * @res: is an &gnutls_certificate_credentials_t structure. * @cert: contains a certificate list (path) for the specified private key * @key: is the private key * @type: is PEM or DER * * This function sets a certificate/private key pair in the - * gnutls_certificate_credentials structure. This function may be called + * gnutls_certificate_credentials_t structure. This function may be called * more than once (in case multiple keys/certificates exist for the * server). * @@ -820,10 +820,10 @@ static int read_key_file(gnutls_certificate_credentials res, * then the strings that hold their values must be null terminated. * **/ -int gnutls_certificate_set_x509_key_mem(gnutls_certificate_credentials res, - const gnutls_datum * cert, - const gnutls_datum * key, - gnutls_x509_crt_fmt type) +int gnutls_certificate_set_x509_key_mem(gnutls_certificate_credentials_t res, + const gnutls_datum_t * cert, + const gnutls_datum_t * key, + gnutls_x509_crt_fmt_t type) { int ret; @@ -846,22 +846,22 @@ int gnutls_certificate_set_x509_key_mem(gnutls_certificate_credentials res, } /** - * gnutls_certificate_set_x509_key - Used to set keys in a gnutls_certificate_credentials structure - * @res: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_set_x509_key - Used to set keys in a gnutls_certificate_credentials_t structure + * @res: is an &gnutls_certificate_credentials_t structure. * @cert_list: contains a certificate list (path) for the specified private key * @cert_list_size: holds the size of the certificate list - * @key: is a gnutls_x509_privkey key + * @key: is a gnutls_x509_privkey_t key * * This function sets a certificate/private key pair in the - * gnutls_certificate_credentials structure. This function may be called + * gnutls_certificate_credentials_t structure. This function may be called * more than once (in case multiple keys/certificates exist for the * server). * **/ -int gnutls_certificate_set_x509_key(gnutls_certificate_credentials res, - gnutls_x509_crt * cert_list, +int gnutls_certificate_set_x509_key(gnutls_certificate_credentials_t res, + gnutls_x509_crt_t * cert_list, int cert_list_size, - gnutls_x509_privkey key) + gnutls_x509_privkey_t key) { int ret, i; @@ -924,15 +924,15 @@ int gnutls_certificate_set_x509_key(gnutls_certificate_credentials res, } /** - * gnutls_certificate_set_x509_key_file - Used to set keys in a gnutls_certificate_credentials structure - * @res: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_set_x509_key_file - Used to set keys in a gnutls_certificate_credentials_t structure + * @res: is an &gnutls_certificate_credentials_t structure. * @CERTFILE: is a file that containing the certificate list (path) for * the specified private key, in PKCS7 format, or a list of certificates * @KEYFILE: is a file that contains the private key * @type: is PEM or DER * * This function sets a certificate/private key pair in the - * gnutls_certificate_credentials structure. This function may be called + * gnutls_certificate_credentials_t structure. This function may be called * more than once (in case multiple keys/certificates exist for the * server). * @@ -940,10 +940,10 @@ int gnutls_certificate_set_x509_key(gnutls_certificate_credentials res, * this function. * **/ -int gnutls_certificate_set_x509_key_file(gnutls_certificate_credentials +int gnutls_certificate_set_x509_key_file(gnutls_certificate_credentials_t res, const char *CERTFILE, const char *KEYFILE, - gnutls_x509_crt_fmt type) + gnutls_x509_crt_fmt_t type) { int ret; @@ -965,10 +965,10 @@ int gnutls_certificate_set_x509_key_file(gnutls_certificate_credentials return 0; } -static int generate_rdn_seq(gnutls_certificate_credentials res) +static int generate_rdn_seq(gnutls_certificate_credentials_t res) { - gnutls_datum tmp; - gnutls_datum _tmp; + gnutls_datum_t tmp; + gnutls_datum_t _tmp; int ret; uint size, i; opaque *pdata; @@ -1030,11 +1030,11 @@ static int generate_rdn_seq(gnutls_certificate_credentials res) -/* Returns 0 if it's ok to use the gnutls_kx_algorithm with this +/* Returns 0 if it's ok to use the gnutls_kx_algorithm_t with this * certificate (uses the KeyUsage field). */ int _gnutls_check_key_usage(const gnutls_cert * cert, - gnutls_kx_algorithm alg) + gnutls_kx_algorithm_t alg) { unsigned int keyUsage = 0; int encipher_type; @@ -1081,12 +1081,12 @@ int _gnutls_check_key_usage(const gnutls_cert * cert, -static int parse_pem_ca_mem(gnutls_x509_crt ** cert_list, uint * ncerts, +static int parse_pem_ca_mem(gnutls_x509_crt_t ** cert_list, uint * ncerts, const opaque * input_cert, int input_cert_size) { int i, size; const opaque *ptr; - gnutls_datum tmp; + gnutls_datum_t tmp; int ret, count; /* move to the certificate @@ -1107,10 +1107,10 @@ static int parse_pem_ca_mem(gnutls_x509_crt ** cert_list, uint * ncerts, do { *cert_list = - (gnutls_x509_crt *) gnutls_realloc_fast(*cert_list, + (gnutls_x509_crt_t *) gnutls_realloc_fast(*cert_list, i * sizeof - (gnutls_x509_crt)); + (gnutls_x509_crt_t)); if (*cert_list == NULL) { gnutls_assert(); @@ -1167,19 +1167,19 @@ static int parse_pem_ca_mem(gnutls_x509_crt ** cert_list, uint * ncerts, * a gnutls_cert structure. This is only called if PKCS7 read fails. * returns the number of certificates parsed (1) */ -static int parse_der_ca_mem(gnutls_x509_crt ** cert_list, uint * ncerts, +static int parse_der_ca_mem(gnutls_x509_crt_t ** cert_list, uint * ncerts, const void *input_cert, int input_cert_size) { int i; - gnutls_datum tmp; + gnutls_datum_t tmp; int ret; i = *ncerts + 1; *cert_list = - (gnutls_x509_crt *) gnutls_realloc_fast(*cert_list, + (gnutls_x509_crt_t *) gnutls_realloc_fast(*cert_list, i * - sizeof(gnutls_x509_crt)); + sizeof(gnutls_x509_crt_t)); if (*cert_list == NULL) { gnutls_assert(); @@ -1209,8 +1209,8 @@ static int parse_der_ca_mem(gnutls_x509_crt ** cert_list, uint * ncerts, } /** - * gnutls_certificate_set_x509_trust_mem - Used to add trusted CAs in a gnutls_certificate_credentials structure - * @res: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_set_x509_trust_mem - Used to add trusted CAs in a gnutls_certificate_credentials_t structure + * @res: is an &gnutls_certificate_credentials_t structure. * @ca: is a list of trusted CAs or a DER certificate * @type: is DER or PEM * @@ -1228,9 +1228,9 @@ static int parse_der_ca_mem(gnutls_x509_crt ** cert_list, uint * ncerts, * value on error. * **/ -int gnutls_certificate_set_x509_trust_mem(gnutls_certificate_credentials - res, const gnutls_datum * ca, - gnutls_x509_crt_fmt type) +int gnutls_certificate_set_x509_trust_mem(gnutls_certificate_credentials_t + res, const gnutls_datum_t * ca, + gnutls_x509_crt_fmt_t type) { int ret, ret2; @@ -1248,8 +1248,8 @@ int gnutls_certificate_set_x509_trust_mem(gnutls_certificate_credentials } /** - * gnutls_certificate_set_x509_trust - Used to add trusted CAs in a gnutls_certificate_credentials structure - * @res: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_set_x509_trust - Used to add trusted CAs in a gnutls_certificate_credentials_t structure + * @res: is an &gnutls_certificate_credentials_t structure. * @ca_list: is a list of trusted CAs * @ca_list_size: holds the size of the CA list * @@ -1266,8 +1266,8 @@ int gnutls_certificate_set_x509_trust_mem(gnutls_certificate_credentials * Returns 0 on success. * **/ -int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials res, - gnutls_x509_crt * ca_list, +int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials_t res, + gnutls_x509_crt_t * ca_list, int ca_list_size) { int ret, i, ret2; @@ -1275,7 +1275,7 @@ int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials res, res->x509_ca_list = gnutls_realloc_fast(res->x509_ca_list, (ca_list_size + res->x509_ncas) * - sizeof(gnutls_x509_crt)); + sizeof(gnutls_x509_crt_t)); if (res->x509_ca_list == NULL) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; @@ -1298,8 +1298,8 @@ int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials res, } /** - * gnutls_certificate_set_x509_trust_file - Used to add trusted CAs in a gnutls_certificate_credentials structure - * @res: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_set_x509_trust_file - Used to add trusted CAs in a gnutls_certificate_credentials_t structure + * @res: is an &gnutls_certificate_credentials_t structure. * @cafile: is a file containing the list of trusted CAs (DER or PEM list) * @type: is PEM or DER * @@ -1317,9 +1317,9 @@ int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials res, * value on error. * **/ -int gnutls_certificate_set_x509_trust_file(gnutls_certificate_credentials +int gnutls_certificate_set_x509_trust_file(gnutls_certificate_credentials_t res, const char *cafile, - gnutls_x509_crt_fmt type) + gnutls_x509_crt_fmt_t type) { int ret, ret2; strfile x; @@ -1352,12 +1352,12 @@ int gnutls_certificate_set_x509_trust_file(gnutls_certificate_credentials #ifdef ENABLE_PKI -static int parse_pem_crl_mem(gnutls_x509_crl ** crl_list, uint * ncrls, +static int parse_pem_crl_mem(gnutls_x509_crl_t ** crl_list, uint * ncrls, const opaque * input_crl, int input_crl_size) { int size, i; const opaque *ptr; - gnutls_datum tmp; + gnutls_datum_t tmp; int ret, count; /* move to the certificate @@ -1376,10 +1376,10 @@ static int parse_pem_crl_mem(gnutls_x509_crl ** crl_list, uint * ncrls, do { *crl_list = - (gnutls_x509_crl *) gnutls_realloc_fast(*crl_list, + (gnutls_x509_crl_t *) gnutls_realloc_fast(*crl_list, i * sizeof - (gnutls_x509_crl)); + (gnutls_x509_crl_t)); if (*crl_list == NULL) { gnutls_assert(); @@ -1429,19 +1429,19 @@ static int parse_pem_crl_mem(gnutls_x509_crl ** crl_list, uint * ncrls, * a gnutls_cert structure. This is only called if PKCS7 read fails. * returns the number of certificates parsed (1) */ -static int parse_der_crl_mem(gnutls_x509_crl ** crl_list, uint * ncrls, +static int parse_der_crl_mem(gnutls_x509_crl_t ** crl_list, uint * ncrls, const void *input_crl, int input_crl_size) { int i; - gnutls_datum tmp; + gnutls_datum_t tmp; int ret; i = *ncrls + 1; *crl_list = - (gnutls_x509_crl *) gnutls_realloc_fast(*crl_list, + (gnutls_x509_crl_t *) gnutls_realloc_fast(*crl_list, i * - sizeof(gnutls_x509_crl)); + sizeof(gnutls_x509_crl_t)); if (*crl_list == NULL) { gnutls_assert(); @@ -1474,8 +1474,8 @@ static int parse_der_crl_mem(gnutls_x509_crl ** crl_list, uint * ncrls, /* Reads a DER or PEM CRL from memory */ static -int read_crl_mem(gnutls_certificate_credentials res, const void *crl, - int crl_size, gnutls_x509_crt_fmt type) +int read_crl_mem(gnutls_certificate_credentials_t res, const void *crl, + int crl_size, gnutls_x509_crt_fmt_t type) { int ret; @@ -1484,7 +1484,7 @@ int read_crl_mem(gnutls_certificate_credentials res, const void *crl, res->x509_crl_list = gnutls_realloc_fast(res->x509_crl_list, (1 + res->x509_ncrls) * - sizeof(gnutls_x509_crl)); + sizeof(gnutls_x509_crl_t)); if (res->x509_crl_list == NULL) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; @@ -1506,8 +1506,8 @@ int read_crl_mem(gnutls_certificate_credentials res, const void *crl, } /** - * gnutls_certificate_set_x509_crl_mem - Used to add CRLs in a gnutls_certificate_credentials structure - * @res: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_set_x509_crl_mem - Used to add CRLs in a gnutls_certificate_credentials_t structure + * @res: is an &gnutls_certificate_credentials_t structure. * @CRL: is a list of trusted CRLs. They should have been verified before. * @type: is DER or PEM * @@ -1521,9 +1521,9 @@ int read_crl_mem(gnutls_certificate_credentials res, const void *crl, * on error. * **/ -int gnutls_certificate_set_x509_crl_mem(gnutls_certificate_credentials res, - const gnutls_datum * CRL, - gnutls_x509_crt_fmt type) +int gnutls_certificate_set_x509_crl_mem(gnutls_certificate_credentials_t res, + const gnutls_datum_t * CRL, + gnutls_x509_crt_fmt_t type) { int ret; @@ -1534,8 +1534,8 @@ int gnutls_certificate_set_x509_crl_mem(gnutls_certificate_credentials res, } /** - * gnutls_certificate_set_x509_crl - Used to add CRLs in a gnutls_certificate_credentials structure - * @res: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_set_x509_crl - Used to add CRLs in a gnutls_certificate_credentials_t structure + * @res: is an &gnutls_certificate_credentials_t structure. * @crl_list: is a list of trusted CRLs. They should have been verified before. * @crl_list_size: holds the size of the crl_list * @@ -1548,8 +1548,8 @@ int gnutls_certificate_set_x509_crl_mem(gnutls_certificate_credentials res, * Returns 0 on success. * **/ -int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials res, - gnutls_x509_crl * crl_list, +int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials_t res, + gnutls_x509_crl_t * crl_list, int crl_list_size) { int ret, i; @@ -1557,7 +1557,7 @@ int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials res, res->x509_crl_list = gnutls_realloc_fast(res->x509_crl_list, (crl_list_size + res->x509_ncrls) * - sizeof(gnutls_x509_crl)); + sizeof(gnutls_x509_crl_t)); if (res->x509_crl_list == NULL) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; @@ -1577,8 +1577,8 @@ int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials res, } /** - * gnutls_certificate_set_x509_crl_file - Used to add CRLs in a gnutls_certificate_credentials structure - * @res: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_set_x509_crl_file - Used to add CRLs in a gnutls_certificate_credentials_t structure + * @res: is an &gnutls_certificate_credentials_t structure. * @crlfile: is a file containing the list of verified CRLs (DER or PEM list) * @type: is PEM or DER * @@ -1592,9 +1592,9 @@ int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials res, * on error. * **/ -int gnutls_certificate_set_x509_crl_file(gnutls_certificate_credentials +int gnutls_certificate_set_x509_crl_file(gnutls_certificate_credentials_t res, const char *crlfile, - gnutls_x509_crt_fmt type) + gnutls_x509_crt_fmt_t type) { int ret; strfile x; @@ -1624,14 +1624,14 @@ int gnutls_certificate_set_x509_crl_file(gnutls_certificate_credentials /** - * gnutls_certificate_free_crls - Used to free all the CRLs from a gnutls_certificate_credentials structure - * @sc: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_free_crls - Used to free all the CRLs from a gnutls_certificate_credentials_t structure + * @sc: is an &gnutls_certificate_credentials_t structure. * * This function will delete all the CRLs associated * with the given credentials. * **/ -void gnutls_certificate_free_crls(gnutls_certificate_credentials sc) +void gnutls_certificate_free_crls(gnutls_certificate_credentials_t sc) { uint j; diff --git a/lib/gnutls_x509.h b/lib/gnutls_x509.h index ed29e3534a..d815b749da 100644 --- a/lib/gnutls_x509.h +++ b/lib/gnutls_x509.h @@ -1,6 +1,6 @@ #include <libtasn1.h> -int _gnutls_x509_cert_verify_peers(gnutls_session session); +int _gnutls_x509_cert_verify_peers(gnutls_session_t session); #define PEM_CERT_SEP2 "-----BEGIN X509 CERTIFICATE" #define PEM_CERT_SEP "-----BEGIN CERTIFICATE" @@ -12,7 +12,7 @@ int _gnutls_x509_cert_verify_peers(gnutls_session session); #define PEM_KEY_DSA_SEP "-----BEGIN DSA" int _gnutls_check_key_usage(const gnutls_cert * cert, - gnutls_kx_algorithm alg); + gnutls_kx_algorithm_t alg); int _gnutls_x509_read_rsa_params(opaque * der, int dersize, mpi_t * params); @@ -20,7 +20,6 @@ int _gnutls_x509_read_dsa_pubkey(opaque * der, int dersize, mpi_t * params); int _gnutls_x509_raw_privkey_to_gkey(gnutls_privkey * privkey, - const gnutls_datum * raw_key, - gnutls_x509_crt_fmt type); + const gnutls_datum_t * raw_key, gnutls_x509_crt_fmt_t type); int _gnutls_x509_privkey_to_gkey(gnutls_privkey * privkey, - gnutls_x509_privkey); + gnutls_x509_privkey_t); diff --git a/lib/x509/common.c b/lib/x509/common.c index 9b281dfe4d..51da2b11df 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -255,7 +255,7 @@ void _gnutls_int2str(unsigned int k, char *data) } -gnutls_pk_algorithm _gnutls_x509_oid2pk_algorithm(const char *oid) +gnutls_pk_algorithm_t _gnutls_x509_oid2pk_algorithm(const char *oid) { if (strcmp(oid, PKIX1_RSA_OID) == 0) /* pkix-1 1 - RSA */ return GNUTLS_PK_RSA; @@ -267,7 +267,7 @@ gnutls_pk_algorithm _gnutls_x509_oid2pk_algorithm(const char *oid) return GNUTLS_PK_UNKNOWN; } -gnutls_sign_algorithm _gnutls_x509_oid2sign_algorithm(const char *oid) +gnutls_sign_algorithm_t _gnutls_x509_oid2sign_algorithm(const char *oid) { if (strcmp(oid, RSA_MD5_OID) == 0) { return GNUTLS_SIGN_RSA_MD5; @@ -287,7 +287,7 @@ gnutls_sign_algorithm _gnutls_x509_oid2sign_algorithm(const char *oid) /* returns -1 on error */ -gnutls_mac_algorithm _gnutls_x509_oid2mac_algorithm(const char *oid) +gnutls_mac_algorithm_t _gnutls_x509_oid2mac_algorithm(const char *oid) { if (strcmp(oid, OID_SHA1) == 0) return GNUTLS_MAC_SHA; @@ -297,7 +297,7 @@ gnutls_mac_algorithm _gnutls_x509_oid2mac_algorithm(const char *oid) return GNUTLS_MAC_UNKNOWN; } -const char *_gnutls_x509_mac_to_oid(gnutls_mac_algorithm mac) +const char *_gnutls_x509_mac_to_oid(gnutls_mac_algorithm_t mac) { if (mac == GNUTLS_MAC_SHA) return OID_SHA1; @@ -307,7 +307,7 @@ const char *_gnutls_x509_mac_to_oid(gnutls_mac_algorithm mac) return NULL; } -const char *_gnutls_x509_pk_to_oid(gnutls_pk_algorithm pk) +const char *_gnutls_x509_pk_to_oid(gnutls_pk_algorithm_t pk) { if (pk == GNUTLS_PK_RSA) return PKIX1_RSA_OID; @@ -317,8 +317,8 @@ const char *_gnutls_x509_pk_to_oid(gnutls_pk_algorithm pk) return NULL; } -gnutls_sign_algorithm _gnutls_x509_pk_to_sign(gnutls_pk_algorithm pk, - gnutls_mac_algorithm mac) +gnutls_sign_algorithm_t _gnutls_x509_pk_to_sign(gnutls_pk_algorithm_t pk, + gnutls_mac_algorithm_t mac) { if (pk == GNUTLS_PK_RSA) { if (mac == GNUTLS_MAC_SHA) @@ -332,10 +332,10 @@ gnutls_sign_algorithm _gnutls_x509_pk_to_sign(gnutls_pk_algorithm pk, return GNUTLS_SIGN_UNKNOWN; } -const char *_gnutls_x509_sign_to_oid(gnutls_pk_algorithm pk, - gnutls_mac_algorithm mac) +const char *_gnutls_x509_sign_to_oid(gnutls_pk_algorithm_t pk, + gnutls_mac_algorithm_t mac) { - gnutls_sign_algorithm sign; + gnutls_sign_algorithm_t sign; sign = _gnutls_x509_pk_to_sign(pk, mac); @@ -646,7 +646,7 @@ int _gnutls_x509_set_time(ASN1_TYPE c2, const char *where, time_t tim) } -gnutls_x509_subject_alt_name _gnutls_x509_san_find_type(char *str_type) +gnutls_x509_subject_alt_name_t _gnutls_x509_san_find_type(char *str_type) { if (strcmp(str_type, "dNSName") == 0) return GNUTLS_SAN_DNSNAME; @@ -656,14 +656,14 @@ gnutls_x509_subject_alt_name _gnutls_x509_san_find_type(char *str_type) return GNUTLS_SAN_URI; if (strcmp(str_type, "iPAddress") == 0) return GNUTLS_SAN_IPADDRESS; - return (gnutls_x509_subject_alt_name) - 1; + return (gnutls_x509_subject_alt_name_t) - 1; } /* A generic export function. Will export the given ASN.1 encoded data * to PEM or DER raw data. */ int _gnutls_x509_export_int(ASN1_TYPE asn1_data, - gnutls_x509_crt_fmt format, char *pem_header, + gnutls_x509_crt_fmt_t format, char *pem_header, int tmp_buf_size, unsigned char *output_data, size_t * output_data_size) { @@ -758,7 +758,7 @@ int _gnutls_x509_export_int(ASN1_TYPE asn1_data, * an octet string. */ int _gnutls_x509_read_value(ASN1_TYPE c, const char *root, - gnutls_datum * ret, int str) + gnutls_datum_t * ret, int str) { int len = 0, result; opaque *tmp = NULL; @@ -833,7 +833,7 @@ int _gnutls_x509_read_value(ASN1_TYPE c, const char *root, * an OCTET STRING. */ int _gnutls_x509_der_encode(ASN1_TYPE src, const char *src_name, - gnutls_datum * res, int str) + gnutls_datum_t * res, int str) { int size, result; int asize; @@ -919,7 +919,7 @@ int _gnutls_x509_der_encode_and_copy(ASN1_TYPE src, const char *src_name, int str) { int result; - gnutls_datum encoded; + gnutls_datum_t encoded; result = _gnutls_x509_der_encode(src, src_name, &encoded, str); @@ -946,12 +946,12 @@ int _gnutls_x509_der_encode_and_copy(ASN1_TYPE src, const char *src_name, * zero it encodes it as OCTET STRING. */ int _gnutls_x509_write_value(ASN1_TYPE c, const char *root, - const gnutls_datum * data, int str) + const gnutls_datum_t * data, int str) { int result; int asize; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; - gnutls_datum val; + gnutls_datum_t val; asize = data->size + 16; @@ -1017,12 +1017,12 @@ int _gnutls_x509_write_value(ASN1_TYPE c, const char *root, */ int _gnutls_x509_encode_and_copy_PKI_params(ASN1_TYPE dst, const char *dst_name, - gnutls_pk_algorithm + gnutls_pk_algorithm_t pk_algorithm, mpi_t * params, int params_size) { const char *pk; - gnutls_datum der = { NULL, 0 }; + gnutls_datum_t der = { NULL, 0 }; int result; char name[128]; @@ -1221,7 +1221,7 @@ int _gnutls_asn1_copy_node(ASN1_TYPE * dst, const char *dst_name, { int result; - gnutls_datum der; + gnutls_datum_t der; ASN1_TYPE dst_node; result = _gnutls_x509_der_encode(src, src_name, &der, 0); @@ -1257,9 +1257,9 @@ int _gnutls_asn1_copy_node(ASN1_TYPE * dst, const char *dst_name, * returns them into signed_data. */ int _gnutls_x509_get_signed_data(ASN1_TYPE src, const char *src_name, - gnutls_datum * signed_data) + gnutls_datum_t * signed_data) { - gnutls_datum der; + gnutls_datum_t der; int start, end, result; result = _gnutls_x509_der_encode(src, "", &der, 0); @@ -1298,7 +1298,7 @@ int _gnutls_x509_get_signed_data(ASN1_TYPE src, const char *src_name, * returns them into signed_data. */ int _gnutls_x509_get_signature(ASN1_TYPE src, const char *src_name, - gnutls_datum * signature) + gnutls_datum_t * signature) { int bits, result, len; diff --git a/lib/x509/common.h b/lib/x509/common.h index 6464e819b0..ce3025fadf 100644 --- a/lib/x509/common.h +++ b/lib/x509/common.h @@ -32,44 +32,44 @@ const char* _gnutls_x509_oid2ldap_string( const char* OID); int _gnutls_x509_oid_data_choice( const char* OID); int _gnutls_x509_oid_data_printable( const char* OID); -gnutls_pk_algorithm _gnutls_x509_oid2pk_algorithm( const char* oid); -gnutls_mac_algorithm _gnutls_x509_oid2mac_algorithm( const char* oid); -gnutls_sign_algorithm _gnutls_x509_oid2sign_algorithm( const char* oid); +gnutls_pk_algorithm_t _gnutls_x509_oid2pk_algorithm( const char* oid); +gnutls_mac_algorithm_t _gnutls_x509_oid2mac_algorithm( const char* oid); +gnutls_sign_algorithm_t _gnutls_x509_oid2sign_algorithm( const char* oid); -const char* _gnutls_x509_pk_to_oid( gnutls_pk_algorithm pk); +const char* _gnutls_x509_pk_to_oid( gnutls_pk_algorithm_t pk); -gnutls_sign_algorithm _gnutls_x509_pk_to_sign( - gnutls_pk_algorithm pk, gnutls_mac_algorithm mac); -const char* _gnutls_x509_sign_to_oid( gnutls_pk_algorithm, gnutls_mac_algorithm mac); -const char* _gnutls_x509_mac_to_oid( gnutls_mac_algorithm mac); +gnutls_sign_algorithm_t _gnutls_x509_pk_to_sign( + gnutls_pk_algorithm_t pk, gnutls_mac_algorithm_t mac); +const char* _gnutls_x509_sign_to_oid( gnutls_pk_algorithm_t, gnutls_mac_algorithm_t mac); +const char* _gnutls_x509_mac_to_oid( gnutls_mac_algorithm_t mac); time_t _gnutls_x509_get_time(ASN1_TYPE c2, const char *when); -gnutls_x509_subject_alt_name _gnutls_x509_san_find_type( char* str_type); +gnutls_x509_subject_alt_name_t _gnutls_x509_san_find_type( char* str_type); int _gnutls_x509_der_encode_and_copy( ASN1_TYPE src, const char* src_name, ASN1_TYPE dest, const char* dest_name, int str); int _gnutls_x509_der_encode( ASN1_TYPE src, const char* src_name, - gnutls_datum *res, int str); + gnutls_datum_t *res, int str); int _gnutls_x509_export_int( ASN1_TYPE asn1_data, - gnutls_x509_crt_fmt format, char* pem_header, + gnutls_x509_crt_fmt_t format, char* pem_header, int tmp_buf_size, unsigned char* output_data, size_t* output_data_size); -int _gnutls_x509_read_value( ASN1_TYPE c, const char* root, gnutls_datum *ret, int str); -int _gnutls_x509_write_value( ASN1_TYPE c, const char* root, const gnutls_datum* data, int str); +int _gnutls_x509_read_value( ASN1_TYPE c, const char* root, gnutls_datum_t *ret, int str); +int _gnutls_x509_write_value( ASN1_TYPE c, const char* root, const gnutls_datum_t* data, int str); int _gnutls_x509_encode_and_write_attribute( const char* given_oid, ASN1_TYPE asn1_struct, const char* where, const void* data, int sizeof_data, int multi); int _gnutls_x509_decode_and_read_attribute(ASN1_TYPE asn1_struct, const char* where, - char* oid, int oid_size, gnutls_datum* value, int multi); + char* oid, int oid_size, gnutls_datum_t* value, int multi); int _gnutls_x509_get_pk_algorithm( ASN1_TYPE src, const char* src_name, unsigned int* bits); int _gnutls_x509_encode_and_copy_PKI_params( ASN1_TYPE dst, const char* dst_name, - gnutls_pk_algorithm pk_algorithm, mpi_t* params, int params_size); + gnutls_pk_algorithm_t pk_algorithm, mpi_t* params, int params_size); int _gnutls_asn1_copy_node( ASN1_TYPE *dst, const char* dst_name, ASN1_TYPE src, const char* src_name); -int _gnutls_x509_get_signed_data( ASN1_TYPE src, const char* src_name, gnutls_datum * signed_data); -int _gnutls_x509_get_signature( ASN1_TYPE src, const char* src_name, gnutls_datum * signature); +int _gnutls_x509_get_signed_data( ASN1_TYPE src, const char* src_name, gnutls_datum_t * signed_data); +int _gnutls_x509_get_signature( ASN1_TYPE src, const char* src_name, gnutls_datum_t * signature); diff --git a/lib/x509/compat.c b/lib/x509/compat.c index 90aae9e60a..6e9797252c 100644 --- a/lib/x509/compat.c +++ b/lib/x509/compat.c @@ -25,11 +25,6 @@ * API. */ -#include <gnutls_global.h> -#include <gnutls_errors.h> -#include <string.h> /* memset */ -#include <dn.h> -#include <libtasn1.h> #include <gnutls/x509.h> /** @@ -41,9 +36,9 @@ * Returns a (time_t) -1 in case of an error. * **/ -time_t _gnutls_x509_get_raw_crt_activation_time(const gnutls_datum * cert) +time_t _gnutls_x509_get_raw_crt_activation_time(const gnutls_datum_t * cert) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; time_t result; result = gnutls_x509_crt_init(&xcert); @@ -72,9 +67,9 @@ time_t _gnutls_x509_get_raw_crt_activation_time(const gnutls_datum * cert) * Returns a (time_t) -1 in case of an error. * **/ -time_t _gnutls_x509_get_raw_crt_expiration_time(const gnutls_datum * cert) +time_t _gnutls_x509_get_raw_crt_expiration_time(const gnutls_datum_t * cert) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; time_t result; result = gnutls_x509_crt_init(&xcert); diff --git a/lib/x509/compat.h b/lib/x509/compat.h index 4e9a0f5e13..c312001bb3 100644 --- a/lib/x509/compat.h +++ b/lib/x509/compat.h @@ -1,2 +1,2 @@ -time_t _gnutls_x509_get_raw_crt_activation_time( const gnutls_datum*); -time_t _gnutls_x509_get_raw_crt_expiration_time( const gnutls_datum*); +time_t _gnutls_x509_get_raw_crt_activation_time( const gnutls_datum_t*); +time_t _gnutls_x509_get_raw_crt_expiration_time( const gnutls_datum_t*); diff --git a/lib/x509/crl.c b/lib/x509/crl.c index 3a6673b76d..5bda8bfabd 100644 --- a/lib/x509/crl.c +++ b/lib/x509/crl.c @@ -34,7 +34,7 @@ #include <dn.h> /** - * gnutls_x509_crl_init - This function initializes a gnutls_x509_crl structure + * gnutls_x509_crl_init - This function initializes a gnutls_x509_crl_t structure * @crl: The structure to be initialized * * This function will initialize a CRL structure. CRL stands for @@ -46,7 +46,7 @@ * Returns 0 on success. * **/ -int gnutls_x509_crl_init(gnutls_x509_crl * crl) +int gnutls_x509_crl_init(gnutls_x509_crl_t * crl) { *crl = gnutls_calloc(1, sizeof(gnutls_x509_crl_int)); @@ -65,13 +65,13 @@ int gnutls_x509_crl_init(gnutls_x509_crl * crl) } /** - * gnutls_x509_crl_deinit - This function deinitializes memory used by a gnutls_x509_crl structure + * gnutls_x509_crl_deinit - This function deinitializes memory used by a gnutls_x509_crl_t structure * @crl: The structure to be initialized * * This function will deinitialize a CRL structure. * **/ -void gnutls_x509_crl_deinit(gnutls_x509_crl crl) +void gnutls_x509_crl_deinit(gnutls_x509_crl_t crl) { if (!crl) return; @@ -89,18 +89,18 @@ void gnutls_x509_crl_deinit(gnutls_x509_crl crl) * @format: One of DER or PEM * * This function will convert the given DER or PEM encoded CRL - * to the native gnutls_x509_crl format. The output will be stored in 'crl'. + * to the native gnutls_x509_crl_t format. The output will be stored in 'crl'. * * If the CRL is PEM encoded it should have a header of "X509 CRL". * * Returns 0 on success. * **/ -int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data, - gnutls_x509_crt_fmt format) +int gnutls_x509_crl_import(gnutls_x509_crl_t crl, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format) { int result = 0, need_free = 0; - gnutls_datum _data; + gnutls_datum_t _data; _data.data = data->data; _data.size = data->size; @@ -153,7 +153,7 @@ int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data, /** * gnutls_x509_crl_get_issuer_dn - This function returns the CRL's issuer distinguished name - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * @buf: a pointer to a structure to hold the peer's name (may be null) * @sizeof_buf: initially holds the size of @buf * @@ -168,7 +168,7 @@ int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data, * 0 on success. * **/ -int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl crl, char *buf, +int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl_t crl, char *buf, size_t * sizeof_buf) { if (crl == NULL) { @@ -183,7 +183,7 @@ int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl crl, char *buf, /** * gnutls_x509_crl_get_issuer_dn_by_oid - This function returns the CRL's issuer distinguished name - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * @oid: holds an Object Identified in null terminated string * @indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use zero to get the first one. * @raw_flag: If non zero returns the raw DER data of the DN part. @@ -206,7 +206,7 @@ int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl crl, char *buf, * and 0 on success. * **/ -int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl crl, +int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl_t crl, const char *oid, int indx, unsigned int raw_flag, void *buf, size_t * sizeof_buf) @@ -223,7 +223,7 @@ int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl crl, /** * gnutls_x509_crl_get_issuer_dn_oid - This function returns the Certificate request issuer's distinguished name OIDs - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * @indx: Specifies which DN OID to send. Use zero to get the first one. * @oid: a pointer to a structure to hold the name (may be null) * @sizeof_oid: initially holds the size of 'oid' @@ -238,7 +238,7 @@ int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl crl, * On success 0 is returned. * **/ -int gnutls_x509_crl_get_dn_oid(gnutls_x509_crl crl, +int gnutls_x509_crl_get_dn_oid(gnutls_x509_crl_t crl, int indx, void *oid, size_t * sizeof_oid) { if (crl == NULL) { @@ -254,18 +254,18 @@ int gnutls_x509_crl_get_dn_oid(gnutls_x509_crl crl, /** * gnutls_x509_crl_get_signature_algorithm - This function returns the CRL's signature algorithm - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * - * This function will return a value of the gnutls_sign_algorithm enumeration that + * This function will return a value of the gnutls_sign_algorithm_t enumeration that * is the signature algorithm. * * Returns a negative value on error. * **/ -int gnutls_x509_crl_get_signature_algorithm(gnutls_x509_crl crl) +int gnutls_x509_crl_get_signature_algorithm(gnutls_x509_crl_t crl) { int result; - gnutls_datum sa; + gnutls_datum_t sa; if (crl == NULL) { gnutls_assert(); @@ -294,14 +294,14 @@ int gnutls_x509_crl_get_signature_algorithm(gnutls_x509_crl crl) /** * gnutls_x509_crl_get_version - This function returns the CRL's version number - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * * This function will return the version of the specified CRL. * * Returns a negative value on error. * **/ -int gnutls_x509_crl_get_version(gnutls_x509_crl crl) +int gnutls_x509_crl_get_version(gnutls_x509_crl_t crl) { opaque version[5]; int len, result; @@ -324,14 +324,14 @@ int gnutls_x509_crl_get_version(gnutls_x509_crl crl) /** * gnutls_x509_crl_get_this_update - This function returns the CRL's thisUpdate time - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * * This function will return the time this CRL was issued. * * Returns (time_t)-1 on error. * **/ -time_t gnutls_x509_crl_get_this_update(gnutls_x509_crl crl) +time_t gnutls_x509_crl_get_this_update(gnutls_x509_crl_t crl) { if (crl == NULL) { gnutls_assert(); @@ -343,7 +343,7 @@ time_t gnutls_x509_crl_get_this_update(gnutls_x509_crl crl) /** * gnutls_x509_crl_get_next_update - This function returns the CRL's nextUpdate time - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * * This function will return the time the next CRL will be issued. * This field is optional in a CRL so it might be normal to get @@ -352,7 +352,7 @@ time_t gnutls_x509_crl_get_this_update(gnutls_x509_crl crl) * Returns (time_t)-1 on error. * **/ -time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl crl) +time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl_t crl) { if (crl == NULL) { gnutls_assert(); @@ -364,7 +364,7 @@ time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl crl) /** * gnutls_x509_crl_get_crt_count - This function returns the number of revoked certificates in a CRL - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * * This function will return the number of revoked certificates in the * given CRL. @@ -372,7 +372,7 @@ time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl crl) * Returns a negative value on failure. * **/ -int gnutls_x509_crl_get_crt_count(gnutls_x509_crl crl) +int gnutls_x509_crl_get_crt_count(gnutls_x509_crl_t crl) { int count, result; @@ -396,7 +396,7 @@ int gnutls_x509_crl_get_crt_count(gnutls_x509_crl crl) /** * gnutls_x509_crl_get_crt_serial - This function returns the serial number of a revoked certificate - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * @index: the index of the certificate to extract (starting from 0) * @serial: where the serial number will be copied * @serial_size: initially holds the size of serial @@ -408,7 +408,7 @@ int gnutls_x509_crl_get_crt_count(gnutls_x509_crl crl) * Returns a negative value on failure. * **/ -int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl crl, int index, +int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl_t crl, int index, unsigned char *serial, size_t * serial_size, time_t * time) { @@ -454,7 +454,7 @@ int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl crl, int index, /*- * _gnutls_x509_crl_get_raw_issuer_dn - This function returns the issuer's DN DER encoded - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * @dn: will hold the starting point of the DN * * This function will return a pointer to the DER encoded DN structure and @@ -463,13 +463,13 @@ int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl crl, int index, * Returns a negative value on error, and zero on success. * -*/ -int _gnutls_x509_crl_get_raw_issuer_dn(gnutls_x509_crl crl, - gnutls_datum * dn) +int _gnutls_x509_crl_get_raw_issuer_dn(gnutls_x509_crl_t crl, + gnutls_datum_t * dn) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result, len1; int start1, end1; - gnutls_datum crl_signed_data; + gnutls_datum_t crl_signed_data; if (crl == NULL) { gnutls_assert(); @@ -545,8 +545,8 @@ int _gnutls_x509_crl_get_raw_issuer_dn(gnutls_x509_crl crl, * Returns 0 on success, and a negative value on failure. * **/ -int gnutls_x509_crl_export(gnutls_x509_crl crl, - gnutls_x509_crt_fmt format, void *output_data, +int gnutls_x509_crl_export(gnutls_x509_crl_t crl, + gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size) { if (crl == NULL) { @@ -560,7 +560,7 @@ int gnutls_x509_crl_export(gnutls_x509_crl crl, } /*- - * _gnutls_x509_crl_cpy - This function copies a gnutls_x509_crl structure + * _gnutls_x509_crl_cpy - This function copies a gnutls_x509_crl_t structure * @dest: The structure where to copy * @src: The structure to be copied * @@ -569,12 +569,12 @@ int gnutls_x509_crl_export(gnutls_x509_crl crl, * Returns 0 on success. * -*/ -int _gnutls_x509_crl_cpy(gnutls_x509_crl dest, gnutls_x509_crl src) +int _gnutls_x509_crl_cpy(gnutls_x509_crl_t dest, gnutls_x509_crl_t src) { int ret; size_t der_size; opaque *der; - gnutls_datum tmp; + gnutls_datum_t tmp; ret = gnutls_x509_crl_export(src, GNUTLS_X509_FMT_DER, NULL, &der_size); diff --git a/lib/x509/crl_write.c b/lib/x509/crl_write.c index c68889cf52..8b802dd0fb 100644 --- a/lib/x509/crl_write.c +++ b/lib/x509/crl_write.c @@ -41,11 +41,11 @@ #include <libtasn1.h> #include <gnutls_ui.h> -static void disable_optional_stuff(gnutls_x509_crl crl); +static void disable_optional_stuff(gnutls_x509_crl_t crl); /** * gnutls_x509_crl_set_version - This function will set the CRL version - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * @version: holds the version number. For CRLv1 crls must be 1. * * This function will set the version of the CRL. This @@ -55,7 +55,7 @@ static void disable_optional_stuff(gnutls_x509_crl crl); * Returns 0 on success. * **/ -int gnutls_x509_crl_set_version(gnutls_x509_crl crl, unsigned int version) +int gnutls_x509_crl_set_version(gnutls_x509_crl_t crl, unsigned int version) { int result; char null = version; @@ -80,7 +80,7 @@ int gnutls_x509_crl_set_version(gnutls_x509_crl crl, unsigned int version) /** * gnutls_x509_crl_sign - This function will sign a CRL with a key - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * @issuer: is the certificate of the certificate issuer * @issuer_key: holds the issuer's private key * @@ -93,8 +93,8 @@ int gnutls_x509_crl_set_version(gnutls_x509_crl crl, unsigned int version) * Returns 0 on success. * **/ -int gnutls_x509_crl_sign(gnutls_x509_crl crl, gnutls_x509_crt issuer, - gnutls_x509_privkey issuer_key) +int gnutls_x509_crl_sign(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer, + gnutls_x509_privkey_t issuer_key) { int result; @@ -119,7 +119,7 @@ int gnutls_x509_crl_sign(gnutls_x509_crl crl, gnutls_x509_crt issuer, /** * gnutls_x509_crl_set_this_update - This function will set the CRL's issuing time - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * @act_time: The actual time * * This function will set the time this CRL was issued. @@ -127,7 +127,7 @@ int gnutls_x509_crl_sign(gnutls_x509_crl crl, gnutls_x509_crt issuer, * Returns 0 on success, or a negative value in case of an error. * **/ -int gnutls_x509_crl_set_this_update(gnutls_x509_crl crl, time_t act_time) +int gnutls_x509_crl_set_this_update(gnutls_x509_crl_t crl, time_t act_time) { if (crl == NULL) { gnutls_assert(); @@ -140,7 +140,7 @@ int gnutls_x509_crl_set_this_update(gnutls_x509_crl crl, time_t act_time) /** * gnutls_x509_crl_set_next_update - This function will set the CRL next update time - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * @exp_time: The actual time * * This function will set the time this CRL will be updated. @@ -148,7 +148,7 @@ int gnutls_x509_crl_set_this_update(gnutls_x509_crl crl, time_t act_time) * Returns 0 on success, or a negative value in case of an error. * **/ -int gnutls_x509_crl_set_next_update(gnutls_x509_crl crl, time_t exp_time) +int gnutls_x509_crl_set_next_update(gnutls_x509_crl_t crl, time_t exp_time) { if (crl == NULL) { gnutls_assert(); @@ -160,7 +160,7 @@ int gnutls_x509_crl_set_next_update(gnutls_x509_crl crl, time_t exp_time) /** * gnutls_x509_crl_set_crt_serial - This function will set a revoked certificate's serial number - * @crl: should contain a gnutls_x509_crl structure + * @crl: should contain a gnutls_x509_crl_t structure * @serial: The revoked certificate's serial number * @serial_size: Holds the size of the serial field. * @revocation_time: The time this certificate was revoked @@ -170,7 +170,7 @@ int gnutls_x509_crl_set_next_update(gnutls_x509_crl crl, time_t exp_time) * Returns 0 on success, or a negative value in case of an error. * **/ -int gnutls_x509_crl_set_crt_serial(gnutls_x509_crl crl, const void *serial, +int gnutls_x509_crl_set_crt_serial(gnutls_x509_crl_t crl, const void *serial, size_t serial_size, time_t revocation_time) { @@ -221,8 +221,8 @@ int gnutls_x509_crl_set_crt_serial(gnutls_x509_crl crl, const void *serial, /** * gnutls_x509_crl_set_crt - This function will set a revoked certificate's serial number - * @crl: should contain a gnutls_x509_crl structure - * @crt: should contain a gnutls_x509_crt structure with the revoked certificate + * @crl: should contain a gnutls_x509_crl_t structure + * @crt: should contain a gnutls_x509_crt_t structure with the revoked certificate * @revocation_time: The time this certificate was revoked * * This function will set a revoked certificate's serial number to the CRL. @@ -230,7 +230,7 @@ int gnutls_x509_crl_set_crt_serial(gnutls_x509_crl crl, const void *serial, * Returns 0 on success, or a negative value in case of an error. * **/ -int gnutls_x509_crl_set_crt(gnutls_x509_crl crl, gnutls_x509_crt crt, +int gnutls_x509_crl_set_crt(gnutls_x509_crl_t crl, gnutls_x509_crt_t crt, time_t revocation_time) { int ret; @@ -264,7 +264,7 @@ int gnutls_x509_crl_set_crt(gnutls_x509_crl crl, gnutls_x509_crt crt, /* If OPTIONAL fields have not been initialized then * disable them. */ -static void disable_optional_stuff(gnutls_x509_crl crl) +static void disable_optional_stuff(gnutls_x509_crl_t crl) { asn1_write_value(crl->crl, "tbsCertList.crlExtensions", NULL, 0); diff --git a/lib/x509/crq.c b/lib/x509/crq.c index 0bbf0b903b..9bca8c79ef 100644 --- a/lib/x509/crq.c +++ b/lib/x509/crq.c @@ -42,7 +42,7 @@ #include <gnutls_ui.h> /** - * gnutls_x509_crq_init - This function initializes a gnutls_x509_crq structure + * gnutls_x509_crq_init - This function initializes a gnutls_x509_crq_t structure * @crq: The structure to be initialized * * This function will initialize a PKCS10 certificate request structure. @@ -50,7 +50,7 @@ * Returns 0 on success. * **/ -int gnutls_x509_crq_init(gnutls_x509_crq * crq) +int gnutls_x509_crq_init(gnutls_x509_crq_t * crq) { *crq = gnutls_calloc(1, sizeof(gnutls_x509_crq_int)); @@ -69,13 +69,13 @@ int gnutls_x509_crq_init(gnutls_x509_crq * crq) } /** - * gnutls_x509_crq_deinit - This function deinitializes memory used by a gnutls_x509_crq structure + * gnutls_x509_crq_deinit - This function deinitializes memory used by a gnutls_x509_crq_t structure * @crq: The structure to be initialized * * This function will deinitialize a CRL structure. * **/ -void gnutls_x509_crq_deinit(gnutls_x509_crq crq) +void gnutls_x509_crq_deinit(gnutls_x509_crq_t crq) { if (!crq) return; @@ -96,18 +96,18 @@ void gnutls_x509_crq_deinit(gnutls_x509_crq crq) * @format: One of DER or PEM * * This function will convert the given DER or PEM encoded Certificate - * to the native gnutls_x509_crq format. The output will be stored in @cert. + * to the native gnutls_x509_crq_t format. The output will be stored in @cert. * * If the Certificate is PEM encoded it should have a header of "NEW CERTIFICATE REQUEST". * * Returns 0 on success. * **/ -int gnutls_x509_crq_import(gnutls_x509_crq crq, const gnutls_datum * data, - gnutls_x509_crt_fmt format) +int gnutls_x509_crq_import(gnutls_x509_crq_t crq, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format) { int result = 0, need_free = 0; - gnutls_datum _data; + gnutls_datum_t _data; if (crq == NULL) { gnutls_assert(); @@ -163,7 +163,7 @@ int gnutls_x509_crq_import(gnutls_x509_crq crq, const gnutls_datum * data, /** * gnutls_x509_crq_get_dn - This function returns the Certificate request subject's distinguished name - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * @buf: a pointer to a structure to hold the name (may be null) * @sizeof_buf: initially holds the size of @buf * @@ -178,7 +178,7 @@ int gnutls_x509_crq_import(gnutls_x509_crq crq, const gnutls_datum * data, * On success 0 is returned. * **/ -int gnutls_x509_crq_get_dn(gnutls_x509_crq crq, char *buf, +int gnutls_x509_crq_get_dn(gnutls_x509_crq_t crq, char *buf, size_t * sizeof_buf) { if (crq == NULL) { @@ -193,7 +193,7 @@ int gnutls_x509_crq_get_dn(gnutls_x509_crq crq, char *buf, /** * gnutls_x509_crq_get_dn_by_oid - This function returns the Certificate request subject's distinguished name - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * @oid: holds an Object Identified in null terminated string * @indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use zero to get the first one. * @raw_flag: If non zero returns the raw DER data of the DN part. @@ -216,7 +216,7 @@ int gnutls_x509_crq_get_dn(gnutls_x509_crq crq, char *buf, * On success 0 is returned. * **/ -int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char *oid, +int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq_t crq, const char *oid, int indx, unsigned int raw_flag, void *buf, size_t * sizeof_buf) { @@ -232,7 +232,7 @@ int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char *oid, /** * gnutls_x509_crq_get_dn_oid - This function returns the Certificate request subject's distinguished name OIDs - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * @indx: Specifies which DN OID to send. Use zero to get the first one. * @oid: a pointer to a structure to hold the name (may be null) * @sizeof_oid: initially holds the size of @oid @@ -247,7 +247,7 @@ int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char *oid, * On success 0 is returned. * **/ -int gnutls_x509_crq_get_dn_oid(gnutls_x509_crq crq, +int gnutls_x509_crq_get_dn_oid(gnutls_x509_crq_t crq, int indx, void *oid, size_t * sizeof_oid) { if (crq == NULL) { @@ -384,7 +384,7 @@ static int parse_attribute(ASN1_TYPE asn1_struct, /** * gnutls_x509_crq_get_challenge_password - This function will get the challenge password - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * @pass: will hold a null terminated password * @sizeof_pass: Initially holds the size of @pass. * @@ -394,7 +394,7 @@ static int parse_attribute(ASN1_TYPE asn1_struct, * Returns 0 on success. * **/ -int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq crq, +int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq_t crq, char *pass, size_t * sizeof_pass) { @@ -409,7 +409,7 @@ int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq crq, /** * gnutls_x509_crq_set_dn_by_oid - This function will set the Certificate request subject's distinguished name - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * @oid: holds an Object Identifier in a null terminated string * @raw_flag: must be 0, or 1 if the data are DER encoded * @data: a pointer to the input data @@ -427,7 +427,7 @@ int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq crq, * Returns 0 on success. * **/ -int gnutls_x509_crq_set_dn_by_oid(gnutls_x509_crq crq, const char *oid, +int gnutls_x509_crq_set_dn_by_oid(gnutls_x509_crq_t crq, const char *oid, unsigned int raw_flag, const void *data, unsigned int sizeof_data) { @@ -442,7 +442,7 @@ int gnutls_x509_crq_set_dn_by_oid(gnutls_x509_crq crq, const char *oid, /** * gnutls_x509_crq_set_version - This function will set the Certificate request version - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * @version: holds the version number. For v1 Requests must be 1. * * This function will set the version of the certificate request. For @@ -451,7 +451,7 @@ int gnutls_x509_crq_set_dn_by_oid(gnutls_x509_crq crq, const char *oid, * Returns 0 on success. * **/ -int gnutls_x509_crq_set_version(gnutls_x509_crq crq, unsigned int version) +int gnutls_x509_crq_set_version(gnutls_x509_crq_t crq, unsigned int version) { int result; unsigned char null = version; @@ -477,14 +477,14 @@ int gnutls_x509_crq_set_version(gnutls_x509_crq crq, unsigned int version) /** * gnutls_x509_crq_get_version - This function returns the Certificate request's version number - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * * This function will return the version of the specified Certificate request. * * Returns a negative value on error. * **/ -int gnutls_x509_crq_get_version(gnutls_x509_crq crq) +int gnutls_x509_crq_get_version(gnutls_x509_crq_t crq) { opaque version[5]; int len, result; @@ -510,7 +510,7 @@ int gnutls_x509_crq_get_version(gnutls_x509_crq crq) /** * gnutls_x509_crq_set_key - This function will associate the Certificate request with a key - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * @key: holds a private key * * This function will set the public parameters from the given private key to the @@ -519,7 +519,7 @@ int gnutls_x509_crq_get_version(gnutls_x509_crq crq) * Returns 0 on success. * **/ -int gnutls_x509_crq_set_key(gnutls_x509_crq crq, gnutls_x509_privkey key) +int gnutls_x509_crq_set_key(gnutls_x509_crq_t crq, gnutls_x509_privkey_t key) { int result; @@ -544,7 +544,7 @@ int gnutls_x509_crq_set_key(gnutls_x509_crq crq, gnutls_x509_privkey key) /** * gnutls_x509_crq_set_challenge_password - This function will set a challenge password - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * @pass: holds a null terminated password * * This function will set a challenge password to be used when revoking the request. @@ -552,7 +552,7 @@ int gnutls_x509_crq_set_key(gnutls_x509_crq crq, gnutls_x509_privkey key) * Returns 0 on success. * **/ -int gnutls_x509_crq_set_challenge_password(gnutls_x509_crq crq, +int gnutls_x509_crq_set_challenge_password(gnutls_x509_crq_t crq, const char *pass) { int result; @@ -588,7 +588,7 @@ int gnutls_x509_crq_set_challenge_password(gnutls_x509_crq crq, /** * gnutls_x509_crq_sign - This function will sign a Certificate request with a key - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * @key: holds a private key * * This function will sign the certificate request with a private key. @@ -601,10 +601,10 @@ int gnutls_x509_crq_set_challenge_password(gnutls_x509_crq crq, * Returns 0 on success. * **/ -int gnutls_x509_crq_sign(gnutls_x509_crq crq, gnutls_x509_privkey key) +int gnutls_x509_crq_sign(gnutls_x509_crq_t crq, gnutls_x509_privkey_t key) { int result; - gnutls_datum signature; + gnutls_datum_t signature; if (crq == NULL) { gnutls_assert(); @@ -667,8 +667,8 @@ int gnutls_x509_crq_sign(gnutls_x509_crq crq, gnutls_x509_privkey key) * 0 on success. * **/ -int gnutls_x509_crq_export(gnutls_x509_crq crq, - gnutls_x509_crt_fmt format, void *output_data, +int gnutls_x509_crq_export(gnutls_x509_crq_t crq, + gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size) { if (crq == NULL) { @@ -683,7 +683,7 @@ int gnutls_x509_crq_export(gnutls_x509_crq crq, /** * gnutls_x509_crq_get_pk_algorithm - This function returns the certificate request's PublicKey algorithm - * @crq: should contain a gnutls_x509_crq structure + * @crq: should contain a gnutls_x509_crq_t structure * @bits: if bits is non null it will hold the size of the parameters' in bits * * This function will return the public key algorithm of a PKCS \#10 @@ -694,11 +694,11 @@ int gnutls_x509_crq_export(gnutls_x509_crq crq, * For DSA the bits returned are of the public * exponent. * - * Returns a member of the gnutls_pk_algorithm enumeration on success, + * Returns a member of the gnutls_pk_algorithm_t enumeration on success, * or a negative value on error. * **/ -int gnutls_x509_crq_get_pk_algorithm(gnutls_x509_crq crq, +int gnutls_x509_crq_get_pk_algorithm(gnutls_x509_crq_t crq, unsigned int *bits) { int result; diff --git a/lib/x509/crq.h b/lib/x509/crq.h index 35b89caf12..579b0a0983 100644 --- a/lib/x509/crq.h +++ b/lib/x509/crq.h @@ -5,17 +5,17 @@ typedef struct gnutls_x509_crq_int { ASN1_TYPE crq; } gnutls_x509_crq_int; -typedef struct gnutls_x509_crq_int *gnutls_x509_crq; +typedef struct gnutls_x509_crq_int *gnutls_x509_crq_t; -int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq crq, const char* oid, +int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq_t crq, const char* oid, int indx, unsigned int raw_flag, void *buf, size_t *sizeof_buf); -int gnutls_x509_crq_init(gnutls_x509_crq * crq); -void gnutls_x509_crq_deinit(gnutls_x509_crq crq); +int gnutls_x509_crq_init(gnutls_x509_crq_t * crq); +void gnutls_x509_crq_deinit(gnutls_x509_crq_t crq); -int gnutls_x509_crq_import(gnutls_x509_crq crq, const gnutls_datum * data, - gnutls_x509_crt_fmt format); +int gnutls_x509_crq_import(gnutls_x509_crq_t crq, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format); -int gnutls_x509_crq_get_pk_algorithm( gnutls_x509_crq crq, unsigned int* bits); +int gnutls_x509_crq_get_pk_algorithm( gnutls_x509_crq_t crq, unsigned int* bits); #endif diff --git a/lib/x509/dn.c b/lib/x509/dn.c index aa626c8a4a..184dcf318f 100644 --- a/lib/x509/dn.c +++ b/lib/x509/dn.c @@ -794,7 +794,7 @@ int _gnutls_x509_write_attribute(const char *given_oid, int _gnutls_x509_decode_and_read_attribute(ASN1_TYPE asn1_struct, const char *where, char *oid, int oid_size, - gnutls_datum * value, int multi) + gnutls_datum_t * value, int multi) { char tmpbuffer[128]; int len, result; @@ -923,7 +923,7 @@ int _gnutls_x509_set_dn_oid(ASN1_TYPE asn1_struct, * and 0 on success. * **/ -int gnutls_x509_rdn_get(const gnutls_datum * idn, +int gnutls_x509_rdn_get(const gnutls_datum_t * idn, char *buf, size_t * sizeof_buf) { int result; @@ -977,7 +977,7 @@ int gnutls_x509_rdn_get(const gnutls_datum * idn, * and 0 on success. * **/ -int gnutls_x509_rdn_get_by_oid(const gnutls_datum * idn, const char *oid, +int gnutls_x509_rdn_get_by_oid(const gnutls_datum_t * idn, const char *oid, int indx, unsigned int raw_flag, void *buf, size_t * sizeof_buf) { @@ -1026,7 +1026,7 @@ int gnutls_x509_rdn_get_by_oid(const gnutls_datum * idn, const char *oid, * and 0 on success. * **/ -int gnutls_x509_rdn_get_oid(const gnutls_datum * idn, +int gnutls_x509_rdn_get_oid(const gnutls_datum_t * idn, int indx, void *buf, size_t * sizeof_buf) { int result; @@ -1067,8 +1067,8 @@ int gnutls_x509_rdn_get_oid(const gnutls_datum * idn, * Returns 1 if the DN's match and zero if they don't match. Otherwise * a negative value is returned to indicate error. */ -int _gnutls_x509_compare_raw_dn(const gnutls_datum * dn1, - const gnutls_datum * dn2) +int _gnutls_x509_compare_raw_dn(const gnutls_datum_t * dn1, + const gnutls_datum_t * dn2) { if (dn1->size != dn2->size) { diff --git a/lib/x509/extensions.c b/lib/x509/extensions.c index 1d499f6abf..33392aa06a 100644 --- a/lib/x509/extensions.c +++ b/lib/x509/extensions.c @@ -41,9 +41,9 @@ * If the extension does not exist, GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will * be returned. */ -int _gnutls_x509_crt_get_extension(gnutls_x509_crt cert, +int _gnutls_x509_crt_get_extension(gnutls_x509_crt_t cert, const char *extension_id, int indx, - gnutls_datum * ret, + gnutls_datum_t * ret, unsigned int *_critical) { int k, result, len; @@ -52,7 +52,7 @@ int _gnutls_x509_crt_get_extension(gnutls_x509_crt cert, char str_critical[10]; int critical = 0; char extnID[128]; - gnutls_datum value; + gnutls_datum_t value; int indx_counter = 0; ret->data = NULL; @@ -160,7 +160,7 @@ int _gnutls_x509_crt_get_extension(gnutls_x509_crt cert, * If you have passed the last extension, GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will * be returned. */ -int _gnutls_x509_crt_get_extension_oid(gnutls_x509_crt cert, +int _gnutls_x509_crt_get_extension_oid(gnutls_x509_crt_t cert, int indx, void *oid, size_t * sizeof_oid) { @@ -239,7 +239,7 @@ int _gnutls_x509_crt_get_extension_oid(gnutls_x509_crt cert, * Critical will be either 0 or 1. */ static int set_extension(ASN1_TYPE asn, const char *extension_id, - const gnutls_datum * ext_data, + const gnutls_datum_t * ext_data, unsigned int critical) { int result; @@ -291,7 +291,7 @@ static int set_extension(ASN1_TYPE asn, const char *extension_id, * index here starts from one. */ static int overwrite_extension(ASN1_TYPE asn, unsigned int indx, - const gnutls_datum * ext_data, + const gnutls_datum_t * ext_data, unsigned int critical) { char name[128], name2[128], counter[MAX_INT_DIGITS]; @@ -333,9 +333,9 @@ static int overwrite_extension(ASN1_TYPE asn, unsigned int indx, * * Critical will be either 0 or 1. */ -int _gnutls_x509_crt_set_extension(gnutls_x509_crt cert, +int _gnutls_x509_crt_set_extension(gnutls_x509_crt_t cert, const char *ext_id, - const gnutls_datum * ext_data, + const gnutls_datum_t * ext_data, unsigned int critical) { int result; @@ -495,7 +495,7 @@ int _gnutls_x509_ext_extract_basicConstraints(int *CA, opaque * extnValue, /* generate the basicConstraints in a DER encoded extension * Use 0 or 1 (TRUE) for CA. */ -int _gnutls_x509_ext_gen_basicConstraints(int CA, gnutls_datum * der_ext) +int _gnutls_x509_ext_gen_basicConstraints(int CA, gnutls_datum_t * der_ext) { ASN1_TYPE ext = ASN1_TYPE_EMPTY; const char *str; @@ -538,7 +538,7 @@ int _gnutls_x509_ext_gen_basicConstraints(int CA, gnutls_datum * der_ext) /* generate the keyUsage in a DER encoded extension * Use an ORed SEQUENCE of GNUTLS_KEY_* for usage. */ -int _gnutls_x509_ext_gen_keyUsage(uint16 usage, gnutls_datum * der_ext) +int _gnutls_x509_ext_gen_keyUsage(uint16 usage, gnutls_datum_t * der_ext) { ASN1_TYPE ext = ASN1_TYPE_EMPTY; int result; @@ -574,7 +574,7 @@ int _gnutls_x509_ext_gen_keyUsage(uint16 usage, gnutls_datum * der_ext) } static int write_new_general_name(ASN1_TYPE ext, const char *ext_name, - gnutls_x509_subject_alt_name type, + gnutls_x509_subject_alt_name_t type, const char *data_string) { const char *str; @@ -634,9 +634,9 @@ static int write_new_general_name(ASN1_TYPE ext, const char *ext_name, /* Convert the given name to GeneralNames in a DER encoded extension. * This is the same as subject alternative name. */ -int _gnutls_x509_ext_gen_subject_alt_name(gnutls_x509_subject_alt_name +int _gnutls_x509_ext_gen_subject_alt_name(gnutls_x509_subject_alt_name_t type, const char *data_string, - gnutls_datum * der_ext) + gnutls_datum_t * der_ext) { ASN1_TYPE ext = ASN1_TYPE_EMPTY; int result; @@ -671,7 +671,7 @@ int _gnutls_x509_ext_gen_subject_alt_name(gnutls_x509_subject_alt_name /* generate the SubjectKeyID in a DER encoded extension */ int _gnutls_x509_ext_gen_key_id(const void *id, size_t id_size, - gnutls_datum * der_ext) + gnutls_datum_t * der_ext) { ASN1_TYPE ext = ASN1_TYPE_EMPTY; int result; @@ -706,7 +706,7 @@ int _gnutls_x509_ext_gen_key_id(const void *id, size_t id_size, /* generate the AuthorityKeyID in a DER encoded extension */ int _gnutls_x509_ext_gen_auth_key_id(const void *id, size_t id_size, - gnutls_datum * der_ext) + gnutls_datum_t * der_ext) { ASN1_TYPE ext = ASN1_TYPE_EMPTY; int result; @@ -747,13 +747,12 @@ int _gnutls_x509_ext_gen_auth_key_id(const void *id, size_t id_size, * reason_flags should be an or'ed sequence of GNUTLS_CRL_REASON_*. * */ -int _gnutls_x509_ext_gen_crl_dist_points(gnutls_x509_subject_alt_name type, - const void *data_string, - unsigned int reason_flags, - gnutls_datum * der_ext) +int _gnutls_x509_ext_gen_crl_dist_points(gnutls_x509_subject_alt_name_t type, + const void *data_string, unsigned int reason_flags, + gnutls_datum_t * der_ext) { ASN1_TYPE ext = ASN1_TYPE_EMPTY; - gnutls_datum gnames = { NULL, 0 }; + gnutls_datum_t gnames = { NULL, 0 }; int result; uint8 reasons[2]; diff --git a/lib/x509/extensions.h b/lib/x509/extensions.h index b3ca4c963a..c9f50a99ef 100644 --- a/lib/x509/extensions.h +++ b/lib/x509/extensions.h @@ -1,20 +1,20 @@ -int _gnutls_x509_crt_get_extension( gnutls_x509_crt cert, const char* extension_id, - int indx, gnutls_datum* ret, unsigned int* critical); +int _gnutls_x509_crt_get_extension( gnutls_x509_crt_t cert, const char* extension_id, + int indx, gnutls_datum_t* ret, unsigned int* critical); -int _gnutls_x509_crt_get_extension_oid( gnutls_x509_crt cert, +int _gnutls_x509_crt_get_extension_oid( gnutls_x509_crt_t cert, int indx, void* ret, size_t * ret_size); int _gnutls_x509_ext_extract_keyUsage(uint16 *keyUsage, opaque * extnValue, int extnValueLen); int _gnutls_x509_ext_extract_basicConstraints(int *CA, opaque * extnValue, int extnValueLen); -int _gnutls_x509_crt_set_extension( gnutls_x509_crt cert, const char* extension_id, - const gnutls_datum* ext_data, unsigned int critical); -int _gnutls_x509_ext_gen_basicConstraints(int CA, gnutls_datum* der_ext); -int _gnutls_x509_ext_gen_keyUsage(uint16 usage, gnutls_datum* der_ext); -int _gnutls_x509_ext_gen_subject_alt_name(gnutls_x509_subject_alt_name type, - const char* data_string, gnutls_datum* der_ext); -int _gnutls_x509_ext_gen_crl_dist_points(gnutls_x509_subject_alt_name type, - const void* data_string, unsigned int reason_flags, gnutls_datum* der_ext); -int _gnutls_x509_ext_gen_key_id( const void* id, size_t id_size, gnutls_datum* der_data); -int _gnutls_x509_ext_gen_auth_key_id( const void* id, size_t id_size, gnutls_datum* der_data); +int _gnutls_x509_crt_set_extension( gnutls_x509_crt_t cert, const char* extension_id, + const gnutls_datum_t* ext_data, unsigned int critical); +int _gnutls_x509_ext_gen_basicConstraints(int CA, gnutls_datum_t* der_ext); +int _gnutls_x509_ext_gen_keyUsage(uint16 usage, gnutls_datum_t* der_ext); +int _gnutls_x509_ext_gen_subject_alt_name(gnutls_x509_subject_alt_name_t type, + const char* data_string, gnutls_datum_t* der_ext); +int _gnutls_x509_ext_gen_crl_dist_points(gnutls_x509_subject_alt_name_t type, + const void* data_string, unsigned int reason_flags, gnutls_datum_t* der_ext); +int _gnutls_x509_ext_gen_key_id( const void* id, size_t id_size, gnutls_datum_t* der_data); +int _gnutls_x509_ext_gen_auth_key_id( const void* id, size_t id_size, gnutls_datum_t* der_data); diff --git a/lib/x509/mpi.c b/lib/x509/mpi.c index f7ea8ac213..8d37c021b5 100644 --- a/lib/x509/mpi.c +++ b/lib/x509/mpi.c @@ -179,7 +179,7 @@ int _gnutls_x509_read_dsa_pubkey(opaque * der, int dersize, mpi_t * params) /* Extracts DSA and RSA parameters from a certificate. */ -int _gnutls_x509_crt_get_mpis(gnutls_x509_crt cert, +int _gnutls_x509_crt_get_mpis(gnutls_x509_crt_t cert, mpi_t * params, int *params_size) { int len, result; @@ -280,7 +280,7 @@ int _gnutls_x509_crt_get_mpis(gnutls_x509_crt cert, * Allocates the space used to store the DER data. */ int _gnutls_x509_write_rsa_params(mpi_t * params, int params_size, - gnutls_datum * der) + gnutls_datum_t * der) { int result; ASN1_TYPE spk = ASN1_TYPE_EMPTY; @@ -333,10 +333,10 @@ int _gnutls_x509_write_rsa_params(mpi_t * params, int params_size, * This is the "signatureAlgorithm" fields. */ int _gnutls_x509_write_sig_params(ASN1_TYPE dst, const char *dst_name, - gnutls_pk_algorithm pk_algorithm, + gnutls_pk_algorithm_t pk_algorithm, mpi_t * params, int params_size) { - gnutls_datum der; + gnutls_datum_t der; int result; char name[128]; const char *pk; @@ -398,7 +398,7 @@ int _gnutls_x509_write_sig_params(ASN1_TYPE dst, const char *dst_name, * Allocates the space used to store the DER data. */ int _gnutls_x509_write_dsa_params(mpi_t * params, int params_size, - gnutls_datum * der) + gnutls_datum_t * der) { int result; ASN1_TYPE spk = ASN1_TYPE_EMPTY; @@ -458,7 +458,7 @@ int _gnutls_x509_write_dsa_params(mpi_t * params, int params_size, * Allocates the space used to store the DER data. */ int _gnutls_x509_write_dsa_public_key(mpi_t * params, int params_size, - gnutls_datum * der) + gnutls_datum_t * der) { int result; ASN1_TYPE spk = ASN1_TYPE_EMPTY; diff --git a/lib/x509/mpi.h b/lib/x509/mpi.h index ce452ef2e1..161f9d6e26 100644 --- a/lib/x509/mpi.h +++ b/lib/x509/mpi.h @@ -1,18 +1,18 @@ #include <gnutls_int.h> #include "x509.h" -int _gnutls_x509_crt_get_mpis( gnutls_x509_crt cert, +int _gnutls_x509_crt_get_mpis( gnutls_x509_crt_t cert, mpi_t* params, int *params_size); int _gnutls_x509_read_rsa_params(opaque * der, int dersize, mpi_t * params); int _gnutls_x509_read_dsa_pubkey(opaque * der, int dersize, mpi_t * params); int _gnutls_x509_read_dsa_params(opaque * der, int dersize, mpi_t * params); int _gnutls_x509_write_rsa_params( mpi_t * params, int params_size, - gnutls_datum* der); + gnutls_datum_t* der); int _gnutls_x509_write_dsa_params( mpi_t * params, int params_size, - gnutls_datum* der); + gnutls_datum_t* der); int _gnutls_x509_write_dsa_public_key( mpi_t * params, int params_size, - gnutls_datum* der); + gnutls_datum_t* der); int _gnutls_x509_read_uint( ASN1_TYPE node, const char* value, unsigned int* ret); @@ -23,4 +23,4 @@ int _gnutls_x509_write_int( ASN1_TYPE node, const char* value, mpi_t mpi, int lz int _gnutls_x509_write_uint32( ASN1_TYPE node, const char* value, uint32 num); int _gnutls_x509_write_sig_params( ASN1_TYPE dst, const char* dst_name, - gnutls_pk_algorithm pk_algorithm, mpi_t * params, int params_size); + gnutls_pk_algorithm_t pk_algorithm, mpi_t * params, int params_size); diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c index ee48262401..3bd761bd4c 100644 --- a/lib/x509/pkcs12.c +++ b/lib/x509/pkcs12.c @@ -45,11 +45,11 @@ */ static int _decode_pkcs12_auth_safe(ASN1_TYPE pkcs12, ASN1_TYPE * authen_safe, - gnutls_datum * raw) + gnutls_datum_t * raw) { char oid[128]; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; - gnutls_datum auth_safe = { NULL, 0 }; + gnutls_datum_t auth_safe = { NULL, 0 }; int tmp_size, len, result; len = sizeof(oid) - 1; @@ -114,7 +114,7 @@ int _decode_pkcs12_auth_safe(ASN1_TYPE pkcs12, ASN1_TYPE * authen_safe, } /** - * gnutls_pkcs12_init - This function initializes a gnutls_pkcs12 structure + * gnutls_pkcs12_init - This function initializes a gnutls_pkcs12_t structure * @pkcs12: The structure to be initialized * * This function will initialize a PKCS12 structure. PKCS12 structures @@ -124,7 +124,7 @@ int _decode_pkcs12_auth_safe(ASN1_TYPE pkcs12, ASN1_TYPE * authen_safe, * Returns 0 on success. * **/ -int gnutls_pkcs12_init(gnutls_pkcs12 * pkcs12) +int gnutls_pkcs12_init(gnutls_pkcs12_t * pkcs12) { *pkcs12 = gnutls_calloc(1, sizeof(gnutls_pkcs12_int)); @@ -143,13 +143,13 @@ int gnutls_pkcs12_init(gnutls_pkcs12 * pkcs12) } /** - * gnutls_pkcs12_deinit - This function deinitializes memory used by a gnutls_pkcs12 structure + * gnutls_pkcs12_deinit - This function deinitializes memory used by a gnutls_pkcs12_t structure * @pkcs12: The structure to be initialized * * This function will deinitialize a PKCS12 structure. * **/ -void gnutls_pkcs12_deinit(gnutls_pkcs12 pkcs12) +void gnutls_pkcs12_deinit(gnutls_pkcs12_t pkcs12) { if (!pkcs12) return; @@ -168,18 +168,18 @@ void gnutls_pkcs12_deinit(gnutls_pkcs12 pkcs12) * @flags: an ORed sequence of gnutls_privkey_pkcs8_flags * * This function will convert the given DER or PEM encoded PKCS12 - * to the native gnutls_pkcs12 format. The output will be stored in 'pkcs12'. + * to the native gnutls_pkcs12_t format. The output will be stored in 'pkcs12'. * * If the PKCS12 is PEM encoded it should have a header of "PKCS12". * * Returns 0 on success. * **/ -int gnutls_pkcs12_import(gnutls_pkcs12 pkcs12, const gnutls_datum * data, - gnutls_x509_crt_fmt format, unsigned int flags) +int gnutls_pkcs12_import(gnutls_pkcs12_t pkcs12, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format, unsigned int flags) { int result = 0, need_free = 0; - gnutls_datum _data; + gnutls_datum_t _data; _data.data = data->data; _data.size = data->size; @@ -249,8 +249,8 @@ int gnutls_pkcs12_import(gnutls_pkcs12 pkcs12, const gnutls_datum * data, * 0 on success. * **/ -int gnutls_pkcs12_export(gnutls_pkcs12 pkcs12, - gnutls_x509_crt_fmt format, void *output_data, +int gnutls_pkcs12_export(gnutls_pkcs12_t pkcs12, + gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size) { if (pkcs12 == NULL) { @@ -307,14 +307,14 @@ static inline char *ucs2_to_ascii(char *data, int size) * the given bag. */ int -_pkcs12_decode_safe_contents(const gnutls_datum * content, - gnutls_pkcs12_bag bag) +_pkcs12_decode_safe_contents(const gnutls_datum_t * content, + gnutls_pkcs12_bag_t bag) { char oid[128], root[128]; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int len, result; int bag_type; - gnutls_datum attr_val; + gnutls_datum_t attr_val; int count = 0, i, attributes, j; char counter[MAX_INT_DIGITS]; @@ -388,7 +388,7 @@ _pkcs12_decode_safe_contents(const gnutls_datum * content, if (bag_type == GNUTLS_BAG_CERTIFICATE || bag_type == GNUTLS_BAG_CRL) { - gnutls_datum tmp = bag->element[i].data; + gnutls_datum_t tmp = bag->element[i].data; result = _pkcs12_decode_crt_bag(bag_type, &tmp, @@ -470,9 +470,9 @@ _pkcs12_decode_safe_contents(const gnutls_datum * content, static int _parse_safe_contents(ASN1_TYPE sc, const char *sc_name, - gnutls_pkcs12_bag bag) + gnutls_pkcs12_bag_t bag) { - gnutls_datum content = { NULL, 0 }; + gnutls_datum_t content = { NULL, 0 }; int result; /* Step 1. Extract the content. @@ -502,7 +502,7 @@ int _parse_safe_contents(ASN1_TYPE sc, const char *sc_name, /** * gnutls_pkcs12_get_bag - This function returns a Bag from a PKCS12 structure - * @pkcs12_struct: should contain a gnutls_pkcs12 structure + * @pkcs12_struct: should contain a gnutls_pkcs12_t structure * @indx: contains the index of the bag to extract * @bag: An initialized bag, where the contents of the bag will be copied * @@ -513,15 +513,15 @@ int _parse_safe_contents(ASN1_TYPE sc, const char *sc_name, * will be returned. * **/ -int gnutls_pkcs12_get_bag(gnutls_pkcs12 pkcs12, - int indx, gnutls_pkcs12_bag bag) +int gnutls_pkcs12_get_bag(gnutls_pkcs12_t pkcs12, + int indx, gnutls_pkcs12_bag_t bag) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result, len; char root2[64]; char oid[128]; char counter[MAX_INT_DIGITS]; - gnutls_datum tmp = { NULL, 0 }; + gnutls_datum_t tmp = { NULL, 0 }; if (pkcs12 == NULL) { gnutls_assert(); @@ -649,14 +649,14 @@ static int create_empty_pfx(ASN1_TYPE pkcs12) /** * gnutls_pkcs12_set_bag - This function inserts a Bag into a PKCS12 structure - * @pkcs12_struct: should contain a gnutls_pkcs12 structure + * @pkcs12_struct: should contain a gnutls_pkcs12_t structure * @bag: An initialized bag * * This function will insert a Bag into the PKCS12 structure. * Returns 0 on success. * **/ -int gnutls_pkcs12_set_bag(gnutls_pkcs12 pkcs12, gnutls_pkcs12_bag bag) +int gnutls_pkcs12_set_bag(gnutls_pkcs12_t pkcs12, gnutls_pkcs12_bag_t bag) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; ASN1_TYPE safe_cont = ASN1_TYPE_EMPTY; @@ -768,20 +768,20 @@ int gnutls_pkcs12_set_bag(gnutls_pkcs12 pkcs12, gnutls_pkcs12_bag bag) /** * gnutls_pkcs12_generate_mac - This function generates the MAC of the PKCS12 structure - * @pkcs12_struct: should contain a gnutls_pkcs12 structure + * @pkcs12_struct: should contain a gnutls_pkcs12_t structure * @pass: The password for the MAC * * This function will generate a MAC for the PKCS12 structure. * Returns 0 on success. * **/ -int gnutls_pkcs12_generate_mac(gnutls_pkcs12 pkcs12, const char *pass) +int gnutls_pkcs12_generate_mac(gnutls_pkcs12_t pkcs12, const char *pass) { opaque salt[8], key[20]; int result; const int iter = 1; mac_hd_t td1 = NULL; - gnutls_datum tmp = { NULL, 0 }; + gnutls_datum_t tmp = { NULL, 0 }; opaque sha_mac[20]; if (pkcs12 == NULL) { @@ -887,20 +887,20 @@ int gnutls_pkcs12_generate_mac(gnutls_pkcs12 pkcs12, const char *pass) /** * gnutls_pkcs12_verify_mac - This function verifies the MAC of the PKCS12 structure - * @pkcs12_struct: should contain a gnutls_pkcs12 structure + * @pkcs12_struct: should contain a gnutls_pkcs12_t structure * @pass: The password for the MAC * * This function will verify the MAC for the PKCS12 structure. * Returns 0 on success. * **/ -int gnutls_pkcs12_verify_mac(gnutls_pkcs12 pkcs12, const char *pass) +int gnutls_pkcs12_verify_mac(gnutls_pkcs12_t pkcs12, const char *pass) { opaque key[20]; int result; unsigned int iter, len; mac_hd_t td1 = NULL; - gnutls_datum tmp = { NULL, 0 }, salt = { + gnutls_datum_t tmp = { NULL, 0 }, salt = { NULL, 0}; opaque sha_mac[20]; opaque sha_mac_orig[20]; @@ -989,7 +989,7 @@ int gnutls_pkcs12_verify_mac(gnutls_pkcs12 pkcs12, const char *pass) } -static int write_attributes(gnutls_pkcs12_bag bag, int elem, ASN1_TYPE c2, +static int write_attributes(gnutls_pkcs12_bag_t bag, int elem, ASN1_TYPE c2, const char *where) { int result; @@ -1089,7 +1089,7 @@ static int write_attributes(gnutls_pkcs12_bag bag, int elem, ASN1_TYPE c2, * the given datum. Enc is set to non zero if the data are encrypted; */ int -_pkcs12_encode_safe_contents(gnutls_pkcs12_bag bag, ASN1_TYPE * contents, +_pkcs12_encode_safe_contents(gnutls_pkcs12_bag_t bag, ASN1_TYPE * contents, int *enc) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; @@ -1152,7 +1152,7 @@ _pkcs12_encode_safe_contents(gnutls_pkcs12_bag bag, ASN1_TYPE * contents, if (bag->element[i].type == GNUTLS_BAG_CERTIFICATE || bag->element[i].type == GNUTLS_BAG_CRL) { - gnutls_datum tmp; + gnutls_datum_t tmp; /* in that case encode it to a CertBag or * a CrlBag. diff --git a/lib/x509/pkcs12.h b/lib/x509/pkcs12.h index a0d86411bb..21cd6aa275 100644 --- a/lib/x509/pkcs12.h +++ b/lib/x509/pkcs12.h @@ -3,7 +3,7 @@ typedef struct gnutls_pkcs12_int { ASN1_TYPE pkcs12; } gnutls_pkcs12_int; -typedef enum gnutls_pkcs12_bag_type { +typedef enum gnutls_pkcs12_bag_type_t { GNUTLS_BAG_EMPTY = 0, GNUTLS_BAG_PKCS8_ENCRYPTED_KEY=1, @@ -12,14 +12,14 @@ typedef enum gnutls_pkcs12_bag_type { GNUTLS_BAG_CRL, GNUTLS_BAG_ENCRYPTED=10, GNUTLS_BAG_UNKNOWN=20 -} gnutls_pkcs12_bag_type; +} gnutls_pkcs12_bag_type_t; #define MAX_BAG_ELEMENTS 32 struct bag_element { - gnutls_datum data; - gnutls_pkcs12_bag_type type; - gnutls_datum local_key_id; + gnutls_datum_t data; + gnutls_pkcs12_bag_type_t type; + gnutls_datum_t local_key_id; char * friendly_name; }; @@ -43,27 +43,27 @@ typedef struct gnutls_pkcs12_bag_int { #define FRIENDLY_NAME_OID "1.2.840.113549.1.9.20" #define KEY_ID_OID "1.2.840.113549.1.9.21" -typedef struct gnutls_pkcs12_int *gnutls_pkcs12; -typedef struct gnutls_pkcs12_bag_int *gnutls_pkcs12_bag; +typedef struct gnutls_pkcs12_int *gnutls_pkcs12_t; +typedef struct gnutls_pkcs12_bag_int *gnutls_pkcs12_bag_t; -int gnutls_pkcs12_init(gnutls_pkcs12 * pkcs12); -void gnutls_pkcs12_deinit(gnutls_pkcs12 pkcs12); -int gnutls_pkcs12_import(gnutls_pkcs12 pkcs12, const gnutls_datum * data, - gnutls_x509_crt_fmt format, unsigned int flags); +int gnutls_pkcs12_init(gnutls_pkcs12_t * pkcs12); +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_t format, unsigned int flags); -int gnutls_pkcs12_get_bag(gnutls_pkcs12 pkcs12, - int indx, gnutls_pkcs12_bag bag); +int gnutls_pkcs12_get_bag(gnutls_pkcs12_t pkcs12, + int indx, gnutls_pkcs12_bag_t bag); -int gnutls_pkcs12_bag_init(gnutls_pkcs12_bag * bag); -void gnutls_pkcs12_bag_deinit(gnutls_pkcs12_bag bag); +int gnutls_pkcs12_bag_init(gnutls_pkcs12_bag_t * bag); +void gnutls_pkcs12_bag_deinit(gnutls_pkcs12_bag_t bag); int _pkcs12_string_to_key (unsigned int id, const opaque *salt, unsigned int salt_size, unsigned int iter, const char *pw, unsigned int req_keylen, opaque *keybuf); -int _gnutls_pkcs7_decrypt_data( const gnutls_datum* data, - const char* password, gnutls_datum* dec); +int _gnutls_pkcs7_decrypt_data( const gnutls_datum_t* data, + const char* password, gnutls_datum_t* dec); typedef enum schema_id { PBES2, /* the stuff in PKCS #5 */ @@ -72,15 +72,15 @@ typedef enum schema_id { PKCS12_RC2_40_SHA1 } schema_id; -int _gnutls_pkcs7_encrypt_data(schema_id schema, const gnutls_datum * data, +int _gnutls_pkcs7_encrypt_data(schema_id schema, const gnutls_datum_t * data, const char *password, - gnutls_datum * enc); -int _pkcs12_decode_safe_contents( const gnutls_datum* content, gnutls_pkcs12_bag bag); + gnutls_datum_t * enc); +int _pkcs12_decode_safe_contents( const gnutls_datum_t* content, gnutls_pkcs12_bag_t bag); int -_pkcs12_encode_safe_contents( gnutls_pkcs12_bag bag, ASN1_TYPE* content, int *enc); +_pkcs12_encode_safe_contents( gnutls_pkcs12_bag_t bag, ASN1_TYPE* content, int *enc); -int _pkcs12_decode_crt_bag( gnutls_pkcs12_bag_type type, const gnutls_datum* in, - gnutls_datum* out); -int _pkcs12_encode_crt_bag( gnutls_pkcs12_bag_type type, const gnutls_datum* raw, - gnutls_datum* out); +int _pkcs12_decode_crt_bag( gnutls_pkcs12_bag_type_t type, const gnutls_datum_t* in, + gnutls_datum_t* out); +int _pkcs12_encode_crt_bag( gnutls_pkcs12_bag_type_t type, const gnutls_datum_t* raw, + gnutls_datum_t* out); diff --git a/lib/x509/pkcs12_bag.c b/lib/x509/pkcs12_bag.c index 352ddb279a..972067bebc 100644 --- a/lib/x509/pkcs12_bag.c +++ b/lib/x509/pkcs12_bag.c @@ -35,7 +35,7 @@ #include <privkey.h> /** - * gnutls_pkcs12_bag_init - This function initializes a gnutls_pkcs12_bag structure + * gnutls_pkcs12_bag_init - This function initializes a gnutls_pkcs12_bag_t structure * @bag: The structure to be initialized * * This function will initialize a PKCS12 bag structure. PKCS12 Bags @@ -45,7 +45,7 @@ * Returns 0 on success. * **/ -int gnutls_pkcs12_bag_init(gnutls_pkcs12_bag * bag) +int gnutls_pkcs12_bag_init(gnutls_pkcs12_bag_t * bag) { *bag = gnutls_calloc(1, sizeof(gnutls_pkcs12_bag_int)); @@ -55,7 +55,7 @@ int gnutls_pkcs12_bag_init(gnutls_pkcs12_bag * bag) return GNUTLS_E_MEMORY_ERROR; } -static inline void _pkcs12_bag_free_data(gnutls_pkcs12_bag bag) +static inline void _pkcs12_bag_free_data(gnutls_pkcs12_bag_t bag) { int i; @@ -71,13 +71,13 @@ static inline void _pkcs12_bag_free_data(gnutls_pkcs12_bag bag) /** - * gnutls_pkcs12_bag_deinit - This function deinitializes memory used by a gnutls_pkcs12 structure + * gnutls_pkcs12_bag_deinit - This function deinitializes memory used by a gnutls_pkcs12_t structure * @bag: The structure to be initialized * * This function will deinitialize a PKCS12 Bag structure. * **/ -void gnutls_pkcs12_bag_deinit(gnutls_pkcs12_bag bag) +void gnutls_pkcs12_bag_deinit(gnutls_pkcs12_bag_t bag) { if (!bag) return; @@ -92,11 +92,11 @@ void gnutls_pkcs12_bag_deinit(gnutls_pkcs12_bag bag) * @bag: The bag * @indx: The element of the bag to get the type * - * This function will return the bag's type. One of the gnutls_pkcs12_bag_type + * This function will return the bag's type. One of the gnutls_pkcs12_bag_type_t * enumerations. * **/ -gnutls_pkcs12_bag_type gnutls_pkcs12_bag_get_type(gnutls_pkcs12_bag bag, +gnutls_pkcs12_bag_type_t gnutls_pkcs12_bag_get_type(gnutls_pkcs12_bag_t bag, int indx) { if (bag == NULL) { @@ -116,7 +116,7 @@ gnutls_pkcs12_bag_type gnutls_pkcs12_bag_get_type(gnutls_pkcs12_bag bag, * This function will return the number of the elements withing the bag. * **/ -int gnutls_pkcs12_bag_get_count(gnutls_pkcs12_bag bag) +int gnutls_pkcs12_bag_get_count(gnutls_pkcs12_bag_t bag) { if (bag == NULL) { gnutls_assert(); @@ -139,8 +139,8 @@ int gnutls_pkcs12_bag_get_count(gnutls_pkcs12_bag bag) * Returns 0 on success and a negative error code on error. * **/ -int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag bag, int indx, - gnutls_datum * data) +int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag_t bag, int indx, + gnutls_datum_t * data) { if (bag == NULL) { gnutls_assert(); @@ -159,8 +159,8 @@ int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag bag, int indx, #define X509_CERT_OID "1.2.840.113549.1.9.22.1" #define X509_CRL_OID "1.2.840.113549.1.9.23.1" -int _pkcs12_decode_crt_bag(gnutls_pkcs12_bag_type type, - const gnutls_datum * in, gnutls_datum * out) +int _pkcs12_decode_crt_bag(gnutls_pkcs12_bag_type_t type, + const gnutls_datum_t * in, gnutls_datum_t * out) { int ret; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; @@ -222,8 +222,8 @@ int _pkcs12_decode_crt_bag(gnutls_pkcs12_bag_type type, } -int _pkcs12_encode_crt_bag(gnutls_pkcs12_bag_type type, - const gnutls_datum * raw, gnutls_datum * out) +int _pkcs12_encode_crt_bag(gnutls_pkcs12_bag_type_t type, + const gnutls_datum_t * raw, gnutls_datum_t * out) { int ret; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; @@ -305,9 +305,9 @@ int _pkcs12_encode_crt_bag(gnutls_pkcs12_bag_type type, * value on error. * **/ -int gnutls_pkcs12_bag_set_data(gnutls_pkcs12_bag bag, - gnutls_pkcs12_bag_type type, - const gnutls_datum * data) +int gnutls_pkcs12_bag_set_data(gnutls_pkcs12_bag_t bag, + gnutls_pkcs12_bag_type_t type, + const gnutls_datum_t * data) { int ret; if (bag == NULL) { @@ -362,10 +362,10 @@ int gnutls_pkcs12_bag_set_data(gnutls_pkcs12_bag bag, * value on failure. * **/ -int gnutls_pkcs12_bag_set_crt(gnutls_pkcs12_bag bag, gnutls_x509_crt crt) +int gnutls_pkcs12_bag_set_crt(gnutls_pkcs12_bag_t bag, gnutls_x509_crt_t crt) { int ret; - gnutls_datum data; + gnutls_datum_t data; if (bag == NULL) { gnutls_assert(); @@ -397,10 +397,10 @@ int gnutls_pkcs12_bag_set_crt(gnutls_pkcs12_bag bag, gnutls_x509_crt crt) * value on failure. * **/ -int gnutls_pkcs12_bag_set_crl(gnutls_pkcs12_bag bag, gnutls_x509_crl crl) +int gnutls_pkcs12_bag_set_crl(gnutls_pkcs12_bag_t bag, gnutls_x509_crl_t crl) { int ret; - gnutls_datum data; + gnutls_datum_t data; if (bag == NULL) { @@ -434,8 +434,8 @@ int gnutls_pkcs12_bag_set_crl(gnutls_pkcs12_bag bag, gnutls_x509_crl crl) * Returns 0 on success, or a negative value on error. * **/ -int gnutls_pkcs12_bag_set_key_id(gnutls_pkcs12_bag bag, int indx, - const gnutls_datum * id) +int gnutls_pkcs12_bag_set_key_id(gnutls_pkcs12_bag_t bag, int indx, + const gnutls_datum_t * id) { int ret; @@ -473,8 +473,8 @@ int gnutls_pkcs12_bag_set_key_id(gnutls_pkcs12_bag bag, int indx, * Returns 0 on success, or a negative value on error. * **/ -int gnutls_pkcs12_bag_get_key_id(gnutls_pkcs12_bag bag, int indx, - gnutls_datum * id) +int gnutls_pkcs12_bag_get_key_id(gnutls_pkcs12_bag_t bag, int indx, + gnutls_datum_t * id) { if (bag == NULL) { gnutls_assert(); @@ -504,7 +504,7 @@ int gnutls_pkcs12_bag_get_key_id(gnutls_pkcs12_bag bag, int indx, * Returns 0 on success, or a negative value on error. * **/ -int gnutls_pkcs12_bag_get_friendly_name(gnutls_pkcs12_bag bag, int indx, +int gnutls_pkcs12_bag_get_friendly_name(gnutls_pkcs12_bag_t bag, int indx, char **name) { if (bag == NULL) { @@ -536,7 +536,7 @@ int gnutls_pkcs12_bag_get_friendly_name(gnutls_pkcs12_bag bag, int indx, * Returns 0 on success, or a negative value on error. * **/ -int gnutls_pkcs12_bag_set_friendly_name(gnutls_pkcs12_bag bag, int indx, +int gnutls_pkcs12_bag_set_friendly_name(gnutls_pkcs12_bag_t bag, int indx, const char *name) { if (bag == NULL) { @@ -568,10 +568,10 @@ int gnutls_pkcs12_bag_set_friendly_name(gnutls_pkcs12_bag bag, int indx, * This function will decrypt the given encrypted bag and return 0 on success. * **/ -int gnutls_pkcs12_bag_decrypt(gnutls_pkcs12_bag bag, const char *pass) +int gnutls_pkcs12_bag_decrypt(gnutls_pkcs12_bag_t bag, const char *pass) { int ret; - gnutls_datum dec; + gnutls_datum_t dec; if (bag == NULL) { gnutls_assert(); @@ -612,18 +612,18 @@ int gnutls_pkcs12_bag_decrypt(gnutls_pkcs12_bag bag, const char *pass) * gnutls_pkcs12_bag_encrypt - This function will encrypt a bag * @bag: The bag * @pass: The password used for encryption. This can only be ASCII. - * @flags: should be one of gnutls_pkcs_encrypt_flags elements bitwise or'd + * @flags: should be one of gnutls_pkcs_encrypt_flags_t elements bitwise or'd * * This function will encrypt the given bag and return 0 on success. * **/ -int gnutls_pkcs12_bag_encrypt(gnutls_pkcs12_bag bag, const char *pass, +int gnutls_pkcs12_bag_encrypt(gnutls_pkcs12_bag_t bag, const char *pass, unsigned int flags) { int ret; ASN1_TYPE safe_cont = ASN1_TYPE_EMPTY; - gnutls_datum der = { NULL, 0 }; - gnutls_datum enc = { NULL, 0 }; + gnutls_datum_t der = { NULL, 0 }; + gnutls_datum_t enc = { NULL, 0 }; schema_id id; if (bag == NULL) { diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c index ce301fda7d..5e8386f075 100644 --- a/lib/x509/pkcs7.c +++ b/lib/x509/pkcs7.c @@ -44,7 +44,7 @@ */ static int _decode_pkcs7_signed_data(ASN1_TYPE pkcs7, ASN1_TYPE * sdata, - gnutls_datum * raw) + gnutls_datum_t * raw) { char oid[128]; ASN1_TYPE c2; @@ -129,7 +129,7 @@ int _decode_pkcs7_signed_data(ASN1_TYPE pkcs7, ASN1_TYPE * sdata, } /** - * gnutls_pkcs7_init - This function initializes a gnutls_pkcs7 structure + * gnutls_pkcs7_init - This function initializes a gnutls_pkcs7_t structure * @pkcs7: The structure to be initialized * * This function will initialize a PKCS7 structure. PKCS7 structures @@ -139,7 +139,7 @@ int _decode_pkcs7_signed_data(ASN1_TYPE pkcs7, ASN1_TYPE * sdata, * Returns 0 on success. * **/ -int gnutls_pkcs7_init(gnutls_pkcs7 * pkcs7) +int gnutls_pkcs7_init(gnutls_pkcs7_t * pkcs7) { *pkcs7 = gnutls_calloc(1, sizeof(gnutls_pkcs7_int)); @@ -158,13 +158,13 @@ int gnutls_pkcs7_init(gnutls_pkcs7 * pkcs7) } /** - * gnutls_pkcs7_deinit - This function deinitializes memory used by a gnutls_pkcs7 structure + * gnutls_pkcs7_deinit - This function deinitializes memory used by a gnutls_pkcs7_t structure * @pkcs7: The structure to be initialized * * This function will deinitialize a PKCS7 structure. * **/ -void gnutls_pkcs7_deinit(gnutls_pkcs7 pkcs7) +void gnutls_pkcs7_deinit(gnutls_pkcs7_t pkcs7) { if (!pkcs7) return; @@ -182,18 +182,18 @@ void gnutls_pkcs7_deinit(gnutls_pkcs7 pkcs7) * @format: One of DER or PEM * * This function will convert the given DER or PEM encoded PKCS7 - * to the native gnutls_pkcs7 format. The output will be stored in 'pkcs7'. + * to the native gnutls_pkcs7_t format. The output will be stored in 'pkcs7'. * * If the PKCS7 is PEM encoded it should have a header of "PKCS7". * * Returns 0 on success. * **/ -int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, - gnutls_x509_crt_fmt format) +int gnutls_pkcs7_import(gnutls_pkcs7_t pkcs7, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format) { int result = 0, need_free = 0; - gnutls_datum _data; + gnutls_datum_t _data; if (pkcs7 == NULL) return GNUTLS_E_INVALID_REQUEST; @@ -244,7 +244,7 @@ int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, /** * gnutls_pkcs7_get_crt_raw - This function returns a certificate in a PKCS7 certificate set - * @pkcs7_struct: should contain a gnutls_pkcs7 structure + * @pkcs7_struct: should contain a gnutls_pkcs7_t structure * @indx: contains the index of the certificate to extract * @certificate: the contents of the certificate will be copied there (may be null) * @certificate_size: should hold the size of the certificate @@ -257,7 +257,7 @@ int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, * will be returned. * **/ -int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7 pkcs7, +int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7_t pkcs7, int indx, void *certificate, size_t * certificate_size) { @@ -266,7 +266,7 @@ int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7 pkcs7, char root2[64]; char oid[128]; char counter[MAX_INT_DIGITS]; - gnutls_datum tmp = { NULL, 0 }; + gnutls_datum_t tmp = { NULL, 0 }; if (certificate_size == NULL || pkcs7 == NULL) return GNUTLS_E_INVALID_REQUEST; @@ -343,7 +343,7 @@ int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7 pkcs7, /** * gnutls_pkcs7_get_crt_count - This function returns the number of certificates in a PKCS7 certificate set - * @pkcs7_struct: should contain a gnutls_pkcs7 structure + * @pkcs7_struct: should contain a gnutls_pkcs7_t structure * * This function will return the number of certifcates in the PKCS7 or * RFC2630 certificate set. @@ -351,7 +351,7 @@ int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7 pkcs7, * Returns a negative value on failure. * **/ -int gnutls_pkcs7_get_crt_count(gnutls_pkcs7 pkcs7) +int gnutls_pkcs7_get_crt_count(gnutls_pkcs7_t pkcs7) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result, count; @@ -401,8 +401,8 @@ int gnutls_pkcs7_get_crt_count(gnutls_pkcs7 pkcs7) * 0 on success. * **/ -int gnutls_pkcs7_export(gnutls_pkcs7 pkcs7, - gnutls_x509_crt_fmt format, void *output_data, +int gnutls_pkcs7_export(gnutls_pkcs7_t pkcs7, + gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size) { if (pkcs7 == NULL) @@ -489,14 +489,14 @@ static int create_empty_signed_data(ASN1_TYPE pkcs7, ASN1_TYPE * sdata) /** * gnutls_pkcs7_set_crt_raw - This function adds a certificate in a PKCS7 certificate set - * @pkcs7_struct: should contain a gnutls_pkcs7 structure + * @pkcs7_struct: should contain a gnutls_pkcs7_t structure * @crt: the DER encoded certificate to be added * * This function will add a certificate to the PKCS7 or RFC2630 certificate set. * Returns 0 on success. * **/ -int gnutls_pkcs7_set_crt_raw(gnutls_pkcs7 pkcs7, const gnutls_datum * crt) +int gnutls_pkcs7_set_crt_raw(gnutls_pkcs7_t pkcs7, const gnutls_datum_t * crt) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result; @@ -574,7 +574,7 @@ int gnutls_pkcs7_set_crt_raw(gnutls_pkcs7 pkcs7, const gnutls_datum * crt) /** * gnutls_pkcs7_set_crt - This function adds a parsed certificate in a PKCS7 certificate set - * @pkcs7_struct: should contain a gnutls_pkcs7 structure + * @pkcs7_struct: should contain a gnutls_pkcs7_t structure * @crt: the certificate to be copied. * * This function will add a parsed certificate to the PKCS7 or RFC2630 certificate set. @@ -583,10 +583,10 @@ int gnutls_pkcs7_set_crt_raw(gnutls_pkcs7 pkcs7, const gnutls_datum * crt) * Returns 0 on success. * **/ -int gnutls_pkcs7_set_crt(gnutls_pkcs7 pkcs7, gnutls_x509_crt crt) +int gnutls_pkcs7_set_crt(gnutls_pkcs7_t pkcs7, gnutls_x509_crt_t crt) { int ret; - gnutls_datum data; + gnutls_datum_t data; if (pkcs7 == NULL) return GNUTLS_E_INVALID_REQUEST; @@ -612,14 +612,14 @@ int gnutls_pkcs7_set_crt(gnutls_pkcs7 pkcs7, gnutls_x509_crt crt) /** * gnutls_pkcs7_delete_crt - This function deletes a certificate from a PKCS7 certificate set - * @pkcs7_struct: should contain a gnutls_pkcs7 structure + * @pkcs7_struct: should contain a gnutls_pkcs7_t structure * @indx: the index of the certificate to delete * * This function will delete a certificate from a PKCS7 or RFC2630 certificate set. * Index starts from 0. Returns 0 on success. * **/ -int gnutls_pkcs7_delete_crt(gnutls_pkcs7 pkcs7, int indx) +int gnutls_pkcs7_delete_crt(gnutls_pkcs7_t pkcs7, int indx) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result; @@ -676,7 +676,7 @@ int gnutls_pkcs7_delete_crt(gnutls_pkcs7 pkcs7, int indx) /** * gnutls_pkcs7_get_crl_raw - This function returns a crl in a PKCS7 crl set - * @pkcs7_struct: should contain a gnutls_pkcs7 structure + * @pkcs7_struct: should contain a gnutls_pkcs7_t structure * @indx: contains the index of the crl to extract * @crl: the contents of the crl will be copied there (may be null) * @crl_size: should hold the size of the crl @@ -689,14 +689,14 @@ int gnutls_pkcs7_delete_crt(gnutls_pkcs7 pkcs7, int indx) * will be returned. * **/ -int gnutls_pkcs7_get_crl_raw(gnutls_pkcs7 pkcs7, +int gnutls_pkcs7_get_crl_raw(gnutls_pkcs7_t pkcs7, int indx, void *crl, size_t * crl_size) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result; char root2[64]; char counter[MAX_INT_DIGITS]; - gnutls_datum tmp = { NULL, 0 }; + gnutls_datum_t tmp = { NULL, 0 }; int start, end; if (pkcs7 == NULL || crl_size == NULL) @@ -753,7 +753,7 @@ int gnutls_pkcs7_get_crl_raw(gnutls_pkcs7 pkcs7, /** * gnutls_pkcs7_get_crl_count - This function returns the number of crls in a PKCS7 crl set - * @pkcs7_struct: should contain a gnutls_pkcs7 structure + * @pkcs7_struct: should contain a gnutls_pkcs7_t structure * * This function will return the number of certifcates in the PKCS7 or * RFC2630 crl set. @@ -761,7 +761,7 @@ int gnutls_pkcs7_get_crl_raw(gnutls_pkcs7 pkcs7, * Returns a negative value on failure. * **/ -int gnutls_pkcs7_get_crl_count(gnutls_pkcs7 pkcs7) +int gnutls_pkcs7_get_crl_count(gnutls_pkcs7_t pkcs7) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result, count; @@ -794,14 +794,14 @@ int gnutls_pkcs7_get_crl_count(gnutls_pkcs7 pkcs7) /** * gnutls_pkcs7_set_crl_raw - This function adds a crl in a PKCS7 crl set - * @pkcs7_struct: should contain a gnutls_pkcs7 structure + * @pkcs7_struct: should contain a gnutls_pkcs7_t structure * @crl: the DER encoded crl to be added * * This function will add a crl to the PKCS7 or RFC2630 crl set. * Returns 0 on success. * **/ -int gnutls_pkcs7_set_crl_raw(gnutls_pkcs7 pkcs7, const gnutls_datum * crl) +int gnutls_pkcs7_set_crl_raw(gnutls_pkcs7_t pkcs7, const gnutls_datum_t * crl) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result; @@ -870,17 +870,17 @@ int gnutls_pkcs7_set_crl_raw(gnutls_pkcs7 pkcs7, const gnutls_datum * crl) /** * gnutls_pkcs7_set_crl - This function adds a parsed crl in a PKCS7 crl set - * @pkcs7_struct: should contain a gnutls_pkcs7 structure + * @pkcs7_struct: should contain a gnutls_pkcs7_t structure * @crl: the DER encoded crl to be added * * This function will add a parsed crl to the PKCS7 or RFC2630 crl set. * Returns 0 on success. * **/ -int gnutls_pkcs7_set_crl(gnutls_pkcs7 pkcs7, gnutls_x509_crl crl) +int gnutls_pkcs7_set_crl(gnutls_pkcs7_t pkcs7, gnutls_x509_crl_t crl) { int ret; - gnutls_datum data; + gnutls_datum_t data; if (pkcs7 == NULL) return GNUTLS_E_INVALID_REQUEST; @@ -905,14 +905,14 @@ int gnutls_pkcs7_set_crl(gnutls_pkcs7 pkcs7, gnutls_x509_crl crl) /** * gnutls_pkcs7_delete_crl - This function deletes a crl from a PKCS7 crl set - * @pkcs7_struct: should contain a gnutls_pkcs7 structure + * @pkcs7_struct: should contain a gnutls_pkcs7_t structure * @indx: the index of the crl to delete * * This function will delete a crl from a PKCS7 or RFC2630 crl set. * Index starts from 0. Returns 0 on success. * **/ -int gnutls_pkcs7_delete_crl(gnutls_pkcs7 pkcs7, int indx) +int gnutls_pkcs7_delete_crl(gnutls_pkcs7_t pkcs7, int indx) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result; diff --git a/lib/x509/pkcs7.h b/lib/x509/pkcs7.h index 64a8f4b7d1..c3d6757ab8 100644 --- a/lib/x509/pkcs7.h +++ b/lib/x509/pkcs7.h @@ -3,12 +3,12 @@ typedef struct gnutls_pkcs7_int { ASN1_TYPE pkcs7; } gnutls_pkcs7_int; -typedef struct gnutls_pkcs7_int *gnutls_pkcs7; +typedef struct gnutls_pkcs7_int *gnutls_pkcs7_t; -int gnutls_pkcs7_init(gnutls_pkcs7 * pkcs7); -void gnutls_pkcs7_deinit(gnutls_pkcs7 pkcs7); -int gnutls_pkcs7_import(gnutls_pkcs7 pkcs7, const gnutls_datum * data, - gnutls_x509_crt_fmt format); -int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7 pkcs7, +int gnutls_pkcs7_init(gnutls_pkcs7_t * pkcs7); +void gnutls_pkcs7_deinit(gnutls_pkcs7_t pkcs7); +int gnutls_pkcs7_import(gnutls_pkcs7_t pkcs7, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format); +int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7_t pkcs7, int indx, void* certificate, size_t* certificate_size); -int gnutls_pkcs7_get_crt_count(gnutls_pkcs7 pkcs7); +int gnutls_pkcs7_get_crt_count(gnutls_pkcs7_t pkcs7); diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c index 73d7d69863..ce0f8a2f56 100644 --- a/lib/x509/privkey.c +++ b/lib/x509/privkey.c @@ -48,7 +48,7 @@ static int _encode_dsa(ASN1_TYPE * c2, mpi_t * params); * Returns 0 on success. * **/ -int gnutls_x509_privkey_init(gnutls_x509_privkey * key) +int gnutls_x509_privkey_init(gnutls_x509_privkey_t * key) { *key = gnutls_calloc(1, sizeof(gnutls_x509_privkey_int)); @@ -62,13 +62,13 @@ int gnutls_x509_privkey_init(gnutls_x509_privkey * key) } /** - * gnutls_x509_privkey_deinit - This function deinitializes memory used by a gnutls_x509_privkey structure + * gnutls_x509_privkey_deinit - This function deinitializes memory used by a gnutls_x509_privkey_t structure * @key: The structure to be initialized * * This function will deinitialize a private key structure. * **/ -void gnutls_x509_privkey_deinit(gnutls_x509_privkey key) +void gnutls_x509_privkey_deinit(gnutls_x509_privkey_t key) { int i; @@ -91,8 +91,8 @@ void gnutls_x509_privkey_deinit(gnutls_x509_privkey key) * This function will copy a private key from source to destination key. * **/ -int gnutls_x509_privkey_cpy(gnutls_x509_privkey dst, - gnutls_x509_privkey src) +int gnutls_x509_privkey_cpy(gnutls_x509_privkey_t dst, + gnutls_x509_privkey_t src) { int i, ret; @@ -137,9 +137,9 @@ int gnutls_x509_privkey_cpy(gnutls_x509_privkey dst, /* Converts an RSA PKCS#1 key to * an internal structure (gnutls_private_key) */ -ASN1_TYPE _gnutls_privkey_decode_pkcs1_rsa_key(const gnutls_datum * +ASN1_TYPE _gnutls_privkey_decode_pkcs1_rsa_key(const gnutls_datum_t * raw_key, - gnutls_x509_privkey pkey) + gnutls_x509_privkey_t pkey) { int result; ASN1_TYPE pkey_asn; @@ -233,8 +233,8 @@ ASN1_TYPE _gnutls_privkey_decode_pkcs1_rsa_key(const gnutls_datum * } -static ASN1_TYPE decode_dsa_key(const gnutls_datum * raw_key, - gnutls_x509_privkey pkey) +static ASN1_TYPE decode_dsa_key(const gnutls_datum_t * raw_key, + gnutls_x509_privkey_t pkey) { int result; ASN1_TYPE dsa_asn; @@ -315,7 +315,7 @@ static ASN1_TYPE decode_dsa_key(const gnutls_datum * raw_key, * @format: One of DER or PEM * * This function will convert the given DER or PEM encoded key - * to the native gnutls_x509_privkey format. The output will be stored in @key . + * to the native gnutls_x509_privkey_t format. The output will be stored in @key . * * If the key is PEM encoded it should have a header of "RSA PRIVATE KEY", or * "DSA PRIVATE KEY". @@ -323,12 +323,12 @@ static ASN1_TYPE decode_dsa_key(const gnutls_datum * raw_key, * Returns 0 on success. * **/ -int gnutls_x509_privkey_import(gnutls_x509_privkey key, - const gnutls_datum * data, - gnutls_x509_crt_fmt format) +int gnutls_x509_privkey_import(gnutls_x509_privkey_t key, + const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format) { int result = 0, need_free = 0; - gnutls_datum _data; + gnutls_datum_t _data; if (key == NULL) { gnutls_assert(); @@ -435,16 +435,16 @@ int gnutls_x509_privkey_import(gnutls_x509_privkey key, * @u: holds the coefficient * * This function will convert the given RSA raw parameters - * to the native gnutls_x509_privkey format. The output will be stored in @key. + * to the native gnutls_x509_privkey_t format. The output will be stored in @key. * **/ -int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey key, - const gnutls_datum * m, - const gnutls_datum * e, - const gnutls_datum * d, - const gnutls_datum * p, - const gnutls_datum * q, - const gnutls_datum * u) +int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey_t key, + const gnutls_datum_t * m, + const gnutls_datum_t * e, + const gnutls_datum_t * d, + const gnutls_datum_t * p, + const gnutls_datum_t * q, + const gnutls_datum_t * u) { int i = 0, ret; size_t siz = 0; @@ -522,15 +522,15 @@ int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey key, * @x: holds the x * * This function will convert the given DSA raw parameters - * to the native gnutls_x509_privkey format. The output will be stored in @key. + * to the native gnutls_x509_privkey_t format. The output will be stored in @key. * **/ -int gnutls_x509_privkey_import_dsa_raw(gnutls_x509_privkey key, - const gnutls_datum * p, - const gnutls_datum * q, - const gnutls_datum * g, - const gnutls_datum * y, - const gnutls_datum * x) +int gnutls_x509_privkey_import_dsa_raw(gnutls_x509_privkey_t key, + const gnutls_datum_t * p, + const gnutls_datum_t * q, + const gnutls_datum_t * g, + const gnutls_datum_t * y, + const gnutls_datum_t * x) { int i = 0, ret; size_t siz = 0; @@ -594,16 +594,16 @@ int gnutls_x509_privkey_import_dsa_raw(gnutls_x509_privkey key, /** * gnutls_x509_privkey_get_pk_algorithm - This function returns the key's PublicKey algorithm - * @key: should contain a gnutls_x509_privkey structure + * @key: should contain a gnutls_x509_privkey_t structure * * This function will return the public key algorithm of a private * key. * - * Returns a member of the gnutls_pk_algorithm enumeration on success, + * Returns a member of the gnutls_pk_algorithm_t enumeration on success, * or a negative value on error. * **/ -int gnutls_x509_privkey_get_pk_algorithm(gnutls_x509_privkey key) +int gnutls_x509_privkey_get_pk_algorithm(gnutls_x509_privkey_t key) { if (key == NULL) { gnutls_assert(); @@ -635,8 +635,8 @@ int gnutls_x509_privkey_get_pk_algorithm(gnutls_x509_privkey key) * 0 on success. * **/ -int gnutls_x509_privkey_export(gnutls_x509_privkey key, - gnutls_x509_crt_fmt format, +int gnutls_x509_privkey_export(gnutls_x509_privkey_t key, + gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size) { @@ -698,10 +698,10 @@ int gnutls_x509_privkey_export(gnutls_x509_privkey key, * gnutls_malloc() and will be stored in the appropriate datum. * **/ -int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey key, - gnutls_datum * m, gnutls_datum * e, - gnutls_datum * d, gnutls_datum * p, - gnutls_datum * q, gnutls_datum * u) +int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey_t key, + gnutls_datum_t * m, gnutls_datum_t * e, + gnutls_datum_t * d, gnutls_datum_t * p, + gnutls_datum_t * q, gnutls_datum_t * u) { int ret; @@ -783,10 +783,10 @@ int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey key, * gnutls_malloc() and will be stored in the appropriate datum. * **/ -int gnutls_x509_privkey_export_dsa_raw(gnutls_x509_privkey key, - gnutls_datum * p, gnutls_datum * q, - gnutls_datum * g, gnutls_datum * y, - gnutls_datum * x) +int gnutls_x509_privkey_export_dsa_raw(gnutls_x509_privkey_t key, + gnutls_datum_t * p, gnutls_datum_t * q, + gnutls_datum_t * g, gnutls_datum_t * y, + gnutls_datum_t * x) { int ret; @@ -1156,7 +1156,7 @@ static int _encode_dsa(ASN1_TYPE * c2, mpi_t * params) /** * gnutls_x509_privkey_generate - This function will generate a private key - * @key: should contain a gnutls_x509_privkey structure + * @key: should contain a gnutls_x509_privkey_t structure * @algo: is one of RSA or DSA. * @bits: the size of the modulus * @flags: unused for now. Must be 0. @@ -1167,8 +1167,8 @@ static int _encode_dsa(ASN1_TYPE * c2, mpi_t * params) * Returns 0 on success or a negative value on error. * **/ -int gnutls_x509_privkey_generate(gnutls_x509_privkey key, - gnutls_pk_algorithm algo, +int gnutls_x509_privkey_generate(gnutls_x509_privkey_t key, + gnutls_pk_algorithm_t algo, unsigned int bits, unsigned int flags) { int ret, params_len; @@ -1252,14 +1252,14 @@ int gnutls_x509_privkey_generate(gnutls_x509_privkey key, * 0 on success. * **/ -int gnutls_x509_privkey_get_key_id(gnutls_x509_privkey key, +int gnutls_x509_privkey_get_key_id(gnutls_x509_privkey_t key, unsigned int flags, unsigned char *output_data, size_t * output_data_size) { int result; GNUTLS_HASH_HANDLE hd; - gnutls_datum der = { NULL, 0 }; + gnutls_datum_t der = { NULL, 0 }; if (key == NULL || key->crippled) { gnutls_assert(); @@ -1334,14 +1334,14 @@ int gnutls_x509_privkey_get_key_id(gnutls_x509_privkey key, * 0 on success. * **/ -int gnutls_x509_privkey_sign_data(gnutls_x509_privkey key, - gnutls_digest_algorithm digest, +int gnutls_x509_privkey_sign_data(gnutls_x509_privkey_t key, + gnutls_digest_algorithm_t digest, unsigned int flags, - const gnutls_datum * data, + const gnutls_datum_t * data, void *signature, size_t * signature_size) { int result; - gnutls_datum sig = { NULL, 0 }; + gnutls_datum_t sig = { NULL, 0 }; if (key == NULL) { gnutls_assert(); @@ -1382,10 +1382,10 @@ int gnutls_x509_privkey_sign_data(gnutls_x509_privkey key, * 1 on success. * **/ -int gnutls_x509_privkey_verify_data(gnutls_x509_privkey key, +int gnutls_x509_privkey_verify_data(gnutls_x509_privkey_t key, unsigned int flags, - const gnutls_datum * data, - const gnutls_datum * signature) + const gnutls_datum_t * data, + const gnutls_datum_t * signature) { int result; diff --git a/lib/x509/privkey.h b/lib/x509/privkey.h index b667326047..a0f0939a05 100644 --- a/lib/x509/privkey.h +++ b/lib/x509/privkey.h @@ -1,4 +1,4 @@ -typedef enum gnutls_pkcs_encrypt_flags { +typedef enum gnutls_pkcs_encrypt_flags_t { GNUTLS_PKCS_PLAIN=1, /* if set the private key will not * be encrypted. */ @@ -6,10 +6,10 @@ typedef enum gnutls_pkcs_encrypt_flags { GNUTLS_PKCS_USE_PKCS12_ARCFOUR=4, GNUTLS_PKCS_USE_PKCS12_RC2_40=8, GNUTLS_PKCS_USE_PBES2_3DES=16 -} gnutls_pkcs_encrypt_flags; +} gnutls_pkcs_encrypt_flags_t; -int gnutls_x509_privkey_import(gnutls_x509_privkey key, const gnutls_datum * data, - gnutls_x509_crt_fmt format); -ASN1_TYPE _gnutls_privkey_decode_pkcs1_rsa_key( const gnutls_datum *raw_key, - gnutls_x509_privkey pkey); -int gnutls_x509_privkey_cpy(gnutls_x509_privkey dst, gnutls_x509_privkey src); +int gnutls_x509_privkey_import(gnutls_x509_privkey_t key, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format); +ASN1_TYPE _gnutls_privkey_decode_pkcs1_rsa_key( const gnutls_datum_t *raw_key, + gnutls_x509_privkey_t pkey); +int gnutls_x509_privkey_cpy(gnutls_x509_privkey_t dst, gnutls_x509_privkey_t src); diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c index c0fe3fd663..c83054a4de 100644 --- a/lib/x509/privkey_pkcs8.c +++ b/lib/x509/privkey_pkcs8.c @@ -61,7 +61,7 @@ struct pbkdf2_params { }; struct pbe_enc_params { - gnutls_cipher_algorithm cipher; + gnutls_cipher_algorithm_t cipher; opaque iv[8]; int iv_size; }; @@ -69,28 +69,28 @@ struct pbe_enc_params { static int generate_key(schema_id schema, const char *password, struct pbkdf2_params *kdf_params, struct pbe_enc_params *enc_params, - gnutls_datum * key); + gnutls_datum_t * key); static int read_pbkdf2_params(ASN1_TYPE pbes2_asn, - const gnutls_datum * der, + const gnutls_datum_t * der, struct pbkdf2_params *params); static int read_pbe_enc_params(ASN1_TYPE pbes2_asn, - const gnutls_datum * der, + const gnutls_datum_t * der, struct pbe_enc_params *params); static int decrypt_data(schema_id, ASN1_TYPE pkcs8_asn, const char *root, const char *password, const struct pbkdf2_params *kdf_params, const struct pbe_enc_params *enc_params, - gnutls_datum * decrypted_data); -static int decode_private_key_info(const gnutls_datum * der, - gnutls_x509_privkey pkey, + gnutls_datum_t * decrypted_data); +static int decode_private_key_info(const gnutls_datum_t * der, + gnutls_x509_privkey_t pkey, ASN1_TYPE * out); static int write_schema_params(schema_id schema, ASN1_TYPE pkcs8_asn, const char *where, const struct pbkdf2_params *kdf_params, const struct pbe_enc_params *enc_params); -static int encrypt_data(const gnutls_datum * plain, +static int encrypt_data(const gnutls_datum_t * plain, const struct pbe_enc_params *enc_params, - gnutls_datum * key, gnutls_datum * encrypted); + gnutls_datum_t * key, gnutls_datum_t * encrypted); static int read_pkcs12_kdf_params(ASN1_TYPE pbes2_asn, struct pbkdf2_params *params); @@ -129,8 +129,8 @@ inline static int check_schema(const char *oid) * info. The output will be allocated and stored into der. Also * the ASN1_TYPE of private key info will be returned. */ -static int encode_to_private_key_info(gnutls_x509_privkey pkey, - gnutls_datum * der, +static int encode_to_private_key_info(gnutls_x509_privkey_t pkey, + gnutls_datum_t * der, ASN1_TYPE * pkey_info) { int result; @@ -268,12 +268,12 @@ static int encode_to_private_key_info(gnutls_x509_privkey pkey, * a PKCS #8 EncryptedPrivateKeyInfo. */ static -int encode_to_pkcs8_key(schema_id schema, const gnutls_datum * der_key, +int encode_to_pkcs8_key(schema_id schema, const gnutls_datum_t * der_key, const char *password, ASN1_TYPE * out) { int result; - gnutls_datum key = { NULL, 0 }; - gnutls_datum tmp = { NULL, 0 }; + gnutls_datum_t key = { NULL, 0 }; + gnutls_datum_t tmp = { NULL, 0 }; ASN1_TYPE pkcs8_asn = ASN1_TYPE_EMPTY; struct pbkdf2_params kdf_params; struct pbe_enc_params enc_params; @@ -378,7 +378,7 @@ int encode_to_pkcs8_key(schema_id schema, const gnutls_datum * der_key, * @key: Holds the key * @format: the format of output params. One of PEM or DER. * @password: the password that will be used to encrypt the key. - * @flags: an ORed sequence of gnutls_pkcs_encrypt_flags + * @flags: an ORed sequence of gnutls_pkcs_encrypt_flags_t * @output_data: will contain a private key PEM or DER encoded * @output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) * @@ -401,8 +401,8 @@ int encode_to_pkcs8_key(schema_id schema, const gnutls_datum * der_key, * 0 on success. * **/ -int gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey key, - gnutls_x509_crt_fmt format, +int gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey_t key, + gnutls_x509_crt_fmt_t format, const char *password, unsigned int flags, void *output_data, @@ -410,7 +410,7 @@ int gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey key, { ASN1_TYPE pkcs8_asn, pkey_info; int ret; - gnutls_datum tmp; + gnutls_datum_t tmp; schema_id schema; if (key == NULL) { @@ -481,7 +481,7 @@ int read_pkcs_schema_params(schema_id schema, const char *password, { ASN1_TYPE pbes2_asn = ASN1_TYPE_EMPTY; int result; - gnutls_datum tmp; + gnutls_datum_t tmp; switch (schema) { @@ -601,13 +601,13 @@ int read_pkcs_schema_params(schema_id schema, const char *password, * (normally a PKCS #1 encoded RSA key) */ static -int decode_pkcs8_key(const gnutls_datum * raw_key, +int decode_pkcs8_key(const gnutls_datum_t * raw_key, const char *password, - gnutls_x509_privkey pkey, ASN1_TYPE * out) + gnutls_x509_privkey_t pkey, ASN1_TYPE * out) { int result, len; char enc_oid[64]; - gnutls_datum tmp; + gnutls_datum_t tmp; ASN1_TYPE pbes2_asn = ASN1_TYPE_EMPTY, pkcs8_asn = ASN1_TYPE_EMPTY; ASN1_TYPE ret_asn; int params_start, params_end, params_len; @@ -702,12 +702,12 @@ int decode_pkcs8_key(const gnutls_datum * raw_key, } static -int decode_private_key_info(const gnutls_datum * der, - gnutls_x509_privkey pkey, ASN1_TYPE * out) +int decode_private_key_info(const gnutls_datum_t * der, + gnutls_x509_privkey_t pkey, ASN1_TYPE * out) { int result, len; opaque oid[64], *data = NULL; - gnutls_datum tmp; + gnutls_datum_t tmp; ASN1_TYPE pkcs8_asn = ASN1_TYPE_EMPTY; ASN1_TYPE ret_asn; int data_size; @@ -809,7 +809,7 @@ int decode_private_key_info(const gnutls_datum * der, * @flags: use 0. * * This function will convert the given DER or PEM encoded PKCS8 2.0 encrypted key - * to the native gnutls_x509_privkey format. The output will be stored in @key. + * to the native gnutls_x509_privkey_t format. The output will be stored in @key. * Currently only RSA keys can be imported, and flags can only be used to indicate * an unencrypted key. * @@ -822,14 +822,14 @@ int decode_private_key_info(const gnutls_datum * der, * Returns 0 on success. * **/ -int gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey key, - const gnutls_datum * data, - gnutls_x509_crt_fmt format, +int gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey_t key, + const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format, const char *password, unsigned int flags) { int result = 0, need_free = 0; - gnutls_datum _data; + gnutls_datum_t _data; int encrypted; if (key == NULL) { @@ -905,7 +905,7 @@ int gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey key, /* Reads the PBKDF2 parameters. */ static int read_pbkdf2_params(ASN1_TYPE pbes2_asn, - const gnutls_datum * der, + const gnutls_datum_t * der, struct pbkdf2_params *params) { int params_start, params_end; @@ -1089,7 +1089,7 @@ static int write_pkcs12_kdf_params(ASN1_TYPE pbes2_asn, /* Converts an OID to a gnutls cipher type. */ inline - static int oid2cipher(const char *oid, gnutls_cipher_algorithm * algo) + static int oid2cipher(const char *oid, gnutls_cipher_algorithm_t * algo) { *algo = 0; @@ -1110,7 +1110,7 @@ inline static int read_pbe_enc_params(ASN1_TYPE pbes2_asn, - const gnutls_datum * der, + const gnutls_datum_t * der, struct pbe_enc_params *params) { int params_start, params_end; @@ -1188,12 +1188,12 @@ static int decrypt_data(schema_id schema, ASN1_TYPE pkcs8_asn, const char *root, const char *password, const struct pbkdf2_params *kdf_params, const struct pbe_enc_params *enc_params, - gnutls_datum * decrypted_data) + gnutls_datum_t * decrypted_data) { int result; int data_size; opaque *data = NULL, *key = NULL; - gnutls_datum dkey, div; + gnutls_datum_t dkey, div; cipher_hd_t ch = NULL; int key_size; @@ -1461,7 +1461,7 @@ static int generate_key(schema_id schema, const char *password, struct pbkdf2_params *kdf_params, struct pbe_enc_params *enc_params, - gnutls_datum * key) + gnutls_datum_t * key) { opaque rnd[2]; int ret; @@ -1628,14 +1628,14 @@ static int write_schema_params(schema_id schema, ASN1_TYPE pkcs8_asn, } -static int encrypt_data(const gnutls_datum * plain, +static int encrypt_data(const gnutls_datum_t * plain, const struct pbe_enc_params *enc_params, - gnutls_datum * key, gnutls_datum * encrypted) + gnutls_datum_t * key, gnutls_datum_t * encrypted) { int result; int data_size; opaque *data = NULL; - gnutls_datum div; + gnutls_datum_t div; cipher_hd_t ch = NULL; opaque pad, pad_size; @@ -1695,12 +1695,12 @@ static int encrypt_data(const gnutls_datum * plain, /* Decrypts a PKCS #7 encryptedData. The output is allocated * and stored in dec. */ -int _gnutls_pkcs7_decrypt_data(const gnutls_datum * data, - const char *password, gnutls_datum * dec) +int _gnutls_pkcs7_decrypt_data(const gnutls_datum_t * data, + const char *password, gnutls_datum_t * dec) { int result, len; char enc_oid[64]; - gnutls_datum tmp; + gnutls_datum_t tmp; ASN1_TYPE pbes2_asn = ASN1_TYPE_EMPTY, pkcs7_asn = ASN1_TYPE_EMPTY; int params_start, params_end, params_len; struct pbkdf2_params kdf_params; @@ -1793,12 +1793,12 @@ int _gnutls_pkcs7_decrypt_data(const gnutls_datum * data, /* Encrypts to a PKCS #7 encryptedData. The output is allocated * and stored in enc. */ -int _gnutls_pkcs7_encrypt_data(schema_id schema, const gnutls_datum * data, - const char *password, gnutls_datum * enc) +int _gnutls_pkcs7_encrypt_data(schema_id schema, const gnutls_datum_t * data, + const char *password, gnutls_datum_t * enc) { int result; - gnutls_datum key = { NULL, 0 }; - gnutls_datum tmp = { NULL, 0 }; + gnutls_datum_t key = { NULL, 0 }; + gnutls_datum_t tmp = { NULL, 0 }; ASN1_TYPE pkcs7_asn = ASN1_TYPE_EMPTY; struct pbkdf2_params kdf_params; struct pbe_enc_params enc_params; diff --git a/lib/x509/rfc2818_hostname.c b/lib/x509/rfc2818_hostname.c index a1a7e1b82d..d5aa73bdec 100644 --- a/lib/x509/rfc2818_hostname.c +++ b/lib/x509/rfc2818_hostname.c @@ -68,7 +68,7 @@ int _gnutls_hostname_compare(const char *certname, const char *hostname) /** * gnutls_x509_crt_check_hostname - This function compares the given hostname with the hostname in the certificate - * @cert: should contain an gnutls_x509_crt structure + * @cert: should contain an gnutls_x509_crt_t structure * @hostname: A null terminated string that contains a DNS name * * This function will check if the given certificate's subject matches @@ -79,7 +79,7 @@ int _gnutls_hostname_compare(const char *certname, const char *hostname) * Returns non zero on success, and zero on failure. * **/ -int gnutls_x509_crt_check_hostname(gnutls_x509_crt cert, +int gnutls_x509_crt_check_hostname(gnutls_x509_crt_t cert, const char *hostname) { diff --git a/lib/x509/sign.c b/lib/x509/sign.c index 8586bd86b7..2cce692920 100644 --- a/lib/x509/sign.c +++ b/lib/x509/sign.c @@ -46,9 +46,9 @@ /* Writes the digest information and the digest in a DER encoded * structure. The digest info is allocated and stored into the info structure. */ -static int encode_ber_digest_info(gnutls_mac_algorithm hash, - const gnutls_datum * digest, - gnutls_datum * info) +static int encode_ber_digest_info(gnutls_mac_algorithm_t hash, + const gnutls_datum_t * digest, + gnutls_datum_t * info) { ASN1_TYPE dinfo = ASN1_TYPE_EMPTY; int result; @@ -117,13 +117,13 @@ static int encode_ber_digest_info(gnutls_mac_algorithm hash, * params[1] is public key */ static int -pkcs1_rsa_sign(gnutls_mac_algorithm hash, const gnutls_datum * text, - mpi_t * params, int params_len, gnutls_datum * signature) +pkcs1_rsa_sign(gnutls_mac_algorithm_t hash, const gnutls_datum_t * text, + mpi_t * params, int params_len, gnutls_datum_t * signature) { int ret; opaque _digest[MAX_HASH_SIZE]; GNUTLS_HASH_HANDLE hd; - gnutls_datum digest, info; + gnutls_datum_t digest, info; hd = _gnutls_hash_init(hash); if (hd == NULL) { @@ -158,13 +158,13 @@ pkcs1_rsa_sign(gnutls_mac_algorithm hash, const gnutls_datum * text, } static int -dsa_sign(const gnutls_datum * text, - mpi_t * params, int params_len, gnutls_datum * signature) +dsa_sign(const gnutls_datum_t * text, + mpi_t * params, int params_len, gnutls_datum_t * signature) { int ret; opaque _digest[MAX_HASH_SIZE]; GNUTLS_HASH_HANDLE hd; - gnutls_datum digest; + gnutls_datum_t digest; hd = _gnutls_hash_init(GNUTLS_MAC_SHA); if (hd == NULL) { @@ -197,8 +197,8 @@ dsa_sign(const gnutls_datum * text, * 'signature' will hold the signature! * 'hash' is only used in PKCS1 RSA signing. */ -int _gnutls_x509_sign(const gnutls_datum * tbs, gnutls_mac_algorithm hash, - gnutls_x509_privkey signer, gnutls_datum * signature) +int _gnutls_x509_sign(const gnutls_datum_t * tbs, gnutls_mac_algorithm_t hash, + gnutls_x509_privkey_t signer, gnutls_datum_t * signature) { int ret; @@ -235,14 +235,14 @@ int _gnutls_x509_sign(const gnutls_datum * tbs, gnutls_mac_algorithm hash, * of the TBS and sign it on the fly. */ int _gnutls_x509_sign_tbs(ASN1_TYPE cert, const char *tbs_name, - gnutls_mac_algorithm hash, - gnutls_x509_privkey signer, - gnutls_datum * signature) + gnutls_mac_algorithm_t hash, + gnutls_x509_privkey_t signer, + gnutls_datum_t * signature) { int result; opaque *buf; int buf_size; - gnutls_datum tbs; + gnutls_datum_t tbs; buf_size = 0; asn1_der_coding(cert, tbs_name, NULL, &buf_size, NULL); @@ -283,11 +283,11 @@ int _gnutls_x509_sign_tbs(ASN1_TYPE cert, const char *tbs_name, * -*/ int _gnutls_x509_pkix_sign(ASN1_TYPE src, const char *src_name, - gnutls_x509_crt issuer, - gnutls_x509_privkey issuer_key) + gnutls_x509_crt_t issuer, + gnutls_x509_privkey_t issuer_key) { int result; - gnutls_datum signature; + gnutls_datum_t signature; char name[128]; /* Step 1. Copy the issuer's name into the certificate. diff --git a/lib/x509/sign.h b/lib/x509/sign.h index 08e0475f72..6a9a385c78 100644 --- a/lib/x509/sign.h +++ b/lib/x509/sign.h @@ -1,6 +1,6 @@ -int _gnutls_x509_sign( const gnutls_datum* tbs, gnutls_mac_algorithm hash, - gnutls_x509_privkey signer, gnutls_datum* signature); +int _gnutls_x509_sign( const gnutls_datum_t* tbs, gnutls_mac_algorithm_t hash, + gnutls_x509_privkey_t signer, gnutls_datum_t* signature); int _gnutls_x509_sign_tbs( ASN1_TYPE cert, const char* tbs_name, - gnutls_mac_algorithm hash, gnutls_x509_privkey signer, gnutls_datum* signature); + gnutls_mac_algorithm_t hash, gnutls_x509_privkey_t signer, gnutls_datum_t* signature); int _gnutls_x509_pkix_sign(ASN1_TYPE src, const char* src_name, - gnutls_x509_crt issuer, gnutls_x509_privkey issuer_key); + gnutls_x509_crt_t issuer, gnutls_x509_privkey_t issuer_key); diff --git a/lib/x509/verify.c b/lib/x509/verify.c index 3eac6b2d91..daa301ada0 100644 --- a/lib/x509/verify.c +++ b/lib/x509/verify.c @@ -39,16 +39,16 @@ #include <common.h> #include <verify.h> -static int _gnutls_verify_certificate2(gnutls_x509_crt cert, - const gnutls_x509_crt * trusted_cas, int tcas_size, unsigned int flags, +static int _gnutls_verify_certificate2(gnutls_x509_crt_t cert, + const gnutls_x509_crt_t * trusted_cas, int tcas_size, unsigned int flags, unsigned int *output); -int _gnutls_x509_verify_signature(const gnutls_datum * signed_data, - const gnutls_datum * signature, gnutls_x509_crt issuer); +int _gnutls_x509_verify_signature(const gnutls_datum_t * signed_data, + const gnutls_datum_t * signature, gnutls_x509_crt_t issuer); static -int is_crl_issuer(gnutls_x509_crl crl, gnutls_x509_crt issuer_cert); -static int _gnutls_verify_crl2(gnutls_x509_crl crl, - const gnutls_x509_crt * trusted_cas, int tcas_size, unsigned int flags, +int is_crl_issuer(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer_cert); +static int _gnutls_verify_crl2(gnutls_x509_crl_t crl, + const gnutls_x509_crt_t * trusted_cas, int tcas_size, unsigned int flags, unsigned int *output); @@ -59,12 +59,12 @@ static int _gnutls_verify_crl2(gnutls_x509_crl crl, * Returns true or false, if the issuer is a CA, * or not. */ -static int check_if_ca(gnutls_x509_crt cert, gnutls_x509_crt issuer) +static int check_if_ca(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer) { - gnutls_datum cert_signed_data = { NULL, 0 }; - gnutls_datum issuer_signed_data = { NULL, 0 }; - gnutls_datum cert_signature = { NULL, 0 }; - gnutls_datum issuer_signature = { NULL, 0 }; + gnutls_datum_t cert_signed_data = { NULL, 0 }; + gnutls_datum_t issuer_signed_data = { NULL, 0 }; + gnutls_datum_t cert_signature = { NULL, 0 }; + gnutls_datum_t issuer_signature = { NULL, 0 }; int result; /* Check if the issuer is the same with the @@ -140,9 +140,9 @@ static int check_if_ca(gnutls_x509_crt cert, gnutls_x509_crt issuer) * a negative value is returned to indicate error. */ static -int is_issuer(gnutls_x509_crt cert, gnutls_x509_crt issuer_cert) +int is_issuer(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer_cert) { - gnutls_datum dn1 = { NULL, 0 }, dn2 = { + gnutls_datum_t dn1 = { NULL, 0 }, dn2 = { NULL, 0}; int ret; @@ -169,8 +169,8 @@ int is_issuer(gnutls_x509_crt cert, gnutls_x509_crt issuer_cert) static inline - gnutls_x509_crt find_issuer(gnutls_x509_crt cert, - const gnutls_x509_crt * trusted_cas, + gnutls_x509_crt_t find_issuer(gnutls_x509_crt_t cert, + const gnutls_x509_crt_t * trusted_cas, int tcas_size) { int i; @@ -198,13 +198,13 @@ static inline * Output will hold some extra information about the verification * procedure. */ -static int _gnutls_verify_certificate2(gnutls_x509_crt cert, - const gnutls_x509_crt * trusted_cas, +static int _gnutls_verify_certificate2(gnutls_x509_crt_t cert, + const gnutls_x509_crt_t * trusted_cas, int tcas_size, unsigned int flags, unsigned int *output) { - gnutls_datum cert_signed_data = { NULL, 0 }; - gnutls_datum cert_signature = { NULL, 0 }; - gnutls_x509_crt issuer; + gnutls_datum_t cert_signed_data = { NULL, 0 }; + gnutls_datum_t cert_signature = { NULL, 0 }; + gnutls_x509_crt_t issuer; int ret, issuer_version, result; if (output) @@ -301,9 +301,9 @@ static int _gnutls_verify_certificate2(gnutls_x509_crt cert, */ static unsigned int _gnutls_x509_verify_certificate( - const gnutls_x509_crt * certificate_list, int clist_size, - const gnutls_x509_crt * trusted_cas, int tcas_size, - const gnutls_x509_crl * CRLs, int crls_size, + const gnutls_x509_crt_t * certificate_list, int clist_size, + const gnutls_x509_crt_t * trusted_cas, int tcas_size, + const gnutls_x509_crl_t * CRLs, int crls_size, unsigned int flags) { int i = 0, ret; @@ -373,8 +373,8 @@ unsigned int _gnutls_x509_verify_certificate( * we use DER here, although we should use BER. It works fine * anyway. */ -static int decode_ber_digest_info(const gnutls_datum * info, - gnutls_mac_algorithm * hash, +static int decode_ber_digest_info(const gnutls_datum_t * info, + gnutls_mac_algorithm_t * hash, opaque * digest, int *digest_size) { ASN1_TYPE dinfo = ASN1_TYPE_EMPTY; @@ -434,16 +434,16 @@ static int decode_ber_digest_info(const gnutls_datum * info, * params[1] is public key */ static int -_pkcs1_rsa_verify_sig(const gnutls_datum * text, - const gnutls_datum * signature, mpi_t * params, +_pkcs1_rsa_verify_sig(const gnutls_datum_t * text, + const gnutls_datum_t * signature, mpi_t * params, int params_len) { - gnutls_mac_algorithm hash; + gnutls_mac_algorithm_t hash; int ret; opaque digest[MAX_HASH_SIZE], md[MAX_HASH_SIZE]; int digest_size; GNUTLS_HASH_HANDLE hd; - gnutls_datum decrypted; + gnutls_datum_t decrypted; ret = _gnutls_pkcs1_rsa_decrypt(&decrypted, signature, params, @@ -492,12 +492,12 @@ _pkcs1_rsa_verify_sig(const gnutls_datum * text, /* Hashes input data and verifies a DSA signature. */ static int -dsa_verify_sig(const gnutls_datum * text, const gnutls_datum * signature, +dsa_verify_sig(const gnutls_datum_t * text, const gnutls_datum_t * signature, mpi_t * params, int params_len) { int ret; opaque _digest[MAX_HASH_SIZE]; - gnutls_datum digest; + gnutls_datum_t digest; GNUTLS_HASH_HANDLE hd; hd = _gnutls_hash_init(GNUTLS_MAC_SHA); @@ -520,9 +520,9 @@ dsa_verify_sig(const gnutls_datum * text, const gnutls_datum * signature, /* Verifies the signature data, and returns 0 if not verified, * or 1 otherwise. */ -static int verify_sig(const gnutls_datum * tbs, - const gnutls_datum * signature, - gnutls_pk_algorithm pk, mpi_t * issuer_params, int issuer_params_size) +static int verify_sig(const gnutls_datum_t * tbs, + const gnutls_datum_t * signature, + gnutls_pk_algorithm_t pk, mpi_t * issuer_params, int issuer_params_size) { switch (pk) { @@ -559,8 +559,8 @@ static int verify_sig(const gnutls_datum * tbs, * 'tbs' is the signed data * 'signature' is the signature! */ -int _gnutls_x509_verify_signature(const gnutls_datum * tbs, - const gnutls_datum * signature, gnutls_x509_crt issuer) +int _gnutls_x509_verify_signature(const gnutls_datum_t * tbs, + const gnutls_datum_t * signature, gnutls_x509_crt_t issuer) { mpi_t issuer_params[MAX_PUBLIC_PARAMS_SIZE]; int ret, issuer_params_size, i; @@ -599,8 +599,8 @@ int _gnutls_x509_verify_signature(const gnutls_datum * tbs, * 'tbs' is the signed data * 'signature' is the signature! */ -int _gnutls_x509_privkey_verify_signature(const gnutls_datum * tbs, - const gnutls_datum * signature, gnutls_x509_privkey issuer) +int _gnutls_x509_privkey_verify_signature(const gnutls_datum_t * tbs, + const gnutls_datum_t * signature, gnutls_x509_privkey_t issuer) { int ret; @@ -636,7 +636,7 @@ int _gnutls_x509_privkey_verify_signature(const gnutls_datum * tbs, * certificate belongs to the actual peer. * * The certificate verification output will be put in @verify and will be - * one or more of the gnutls_certificate_status enumerated elements bitwise or'd. + * one or more of the gnutls_certificate_status_t enumerated elements bitwise or'd. * For a more detailed verification status use gnutls_x509_crt_verify() per list * element. * @@ -648,9 +648,9 @@ int _gnutls_x509_privkey_verify_signature(const gnutls_datum * tbs, * **/ int gnutls_x509_crt_list_verify( - const gnutls_x509_crt * cert_list, int cert_list_length, - const gnutls_x509_crt * CA_list, int CA_list_length, - const gnutls_x509_crl * CRL_list, int CRL_list_length, + const gnutls_x509_crt_t * cert_list, int cert_list_length, + const gnutls_x509_crt_t * CA_list, int CA_list_length, + const gnutls_x509_crl_t * CRL_list, int CRL_list_length, unsigned int flags, unsigned int *verify) { if (cert_list == NULL || cert_list_length == 0) @@ -680,8 +680,8 @@ int gnutls_x509_crt_list_verify( * Returns 0 on success and a negative value in case of an error. * **/ -int gnutls_x509_crt_verify(gnutls_x509_crt cert, - const gnutls_x509_crt * CA_list, int CA_list_length, +int gnutls_x509_crt_verify(gnutls_x509_crt_t cert, + const gnutls_x509_crt_t * CA_list, int CA_list_length, unsigned int flags, unsigned int *verify) { int ret; @@ -710,8 +710,8 @@ int gnutls_x509_crt_verify(gnutls_x509_crt cert, * A negative value is returned in case of an error. * **/ -int gnutls_x509_crt_check_issuer(gnutls_x509_crt cert, - gnutls_x509_crt issuer) +int gnutls_x509_crt_check_issuer(gnutls_x509_crt_t cert, + gnutls_x509_crt_t issuer) { return is_issuer(cert, issuer); } @@ -731,8 +731,8 @@ int gnutls_x509_crt_check_issuer(gnutls_x509_crt cert, * A negative value is returned in case of an error. * **/ -int gnutls_x509_crl_check_issuer(gnutls_x509_crl cert, - gnutls_x509_crt issuer) +int gnutls_x509_crl_check_issuer(gnutls_x509_crl_t cert, + gnutls_x509_crt_t issuer) { return is_crl_issuer(cert, issuer); } @@ -752,8 +752,8 @@ int gnutls_x509_crl_check_issuer(gnutls_x509_crl cert, * Returns 0 on success and a negative value in case of an error. * **/ -int gnutls_x509_crl_verify(gnutls_x509_crl crl, - const gnutls_x509_crt * CA_list, int CA_list_length, +int gnutls_x509_crl_verify(gnutls_x509_crl_t crl, + const gnutls_x509_crt_t * CA_list, int CA_list_length, unsigned int flags, unsigned int *verify) { int ret; @@ -772,9 +772,9 @@ int gnutls_x509_crl_verify(gnutls_x509_crl crl, /* The same as above, but here we've got a CRL. */ static -int is_crl_issuer(gnutls_x509_crl crl, gnutls_x509_crt issuer_cert) +int is_crl_issuer(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer_cert) { - gnutls_datum dn1 = { NULL, 0 }, dn2 = { + gnutls_datum_t dn1 = { NULL, 0 }, dn2 = { NULL, 0}; int ret; @@ -800,8 +800,8 @@ int is_crl_issuer(gnutls_x509_crl crl, gnutls_x509_crt issuer_cert) } static inline -gnutls_x509_crt find_crl_issuer(gnutls_x509_crl crl, - const gnutls_x509_crt * trusted_cas, int tcas_size) +gnutls_x509_crt_t find_crl_issuer(gnutls_x509_crl_t crl, + const gnutls_x509_crt_t * trusted_cas, int tcas_size) { int i; @@ -826,14 +826,14 @@ gnutls_x509_crt find_crl_issuer(gnutls_x509_crl crl, * Output will hold information about the verification * procedure. */ -static int _gnutls_verify_crl2(gnutls_x509_crl crl, - const gnutls_x509_crt * trusted_cas, int tcas_size, +static int _gnutls_verify_crl2(gnutls_x509_crl_t crl, + const gnutls_x509_crt_t * trusted_cas, int tcas_size, unsigned int flags, unsigned int *output) { /* CRL is ignored for now */ - gnutls_datum crl_signed_data = { NULL, 0 }; - gnutls_datum crl_signature = { NULL, 0 }; - gnutls_x509_crt issuer; + gnutls_datum_t crl_signed_data = { NULL, 0 }; + gnutls_datum_t crl_signature = { NULL, 0 }; + gnutls_x509_crt_t issuer; int ret, result; if (output) diff --git a/lib/x509/verify.h b/lib/x509/verify.h index e2f96dbf46..d98dbb4390 100644 --- a/lib/x509/verify.h +++ b/lib/x509/verify.h @@ -5,22 +5,22 @@ typedef enum gnutls_certificate_verify_flags { GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT=2 } gnutls_certificate_verify_flags; -int gnutls_x509_crt_is_issuer( gnutls_x509_crt cert, - gnutls_x509_crt issuer); -int gnutls_x509_crt_verify( gnutls_x509_crt cert, - const gnutls_x509_crt *CA_list, int CA_list_length, +int gnutls_x509_crt_is_issuer( gnutls_x509_crt_t cert, + gnutls_x509_crt_t issuer); +int gnutls_x509_crt_verify( gnutls_x509_crt_t cert, + const gnutls_x509_crt_t *CA_list, int CA_list_length, unsigned int flags, unsigned int *verify); -int gnutls_x509_crl_verify( gnutls_x509_crl crl, - const gnutls_x509_crt *CA_list, int CA_list_length, +int gnutls_x509_crl_verify( gnutls_x509_crl_t crl, + const gnutls_x509_crt_t *CA_list, int CA_list_length, unsigned int flags, unsigned int *verify); int gnutls_x509_crt_list_verify( - const gnutls_x509_crt* cert_list, int cert_list_length, - const gnutls_x509_crt * CA_list, int CA_list_length, - const gnutls_x509_crl* CRL_list, int CRL_list_length, + const gnutls_x509_crt_t* cert_list, int cert_list_length, + const gnutls_x509_crt_t * CA_list, int CA_list_length, + const gnutls_x509_crl_t* CRL_list, int CRL_list_length, unsigned int flags, unsigned int *verify); -int _gnutls_x509_verify_signature( const gnutls_datum* tbs, - const gnutls_datum* signature, gnutls_x509_crt issuer); -int _gnutls_x509_privkey_verify_signature( const gnutls_datum* tbs, - const gnutls_datum* signature, gnutls_x509_privkey issuer); +int _gnutls_x509_verify_signature( const gnutls_datum_t* tbs, + const gnutls_datum_t* signature, gnutls_x509_crt_t issuer); +int _gnutls_x509_privkey_verify_signature( const gnutls_datum_t* tbs, + const gnutls_datum_t* signature, gnutls_x509_privkey_t issuer); diff --git a/lib/x509/x509.c b/lib/x509/x509.c index c36e6a426d..4b9d275b31 100644 --- a/lib/x509/x509.c +++ b/lib/x509/x509.c @@ -40,7 +40,7 @@ #include <verify.h> /** - * gnutls_x509_crt_init - This function initializes a gnutls_x509_crt structure + * gnutls_x509_crt_init - This function initializes a gnutls_x509_crt_t structure * @cert: The structure to be initialized * * This function will initialize an X.509 certificate structure. @@ -48,7 +48,7 @@ * Returns 0 on success. * **/ -int gnutls_x509_crt_init(gnutls_x509_crt * cert) +int gnutls_x509_crt_init(gnutls_x509_crt_t * cert) { *cert = gnutls_calloc(1, sizeof(gnutls_x509_crt_int)); @@ -67,7 +67,7 @@ int gnutls_x509_crt_init(gnutls_x509_crt * cert) } /*- - * _gnutls_x509_crt_cpy - This function copies a gnutls_x509_crt structure + * _gnutls_x509_crt_cpy - This function copies a gnutls_x509_crt_t structure * @dest: The structure where to copy * @src: The structure to be copied * @@ -76,12 +76,12 @@ int gnutls_x509_crt_init(gnutls_x509_crt * cert) * Returns 0 on success. * -*/ -int _gnutls_x509_crt_cpy(gnutls_x509_crt dest, gnutls_x509_crt src) +int _gnutls_x509_crt_cpy(gnutls_x509_crt_t dest, gnutls_x509_crt_t src) { int ret; size_t der_size; opaque *der; - gnutls_datum tmp; + gnutls_datum_t tmp; ret = gnutls_x509_crt_export(src, GNUTLS_X509_FMT_DER, NULL, &der_size); @@ -119,13 +119,13 @@ int _gnutls_x509_crt_cpy(gnutls_x509_crt dest, gnutls_x509_crt src) } /** - * gnutls_x509_crt_deinit - This function deinitializes memory used by a gnutls_x509_crt structure + * gnutls_x509_crt_deinit - This function deinitializes memory used by a gnutls_x509_crt_t structure * @cert: The structure to be initialized * * This function will deinitialize a CRL structure. * **/ -void gnutls_x509_crt_deinit(gnutls_x509_crt cert) +void gnutls_x509_crt_deinit(gnutls_x509_crt_t cert) { if (!cert) return; @@ -143,7 +143,7 @@ void gnutls_x509_crt_deinit(gnutls_x509_crt cert) * @format: One of DER or PEM * * This function will convert the given DER or PEM encoded Certificate - * to the native gnutls_x509_crt format. The output will be stored in @cert. + * to the native gnutls_x509_crt_t format. The output will be stored in @cert. * * If the Certificate is PEM encoded it should have a header of "X509 CERTIFICATE", or * "CERTIFICATE". @@ -151,11 +151,11 @@ void gnutls_x509_crt_deinit(gnutls_x509_crt cert) * Returns 0 on success. * **/ -int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data, - gnutls_x509_crt_fmt format) +int gnutls_x509_crt_import(gnutls_x509_crt_t cert, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format) { int result = 0, need_free = 0; - gnutls_datum _data; + gnutls_datum_t _data; opaque *signature = NULL; if (cert == NULL) { @@ -221,7 +221,7 @@ int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data, /** * gnutls_x509_crt_get_issuer_dn - This function returns the Certificate's issuer distinguished name - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @buf: a pointer to a structure to hold the name (may be null) * @sizeof_buf: initially holds the size of @buf * @@ -236,7 +236,7 @@ int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data, * On success 0 is returned. * **/ -int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt cert, char *buf, +int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt_t cert, char *buf, size_t * sizeof_buf) { if (cert == NULL) { @@ -251,7 +251,7 @@ int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt cert, char *buf, /** * gnutls_x509_crt_get_issuer_dn_by_oid - This function returns the Certificate's issuer distinguished name - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @oid: holds an Object Identified in null terminated string * @indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use zero to get the first one. * @raw_flag: If non zero returns the raw DER data of the DN part. @@ -274,7 +274,7 @@ int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt cert, char *buf, * On success 0 is returned. * **/ -int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, +int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt_t cert, const char *oid, int indx, unsigned int raw_flag, void *buf, size_t * sizeof_buf) @@ -291,7 +291,7 @@ int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, /** * gnutls_x509_crt_get_issuer_dn_oid - This function returns the Certificate's issuer distinguished name OIDs - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @indx: This specifies which OID to return. Use zero to get the first one. * @oid: a pointer to a buffer to hold the OID (may be null) * @sizeof_oid: initially holds the size of @oid @@ -306,7 +306,7 @@ int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, * On success 0 is returned. * **/ -int gnutls_x509_crt_get_issuer_dn_oid(gnutls_x509_crt cert, +int gnutls_x509_crt_get_issuer_dn_oid(gnutls_x509_crt_t cert, int indx, void *oid, size_t * sizeof_oid) { @@ -322,7 +322,7 @@ int gnutls_x509_crt_get_issuer_dn_oid(gnutls_x509_crt cert, /** * gnutls_x509_crt_get_dn - This function returns the Certificate's distinguished name - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @buf: a pointer to a structure to hold the name (may be null) * @sizeof_buf: initially holds the size of @buf * @@ -337,7 +337,7 @@ int gnutls_x509_crt_get_issuer_dn_oid(gnutls_x509_crt cert, * On success 0 is returned. * **/ -int gnutls_x509_crt_get_dn(gnutls_x509_crt cert, char *buf, +int gnutls_x509_crt_get_dn(gnutls_x509_crt_t cert, char *buf, size_t * sizeof_buf) { if (cert == NULL) { @@ -352,7 +352,7 @@ int gnutls_x509_crt_get_dn(gnutls_x509_crt cert, char *buf, /** * gnutls_x509_crt_get_dn_by_oid - This function returns the Certificate's distinguished name - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @oid: holds an Object Identified in null terminated string * @indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use zero to get the first one. * @raw_flag: If non zero returns the raw DER data of the DN part. @@ -375,7 +375,7 @@ int gnutls_x509_crt_get_dn(gnutls_x509_crt cert, char *buf, * On success 0 is returned. * **/ -int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char *oid, +int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt_t cert, const char *oid, int indx, unsigned int raw_flag, void *buf, size_t * sizeof_buf) { @@ -391,7 +391,7 @@ int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char *oid, /** * gnutls_x509_crt_get_dn_oid - This function returns the Certificate's subject distinguished name OIDs - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @indx: This specifies which OID to return. Use zero to get the first one. * @oid: a pointer to a buffer to hold the OID (may be null) * @sizeof_oid: initially holds the size of @oid @@ -406,7 +406,7 @@ int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char *oid, * On success 0 is returned. * **/ -int gnutls_x509_crt_get_dn_oid(gnutls_x509_crt cert, +int gnutls_x509_crt_get_dn_oid(gnutls_x509_crt_t cert, int indx, void *oid, size_t * sizeof_oid) { if (cert == NULL) { @@ -421,18 +421,18 @@ int gnutls_x509_crt_get_dn_oid(gnutls_x509_crt cert, /** * gnutls_x509_crt_get_signature_algorithm - This function returns the Certificate's signature algorithm - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * - * This function will return a value of the gnutls_sign_algorithm enumeration that + * This function will return a value of the gnutls_sign_algorithm_t enumeration that * is the signature algorithm. * * Returns a negative value on error. * **/ -int gnutls_x509_crt_get_signature_algorithm(gnutls_x509_crt cert) +int gnutls_x509_crt_get_signature_algorithm(gnutls_x509_crt_t cert) { int result; - gnutls_datum sa; + gnutls_datum_t sa; if (cert == NULL) { gnutls_assert(); @@ -460,14 +460,14 @@ int gnutls_x509_crt_get_signature_algorithm(gnutls_x509_crt cert) /** * gnutls_x509_crt_get_version - This function returns the Certificate's version number - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * * This function will return the version of the specified Certificate. * * Returns a negative value on error. * **/ -int gnutls_x509_crt_get_version(gnutls_x509_crt cert) +int gnutls_x509_crt_get_version(gnutls_x509_crt_t cert) { opaque version[5]; int len, result; @@ -493,14 +493,14 @@ int gnutls_x509_crt_get_version(gnutls_x509_crt cert) /** * gnutls_x509_crt_get_activation_time - This function returns the Certificate's activation time - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * * This function will return the time this Certificate was or will be activated. * * Returns (time_t)-1 on error. * **/ -time_t gnutls_x509_crt_get_activation_time(gnutls_x509_crt cert) +time_t gnutls_x509_crt_get_activation_time(gnutls_x509_crt_t cert) { if (cert == NULL) { gnutls_assert(); @@ -513,14 +513,14 @@ time_t gnutls_x509_crt_get_activation_time(gnutls_x509_crt cert) /** * gnutls_x509_crt_get_expiration_time - This function returns the Certificate's expiration time - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * * This function will return the time this Certificate was or will be expired. * * Returns (time_t)-1 on error. * **/ -time_t gnutls_x509_crt_get_expiration_time(gnutls_x509_crt cert) +time_t gnutls_x509_crt_get_expiration_time(gnutls_x509_crt_t cert) { if (cert == NULL) { gnutls_assert(); @@ -533,7 +533,7 @@ time_t gnutls_x509_crt_get_expiration_time(gnutls_x509_crt cert) /** * gnutls_x509_crt_get_serial - This function returns the certificate's serial number - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @result: The place where the serial number will be copied * @result_size: Holds the size of the result field. * @@ -546,7 +546,7 @@ time_t gnutls_x509_crt_get_expiration_time(gnutls_x509_crt cert) * Returns 0 on success and a negative value in case of an error. * **/ -int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, void *result, +int gnutls_x509_crt_get_serial(gnutls_x509_crt_t cert, void *result, size_t * result_size) { int ret; @@ -568,7 +568,7 @@ int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, void *result, /** * gnutls_x509_crt_get_subject_key_id - This function returns the certificate's key identifier - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @result: The place where the identifier will be copied * @result_size: Holds the size of the result field. * @critical: will be non zero if the extension is marked as critical (may be null) @@ -580,12 +580,12 @@ int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, void *result, * Returns 0 on success and a negative value in case of an error. * **/ -int gnutls_x509_crt_get_subject_key_id(gnutls_x509_crt cert, void *ret, +int gnutls_x509_crt_get_subject_key_id(gnutls_x509_crt_t cert, void *ret, size_t * ret_size, unsigned int *critical) { int result, len; - gnutls_datum id; + gnutls_datum_t id; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; if (cert == NULL) { @@ -647,7 +647,7 @@ int gnutls_x509_crt_get_subject_key_id(gnutls_x509_crt cert, void *ret, /** * gnutls_x509_crt_get_authority_key_id - This function returns the certificate authority's identifier - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @result: The place where the identifier will be copied * @result_size: Holds the size of the result field. * @critical: will be non zero if the extension is marked as critical (may be null) @@ -660,12 +660,12 @@ int gnutls_x509_crt_get_subject_key_id(gnutls_x509_crt cert, void *ret, * Returns 0 on success and a negative value in case of an error. * **/ -int gnutls_x509_crt_get_authority_key_id(gnutls_x509_crt cert, void *ret, +int gnutls_x509_crt_get_authority_key_id(gnutls_x509_crt_t cert, void *ret, size_t * ret_size, unsigned int *critical) { int result, len; - gnutls_datum id; + gnutls_datum_t id; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; if (cert == NULL) { @@ -727,7 +727,7 @@ int gnutls_x509_crt_get_authority_key_id(gnutls_x509_crt cert, void *ret, /** * gnutls_x509_crt_get_pk_algorithm - This function returns the certificate's PublicKey algorithm - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @bits: if bits is non null it will hold the size of the parameters' in bits * * This function will return the public key algorithm of an X.509 @@ -738,11 +738,11 @@ int gnutls_x509_crt_get_authority_key_id(gnutls_x509_crt cert, void *ret, * For DSA the bits returned are of the public * exponent. * - * Returns a member of the gnutls_pk_algorithm enumeration on success, + * Returns a member of the gnutls_pk_algorithm_t enumeration on success, * or a negative value on error. * **/ -int gnutls_x509_crt_get_pk_algorithm(gnutls_x509_crt cert, +int gnutls_x509_crt_get_pk_algorithm(gnutls_x509_crt_t cert, unsigned int *bits) { int result; @@ -776,7 +776,7 @@ static int parse_general_name(ASN1_TYPE src, const char *src_name, char nptr[128]; int result; opaque choice_type[128]; - gnutls_x509_subject_alt_name type; + gnutls_x509_subject_alt_name_t type; seq++; /* 0->1, 1->2 etc */ _gnutls_int2str(seq, num); @@ -802,7 +802,7 @@ static int parse_general_name(ASN1_TYPE src, const char *src_name, type = _gnutls_x509_san_find_type(choice_type); - if (type == (gnutls_x509_subject_alt_name) - 1) { + if (type == (gnutls_x509_subject_alt_name_t) - 1) { gnutls_assert(); return GNUTLS_E_X509_UNKNOWN_SAN; } @@ -827,7 +827,7 @@ static int parse_general_name(ASN1_TYPE src, const char *src_name, /** * gnutls_x509_crt_get_subject_alt_name - This function returns the certificate's alternative name, if any - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.) * @ret: is the place where the alternative name will be copied to * @ret_size: holds the size of ret. @@ -842,21 +842,21 @@ static int parse_general_name(ASN1_TYPE src, const char *src_name, * * 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_t. * * If the certificate does not have an Alternative name with the specified * sequence number then returns GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; * **/ -int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert, +int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt_t cert, unsigned int seq, void *ret, size_t * ret_size, unsigned int *critical) { int result; - gnutls_datum dnsname; + gnutls_datum_t dnsname; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; - gnutls_x509_subject_alt_name type; + gnutls_x509_subject_alt_name_t type; if (cert == NULL) { gnutls_assert(); @@ -911,7 +911,7 @@ int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert, /** * gnutls_x509_crt_get_ca_status - This function returns the certificate CA status - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @critical: will be non zero if the extension is marked as critical * * This function will return certificates CA status, by reading the @@ -924,11 +924,11 @@ int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert, * GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. * **/ -int gnutls_x509_crt_get_ca_status(gnutls_x509_crt cert, +int gnutls_x509_crt_get_ca_status(gnutls_x509_crt_t cert, unsigned int *critical) { int result; - gnutls_datum basicConstraints; + gnutls_datum_t basicConstraints; int ca; if (cert == NULL) { @@ -965,7 +965,7 @@ int gnutls_x509_crt_get_ca_status(gnutls_x509_crt cert, /** * gnutls_x509_crt_get_key_usage - This function returns the certificate's key usage - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @key_usage: where the key usage bits will be stored * @critical: will be non zero if the extension is marked as critical * @@ -982,12 +982,12 @@ int gnutls_x509_crt_get_ca_status(gnutls_x509_crt cert, * GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. * **/ -int gnutls_x509_crt_get_key_usage(gnutls_x509_crt cert, +int gnutls_x509_crt_get_key_usage(gnutls_x509_crt_t cert, unsigned int *key_usage, unsigned int *critical) { int result; - gnutls_datum keyUsage; + gnutls_datum_t keyUsage; uint16 _usage; if (cert == NULL) { @@ -1022,7 +1022,7 @@ int gnutls_x509_crt_get_key_usage(gnutls_x509_crt cert, /** * gnutls_x509_crt_get_extension_by_oid - This function returns the specified extension - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @oid: holds an Object Identified in null terminated string * @indx: In case multiple same OIDs exist in the extensions, this specifies which to send. Use zero to get the first one. * @buf: a pointer to a structure to hold the name (may be null) @@ -1038,13 +1038,13 @@ int gnutls_x509_crt_get_key_usage(gnutls_x509_crt cert, * GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. * **/ -int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt cert, +int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt_t cert, const char *oid, int indx, void *buf, size_t * sizeof_buf, unsigned int *critical) { int result; - gnutls_datum output; + gnutls_datum_t output; if (cert == NULL) { gnutls_assert(); @@ -1082,7 +1082,7 @@ int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt cert, /** * gnutls_x509_crt_get_extension_oid - This function returns the specified extension OID - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @indx: Specifies which extension OID to send. Use zero to get the first one. * @oid: a pointer to a structure to hold the OID (may be null) * @sizeof_oid: initially holds the size of @oid @@ -1095,7 +1095,7 @@ int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt cert, * GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. * **/ -int gnutls_x509_crt_get_extension_oid(gnutls_x509_crt cert, int indx, +int gnutls_x509_crt_get_extension_oid(gnutls_x509_crt_t cert, int indx, void *oid, size_t * sizeof_oid) { int result; @@ -1117,13 +1117,13 @@ int gnutls_x509_crt_get_extension_oid(gnutls_x509_crt cert, int indx, static -int _gnutls_x509_crt_get_raw_dn2(gnutls_x509_crt cert, - const char *whom, gnutls_datum * start) +int _gnutls_x509_crt_get_raw_dn2(gnutls_x509_crt_t cert, + const char *whom, gnutls_datum_t * start) { ASN1_TYPE c2 = ASN1_TYPE_EMPTY; int result, len1; int start1, end1; - gnutls_datum signed_data; + gnutls_datum_t signed_data; /* get the issuer of 'cert' */ @@ -1175,7 +1175,7 @@ int _gnutls_x509_crt_get_raw_dn2(gnutls_x509_crt cert, /*- * _gnutls_x509_crt_get_raw_issuer_dn - This function returns the issuer's DN DER encoded - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @start: will hold the starting point of the DN * * This function will return a pointer to the DER encoded DN structure and @@ -1184,15 +1184,15 @@ int _gnutls_x509_crt_get_raw_dn2(gnutls_x509_crt cert, * Returns 0 on success or a negative value on error. * -*/ -int _gnutls_x509_crt_get_raw_issuer_dn(gnutls_x509_crt cert, - gnutls_datum * start) +int _gnutls_x509_crt_get_raw_issuer_dn(gnutls_x509_crt_t cert, + gnutls_datum_t * start) { return _gnutls_x509_crt_get_raw_dn2(cert, "issuer", start); } /*- * _gnutls_x509_crt_get_raw_dn - This function returns the subject's DN DER encoded - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @start: will hold the starting point of the DN * * This function will return a pointer to the DER encoded DN structure and @@ -1201,7 +1201,7 @@ int _gnutls_x509_crt_get_raw_issuer_dn(gnutls_x509_crt cert, * Returns 0 on success, or a negative value on error. * -*/ -int _gnutls_x509_crt_get_raw_dn(gnutls_x509_crt cert, gnutls_datum * start) +int _gnutls_x509_crt_get_raw_dn(gnutls_x509_crt_t cert, gnutls_datum_t * start) { return _gnutls_x509_crt_get_raw_dn2(cert, "subject", start); } @@ -1209,7 +1209,7 @@ int _gnutls_x509_crt_get_raw_dn(gnutls_x509_crt cert, gnutls_datum * start) /** * gnutls_x509_crt_get_fingerprint - This function returns the Certificate's fingerprint - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @algo: is a digest algorithm * @buf: a pointer to a structure to hold the fingerprint (may be null) * @sizeof_buf: initially holds the size of @buf @@ -1224,14 +1224,14 @@ int _gnutls_x509_crt_get_raw_dn(gnutls_x509_crt cert, gnutls_datum * start) * On success 0 is returned. * **/ -int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt cert, - gnutls_digest_algorithm algo, +int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt_t cert, + gnutls_digest_algorithm_t algo, void *buf, size_t * sizeof_buf) { opaque *cert_buf; int cert_buf_size; int result; - gnutls_datum tmp; + gnutls_datum_t tmp; if (sizeof_buf == 0 || cert == NULL) { return GNUTLS_E_INVALID_REQUEST; @@ -1283,8 +1283,8 @@ int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt cert, * 0 on success. * **/ -int gnutls_x509_crt_export(gnutls_x509_crt cert, - gnutls_x509_crt_fmt format, void *output_data, +int gnutls_x509_crt_export(gnutls_x509_crt_t cert, + gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size) { if (cert == NULL) { @@ -1317,14 +1317,14 @@ int gnutls_x509_crt_export(gnutls_x509_crt cert, * 0 on success. * **/ -int gnutls_x509_crt_get_key_id(gnutls_x509_crt crt, unsigned int flags, +int gnutls_x509_crt_get_key_id(gnutls_x509_crt_t crt, unsigned int flags, unsigned char *output_data, size_t * output_data_size) { mpi_t params[MAX_PUBLIC_PARAMS_SIZE]; int params_size = MAX_PUBLIC_PARAMS_SIZE; int i, pk, result = 0; - gnutls_datum der = { NULL, 0 }; + gnutls_datum_t der = { NULL, 0 }; GNUTLS_HASH_HANDLE hd; if (crt == NULL) { @@ -1399,8 +1399,8 @@ int gnutls_x509_crt_get_key_id(gnutls_x509_crt crt, unsigned int flags, /** * gnutls_x509_crt_check_revocation - This function checks if the given certificate is revoked - * @cert: should contain a gnutls_x509_crt structure - * @crl_list: should contain a list of gnutls_x509_crl structures + * @cert: should contain a gnutls_x509_crt_t structure + * @crl_list: should contain a list of gnutls_x509_crl_t structures * @crl_list_length: the length of the crl_list * * This function will return check if the given certificate is revoked. @@ -1410,14 +1410,14 @@ int gnutls_x509_crt_get_key_id(gnutls_x509_crt crt, unsigned int flags, * A negative value is returned on error. * **/ -int gnutls_x509_crt_check_revocation(gnutls_x509_crt cert, - const gnutls_x509_crl * crl_list, int crl_list_length) +int gnutls_x509_crt_check_revocation(gnutls_x509_crt_t cert, + const gnutls_x509_crl_t * crl_list, int crl_list_length) { opaque serial[64]; opaque cert_serial[64]; size_t serial_size, cert_serial_size; int ncerts, ret, i, j; - gnutls_datum dn1, dn2; + gnutls_datum_t dn1, dn2; if (cert == NULL) { gnutls_assert(); @@ -1506,9 +1506,9 @@ int gnutls_x509_crt_check_revocation(gnutls_x509_crt cert, * 1 on success. * **/ -int gnutls_x509_crt_verify_data(gnutls_x509_crt crt, unsigned int flags, - const gnutls_datum * data, - const gnutls_datum * signature) +int gnutls_x509_crt_verify_data(gnutls_x509_crt_t crt, unsigned int flags, + const gnutls_datum_t * data, + const gnutls_datum_t * signature) { int result; @@ -1528,7 +1528,7 @@ int gnutls_x509_crt_verify_data(gnutls_x509_crt crt, unsigned int flags, /** * gnutls_x509_crt_get_crl_dist_points - This function returns the CRL distribution points - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @seq: specifies the sequence number of the distribution point (0 for the first one, 1 for the second etc.) * @ret: is the place where the distribution point will be copied to * @ret_size: holds the size of ret. @@ -1550,25 +1550,25 @@ int gnutls_x509_crt_verify_data(gnutls_x509_crt crt, unsigned int flags, * * Returns GNUTLS_E_SHORT_MEMORY_BUFFER if ret_size is not enough to hold the distribution * point, or the type of the distribution point 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_t. * * If the certificate does not have an Alternative name with the specified * sequence number then returns GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; * **/ -int gnutls_x509_crt_get_crl_dist_points(gnutls_x509_crt cert, +int gnutls_x509_crt_get_crl_dist_points(gnutls_x509_crt_t cert, unsigned int seq, void *ret, size_t * ret_size, unsigned int *reason_flags, unsigned int *critical) { int result; - gnutls_datum dist_points = { NULL, 0 }; + gnutls_datum_t dist_points = { NULL, 0 }; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; char name[128]; int len; char num[MAX_INT_DIGITS]; - gnutls_x509_subject_alt_name type; + gnutls_x509_subject_alt_name_t type; uint8 reasons[2]; if (cert == NULL) { @@ -1652,7 +1652,7 @@ int gnutls_x509_crt_get_crl_dist_points(gnutls_x509_crt cert, /** * gnutls_x509_crt_get_key_purpose_oid - This function returns the Certificate's key purpose OIDs - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @indx: This specifies which OID to return. Use zero to get the first one. * @oid: a pointer to a buffer to hold the OID (may be null) * @sizeof_oid: initially holds the size of @oid @@ -1668,7 +1668,7 @@ int gnutls_x509_crt_get_crl_dist_points(gnutls_x509_crt cert, * On success 0 is returned. * **/ -int gnutls_x509_crt_get_key_purpose_oid(gnutls_x509_crt cert, +int gnutls_x509_crt_get_key_purpose_oid(gnutls_x509_crt_t cert, int indx, void *oid, size_t * sizeof_oid, unsigned int *critical) @@ -1676,7 +1676,7 @@ int gnutls_x509_crt_get_key_purpose_oid(gnutls_x509_crt cert, char counter[MAX_INT_DIGITS]; char tmpstr[64]; int result, len; - gnutls_datum id; + gnutls_datum_t id; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; if (cert == NULL) { @@ -1754,8 +1754,8 @@ int gnutls_x509_crt_get_key_purpose_oid(gnutls_x509_crt cert, * gnutls_malloc() and will be stored in the appropriate datum. * **/ -int gnutls_x509_crt_get_pk_rsa_raw(gnutls_x509_crt crt, - gnutls_datum * m, gnutls_datum * e) +int gnutls_x509_crt_get_pk_rsa_raw(gnutls_x509_crt_t crt, + gnutls_datum_t * m, gnutls_datum_t * e) { int ret; mpi_t params[MAX_PUBLIC_PARAMS_SIZE]; @@ -1814,9 +1814,9 @@ int gnutls_x509_crt_get_pk_rsa_raw(gnutls_x509_crt crt, * gnutls_malloc() and will be stored in the appropriate datum. * **/ -int gnutls_x509_crt_get_pk_dsa_raw(gnutls_x509_crt crt, - gnutls_datum * p, gnutls_datum * q, - gnutls_datum * g, gnutls_datum * y) +int gnutls_x509_crt_get_pk_dsa_raw(gnutls_x509_crt_t crt, + gnutls_datum_t * p, gnutls_datum_t * q, + gnutls_datum_t * g, gnutls_datum_t * y) { int ret; mpi_t params[MAX_PUBLIC_PARAMS_SIZE]; diff --git a/lib/x509/x509.h b/lib/x509/x509.h index 52e74667bd..d6bd75c2f7 100644 --- a/lib/x509/x509.h +++ b/lib/x509/x509.h @@ -49,7 +49,7 @@ typedef struct gnutls_x509_privkey_int { */ int params_size; /* holds the number of params */ - gnutls_pk_algorithm pk_algorithm; + gnutls_pk_algorithm_t pk_algorithm; int crippled; /* The crippled keys will not use the ASN1_TYPE key. * The encoding will only be performed at the export @@ -59,79 +59,79 @@ typedef struct gnutls_x509_privkey_int { ASN1_TYPE key; } gnutls_x509_privkey_int; -typedef struct gnutls_x509_crt_int *gnutls_x509_crt; -typedef struct gnutls_x509_crl_int *gnutls_x509_crl; -typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey; +typedef struct gnutls_x509_crt_int *gnutls_x509_crt_t; +typedef struct gnutls_x509_crl_int *gnutls_x509_crl_t; +typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey_t; -int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt cert, const char* oid, +int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt_t cert, const char* oid, int indx, unsigned int raw_flag, void *buf, size_t *sizeof_buf); -int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt cert, +int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt_t cert, unsigned int seq, void *ret, size_t *ret_size, unsigned int* critical); -int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt cert, const char* oid, +int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt_t cert, const char* oid, int indx, unsigned int raw_flag, void *buf, size_t *sizeof_buf); -int gnutls_x509_crt_get_ca_status(gnutls_x509_crt cert, unsigned int* critical); -int gnutls_x509_crt_get_pk_algorithm( gnutls_x509_crt cert, unsigned int* bits); +int gnutls_x509_crt_get_ca_status(gnutls_x509_crt_t cert, unsigned int* critical); +int gnutls_x509_crt_get_pk_algorithm( gnutls_x509_crt_t cert, unsigned int* bits); -int _gnutls_x509_crt_cpy(gnutls_x509_crt dest, gnutls_x509_crt src); -int _gnutls_x509_crt_get_raw_issuer_dn( gnutls_x509_crt cert, - gnutls_datum* start); -int _gnutls_x509_crt_get_raw_dn( gnutls_x509_crt cert, - gnutls_datum* start); +int _gnutls_x509_crt_cpy(gnutls_x509_crt_t dest, gnutls_x509_crt_t src); +int _gnutls_x509_crt_get_raw_issuer_dn( gnutls_x509_crt_t cert, + gnutls_datum_t* start); +int _gnutls_x509_crt_get_raw_dn( gnutls_x509_crt_t cert, + gnutls_datum_t* start); -int gnutls_x509_crt_get_serial(gnutls_x509_crt cert, void* result, size_t* result_size); +int gnutls_x509_crt_get_serial(gnutls_x509_crt_t cert, void* result, size_t* result_size); -int _gnutls_x509_compare_raw_dn(const gnutls_datum * dn1, - const gnutls_datum * dn2); +int _gnutls_x509_compare_raw_dn(const gnutls_datum_t * dn1, + const gnutls_datum_t * dn2); -int gnutls_x509_crt_check_revocation(gnutls_x509_crt cert, - const gnutls_x509_crl * crl_list, int crl_list_length); +int gnutls_x509_crt_check_revocation(gnutls_x509_crt_t cert, + const gnutls_x509_crl_t * crl_list, int crl_list_length); -int _gnutls_x509_crl_cpy(gnutls_x509_crl dest, gnutls_x509_crl src); -int _gnutls_x509_crl_get_raw_issuer_dn( gnutls_x509_crl crl, - gnutls_datum* dn); -int gnutls_x509_crl_get_crt_count(gnutls_x509_crl crl); -int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl crl, int index, +int _gnutls_x509_crl_cpy(gnutls_x509_crl_t dest, gnutls_x509_crl_t src); +int _gnutls_x509_crl_get_raw_issuer_dn( gnutls_x509_crl_t crl, + gnutls_datum_t* dn); +int gnutls_x509_crl_get_crt_count(gnutls_x509_crl_t crl); +int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl_t crl, int index, unsigned char *serial, size_t *serial_size, time_t * time); -void gnutls_x509_crl_deinit(gnutls_x509_crl crl); -int gnutls_x509_crl_init(gnutls_x509_crl * crl); -int gnutls_x509_crl_import(gnutls_x509_crl crl, const gnutls_datum * data, - gnutls_x509_crt_fmt format); -int gnutls_x509_crl_export( gnutls_x509_crl crl, - gnutls_x509_crt_fmt format, void* output_data, size_t* output_data_size); - -int gnutls_x509_crt_init(gnutls_x509_crt * cert); -void gnutls_x509_crt_deinit(gnutls_x509_crt cert); -int gnutls_x509_crt_import(gnutls_x509_crt cert, const gnutls_datum * data, - gnutls_x509_crt_fmt format); -int gnutls_x509_crt_export( gnutls_x509_crt cert, - gnutls_x509_crt_fmt format, void* output_data, size_t* output_data_size); - -int gnutls_x509_crt_get_key_usage(gnutls_x509_crt cert, unsigned int *key_usage, +void gnutls_x509_crl_deinit(gnutls_x509_crl_t crl); +int gnutls_x509_crl_init(gnutls_x509_crl_t * crl); +int gnutls_x509_crl_import(gnutls_x509_crl_t crl, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format); +int gnutls_x509_crl_export( gnutls_x509_crl_t crl, + gnutls_x509_crt_fmt_t format, void* output_data, size_t* output_data_size); + +int gnutls_x509_crt_init(gnutls_x509_crt_t * cert); +void gnutls_x509_crt_deinit(gnutls_x509_crt_t cert); +int gnutls_x509_crt_import(gnutls_x509_crt_t cert, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format); +int gnutls_x509_crt_export( gnutls_x509_crt_t cert, + gnutls_x509_crt_fmt_t format, void* output_data, size_t* output_data_size); + +int gnutls_x509_crt_get_key_usage(gnutls_x509_crt_t cert, unsigned int *key_usage, unsigned int *critical); -int gnutls_x509_crt_get_version(gnutls_x509_crt cert); +int gnutls_x509_crt_get_version(gnutls_x509_crt_t cert); -int gnutls_x509_privkey_init(gnutls_x509_privkey * key); -void gnutls_x509_privkey_deinit(gnutls_x509_privkey key); +int gnutls_x509_privkey_init(gnutls_x509_privkey_t * key); +void gnutls_x509_privkey_deinit(gnutls_x509_privkey_t key); -int gnutls_x509_privkey_generate( gnutls_x509_privkey key, gnutls_pk_algorithm algo, +int gnutls_x509_privkey_generate( gnutls_x509_privkey_t key, gnutls_pk_algorithm_t algo, unsigned int bits, unsigned int flags); -int gnutls_x509_privkey_import(gnutls_x509_privkey key, const gnutls_datum * data, - gnutls_x509_crt_fmt format); -int gnutls_x509_privkey_get_pk_algorithm( gnutls_x509_privkey key); -int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey key, - const gnutls_datum* m, const gnutls_datum* e, - const gnutls_datum* d, const gnutls_datum* p, - const gnutls_datum* q, const gnutls_datum* u); -int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey key, - gnutls_datum * m, gnutls_datum *e, - gnutls_datum *d, gnutls_datum *p, gnutls_datum* q, - gnutls_datum* u); -int gnutls_x509_privkey_export( gnutls_x509_privkey key, - gnutls_x509_crt_fmt format, void* output_data, size_t* output_data_size); +int gnutls_x509_privkey_import(gnutls_x509_privkey_t key, const gnutls_datum_t * data, + gnutls_x509_crt_fmt_t format); +int gnutls_x509_privkey_get_pk_algorithm( gnutls_x509_privkey_t key); +int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey_t key, + const gnutls_datum_t* m, const gnutls_datum_t* e, + const gnutls_datum_t* d, const gnutls_datum_t* p, + const gnutls_datum_t* q, const gnutls_datum_t* u); +int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey_t key, + gnutls_datum_t * m, gnutls_datum_t *e, + gnutls_datum_t *d, gnutls_datum_t *p, gnutls_datum_t* q, + gnutls_datum_t* u); +int gnutls_x509_privkey_export( gnutls_x509_privkey_t key, + gnutls_x509_crt_fmt_t format, void* output_data, size_t* output_data_size); #define GNUTLS_CRL_REASON_UNUSED 128 #define GNUTLS_CRL_REASON_KEY_COMPROMISE 64 diff --git a/lib/x509/x509_write.c b/lib/x509/x509_write.c index 0fbe906c19..d7229b48ea 100644 --- a/lib/x509/x509_write.c +++ b/lib/x509/x509_write.c @@ -41,11 +41,11 @@ #include <libtasn1.h> #include <gnutls_ui.h> -static void disable_optional_stuff(gnutls_x509_crt cert); +static void disable_optional_stuff(gnutls_x509_crt_t cert); /** * gnutls_x509_crt_set_dn_by_oid - This function will set the Certificate request subject's distinguished name - * @crt: should contain a gnutls_x509_crt structure + * @crt: should contain a gnutls_x509_crt_t structure * @oid: holds an Object Identifier in a null terminated string * @raw_flag: must be 0, or 1 if the data are DER encoded * @name: a pointer to the name @@ -63,7 +63,7 @@ static void disable_optional_stuff(gnutls_x509_crt cert); * Returns 0 on success. * **/ -int gnutls_x509_crt_set_dn_by_oid(gnutls_x509_crt crt, const char *oid, +int gnutls_x509_crt_set_dn_by_oid(gnutls_x509_crt_t crt, const char *oid, unsigned int raw_flag, const void *name, unsigned int sizeof_name) { @@ -77,7 +77,7 @@ int gnutls_x509_crt_set_dn_by_oid(gnutls_x509_crt crt, const char *oid, /** * gnutls_x509_crt_set_issuer_dn_by_oid - This function will set the Certificate request issuer's distinguished name - * @crt: should contain a gnutls_x509_crt structure + * @crt: should contain a gnutls_x509_crt_t structure * @oid: holds an Object Identifier in a null terminated string * @raw_flag: must be 0, or 1 if the data are DER encoded * @name: a pointer to the name @@ -98,7 +98,7 @@ int gnutls_x509_crt_set_dn_by_oid(gnutls_x509_crt crt, const char *oid, * Returns 0 on success. * **/ -int gnutls_x509_crt_set_issuer_dn_by_oid(gnutls_x509_crt crt, +int gnutls_x509_crt_set_issuer_dn_by_oid(gnutls_x509_crt_t crt, const char *oid, unsigned int raw_flag, const void *name, @@ -114,7 +114,7 @@ int gnutls_x509_crt_set_issuer_dn_by_oid(gnutls_x509_crt crt, /** * gnutls_x509_crt_set_version - This function will set the Certificate request version - * @crt: should contain a gnutls_x509_crt structure + * @crt: should contain a gnutls_x509_crt_t structure * @version: holds the version number. For X.509v1 certificates must be 1. * * This function will set the version of the certificate. This @@ -124,7 +124,7 @@ int gnutls_x509_crt_set_issuer_dn_by_oid(gnutls_x509_crt crt, * Returns 0 on success. * **/ -int gnutls_x509_crt_set_version(gnutls_x509_crt crt, unsigned int version) +int gnutls_x509_crt_set_version(gnutls_x509_crt_t crt, unsigned int version) { int result; unsigned char null = version; @@ -149,7 +149,7 @@ int gnutls_x509_crt_set_version(gnutls_x509_crt crt, unsigned int version) /** * gnutls_x509_crt_set_key - This function will associate the Certificate with a key - * @crt: should contain a gnutls_x509_crt structure + * @crt: should contain a gnutls_x509_crt_t structure * @key: holds a private key * * This function will set the public parameters from the given private key to the @@ -158,7 +158,7 @@ int gnutls_x509_crt_set_version(gnutls_x509_crt crt, unsigned int version) * Returns 0 on success. * **/ -int gnutls_x509_crt_set_key(gnutls_x509_crt crt, gnutls_x509_privkey key) +int gnutls_x509_crt_set_key(gnutls_x509_crt_t crt, gnutls_x509_privkey_t key) { int result; @@ -183,7 +183,7 @@ int gnutls_x509_crt_set_key(gnutls_x509_crt crt, gnutls_x509_privkey key) /** * gnutls_x509_crt_set_crq - This function will associate the Certificate with a request - * @crt: should contain a gnutls_x509_crt structure + * @crt: should contain a gnutls_x509_crt_t structure * @crq: holds a certificate request * * This function will set the name and public parameters from the given certificate request to the @@ -192,7 +192,7 @@ int gnutls_x509_crt_set_key(gnutls_x509_crt crt, gnutls_x509_privkey key) * Returns 0 on success. * **/ -int gnutls_x509_crt_set_crq(gnutls_x509_crt crt, gnutls_x509_crq crq) +int gnutls_x509_crt_set_crq(gnutls_x509_crt_t crt, gnutls_x509_crq_t crq) { int result; int pk_algorithm; @@ -228,7 +228,7 @@ int gnutls_x509_crt_set_crq(gnutls_x509_crt crt, gnutls_x509_crq crq) /** * gnutls_x509_crt_set_ca_status - This function will set the basicConstraints extension - * @crt: should contain a gnutls_x509_crt structure + * @crt: should contain a gnutls_x509_crt_t structure * @ca: true(1) or false(0). Depending on the Certificate authority status. * * This function will set the basicConstraints certificate extension. @@ -236,10 +236,10 @@ int gnutls_x509_crt_set_crq(gnutls_x509_crt crt, gnutls_x509_crq crq) * Returns 0 on success. * **/ -int gnutls_x509_crt_set_ca_status(gnutls_x509_crt crt, unsigned int ca) +int gnutls_x509_crt_set_ca_status(gnutls_x509_crt_t crt, unsigned int ca) { int result; - gnutls_datum der_data; + gnutls_datum_t der_data; if (crt == NULL) { gnutls_assert(); @@ -271,7 +271,7 @@ int gnutls_x509_crt_set_ca_status(gnutls_x509_crt crt, unsigned int ca) /** * gnutls_x509_crt_set_key_usage - This function will set the keyUsage extension - * @crt: should contain a gnutls_x509_crt structure + * @crt: should contain a gnutls_x509_crt_t structure * @usage: an ORed sequence of the GNUTLS_KEY_* elements. * * This function will set the keyUsage certificate extension. @@ -279,10 +279,10 @@ int gnutls_x509_crt_set_ca_status(gnutls_x509_crt crt, unsigned int ca) * Returns 0 on success. * **/ -int gnutls_x509_crt_set_key_usage(gnutls_x509_crt crt, unsigned int usage) +int gnutls_x509_crt_set_key_usage(gnutls_x509_crt_t crt, unsigned int usage) { int result; - gnutls_datum der_data; + gnutls_datum_t der_data; if (crt == NULL) { gnutls_assert(); @@ -314,8 +314,8 @@ int gnutls_x509_crt_set_key_usage(gnutls_x509_crt crt, unsigned int usage) /** * gnutls_x509_crt_set_subject_alt_name - This function will set the subject Alternative Name - * @crt: should contain a gnutls_x509_crt structure - * @type: is one of the gnutls_x509_subject_alt_name enumerations + * @crt: should contain a gnutls_x509_crt_t structure + * @type: is one of the gnutls_x509_subject_alt_name_t enumerations * @data_string: The data to be set * * This function will set the subject alternative name certificate extension. @@ -323,14 +323,14 @@ int gnutls_x509_crt_set_key_usage(gnutls_x509_crt crt, unsigned int usage) * Returns 0 on success. * **/ -int gnutls_x509_crt_set_subject_alternative_name(gnutls_x509_crt crt, - gnutls_x509_subject_alt_name +int gnutls_x509_crt_set_subject_alternative_name(gnutls_x509_crt_t crt, + gnutls_x509_subject_alt_name_t type, const char *data_string) { int result; - gnutls_datum der_data; - gnutls_datum dnsname; + gnutls_datum_t der_data; + gnutls_datum_t dnsname; unsigned int critical; if (crt == NULL) { @@ -378,7 +378,7 @@ int gnutls_x509_crt_set_subject_alternative_name(gnutls_x509_crt crt, /** * gnutls_x509_crt_sign - This function will sign a Certificate request with a key - * @crt: should contain a gnutls_x509_crt structure + * @crt: should contain a gnutls_x509_crt_t structure * @issuer: is the certificate of the certificate issuer * @issuer_key: holds the issuer's private key * @@ -391,8 +391,8 @@ int gnutls_x509_crt_set_subject_alternative_name(gnutls_x509_crt crt, * Returns 0 on success. * **/ -int gnutls_x509_crt_sign(gnutls_x509_crt crt, gnutls_x509_crt issuer, - gnutls_x509_privkey issuer_key) +int gnutls_x509_crt_sign(gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer, + gnutls_x509_privkey_t issuer_key) { int result; @@ -417,7 +417,7 @@ int gnutls_x509_crt_sign(gnutls_x509_crt crt, gnutls_x509_crt issuer, /** * gnutls_x509_crt_set_activation_time - This function will set the Certificate's activation time - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @act_time: The actual time * * This function will set the time this Certificate was or will be activated. @@ -425,7 +425,7 @@ int gnutls_x509_crt_sign(gnutls_x509_crt crt, gnutls_x509_crt issuer, * Returns 0 on success, or a negative value in case of an error. * **/ -int gnutls_x509_crt_set_activation_time(gnutls_x509_crt cert, +int gnutls_x509_crt_set_activation_time(gnutls_x509_crt_t cert, time_t act_time) { if (cert == NULL) { @@ -440,7 +440,7 @@ int gnutls_x509_crt_set_activation_time(gnutls_x509_crt cert, /** * gnutls_x509_crt_set_expiration_time - This function will set the Certificate's expiration time - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @exp_time: The actual time * * This function will set the time this Certificate will expire. @@ -448,7 +448,7 @@ int gnutls_x509_crt_set_activation_time(gnutls_x509_crt cert, * Returns 0 on success, or a negative value in case of an error. * **/ -int gnutls_x509_crt_set_expiration_time(gnutls_x509_crt cert, +int gnutls_x509_crt_set_expiration_time(gnutls_x509_crt_t cert, time_t exp_time) { if (cert == NULL) { @@ -462,7 +462,7 @@ int gnutls_x509_crt_set_expiration_time(gnutls_x509_crt cert, /** * gnutls_x509_crt_set_serial - This function will set the certificate's serial number - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @serial: The serial number * @serial_size: Holds the size of the serial field. * @@ -474,7 +474,7 @@ int gnutls_x509_crt_set_expiration_time(gnutls_x509_crt cert, * Returns 0 on success, or a negative value in case of an error. * **/ -int gnutls_x509_crt_set_serial(gnutls_x509_crt cert, const void *serial, +int gnutls_x509_crt_set_serial(gnutls_x509_crt_t cert, const void *serial, size_t serial_size) { int ret; @@ -499,7 +499,7 @@ int gnutls_x509_crt_set_serial(gnutls_x509_crt cert, const void *serial, /* If OPTIONAL fields have not been initialized then * disable them. */ -static void disable_optional_stuff(gnutls_x509_crt cert) +static void disable_optional_stuff(gnutls_x509_crt_t cert) { asn1_write_value(cert->cert, "tbsCertificate.issuerUniqueID", NULL, 0); @@ -517,8 +517,8 @@ static void disable_optional_stuff(gnutls_x509_crt cert) /** * gnutls_x509_crt_set_crl_dist_points - This function will set the CRL dist points - * @crt: should contain a gnutls_x509_crt structure - * @type: is one of the gnutls_x509_subject_alt_name enumerations + * @crt: should contain a gnutls_x509_crt_t structure + * @type: is one of the gnutls_x509_subject_alt_name_t enumerations * @data_string: The data to be set * @reason_flags: revocation reasons * @@ -527,14 +527,14 @@ static void disable_optional_stuff(gnutls_x509_crt cert) * Returns 0 on success. * **/ -int gnutls_x509_crt_set_crl_dist_points(gnutls_x509_crt crt, - gnutls_x509_subject_alt_name type, +int gnutls_x509_crt_set_crl_dist_points(gnutls_x509_crt_t crt, + gnutls_x509_subject_alt_name_t type, const void *data_string, unsigned int reason_flags) { int result; - gnutls_datum der_data; - gnutls_datum oldname; + gnutls_datum_t der_data; + gnutls_datum_t oldname; unsigned int critical; if (crt == NULL) { @@ -582,7 +582,7 @@ int gnutls_x509_crt_set_crl_dist_points(gnutls_x509_crt crt, /** * gnutls_x509_crt_cpy_crl_dist_points - This function will copy the CRL dist points - * @dst: should contain a gnutls_x509_crt structure + * @dst: should contain a gnutls_x509_crt_t structure * @src: the certificate where the dist points will be copied from * * This function will copy the CRL distribution points certificate @@ -592,11 +592,11 @@ int gnutls_x509_crt_set_crl_dist_points(gnutls_x509_crt crt, * Returns 0 on success. * **/ -int gnutls_x509_crt_cpy_crl_dist_points(gnutls_x509_crt dst, - gnutls_x509_crt src) +int gnutls_x509_crt_cpy_crl_dist_points(gnutls_x509_crt_t dst, + gnutls_x509_crt_t src) { int result; - gnutls_datum der_data; + gnutls_datum_t der_data; unsigned int critical; if (dst == NULL || src == NULL) { @@ -631,7 +631,7 @@ int gnutls_x509_crt_cpy_crl_dist_points(gnutls_x509_crt dst, /** * gnutls_x509_crt_set_subject_key_id - This function will set the certificate's subject key id - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @id: The key ID * @id_size: Holds the size of the serial field. * @@ -640,11 +640,11 @@ int gnutls_x509_crt_cpy_crl_dist_points(gnutls_x509_crt dst, * Returns 0 on success, or a negative value in case of an error. * **/ -int gnutls_x509_crt_set_subject_key_id(gnutls_x509_crt cert, +int gnutls_x509_crt_set_subject_key_id(gnutls_x509_crt_t cert, const void *id, size_t id_size) { int result; - gnutls_datum old_id, der_data; + gnutls_datum_t old_id, der_data; unsigned int critical; if (cert == NULL) { @@ -690,7 +690,7 @@ int gnutls_x509_crt_set_subject_key_id(gnutls_x509_crt cert, /** * gnutls_x509_crt_set_authority_key_id - This function will set the certificate authority's key id - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @id: The key ID * @id_size: Holds the size of the serial field. * @@ -700,11 +700,11 @@ int gnutls_x509_crt_set_subject_key_id(gnutls_x509_crt cert, * Returns 0 on success, or a negative value in case of an error. * **/ -int gnutls_x509_crt_set_authority_key_id(gnutls_x509_crt cert, +int gnutls_x509_crt_set_authority_key_id(gnutls_x509_crt_t cert, const void *id, size_t id_size) { int result; - gnutls_datum old_id, der_data; + gnutls_datum_t old_id, der_data; unsigned int critical; if (cert == NULL) { @@ -750,7 +750,7 @@ int gnutls_x509_crt_set_authority_key_id(gnutls_x509_crt cert, /** * gnutls_x509_crt_set_key_purpose_oid - This function sets the Certificate's key purpose OIDs - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @oid: a pointer to a null terminated string that holds the OID * @critical: Whether this extension will be critical or not * @@ -763,12 +763,12 @@ int gnutls_x509_crt_set_authority_key_id(gnutls_x509_crt cert, * On success 0 is returned. * **/ -int gnutls_x509_crt_set_key_purpose_oid(gnutls_x509_crt cert, +int gnutls_x509_crt_set_key_purpose_oid(gnutls_x509_crt_t cert, const void *oid, unsigned int critical) { int result; - gnutls_datum old_id, der_data; + gnutls_datum_t old_id, der_data; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; if (cert == NULL) { diff --git a/lib/x509/xml.c b/lib/x509/xml.c index e5b1350f34..874c91825c 100644 --- a/lib/x509/xml.c +++ b/lib/x509/xml.c @@ -201,7 +201,7 @@ static int normalize_name(ASN1_TYPE p, char *output, int output_size) static int _gnutls_asn1_get_structure_xml(ASN1_TYPE structure, - gnutls_datum * res, int detail) + gnutls_datum_t * res, int detail) { node_asn *p, *root; int k, indent = 0, len, len2, len3; @@ -586,7 +586,7 @@ _gnutls_asn1_get_structure_xml(ASN1_TYPE structure, /** * gnutls_x509_crt_to_xml - This function parses an RDN sequence - * @cert: should contain a gnutls_x509_crt structure + * @cert: should contain a gnutls_x509_crt_t structure * @res: The datum that will hold the result * @detail: The detail level (must be GNUTLS_XML_SHOW_ALL or GNUTLS_XML_NORMAL) * @@ -595,7 +595,7 @@ _gnutls_asn1_get_structure_xml(ASN1_TYPE structure, * Returns a negative error code in case of an error. * **/ -int gnutls_x509_crt_to_xml(gnutls_x509_crt cert, gnutls_datum * res, +int gnutls_x509_crt_to_xml(gnutls_x509_crt_t cert, gnutls_datum_t * res, int detail) { int result; diff --git a/lib/x509_b64.c b/lib/x509_b64.c index dcdb9dbade..61b8fdfe51 100644 --- a/lib/x509_b64.c +++ b/lib/x509_b64.c @@ -284,7 +284,7 @@ int _gnutls_fbase64_encode(const char *msg, const uint8 * data, * the terminating null. * **/ -int gnutls_pem_base64_encode(const char *msg, const gnutls_datum * data, +int gnutls_pem_base64_encode(const char *msg, const gnutls_datum_t * data, char *result, size_t * result_size) { opaque *ret; @@ -321,8 +321,8 @@ int gnutls_pem_base64_encode(const char *msg, const gnutls_datum * data, * **/ int gnutls_pem_base64_encode_alloc(const char *msg, - const gnutls_datum * data, - gnutls_datum * result) + const gnutls_datum_t * data, + gnutls_datum_t * result) { opaque *ret; int size; @@ -499,7 +499,7 @@ int _gnutls_fbase64_decode(const char *header, const opaque * data, * or 0 on success. **/ int gnutls_pem_base64_decode(const char *header, - const gnutls_datum * b64_data, + const gnutls_datum_t * b64_data, unsigned char *result, size_t * result_size) { opaque *ret; @@ -540,8 +540,8 @@ int gnutls_pem_base64_decode(const char *header, * **/ int gnutls_pem_base64_decode_alloc(const char *header, - const gnutls_datum * b64_data, - gnutls_datum * result) + const gnutls_datum_t * b64_data, + gnutls_datum_t * result) { opaque *ret; int size; |