* Version 3.0.4 (unreleased)
+** libgnutls: Fixed the deflate compression code.
+
** libgnutls: Added gnutls_x509_crt_get_authority_info_access.
Used to get the PKIX Authority Information Access (AIA) field.
if test -n "$VALGRIND" && $VALGRIND -q true > /dev/null 2>&1; then
opt_valgrind_tests=yes
- VALGRIND="$VALGRIND -q --error-exitcode=1"
+ VALGRIND="$VALGRIND -q --error-exitcode=1 --suppressions=suppressions.valgrind"
else
opt_valgrind_tests=no
VALGRIND=
if test -n "$VALGRIND" && $VALGRIND -q true > /dev/null 2>&1; then
opt_valgrind_tests=yes
- VALGRIND="$VALGRIND -q --error-exitcode=1 --leak-check=full"
-+ VALGRIND="$VALGRIND -q --error-exitcode=1"
++ VALGRIND="$VALGRIND -q --error-exitcode=1 --suppressions=suppressions.valgrind"
else
opt_valgrind_tests=no
VALGRIND=
if (comp.data == NULL)
return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
- ret = _gnutls_compress( params->write.compression_state, data, data_size, comp.data, comp.size);
+ ret = _gnutls_compress( ¶ms->write.compression_state, data, data_size, comp.data, comp.size);
if (ret < 0)
{
gnutls_free(comp.data);
if (ret != 0)
{
- ret = _gnutls_decompress(params->read.compression_state, tmp_data, data_size, data, max_data_size);
+ ret = _gnutls_decompress( ¶ms->read.compression_state, tmp_data, data_size, data, max_data_size);
if (ret < 0)
goto leave;
}
/* The flag d is the direction (compress, decompress). Non zero is
* decompress.
*/
-comp_hd_t
-_gnutls_comp_init (gnutls_compression_method_t method, int d)
+int _gnutls_comp_init (comp_hd_st* handle, gnutls_compression_method_t method, int d)
{
- comp_hd_t ret;
-
- ret = gnutls_malloc (sizeof (struct comp_hd_t_STRUCT));
- if (ret == NULL)
- {
- gnutls_assert ();
- return NULL;
- }
-
- ret->algo = method;
- ret->handle = NULL;
+ handle->algo = method;
+ handle->handle = NULL;
switch (method)
{
mem_level = get_mem_level (method);
comp_level = get_comp_level (method);
- ret->handle = gnutls_malloc (sizeof (z_stream));
- if (ret->handle == NULL)
- {
- gnutls_assert ();
- goto cleanup_ret;
- }
+ handle->handle = gnutls_malloc (sizeof (z_stream));
+ if (handle->handle == NULL)
+ return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
- zhandle = ret->handle;
+ zhandle = handle->handle;
zhandle->zalloc = (alloc_func) 0;
zhandle->zfree = (free_func) 0;
if (err != Z_OK)
{
gnutls_assert ();
- gnutls_free (ret->handle);
- goto cleanup_ret;
+ gnutls_free (handle->handle);
+ return GNUTLS_E_COMPRESSION_FAILED;
}
}
break;
case GNUTLS_COMP_NULL:
case GNUTLS_COMP_UNKNOWN:
break;
+ default:
+ return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM;
}
- return ret;
-
-cleanup_ret:
- gnutls_free (ret);
- return NULL;
+ return 0;
}
/* The flag d is the direction (compress, decompress). Non zero is
* decompress.
*/
void
-_gnutls_comp_deinit (comp_hd_t handle, int d)
+_gnutls_comp_deinit (comp_hd_st* handle, int d)
{
if (handle != NULL)
{
break;
}
gnutls_free (handle->handle);
- gnutls_free (handle);
-
+ handle->handle = NULL;
}
}
*/
int
-_gnutls_compress (comp_hd_t handle, const opaque * plain,
+_gnutls_compress (comp_hd_st *handle, const opaque * plain,
size_t plain_size, opaque * compressed,
size_t max_comp_size)
{
int
-_gnutls_decompress (comp_hd_t handle, opaque * compressed,
+_gnutls_decompress (comp_hd_st *handle, opaque * compressed,
size_t compressed_size, opaque * plain,
size_t max_plain_size)
{
#define GNUTLS_COMP_FAILED NULL
-typedef struct comp_hd_t_STRUCT
+typedef struct comp_hd_st
{
void *handle;
gnutls_compression_method_t algo;
-} *comp_hd_t;
+} comp_hd_st;
-comp_hd_t _gnutls_comp_init (gnutls_compression_method_t, int d);
-void _gnutls_comp_deinit (comp_hd_t handle, int d);
+int _gnutls_comp_init (comp_hd_st*, gnutls_compression_method_t, int d);
+void _gnutls_comp_deinit (comp_hd_st* handle, int d);
-int _gnutls_decompress (comp_hd_t handle, opaque * compressed,
+int _gnutls_decompress (comp_hd_st* handle, opaque * compressed,
size_t compressed_size, opaque * plain,
size_t max_plain_size);
-int _gnutls_compress (comp_hd_t, const opaque * plain, size_t plain_size,
+int _gnutls_compress (comp_hd_st*, const opaque * plain, size_t plain_size,
opaque * compressed, size_t max_comp_size);
struct gnutls_compression_entry
if (ret < 0 && params->cipher_algorithm != GNUTLS_CIPHER_NULL)
return gnutls_assert_val (ret);
- state->compression_state =
- _gnutls_comp_init (params->compression_algorithm, read/*1==decompress*/);
+ ret =
+ _gnutls_comp_init (&state->compression_state, params->compression_algorithm, read/*1==decompress*/);
- if (state->compression_state == GNUTLS_COMP_FAILED)
- return gnutls_assert_val (GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM);
+ if (ret < 0)
+ return gnutls_assert_val (ret);
return 0;
}
_gnutls_auth_cipher_deinit (&state->cipher_state);
- if (state->compression_state != NULL)
- _gnutls_comp_deinit (state->compression_state, d);
+ if (state->compression_state.handle != NULL)
+ _gnutls_comp_deinit (&state->compression_state, d);
}
void
gnutls_datum_t IV;
gnutls_datum_t key;
auth_cipher_hd_st cipher_state;
- comp_hd_t compression_state;
+ comp_hd_st compression_state;
uint64 sequence_number;
};
SUBDIRS += suite
endif
-EXTRA_DIST = libgcrypt.supp eagain-common.h
+EXTRA_DIST = suppressions.valgrind eagain-common.h
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
AM_CPPFLAGS = \
noinst_LTLIBRARIES = libutils.la
libutils_la_SOURCES = utils.h utils.c
-ctests = simple gc set_pkcs12_cred certder certuniqueid mpi \
+ctests = mini-deflate simple gc set_pkcs12_cred certder certuniqueid mpi \
certificate_set_x509_crl dn parse_ca moredn mini \
hostname-check cve-2008-4989 pkcs12_s2k chainverify crq_key_id \
x509sign-verify cve-2009-1415 cve-2009-1416 crq_apis \
init_roundtrip pkcs12_s2k_pem dn2 mini-eagain \
nul-in-x509-names x509_altname pkcs12_encode mini-x509 \
mini-x509-rehandshake rng-fork mini-eagain-dtls cipher-test \
- x509cert x509cert-tl infoaccess #gendh mini-deflate
-#gendh is out because it is too slow in valgrind and
-#mini-deflate is out because zlib has warnings in valgrind
+ x509cert x509cert-tl infoaccess #gendh
+#gendh is out because it is too slow in valgrind
if ENABLE_OPENSSL
ctests += openssl
TESTS = $(ctests)
TESTS_ENVIRONMENT = $(VALGRIND)
-EXTRA_DIST = README
+EXTRA_DIST = README suppressions.valgrind
-# libgcrypt.supp -- Valgrind suppresion file for libgcrypt
+# suppressions -- Valgrind suppresion file for libgcrypt
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008-2011 Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
+{
+ zlib inflateInit
+ Memcheck:Cond
+ fun:inflateReset2
+ fun:inflateInit2_
+ fun:_gnutls_comp_init
+ fun:_gnutls_init_record_state
+ fun:_gnutls_epoch_set_keys
+ fun:_gnutls_write_connection_state_init
+ fun:_gnutls_send_handshake_final
+ fun:_gnutls_handshake_common
+ fun:gnutls_handshake
+ fun:doit
+ fun:main
+}
+
{
libgcrypt1
Memcheck:Leak