gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, master, updated. gnutls_3_0_3-25-g60a13b9


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_3-25-g60a13b9
Date: Fri, 23 Sep 2011 15:24:33 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=60a13b98e9f410c3b1019252f271d3c0f20b2e61

The branch, master has been updated
       via  60a13b98e9f410c3b1019252f271d3c0f20b2e61 (commit)
       via  b0ff3f86b1399edf3d3826baa221bed86b6bef91 (commit)
       via  615f8966f295417d3bb608fd325bbfac57a279c2 (commit)
       via  56120e2caabc4b7becbd961187a4aa92e3534215 (commit)
      from  8aae368bd1fb38e83ae2dc1de9c46e9d99252f21 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 60a13b98e9f410c3b1019252f271d3c0f20b2e61
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Fri Sep 23 16:39:29 2011 +0200

    a hack to allow compilation on systems without AF_LOCAL.

commit b0ff3f86b1399edf3d3826baa221bed86b6bef91
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Fri Sep 23 16:34:12 2011 +0200

    Disable openpgp code when not requested. Reported by Bjorn Christensen.

commit 615f8966f295417d3bb608fd325bbfac57a279c2
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Fri Sep 23 14:31:01 2011 +0200

    more silent tests.

commit 56120e2caabc4b7becbd961187a4aa92e3534215
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Fri Sep 23 14:22:33 2011 +0200

    Further optimizations in the compression code. Re-enabled the test program 
by suppressing the zlib warning.

-----------------------------------------------------------------------

Summary of changes:
 NEWS                                               |    2 +
 gl/m4/valgrind-tests.m4                            |    2 +-
 gl/override/m4/valgrind-tests.m4.diff              |    2 +-
 lib/gnutls_cipher.c                                |    4 +-
 lib/gnutls_compress.c                              |   48 +++++++-------------
 lib/gnutls_compress.h                              |   12 +++---
 lib/gnutls_constate.c                              |   12 +++---
 lib/gnutls_int.h                                   |    2 +-
 lib/gnutls_pcert.c                                 |    4 ++
 lib/nettle/egd.c                                   |   10 +++-
 tests/Makefile.am                                  |    9 ++--
 tests/cve-2009-1416.c                              |    2 -
 tests/mpi.c                                        |    2 +-
 tests/rng-fork.c                                   |    4 +-
 tests/safe-renegotiation/Makefile.am               |    2 +-
 .../safe-renegotiation/suppressions.valgrind       |    0
 tests/{libgcrypt.supp => suppressions.valgrind}    |   20 +++++++-
 tests/x509cert-tl.c                                |    2 +-
 tests/x509cert.c                                   |    2 +-
 19 files changed, 75 insertions(+), 66 deletions(-)
 copy doc/reference/gnutls.types => 
tests/safe-renegotiation/suppressions.valgrind (100%)
 rename tests/{libgcrypt.supp => suppressions.valgrind} (88%)

diff --git a/NEWS b/NEWS
index e89105b..29502cd 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ See the end for copying conditions.
 
 * 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.
 
