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_2_9_10-23-g4ceabba


From: Simon Josefsson
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_2_9_10-23-g4ceabba
Date: Mon, 03 May 2010 13:52:31 +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=4ceabba9547dc3e4af1d20d26b7d1ee535d1b78b

The branch, master has been updated
       via  4ceabba9547dc3e4af1d20d26b7d1ee535d1b78b (commit)
      from  15090a5f52a5f5ccbbb23ea2ddc18ff829a25a32 (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 4ceabba9547dc3e4af1d20d26b7d1ee535d1b78b
Author: Simon Josefsson <address@hidden>
Date:   Mon May 3 15:52:26 2010 +0200

    tests: Add another safe renegotiation self tests.

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

Summary of changes:
 tests/safe-renegotiation/Makefile.am               |    2 +-
 .../srn2.c}                                        |  148 ++++++++++++++++++++
 2 files changed, 149 insertions(+), 1 deletions(-)
 copy tests/{mini-x509-rehandshake.c => safe-renegotiation/srn2.c} (70%)

diff --git a/tests/safe-renegotiation/Makefile.am 
b/tests/safe-renegotiation/Makefile.am
index 0d967d8..8fb85fd 100644
--- a/tests/safe-renegotiation/Makefile.am
+++ b/tests/safe-renegotiation/Makefile.am
@@ -25,7 +25,7 @@ AM_CPPFLAGS = \
 AM_LDFLAGS = -no-install
 LDADD = ../../lib/libgnutls.la $(LTLIBGCRYPT) $(LIBSOCKET)
 
-ctests = srn1
+ctests = srn1 srn2
 
 check_PROGRAMS = $(ctests)
 TESTS = $(ctests)
diff --git a/tests/mini-x509-rehandshake.c b/tests/safe-renegotiation/srn2.c
similarity index 70%
copy from tests/mini-x509-rehandshake.c
copy to tests/safe-renegotiation/srn2.c
index 5664e65..0f4041f 100644
--- a/tests/mini-x509-rehandshake.c
+++ b/tests/safe-renegotiation/srn2.c
@@ -20,6 +20,11 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+/* Code based on ../mini-x509-rehandshake.c.
+ *
+ * Check that new APIs are behaving properly.
+ */
+
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -189,6 +194,14 @@ main (int argc, char *argv[])
   gnutls_transport_set_push_function (client, client_push);
   gnutls_transport_set_pull_function (client, client_pull);
 
+  /* Check that initially no session use the extension. */
+  if (gnutls_safe_renegotiation_status (server)
+      || gnutls_safe_renegotiation_status (client))
+    {
+      puts ("Client or server using extension before handshake?");
+      abort ();
+    }
+
   do
     {
       static int max_iter = 0;
@@ -226,6 +239,141 @@ main (int argc, char *argv[])
   if (cret != GNUTLS_E_SUCCESS && sret != GNUTLS_E_SUCCESS)
     exit_code = EXIT_FAILURE;
 
+  /* Check that both sessions use the extension. */
+  if (!gnutls_safe_renegotiation_status (server)
+      || !gnutls_safe_renegotiation_status (client))
+    {
+      puts ("Client or server not using safe renegotiation extension?");
+      abort ();
+    }
+
+  sret = gnutls_rehandshake (server);
+  if (debug_level > 0)
+    {
+      tls_log_func (0, "gnutls_rehandshake (server)...\n");
+      tls_log_func (0, gnutls_strerror (sret));
+      tls_log_func (0, "\n");
+    }
+
+  {
+    ssize_t n;
+    char b[1];
+    n = gnutls_record_recv (client, b, 1);
+    if (n != GNUTLS_E_REHANDSHAKE)
+      abort ();
+  }
+
+  cret = GNUTLS_E_AGAIN;
+  sret = GNUTLS_E_AGAIN;
+
+  do
+    {
+      static int max_iter = 0;
+      if (max_iter++ > 10)
+       abort ();
+
+      if (cret == GNUTLS_E_AGAIN)
+       {
+         cret = gnutls_handshake (client);
+         if (debug_level > 0)
+           {
+             tls_log_func (0, "second gnutls_handshake (client)...\n");
+             tls_log_func (0, gnutls_strerror (cret));
+             tls_log_func (0, "\n");
+           }
+       }
+
+      if (sret == GNUTLS_E_AGAIN)
+       {
+         sret = gnutls_handshake (server);
+         if (debug_level > 0)
+           {
+             tls_log_func (0, "second gnutls_handshake (server)...\n");
+             tls_log_func (0, gnutls_strerror (sret));
+             tls_log_func (0, "\n");
+           }
+       }
+    }
+  while (
+        /* Not done: */
+        !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS)
+        /* No error: */
+        && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN));
+
+  if (cret != GNUTLS_E_SUCCESS && sret != GNUTLS_E_SUCCESS)
+    exit_code = 1;
+
+  /* Check that session still use the extension. */
+  if (!gnutls_safe_renegotiation_status (server)
+      || !gnutls_safe_renegotiation_status (client))
+    {
+      puts ("Client or server not using safe renegotiation extension?");
+      abort ();
+    }
+
+  /* Check that this API does not affect anything after first
+     handshake. */
+  gnutls_safe_negotiation_set_initial (server, 0);
+
+  sret = gnutls_rehandshake (server);
+  if (debug_level > 0)
+    {
+      tls_log_func (0, "gnutls_rehandshake (server)...\n");
+      tls_log_func (0, gnutls_strerror (sret));
+      tls_log_func (0, "\n");
+    }
+
+  {
+    ssize_t n;
+    char b[1];
+    n = gnutls_record_recv (client, b, 1);
+    if (n != GNUTLS_E_REHANDSHAKE)
+      abort ();
+  }
+
+  cret = GNUTLS_E_AGAIN;
+  sret = GNUTLS_E_AGAIN;
+
+  do
+    {
+      static int max_iter = 0;
+      if (max_iter++ > 10)
+       abort ();
+
+      if (cret == GNUTLS_E_AGAIN)
+       {
+         cret = gnutls_handshake (client);
+         if (debug_level > 0)
+           {
+             tls_log_func (0, "second gnutls_handshake (client)...\n");
+             tls_log_func (0, gnutls_strerror (cret));
+             tls_log_func (0, "\n");
+           }
+       }
+
+      if (sret == GNUTLS_E_AGAIN)
+       {
+         sret = gnutls_handshake (server);
+         if (debug_level > 0)
+           {
+             tls_log_func (0, "second gnutls_handshake (server)...\n");
+             tls_log_func (0, gnutls_strerror (sret));
+             tls_log_func (0, "\n");
+           }
+       }
+    }
+  while (
+        /* Not done: */
+        !(cret == GNUTLS_E_SUCCESS && sret == GNUTLS_E_SUCCESS)
+        /* No error: */
+        && (cret == GNUTLS_E_AGAIN || sret == GNUTLS_E_AGAIN));
+
+  if (cret != GNUTLS_E_SUCCESS && sret != GNUTLS_E_SUCCESS)
+    exit_code = 1;
+
+  /* Check that disabling the extension will break rehandshakes. */
+  gnutls_safe_renegotiation_set (client, 0);
+
   sret = gnutls_rehandshake (server);
   if (debug_level > 0)
     {


hooks/post-receive
-- 
GNU gnutls




reply via email to

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