diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-06-05 18:10:59 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-06-05 18:10:59 +0000 |
commit | 388797851a48fc6fbcee50a00eb4c78be72e40f9 (patch) | |
tree | 607c28d8ea9b23a940c89d3d1711b760dea28181 | |
parent | 511efe55dd36eb5908f8019f927a7c31dde3c880 (diff) | |
download | gnutls-388797851a48fc6fbcee50a00eb4c78be72e40f9.tar.gz |
several internal types fix.
35 files changed, 197 insertions, 198 deletions
diff --git a/lib/auth_anon.c b/lib/auth_anon.c index c4bd85d731..cf0882edf9 100644 --- a/lib/auth_anon.c +++ b/lib/auth_anon.c @@ -60,8 +60,8 @@ const MOD_AUTH_STRUCT anon_auth_struct = { }; static int gen_anon_server_kx( gnutls_session session, opaque** data) { - GNUTLS_MPI g, p; - const GNUTLS_MPI *mpis; + mpi_t g, p; + const mpi_t *mpis; int ret; gnutls_dh_params dh_params; const gnutls_anon_server_credentials cred; @@ -82,7 +82,7 @@ static int gen_anon_server_kx( gnutls_session session, opaque** data) { p = mpis[0]; g = mpis[1]; - if ( (ret=_gnutls_auth_info_set( session, GNUTLS_CRD_ANON, sizeof( ANON_SERVER_AUTH_INFO_INT), 1)) < 0) + if ( (ret=_gnutls_auth_info_set( session, GNUTLS_CRD_ANON, sizeof( anon_server_auth_info_st), 1)) < 0) { gnutls_assert(); return ret; @@ -104,9 +104,9 @@ static int proc_anon_client_kx( gnutls_session session, opaque* data, size_t _da const gnutls_anon_server_credentials cred; int bits; int ret; -GNUTLS_MPI p, g; +mpi_t p, g; gnutls_dh_params dh_params; -const GNUTLS_MPI *mpis; +const mpi_t *mpis; bits = _gnutls_dh_get_allowed_prime_bits( session); @@ -138,7 +138,7 @@ int proc_anon_server_kx( gnutls_session session, opaque* data, size_t _data_size int ret; /* set auth_info */ - if ( (ret=_gnutls_auth_info_set( session, GNUTLS_CRD_ANON, sizeof( ANON_CLIENT_AUTH_INFO_INT), 1)) < 0) { + if ( (ret=_gnutls_auth_info_set( session, GNUTLS_CRD_ANON, sizeof( anon_client_auth_info_st), 1)) < 0) { gnutls_assert(); return ret; } diff --git a/lib/auth_anon.h b/lib/auth_anon.h index 22ca1c4a33..72eb87ca49 100644 --- a/lib/auth_anon.h +++ b/lib/auth_anon.h @@ -8,19 +8,19 @@ typedef struct { * parameters. */ gnutls_params_function * params_func; -} ANON_SERVER_CREDENTIALS_INT; -#define gnutls_anon_server_credentials ANON_SERVER_CREDENTIALS_INT* +} anon_server_credentials_st; +#define gnutls_anon_server_credentials anon_server_credentials_st* #define gnutls_anon_client_credentials void* -typedef struct ANON_CLIENT_AUTH_INFO_INT { +typedef struct anon_client_auth_info_st { dh_info_st dh; -} *ANON_CLIENT_AUTH_INFO; +} *anon_client_auth_info_t; -typedef ANON_CLIENT_AUTH_INFO ANON_SERVER_AUTH_INFO; +typedef anon_client_auth_info_t anon_server_auth_info_t; -typedef struct ANON_CLIENT_AUTH_INFO_INT ANON_CLIENT_AUTH_INFO_INT; -typedef ANON_CLIENT_AUTH_INFO_INT ANON_SERVER_AUTH_INFO_INT; +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); diff --git a/lib/auth_cert.c b/lib/auth_cert.c index ca22a3cb92..1415e0bec6 100644 --- a/lib/auth_cert.c +++ b/lib/auth_cert.c @@ -52,13 +52,13 @@ static gnutls_privkey *alloc_and_load_pgp_key(const gnutls_openpgp_privkey key); /* Copies data from a internal certificate struct (gnutls_cert) to - * exported certificate struct (CERTIFICATE_AUTH_INFO) + * exported certificate struct (cert_auth_info_t) */ static -int _gnutls_copy_certificate_auth_info(CERTIFICATE_AUTH_INFO info, +int _gnutls_copy_certificate_auth_info(cert_auth_info_t info, gnutls_cert * cert, int ncerts) { - /* Copy peer's information to AUTH_INFO + /* Copy peer's information to auth_info_t */ int ret, i, j; @@ -772,7 +772,7 @@ int _gnutls_proc_x509_server_certificate(gnutls_session session, { int size, len, ret; opaque *p = data; - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; const gnutls_certificate_credentials cred; ssize_t dsize = data_size; int i, j, x; @@ -790,7 +790,7 @@ int _gnutls_proc_x509_server_certificate(gnutls_session session, if ((ret = _gnutls_auth_info_set(session, GNUTLS_CRD_CERTIFICATE, - sizeof(CERTIFICATE_AUTH_INFO_INT), 1)) < + sizeof(cert_auth_info_st), 1)) < 0) { gnutls_assert(); return ret; @@ -904,7 +904,7 @@ int _gnutls_proc_openpgp_server_certificate(gnutls_session session, { int size, ret, len; opaque *p = data; - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; const gnutls_certificate_credentials cred; ssize_t dsize = data_size; int i, x; @@ -921,7 +921,7 @@ int _gnutls_proc_openpgp_server_certificate(gnutls_session session, if ((ret = _gnutls_auth_info_set(session, GNUTLS_CRD_CERTIFICATE, - sizeof(CERTIFICATE_AUTH_INFO_INT), 1)) < + sizeof(cert_auth_info_st), 1)) < 0) { gnutls_assert(); return ret; @@ -1106,7 +1106,7 @@ int _gnutls_proc_cert_cert_req(gnutls_session session, opaque * data, int size, ret; opaque *p; const gnutls_certificate_credentials cred; - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; ssize_t dsize; int i, j; gnutls_pk_algorithm pk_algos[MAX_SIGN_ALGOS]; @@ -1121,7 +1121,7 @@ int _gnutls_proc_cert_cert_req(gnutls_session session, opaque * data, if ((ret = _gnutls_auth_info_set(session, GNUTLS_CRD_CERTIFICATE, - sizeof(CERTIFICATE_AUTH_INFO_INT), 0)) < + sizeof(cert_auth_info_st), 0)) < 0) { gnutls_assert(); return ret; @@ -1237,7 +1237,7 @@ int _gnutls_proc_cert_client_cert_vrfy(gnutls_session session, ssize_t dsize = data_size; opaque *pdata = data; gnutls_datum sig; - CERTIFICATE_AUTH_INFO info = _gnutls_get_auth_info(session); + cert_auth_info_t info = _gnutls_get_auth_info(session); gnutls_cert peer_cert; if (info == NULL || info->ncerts == 0) { diff --git a/lib/auth_cert.h b/lib/auth_cert.h index 85fbd223ce..a5488a9649 100644 --- a/lib/auth_cert.h +++ b/lib/auth_cert.h @@ -92,10 +92,9 @@ typedef struct { gnutls_certificate_client_retrieve_function* client_get_cert_callback; gnutls_certificate_server_retrieve_function* server_get_cert_callback; -} CERTIFICATE_CREDENTIALS_INT; +} certificate_credentials_st; -/* typedef CERTIFICATE_CREDENTIALS_INT * CERTIFICATE_CREDENTIALS; */ -#define gnutls_certificate_credentials CERTIFICATE_CREDENTIALS_INT* +#define gnutls_certificate_credentials certificate_credentials_st* typedef struct rsa_info_st_int { opaque modulus[64]; @@ -104,7 +103,7 @@ typedef struct rsa_info_st_int { size_t exponent_size; } rsa_info_st; -typedef struct CERTIFICATE_AUTH_INFO_INT { +typedef struct cert_auth_info_st { int certificate_requested; /* if the peer requested certificate * this is non zero; */ @@ -115,9 +114,9 @@ typedef struct CERTIFICATE_AUTH_INFO_INT { * peer. */ unsigned int ncerts; /* holds the size of the list above */ -} *CERTIFICATE_AUTH_INFO; +} *cert_auth_info_t; -typedef struct CERTIFICATE_AUTH_INFO_INT CERTIFICATE_AUTH_INFO_INT; +typedef struct cert_auth_info_st cert_auth_info_st; /* AUTH X509 functions */ int _gnutls_gen_cert_server_certificate(gnutls_session, opaque **); diff --git a/lib/auth_dh_common.c b/lib/auth_dh_common.c index d3a6a16721..a4842710f3 100644 --- a/lib/auth_dh_common.c +++ b/lib/auth_dh_common.c @@ -38,7 +38,7 @@ #include <auth_dh_common.h> int _gnutls_proc_dh_common_client_kx(gnutls_session session, opaque * data, - size_t _data_size, GNUTLS_MPI g, GNUTLS_MPI p) + size_t _data_size, mpi_t g, mpi_t p) { uint16 n_Y; size_t _n_Y; @@ -82,7 +82,7 @@ int _gnutls_proc_dh_common_client_kx(gnutls_session session, opaque * data, int _gnutls_gen_dh_common_client_kx(gnutls_session session, opaque ** data) { - GNUTLS_MPI x = NULL, X = NULL; + mpi_t x = NULL, X = NULL; size_t n_X; int ret; @@ -222,9 +222,9 @@ int _gnutls_proc_dh_common_server_kx( gnutls_session session, opaque* data, size } int _gnutls_dh_common_print_server_kx( gnutls_session session, - GNUTLS_MPI g, GNUTLS_MPI p, opaque** data) + mpi_t g, mpi_t p, opaque** data) { - GNUTLS_MPI x, X; + mpi_t x, X; size_t n_X, n_g, n_p; int ret; uint8 *data_p; diff --git a/lib/auth_dh_common.h b/lib/auth_dh_common.h index 964250ffc2..cc23a987df 100644 --- a/lib/auth_dh_common.h +++ b/lib/auth_dh_common.h @@ -14,9 +14,9 @@ typedef struct dh_info_st_int { int _gnutls_gen_dh_common_client_kx(gnutls_session, opaque **); int _gnutls_proc_dh_common_client_kx(gnutls_session session, opaque * data, - size_t _data_size, GNUTLS_MPI p, GNUTLS_MPI g); -int _gnutls_dh_common_print_server_kx( gnutls_session, GNUTLS_MPI g, - GNUTLS_MPI p, opaque** data); + size_t _data_size, mpi_t p, mpi_t g); +int _gnutls_dh_common_print_server_kx( gnutls_session, mpi_t g, + mpi_t p, opaque** data); int _gnutls_proc_dh_common_server_kx( gnutls_session session, opaque* data, size_t _data_size); diff --git a/lib/auth_dhe.c b/lib/auth_dhe.c index 8ffd5b2846..2dda026a84 100644 --- a/lib/auth_dhe.c +++ b/lib/auth_dhe.c @@ -79,8 +79,8 @@ const MOD_AUTH_STRUCT dhe_dss_auth_struct = { static int gen_dhe_server_kx(gnutls_session session, opaque ** data) { - GNUTLS_MPI g, p; - const GNUTLS_MPI *mpis; + mpi_t g, p; + const mpi_t *mpis; int ret = 0, data_size; int bits; gnutls_cert *apr_cert_list; @@ -118,7 +118,7 @@ static int gen_dhe_server_kx(gnutls_session session, opaque ** data) g = mpis[1]; if ( (ret=_gnutls_auth_info_set( session, GNUTLS_CRD_CERTIFICATE, - sizeof( CERTIFICATE_AUTH_INFO_INT), 0)) < 0) + sizeof( cert_auth_info_st), 0)) < 0) { gnutls_assert(); return ret; @@ -173,7 +173,7 @@ static int proc_dhe_server_kx(gnutls_session session, opaque * data, int sigsize; gnutls_datum vparams, signature; int ret; - CERTIFICATE_AUTH_INFO info = _gnutls_get_auth_info( session); + cert_auth_info_t info = _gnutls_get_auth_info( session); ssize_t data_size = _data_size; gnutls_cert peer_cert; @@ -229,8 +229,8 @@ static int proc_dhe_client_kx(gnutls_session session, opaque * data, { const gnutls_certificate_credentials cred; int ret; -GNUTLS_MPI p, g; -const GNUTLS_MPI *mpis; +mpi_t p, g; +const mpi_t *mpis; gnutls_dh_params dh_params; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); diff --git a/lib/auth_rsa.c b/lib/auth_rsa.c index 8bb0a3f541..67b9366d15 100644 --- a/lib/auth_rsa.c +++ b/lib/auth_rsa.c @@ -64,10 +64,10 @@ const MOD_AUTH_STRUCT rsa_auth_struct = { /* This function reads the RSA parameters from peer's certificate; */ int _gnutls_get_public_rsa_params(gnutls_session session, - GNUTLS_MPI params[MAX_PUBLIC_PARAMS_SIZE], int* params_len) + mpi_t params[MAX_PUBLIC_PARAMS_SIZE], int* params_len) { int ret; -CERTIFICATE_AUTH_INFO info; +cert_auth_info_t info; gnutls_cert peer_cert; int i; @@ -133,7 +133,7 @@ int i; /* This function reads the RSA parameters from the private key */ -int _gnutls_get_private_rsa_params(gnutls_session session, GNUTLS_MPI **params, int* params_size) +int _gnutls_get_private_rsa_params(gnutls_session session, mpi_t **params, int* params_size) { int bits; const gnutls_certificate_credentials cred; @@ -195,7 +195,7 @@ int _gnutls_proc_rsa_client_kx(gnutls_session session, opaque * data, size_t _da gnutls_datum plaintext; gnutls_datum ciphertext; int ret, dsize; - GNUTLS_MPI *params; + mpi_t *params; int params_len; int randomize_key = 0; ssize_t data_size = _data_size; @@ -280,9 +280,9 @@ int _gnutls_proc_rsa_client_kx(gnutls_session session, opaque * data, size_t _da */ int _gnutls_gen_rsa_client_kx(gnutls_session session, opaque ** data) { - CERTIFICATE_AUTH_INFO auth = session->key->auth_info; + cert_auth_info_t auth = session->key->auth_info; gnutls_datum sdata; /* data to send */ - GNUTLS_MPI params[MAX_PUBLIC_PARAMS_SIZE]; + mpi_t params[MAX_PUBLIC_PARAMS_SIZE]; int params_len = MAX_PUBLIC_PARAMS_SIZE; int ret, i; gnutls_protocol_version ver; diff --git a/lib/auth_rsa_export.c b/lib/auth_rsa_export.c index 3ed85fdcf2..2842d4826b 100644 --- a/lib/auth_rsa_export.c +++ b/lib/auth_rsa_export.c @@ -68,7 +68,7 @@ const MOD_AUTH_STRUCT rsa_export_auth_struct = { static int gen_rsa_export_server_kx(gnutls_session session, opaque ** data) { gnutls_rsa_params rsa_params; - const GNUTLS_MPI *rsa_mpis; + const mpi_t *rsa_mpis; size_t n_e, n_m; uint8 *data_e, *data_m; int ret = 0, data_size; @@ -76,7 +76,7 @@ static int gen_rsa_export_server_kx(gnutls_session session, opaque ** data) gnutls_privkey* apr_pkey; int apr_cert_list_length; gnutls_datum signature, ddata; - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; const gnutls_certificate_credentials cred; cred = _gnutls_get_cred(session->key, GNUTLS_CRD_CERTIFICATE, NULL); @@ -110,7 +110,7 @@ static int gen_rsa_export_server_kx(gnutls_session session, opaque ** data) } if ( (ret=_gnutls_auth_info_set( session, GNUTLS_CRD_CERTIFICATE, - sizeof( CERTIFICATE_AUTH_INFO_INT), 0)) < 0) { + sizeof( cert_auth_info_st), 0)) < 0) { gnutls_assert(); return ret; } @@ -179,7 +179,7 @@ int _gnutls_peers_cert_less_512( gnutls_session session) { gnutls_cert peer_cert; int ret; -CERTIFICATE_AUTH_INFO info = _gnutls_get_auth_info( session); +cert_auth_info_t info = _gnutls_get_auth_info( session); if (info == NULL || info->ncerts==0) { gnutls_assert(); @@ -222,7 +222,7 @@ static int proc_rsa_export_server_kx(gnutls_session session, opaque * data, gnutls_datum vparams, signature; int ret; ssize_t data_size = _data_size; - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; gnutls_cert peer_cert; info = _gnutls_get_auth_info( session); diff --git a/lib/debug.c b/lib/debug.c index d944fe6b3b..5b4838a0e2 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -103,7 +103,7 @@ const char* _gnutls_handshake2str( HandshakeType handshake) } } -void _gnutls_dump_mpi(const char* prefix, GNUTLS_MPI a) +void _gnutls_dump_mpi(const char* prefix, mpi_t a) { opaque buf[1024]; size_t n = sizeof buf; diff --git a/lib/debug.h b/lib/debug.h index dca55b578f..3e9668b04e 100644 --- a/lib/debug.h +++ b/lib/debug.h @@ -23,4 +23,4 @@ void _gnutls_print_state(gnutls_session session); #endif const char* _gnutls_packet2str( ContentType packet); const char* _gnutls_handshake2str( HandshakeType handshake); -void _gnutls_dump_mpi(const char* prefix, GNUTLS_MPI a); +void _gnutls_dump_mpi(const char* prefix, mpi_t a); diff --git a/lib/gnutls_anon_cred.c b/lib/gnutls_anon_cred.c index 835c23ae18..50da169d3d 100644 --- a/lib/gnutls_anon_cred.c +++ b/lib/gnutls_anon_cred.c @@ -84,7 +84,7 @@ int ret; **/ int gnutls_anon_allocate_server_credentials( gnutls_anon_server_credentials *sc) { - *sc = gnutls_calloc( 1, sizeof(ANON_SERVER_CREDENTIALS_INT)); + *sc = gnutls_calloc( 1, sizeof(anon_server_credentials_st)); return 0; } @@ -101,7 +101,7 @@ void gnutls_anon_free_client_credentials( gnutls_anon_client_credentials sc) { } /** - * gnutls_allocate_anon_client_credentials - Used to allocate an GNUTLS_ANON_CLIENT CREDENTIALS structure + * gnutls_allocate_anon_client_credentials - Used to allocate a credentials structure * @sc: is a pointer to an &gnutls_anon_client_credentials structure. * * This structure is complex enough to manipulate directly thus diff --git a/lib/gnutls_auth.c b/lib/gnutls_auth.c index ed2715eb1a..8257bae6e6 100644 --- a/lib/gnutls_auth.c +++ b/lib/gnutls_auth.c @@ -43,7 +43,7 @@ **/ void gnutls_credentials_clear( gnutls_session session) { if (session->key && session->key->cred) { /* beginning of the list */ - AUTH_CRED * ccred, *ncred; + auth_cred_t * ccred, *ncred; ccred = session->key->cred; while(ccred!=NULL) { ncred = ccred->next; @@ -84,12 +84,12 @@ void gnutls_credentials_clear( gnutls_session session) { * **/ int gnutls_credentials_set( gnutls_session session, gnutls_credentials_type type, void* cred) { - AUTH_CRED * ccred=NULL, *pcred=NULL; + auth_cred_t * ccred=NULL, *pcred=NULL; int exists=0; if (session->key->cred==NULL) { /* beginning of the list */ - session->key->cred = gnutls_malloc(sizeof(AUTH_CRED)); + session->key->cred = gnutls_malloc(sizeof(auth_cred_t)); if (session->key->cred == NULL) return GNUTLS_E_MEMORY_ERROR; /* copy credentials locally */ @@ -111,7 +111,7 @@ int gnutls_credentials_set( gnutls_session session, gnutls_credentials_type type */ if (exists==0) { /* new entry */ - pcred->next = gnutls_malloc(sizeof(AUTH_CRED)); + pcred->next = gnutls_malloc(sizeof(auth_cred_t)); if (pcred->next == NULL) return GNUTLS_E_MEMORY_ERROR; ccred = pcred->next; @@ -200,7 +200,7 @@ int server = session->security_parameters.entity==GNUTLS_SERVER?1:0; const void *_gnutls_get_cred( GNUTLS_KEY key, gnutls_credentials_type type, int *err) { const void *retval = NULL; int _err = -1; - AUTH_CRED * ccred; + auth_cred_t * ccred; if (key == NULL) goto out; @@ -230,9 +230,9 @@ const void *_gnutls_get_cred( GNUTLS_KEY key, gnutls_credentials_type type, int * is data obtained by the handshake protocol, the key exchange algorithm, * and the TLS extensions messages. * - * In case of GNUTLS_CRD_ANON returns a pointer to &ANON_(SERVER/CLIENT)_AUTH_INFO; - * In case of GNUTLS_CRD_CERTIFICATE returns a pointer to structure &CERTIFICATE_(SERVER/CLIENT)_AUTH_INFO; - * In case of GNUTLS_CRD_SRP returns a pointer to structure &SRP_(SERVER/CLIENT)_AUTH_INFO; + * In case of GNUTLS_CRD_ANON returns a type of &anon_(server/client)_auth_info_t; + * 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) { return session->key->auth_info; @@ -259,7 +259,7 @@ void _gnutls_free_auth_info( gnutls_session session) { break; case GNUTLS_CRD_CERTIFICATE: { unsigned int i; - CERTIFICATE_AUTH_INFO info = + cert_auth_info_t info = _gnutls_get_auth_info(session); if (info==NULL) break; @@ -337,7 +337,7 @@ int _gnutls_auth_info_set( gnutls_session session, return 0; } -/* this function will copy an GNUTLS_MPI key to +/* this function will copy an mpi_t key to * opaque data. */ int _gnutls_generate_session_key(GNUTLS_KEY key) { diff --git a/lib/gnutls_cert.c b/lib/gnutls_cert.c index 3919befb56..ead9d09363 100644 --- a/lib/gnutls_cert.c +++ b/lib/gnutls_cert.c @@ -223,7 +223,7 @@ void gnutls_certificate_free_credentials(gnutls_certificate_credentials sc) **/ int gnutls_certificate_allocate_credentials(gnutls_certificate_credentials * res) { - *res = gnutls_calloc(1, sizeof(CERTIFICATE_CREDENTIALS_INT)); + *res = gnutls_calloc(1, sizeof(certificate_credentials_st)); if (*res == NULL) return GNUTLS_E_MEMORY_ERROR; @@ -382,7 +382,7 @@ OPENPGP_VERIFY_KEY_FUNC _E_gnutls_openpgp_verify_key = NULL; -*/ int _gnutls_openpgp_cert_verify_peers(gnutls_session session) { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; const gnutls_certificate_credentials cred; int verify; int peer_certificate_list_size; @@ -446,7 +446,7 @@ int _gnutls_openpgp_cert_verify_peers(gnutls_session session) **/ int gnutls_certificate_verify_peers(gnutls_session session) { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; CHECK_AUTH(GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); @@ -479,7 +479,7 @@ int gnutls_certificate_verify_peers(gnutls_session session) **/ time_t gnutls_certificate_expiration_time_peers(gnutls_session session) { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; CHECK_AUTH(GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); @@ -519,7 +519,7 @@ time_t gnutls_certificate_expiration_time_peers(gnutls_session session) **/ time_t gnutls_certificate_activation_time_peers(gnutls_session session) { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; CHECK_AUTH(GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST); diff --git a/lib/gnutls_cert.h b/lib/gnutls_cert.h index 803eca5033..66c66a829f 100644 --- a/lib/gnutls_cert.h +++ b/lib/gnutls_cert.h @@ -26,7 +26,7 @@ #define KEY_DECIPHER_ONLY 32768 typedef struct gnutls_cert { - GNUTLS_MPI params[MAX_PUBLIC_PARAMS_SIZE]; /* the size of params depends on the public + mpi_t params[MAX_PUBLIC_PARAMS_SIZE]; /* the size of params depends on the public * key algorithm * RSA: [0] is modulus * [1] is public exponent @@ -52,7 +52,7 @@ typedef struct gnutls_cert { } gnutls_cert; typedef struct gnutls_privkey_int { - GNUTLS_MPI params[MAX_PRIV_PARAMS_SIZE];/* the size of params depends on the public + mpi_t params[MAX_PRIV_PARAMS_SIZE];/* the size of params depends on the public * key algorithm */ /* diff --git a/lib/gnutls_dh.c b/lib/gnutls_dh.c index 5d749066b2..1358f0ddda 100644 --- a/lib/gnutls_dh.c +++ b/lib/gnutls_dh.c @@ -45,9 +45,9 @@ /* returns the public value (X), and the secret (ret_x). */ -GNUTLS_MPI gnutls_calc_dh_secret(GNUTLS_MPI * ret_x, GNUTLS_MPI g, GNUTLS_MPI prime) +mpi_t gnutls_calc_dh_secret(mpi_t * ret_x, mpi_t g, mpi_t prime) { - GNUTLS_MPI e, x; + mpi_t e, x; int x_size = _gnutls_mpi_get_nbits(prime) - 1; /* The size of the secret key is less than * prime/2 @@ -92,9 +92,9 @@ GNUTLS_MPI gnutls_calc_dh_secret(GNUTLS_MPI * ret_x, GNUTLS_MPI g, GNUTLS_MPI pr } -GNUTLS_MPI gnutls_calc_dh_key(GNUTLS_MPI f, GNUTLS_MPI x, GNUTLS_MPI prime) +mpi_t gnutls_calc_dh_key(mpi_t f, mpi_t x, mpi_t prime) { - GNUTLS_MPI k; + mpi_t k; int bits; bits = _gnutls_mpi_get_nbits(prime); diff --git a/lib/gnutls_dh.h b/lib/gnutls_dh.h index 3cf53c7881..6b449ec72e 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 GNUTLS_MPI* _gnutls_get_dh_params(gnutls_dh_params); -GNUTLS_MPI gnutls_calc_dh_secret( GNUTLS_MPI *ret_x, GNUTLS_MPI g, GNUTLS_MPI prime ); -GNUTLS_MPI gnutls_calc_dh_key( GNUTLS_MPI f, GNUTLS_MPI x, GNUTLS_MPI prime ); -int _gnutls_dh_generate_prime(GNUTLS_MPI *ret_g, GNUTLS_MPI* ret_n, uint bits); +const mpi_t* _gnutls_get_dh_params(gnutls_dh_params); +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); diff --git a/lib/gnutls_dh_primes.c b/lib/gnutls_dh_primes.c index b91a1cae0d..442d8e052f 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 GNUTLS_MPI* _gnutls_get_dh_params(gnutls_dh_params dh_primes) +const mpi_t* _gnutls_get_dh_params(gnutls_dh_params dh_primes) { if (dh_primes == NULL || dh_primes->params[1] == NULL || dh_primes->params[0] == NULL) @@ -43,13 +43,13 @@ const GNUTLS_MPI* _gnutls_get_dh_params(gnutls_dh_params dh_primes) return dh_primes->params; } -int _gnutls_dh_generate_prime(GNUTLS_MPI * ret_g, GNUTLS_MPI * ret_n, +int _gnutls_dh_generate_prime(mpi_t * ret_g, mpi_t * ret_n, unsigned int bits) { - GNUTLS_MPI g=NULL, prime=NULL; + mpi_t g=NULL, prime=NULL; gcry_error_t err; int result, times = 0, qbits; - GNUTLS_MPI *factors = NULL; + mpi_t *factors = NULL; /* Calculate the size of a prime factor of (prime-1)/2. * This is a bad emulation of Michael Wiener's table @@ -140,7 +140,7 @@ int _gnutls_dh_generate_prime(GNUTLS_MPI * ret_g, GNUTLS_MPI * ret_n, int gnutls_dh_params_import_raw(gnutls_dh_params dh_params, const gnutls_datum *prime, const gnutls_datum* generator) { - GNUTLS_MPI tmp_prime, tmp_g; + mpi_t tmp_prime, tmp_g; size_t siz; siz = prime->size; diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index 242ed6040c..e9cbab910c 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -234,38 +234,38 @@ 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 struct AUTH_CRED { +typedef struct auth_cred_t { gnutls_credentials_type algorithm; /* the type of credentials depends on algorithm */ void* credentials; - struct AUTH_CRED* next; -} AUTH_CRED; + struct auth_cred_t* next; +} auth_cred_t; struct GNUTLS_KEY_INT { /* For DH KX */ gnutls_datum key; - GNUTLS_MPI KEY; - GNUTLS_MPI client_Y; - GNUTLS_MPI client_g; - GNUTLS_MPI client_p; - GNUTLS_MPI dh_secret; + mpi_t KEY; + mpi_t client_Y; + mpi_t client_g; + mpi_t client_p; + mpi_t dh_secret; /* for SRP */ - GNUTLS_MPI A; - GNUTLS_MPI B; - GNUTLS_MPI u; - GNUTLS_MPI b; - GNUTLS_MPI a; - GNUTLS_MPI x; + mpi_t A; + mpi_t B; + mpi_t u; + mpi_t b; + mpi_t a; + mpi_t x; /* RSA: e, m */ - GNUTLS_MPI rsa[2]; + mpi_t rsa[2]; /* this is used to hold the peers authentication data */ - /* AUTH_INFO structures MAY contain malloced + /* auth_info_t structures SHOULD NOT contain malloced * elements. Check gnutls_session_pack.c, and gnutls_auth.c. * Rememember that this should be calloced! */ @@ -275,7 +275,7 @@ struct GNUTLS_KEY_INT { */ uint8 crypt_algo; - AUTH_CRED* cred; /* used to specify keys/certificates etc */ + auth_cred_t* cred; /* used to specify keys/certificates etc */ int certificate_requested; /* some ciphersuites use this @@ -310,7 +310,7 @@ typedef enum gnutls_protocol_version { GNUTLS_SSL3=1, GNUTLS_TLS1_0, gnutls_protocol_version; /* This structure holds parameters got from TLS extension - * mechanism. (some extensions may hold parameters in AUTH_INFO + * mechanism. (some extensions may hold parameters in auth_info_t * structures also - see SRP). */ @@ -332,11 +332,11 @@ typedef struct { opaque srp_username[MAX_SRP_USERNAME]; } TLSExtensions; -/* AUTH_INFO structures now MAY contain malloced +/* auth_info_t structures now MAY contain malloced * elements. */ -/* This structure and AUTH_INFO, are stored in the resume database, +/* This structure and auth_info_t, are stored in the resume database, * and are restored, in case of resume. * Holds all the required parameters to resume the current * session. @@ -426,7 +426,7 @@ typedef struct { typedef struct { /* [0] is the prime, [1] is the generator. */ - GNUTLS_MPI params[2]; + mpi_t params[2]; } _gnutls_dh_params; #define gnutls_dh_params _gnutls_dh_params* diff --git a/lib/gnutls_pk.c b/lib/gnutls_pk.c index ffcff5dc9d..fa49381d96 100644 --- a/lib/gnutls_pk.c +++ b/lib/gnutls_pk.c @@ -36,23 +36,23 @@ #include <x509/mpi.h> #include <x509/common.h> -static int _gnutls_pk_encrypt(int algo, GNUTLS_MPI * resarr, GNUTLS_MPI data, GNUTLS_MPI * pkey, int pkey_len); -static int _gnutls_pk_sign(int algo, GNUTLS_MPI* data, GNUTLS_MPI hash, GNUTLS_MPI * pkey, int); -static int _gnutls_pk_verify(int algo, GNUTLS_MPI hash, GNUTLS_MPI* data, GNUTLS_MPI *pkey, int); -static int _gnutls_pk_decrypt(int algo, GNUTLS_MPI * resarr, GNUTLS_MPI data, GNUTLS_MPI * pkey, int); +static int _gnutls_pk_encrypt(int algo, mpi_t * resarr, mpi_t data, mpi_t * pkey, int pkey_len); +static int _gnutls_pk_sign(int algo, mpi_t* data, mpi_t hash, mpi_t * pkey, int); +static int _gnutls_pk_verify(int algo, mpi_t hash, mpi_t* data, mpi_t *pkey, int); +static int _gnutls_pk_decrypt(int algo, mpi_t * resarr, mpi_t data, mpi_t * pkey, int); /* Do PKCS-1 RSA encryption. * params is modulus, public exp. */ int _gnutls_pkcs1_rsa_encrypt(gnutls_datum * ciphertext, - const gnutls_datum *plaintext, GNUTLS_MPI* params, + const gnutls_datum *plaintext, mpi_t* params, uint params_len, uint btype) { unsigned int i, pad; int ret; - GNUTLS_MPI m, res; + mpi_t m, res; opaque *edata, *ps; size_t k, psize; size_t mod_bits; @@ -200,12 +200,12 @@ int _gnutls_pkcs1_rsa_encrypt(gnutls_datum * ciphertext, * Can decrypt block type 1 and type 2 packets. */ int _gnutls_pkcs1_rsa_decrypt(gnutls_datum * plaintext, - const gnutls_datum *ciphertext, GNUTLS_MPI* params, uint params_len, + const gnutls_datum *ciphertext, mpi_t* params, uint params_len, uint btype) { uint k, i; int ret; - GNUTLS_MPI c, res; + mpi_t c, res; opaque *edata; size_t esize, mod_bits; @@ -314,7 +314,7 @@ int _gnutls_pkcs1_rsa_decrypt(gnutls_datum * plaintext, int _gnutls_rsa_verify( const gnutls_datum* vdata, const gnutls_datum *ciphertext, - GNUTLS_MPI *params, int params_len, int btype) { + mpi_t *params, int params_len, int btype) { gnutls_datum plain; int ret; @@ -344,7 +344,7 @@ int _gnutls_rsa_verify( const gnutls_datum* vdata, const gnutls_datum *ciphertex /* encodes the Dss-Sig-Value structure */ -static int encode_ber_rs( gnutls_datum* sig_value, GNUTLS_MPI r, GNUTLS_MPI s) { +static int encode_ber_rs( gnutls_datum* sig_value, mpi_t r, mpi_t s) { ASN1_TYPE sig; int result, tot_len; @@ -386,9 +386,9 @@ int result, tot_len; /* 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, - GNUTLS_MPI * params, uint params_len) + mpi_t * params, uint params_len) { - GNUTLS_MPI rs[2], mdata; + mpi_t rs[2], mdata; int ret; size_t k; @@ -428,7 +428,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, GNUTLS_MPI* r, GNUTLS_MPI* s) { +static int decode_ber_rs( const gnutls_datum* sig_value, mpi_t* r, mpi_t* s) { ASN1_TYPE sig; int result; @@ -469,12 +469,12 @@ int result; /* params is p, q, g, y in that order */ int _gnutls_dsa_verify( const gnutls_datum* vdata, const gnutls_datum *sig_value, - GNUTLS_MPI * params, int params_len) { + mpi_t * params, int params_len) { - GNUTLS_MPI mdata; + mpi_t mdata; int ret; size_t k; - GNUTLS_MPI rs[2]; + mpi_t rs[2]; if (vdata->size != 20) { /* sha-1 only */ gnutls_assert(); @@ -513,7 +513,7 @@ int _gnutls_dsa_verify( const gnutls_datum* vdata, const gnutls_datum *sig_value * Emulate our old PK interface here - sometime in the future we might * change the internal design to directly fit to libgcrypt. */ -static int _gnutls_pk_encrypt(int algo, GNUTLS_MPI * resarr, GNUTLS_MPI data, GNUTLS_MPI * pkey, int pkey_len) +static int _gnutls_pk_encrypt(int algo, mpi_t * resarr, mpi_t data, mpi_t * pkey, int pkey_len) { gcry_sexp_t s_ciph, s_data, s_pkey; int rc=-1; @@ -576,7 +576,7 @@ static int _gnutls_pk_encrypt(int algo, GNUTLS_MPI * resarr, GNUTLS_MPI data, GN } static -int _gnutls_pk_decrypt(int algo, GNUTLS_MPI * resarr, GNUTLS_MPI data, GNUTLS_MPI * pkey, int pkey_len) +int _gnutls_pk_decrypt(int algo, mpi_t * resarr, mpi_t data, mpi_t * pkey, int pkey_len) { gcry_sexp_t s_plain, s_data, s_pkey; int rc=-1; @@ -635,7 +635,7 @@ int _gnutls_pk_decrypt(int algo, GNUTLS_MPI * resarr, GNUTLS_MPI data, GNUTLS_MP /* in case of DSA puts into data, r,s */ static -int _gnutls_pk_sign(int algo, GNUTLS_MPI* data, GNUTLS_MPI hash, GNUTLS_MPI * pkey, int pkey_len) +int _gnutls_pk_sign(int algo, mpi_t* data, mpi_t hash, mpi_t * pkey, int pkey_len) { gcry_sexp_t s_hash, s_key, s_sig; int rc=-1; @@ -729,7 +729,7 @@ int _gnutls_pk_sign(int algo, GNUTLS_MPI* data, GNUTLS_MPI hash, GNUTLS_MPI * pk } -static int _gnutls_pk_verify(int algo, GNUTLS_MPI hash, GNUTLS_MPI* data, GNUTLS_MPI *pkey, int pkey_len) +static int _gnutls_pk_verify(int algo, mpi_t hash, mpi_t* data, mpi_t *pkey, int pkey_len) { gcry_sexp_t s_sig, s_hash, s_pkey; int rc=-1; diff --git a/lib/gnutls_pk.h b/lib/gnutls_pk.h index cf94694e6c..9838d6589b 100644 --- a/lib/gnutls_pk.h +++ b/lib/gnutls_pk.h @@ -2,14 +2,14 @@ # define GNUTLS_PK_H int _gnutls_pkcs1_rsa_encrypt(gnutls_datum * ciphertext, const gnutls_datum *plaintext, - GNUTLS_MPI * params, uint params_len, uint btype); + mpi_t * params, uint params_len, uint btype); int _gnutls_dsa_sign(gnutls_datum * signature, const gnutls_datum *plaintext, - GNUTLS_MPI *params, uint params_len); + mpi_t *params, uint params_len); int _gnutls_pkcs1_rsa_decrypt(gnutls_datum * plaintext, const gnutls_datum* ciphertext, - GNUTLS_MPI * params, uint params_len, uint btype); + mpi_t * params, uint params_len, uint btype); int _gnutls_rsa_verify( const gnutls_datum* vdata, const gnutls_datum *ciphertext, - GNUTLS_MPI* params, int params_len, int btype); + mpi_t* params, int params_len, int btype); int _gnutls_dsa_verify( const gnutls_datum* vdata, const gnutls_datum *sig_value, - GNUTLS_MPI * params, int params_len); + mpi_t * params, int params_len); #endif /* GNUTLS_PK_H */ diff --git a/lib/gnutls_rsa_export.c b/lib/gnutls_rsa_export.c index 57e15ebb12..597a45145a 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 GNUTLS_MPI* _gnutls_get_rsa_params(gnutls_rsa_params rsa_params) +const mpi_t* _gnutls_get_rsa_params(gnutls_rsa_params rsa_params) { if (rsa_params == NULL) { return NULL; @@ -55,7 +55,7 @@ const GNUTLS_MPI* _gnutls_get_rsa_params(gnutls_rsa_params rsa_params) /* resarr will contain: modulus(0), public exponent(1), private exponent(2), * prime1 - p (3), prime2 - q(4), u (5). */ -int _gnutls_rsa_generate_params(GNUTLS_MPI* resarr, int* resarr_len, int bits) +int _gnutls_rsa_generate_params(mpi_t* resarr, int* resarr_len, int bits) { int ret; diff --git a/lib/gnutls_rsa_export.h b/lib/gnutls_rsa_export.h index 765610e1a7..ce2c70e4f0 100644 --- a/lib/gnutls_rsa_export.h +++ b/lib/gnutls_rsa_export.h @@ -18,8 +18,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -const GNUTLS_MPI* _gnutls_get_rsa_params(gnutls_rsa_params); +const mpi_t* _gnutls_get_rsa_params(gnutls_rsa_params); int _gnutls_peers_cert_less_512( gnutls_session session); -int _gnutls_rsa_generate_params(GNUTLS_MPI* resarr, int* resarr_len, int bits); +int _gnutls_rsa_generate_params(mpi_t* resarr, int* resarr_len, int bits); void gnutls_rsa_params_deinit(gnutls_rsa_params rsa_params); diff --git a/lib/gnutls_session_pack.c b/lib/gnutls_session_pack.c index f3b387d65f..c9f5dbc25a 100644 --- a/lib/gnutls_session_pack.c +++ b/lib/gnutls_session_pack.c @@ -35,11 +35,11 @@ #include <gnutls_num.h> #define PACK_HEADER_SIZE 1 -int _gnutls_pack_certificate_auth_info( CERTIFICATE_AUTH_INFO info, +int _gnutls_pack_certificate_auth_info( cert_auth_info_t info, gnutls_datum * packed_session); -int _gnutls_unpack_certificate_auth_info(CERTIFICATE_AUTH_INFO info, +int _gnutls_unpack_certificate_auth_info(cert_auth_info_t info, const gnutls_datum * packed_session); -static int _gnutls_pack_certificate_auth_info_size( CERTIFICATE_AUTH_INFO info); +static int _gnutls_pack_certificate_auth_info_size( cert_auth_info_t info); /* Since auth_info structures contain malloced data, this function @@ -60,7 +60,7 @@ int _gnutls_session_pack(gnutls_session session, gnutls_datum * packed_session) switch (gnutls_auth_get_type(session)) { #ifdef ENABLE_SRP case GNUTLS_CRD_SRP:{ - SRP_SERVER_AUTH_INFO info = + srp_server_auth_info_t info = _gnutls_get_auth_info(session); @@ -88,7 +88,7 @@ int _gnutls_session_pack(gnutls_session session, gnutls_datum * packed_session) break; #endif case GNUTLS_CRD_ANON:{ - ANON_CLIENT_AUTH_INFO info = + anon_client_auth_info_t info = _gnutls_get_auth_info(session); if (info == NULL && session->key->auth_info_size!=0) { gnutls_assert(); @@ -111,7 +111,7 @@ int _gnutls_session_pack(gnutls_session session, gnutls_datum * packed_session) } break; case GNUTLS_CRD_CERTIFICATE:{ - CERTIFICATE_AUTH_INFO info = + cert_auth_info_t info = _gnutls_get_auth_info(session); if (info == NULL && session->key->auth_info_size!=0) { gnutls_assert(); @@ -158,7 +158,7 @@ uint _gnutls_session_size( gnutls_session session) pack_size += session->key->auth_info_size; break; case GNUTLS_CRD_CERTIFICATE: { - CERTIFICATE_AUTH_INFO info = + cert_auth_info_t info = _gnutls_get_auth_info(session); pack_size += _gnutls_pack_certificate_auth_info_size( info); @@ -199,7 +199,7 @@ int _gnutls_session_unpack(gnutls_session session, data[PACK_HEADER_SIZE]); if (pack_size == 0) break; - if (pack_size != sizeof(SRP_SERVER_AUTH_INFO_INT)) { + if (pack_size != sizeof(srp_server_auth_info_st)) { gnutls_assert(); return GNUTLS_E_DB_ERROR; } @@ -212,7 +212,7 @@ int _gnutls_session_unpack(gnutls_session session, return GNUTLS_E_MEMORY_ERROR; } session->key->auth_info_size = - sizeof(SRP_SERVER_AUTH_INFO_INT); + sizeof(srp_server_auth_info_st); memcpy(session->key->auth_info, @@ -229,7 +229,7 @@ int _gnutls_session_unpack(gnutls_session session, if (pack_size == 0) break; - if (pack_size != sizeof(ANON_CLIENT_AUTH_INFO_INT)) { + if (pack_size != sizeof(anon_client_auth_info_st)) { gnutls_assert(); return GNUTLS_E_DB_ERROR; } @@ -258,20 +258,20 @@ int _gnutls_session_unpack(gnutls_session session, session->key->auth_info_size = 0; break; } - if (pack_size < sizeof(CERTIFICATE_AUTH_INFO_INT)) { + if (pack_size < sizeof(cert_auth_info_st)) { gnutls_assert(); return GNUTLS_E_DB_ERROR; } session->key->auth_info = - gnutls_malloc( sizeof(CERTIFICATE_AUTH_INFO_INT)); + gnutls_malloc( sizeof(cert_auth_info_st)); if (session->key->auth_info == NULL) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; } session->key->auth_info_size = - sizeof(CERTIFICATE_AUTH_INFO_INT); + sizeof(cert_auth_info_st); ret = _gnutls_unpack_certificate_auth_info(session-> @@ -322,7 +322,7 @@ int _gnutls_session_unpack(gnutls_session session, return 0; } -int _gnutls_pack_certificate_auth_info( CERTIFICATE_AUTH_INFO info, +int _gnutls_pack_certificate_auth_info( cert_auth_info_t info, gnutls_datum * packed_session) { unsigned int pos, i; @@ -331,14 +331,14 @@ int _gnutls_pack_certificate_auth_info( CERTIFICATE_AUTH_INFO info, packed_session->size = _gnutls_pack_certificate_auth_info_size( info); if (info==NULL) info_size = 0; - else info_size = sizeof(CERTIFICATE_AUTH_INFO_INT); + else info_size = sizeof(cert_auth_info_st); packed_session->data[0] = GNUTLS_CRD_CERTIFICATE; _gnutls_write_uint32( packed_session->size-PACK_HEADER_SIZE-sizeof(uint32), &packed_session->data[PACK_HEADER_SIZE]); if (info!=NULL) { memcpy(&packed_session->data[PACK_HEADER_SIZE + sizeof(uint32)], - info, sizeof(CERTIFICATE_AUTH_INFO_INT)); + info, sizeof(cert_auth_info_st)); } pos = PACK_HEADER_SIZE + sizeof(uint32) + info_size; @@ -356,9 +356,9 @@ int _gnutls_pack_certificate_auth_info( CERTIFICATE_AUTH_INFO info, return 0; } -static int _gnutls_pack_certificate_auth_info_size( CERTIFICATE_AUTH_INFO info) +static int _gnutls_pack_certificate_auth_info_size( cert_auth_info_t info) { - uint32 pack_size = sizeof(CERTIFICATE_AUTH_INFO_INT); + uint32 pack_size = sizeof(cert_auth_info_st); unsigned int i; if (info == NULL) @@ -372,7 +372,7 @@ static int _gnutls_pack_certificate_auth_info_size( CERTIFICATE_AUTH_INFO info) } -int _gnutls_unpack_certificate_auth_info(CERTIFICATE_AUTH_INFO info, +int _gnutls_unpack_certificate_auth_info(cert_auth_info_t info, const gnutls_datum * packed_session) { unsigned int i,j, pos; @@ -381,9 +381,9 @@ uint32 size; memcpy(info, &packed_session->data[PACK_HEADER_SIZE + sizeof(uint32)], - sizeof(CERTIFICATE_AUTH_INFO_INT)); + sizeof(cert_auth_info_st)); - pos = PACK_HEADER_SIZE + sizeof(uint32) + sizeof(CERTIFICATE_AUTH_INFO_INT); + 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)); if (info->raw_certificate_list == NULL) { diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c index 8f1b26728e..b63ff29190 100644 --- a/lib/gnutls_sig.c +++ b/lib/gnutls_sig.c @@ -166,7 +166,7 @@ opaque concat[36]; /* 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, GNUTLS_MPI* params, int params_size, +int _gnutls_sign( gnutls_pk_algorithm algo, mpi_t* params, int params_size, const gnutls_datum* data, gnutls_datum *signature) { int ret; diff --git a/lib/gnutls_sig.h b/lib/gnutls_sig.h index 30feba7b43..eb832e30e9 100644 --- a/lib/gnutls_sig.h +++ b/lib/gnutls_sig.h @@ -7,7 +7,7 @@ int _gnutls_tls_sign_hdata( gnutls_session session, gnutls_cert* cert, gnutls_pr 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, GNUTLS_MPI* params, int params_size, +int _gnutls_sign( gnutls_pk_algorithm algo, mpi_t* params, int params_size, const gnutls_datum* data, gnutls_datum *signature); #endif diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index 14e0e0aff0..d2fc9dfd4f 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -399,7 +399,7 @@ int ret; switch( gnutls_auth_get_type( session)) { case GNUTLS_CRD_ANON: { - ANON_SERVER_AUTH_INFO info; + anon_server_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) return GNUTLS_E_INTERNAL_ERROR; @@ -408,7 +408,7 @@ int ret; break; } case GNUTLS_CRD_CERTIFICATE: { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) @@ -437,7 +437,7 @@ int _gnutls_dh_set_secret_bits( gnutls_session session, uint bits) { switch( gnutls_auth_get_type( session)) { case GNUTLS_CRD_ANON: { - ANON_SERVER_AUTH_INFO info; + anon_server_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) return GNUTLS_E_INTERNAL_ERROR; @@ -445,7 +445,7 @@ int _gnutls_dh_set_secret_bits( gnutls_session session, uint bits) break; } case GNUTLS_CRD_CERTIFICATE: { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) @@ -467,7 +467,7 @@ int _gnutls_dh_set_secret_bits( gnutls_session session, uint bits) */ int _gnutls_rsa_export_set_pubkey( gnutls_session session, mpi_t exp, mpi_t mod) { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; int ret; info = _gnutls_get_auth_info(session); @@ -503,7 +503,7 @@ int ret; switch( gnutls_auth_get_type( session)) { case GNUTLS_CRD_ANON: { - ANON_SERVER_AUTH_INFO info; + anon_server_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) return GNUTLS_E_INTERNAL_ERROR; @@ -512,7 +512,7 @@ int ret; break; } case GNUTLS_CRD_CERTIFICATE: { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c index 930b53dad9..73466daa6b 100644 --- a/lib/gnutls_ui.c +++ b/lib/gnutls_ui.c @@ -73,8 +73,8 @@ int gnutls_dh_get_group(gnutls_session session, gnutls_datum* raw_gen, gnutls_datum* raw_prime) { dh_info_st *dh; -ANON_SERVER_AUTH_INFO anon_info; -CERTIFICATE_AUTH_INFO cert_info; +anon_server_auth_info_t anon_info; +cert_auth_info_t cert_info; switch( gnutls_auth_get_type( session)) { case GNUTLS_CRD_ANON: @@ -117,8 +117,8 @@ CERTIFICATE_AUTH_INFO cert_info; int gnutls_dh_get_pubkey(gnutls_session session, gnutls_datum* key) { dh_info_st* dh; -ANON_SERVER_AUTH_INFO anon_info; -CERTIFICATE_AUTH_INFO cert_info; +anon_server_auth_info_t anon_info; +cert_auth_info_t cert_info; switch( gnutls_auth_get_type( session)) { case GNUTLS_CRD_ANON: { @@ -160,7 +160,7 @@ CERTIFICATE_AUTH_INFO cert_info; **/ int gnutls_rsa_export_get_pubkey(gnutls_session session, gnutls_datum* exp, gnutls_datum* mod) { -CERTIFICATE_AUTH_INFO cert_info; +cert_auth_info_t cert_info; if ( gnutls_auth_get_type( session) == GNUTLS_CRD_CERTIFICATE) { cert_info = _gnutls_get_auth_info(session); @@ -193,7 +193,7 @@ int gnutls_dh_get_secret_bits(gnutls_session session) { switch( gnutls_auth_get_type( session)) { case GNUTLS_CRD_ANON: { - ANON_SERVER_AUTH_INFO info; + anon_server_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) @@ -201,7 +201,7 @@ int gnutls_dh_get_secret_bits(gnutls_session session) return info->dh.secret_bits; } case GNUTLS_CRD_CERTIFICATE: { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) @@ -231,7 +231,7 @@ dh_info_st *dh; switch( gnutls_auth_get_type( session)) { case GNUTLS_CRD_ANON: { - ANON_SERVER_AUTH_INFO info; + anon_server_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) @@ -240,7 +240,7 @@ dh_info_st *dh; break; } case GNUTLS_CRD_CERTIFICATE: { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) @@ -269,7 +269,7 @@ dh_info_st *dh; **/ int gnutls_rsa_export_get_modulus_bits(gnutls_session session) { -CERTIFICATE_AUTH_INFO info; +cert_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) @@ -293,7 +293,7 @@ dh_info_st * dh; switch( gnutls_auth_get_type( session)) { case GNUTLS_CRD_ANON: { - ANON_SERVER_AUTH_INFO info; + anon_server_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) @@ -303,7 +303,7 @@ dh_info_st * dh; break; } case GNUTLS_CRD_CERTIFICATE: { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; info = _gnutls_get_auth_info(session); if (info == NULL) @@ -369,7 +369,7 @@ const gnutls_datum *gnutls_certificate_get_ours(gnutls_session session) const gnutls_datum *gnutls_certificate_get_peers(gnutls_session session, unsigned int *list_size) { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; CHECK_AUTH(GNUTLS_CRD_CERTIFICATE, NULL); @@ -393,7 +393,7 @@ const gnutls_datum *gnutls_certificate_get_peers(gnutls_session session, **/ int gnutls_certificate_client_get_request_status(gnutls_session session) { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; CHECK_AUTH(GNUTLS_CRD_CERTIFICATE, 0); diff --git a/lib/gnutls_ui.h b/lib/gnutls_ui.h index 6a17cd0ef1..29093fa989 100644 --- a/lib/gnutls_ui.h +++ b/lib/gnutls_ui.h @@ -38,7 +38,7 @@ typedef int gnutls_certificate_server_retrieve_function(gnutls_session, gnutls_retr_st *); -/* Functions that allow AUTH_INFO structures handling +/* Functions that allow auth_info_t structures handling */ gnutls_credentials_type gnutls_auth_get_type(gnutls_session session); diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index e7d358f8e1..705b56a230 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -71,7 +71,7 @@ -*/ int _gnutls_x509_cert_verify_peers(gnutls_session session) { - CERTIFICATE_AUTH_INFO info; + cert_auth_info_t info; const gnutls_certificate_credentials cred; unsigned int verify; gnutls_x509_crt *peer_certificate_list; diff --git a/lib/gnutls_x509.h b/lib/gnutls_x509.h index 5a832b275f..f6ff1e32ac 100644 --- a/lib/gnutls_x509.h +++ b/lib/gnutls_x509.h @@ -13,8 +13,8 @@ int _gnutls_x509_cert_verify_peers(gnutls_session session); int _gnutls_check_key_usage( const gnutls_cert* cert, gnutls_kx_algorithm alg); -int _gnutls_x509_read_rsa_params(opaque * der, int dersize, GNUTLS_MPI * params); -int _gnutls_x509_read_dsa_pubkey(opaque * der, int dersize, GNUTLS_MPI * params); +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_raw_privkey_to_gkey( gnutls_privkey* privkey, const gnutls_datum* raw_key, gnutls_x509_crt_fmt type); diff --git a/libextra/auth_srp.c b/libextra/auth_srp.c index 9526679376..de4a3f297a 100644 --- a/libextra/auth_srp.c +++ b/libextra/auth_srp.c @@ -135,13 +135,13 @@ int _gnutls_gen_srp_server_kx(gnutls_session session, opaque ** data) uint8 *data_g; char *username; SRP_PWD_ENTRY *pwd_entry; - SRP_SERVER_AUTH_INFO info; + srp_server_auth_info_t info; ssize_t data_size; size_t n_b, tmp_size; char buf[64]; uint8 *data_b; - if ( (ret=_gnutls_auth_info_set( session, GNUTLS_CRD_SRP, sizeof( SRP_SERVER_AUTH_INFO_INT), 1)) < 0) { + if ( (ret=_gnutls_auth_info_set( session, GNUTLS_CRD_SRP, sizeof( srp_server_auth_info_st), 1)) < 0) { gnutls_assert(); return ret; } diff --git a/libextra/auth_srp.h b/libextra/auth_srp.h index f445f44e05..bd1a9bfd7f 100644 --- a/libextra/auth_srp.h +++ b/libextra/auth_srp.h @@ -16,9 +16,9 @@ typedef struct { char *username; char *password; gnutls_srp_client_credentials_function *get_function; -} SRP_CLIENT_CREDENTIALS_INT; +} srp_client_credentials_st; -#define gnutls_srp_client_credentials SRP_CLIENT_CREDENTIALS_INT* +#define gnutls_srp_client_credentials srp_client_credentials_st* typedef struct { char *password_file; @@ -27,14 +27,14 @@ typedef struct { * password files. */ gnutls_srp_server_credentials_function *pwd_callback; -} SRP_SERVER_CREDENTIALS_INT; +} srp_server_cred_st; -#define gnutls_srp_server_credentials SRP_SERVER_CREDENTIALS_INT* +#define gnutls_srp_server_credentials srp_server_cred_st* /* these structures should not use allocated data */ -typedef struct SRP_SERVER_AUTH_INFO_INT { +typedef struct srp_server_auth_info_st { char username[MAX_SRP_USERNAME]; -} *SRP_SERVER_AUTH_INFO; +} *srp_server_auth_info_t; #ifdef ENABLE_SRP @@ -49,7 +49,7 @@ int _gnutls_gen_srp_client_kx(gnutls_session, opaque **); int _gnutls_proc_srp_server_kx(gnutls_session, opaque *, size_t); int _gnutls_proc_srp_client_kx(gnutls_session, opaque *, size_t); -typedef struct SRP_SERVER_AUTH_INFO_INT SRP_SERVER_AUTH_INFO_INT; +typedef struct srp_server_auth_info_st srp_server_auth_info_st; #endif /* ENABLE_SRP */ diff --git a/libextra/auth_srp_rsa.c b/libextra/auth_srp_rsa.c index 561465d71f..1a75530ce2 100644 --- a/libextra/auth_srp_rsa.c +++ b/libextra/auth_srp_rsa.c @@ -139,7 +139,7 @@ ssize_t ret; int sigsize; gnutls_datum vparams, signature; ssize_t data_size; -CERTIFICATE_AUTH_INFO info; +cert_auth_info_t info; gnutls_cert peer_cert; opaque* p; diff --git a/libextra/gnutls_srp.c b/libextra/gnutls_srp.c index f2d09a5e5a..4ab3d29e61 100644 --- a/libextra/gnutls_srp.c +++ b/libextra/gnutls_srp.c @@ -380,7 +380,7 @@ void gnutls_srp_free_client_credentials( gnutls_srp_client_credentials sc) { * Returns 0 on success. **/ int gnutls_srp_allocate_client_credentials( gnutls_srp_client_credentials *sc) { - *sc = gnutls_calloc( 1, sizeof(SRP_CLIENT_CREDENTIALS_INT)); + *sc = gnutls_calloc( 1, sizeof(srp_client_credentials_st)); if (*sc==NULL) return GNUTLS_E_MEMORY_ERROR; @@ -444,7 +444,7 @@ void gnutls_srp_free_server_credentials( gnutls_srp_server_credentials sc) { * Returns 0 on success. **/ int gnutls_srp_allocate_server_credentials( gnutls_srp_server_credentials *sc) { - *sc = gnutls_calloc( 1, sizeof(SRP_SERVER_CREDENTIALS_INT)); + *sc = gnutls_calloc( 1, sizeof(srp_server_cred_st)); if (*sc==NULL) return GNUTLS_E_MEMORY_ERROR; @@ -597,7 +597,7 @@ void gnutls_srp_set_client_credentials_function( **/ const char *gnutls_srp_server_get_username(gnutls_session session) { - SRP_SERVER_AUTH_INFO info; + srp_server_auth_info_t info; CHECK_AUTH(GNUTLS_CRD_SRP, NULL); |