diff --git a/gl/m4/valgrind-tests.m4 b/gl/m4/valgrind-tests.m4
index 98d4487..9c4d029 100644
--- a/gl/m4/valgrind-tests.m4
+++ b/gl/m4/valgrind-tests.m4
@@ -23,7 +23,7 @@ AC_DEFUN([gl_VALGRIND_TESTS],
 
   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=
diff --git a/gl/override/m4/valgrind-tests.m4.diff 
b/gl/override/m4/valgrind-tests.m4.diff
index 8a4f643..dac9a24 100644
--- a/gl/override/m4/valgrind-tests.m4.diff
+++ b/gl/override/m4/valgrind-tests.m4.diff
@@ -5,7 +5,7 @@
    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=
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
index 75ca6ab..716b7c9 100644
--- a/lib/gnutls_cipher.c
+++ b/lib/gnutls_cipher.c
@@ -105,7 +105,7 @@ _gnutls_encrypt (gnutls_session_t session, const opaque * 
headers,
       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( &params->write.compression_state, data, 
data_size, comp.data, comp.size);
       if (ret < 0)
         {
           gnutls_free(comp.data);
@@ -182,7 +182,7 @@ _gnutls_decrypt (gnutls_session_t session, opaque * 
ciphertext,
         
       if (ret != 0)
         {
-          ret = _gnutls_decompress(params->read.compression_state, tmp_data, 
data_size, data, max_data_size);
+          ret = _gnutls_decompress( &params->read.compression_state, tmp_data, 
data_size, data, max_data_size);
           if (ret < 0)
             goto leave;
         }
diff --git a/lib/gnutls_compress.c b/lib/gnutls_compress.c
index d682511..3821a84 100644
--- a/lib/gnutls_compress.c
+++ b/lib/gnutls_compress.c
@@ -241,20 +241,10 @@ _gnutls_supported_compression_methods (gnutls_session_t 
session,
 /* 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)
     {
@@ -270,14 +260,11 @@ _gnutls_comp_init (gnutls_compression_method_t method, 
int d)
         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;
@@ -294,8 +281,8 @@ _gnutls_comp_init (gnutls_compression_method_t method, int 
d)
         if (err != Z_OK)
           {
             gnutls_assert ();
-            gnutls_free (ret->handle);
-            goto cleanup_ret;
+            gnutls_free (handle->handle);
+            return GNUTLS_E_COMPRESSION_FAILED;
           }
       }
       break;
@@ -303,20 +290,18 @@ _gnutls_comp_init (gnutls_compression_method_t method, 
int d)
     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)
     {
@@ -336,8 +321,7 @@ _gnutls_comp_deinit (comp_hd_t handle, int d)
           break;
         }
       gnutls_free (handle->handle);
-      gnutls_free (handle);
-
+      handle->handle = NULL;
     }
 }
 
@@ -345,7 +329,7 @@ _gnutls_comp_deinit (comp_hd_t handle, int d)
  */
 
 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)
 {
@@ -399,7 +383,7 @@ _gnutls_compress (comp_hd_t handle, const opaque * plain,
 
 
 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)
 {
diff --git a/lib/gnutls_compress.h b/lib/gnutls_compress.h
index 7f3545c..559906d 100644
--- a/lib/gnutls_compress.h
+++ b/lib/gnutls_compress.h
@@ -35,19 +35,19 @@ gnutls_compression_method_t _gnutls_compression_get_id (int 
num);
 
 #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
diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c
index d747cc3..6d25940 100644
--- a/lib/gnutls_constate.c
+++ b/lib/gnutls_constate.c
@@ -306,11 +306,11 @@ _gnutls_init_record_state (record_parameters_st * params, 
gnutls_protocol_t ver,
   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;
 }
@@ -815,8 +815,8 @@ free_record_state (record_state_st * state, int d)
 
   _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
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index 9b0b8bf..d47ce59 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -495,7 +495,7 @@ struct record_state_st
   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;
 };
 
diff --git a/lib/gnutls_pcert.c b/lib/gnutls_pcert.c
index 9ee43f3..b277472 100644
--- a/lib/gnutls_pcert.c
+++ b/lib/gnutls_pcert.c
@@ -218,6 +218,8 @@ cleanup:
   return ret;
 }
 
+#ifdef ENABLE_OPENPGP
+
 /**
  * gnutls_pcert_import_openpgp:
  * @pcert: The pcert structure
@@ -355,6 +357,8 @@ cleanup:
   return ret;
 }
 
+#endif
+
 /**
  * gnutls_pcert_deinit:
  * @pcert: The structure to be deinitialized
diff --git a/lib/nettle/egd.c b/lib/nettle/egd.c
index bd35d56..f472aed 100644
--- a/lib/nettle/egd.c
+++ b/lib/nettle/egd.c
@@ -34,6 +34,12 @@
 #include <gnutls_str.h>
 #include <gnutls_errors.h>
 
+#ifdef AF_UNIX
+# define LOCAL_SOCKET_TYPE AF_UNIX
+#else
+# define LOCAL_SOCKET_TYPE AF_LOCAL
+#endif
+
 #ifndef offsetof
 #define offsetof(type, member) ((size_t) &((type *)0)->member)
 #endif
@@ -142,12 +148,12 @@ _rndegd_connect_socket (void)
     }
 
   memset (&addr, 0, sizeof addr);
-  addr.sun_family = AF_LOCAL;
+  addr.sun_family = LOCAL_SOCKET_TYPE;
   _gnutls_str_cpy (addr.sun_path, sizeof(addr.sun_path), name);
   addr_len = (offsetof (struct sockaddr_un, sun_path)
               + strlen (addr.sun_path));
 
-  fd = socket (AF_LOCAL, SOCK_STREAM, 0);
+  fd = socket (LOCAL_SOCKET_TYPE, SOCK_STREAM, 0);
   if (fd == -1)
     {
       _gnutls_debug_log ("can't create unix domain socket: %s\n",
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 23c0bae..08104a7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -30,7 +30,7 @@ if WANT_TEST_SUITE
 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 = \
@@ -57,16 +57,15 @@ endif
 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
diff --git a/tests/cve-2009-1416.c b/tests/cve-2009-1416.c
index faa5d1d..addc3cb 100644
--- a/tests/cve-2009-1416.c
+++ b/tests/cve-2009-1416.c
@@ -71,8 +71,6 @@ main (void)
       printf ("buggy\n");
       return 1;
     }
-  else
-    printf ("success!\n");
 
   gnutls_free (p.data);
   gnutls_free (q.data);
diff --git a/tests/mpi.c b/tests/mpi.c
index 23289de..fdef519 100644
--- a/tests/mpi.c
+++ b/tests/mpi.c
@@ -83,5 +83,5 @@ doit (void)
   _gnutls_mpi_release (&n3);
   _gnutls_mpi_release (&n4);
 
-  success ("mpi ops ok\n");
+  if (debug) success ("mpi ops ok\n");
 }
diff --git a/tests/rng-fork.c b/tests/rng-fork.c
index 5b086b9..7bbb5a4 100644
--- a/tests/rng-fork.c
+++ b/tests/rng-fork.c
@@ -97,8 +97,8 @@ doit (void)
           fail("error in the random generator. Produces same valus after 
fork()");
           return;
         }
-      
-      success("success");
+      if(debug)
+        success("success\n");
     }
 }
 #else
diff --git a/tests/safe-renegotiation/Makefile.am 
b/tests/safe-renegotiation/Makefile.am
index 8b0c658..17d4684 100644
--- a/tests/safe-renegotiation/Makefile.am
+++ b/tests/safe-renegotiation/Makefile.am
@@ -32,4 +32,4 @@ check_PROGRAMS = $(ctests)
 TESTS = $(ctests)
 TESTS_ENVIRONMENT = $(VALGRIND)
 
-EXTRA_DIST = README
+EXTRA_DIST = README suppressions.valgrind
diff --git a/doc/reference/gnutls.types 
b/tests/safe-renegotiation/suppressions.valgrind
similarity index 100%
copy from doc/reference/gnutls.types
copy to tests/safe-renegotiation/suppressions.valgrind
diff --git a/tests/libgcrypt.supp b/tests/suppressions.valgrind
similarity index 88%
rename from tests/libgcrypt.supp
rename to tests/suppressions.valgrind
index 3766b25..57c4222 100644
--- a/tests/libgcrypt.supp
+++ b/tests/suppressions.valgrind
@@ -1,12 +1,28 @@
-# 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
    fun:malloc
diff --git a/tests/x509cert-tl.c b/tests/x509cert-tl.c
index f3936f7..a490c27 100644
--- a/tests/x509cert-tl.c
+++ b/tests/x509cert-tl.c
@@ -207,5 +207,5 @@ doit (void)
   
   gnutls_global_deinit();
   
-  success("success");
+  if (debug) success("success");
 }
diff --git a/tests/x509cert.c b/tests/x509cert.c
index 8edd711..78d0049 100644
--- a/tests/x509cert.c
+++ b/tests/x509cert.c
@@ -203,5 +203,5 @@ doit (void)
   
   gnutls_global_deinit();
 
-  success("success");
+  if (debug) success("success");
 }


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]