summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/README.CODING_STYLE6
-rw-r--r--lib/auth_anon.c2
-rw-r--r--lib/auth_anon.h2
-rw-r--r--lib/auth_cert.h8
-rw-r--r--lib/auth_dh_common.h4
-rw-r--r--lib/auth_dhe.c4
-rw-r--r--lib/auth_rsa.c2
-rw-r--r--lib/auth_rsa_export.c2
-rw-r--r--lib/debug.c2
-rw-r--r--lib/debug.h2
-rw-r--r--lib/gnutls_algorithms.c66
-rw-r--r--lib/gnutls_algorithms.h20
-rw-r--r--lib/gnutls_auth.c14
-rw-r--r--lib/gnutls_auth.h4
-rw-r--r--lib/gnutls_auth_int.h4
-rw-r--r--lib/gnutls_buffers.c12
-rw-r--r--lib/gnutls_buffers.h12
-rw-r--r--lib/gnutls_cipher.c20
-rw-r--r--lib/gnutls_cipher.h6
-rw-r--r--lib/gnutls_cipher_int.c10
-rw-r--r--lib/gnutls_cipher_int.h10
-rw-r--r--lib/gnutls_compress_int.c12
-rw-r--r--lib/gnutls_compress_int.h12
-rw-r--r--lib/gnutls_constate.c12
-rw-r--r--lib/gnutls_db.c2
-rw-r--r--lib/gnutls_dh_primes.c2
-rw-r--r--lib/gnutls_handshake.c54
-rw-r--r--lib/gnutls_handshake.h2
-rw-r--r--lib/gnutls_hash_int.c30
-rw-r--r--lib/gnutls_hash_int.h16
-rw-r--r--lib/gnutls_int.h108
-rw-r--r--lib/gnutls_record.c22
-rw-r--r--lib/gnutls_record.h4
-rw-r--r--lib/gnutls_session_pack.c24
-rw-r--r--lib/gnutls_sig.c16
-rw-r--r--lib/gnutls_state.c12
-rw-r--r--lib/gnutls_ui.c8
-rw-r--r--lib/gnutls_v2_compat.c2
-rw-r--r--lib/x509/pkcs12.c4
-rw-r--r--lib/x509/privkey_pkcs8.c4
-rw-r--r--libextra/auth_srp.c2
-rw-r--r--libextra/auth_srp_rsa.c4
-rw-r--r--libextra/ext_srp.c2
-rw-r--r--libextra/gnutls_extra.c6
44 files changed, 289 insertions, 283 deletions
diff --git a/doc/README.CODING_STYLE b/doc/README.CODING_STYLE
index 327f2f1e03..fee502584c 100644
--- a/doc/README.CODING_STYLE
+++ b/doc/README.CODING_STYLE
@@ -44,6 +44,12 @@ The rules here are not always used, although we try to stick to them.
Definitions, value defaults and enumerated values should be in
capitals. E.g. GNUTLS_CIPHER_3DES_CBC
+ Structures should have the '_st' suffix in their name even
+ if they are a typedef. One can use the sizeof() on types with
+ '_st' as suffix.
+
+ Other constructed types should have the '_t' suffix. A pointer
+ to a structure also has the '_t' suffix.
*** Function parameters:
The gnutls functions accept parameters in the order:
diff --git a/lib/auth_anon.c b/lib/auth_anon.c
index cf0882edf9..4eb120307f 100644
--- a/lib/auth_anon.c
+++ b/lib/auth_anon.c
@@ -42,7 +42,7 @@ 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);
-const MOD_AUTH_STRUCT anon_auth_struct = {
+const mod_auth_st anon_auth_struct = {
"ANON",
NULL,
NULL,
diff --git a/lib/auth_anon.h b/lib/auth_anon.h
index 72eb87ca49..8173814be4 100644
--- a/lib/auth_anon.h
+++ b/lib/auth_anon.h
@@ -14,7 +14,7 @@ typedef struct {
#define gnutls_anon_client_credentials void*
typedef struct anon_client_auth_info_st {
- dh_info_st dh;
+ dh_info_t dh;
} *anon_client_auth_info_t;
typedef anon_client_auth_info_t anon_server_auth_info_t;
diff --git a/lib/auth_cert.h b/lib/auth_cert.h
index a5488a9649..cb6bab300e 100644
--- a/lib/auth_cert.h
+++ b/lib/auth_cert.h
@@ -96,20 +96,20 @@ typedef struct {
#define gnutls_certificate_credentials certificate_credentials_st*
-typedef struct rsa_info_st_int {
+typedef struct rsa_info_st {
opaque modulus[64];
size_t modulus_size;
opaque exponent[64];
size_t exponent_size;
-} rsa_info_st;
+} rsa_info_t;
typedef struct cert_auth_info_st {
int certificate_requested; /* if the peer requested certificate
* this is non zero;
*/
- dh_info_st dh;
+ dh_info_t dh;
- rsa_info_st rsa_export;
+ rsa_info_t rsa_export;
gnutls_datum* raw_certificate_list; /* holds the raw certificate of the
* peer.
*/
diff --git a/lib/auth_dh_common.h b/lib/auth_dh_common.h
index cc23a987df..8d82d3c33c 100644
--- a/lib/auth_dh_common.h
+++ b/lib/auth_dh_common.h
@@ -1,7 +1,7 @@
#ifndef AUTH_DH_COMMON
# define AUTH_DH_COMMON
-typedef struct dh_info_st_int {
+typedef struct dh_info_st {
int secret_bits;
opaque prime[1024];
@@ -10,7 +10,7 @@ typedef struct dh_info_st_int {
size_t generator_size;
opaque public_key[1024];
size_t public_key_size;
-} dh_info_st;
+} 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,
diff --git a/lib/auth_dhe.c b/lib/auth_dhe.c
index 2dda026a84..8025801a2e 100644
--- a/lib/auth_dhe.c
+++ b/lib/auth_dhe.c
@@ -42,7 +42,7 @@ 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);
-const MOD_AUTH_STRUCT dhe_rsa_auth_struct = {
+const mod_auth_st dhe_rsa_auth_struct = {
"DHE_RSA",
_gnutls_gen_cert_server_certificate,
_gnutls_gen_cert_client_certificate,
@@ -59,7 +59,7 @@ const MOD_AUTH_STRUCT dhe_rsa_auth_struct = {
_gnutls_proc_cert_cert_req /* proc server cert request */
};
-const MOD_AUTH_STRUCT dhe_dss_auth_struct = {
+const mod_auth_st dhe_dss_auth_struct = {
"DHE_DSS",
_gnutls_gen_cert_server_certificate,
_gnutls_gen_cert_client_certificate,
diff --git a/lib/auth_rsa.c b/lib/auth_rsa.c
index 67b9366d15..5e6f412b92 100644
--- a/lib/auth_rsa.c
+++ b/lib/auth_rsa.c
@@ -44,7 +44,7 @@
int _gnutls_gen_rsa_client_kx(gnutls_session, opaque **);
int _gnutls_proc_rsa_client_kx(gnutls_session, opaque *, size_t);
-const MOD_AUTH_STRUCT rsa_auth_struct = {
+const mod_auth_st rsa_auth_struct = {
"RSA",
_gnutls_gen_cert_server_certificate,
_gnutls_gen_cert_client_certificate,
diff --git a/lib/auth_rsa_export.c b/lib/auth_rsa_export.c
index 2842d4826b..fe952d8d40 100644
--- a/lib/auth_rsa_export.c
+++ b/lib/auth_rsa_export.c
@@ -48,7 +48,7 @@ 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);
-const MOD_AUTH_STRUCT rsa_export_auth_struct = {
+const mod_auth_st rsa_export_auth_struct = {
"RSA EXPORT",
_gnutls_gen_cert_server_certificate,
_gnutls_gen_cert_client_certificate,
diff --git a/lib/debug.c b/lib/debug.c
index 5b4838a0e2..bc02df8cec 100644
--- a/lib/debug.c
+++ b/lib/debug.c
@@ -46,7 +46,7 @@ void _gnutls_print_state(gnutls_session session)
#endif
-const char* _gnutls_packet2str( ContentType packet)
+const char* _gnutls_packet2str( content_type_t packet)
{
switch(packet) {
case GNUTLS_CHANGE_CIPHER_SPEC:
diff --git a/lib/debug.h b/lib/debug.h
index 3e9668b04e..c874abf4f3 100644
--- a/lib/debug.h
+++ b/lib/debug.h
@@ -21,6 +21,6 @@
#ifdef DEBUG
void _gnutls_print_state(gnutls_session session);
#endif
-const char* _gnutls_packet2str( ContentType packet);
+const char* _gnutls_packet2str( content_type_t packet);
const char* _gnutls_handshake2str( HandshakeType handshake);
void _gnutls_dump_mpi(const char* prefix, mpi_t a);
diff --git a/lib/gnutls_algorithms.c b/lib/gnutls_algorithms.c
index e3fa630524..c79acf683c 100644
--- a/lib/gnutls_algorithms.c
+++ b/lib/gnutls_algorithms.c
@@ -126,7 +126,7 @@ struct gnutls_cipher_entry {
gnutls_cipher_algorithm id;
uint16 blocksize;
uint16 keysize;
- CipherType block;
+ cipher_type_t block;
uint16 iv;
int export_flag; /* 0 non export */
};
@@ -211,11 +211,11 @@ gnutls_compression_entry _gnutls_compression_algorithms[MAX_COMP_METHODS] =
/* Key Exchange Section */
-extern MOD_AUTH_STRUCT rsa_auth_struct;
-extern MOD_AUTH_STRUCT rsa_export_auth_struct;
-extern MOD_AUTH_STRUCT dhe_rsa_auth_struct;
-extern MOD_AUTH_STRUCT dhe_dss_auth_struct;
-extern MOD_AUTH_STRUCT anon_auth_struct;
+extern mod_auth_st rsa_auth_struct;
+extern mod_auth_st rsa_export_auth_struct;
+extern mod_auth_st dhe_rsa_auth_struct;
+extern mod_auth_st dhe_dss_auth_struct;
+extern mod_auth_st anon_auth_struct;
#define MAX_KX_ALGOS 10
@@ -250,7 +250,7 @@ gnutls_kx_algo_entry _gnutls_kx_algorithms[MAX_KX_ALGOS] = {
typedef struct {
const char *name;
- GNUTLS_CipherSuite id;
+ cipher_suite_st id;
gnutls_cipher_algorithm block_algorithm;
gnutls_kx_algorithm kx_algorithm;
gnutls_mac_algorithm mac_algorithm;
@@ -475,7 +475,7 @@ static const gnutls_cipher_suite_entry cs_algorithms[] = {
for(p = cs_algorithms; p->name != NULL; p++) { b ; }
#define GNUTLS_CIPHER_SUITE_ALG_LOOP(a) \
- GNUTLS_CIPHER_SUITE_LOOP( if( (p->id.CipherSuite[0] == suite->CipherSuite[0]) && (p->id.CipherSuite[1] == suite->CipherSuite[1])) { a; break; } )
+ GNUTLS_CIPHER_SUITE_LOOP( if( (p->id.suite[0] == suite->suite[0]) && (p->id.suite[1] == suite->suite[1])) { a; break; } )
@@ -721,9 +721,9 @@ int _gnutls_cipher_is_ok(gnutls_cipher_algorithm algorithm)
/* Key EXCHANGE functions */
-MOD_AUTH_STRUCT *_gnutls_kx_auth_struct(gnutls_kx_algorithm algorithm)
+mod_auth_st *_gnutls_kx_auth_struct(gnutls_kx_algorithm algorithm)
{
- MOD_AUTH_STRUCT *ret = NULL;
+ mod_auth_st *ret = NULL;
GNUTLS_KX_ALG_LOOP(ret = p->auth_struct);
return ret;
@@ -931,7 +931,7 @@ gnutls_credentials_type _gnutls_map_kx_get_cred(gnutls_kx_algorithm algorithm, i
/* Cipher Suite's functions */
gnutls_cipher_algorithm
-_gnutls_cipher_suite_get_cipher_algo(const GNUTLS_CipherSuite* suite)
+_gnutls_cipher_suite_get_cipher_algo(const cipher_suite_st* suite)
{
int ret = 0;
GNUTLS_CIPHER_SUITE_ALG_LOOP(ret = p->block_algorithm);
@@ -939,14 +939,14 @@ _gnutls_cipher_suite_get_cipher_algo(const GNUTLS_CipherSuite* suite)
}
gnutls_protocol_version
-_gnutls_cipher_suite_get_version(const GNUTLS_CipherSuite* suite)
+_gnutls_cipher_suite_get_version(const cipher_suite_st* suite)
{
int ret = 0;
GNUTLS_CIPHER_SUITE_ALG_LOOP(ret = p->version);
return ret;
}
-gnutls_kx_algorithm _gnutls_cipher_suite_get_kx_algo(const GNUTLS_CipherSuite*
+gnutls_kx_algorithm _gnutls_cipher_suite_get_kx_algo(const cipher_suite_st*
suite)
{
int ret = 0;
@@ -957,7 +957,7 @@ gnutls_kx_algorithm _gnutls_cipher_suite_get_kx_algo(const GNUTLS_CipherSuite*
}
gnutls_mac_algorithm
-_gnutls_cipher_suite_get_mac_algo(const GNUTLS_CipherSuite *suite)
+_gnutls_cipher_suite_get_mac_algo(const cipher_suite_st *suite)
{ /* In bytes */
int ret = 0;
GNUTLS_CIPHER_SUITE_ALG_LOOP(ret = p->mac_algorithm);
@@ -965,7 +965,7 @@ _gnutls_cipher_suite_get_mac_algo(const GNUTLS_CipherSuite *suite)
}
-const char *_gnutls_cipher_suite_get_name(GNUTLS_CipherSuite* suite)
+const char *_gnutls_cipher_suite_get_name(cipher_suite_st* suite)
{
const char *ret = NULL;
@@ -1006,7 +1006,7 @@ const char *gnutls_cipher_suite_get_name(gnutls_kx_algorithm kx_algorithm,
}
inline
-static int _gnutls_cipher_suite_is_ok(GNUTLS_CipherSuite *suite)
+static int _gnutls_cipher_suite_is_ok(cipher_suite_st *suite)
{
size_t ret;
const char *name = NULL;
@@ -1100,20 +1100,20 @@ _gnutls_compare_algo(gnutls_session session, const void *i_A1,
const void *i_A2)
{
gnutls_kx_algorithm kA1 =
- _gnutls_cipher_suite_get_kx_algo((const GNUTLS_CipherSuite *) i_A1);
+ _gnutls_cipher_suite_get_kx_algo((const cipher_suite_st *) i_A1);
gnutls_kx_algorithm kA2 =
- _gnutls_cipher_suite_get_kx_algo((const GNUTLS_CipherSuite *) i_A2);
+ _gnutls_cipher_suite_get_kx_algo((const cipher_suite_st *) i_A2);
gnutls_cipher_algorithm cA1 =
- _gnutls_cipher_suite_get_cipher_algo((const GNUTLS_CipherSuite *)
+ _gnutls_cipher_suite_get_cipher_algo((const cipher_suite_st *)
i_A1);
gnutls_cipher_algorithm cA2 =
- _gnutls_cipher_suite_get_cipher_algo((const GNUTLS_CipherSuite *)
+ _gnutls_cipher_suite_get_cipher_algo((const cipher_suite_st *)
i_A2);
gnutls_mac_algorithm mA1 =
- _gnutls_cipher_suite_get_mac_algo((const GNUTLS_CipherSuite *)
+ _gnutls_cipher_suite_get_mac_algo((const cipher_suite_st *)
i_A1);
gnutls_mac_algorithm mA2 =
- _gnutls_cipher_suite_get_mac_algo((const GNUTLS_CipherSuite *)
+ _gnutls_cipher_suite_get_mac_algo((const cipher_suite_st *)
i_A2);
int p1 = (_gnutls_kx_priority(session, kA1) + 1) * 64;
@@ -1157,7 +1157,7 @@ _gnutls_bsort(gnutls_session session, void *_base, size_t nmemb,
int
_gnutls_supported_ciphersuites_sorted(gnutls_session session,
- GNUTLS_CipherSuite ** ciphers)
+ cipher_suite_st ** ciphers)
{
#ifdef SORT_DEBUG
@@ -1179,7 +1179,7 @@ _gnutls_supported_ciphersuites_sorted(gnutls_session session,
#endif
_gnutls_qsort(session, *ciphers, count,
- sizeof(GNUTLS_CipherSuite), _gnutls_compare_algo);
+ sizeof(cipher_suite_st), _gnutls_compare_algo);
#ifdef SORT_DEBUG
_gnutls_debug_log( "Sorted: \n");
@@ -1193,24 +1193,24 @@ _gnutls_supported_ciphersuites_sorted(gnutls_session session,
int
_gnutls_supported_ciphersuites(gnutls_session session,
- GNUTLS_CipherSuite ** _ciphers)
+ cipher_suite_st ** _ciphers)
{
unsigned int i, ret_count, j;
unsigned int count = CIPHER_SUITES_COUNT;
- GNUTLS_CipherSuite *tmp_ciphers;
- GNUTLS_CipherSuite* ciphers;
+ cipher_suite_st *tmp_ciphers;
+ cipher_suite_st* ciphers;
gnutls_protocol_version version;
if (count == 0) {
return 0;
}
- tmp_ciphers = gnutls_alloca(count * sizeof(GNUTLS_CipherSuite));
+ tmp_ciphers = gnutls_alloca(count * sizeof(cipher_suite_st));
if ( tmp_ciphers==NULL)
return GNUTLS_E_MEMORY_ERROR;
- ciphers = gnutls_malloc(count * sizeof(GNUTLS_CipherSuite));
+ ciphers = gnutls_malloc(count * sizeof(cipher_suite_st));
if ( ciphers==NULL) {
gnutls_afree( tmp_ciphers);
return GNUTLS_E_MEMORY_ERROR;
@@ -1219,13 +1219,13 @@ _gnutls_supported_ciphersuites(gnutls_session session,
version = gnutls_protocol_get_version( session);
for (i = 0; i < count; i++) {
- memcpy( &tmp_ciphers[i], &cs_algorithms[i].id, sizeof( GNUTLS_CipherSuite));
+ memcpy( &tmp_ciphers[i], &cs_algorithms[i].id, sizeof( cipher_suite_st));
}
for (i = j = 0; i < count; i++) {
/* remove private cipher suites, if requested.
*/
- if ( tmp_ciphers[i].CipherSuite[0] == 0xFF &&
+ if ( tmp_ciphers[i].suite[0] == 0xFF &&
session->internals.enable_private == 0)
continue;
@@ -1250,7 +1250,7 @@ _gnutls_supported_ciphersuites(gnutls_session session,
< 0)
continue;
- memcpy( &ciphers[j], &tmp_ciphers[i], sizeof( GNUTLS_CipherSuite));
+ memcpy( &ciphers[j], &tmp_ciphers[i], sizeof( cipher_suite_st));
j++;
}
@@ -1260,7 +1260,7 @@ _gnutls_supported_ciphersuites(gnutls_session session,
if (ret_count > 0 && ret_count != count) {
ciphers =
gnutls_realloc_fast(ciphers,
- ret_count * sizeof(GNUTLS_CipherSuite));
+ ret_count * sizeof(cipher_suite_st));
} else {
if (ret_count != count) {
gnutls_free(ciphers);
diff --git a/lib/gnutls_algorithms.h b/lib/gnutls_algorithms.h
index e6551e5bbf..9962eb8a0d 100644
--- a/lib/gnutls_algorithms.h
+++ b/lib/gnutls_algorithms.h
@@ -36,16 +36,16 @@ int _gnutls_mac_is_ok(gnutls_mac_algorithm algorithm);
int _gnutls_mac_priority(gnutls_session session, gnutls_mac_algorithm algorithm);
/* functions for cipher suites */
-int _gnutls_supported_ciphersuites(gnutls_session session, GNUTLS_CipherSuite **ciphers);
-int _gnutls_supported_ciphersuites_sorted(gnutls_session session, GNUTLS_CipherSuite **ciphers);
+int _gnutls_supported_ciphersuites(gnutls_session session, cipher_suite_st **ciphers);
+int _gnutls_supported_ciphersuites_sorted(gnutls_session session, cipher_suite_st **ciphers);
int _gnutls_supported_compression_methods(gnutls_session session, uint8 **comp);
-const char* _gnutls_cipher_suite_get_name(GNUTLS_CipherSuite *algorithm);
-gnutls_cipher_algorithm _gnutls_cipher_suite_get_cipher_algo(const GNUTLS_CipherSuite *algorithm);
-gnutls_kx_algorithm _gnutls_cipher_suite_get_kx_algo(const GNUTLS_CipherSuite *algorithm);
-gnutls_mac_algorithm _gnutls_cipher_suite_get_mac_algo(const GNUTLS_CipherSuite *algorithm);
-gnutls_protocol_version _gnutls_cipher_suite_get_version(const GNUTLS_CipherSuite *algorithm);
-GNUTLS_CipherSuite _gnutls_cipher_suite_get_suite_name(GNUTLS_CipherSuite *algorithm);
+const char* _gnutls_cipher_suite_get_name(cipher_suite_st *algorithm);
+gnutls_cipher_algorithm _gnutls_cipher_suite_get_cipher_algo(const cipher_suite_st *algorithm);
+gnutls_kx_algorithm _gnutls_cipher_suite_get_kx_algo(const cipher_suite_st *algorithm);
+gnutls_mac_algorithm _gnutls_cipher_suite_get_mac_algo(const cipher_suite_st *algorithm);
+gnutls_protocol_version _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);
@@ -63,7 +63,7 @@ int _gnutls_kx_needs_dh_params(gnutls_kx_algorithm algorithm);
int _gnutls_kx_needs_rsa_params(gnutls_kx_algorithm algorithm);
-MOD_AUTH_STRUCT * _gnutls_kx_auth_struct(gnutls_kx_algorithm 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);
@@ -92,7 +92,7 @@ enum encipher_type _gnutls_kx_encipher_type(gnutls_kx_algorithm algorithm);
struct gnutls_kx_algo_entry {
const char *name;
gnutls_kx_algorithm algorithm;
- MOD_AUTH_STRUCT *auth_struct;
+ mod_auth_st *auth_struct;
int needs_dh_params;
int needs_rsa_params;
};
diff --git a/lib/gnutls_auth.c b/lib/gnutls_auth.c
index 8257bae6e6..a383ff1eaa 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_t * ccred, *ncred;
+ auth_cred_st * 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_t * ccred=NULL, *pcred=NULL;
+ auth_cred_st * ccred=NULL, *pcred=NULL;
int exists=0;
if (session->key->cred==NULL) { /* beginning of the list */
- session->key->cred = gnutls_malloc(sizeof(auth_cred_t));
+ session->key->cred = gnutls_malloc(sizeof(auth_cred_st));
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_t));
+ pcred->next = gnutls_malloc(sizeof(auth_cred_st));
if (pcred->next == NULL) return GNUTLS_E_MEMORY_ERROR;
ccred = pcred->next;
@@ -197,10 +197,10 @@ int server = session->security_parameters.entity==GNUTLS_SERVER?1:0;
return _gnutls_get_cred( session->key, _gnutls_map_kx_get_cred(algo, server), err);
}
-const void *_gnutls_get_cred( GNUTLS_KEY key, gnutls_credentials_type type, int *err) {
+const void *_gnutls_get_cred( gnutls_key_st key, gnutls_credentials_type type, int *err) {
const void *retval = NULL;
int _err = -1;
- auth_cred_t * ccred;
+ auth_cred_st * ccred;
if (key == NULL) goto out;
@@ -340,7 +340,7 @@ int _gnutls_auth_info_set( gnutls_session session,
/* this function will copy an mpi_t key to
* opaque data.
*/
-int _gnutls_generate_session_key(GNUTLS_KEY key) {
+int _gnutls_generate_session_key(gnutls_key_st key) {
size_t tmp;
_gnutls_mpi_print( NULL, &tmp, key->KEY);
diff --git a/lib/gnutls_auth.h b/lib/gnutls_auth.h
index 23d4326216..23cb6d742e 100644
--- a/lib/gnutls_auth.h
+++ b/lib/gnutls_auth.h
@@ -1,7 +1,7 @@
#ifndef GNUTLS_AUTH_H
# define GNUTLS_AUTH_H
-typedef struct MOD_AUTH_STRUCT_INT {
+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**);
@@ -16,6 +16,6 @@ typedef struct MOD_AUTH_STRUCT_INT {
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);
-} MOD_AUTH_STRUCT;
+} mod_auth_st;
#endif
diff --git a/lib/gnutls_auth_int.h b/lib/gnutls_auth_int.h
index a225ac1819..c8ee82e373 100644
--- a/lib/gnutls_auth_int.h
+++ b/lib/gnutls_auth_int.h
@@ -1,8 +1,8 @@
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 key, gnutls_credentials_type kx, int* err);
+const void *_gnutls_get_cred( gnutls_key_st key, gnutls_credentials_type kx, int* err);
const void *_gnutls_get_kx_cred( gnutls_session session, gnutls_kx_algorithm algo, int *err);
-int _gnutls_generate_session_key(GNUTLS_KEY key);
+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, int allow_change);
diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c
index 02d22370c0..aa31d7a70a 100644
--- a/lib/gnutls_buffers.c
+++ b/lib/gnutls_buffers.c
@@ -76,7 +76,7 @@ static int RET( int err) {
/* Buffers received packets of type APPLICATION DATA and
* HANDSHAKE DATA.
*/
-int _gnutls_record_buffer_put(ContentType type, gnutls_session session, opaque *data, size_t length)
+int _gnutls_record_buffer_put(content_type_t type, gnutls_session session, opaque *data, size_t length)
{
if (length==0) return 0;
switch( type) {
@@ -110,7 +110,7 @@ int _gnutls_record_buffer_put(ContentType type, gnutls_session session, opaque *
}
-int _gnutls_record_buffer_get_size(ContentType type, gnutls_session session)
+int _gnutls_record_buffer_get_size(content_type_t type, gnutls_session session)
{
switch( type) {
case GNUTLS_APPLICATION_DATA:
@@ -139,7 +139,7 @@ size_t gnutls_record_check_pending(gnutls_session session) {
return _gnutls_record_buffer_get_size(GNUTLS_APPLICATION_DATA, session);
}
-int _gnutls_record_buffer_get(ContentType type, gnutls_session session, opaque *data, size_t length)
+int _gnutls_record_buffer_get(content_type_t type, gnutls_session session, opaque *data, size_t length)
{
if (length==0 || data==NULL) {
gnutls_assert();
@@ -327,7 +327,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, size_t sizeOfPtr, ContentType recv_type)
+ssize_t _gnutls_io_read_buffered( gnutls_session session, opaque **iptr, size_t sizeOfPtr, content_type_t recv_type)
{
ssize_t ret=0, ret2=0;
size_t min;
@@ -715,7 +715,7 @@ 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, ContentType type, HandshakeType htype, const void *iptr, size_t n)
+ssize_t _gnutls_handshake_io_send_int( gnutls_session session, content_type_t type, HandshakeType htype, const void *iptr, size_t n)
{
size_t left;
ssize_t ret=0;
@@ -819,7 +819,7 @@ ssize_t _gnutls_handshake_io_send_int( gnutls_session session, ContentType type,
* protocol. Makes sure that we have received all data.
*/
ssize_t _gnutls_handshake_io_recv_int( gnutls_session session,
- ContentType type, HandshakeType htype, void *iptr, size_t sizeOfPtr)
+ content_type_t type, HandshakeType htype, void *iptr, size_t sizeOfPtr)
{
size_t left;
ssize_t i;
diff --git a/lib/gnutls_buffers.h b/lib/gnutls_buffers.h
index 59e378df3e..8552377971 100644
--- a/lib/gnutls_buffers.h
+++ b/lib/gnutls_buffers.h
@@ -18,10 +18,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-int _gnutls_record_buffer_put(ContentType type, gnutls_session session, opaque *data, size_t length);
-int _gnutls_record_buffer_get_size(ContentType type, gnutls_session session);
-int _gnutls_record_buffer_get(ContentType type, gnutls_session session, opaque *data, size_t length);
-ssize_t _gnutls_io_read_buffered( gnutls_session, opaque **iptr, size_t n, ContentType);
+int _gnutls_record_buffer_put(content_type_t type, gnutls_session 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, opaque *data, size_t length);
+ssize_t _gnutls_io_read_buffered( gnutls_session, 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);
@@ -41,8 +41,8 @@ int _gnutls_handshake_buffer_get_ptr( gnutls_session session, opaque **data_ptr,
_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, ContentType, HandshakeType, void *, size_t);
-ssize_t _gnutls_handshake_io_send_int( gnutls_session, ContentType, HandshakeType, const void *, size_t);
+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);
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
index fe3698f57e..c892624880 100644
--- a/lib/gnutls_cipher.c
+++ b/lib/gnutls_cipher.c
@@ -63,7 +63,7 @@ is_read_comp_null( gnutls_session session) {
*/
int _gnutls_encrypt(gnutls_session session, const opaque* headers, size_t headers_size,
const opaque *data, size_t data_size,
- opaque * ciphertext, size_t ciphertext_size, ContentType type, int random_pad)
+ opaque * ciphertext, size_t ciphertext_size, content_type_t type, int random_pad)
{
gnutls_datum plain;
gnutls_datum comp;
@@ -111,7 +111,7 @@ int _gnutls_encrypt(gnutls_session session, const opaque* headers, size_t header
*/
int _gnutls_decrypt(gnutls_session session, opaque *ciphertext,
size_t ciphertext_size, uint8 * data, size_t max_data_size,
- ContentType type)
+ content_type_t type)
{
gnutls_datum gtxt;
gnutls_datum gcipher;
@@ -163,10 +163,10 @@ int _gnutls_decrypt(gnutls_session session, opaque *ciphertext,
}
inline
-static GNUTLS_MAC_HANDLE
+static mac_hd_t
mac_init( gnutls_mac_algorithm mac, opaque* secret, int secret_size, int ver)
{
-GNUTLS_MAC_HANDLE td;
+mac_hd_t td;
if (mac == GNUTLS_MAC_NULL) return GNUTLS_MAC_FAILED;
@@ -183,7 +183,7 @@ GNUTLS_MAC_HANDLE td;
}
inline
-static void mac_deinit( GNUTLS_MAC_HANDLE td, opaque* res, int ver)
+static void mac_deinit( mac_hd_t td, opaque* res, int ver)
{
if ( ver == GNUTLS_SSL3) { /* SSL 3.0 */
_gnutls_mac_deinit_ssl3(td, res);
@@ -195,7 +195,7 @@ static void mac_deinit( GNUTLS_MAC_HANDLE td, opaque* res, int ver)
inline
static int calc_enc_length(
gnutls_session session, int data_size, int hash_size, uint8* pad,
- int random_pad, CipherType block_algo, uint16 blocksize)
+ int random_pad, cipher_type_t block_algo, uint16 blocksize)
{
uint8 rand;
int length;
@@ -252,14 +252,14 @@ int length;
*/
int _gnutls_compressed2ciphertext(gnutls_session session,
opaque* cipher_data, int cipher_size,
- gnutls_datum compressed, ContentType _type,
+ gnutls_datum compressed, content_type_t _type,
int random_pad)
{
uint8 MAC[MAX_HASH_SIZE];
uint16 c_length;
uint8 pad;
int length,ret;
- GNUTLS_MAC_HANDLE td;
+ mac_hd_t td;
uint8 type = _type;
uint8 major, minor;
int hash_size = _gnutls_hash_get_algo_len(session->security_parameters.write_mac_algorithm);
@@ -267,7 +267,7 @@ int _gnutls_compressed2ciphertext(gnutls_session session,
int blocksize =
_gnutls_cipher_get_block_size(session->security_parameters.
write_bulk_cipher_algorithm);
- CipherType block_algo = _gnutls_cipher_is_block(session->security_parameters.write_bulk_cipher_algorithm);
+ cipher_type_t block_algo = _gnutls_cipher_is_block(session->security_parameters.write_bulk_cipher_algorithm);
opaque* data_ptr;
@@ -368,7 +368,7 @@ int _gnutls_ciphertext2compressed(gnutls_session session,
uint16 c_length;
uint8 pad;
int length;
- GNUTLS_MAC_HANDLE td;
+ mac_hd_t td;
uint16 blocksize;
int ret, i, pad_failed = 0;
uint8 major, minor;
diff --git a/lib/gnutls_cipher.h b/lib/gnutls_cipher.h
index 088ecfc91f..bc89aad4ab 100644
--- a/lib/gnutls_cipher.h
+++ b/lib/gnutls_cipher.h
@@ -19,12 +19,12 @@
*/
int _gnutls_encrypt( gnutls_session session, const opaque* headers, size_t headers_size, const opaque* data, size_t data_size,
- opaque* ciphertext, size_t ciphertext_size, ContentType type, int random_pad);
+ opaque* ciphertext, size_t ciphertext_size, content_type_t type, int random_pad);
int _gnutls_decrypt(gnutls_session session, opaque *ciphertext,
size_t ciphertext_size, uint8 * data, size_t data_size,
- ContentType type);
+ content_type_t type);
int _gnutls_compressed2ciphertext(gnutls_session session, opaque* cipher_data, int cipher_size, gnutls_datum compressed,
- ContentType _type, int random_pad);
+ content_type_t _type, int random_pad);
int _gnutls_ciphertext2compressed(gnutls_session session, opaque * compress_data, int compress_size,
gnutls_datum ciphertext, uint8 type);
diff --git a/lib/gnutls_cipher_int.c b/lib/gnutls_cipher_int.c
index dc5d6121cc..c68a243736 100644
--- a/lib/gnutls_cipher_int.c
+++ b/lib/gnutls_cipher_int.c
@@ -25,10 +25,10 @@
#include <gnutls_cipher_int.h>
#include <gnutls_datum.h>
-GNUTLS_CIPHER_HANDLE _gnutls_cipher_init( gnutls_cipher_algorithm cipher,
+cipher_hd_t _gnutls_cipher_init( gnutls_cipher_algorithm cipher,
const gnutls_datum *key, const gnutls_datum *iv)
{
-GNUTLS_CIPHER_HANDLE ret = NULL;
+cipher_hd_t ret = NULL;
gcry_error_t err = GPG_ERR_GENERAL; /* doesn't matter */
@@ -67,7 +67,7 @@ gcry_error_t err = GPG_ERR_GENERAL; /* doesn't matter */
return ret;
}
-int _gnutls_cipher_encrypt(GNUTLS_CIPHER_HANDLE handle, void* text,
+int _gnutls_cipher_encrypt(cipher_hd_t handle, void* text,
int textlen)
{
if (handle!=GNUTLS_CIPHER_FAILED) {
@@ -79,7 +79,7 @@ int _gnutls_cipher_encrypt(GNUTLS_CIPHER_HANDLE handle, void* text,
return 0;
}
-int _gnutls_cipher_decrypt(GNUTLS_CIPHER_HANDLE handle, void* ciphertext,
+int _gnutls_cipher_decrypt(cipher_hd_t handle, void* ciphertext,
int ciphertextlen)
{
if (handle!=GNUTLS_CIPHER_FAILED) {
@@ -91,7 +91,7 @@ int _gnutls_cipher_decrypt(GNUTLS_CIPHER_HANDLE handle, void* ciphertext,
return 0;
}
-void _gnutls_cipher_deinit(GNUTLS_CIPHER_HANDLE handle)
+void _gnutls_cipher_deinit(cipher_hd_t handle)
{
if (handle!=GNUTLS_CIPHER_FAILED) {
gcry_cipher_close(handle);
diff --git a/lib/gnutls_cipher_int.h b/lib/gnutls_cipher_int.h
index fb2d48a9bd..b1dc79569d 100644
--- a/lib/gnutls_cipher_int.h
+++ b/lib/gnutls_cipher_int.h
@@ -21,13 +21,13 @@
#ifndef GNUTLS_CIPHER_INT
# define GNUTLS_CIPHER_INT
-#define GNUTLS_CIPHER_HANDLE gcry_cipher_hd_t
+#define cipher_hd_t gcry_cipher_hd_t
#define GNUTLS_CIPHER_FAILED NULL
-GNUTLS_CIPHER_HANDLE _gnutls_cipher_init( gnutls_cipher_algorithm cipher,
+cipher_hd_t _gnutls_cipher_init( gnutls_cipher_algorithm cipher,
const gnutls_datum *key, const gnutls_datum *iv);
-int _gnutls_cipher_encrypt(GNUTLS_CIPHER_HANDLE handle, void* text, int textlen);
-int _gnutls_cipher_decrypt(GNUTLS_CIPHER_HANDLE handle, void* ciphertext, int ciphertextlen);
-void _gnutls_cipher_deinit(GNUTLS_CIPHER_HANDLE handle);
+int _gnutls_cipher_encrypt(cipher_hd_t handle, void* text, int textlen);
+int _gnutls_cipher_decrypt(cipher_hd_t handle, void* ciphertext, int ciphertextlen);
+void _gnutls_cipher_deinit(cipher_hd_t handle);
#endif /* GNUTLS_CIPHER_INT */
diff --git a/lib/gnutls_compress_int.c b/lib/gnutls_compress_int.c
index 87ac63b895..7616e9212a 100644
--- a/lib/gnutls_compress_int.c
+++ b/lib/gnutls_compress_int.c
@@ -45,12 +45,12 @@ LZO_FUNC _gnutls_lzo1x_1_compress = NULL;
/* The flag d is the direction (compress, decompress). Non zero is
* decompress.
*/
-GNUTLS_COMP_HANDLE _gnutls_comp_init( gnutls_compression_method method, int d)
+comp_hd_t _gnutls_comp_init( gnutls_compression_method method, int d)
{
-GNUTLS_COMP_HANDLE ret;
+comp_hd_t ret;
int err;
- ret = gnutls_malloc( sizeof( struct GNUTLS_COMP_HANDLE_STRUCT));
+ ret = gnutls_malloc( sizeof( struct comp_hd_t_STRUCT));
if (ret==NULL) {
gnutls_assert();
return NULL;
@@ -121,7 +121,7 @@ int err;
return ret;
}
-void _gnutls_comp_deinit(GNUTLS_COMP_HANDLE handle, int d) {
+void _gnutls_comp_deinit(comp_hd_t handle, int d) {
int err;
if (handle!=NULL) {
@@ -146,7 +146,7 @@ int err;
/* These functions are memory consuming
*/
-int _gnutls_compress( GNUTLS_COMP_HANDLE handle, const opaque* plain, size_t plain_size,
+int _gnutls_compress( comp_hd_t handle, const opaque* plain, size_t plain_size,
opaque** compressed, size_t max_comp_size)
{
int compressed_size=GNUTLS_E_COMPRESSION_FAILED;
@@ -234,7 +234,7 @@ int err;
-int _gnutls_decompress( GNUTLS_COMP_HANDLE handle, opaque* compressed, size_t compressed_size,
+int _gnutls_decompress( comp_hd_t handle, opaque* compressed, size_t compressed_size,
opaque** plain, size_t max_record_size)
{
int plain_size=GNUTLS_E_DECOMPRESSION_FAILED, err;
diff --git a/lib/gnutls_compress_int.h b/lib/gnutls_compress_int.h
index 1d0db4605a..7c1bfd404a 100644
--- a/lib/gnutls_compress_int.h
+++ b/lib/gnutls_compress_int.h
@@ -27,15 +27,15 @@
#define GNUTLS_COMP_FAILED NULL
-typedef struct GNUTLS_COMP_HANDLE_STRUCT {
+typedef struct comp_hd_t_STRUCT {
void* handle;
gnutls_compression_method algo;
-} *GNUTLS_COMP_HANDLE;
+} *comp_hd_t;
-GNUTLS_COMP_HANDLE _gnutls_comp_init( gnutls_compression_method, int d);
-void _gnutls_comp_deinit(GNUTLS_COMP_HANDLE handle, int d);
+comp_hd_t _gnutls_comp_init( gnutls_compression_method, int d);
+void _gnutls_comp_deinit(comp_hd_t handle, int d);
-int _gnutls_decompress( GNUTLS_COMP_HANDLE handle, opaque* compressed, size_t compressed_size, opaque** plain, size_t max_record_size);
-int _gnutls_compress( GNUTLS_COMP_HANDLE, const opaque* plain, size_t plain_size, opaque** compressed, size_t max_comp_size);
+int _gnutls_decompress( comp_hd_t handle, opaque* compressed, size_t compressed_size, opaque** plain, size_t max_record_size);
+int _gnutls_compress( comp_hd_t, const opaque* plain, size_t plain_size, opaque** compressed, size_t max_comp_size);
#endif
diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c
index c2859b947f..768a0b6c4d 100644
--- a/lib/gnutls_constate.c
+++ b/lib/gnutls_constate.c
@@ -393,7 +393,7 @@ int _gnutls_set_write_keys(gnutls_session session)
#define CPY_COMMON dst->entity = src->entity; \
dst->kx_algorithm = src->kx_algorithm; \
- memcpy( &dst->current_cipher_suite, &src->current_cipher_suite, sizeof(GNUTLS_CipherSuite)); \
+ memcpy( &dst->current_cipher_suite, &src->current_cipher_suite, sizeof(cipher_suite_st)); \
memcpy( dst->master_secret, src->master_secret, TLS_MASTER_SIZE); \
memcpy( dst->client_random, src->client_random, TLS_RANDOM_SIZE); \
memcpy( dst->server_random, src->server_random, TLS_RANDOM_SIZE); \
@@ -404,10 +404,10 @@ int _gnutls_set_write_keys(gnutls_session session)
dst->max_record_recv_size = src->max_record_recv_size; \
dst->max_record_send_size = src->max_record_send_size; \
dst->version = src->version; \
- memcpy( &dst->extensions, &src->extensions, sizeof(TLSExtensions));
+ memcpy( &dst->extensions, &src->extensions, sizeof(tls_ext_st));
-static void _gnutls_cpy_read_security_parameters(SecurityParameters * dst,
- SecurityParameters * src)
+static void _gnutls_cpy_read_security_parameters(security_parameters_st * dst,
+ security_parameters_st * src)
{
CPY_COMMON;
@@ -416,8 +416,8 @@ static void _gnutls_cpy_read_security_parameters(SecurityParameters * dst,
dst->read_compression_algorithm = src->read_compression_algorithm;
}
-static void _gnutls_cpy_write_security_parameters(SecurityParameters * dst,
- SecurityParameters * src)
+static void _gnutls_cpy_write_security_parameters(security_parameters_st * dst,
+ security_parameters_st * src)
{
CPY_COMMON;
diff --git a/lib/gnutls_db.c b/lib/gnutls_db.c
index f54f1307d1..a58c17b52e 100644
--- a/lib/gnutls_db.c
+++ b/lib/gnutls_db.c
@@ -137,7 +137,7 @@ time_t timestamp;
timestamp = time(0);
if (session_entry.data != NULL)
- if ( timestamp - ((SecurityParameters*)(session_entry.data))->timestamp <= session->internals.expire_time || ((SecurityParameters*)(session_entry.data))->timestamp > timestamp|| ((SecurityParameters*)(session_entry.data))->timestamp == 0)
+ if ( timestamp - ((security_parameters_st*)(session_entry.data))->timestamp <= session->internals.expire_time || ((security_parameters_st*)(session_entry.data))->timestamp > timestamp|| ((security_parameters_st*)(session_entry.data))->timestamp == 0)
return GNUTLS_E_EXPIRED;
return 0;
diff --git a/lib/gnutls_dh_primes.c b/lib/gnutls_dh_primes.c
index 442d8e052f..061868093a 100644
--- a/lib/gnutls_dh_primes.c
+++ b/lib/gnutls_dh_primes.c
@@ -175,7 +175,7 @@ int gnutls_dh_params_import_raw(gnutls_dh_params dh_params, const gnutls_datum *
int gnutls_dh_params_init(gnutls_dh_params * dh_params)
{
- (*dh_params) = gnutls_calloc(1, sizeof(_gnutls_dh_params));
+ (*dh_params) = gnutls_calloc(1, sizeof(dh_params_st));
if (*dh_params == NULL) {
gnutls_assert();
return GNUTLS_E_MEMORY_ERROR;
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
index c7c98edcc9..150e1864d6 100644
--- a/lib/gnutls_handshake.c
+++ b/lib/gnutls_handshake.c
@@ -94,9 +94,9 @@ static void resume_copy_required_values(gnutls_session session)
* hello message.
*/
memcpy(session->security_parameters.current_cipher_suite.
- CipherSuite,
+ suite,
session->internals.resumed_security_parameters.
- current_cipher_suite.CipherSuite, 2);
+ current_cipher_suite.suite, 2);
session->internals.compression_method =
session->internals.resumed_security_parameters.read_compression_algorithm;
@@ -140,8 +140,8 @@ void _gnutls_set_client_random(gnutls_session session, uint8 * random)
static int _gnutls_ssl3_finished(gnutls_session session, int type, opaque * ret)
{
const int siz = SSL_MSG_LEN;
- GNUTLS_MAC_HANDLE td_md5;
- GNUTLS_MAC_HANDLE td_sha;
+ mac_hd_t td_md5;
+ mac_hd_t td_sha;
const char *mesg;
td_md5 = _gnutls_hash_copy( session->internals.handshake_mac_handle_md5);
@@ -182,8 +182,8 @@ int _gnutls_finished(gnutls_session session, int type, void *ret)
const int siz = TLS_MSG_LEN;
opaque concat[36];
const char *mesg;
- GNUTLS_MAC_HANDLE td_md5;
- GNUTLS_MAC_HANDLE td_sha;
+ mac_hd_t td_md5;
+ mac_hd_t td_sha;
td_md5 = _gnutls_hash_copy( session->internals.handshake_mac_handle_md5);
@@ -516,7 +516,7 @@ static int _gnutls_server_find_pk_algos_in_ciphersuites( const opaque* data, int
int j;
gnutls_pk_algorithm algo=GNUTLS_PK_NONE, prev_algo = 0;
gnutls_kx_algorithm kx;
-GNUTLS_CipherSuite cs;
+cipher_suite_st cs;
if (datalen % 2 != 0) {
gnutls_assert();
@@ -524,7 +524,7 @@ GNUTLS_CipherSuite cs;
}
for (j = 0; j < datalen; j += 2) {
- memcpy( &cs.CipherSuite, &data[j], 2);
+ memcpy( &cs.suite, &data[j], 2);
kx = _gnutls_cipher_suite_get_kx_algo( &cs);
if ( _gnutls_map_kx_get_cred( kx, 1) == GNUTLS_CRD_CERTIFICATE) {
@@ -545,7 +545,7 @@ GNUTLS_CipherSuite cs;
int _gnutls_server_select_suite(gnutls_session session, opaque *data, int datalen)
{
int x, i, j;
- GNUTLS_CipherSuite *ciphers, cs;
+ cipher_suite_st *ciphers, cs;
int retval, err;
gnutls_pk_algorithm pk_algo; /* will hold the pk algorithms
* supported by the peer.
@@ -584,7 +584,7 @@ int _gnutls_server_select_suite(gnutls_session session, opaque *data, int datale
_gnutls_handshake_log("HSK[%x]: Requested cipher suites: \n", session);
for (j = 0; j < datalen; j += 2) {
- memcpy( &cs.CipherSuite, &data[j], 2);
+ memcpy( &cs.suite, &data[j], 2);
_gnutls_handshake_log("\t%s\n",
_gnutls_cipher_suite_get_name(&cs));
}
@@ -593,19 +593,19 @@ int _gnutls_server_select_suite(gnutls_session session, opaque *data, int datale
_gnutls_handshake_log("\t%s\n",
_gnutls_cipher_suite_get_name(&ciphers[j]));
#endif
- memset(session->security_parameters.current_cipher_suite.CipherSuite, '\0', 2);
+ memset(session->security_parameters.current_cipher_suite.suite, '\0', 2);
retval = GNUTLS_E_UNKNOWN_CIPHER_SUITE;
for (j = 0; j < datalen; j += 2) {
for (i = 0; i < x; i++) {
- if (memcmp(ciphers[i].CipherSuite, &data[j], 2) ==
+ if (memcmp(ciphers[i].suite, &data[j], 2) ==
0) {
- memcpy( &cs.CipherSuite, &data[j], 2);
+ memcpy( &cs.suite, &data[j], 2);
_gnutls_handshake_log("HSK[%x]: Selected cipher suite: %s\n",
session, _gnutls_cipher_suite_get_name(&cs));
- memcpy(session->security_parameters.current_cipher_suite.CipherSuite, ciphers[i].CipherSuite, 2);
+ memcpy(session->security_parameters.current_cipher_suite.suite, ciphers[i].suite, 2);
retval = 0;
goto finish;
}
@@ -631,7 +631,7 @@ int _gnutls_server_select_suite(gnutls_session session, opaque *data, int datale
}
- /* set the MOD_AUTH_STRUCT to the appropriate struct
+ /* set the mod_auth_st to the appropriate struct
* according to the KX algorithm. This is needed since all the
* handshake functions are read from there;
*/
@@ -1112,7 +1112,7 @@ static int _gnutls_client_set_ciphersuite(gnutls_session session,
opaque suite[2])
{
uint8 z;
- GNUTLS_CipherSuite *cipher_suites;
+ cipher_suite_st *cipher_suites;
int cipher_suite_num;
int i, err;
@@ -1137,7 +1137,7 @@ static int _gnutls_client_set_ciphersuite(gnutls_session session,
}
memcpy(session->security_parameters.
- current_cipher_suite.CipherSuite, suite, 2);
+ current_cipher_suite.suite, suite, 2);
_gnutls_handshake_log("HSK[%x]: Selected cipher suite: %s\n", session,
_gnutls_cipher_suite_get_name(&session->
@@ -1158,7 +1158,7 @@ static int _gnutls_client_set_ciphersuite(gnutls_session session,
}
- /* set the MOD_AUTH_STRUCT to the appropriate struct
+ /* set the mod_auth_st to the appropriate struct
* according to the KX algorithm. This is needed since all the
* handshake functions are read from there;
*/
@@ -1362,7 +1362,7 @@ static int _gnutls_copy_ciphersuites(gnutls_session session,
opaque * ret_data, size_t ret_data_size)
{
int ret, i;
- GNUTLS_CipherSuite *cipher_suites;
+ cipher_suite_st *cipher_suites;
uint16 cipher_num;
int datalen, pos;
@@ -1410,7 +1410,7 @@ static int _gnutls_copy_ciphersuites(gnutls_session session,
pos += 2;
for (i = 0; i < (cipher_num / 2); i++) {
- memcpy( &ret_data[pos], cipher_suites[i].CipherSuite, 2);
+ memcpy( &ret_data[pos], cipher_suites[i].suite, 2);
pos += 2;
}
gnutls_free(cipher_suites);
@@ -1710,7 +1710,7 @@ static int _gnutls_send_server_hello(gnutls_session session, int again)
memcpy(&data[pos],
session->security_parameters.
- current_cipher_suite.CipherSuite, 2);
+ current_cipher_suite.suite, 2);
pos += 2;
comp =
@@ -2436,13 +2436,13 @@ inline static int check_server_params( gnutls_session session, gnutls_kx_algorit
* by checking certificates etc.
*/
int _gnutls_remove_unwanted_ciphersuites(gnutls_session session,
- GNUTLS_CipherSuite **
+ cipher_suite_st **
cipherSuites, int numCipherSuites,
gnutls_pk_algorithm requested_pk_algo)
{
int ret = 0;
- GNUTLS_CipherSuite *newSuite, cs;
+ cipher_suite_st *newSuite, cs;
int newSuiteSize = 0, i, remove;
const gnutls_certificate_credentials x509_cred;
gnutls_kx_algorithm kx;
@@ -2481,7 +2481,7 @@ int _gnutls_remove_unwanted_ciphersuites(gnutls_session session,
}
newSuite =
- gnutls_malloc(numCipherSuites * sizeof(GNUTLS_CipherSuite));
+ gnutls_malloc(numCipherSuites * sizeof(cipher_suite_st));
if (newSuite == NULL) {
gnutls_assert();
gnutls_free(alg);
@@ -2510,15 +2510,15 @@ int _gnutls_remove_unwanted_ciphersuites(gnutls_session session,
- memcpy( &cs.CipherSuite, &(*cipherSuites)[i].CipherSuite, 2);
+ memcpy( &cs.suite, &(*cipherSuites)[i].suite, 2);
if (remove == 0) {
_gnutls_handshake_log("HSK[%x]: Keeping ciphersuite: %s\n", session,
_gnutls_cipher_suite_get_name(&cs));
- memcpy(newSuite[newSuiteSize].CipherSuite,
- (*cipherSuites)[i].CipherSuite, 2);
+ memcpy(newSuite[newSuiteSize].suite,
+ (*cipherSuites)[i].suite, 2);
newSuiteSize++;
} else {
_gnutls_handshake_log("HSK[%x]: Removing ciphersuite: %s\n", session,
diff --git a/lib/gnutls_handshake.h b/lib/gnutls_handshake.h
index 2b8aa94255..5a86c9be74 100644
--- a/lib/gnutls_handshake.h
+++ b/lib/gnutls_handshake.h
@@ -34,7 +34,7 @@ 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_tls_create_random( opaque* dst);
-int _gnutls_remove_unwanted_ciphersuites( gnutls_session session, GNUTLS_CipherSuite ** cipherSuites, int numCipherSuites, gnutls_pk_algorithm);
+int _gnutls_remove_unwanted_ciphersuites( gnutls_session session, cipher_suite_st ** cipherSuites, int numCipherSuites, gnutls_pk_algorithm);
void gnutls_handshake_set_max_packet_length( gnutls_session 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 datalen);
diff --git a/lib/gnutls_hash_int.c b/lib/gnutls_hash_int.c
index 9bb191f9a4..7cecfa705c 100644
--- a/lib/gnutls_hash_int.c
+++ b/lib/gnutls_hash_int.c
@@ -31,10 +31,10 @@
GNUTLS_HASH_HANDLE _gnutls_hash_init(gnutls_mac_algorithm algorithm)
{
- GNUTLS_MAC_HANDLE ret;
+ mac_hd_t ret;
gcry_error_t result;
- ret = gnutls_malloc(sizeof(GNUTLS_MAC_HANDLE_INT));
+ ret = gnutls_malloc(sizeof(mac_hd_t_INT));
if (ret == NULL) {
gnutls_assert();
return GNUTLS_HASH_FAILED;
@@ -100,7 +100,7 @@ GNUTLS_HASH_HANDLE _gnutls_hash_copy(GNUTLS_HASH_HANDLE handle)
GNUTLS_HASH_HANDLE ret;
gcry_error_t result;
- ret = gnutls_malloc(sizeof(GNUTLS_MAC_HANDLE_INT));
+ ret = gnutls_malloc(sizeof(mac_hd_t_INT));
if (ret == NULL)
return GNUTLS_HASH_FAILED;
@@ -137,13 +137,13 @@ void _gnutls_hash_deinit(GNUTLS_HASH_HANDLE handle, void *digest)
}
-GNUTLS_MAC_HANDLE _gnutls_hmac_init(gnutls_mac_algorithm algorithm,
+mac_hd_t _gnutls_hmac_init(gnutls_mac_algorithm algorithm,
const void *key, int keylen)
{
- GNUTLS_MAC_HANDLE ret;
+ mac_hd_t ret;
gcry_error_t result;
- ret = gnutls_malloc(sizeof(GNUTLS_MAC_HANDLE_INT));
+ ret = gnutls_malloc(sizeof(mac_hd_t_INT));
if (ret == NULL)
return GNUTLS_MAC_FAILED;
@@ -177,7 +177,7 @@ GNUTLS_MAC_HANDLE _gnutls_hmac_init(gnutls_mac_algorithm algorithm,
return ret;
}
-void _gnutls_hmac_deinit(GNUTLS_MAC_HANDLE handle, void *digest)
+void _gnutls_hmac_deinit(mac_hd_t handle, void *digest)
{
opaque *mac;
int maclen;
@@ -207,10 +207,10 @@ inline static int get_padsize( gnutls_mac_algorithm algorithm)
}
}
-GNUTLS_MAC_HANDLE _gnutls_mac_init_ssl3(gnutls_mac_algorithm algorithm, void *key,
+mac_hd_t _gnutls_mac_init_ssl3(gnutls_mac_algorithm algorithm, void *key,
int keylen)
{
- GNUTLS_MAC_HANDLE ret;
+ mac_hd_t ret;
opaque ipad[48];
int padsize;
@@ -235,10 +235,10 @@ GNUTLS_MAC_HANDLE _gnutls_mac_init_ssl3(gnutls_mac_algorithm algorithm, void *ke
return ret;
}
-void _gnutls_mac_deinit_ssl3(GNUTLS_MAC_HANDLE handle, void *digest)
+void _gnutls_mac_deinit_ssl3(mac_hd_t handle, void *digest)
{
opaque ret[MAX_HASH_SIZE];
- GNUTLS_MAC_HANDLE td;
+ mac_hd_t td;
opaque opad[48];
int padsize;
int block;
@@ -265,12 +265,12 @@ void _gnutls_mac_deinit_ssl3(GNUTLS_MAC_HANDLE handle, void *digest)
}
}
-void _gnutls_mac_deinit_ssl3_handshake(GNUTLS_MAC_HANDLE handle,
+void _gnutls_mac_deinit_ssl3_handshake(mac_hd_t handle,
void *digest, opaque * key,
uint32 key_size)
{
opaque ret[MAX_HASH_SIZE];
- GNUTLS_MAC_HANDLE td;
+ mac_hd_t td;
opaque opad[48];
opaque ipad[48];
int padsize;
@@ -334,7 +334,7 @@ static int ssl3_md5(int i, opaque *secret, int secret_len, opaque *random,
int random_len, void *digest)
{
opaque tmp[MAX_HASH_SIZE];
- GNUTLS_MAC_HANDLE td;
+ mac_hd_t td;
int ret;
td = _gnutls_hash_init(GNUTLS_MAC_MD5);
@@ -363,7 +363,7 @@ int _gnutls_ssl3_hash_md5(void *first, int first_len,
opaque * ret)
{
opaque digest[MAX_HASH_SIZE];
- GNUTLS_MAC_HANDLE td;
+ mac_hd_t td;
int block = _gnutls_hash_get_algo_len(GNUTLS_MAC_MD5);
td = _gnutls_hash_init(GNUTLS_MAC_MD5);
diff --git a/lib/gnutls_hash_int.h b/lib/gnutls_hash_int.h
index eee1db96f3..15c7e19514 100644
--- a/lib/gnutls_hash_int.h
+++ b/lib/gnutls_hash_int.h
@@ -30,20 +30,20 @@ typedef struct {
gnutls_mac_algorithm algorithm;
const void* key;
int keysize;
-} GNUTLS_MAC_HANDLE_INT;
-typedef GNUTLS_MAC_HANDLE_INT* GNUTLS_MAC_HANDLE;
-typedef GNUTLS_MAC_HANDLE GNUTLS_HASH_HANDLE;
+} mac_hd_t_INT;
+typedef mac_hd_t_INT* mac_hd_t;
+typedef mac_hd_t GNUTLS_HASH_HANDLE;
#define GNUTLS_HASH_FAILED NULL
#define GNUTLS_MAC_FAILED NULL
-GNUTLS_MAC_HANDLE _gnutls_hmac_init( gnutls_mac_algorithm algorithm, const void* key, int keylen);
+mac_hd_t _gnutls_hmac_init( gnutls_mac_algorithm 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( GNUTLS_MAC_HANDLE handle, void* digest);
+void _gnutls_hmac_deinit( mac_hd_t handle, void* digest);
-GNUTLS_MAC_HANDLE _gnutls_mac_init_ssl3( gnutls_mac_algorithm algorithm, void* key, int keylen);
-void _gnutls_mac_deinit_ssl3( GNUTLS_MAC_HANDLE handle, void* digest);
+mac_hd_t _gnutls_mac_init_ssl3( gnutls_mac_algorithm 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);
@@ -54,7 +54,7 @@ int _gnutls_ssl3_generate_random(void *secret, int secret_len, void *random, int
int _gnutls_ssl3_hash_md5(void *first, int first_len,
void *second, int second_len, int ret_len, opaque* ret);
-void _gnutls_mac_deinit_ssl3_handshake(GNUTLS_MAC_HANDLE handle, void* digest, opaque* key, uint32 key_size);
+void _gnutls_mac_deinit_ssl3_handshake(mac_hd_t handle, void* digest, opaque* key, uint32 key_size);
GNUTLS_HASH_HANDLE _gnutls_hash_copy(GNUTLS_HASH_HANDLE handle);
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index e9cbab910c..b9415b9c12 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -184,25 +184,25 @@ typedef enum gnutls_compression_method { GNUTLS_COMP_NULL=1, GNUTLS_COMP_DEFLATE
typedef enum gnutls_connection_end { GNUTLS_SERVER=1, GNUTLS_CLIENT } gnutls_connection_end;
-typedef enum Extensions { GNUTLS_EXTENSION_SERVER_NAME=0,
+typedef enum extensions_t { GNUTLS_EXTENSION_SERVER_NAME=0,
GNUTLS_EXTENSION_MAX_RECORD_SIZE=1, GNUTLS_EXTENSION_SRP=6,
GNUTLS_EXTENSION_CERT_TYPE=7
-} Extensions;
+} extensions_t;
typedef enum gnutls_credentials_type { GNUTLS_CRD_CERTIFICATE=1, GNUTLS_CRD_ANON, GNUTLS_CRD_SRP } gnutls_credentials_type;
typedef enum gnutls_certificate_type { GNUTLS_CRT_X509=1, GNUTLS_CRT_OPENPGP
} gnutls_certificate_type;
-typedef enum CipherType { CIPHER_STREAM, CIPHER_BLOCK } CipherType;
+typedef enum { CIPHER_STREAM, CIPHER_BLOCK } cipher_type_t;
-typedef enum ValidSession { VALID_TRUE, VALID_FALSE } ValidSession;
-typedef enum ResumableSession { RESUME_TRUE, RESUME_FALSE } ResumableSession;
+typedef enum valid_session_t { VALID_TRUE, VALID_FALSE } valid_session_t;
+typedef enum resumable_session_t { RESUME_TRUE, RESUME_FALSE } resumable_session_t;
/* Record Protocol */
-typedef enum ContentType { GNUTLS_CHANGE_CIPHER_SPEC=20, GNUTLS_ALERT,
+typedef enum content_type_t { GNUTLS_CHANGE_CIPHER_SPEC=20, GNUTLS_ALERT,
GNUTLS_HANDSHAKE, GNUTLS_APPLICATION_DATA
-} ContentType;
+} content_type_t;
typedef enum gnutls_x509_crt_fmt { GNUTLS_X509_FMT_DER,
GNUTLS_X509_FMT_PEM } gnutls_x509_crt_fmt;
@@ -234,17 +234,17 @@ 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_t {
+typedef struct auth_cred_st {
gnutls_credentials_type algorithm;
/* the type of credentials depends on algorithm
*/
void* credentials;
- struct auth_cred_t* next;
-} auth_cred_t;
+ struct auth_cred_st* next;
+} auth_cred_st;
-struct GNUTLS_KEY_INT {
+struct gnutls_key_st {
/* For DH KX */
gnutls_datum key;
mpi_t KEY;
@@ -275,7 +275,7 @@ struct GNUTLS_KEY_INT {
*/
uint8 crypt_algo;
- auth_cred_t* cred; /* used to specify keys/certificates etc */
+ auth_cred_st* cred; /* used to specify keys/certificates etc */
int certificate_requested;
/* some ciphersuites use this
@@ -287,7 +287,7 @@ struct GNUTLS_KEY_INT {
* for a client certificate verify
*/
};
-typedef struct GNUTLS_KEY_INT* GNUTLS_KEY;
+typedef struct gnutls_key_st* gnutls_key_st;
/* STATE (cont) */
@@ -298,8 +298,8 @@ typedef struct GNUTLS_KEY_INT* GNUTLS_KEY;
#include <gnutls_cert.h>
typedef struct {
- uint8 CipherSuite[2];
-} GNUTLS_CipherSuite;
+ uint8 suite[2];
+} cipher_suite_st;
/* Versions should be in order of the oldest
* (eg. SSL3 is before TLS1)
@@ -330,7 +330,7 @@ typedef struct {
/* limit server_name extensions */
uint server_names_size;
opaque srp_username[MAX_SRP_USERNAME];
-} TLSExtensions;
+} tls_ext_st;
/* auth_info_t structures now MAY contain malloced
* elements.
@@ -369,14 +369,14 @@ typedef struct {
* moved here from internals in order to be restored
* on resume;
*/
- GNUTLS_CipherSuite current_cipher_suite;
+ cipher_suite_st current_cipher_suite;
opaque master_secret[TLS_MASTER_SIZE];
opaque client_random[TLS_RANDOM_SIZE];
opaque server_random[TLS_RANDOM_SIZE];
opaque session_id[TLS_MAX_SESSION_ID_SIZE];
uint8 session_id_size;
time_t timestamp;
- TLSExtensions extensions;
+ tls_ext_st extensions;
/* The send size is the one requested by the programmer.
* The recv size is the one negotiated with the peer.
@@ -386,7 +386,7 @@ typedef struct {
/* holds the negotiated certificate type */
gnutls_certificate_type cert_type;
gnutls_protocol_version version; /* moved here */
-} SecurityParameters;
+} security_parameters_st;
/* This structure holds the generated keys
*/
@@ -401,25 +401,25 @@ typedef struct {
* been generated. Non zero
* otherwise.
*/
-} CipherSpecs;
+} cipher_specs_st;
typedef struct {
- GNUTLS_CIPHER_HANDLE write_cipher_state;
- GNUTLS_CIPHER_HANDLE read_cipher_state;
- GNUTLS_COMP_HANDLE read_compression_state;
- GNUTLS_COMP_HANDLE write_compression_state;
+ cipher_hd_t write_cipher_state;
+ 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;
uint64 read_sequence_number;
uint64 write_sequence_number;
-} ConnectionState;
+} conn_stat_st;
typedef struct {
unsigned int priority[MAX_ALGOS];
unsigned int algorithms;
-} GNUTLS_Priority;
+} priority_st;
/* DH and RSA parameters types.
*/
@@ -427,20 +427,20 @@ typedef struct {
/* [0] is the prime, [1] is the generator.
*/
mpi_t params[2];
-} _gnutls_dh_params;
+} dh_params_st;
-#define gnutls_dh_params _gnutls_dh_params*
+#define gnutls_dh_params dh_params_st*
#define gnutls_rsa_params gnutls_x509_privkey
-typedef struct gnutls_internal_params {
+typedef struct {
gnutls_dh_params anon_dh_params;
int free_anon_dh_params;
gnutls_dh_params cert_dh_params;
int free_cert_dh_params;
gnutls_rsa_params rsa_params;
int free_rsa_params;
-} gnutls_internal_params;
+} internal_params_st;
typedef struct gnutls_params_st {
gnutls_params_type type;
@@ -460,7 +460,7 @@ typedef struct {
/* this holds the length of the handshake packet */
size_t packet_length;
HandshakeType recv_type;
-} HANDSHAKE_HEADER_BUFFER;
+} handshake_header_buffer_st;
/* Openpgp key retrieval callback */
typedef int (*gnutls_openpgp_recv_key_func)(struct gnutls_session_int*,
@@ -470,11 +470,11 @@ typedef struct {
gnutls_buffer application_data_buffer; /* holds data to be delivered to application layer */
gnutls_buffer handshake_hash_buffer; /* used to keep the last received handshake
* message */
- GNUTLS_MAC_HANDLE handshake_mac_handle_sha; /* hash of the handshake messages */
- GNUTLS_MAC_HANDLE handshake_mac_handle_md5; /* hash of the handshake messages */
+ mac_hd_t handshake_mac_handle_sha; /* hash of the handshake messages */
+ mac_hd_t handshake_mac_handle_md5; /* hash of the handshake messages */
gnutls_buffer handshake_data_buffer; /* this is a buffer that holds the current handshake message */
- ResumableSession resumable; /* TRUE or FALSE - if we can resume that session */
+ resumable_session_t resumable; /* TRUE or FALSE - if we can resume that session */
HandshakeState handshake_state; /* holds
* a number which indicates where
* the handshake procedure has been
@@ -482,7 +482,7 @@ typedef struct {
* no interruption has happened.
*/
- ValidSession valid_connection; /* true or FALSE - if this session is valid */
+ valid_session_t valid_connection; /* true or FALSE - if this session is valid */
int may_not_read; /* if it's 0 then we can read/write, otherwise it's forbiden to read/write
*/
@@ -499,16 +499,16 @@ typedef struct {
/* this is the compression method we are going to use */
gnutls_compression_method compression_method;
/* priorities */
- GNUTLS_Priority cipher_algorithm_priority;
- GNUTLS_Priority mac_algorithm_priority;
- GNUTLS_Priority kx_algorithm_priority;
- GNUTLS_Priority compression_method_priority;
- GNUTLS_Priority protocol_priority;
- GNUTLS_Priority cert_type_priority;
+ priority_st cipher_algorithm_priority;
+ priority_st mac_algorithm_priority;
+ priority_st kx_algorithm_priority;
+ priority_st compression_method_priority;
+ priority_st protocol_priority;
+ priority_st cert_type_priority;
/* resumed session */
- ResumableSession resumed; /* RESUME_TRUE or FALSE - if we are resuming a session */
- SecurityParameters resumed_security_parameters;
+ resumable_session_t resumed; /* RESUME_TRUE or FALSE - if we are resuming a session */
+ security_parameters_st resumed_security_parameters;
/* sockets internals */
int lowat;
@@ -518,9 +518,9 @@ typedef struct {
*/
gnutls_buffer handshake_send_buffer;
size_t handshake_send_buffer_prev_size;
- ContentType handshake_send_buffer_type;
+ content_type_t handshake_send_buffer_type;
HandshakeType handshake_send_buffer_htype;
- ContentType handshake_recv_buffer_type;
+ content_type_t handshake_recv_buffer_type;
HandshakeType handshake_recv_buffer_htype;
gnutls_buffer handshake_recv_buffer;
@@ -545,13 +545,13 @@ typedef struct {
int have_peeked_data;
int expire_time; /* after expire_time seconds this session will expire */
- struct MOD_AUTH_STRUCT_INT* auth_struct; /* used in handshake packets and KX algorithms */
+ struct mod_auth_st_int* auth_struct; /* used in handshake packets and KX algorithms */
int v2_hello; /* 0 if the client hello is v3+.
* non-zero if we got a v2 hello.
*/
/* keeps the headers of the handshake packet
*/
- HANDSHAKE_HEADER_BUFFER handshake_header_buffer;
+ handshake_header_buffer_st handshake_header_buffer;
/* this is the highest version available
* to the peer. (advertized version).
@@ -664,7 +664,7 @@ typedef struct {
* credentials structure, or from a callback. That is to
* minimize external calls.
*/
- gnutls_internal_params params;
+ internal_params_st params;
/* This buffer is used by the record recv functions,
* as a temporary store buffer.
@@ -673,14 +673,14 @@ typedef struct {
/* If you add anything here, check _gnutls_handshake_internal_state_clear().
*/
-} GNUTLS_INTERNALS;
+} internals_st;
struct gnutls_session_int {
- SecurityParameters security_parameters;
- CipherSpecs cipher_specs;
- ConnectionState connection_state;
- GNUTLS_INTERNALS internals;
- GNUTLS_KEY key;
+ security_parameters_st security_parameters;
+ cipher_specs_st cipher_specs;
+ conn_stat_st connection_state;
+ internals_st internals;
+ gnutls_key_st key;
};
typedef struct gnutls_session_int *gnutls_session;
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
index f31c55c219..30e95f3585 100644
--- a/lib/gnutls_record.c
+++ b/lib/gnutls_record.c
@@ -256,7 +256,7 @@ gnutls_protocol_version lver;
}
/* This function behaves exactly like write(). The only difference is
- * that it accepts, the gnutls_session and the ContentType of data to
+ * that it accepts, the gnutls_session 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.
*
@@ -269,7 +269,7 @@ gnutls_protocol_version lver;
* and only if the previous send was interrupted for some reason.
*
*/
-ssize_t _gnutls_send_int( gnutls_session session, ContentType type,
+ssize_t _gnutls_send_int( gnutls_session session, content_type_t type,
HandshakeType htype, const void *_data, size_t sizeofdata)
{
uint8 *cipher;
@@ -408,7 +408,7 @@ ssize_t _gnutls_send_change_cipher_spec( gnutls_session session, int again)
}
}
-static int _gnutls_check_recv_type( ContentType recv_type) {
+static int _gnutls_check_recv_type( content_type_t recv_type) {
switch( recv_type) {
case GNUTLS_CHANGE_CIPHER_SPEC:
case GNUTLS_ALERT:
@@ -426,7 +426,7 @@ static int _gnutls_check_recv_type( ContentType recv_type) {
/* Checks if there are pending data in the record buffers. If there are
* then it copies the data.
*/
-static int _gnutls_check_buffers( gnutls_session session, ContentType type, opaque* data, int sizeofdata) {
+static int _gnutls_check_buffers( gnutls_session session, content_type_t type, opaque* data, int sizeofdata) {
if ( (type == GNUTLS_APPLICATION_DATA || type == GNUTLS_HANDSHAKE) && _gnutls_record_buffer_get_size(type, session) > 0) {
int ret, ret2;
ret = _gnutls_record_buffer_get(type, session, data, sizeofdata);
@@ -455,8 +455,8 @@ static int _gnutls_check_buffers( gnutls_session session, ContentType type, opaq
/* Checks the record headers and returns the length, version and
* content type.
*/
-static int _gnutls_check_record_headers( gnutls_session session, uint8 headers[RECORD_HEADER_SIZE], ContentType type,
- HandshakeType htype, /*output*/ ContentType *recv_type, opaque version[2], uint16 *length, uint16* header_size) {
+static int _gnutls_check_record_headers( gnutls_session session, uint8 headers[RECORD_HEADER_SIZE], content_type_t type,
+ HandshakeType htype, /*output*/ content_type_t *recv_type, opaque version[2], uint16 *length, uint16* header_size) {
/* Read the first two bytes to determine if this is a
* version 2 message
@@ -525,8 +525,8 @@ static int _gnutls_check_record_version( gnutls_session session, HandshakeType h
/* This function will check if the received record type is
* the one we actually expect.
*/
-static int _gnutls_record_check_type( gnutls_session session, ContentType recv_type,
- ContentType type, HandshakeType htype, opaque* data, int data_size) {
+static int _gnutls_record_check_type( gnutls_session session, content_type_t recv_type,
+ content_type_t type, HandshakeType htype, opaque* data, int data_size) {
int ret;
@@ -664,20 +664,20 @@ inline static int get_temp_recv_buffer( gnutls_session session, gnutls_datum* tm
#define MAX_EMPTY_PACKETS_SEQUENCE 4
/* This function behaves exactly like read(). The only difference is
- * that it accepts the gnutls_session and the ContentType of data to
+ * that it accepts the gnutls_session 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.
*/
-ssize_t _gnutls_recv_int( gnutls_session session, ContentType type,
+ssize_t _gnutls_recv_int( gnutls_session session, content_type_t type,
HandshakeType htype, opaque *data, size_t sizeofdata)
{
gnutls_datum tmp;
int decrypted_length;
opaque version[2];
uint8 *headers;
- ContentType recv_type;
+ content_type_t recv_type;
uint16 length;
uint8 *ciphertext;
uint8 *recv_data;
diff --git a/lib/gnutls_record.h b/lib/gnutls_record.h
index 8cecdbf6e4..2b4f5e4f92 100644
--- a/lib/gnutls_record.h
+++ b/lib/gnutls_record.h
@@ -1,6 +1,6 @@
-ssize_t _gnutls_send_int( gnutls_session session, ContentType type,
+ssize_t _gnutls_send_int( gnutls_session session, content_type_t type,
HandshakeType htype, const void* data, size_t sizeofdata);
-ssize_t _gnutls_recv_int( gnutls_session session, ContentType type,
+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);
diff --git a/lib/gnutls_session_pack.c b/lib/gnutls_session_pack.c
index c9f5dbc25a..3fff4977fb 100644
--- a/lib/gnutls_session_pack.c
+++ b/lib/gnutls_session_pack.c
@@ -132,14 +132,14 @@ int _gnutls_session_pack(gnutls_session session, gnutls_datum * packed_session)
}
- /* Auth_info structures copied. Now copy SecurityParameters.
+ /* Auth_info structures copied. Now copy security_parameters_st.
*/
- packed_session->size += sizeof(SecurityParameters)+sizeof(uint32);
+ packed_session->size += sizeof(security_parameters_st)+sizeof(uint32);
- _gnutls_write_uint32( sizeof(SecurityParameters), &packed_session->data[packed_session->size - sizeof(SecurityParameters) - sizeof(uint32)]);
+ _gnutls_write_uint32( sizeof(security_parameters_st), &packed_session->data[packed_session->size - sizeof(security_parameters_st) - sizeof(uint32)]);
memcpy(&packed_session->
- data[packed_session->size - sizeof(SecurityParameters)],
- &session->security_parameters, sizeof(SecurityParameters));
+ data[packed_session->size - sizeof(security_parameters_st)],
+ &session->security_parameters, sizeof(security_parameters_st));
return 0;
}
@@ -166,9 +166,9 @@ uint _gnutls_session_size( gnutls_session session)
break;
}
- /* Auth_info structures copied. Now copy SecurityParameters.
+ /* Auth_info structures copied. Now copy security_parameters_st.
*/
- pack_size += sizeof(SecurityParameters) + sizeof(uint32);
+ pack_size += sizeof(security_parameters_st) + sizeof(uint32);
return pack_size;
}
@@ -179,7 +179,7 @@ int _gnutls_session_unpack(gnutls_session session,
uint32 pack_size;
int ret;
time_t timestamp = time(0);
- SecurityParameters sp;
+ security_parameters_st sp;
if (packed_session==NULL || packed_session->size == 0) {
gnutls_assert();
@@ -293,25 +293,25 @@ int _gnutls_session_unpack(gnutls_session session,
session->key->auth_info_type = packed_session->data[0];
- /* Auth_info structures copied. Now copy SecurityParameters.
+ /* Auth_info structures copied. Now copy security_parameters_st.
*/
ret =
_gnutls_read_uint32(&packed_session->
data[PACK_HEADER_SIZE + sizeof(uint32) +
pack_size]);
- if (ret != sizeof(SecurityParameters)) {
+ if (ret != sizeof(security_parameters_st)) {
gnutls_assert();
return GNUTLS_E_DB_ERROR;
}
memcpy(&sp, &packed_session->data[PACK_HEADER_SIZE +
2 * sizeof(uint32) + pack_size],
- sizeof(SecurityParameters));
+ sizeof(security_parameters_st));
if ( timestamp - sp.timestamp <= session->internals.expire_time
&& sp.timestamp <= timestamp) {
- memcpy( &session->internals.resumed_security_parameters, &sp, sizeof(SecurityParameters));
+ memcpy( &session->internals.resumed_security_parameters, &sp, sizeof(security_parameters_st));
} else {
_gnutls_free_auth_info( session);
gnutls_assert();
diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c
index b63ff29190..045f2f33f7 100644
--- a/lib/gnutls_sig.c
+++ b/lib/gnutls_sig.c
@@ -48,8 +48,8 @@ int _gnutls_tls_sign_hdata( gnutls_session session,
gnutls_datum dconcat;
int ret;
opaque concat[36];
-GNUTLS_MAC_HANDLE td_md5;
-GNUTLS_MAC_HANDLE td_sha;
+mac_hd_t td_md5;
+mac_hd_t td_sha;
gnutls_protocol_version ver = gnutls_protocol_get_version( session);
td_sha = _gnutls_hash_copy( session->internals.handshake_mac_handle_sha);
@@ -110,8 +110,8 @@ int _gnutls_tls_sign_params( gnutls_session session, gnutls_cert* cert, gnutls_p
{
gnutls_datum dconcat;
int ret;
-GNUTLS_MAC_HANDLE td_md5;
-GNUTLS_MAC_HANDLE td_sha;
+mac_hd_t td_md5;
+mac_hd_t td_sha;
opaque concat[36];
@@ -292,8 +292,8 @@ int _gnutls_verify_sig_hdata( gnutls_session session, gnutls_cert *cert, gnutls_
{
int ret;
opaque concat[36];
-GNUTLS_MAC_HANDLE td_md5;
-GNUTLS_MAC_HANDLE td_sha;
+mac_hd_t td_md5;
+mac_hd_t td_sha;
gnutls_datum dconcat;
gnutls_protocol_version ver = gnutls_protocol_get_version( session);
@@ -344,8 +344,8 @@ int _gnutls_verify_sig_params( gnutls_session session, gnutls_cert *cert, const
{
gnutls_datum dconcat;
int ret;
-GNUTLS_MAC_HANDLE td_md5;
-GNUTLS_MAC_HANDLE td_sha;
+mac_hd_t td_md5;
+mac_hd_t td_sha;
opaque concat[36];
td_md5 = _gnutls_hash_init( GNUTLS_MAC_MD5);
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index d2fc9dfd4f..5abeab791e 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -184,7 +184,7 @@ void _gnutls_handshake_internal_state_clear( gnutls_session session)
session->internals.adv_version_minor = 0;
session->internals.v2_hello = 0;
memset( &session->internals.handshake_header_buffer, 0,
- sizeof(HANDSHAKE_HEADER_BUFFER));
+ sizeof(handshake_header_buffer_st));
session->internals.adv_version_minor = 0;
session->internals.adv_version_minor = 0;
session->internals.direction = 0;
@@ -249,7 +249,7 @@ int gnutls_init(gnutls_session * session, gnutls_connection_end con_end)
_gnutls_buffer_init( &(*session)->internals.handshake_send_buffer);
_gnutls_buffer_init( &(*session)->internals.handshake_recv_buffer);
- (*session)->key = gnutls_calloc(1, sizeof(struct GNUTLS_KEY_INT));
+ (*session)->key = gnutls_calloc(1, sizeof(struct gnutls_key_st));
if ( (*session)->key == NULL) {
cleanup_session:
gnutls_free( *session); *session = NULL;
@@ -394,7 +394,7 @@ int _gnutls_dh_get_allowed_prime_bits( gnutls_session session)
int _gnutls_dh_set_peer_public( gnutls_session session, mpi_t public)
{
-dh_info_st * dh;
+dh_info_t * dh;
int ret;
switch( gnutls_auth_get_type( session)) {
@@ -498,7 +498,7 @@ int _gnutls_rsa_export_set_pubkey( gnutls_session session, mpi_t exp, mpi_t mod)
*/
int _gnutls_dh_set_group( gnutls_session session, mpi_t gen, mpi_t prime)
{
-dh_info_st* dh;
+dh_info_t* dh;
int ret;
switch( gnutls_auth_get_type( session)) {
@@ -630,7 +630,7 @@ void gnutls_handshake_set_private_extensions(gnutls_session session, int allow)
inline
static int _gnutls_cal_PRF_A( gnutls_mac_algorithm algorithm, const void *secret, int secret_size, const void *seed, int seed_size, void* result)
{
- GNUTLS_MAC_HANDLE td1;
+ mac_hd_t td1;
td1 = _gnutls_hmac_init(algorithm, secret, secret_size);
if (td1 == GNUTLS_MAC_FAILED) {
@@ -652,7 +652,7 @@ static int _gnutls_cal_PRF_A( gnutls_mac_algorithm algorithm, const void *secret
static int _gnutls_P_hash( gnutls_mac_algorithm algorithm, const opaque * secret, int secret_size, const opaque * seed, int seed_size, int total_bytes, opaque* ret)
{
- GNUTLS_MAC_HANDLE td2;
+ mac_hd_t td2;
int i, times, how, blocksize, A_size;
opaque final[20], Atmp[MAX_SEED_SIZE];
int output_bytes, result;
diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c
index 73466daa6b..f9b607fafa 100644
--- a/lib/gnutls_ui.c
+++ b/lib/gnutls_ui.c
@@ -72,7 +72,7 @@ void gnutls_dh_set_prime_bits(gnutls_session session, unsigned int bits)
int gnutls_dh_get_group(gnutls_session session,
gnutls_datum* raw_gen, gnutls_datum* raw_prime)
{
-dh_info_st *dh;
+dh_info_t *dh;
anon_server_auth_info_t anon_info;
cert_auth_info_t cert_info;
@@ -116,7 +116,7 @@ cert_auth_info_t cert_info;
**/
int gnutls_dh_get_pubkey(gnutls_session session, gnutls_datum* key)
{
-dh_info_st* dh;
+dh_info_t* dh;
anon_server_auth_info_t anon_info;
cert_auth_info_t cert_info;
@@ -227,7 +227,7 @@ int gnutls_dh_get_secret_bits(gnutls_session session)
**/
int gnutls_dh_get_prime_bits(gnutls_session session)
{
-dh_info_st *dh;
+dh_info_t *dh;
switch( gnutls_auth_get_type( session)) {
case GNUTLS_CRD_ANON: {
@@ -289,7 +289,7 @@ cert_auth_info_t info;
**/
int gnutls_dh_get_peers_public_bits(gnutls_session session)
{
-dh_info_st * dh;
+dh_info_t * dh;
switch( gnutls_auth_get_type( session)) {
case GNUTLS_CRD_ANON: {
diff --git a/lib/gnutls_v2_compat.c b/lib/gnutls_v2_compat.c
index 7e603ff87d..7e19848582 100644
--- a/lib/gnutls_v2_compat.c
+++ b/lib/gnutls_v2_compat.c
@@ -164,7 +164,7 @@ int _gnutls_read_client_hello_v2(gnutls_session session, opaque * data,
return GNUTLS_E_INSUFFICIENT_CREDENTIALS;
}
- /* set the MOD_AUTH_STRUCT to the appropriate struct
+ /* set the mod_auth_st to the appropriate struct
* according to the KX algorithm. This is needed since all the
* handshake functions are read from there;
*/
diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c
index 27bbe41218..0b9c0253c9 100644
--- a/lib/x509/pkcs12.c
+++ b/lib/x509/pkcs12.c
@@ -744,7 +744,7 @@ int gnutls_pkcs12_generate_mac(gnutls_pkcs12 pkcs12, const char* pass)
opaque salt[8], key[20];
int result;
const int iter = 1;
- GNUTLS_MAC_HANDLE td1 = NULL;
+ mac_hd_t td1 = NULL;
gnutls_datum tmp = {NULL, 0};
opaque sha_mac[20];
@@ -851,7 +851,7 @@ int gnutls_pkcs12_verify_mac(gnutls_pkcs12 pkcs12, const char* pass)
opaque key[20];
int result;
unsigned int iter, len;
- GNUTLS_MAC_HANDLE td1 = NULL;
+ mac_hd_t td1 = NULL;
gnutls_datum tmp = {NULL, 0}, salt = {NULL, 0};
opaque sha_mac[20];
opaque sha_mac_orig[20];
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c
index 93a67d41d6..894be9f1b7 100644
--- a/lib/x509/privkey_pkcs8.c
+++ b/lib/x509/privkey_pkcs8.c
@@ -1201,7 +1201,7 @@ static int decrypt_data(schema_id schema, ASN1_TYPE pkcs8_asn, const char *root,
int data_size;
opaque *data = NULL, *key = NULL;
gnutls_datum dkey, div;
- GNUTLS_CIPHER_HANDLE ch = NULL;
+ cipher_hd_t ch = NULL;
int key_size;
data_size = 0;
@@ -1640,7 +1640,7 @@ static int encrypt_data( const gnutls_datum * plain,
int data_size;
opaque *data = NULL;
gnutls_datum div;
- GNUTLS_CIPHER_HANDLE ch = NULL;
+ cipher_hd_t ch = NULL;
opaque pad, pad_size;
pad_size = _gnutls_cipher_get_block_size(enc_params->cipher);
diff --git a/libextra/auth_srp.c b/libextra/auth_srp.c
index de4a3f297a..cbeb134210 100644
--- a/libextra/auth_srp.c
+++ b/libextra/auth_srp.c
@@ -41,7 +41,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);
-const MOD_AUTH_STRUCT srp_auth_struct = {
+const mod_auth_st srp_auth_struct = {
"SRP",
NULL,
NULL,
diff --git a/libextra/auth_srp_rsa.c b/libextra/auth_srp_rsa.c
index 1a75530ce2..f28a3771b0 100644
--- a/libextra/auth_srp_rsa.c
+++ b/libextra/auth_srp_rsa.c
@@ -42,7 +42,7 @@
static int gen_srp_cert_server_kx(gnutls_session, opaque **);
static int proc_srp_cert_server_kx(gnutls_session, opaque *, size_t);
-const MOD_AUTH_STRUCT srp_rsa_auth_struct = {
+const mod_auth_st srp_rsa_auth_struct = {
"SRP",
_gnutls_gen_cert_server_certificate,
NULL,
@@ -59,7 +59,7 @@ const MOD_AUTH_STRUCT srp_rsa_auth_struct = {
NULL
};
-const MOD_AUTH_STRUCT srp_dss_auth_struct = {
+const mod_auth_st srp_dss_auth_struct = {
"SRP",
_gnutls_gen_cert_server_certificate,
NULL,
diff --git a/libextra/ext_srp.c b/libextra/ext_srp.c
index 239edfa916..c279f87b8e 100644
--- a/libextra/ext_srp.c
+++ b/libextra/ext_srp.c
@@ -60,7 +60,7 @@ int _gnutls_srp_recv_params( gnutls_session session, const opaque* data, size_t
/* Checks if the given cipher suite is an SRP one
*/
-inline static int is_srp( GNUTLS_CipherSuite suite)
+inline static int is_srp( cipher_suite_st suite)
{
int kx = _gnutls_cipher_suite_get_kx_algo( &suite);
diff --git a/libextra/gnutls_extra.c b/libextra/gnutls_extra.c
index cdf1446753..d32ba12264 100644
--- a/libextra/gnutls_extra.c
+++ b/libextra/gnutls_extra.c
@@ -61,9 +61,9 @@ int i;
return GNUTLS_E_MEMORY_ERROR;
}
-extern MOD_AUTH_STRUCT srp_auth_struct;
-extern MOD_AUTH_STRUCT srp_rsa_auth_struct;
-extern MOD_AUTH_STRUCT srp_dss_auth_struct;
+extern mod_auth_st srp_auth_struct;
+extern mod_auth_st srp_rsa_auth_struct;
+extern mod_auth_st srp_dss_auth_struct;
static int _gnutls_add_srp_auth_struct(void) {