From 22e3613826a28f046f3e48639956c7721e7c8de0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 13 Oct 2008 03:56:53 +0000 Subject: [PATCH] integrating fixes in gnutls --- src/daemon/https/tls/auth_rsa.c | 1 - src/daemon/https/tls/auth_rsa_export.c | 1 - src/daemon/https/tls/gnutls_cert.c | 1 - src/daemon/https/tls/gnutls_cert.h | 1 - src/daemon/https/tls/gnutls_constate.c | 3 -- src/daemon/https/tls/gnutls_handshake.c | 2 +- src/daemon/https/tls/gnutls_mpi.h | 2 -- src/daemon/https/tls/gnutls_sig.c | 1 - src/daemon/https/tls/gnutls_x509.c | 4 +-- src/daemon/https/x509/common.c | 38 +++++++++++-------------- src/daemon/https/x509/x509.h | 1 + 11 files changed, 19 insertions(+), 36 deletions(-) diff --git a/src/daemon/https/tls/auth_rsa.c b/src/daemon/https/tls/auth_rsa.c index f39a91fb..1b461951 100644 --- a/src/daemon/https/tls/auth_rsa.c +++ b/src/daemon/https/tls/auth_rsa.c @@ -31,7 +31,6 @@ #include "gnutls_errors.h" #include "gnutls_dh.h" #include "gnutls_num.h" -#include "libtasn1.h" #include "gnutls_datum.h" #include "auth_cert.h" #include diff --git a/src/daemon/https/tls/auth_rsa_export.c b/src/daemon/https/tls/auth_rsa_export.c index 5fdce12e..575a2b72 100644 --- a/src/daemon/https/tls/auth_rsa_export.c +++ b/src/daemon/https/tls/auth_rsa_export.c @@ -31,7 +31,6 @@ #include "gnutls_errors.h" #include "gnutls_dh.h" #include "gnutls_num.h" -#include "libtasn1.h" #include "gnutls_datum.h" #include "auth_cert.h" #include diff --git a/src/daemon/https/tls/gnutls_cert.c b/src/daemon/https/tls/gnutls_cert.c index d01d3918..52be5fb5 100644 --- a/src/daemon/https/tls/gnutls_cert.c +++ b/src/daemon/https/tls/gnutls_cert.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/src/daemon/https/tls/gnutls_cert.h b/src/daemon/https/tls/gnutls_cert.h index ee3b3ca8..0a1a04db 100644 --- a/src/daemon/https/tls/gnutls_cert.h +++ b/src/daemon/https/tls/gnutls_cert.h @@ -26,7 +26,6 @@ # define GNUTLS_CERT_H #include -#include #include "x509.h" #define MAX_PUBLIC_PARAMS_SIZE 4 /* ok for RSA and DSA */ diff --git a/src/daemon/https/tls/gnutls_constate.c b/src/daemon/https/tls/gnutls_constate.c index 11c8beca..fe5cf5bd 100644 --- a/src/daemon/https/tls/gnutls_constate.c +++ b/src/daemon/https/tls/gnutls_constate.c @@ -59,9 +59,6 @@ int MHD__gnutls_set_keys (MHD_gtls_session_t session, int hash_size, int IV_size, int key_size, int export_flag) { - -/* FIXME: This function is too long - */ opaque *key_block; opaque rnd[2 * TLS_RANDOM_SIZE]; opaque rrnd[2 * TLS_RANDOM_SIZE]; diff --git a/src/daemon/https/tls/gnutls_handshake.c b/src/daemon/https/tls/gnutls_handshake.c index 291ad03e..db28ad9a 100644 --- a/src/daemon/https/tls/gnutls_handshake.c +++ b/src/daemon/https/tls/gnutls_handshake.c @@ -1012,7 +1012,7 @@ MHD_gtls_send_handshake (MHD_gtls_session_t session, void *i_data, MHD__gnutls_handshake_log ("HSK[%x]: %s was sent [%ld bytes]\n", session, MHD__gnutls_handshake2str (type), - datasize); + (long) datasize); MHD_gnutls_afree (data); diff --git a/src/daemon/https/tls/gnutls_mpi.h b/src/daemon/https/tls/gnutls_mpi.h index ec633ca0..b3494024 100644 --- a/src/daemon/https/tls/gnutls_mpi.h +++ b/src/daemon/https/tls/gnutls_mpi.h @@ -27,8 +27,6 @@ # include # include -# include -/* lgl */ # include "gc.h" typedef gcry_mpi_t mpi_t; diff --git a/src/daemon/https/tls/gnutls_sig.c b/src/daemon/https/tls/gnutls_sig.c index fcd756b5..afa7c8e1 100644 --- a/src/daemon/https/tls/gnutls_sig.c +++ b/src/daemon/https/tls/gnutls_sig.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/src/daemon/https/tls/gnutls_x509.c b/src/daemon/https/tls/gnutls_x509.c index 06ee8635..a326ac01 100644 --- a/src/daemon/https/tls/gnutls_x509.c +++ b/src/daemon/https/tls/gnutls_x509.c @@ -29,7 +29,6 @@ #include #include "gnutls_dh.h" #include "gnutls_num.h" -#include "libtasn1.h" #include "gnutls_datum.h" #include #include @@ -141,8 +140,7 @@ MHD__gnutls_x509_cert_verify_peers (MHD_gtls_session_t session, */ peer_certificate_list_size = info->ncerts; peer_certificate_list = - MHD_gnutls_calloc (1, - peer_certificate_list_size * + MHD_gnutls_calloc (peer_certificate_list_size, sizeof (MHD_gnutls_x509_crt_t)); if (peer_certificate_list == NULL) { diff --git a/src/daemon/https/x509/common.c b/src/daemon/https/x509/common.c index ca2e355f..1d9c60c7 100644 --- a/src/daemon/https/x509/common.c +++ b/src/daemon/https/x509/common.c @@ -410,39 +410,33 @@ MHD__gnutls_x509_data2hex (const opaque * data, { char *res; char escaped[MAX_STRING_LEN]; + unsigned int size; if (2 * data_size + 1 > MAX_STRING_LEN) { MHD_gnutls_assert (); return GNUTLS_E_INTERNAL_ERROR; } - res = MHD_gtls_bin2hex (data, data_size, escaped, sizeof (escaped)); - - if (res) - { - unsigned int size = strlen (res) + 1; - if (size + 1 > *sizeof_out) - { - *sizeof_out = size; - return GNUTLS_E_SHORT_MEMORY_BUFFER; - } - *sizeof_out = size; /* -1 for the null +1 for the '#' */ - - if (out) - { - strcpy ((char *) out, "#"); - strcat ((char *) out, res); - } - - return 0; - } - else + if (!res) { MHD_gnutls_assert (); return GNUTLS_E_INTERNAL_ERROR; } - + + size = strlen (res) + 1; + if (size + 1 > *sizeof_out) + { + *sizeof_out = size; + return GNUTLS_E_SHORT_MEMORY_BUFFER; + } + *sizeof_out = size; /* -1 for the null +1 for the '#' */ + + if (out) + { + strcpy ((char*) out, "#"); + strcat ((char*) out, res); + } return 0; } diff --git a/src/daemon/https/x509/x509.h b/src/daemon/https/x509/x509.h index 3afda0da..26892fc8 100644 --- a/src/daemon/https/x509/x509.h +++ b/src/daemon/https/x509/x509.h @@ -33,6 +33,7 @@ extern "C" #endif #include +#include #include "gnutls_mpi.h" /* Some OIDs usually found in Distinguished names, or