diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2002-12-02 07:13:35 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2002-12-02 07:13:35 +0000 |
commit | 54e8f8fe0a91a8b53a2362ef2bab292ade94fb25 (patch) | |
tree | fadbc28920b3e0b2b74332c54110d14148c950d2 | |
parent | e9accc808aad3981ac19712be97e395a399506e7 (diff) | |
download | gnutls-54e8f8fe0a91a8b53a2362ef2bab292ade94fb25.tar.gz |
Cleanups. Prefixed some internal function with underscore.
50 files changed, 194 insertions, 174 deletions
diff --git a/lib/auth_cert.c b/lib/auth_cert.c index 6c3845d201..5751e6d3ee 100644 --- a/lib/auth_cert.c +++ b/lib/auth_cert.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -76,7 +76,7 @@ int _gnutls_copy_certificate_auth_info(CERTIFICATE_AUTH_INFO info, for (i = 0; i < ncerts; i++) { if (cert->raw.size > 0) { ret = - gnutls_set_datum(&info-> + _gnutls_set_datum(&info-> raw_certificate_list[i], cert[i].raw.data, cert[i].raw.size); @@ -93,7 +93,7 @@ int _gnutls_copy_certificate_auth_info(CERTIFICATE_AUTH_INFO info, clear: for (j = 0; j < i; j++) - gnutls_free_datum(&info->raw_certificate_list[j]); + _gnutls_free_datum(&info->raw_certificate_list[j]); gnutls_free(info->raw_certificate_list); info->raw_certificate_list = NULL; @@ -904,7 +904,7 @@ int _gnutls_proc_openpgp_server_certificate(gnutls_session session, if (peer_certificate_list_size == 0) { gnutls_assert(); - gnutls_free_datum( &akey); + _gnutls_free_datum( &akey); return GNUTLS_E_UNEXPECTED_PACKET_LENGTH; } @@ -920,7 +920,7 @@ int _gnutls_proc_openpgp_server_certificate(gnutls_session session, if (_E_gnutls_openpgp_cert2gnutls_cert==NULL) { gnutls_assert(); - gnutls_free_datum( &akey); + _gnutls_free_datum( &akey); CLEAR_CERTS; gnutls_afree(peer_certificate_list); return GNUTLS_E_INIT_LIBEXTRA; @@ -930,12 +930,12 @@ int _gnutls_proc_openpgp_server_certificate(gnutls_session session, _E_gnutls_openpgp_cert2gnutls_cert(&peer_certificate_list[0], tmp)) < 0) { gnutls_assert(); - gnutls_free_datum( &akey); + _gnutls_free_datum( &akey); CLEAR_CERTS; gnutls_afree(peer_certificate_list); return ret; } - gnutls_free_datum( &akey); + _gnutls_free_datum( &akey); if ((ret = _gnutls_copy_certificate_auth_info(info, @@ -1118,7 +1118,7 @@ int _gnutls_gen_cert_client_cert_vrfy(gnutls_session session, opaque ** data) *data = gnutls_malloc(signature.size + 2); if (*data == NULL) { - gnutls_free_datum(&signature); + _gnutls_free_datum(&signature); return GNUTLS_E_MEMORY_ERROR; } size = signature.size; @@ -1126,7 +1126,7 @@ int _gnutls_gen_cert_client_cert_vrfy(gnutls_session session, opaque ** data) memcpy(&(*data)[2], signature.data, size); - gnutls_free_datum(&signature); + _gnutls_free_datum(&signature); return size + 2; } diff --git a/lib/auth_dhe.c b/lib/auth_dhe.c index 9fb17edc76..fe53d81822 100644 --- a/lib/auth_dhe.c +++ b/lib/auth_dhe.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -164,7 +164,7 @@ static int gen_dhe_server_kx(gnutls_session session, opaque ** data) *data = gnutls_realloc_fast(*data, data_size + signature.size + 2); if (*data == NULL) { - gnutls_free_datum(&signature); + _gnutls_free_datum(&signature); gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; } @@ -172,7 +172,7 @@ static int gen_dhe_server_kx(gnutls_session session, opaque ** data) _gnutls_write_datum16(&(*data)[data_size], signature); data_size += signature.size + 2; - gnutls_free_datum(&signature); + _gnutls_free_datum(&signature); return data_size; } diff --git a/lib/auth_rsa.c b/lib/auth_rsa.c index 121c96d0f8..c55eb338dc 100644 --- a/lib/auth_rsa.c +++ b/lib/auth_rsa.c @@ -327,12 +327,12 @@ int _gnutls_gen_rsa_client_kx(gnutls_session session, opaque ** data) } else { /* TLS 1 */ *data = gnutls_malloc(sdata.size + 2); if (*data == NULL) { - gnutls_free_datum(&sdata); + _gnutls_free_datum(&sdata); return GNUTLS_E_MEMORY_ERROR; } _gnutls_write_datum16( *data, sdata); ret = sdata.size + 2; - gnutls_free_datum(&sdata); + _gnutls_free_datum(&sdata); return ret; } diff --git a/lib/auth_rsa_export.c b/lib/auth_rsa_export.c index a722776dc9..4f681590d2 100644 --- a/lib/auth_rsa_export.c +++ b/lib/auth_rsa_export.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -167,7 +167,7 @@ static int gen_rsa_export_server_kx(gnutls_session session, opaque ** data) *data = gnutls_realloc_fast(*data, data_size + signature.size + 2); if (*data == NULL) { - gnutls_free_datum(&signature); + _gnutls_free_datum(&signature); gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; } @@ -175,7 +175,7 @@ static int gen_rsa_export_server_kx(gnutls_session session, opaque ** data) _gnutls_write_datum16(&(*data)[data_size], signature); data_size += signature.size + 2; - gnutls_free_datum(&signature); + _gnutls_free_datum(&signature); return data_size; } diff --git a/lib/ext_cert_type.c b/lib/ext_cert_type.c index 407074dfd9..9453f394a9 100644 --- a/lib/ext_cert_type.c +++ b/lib/ext_cert_type.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Nikos Mavroyanopoulos + * Copyright (C) 2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/ext_server_name.c b/lib/ext_server_name.c index 82fe37b538..5547d47eb0 100644 --- a/lib/ext_server_name.c +++ b/lib/ext_server_name.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Nikos Mavroyanopoulos + * Copyright (C) 2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_alert.c b/lib/gnutls_alert.c index 3a6207548b..655987322c 100644 --- a/lib/gnutls_alert.c +++ b/lib/gnutls_alert.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_algorithms.c b/lib/gnutls_algorithms.c index c67e035d63..e2e6ca780e 100644 --- a/lib/gnutls_algorithms.c +++ b/lib/gnutls_algorithms.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_anon_cred.c b/lib/gnutls_anon_cred.c index 761ea78677..40494f8294 100644 --- a/lib/gnutls_anon_cred.c +++ b/lib/gnutls_anon_cred.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001 Nikos Mavroyanopoulos + * Copyright (C) 2001 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_auth.c b/lib/gnutls_auth.c index 5bed7f9c52..1d81d56823 100644 --- a/lib/gnutls_auth.c +++ b/lib/gnutls_auth.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -224,7 +224,7 @@ void _gnutls_free_auth_info( gnutls_session session) { if (info==NULL) break; for (i=0;i<info->ncerts;i++) { - gnutls_free_datum( &info->raw_certificate_list[i]); + _gnutls_free_datum( &info->raw_certificate_list[i]); } gnutls_free( info->raw_certificate_list); diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c index 7c6fc04c29..db70edcad4 100644 --- a/lib/gnutls_buffers.c +++ b/lib/gnutls_buffers.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_cert.c b/lib/gnutls_cert.c index 44dcdeef42..26248ff514 100644 --- a/lib/gnutls_cert.c +++ b/lib/gnutls_cert.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -50,8 +50,8 @@ void _gnutls_free_cert(gnutls_cert cert) _gnutls_mpi_release(&cert.params[i]); } - gnutls_free_datum(&cert.signature); - gnutls_free_datum(&cert.raw); + _gnutls_free_datum(&cert.signature); + _gnutls_free_datum(&cert.raw); return; } @@ -87,7 +87,7 @@ void gnutls_certificate_free_credentials(gnutls_certificate_credentials sc) } gnutls_free( sc->x509_ca_list); - gnutls_free_datum( &sc->keyring); + _gnutls_free_datum( &sc->keyring); for (i = 0; i < sc->ncerts; i++) { _gnutls_free_private_key(sc->pkey[i]); diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c index ca7c14bc74..56ee62d60e 100644 --- a/lib/gnutls_cipher.c +++ b/lib/gnutls_cipher.c @@ -87,7 +87,7 @@ int _gnutls_encrypt(gnutls_session session, const char* headers, size_t headers_ ciphertext_size - headers_size, comp, type, random_pad); if (free_comp) - gnutls_free_datum(&comp); + _gnutls_free_datum(&comp); if (ret < 0) { gnutls_assert(); @@ -140,14 +140,14 @@ int _gnutls_decrypt(gnutls_session session, char *ciphertext, if (gtxt.size > data_size) { gnutls_assert(); - gnutls_free_datum( >xt); + _gnutls_free_datum( >xt); return GNUTLS_E_MEMORY_ERROR; } memcpy( data, gtxt.data, gtxt.size); ret = gtxt.size; - gnutls_free_datum( >xt); + _gnutls_free_datum( >xt); } return ret; diff --git a/lib/gnutls_compress.c b/lib/gnutls_compress.c index a20558dcf6..4e34b31db2 100644 --- a/lib/gnutls_compress.c +++ b/lib/gnutls_compress.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000 Nikos Mavroyanopoulos + * Copyright (C) 2000 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_compress_int.c b/lib/gnutls_compress_int.c index 82d46d53f7..2b23ff3208 100644 --- a/lib/gnutls_compress_int.c +++ b/lib/gnutls_compress_int.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c index c09def2b72..1629d8526f 100644 --- a/lib/gnutls_constate.c +++ b/lib/gnutls_constate.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -118,7 +118,7 @@ int _gnutls_set_keys(gnutls_session session, int hash_size, int IV_size, pos = 0; if (hash_size > 0) { - if (gnutls_sset_datum + if (_gnutls_sset_datum (&session->cipher_specs.client_write_mac_secret, &key_block[pos], hash_size) < 0) { gnutls_free(key_block); @@ -126,7 +126,7 @@ int _gnutls_set_keys(gnutls_session session, int hash_size, int IV_size, } pos += hash_size; - if (gnutls_sset_datum + if (_gnutls_sset_datum (&session->cipher_specs.server_write_mac_secret, &key_block[pos], hash_size) < 0) { gnutls_free(key_block); @@ -229,7 +229,7 @@ int _gnutls_set_keys(gnutls_session session, int hash_size, int IV_size, pos += key_size; } - if (gnutls_sset_datum + if (_gnutls_sset_datum (&session->cipher_specs.client_write_key, client_write_key, client_write_key_size) < 0) { gnutls_free(key_block); @@ -242,7 +242,7 @@ int _gnutls_set_keys(gnutls_session session, int hash_size, int IV_size, _gnutls_bin2hex(client_write_key, client_write_key_size)); - if (gnutls_sset_datum + if (_gnutls_sset_datum (&session->cipher_specs.server_write_key, server_write_key, server_write_key_size) < 0) { gnutls_free(key_block); @@ -266,7 +266,7 @@ int _gnutls_set_keys(gnutls_session session, int hash_size, int IV_size, /* IV generation in export and non export ciphers. */ if (IV_size > 0 && export_flag == 0) { - if (gnutls_sset_datum + if (_gnutls_sset_datum (&session->cipher_specs.client_write_IV, &key_block[pos], IV_size) < 0) { gnutls_free(key_block); @@ -274,7 +274,7 @@ int _gnutls_set_keys(gnutls_session session, int hash_size, int IV_size, } pos += IV_size; - if (gnutls_sset_datum + if (_gnutls_sset_datum (&session->cipher_specs.server_write_IV, &key_block[pos], IV_size) < 0) { gnutls_free(key_block); @@ -322,14 +322,14 @@ int _gnutls_set_keys(gnutls_session session, int hash_size, int IV_size, return ret; } - if (gnutls_sset_datum + if (_gnutls_sset_datum (&session->cipher_specs.client_write_IV, iv_block, IV_size) < 0) { gnutls_free(key_block); return GNUTLS_E_MEMORY_ERROR; } - if (gnutls_sset_datum + if (_gnutls_sset_datum (&session->cipher_specs.server_write_IV, &iv_block[IV_size], IV_size) < 0) { gnutls_free(key_block); @@ -514,7 +514,7 @@ int _gnutls_read_connection_state_init(gnutls_session session) /* Free all the previous keys/ sessions etc. */ if (session->connection_state.read_mac_secret.data != NULL) - gnutls_sfree_datum(&session->connection_state. + _gnutls_free_datum(&session->connection_state. read_mac_secret); if (session->connection_state.read_cipher_state != NULL) @@ -556,12 +556,15 @@ int _gnutls_read_connection_state_init(gnutls_session session) * session. */ if (mac_size > 0) { - gnutls_sset_datum(&session->connection_state. + if (_gnutls_sset_datum(&session->connection_state. read_mac_secret, session->cipher_specs. client_write_mac_secret.data, session->cipher_specs. - client_write_mac_secret.size); + client_write_mac_secret.size) < 0) { + gnutls_assert(); + return GNUTLS_E_MEMORY_ERROR; + } } @@ -588,12 +591,15 @@ int _gnutls_read_connection_state_init(gnutls_session session) /* copy mac secret to connection session */ if (mac_size > 0) { - gnutls_sset_datum(&session->connection_state. + if (_gnutls_sset_datum(&session->connection_state. read_mac_secret, session->cipher_specs. server_write_mac_secret.data, session->cipher_specs. - server_write_mac_secret.size); + server_write_mac_secret.size) < 0) { + gnutls_assert(); + return GNUTLS_E_MEMORY_ERROR; + } } break; @@ -692,7 +698,7 @@ int _gnutls_write_connection_state_init(gnutls_session session) /* Free all the previous keys/ sessions etc. */ if (session->connection_state.write_mac_secret.data != NULL) - gnutls_sfree_datum(&session->connection_state. + _gnutls_free_datum(&session->connection_state. write_mac_secret); if (session->connection_state.write_cipher_state != NULL) @@ -735,12 +741,15 @@ int _gnutls_write_connection_state_init(gnutls_session session) * session. */ if (mac_size > 0) { - gnutls_sset_datum(&session->connection_state. + if (_gnutls_sset_datum(&session->connection_state. write_mac_secret, session->cipher_specs. server_write_mac_secret.data, session->cipher_specs. - server_write_mac_secret.size); + server_write_mac_secret.size) < 0) { + gnutls_assert(); + return GNUTLS_E_MEMORY_ERROR; + } } @@ -767,12 +776,15 @@ int _gnutls_write_connection_state_init(gnutls_session session) /* copy mac secret to connection session */ if (mac_size > 0) { - gnutls_sset_datum(&session->connection_state. + if (_gnutls_sset_datum(&session->connection_state. write_mac_secret, session->cipher_specs. client_write_mac_secret.data, session->cipher_specs. - client_write_mac_secret.size); + client_write_mac_secret.size) < 0) { + gnutls_assert(); + return GNUTLS_E_MEMORY_ERROR; + } } break; diff --git a/lib/gnutls_datum.c b/lib/gnutls_datum.c index af9a3660bb..30b2cff11f 100644 --- a/lib/gnutls_datum.c +++ b/lib/gnutls_datum.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_datum.h b/lib/gnutls_datum.h index 50d97f420a..b1b23d6571 100644 --- a/lib/gnutls_datum.h +++ b/lib/gnutls_datum.h @@ -5,14 +5,13 @@ void _gnutls_write_datum8( opaque* dest, gnutls_datum dat); int _gnutls_set_datum_m( gnutls_datum* dat, const void* data, int data_size, ALLOC_FUNC); -#define gnutls_set_datum( x, y, z) _gnutls_set_datum_m(x,y,z, gnutls_malloc) -#define gnutls_sset_datum( x, y, z) _gnutls_set_datum_m(x,y,z, gnutls_secure_malloc) +#define _gnutls_set_datum( x, y, z) _gnutls_set_datum_m(x,y,z, gnutls_malloc) +#define _gnutls_sset_datum( x, y, z) _gnutls_set_datum_m(x,y,z, gnutls_secure_malloc) int _gnutls_datum_append_m( gnutls_datum* dat, const void* data, int data_size, REALLOC_FUNC); -#define gnutls_datum_append(x,y,z) _gnutls_datum_append_m(x,y,z, gnutls_realloc) +#define _gnutls_datum_append(x,y,z) _gnutls_datum_append_m(x,y,z, gnutls_realloc) void _gnutls_free_datum_m( gnutls_datum* dat, FREE_FUNC); -#define gnutls_free_datum(x) _gnutls_free_datum_m(x, gnutls_free) -#define gnutls_sfree_datum(x) _gnutls_free_datum_m(x, gnutls_free) +#define _gnutls_free_datum(x) _gnutls_free_datum_m(x, gnutls_free) diff --git a/lib/gnutls_db.c b/lib/gnutls_db.c index 4d3c7b1fd0..1c2ab4fdce 100644 --- a/lib/gnutls_db.c +++ b/lib/gnutls_db.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_dh.c b/lib/gnutls_dh.c index bce4157e8f..f83754a6d5 100644 --- a/lib/gnutls_dh.c +++ b/lib/gnutls_dh.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * someday was part of gsti diff --git a/lib/gnutls_dh_primes.c b/lib/gnutls_dh_primes.c index f9c66b19fd..641de737f0 100644 --- a/lib/gnutls_dh_primes.c +++ b/lib/gnutls_dh_primes.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2001 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -437,11 +437,16 @@ int _gnutls_get_rnd_srp_params(gnutls_datum *g, gnutls_datum* p, int bits) i = 0; do { if (_gnutls_dh_default_params[i].bits == bits) { - gnutls_set_datum( p, _gnutls_dh_default_params[i].prime.data, - _gnutls_dh_default_params[i].prime.size); + if (_gnutls_set_datum( p, _gnutls_dh_default_params[i].prime.data, + _gnutls_dh_default_params[i].prime.size) < 0) { + return GNUTLS_E_MEMORY_ERROR; + } - gnutls_set_datum( g, _gnutls_dh_default_params[i].generator.data, - _gnutls_dh_default_params[i].generator.size); + if (_gnutls_set_datum( g, _gnutls_dh_default_params[i].generator.data, + _gnutls_dh_default_params[i].generator.size) < 0) { + _gnutls_free_datum( p); + return GNUTLS_E_MEMORY_ERROR; + } break; } @@ -450,8 +455,8 @@ int _gnutls_get_rnd_srp_params(gnutls_datum *g, gnutls_datum* p, int bits) if (g->data == NULL || p->data == NULL) { gnutls_assert(); - gnutls_free_datum(g); - gnutls_free_datum(p); + _gnutls_free_datum(g); + _gnutls_free_datum(p); return GNUTLS_E_INTERNAL_ERROR; } @@ -585,11 +590,11 @@ int gnutls_dh_params_set(gnutls_dh_params dh_params, gnutls_datum prime, sprime->generator.data = NULL; sprime->prime.data = NULL; - if (gnutls_set_datum(&sprime->prime, prime.data, prime.size) < 0) { + if (_gnutls_set_datum(&sprime->prime, prime.data, prime.size) < 0) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; } - if (gnutls_set_datum + if (_gnutls_set_datum (&sprime->generator, generator.data, generator.size) < 0) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c index fe5335db79..b39007758c 100644 --- a/lib/gnutls_global.c +++ b/lib/gnutls_global.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index 00dfd2a5c2..6fd293b7e7 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -2389,7 +2389,6 @@ int _gnutls_remove_unwanted_ciphersuites(gnutls_session session, /* if it is defined but had no credentials */ if (_gnutls_get_kx_cred(session, kx, NULL) == NULL) { -fprintf(stderr, "HERE\n"); keep = 1; } else /* If there was no credentials to use with the specified @@ -2398,14 +2397,12 @@ fprintf(stderr, "HERE\n"); if (_gnutls_map_kx_get_cred(kx, server) == GNUTLS_CRD_CERTIFICATE) { keep = 1; /* do not keep */ -fprintf(stderr, "THERE %d\n", kx); if (x509_cred != NULL) { if (server) { /* here we check if the KX algorithm * is compatible with the certificate. */ for (j = 0; j < alg_size; j++) { -fprintf(stderr, "ALG %d\n", alg[j]); if (alg[j] == kx) { keep = 0; diff --git a/lib/gnutls_kx.c b/lib/gnutls_kx.c index 0f99bdeeb3..8533f1a069 100644 --- a/lib/gnutls_kx.c +++ b/lib/gnutls_kx.c @@ -75,7 +75,7 @@ char random[2*TLS_RANDOM_SIZE]; random, 2*TLS_RANDOM_SIZE, TLS_MASTER_SIZE, session->security_parameters.master_secret); } - gnutls_sfree_datum(&PREMASTER); + _gnutls_free_datum(&PREMASTER); if (ret<0) return ret; diff --git a/lib/gnutls_mem.c b/lib/gnutls_mem.c index 9b02527331..88a0787d0e 100644 --- a/lib/gnutls_mem.c +++ b/lib/gnutls_mem.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_mpi.c b/lib/gnutls_mpi.c index 436a356ea3..2dcdc3a2dc 100644 --- a/lib/gnutls_mpi.c +++ b/lib/gnutls_mpi.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_num.c b/lib/gnutls_num.c index 9925d6671a..f747d4454e 100644 --- a/lib/gnutls_num.c +++ b/lib/gnutls_num.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_pk.c b/lib/gnutls_pk.c index 3416ce8c6a..7dd4edad7c 100644 --- a/lib/gnutls_pk.c +++ b/lib/gnutls_pk.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -267,7 +267,7 @@ int _gnutls_pkcs1_rsa_decrypt(gnutls_sdatum * plaintext, return GNUTLS_E_DECRYPTION_FAILED; } - if (gnutls_sset_datum(plaintext, &edata[i], esize - i) < 0) { + if (_gnutls_sset_datum(plaintext, &edata[i], esize - i) < 0) { gnutls_assert(); gnutls_free(edata); return GNUTLS_E_MEMORY_ERROR; @@ -293,17 +293,17 @@ int _gnutls_rsa_verify( const gnutls_datum* vdata, const gnutls_datum *ciphertex if (plain.size != vdata->size) { gnutls_assert(); - gnutls_sfree_datum( &plain); + _gnutls_free_datum( &plain); return GNUTLS_E_PK_SIG_VERIFY_FAILED; } if ( memcmp(plain.data, vdata->data, plain.size)!=0) { gnutls_assert(); - gnutls_sfree_datum( &plain); + _gnutls_free_datum( &plain); return GNUTLS_E_PK_SIG_VERIFY_FAILED; } - gnutls_sfree_datum( &plain); + _gnutls_free_datum( &plain); return 0; /* ok */ } diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c index d2d94b496f..17184f2efd 100644 --- a/lib/gnutls_priority.c +++ b/lib/gnutls_priority.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000 Nikos Mavroyanopoulos + * Copyright (C) 2000 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_privkey.c b/lib/gnutls_privkey.c index 06dd6a7120..a3cec3d683 100644 --- a/lib/gnutls_privkey.c +++ b/lib/gnutls_privkey.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001 Nikos Mavroyanopoulos + * Copyright (C) 2001 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -150,7 +150,7 @@ int _gnutls_PKCS1key2gnutlsKey(gnutls_private_key * pkey, asn1_delete_structure(&pkey_asn); - if (gnutls_set_datum(&pkey->raw, raw_key.data, raw_key.size) < 0) { + if (_gnutls_set_datum(&pkey->raw, raw_key.data, raw_key.size) < 0) { _gnutls_mpi_release(&pkey->params[0]); _gnutls_mpi_release(&pkey->params[1]); _gnutls_mpi_release(&pkey->params[2]); @@ -248,7 +248,7 @@ int _gnutls_DSAkey2gnutlsKey(gnutls_private_key * pkey, asn1_delete_structure(&dsa_asn); - if (gnutls_set_datum(&pkey->raw, raw_key.data, raw_key.size) < 0) { + if (_gnutls_set_datum(&pkey->raw, raw_key.data, raw_key.size) < 0) { _gnutls_mpi_release(&pkey->params[0]); _gnutls_mpi_release(&pkey->params[1]); _gnutls_mpi_release(&pkey->params[2]); @@ -271,7 +271,7 @@ void _gnutls_free_private_key(gnutls_private_key pkey) _gnutls_mpi_release(&pkey.params[i]); } - gnutls_free_datum(&pkey.raw); + _gnutls_free_datum(&pkey.raw); return; } diff --git a/lib/gnutls_random.c b/lib/gnutls_random.c index 130e14f53f..ffabbe7120 100644 --- a/lib/gnutls_random.c +++ b/lib/gnutls_random.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001 Nikos Mavroyanopoulos + * Copyright (C) 2001 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c index 1aca855a77..3c386c40c7 100644 --- a/lib/gnutls_record.c +++ b/lib/gnutls_record.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_rsa_export.c b/lib/gnutls_rsa_export.c index 5a26aa9acc..6018014998 100644 --- a/lib/gnutls_rsa_export.c +++ b/lib/gnutls_rsa_export.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Nikos Mavroyanopoulos + * Copyright (C) 2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -358,7 +358,7 @@ int gnutls_rsa_params_generate(gnutls_datum * m, gnutls_datum *e, e->data = malloc(siz); if (e->data == NULL) { FREE_ALL_MPIS; - gnutls_free_datum( m); + _gnutls_free_datum( m); return GNUTLS_E_MEMORY_ERROR; } @@ -372,8 +372,8 @@ int gnutls_rsa_params_generate(gnutls_datum * m, gnutls_datum *e, d->data = malloc(siz); if (d->data == NULL) { FREE_ALL_MPIS; - gnutls_free_datum( m); - gnutls_free_datum( e); + _gnutls_free_datum( m); + _gnutls_free_datum( e); return GNUTLS_E_MEMORY_ERROR; } @@ -387,9 +387,9 @@ int gnutls_rsa_params_generate(gnutls_datum * m, gnutls_datum *e, p->data = malloc(siz); if (p->data == NULL) { FREE_ALL_MPIS; - gnutls_free_datum( m); - gnutls_free_datum( e); - gnutls_free_datum( d); + _gnutls_free_datum( m); + _gnutls_free_datum( e); + _gnutls_free_datum( d); return GNUTLS_E_MEMORY_ERROR; } @@ -403,10 +403,10 @@ int gnutls_rsa_params_generate(gnutls_datum * m, gnutls_datum *e, q->data = malloc(siz); if (q->data == NULL) { FREE_ALL_MPIS; - gnutls_free_datum( m); - gnutls_free_datum( e); - gnutls_free_datum( d); - gnutls_free_datum( p); + _gnutls_free_datum( m); + _gnutls_free_datum( e); + _gnutls_free_datum( d); + _gnutls_free_datum( p); return GNUTLS_E_MEMORY_ERROR; } @@ -420,11 +420,11 @@ int gnutls_rsa_params_generate(gnutls_datum * m, gnutls_datum *e, u->data = malloc(siz); if (u->data == NULL) { FREE_ALL_MPIS; - gnutls_free_datum( m); - gnutls_free_datum( e); - gnutls_free_datum( d); - gnutls_free_datum( p); - gnutls_free_datum( q); + _gnutls_free_datum( m); + _gnutls_free_datum( e); + _gnutls_free_datum( d); + _gnutls_free_datum( p); + _gnutls_free_datum( q); return GNUTLS_E_MEMORY_ERROR; } diff --git a/lib/gnutls_session.c b/lib/gnutls_session.c index 93e5d912b2..d1d08735cf 100644 --- a/lib/gnutls_session.c +++ b/lib/gnutls_session.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000 Nikos Mavroyanopoulos + * Copyright (C) 2000 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_session_pack.c b/lib/gnutls_session_pack.c index 2eb4de45c4..0e0a170632 100644 --- a/lib/gnutls_session_pack.c +++ b/lib/gnutls_session_pack.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000 Nikos Mavroyanopoulos + * Copyright (C) 2000 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -395,7 +395,7 @@ uint32 size; size = _gnutls_read_uint32( &packed_session->data[ pos]); pos += sizeof(uint32); - ret = gnutls_set_datum( &info->raw_certificate_list[i], &packed_session->data[ pos], size); + ret = _gnutls_set_datum( &info->raw_certificate_list[i], &packed_session->data[ pos], size); pos += size; if (ret < 0) { @@ -408,7 +408,7 @@ uint32 size; clear: for (j=0;j<i;j++) - gnutls_free_datum( &info->raw_certificate_list[j]); + _gnutls_free_datum( &info->raw_certificate_list[j]); gnutls_free( info->raw_certificate_list); return GNUTLS_E_MEMORY_ERROR; diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c index b538cb3ef6..aa1aa15dae 100644 --- a/lib/gnutls_sig.c +++ b/lib/gnutls_sig.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001 Nikos Mavroyanopoulos + * Copyright (C) 2001 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index 451a0c7f57..689d12f6ab 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Nikos Mavroyanopoulos + * Copyright (C) 2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -251,8 +251,8 @@ void _gnutls_deinit(gnutls_session session) _gnutls_handshake_io_buffer_clear( session); - gnutls_sfree_datum(&session->connection_state.read_mac_secret); - gnutls_sfree_datum(&session->connection_state.write_mac_secret); + _gnutls_free_datum(&session->connection_state.read_mac_secret); + _gnutls_free_datum(&session->connection_state.write_mac_secret); _gnutls_buffer_clear( &session->internals.handshake_hash_buffer); _gnutls_buffer_clear( &session->internals.handshake_data_buffer); @@ -272,12 +272,12 @@ void _gnutls_deinit(gnutls_session session) if (session->connection_state.write_compression_state != NULL) _gnutls_comp_deinit(session->connection_state.write_compression_state, 0); - gnutls_sfree_datum( &session->cipher_specs.server_write_mac_secret); - gnutls_sfree_datum( &session->cipher_specs.client_write_mac_secret); - gnutls_sfree_datum( &session->cipher_specs.server_write_IV); - gnutls_sfree_datum( &session->cipher_specs.client_write_IV); - gnutls_sfree_datum( &session->cipher_specs.server_write_key); - gnutls_sfree_datum( &session->cipher_specs.client_write_key); + _gnutls_free_datum( &session->cipher_specs.server_write_mac_secret); + _gnutls_free_datum( &session->cipher_specs.client_write_mac_secret); + _gnutls_free_datum( &session->cipher_specs.server_write_IV); + _gnutls_free_datum( &session->cipher_specs.client_write_IV); + _gnutls_free_datum( &session->cipher_specs.server_write_key); + _gnutls_free_datum( &session->cipher_specs.client_write_key); if (session->key != NULL) { _gnutls_mpi_release(&session->key->KEY); diff --git a/lib/gnutls_str.c b/lib/gnutls_str.c index b04e6d3a6c..2cb96c9478 100644 --- a/lib/gnutls_str.c +++ b/lib/gnutls_str.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Nikos Mavroyanopoulos + * Copyright (C) 2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c index 164cb4d333..6e59b94fcb 100644 --- a/lib/gnutls_ui.c +++ b/lib/gnutls_ui.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_v2_compat.c b/lib/gnutls_v2_compat.c index 01225468f1..e8ac10e8b3 100644 --- a/lib/gnutls_v2_compat.c +++ b/lib/gnutls_v2_compat.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001 Nikos Mavroyanopoulos + * Copyright (C) 2001 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index 534a084d86..91912a7a05 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 Nikos Mavroyanopoulos + * Copyright (C) 2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -624,12 +624,12 @@ int gnutls_x509_extract_certificate_subject_alt_name(const gnutls_datum * cert, (_gnutls_get_pkix(), "PKIX1.SubjectAltName", &c2, "san")) != ASN1_SUCCESS) { gnutls_assert(); - gnutls_free_datum( &dnsname); + _gnutls_free_datum( &dnsname); return _gnutls_asn2err(result); } result = asn1_der_decoding(&c2, dnsname.data, dnsname.size, NULL); - gnutls_free_datum( &dnsname); + _gnutls_free_datum( &dnsname); if (result != ASN1_SUCCESS) { /* couldn't decode DER */ @@ -2066,7 +2066,7 @@ int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert, gCert->cert_type = GNUTLS_CRT_X509; if ( !(fast & CERT_NO_COPY)) { - if (gnutls_set_datum(&gCert->raw, derCert.data, derCert.size) < 0) { + if (_gnutls_set_datum(&gCert->raw, derCert.data, derCert.size) < 0) { gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; } @@ -2080,7 +2080,7 @@ int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert, "cert")) != ASN1_SUCCESS) { gnutls_assert(); - gnutls_free_datum( &gCert->raw); + _gnutls_free_datum( &gCert->raw); return _gnutls_asn2err(result); } @@ -2094,7 +2094,7 @@ int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert, _gnutls_log("CERT: Decoding error %d\n", result); gnutls_assert(); asn1_delete_structure(&c2); - gnutls_free_datum( &gCert->raw); + _gnutls_free_datum( &gCert->raw); return _gnutls_asn2err(result); } } @@ -2109,7 +2109,7 @@ int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert, _gnutls_log("CERT: Decoding error %d\n", result); gnutls_assert(); asn1_delete_structure(&c2); - gnutls_free_datum( &gCert->raw); + _gnutls_free_datum( &gCert->raw); return _gnutls_asn2err(result); } } @@ -2124,7 +2124,7 @@ int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert, gnutls_assert(); asn1_delete_structure(&c2); - gnutls_free_datum( &gCert->raw); + _gnutls_free_datum( &gCert->raw); return _gnutls_asn2err(result); } } @@ -2145,8 +2145,8 @@ int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert, if ((len % 8) != 0) { gnutls_assert(); asn1_delete_structure(&c2); - gnutls_free_datum( &gCert->raw); - gnutls_free_datum( &gCert->signature); + _gnutls_free_datum( &gCert->raw); + _gnutls_free_datum( &gCert->signature); return GNUTLS_E_UNIMPLEMENTED_FEATURE; } @@ -2162,7 +2162,7 @@ int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert, if (gCert->version < 0) { gnutls_assert(); asn1_delete_structure(&c2); - gnutls_free_datum( &gCert->raw); + _gnutls_free_datum( &gCert->raw); return GNUTLS_E_ASN1_GENERIC_ERROR; } } @@ -2178,14 +2178,14 @@ int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert, if (result != ASN1_SUCCESS) { gnutls_assert(); asn1_delete_structure(&c2); - gnutls_free_datum( &gCert->raw); + _gnutls_free_datum( &gCert->raw); return _gnutls_asn2err(result); } if ( (result=_gnutls_extract_x509_cert_mpi_params( oid, gCert, c2, "cert", str, sizeof(str))) < 0) { gnutls_assert(); asn1_delete_structure(&c2); - gnutls_free_datum( &gCert->raw); + _gnutls_free_datum( &gCert->raw); return result; } } @@ -2197,7 +2197,7 @@ int _gnutls_x509_cert2gnutls_cert(gnutls_cert * gCert, gnutls_datum derCert, gCert, fast)) < 0) { gnutls_assert(); asn1_delete_structure(&c2); - gnutls_free_datum( &gCert->raw); + _gnutls_free_datum( &gCert->raw); return result; } diff --git a/lib/x509_extensions.c b/lib/x509_extensions.c index d092e318d4..babf2ea0d1 100644 --- a/lib/x509_extensions.c +++ b/lib/x509_extensions.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/lib/x509_sig_check.c b/lib/x509_sig_check.c index fd9bb4db79..8458b91cb4 100644 --- a/lib/x509_sig_check.c +++ b/lib/x509_sig_check.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -69,7 +69,7 @@ int start, end; len = end - start + 1; str = &cert->raw.data[start]; - if (gnutls_set_datum( &ret, str, len) < 0) { + if (_gnutls_set_datum( &ret, str, len) < 0) { gnutls_assert(); return ret; } @@ -163,11 +163,11 @@ _pkcs1_rsa_verify_sig( const gnutls_datum* signature, gnutls_datum* text, GNUTLS digest_size = sizeof(digest); if ( (ret = _gnutls_get_ber_digest_info( &decrypted, &hash, digest, &digest_size)) != 0) { gnutls_assert(); - gnutls_sfree_datum( &decrypted); + _gnutls_free_datum( &decrypted); return ret; } - gnutls_sfree_datum( &decrypted); + _gnutls_free_datum( &decrypted); if (digest_size != _gnutls_hash_get_algo_len(hash)) { gnutls_assert(); @@ -210,32 +210,32 @@ gnutls_datum tbs; if (_pkcs1_rsa_verify_sig( &signature, &tbs, issuer->params, issuer->params_size)!=0) { gnutls_assert(); - gnutls_free_datum( &tbs); + _gnutls_free_datum( &tbs); return GNUTLS_CERT_INVALID; } - gnutls_free_datum(&tbs); + _gnutls_free_datum(&tbs); return 0; break; case GNUTLS_PK_DSA: if (_gnutls_dsa_verify( &tbs, &signature, issuer->params, issuer->params_size)!=0) { gnutls_assert(); - gnutls_free_datum( &tbs); + _gnutls_free_datum( &tbs); return GNUTLS_CERT_INVALID; } - gnutls_free_datum(&tbs); + _gnutls_free_datum(&tbs); return 0; break; default: gnutls_assert(); - gnutls_free_datum(&tbs); + _gnutls_free_datum(&tbs); return GNUTLS_E_INTERNAL_ERROR; } - gnutls_free_datum(&tbs); + _gnutls_free_datum(&tbs); _gnutls_x509_log( "X509_SIG: PK: %d\n", issuer->subject_pk_algorithm); diff --git a/libextra/auth_srp.c b/libextra/auth_srp.c index 0de75db090..850e1b29d5 100644 --- a/libextra/auth_srp.c +++ b/libextra/auth_srp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/libextra/auth_srp_passwd.c b/libextra/auth_srp_passwd.c index 99ca2dfcef..359b7eefb9 100644 --- a/libextra/auth_srp_passwd.c +++ b/libextra/auth_srp_passwd.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001 Nikos Mavroyanopoulos + * Copyright (C) 2001 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -84,7 +84,7 @@ int indx; /* now go for verifier */ p = rindex( str, ':'); /* we have verifier */ if (p==NULL) { - gnutls_free_datum(&entry->salt); + _gnutls_free_datum(&entry->salt); return GNUTLS_E_PARSING_ERROR; } @@ -95,7 +95,7 @@ int indx; ret = _gnutls_sbase64_decode( p, len, &verifier); if (ret <= 0) { gnutls_assert(); - gnutls_free_datum(&entry->salt); + _gnutls_free_datum(&entry->salt); return GNUTLS_E_PARSING_ERROR; } @@ -108,7 +108,7 @@ int indx; entry->username = gnutls_strdup(str); if (entry->username==NULL) { - gnutls_free_datum( &entry->salt); + _gnutls_free_datum( &entry->salt); gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; } @@ -152,7 +152,7 @@ int ret; /* now go for n - modulo */ p = rindex( str, ':'); /* we have n */ if (p==NULL) { - gnutls_free_datum( &entry->g); + _gnutls_free_datum( &entry->g); gnutls_assert(); return GNUTLS_E_PARSING_ERROR; } @@ -165,7 +165,7 @@ int ret; if (ret < 0) { gnutls_assert(); - gnutls_free_datum( &entry->g); + _gnutls_free_datum( &entry->g); return GNUTLS_E_PARSING_ERROR; } @@ -357,10 +357,10 @@ SRP_PWD_ENTRY* _gnutls_randomize_pwd_entry() { } void _gnutls_srp_clear_pwd_entry( SRP_PWD_ENTRY * entry) { - gnutls_free_datum(&entry->v); - gnutls_free_datum(&entry->g); - gnutls_free_datum(&entry->n); - gnutls_free_datum(&entry->salt); + _gnutls_free_datum(&entry->v); + _gnutls_free_datum(&entry->g); + _gnutls_free_datum(&entry->n); + _gnutls_free_datum(&entry->salt); gnutls_free(entry->username); gnutls_free(entry); diff --git a/libextra/auth_srp_rsa.c b/libextra/auth_srp_rsa.c index d8ee4ee51d..6476ea4f76 100644 --- a/libextra/auth_srp_rsa.c +++ b/libextra/auth_srp_rsa.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * @@ -127,7 +127,7 @@ int apr_cert_list_length; *data = gnutls_realloc_fast(*data, data_size + signature.size + 2); if (*data == NULL) { - gnutls_free_datum(&signature); + _gnutls_free_datum(&signature); gnutls_assert(); return GNUTLS_E_MEMORY_ERROR; } @@ -135,7 +135,7 @@ int apr_cert_list_length; _gnutls_write_datum16(&(*data)[data_size], signature); data_size += signature.size + 2; - gnutls_free_datum(&signature); + _gnutls_free_datum(&signature); return data_size; diff --git a/libextra/ext_srp.c b/libextra/ext_srp.c index 3cfa92167b..299625bd5c 100644 --- a/libextra/ext_srp.c +++ b/libextra/ext_srp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2001,2002 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/libextra/gnutls_extra.c b/libextra/gnutls_extra.c index e1713d9f51..21172ab19a 100644 --- a/libextra/gnutls_extra.c +++ b/libextra/gnutls_extra.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001 Nikos Mavroyanopoulos + * Copyright (C) 2001 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * diff --git a/libextra/gnutls_openpgp.c b/libextra/gnutls_openpgp.c index 4b167662b8..cf233b9f4f 100644 --- a/libextra/gnutls_openpgp.c +++ b/libextra/gnutls_openpgp.c @@ -444,7 +444,7 @@ _gnutls_openpgp_key2gnutls_key( gnutls_private_key *pkey, pkey->pk_algorithm = GNUTLS_PK_DSA; else if( is_RSA(pke_algo) ) pkey->pk_algorithm = GNUTLS_PK_RSA; - rc = gnutls_set_datum( &pkey->raw, raw_key->data, raw_key->size ); + rc = _gnutls_set_datum( &pkey->raw, raw_key->data, raw_key->size ); if( rc < 0 ) { release_mpi_array( pkey->params, i ); rc = GNUTLS_E_MEMORY_ERROR; @@ -485,7 +485,7 @@ _gnutls_openpgp_cert2gnutls_cert( gnutls_cert *cert, gnutls_datum raw ) if( !pkt ) rc = GNUTLS_E_INTERNAL_ERROR; if( !rc ) - rc = gnutls_set_datum( &cert->raw, raw.data, raw.size ); + rc = _gnutls_set_datum( &cert->raw, raw.data, raw.size ); if( !rc ) rc = openpgp_pk_to_gnutls_cert( cert, pkt->pkt.public_key ); @@ -623,8 +623,11 @@ gnutls_certificate_set_openpgp_key_mem( gnutls_certificate_credentials res, int n = res->ncerts; cdkPKT_public_key *pk = pkt->pkt.public_key; res->cert_list_length[n] = 1; - gnutls_set_datum( &res->cert_list[n][0].raw, - cert->data, cert->size ); + if (_gnutls_set_datum( &res->cert_list[n][0].raw, + cert->data, cert->size ) < 0) { + gnutls_assert(); + return GNUTLS_E_MEMORY_ERROR; + } openpgp_pk_to_gnutls_cert( &res->cert_list[n][0], pk ); i++; } @@ -643,10 +646,14 @@ gnutls_certificate_set_openpgp_key_mem( gnutls_certificate_credentials res, return GNUTLS_E_MEMORY_ERROR; } /* ncerts has been incremented before */ - gnutls_set_datum( &raw, key->data, key->size ); - rc =_gnutls_openpgp_key2gnutls_key( &res->pkey[res->ncerts-1], &raw ); - gnutls_free_datum(&raw); - + rc = _gnutls_set_datum( &raw, key->data, key->size ); + if (rc < 0) { + gnutls_assert(); + return rc; + } + rc = _gnutls_openpgp_key2gnutls_key( &res->pkey[res->ncerts-1], &raw ); + _gnutls_free_datum(&raw); + leave: cdk_kbnode_release( knode ); diff --git a/libextra/gnutls_srp.c b/libextra/gnutls_srp.c index 22b365efa1..f56ee914f1 100644 --- a/libextra/gnutls_srp.c +++ b/libextra/gnutls_srp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001 Nikos Mavroyanopoulos + * Copyright (C) 2001 Nikos Mavroyanopoulos * * This file is part of GNUTLS. * |