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_18-22-gd2568a5


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_18-22-gd2568a5
Date: Wed, 11 Apr 2012 19:55:49 +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=d2568a57b69140d654c5c86660d9cbc246862aba

The branch, master has been updated
       via  d2568a57b69140d654c5c86660d9cbc246862aba (commit)
       via  b7cd6d7b233e142b1df336e3d1294361f9e71d8c (commit)
       via  cf80b7bb960549bc8c85c22a8f38abfa3908868f (commit)
      from  4dd4038557f89f3384f3a3246b8601db4fe0fa63 (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 d2568a57b69140d654c5c86660d9cbc246862aba
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Wed Apr 11 21:55:34 2012 +0200

    Added TLS 1.2 interop tests.

commit b7cd6d7b233e142b1df336e3d1294361f9e71d8c
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Wed Apr 11 21:23:10 2012 +0200

    Relax strict DSA/ECDSA checks to allow broader interoperability. Stronger 
hash algorithms are now allowed even if DSA might only allow SHA1.

commit cf80b7bb960549bc8c85c22a8f38abfa3908868f
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Wed Apr 11 20:47:20 2012 +0200

    Add sanity checks in Diffie-Hellman key exchange values.

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

Summary of changes:
 NEWS                        |    5 ++
 lib/gnutls_dh.c             |   37 +++++++++++----
 lib/gnutls_pubkey.c         |    4 +-
 lib/gnutls_state.c          |    2 +-
 tests/suite/testcompat-main |  106 ++++++++++++++++++++++++++++++++++++-------
 5 files changed, 126 insertions(+), 28 deletions(-)

diff --git a/NEWS b/NEWS
index 13b787b..fb1b7c2 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,11 @@ of the next call to gnutls_record_recv(). To compensate
 for unprocessed data, the gnutls_record_check_unprocessed() 
 was added.
 
+** libgnutls: in ECDSA and DSA TLS 1.2 authentication be less
+strict in hash selection, and allow a stronger hash to
+be used than the appropriate, to improve interoperability
+with openssl.
+
 ** tests: Disabled floating point test, and corrections
 in pkcs12 decoding tests.
 
diff --git a/lib/gnutls_dh.c b/lib/gnutls_dh.c
index 3cd0922..79eb062 100644
--- a/lib/gnutls_dh.c
+++ b/lib/gnutls_dh.c
@@ -63,39 +63,57 @@ gnutls_calc_dh_secret (bigint_t * ret_x, bigint_t g, 
bigint_t prime,
       return NULL;
     }
 
-  x = _gnutls_mpi_randomize (NULL, x_size, GNUTLS_RND_RANDOM);
+  x = _gnutls_mpi_new(x_size);
   if (x == NULL)
     {
       gnutls_assert ();
-      return NULL;
+      goto fail;
     }
 
   e = _gnutls_mpi_alloc_like (prime);
   if (e == NULL)
     {
       gnutls_assert ();
-      if (ret_x)
-        *ret_x = NULL;
-
-      _gnutls_mpi_release (&x);
-      return NULL;
+      goto fail;
     }
 
-  _gnutls_mpi_powm (e, g, x, prime);
+  do
+    {
+      if (_gnutls_mpi_randomize (x, x_size, GNUTLS_RND_RANDOM) == NULL)
+        {
+          gnutls_assert();
+          goto fail;
+        }
+
+      _gnutls_mpi_powm (e, g, x, prime);
+    }
+  while(_gnutls_mpi_cmp_ui(e, 1) == 0);
 
   if (ret_x)
     *ret_x = x;
   else
     _gnutls_mpi_release (&x);
   return e;
-}
 
+fail:
+  if (x) _gnutls_mpi_release (&x);
+  return NULL;
 
+}
+
+/* returns f^x mod prime 
+ */
 bigint_t
 gnutls_calc_dh_key (bigint_t f, bigint_t x, bigint_t prime)
 {
   bigint_t k;
   int bits;
+  
+  if (_gnutls_mpi_cmp_ui(f, 1) == 0)
+    {
+      gnutls_assert();
+      return NULL;
+    }
 
   bits = _gnutls_mpi_get_nbits (prime);
   if (bits <= 0 || bits > MAX_BITS)
@@ -107,6 +125,7 @@ gnutls_calc_dh_key (bigint_t f, bigint_t x, bigint_t prime)
   k = _gnutls_mpi_alloc_like (prime);
   if (k == NULL)
     return NULL;
+
   _gnutls_mpi_powm (k, f, x, prime);
   return k;
 }
diff --git a/lib/gnutls_pubkey.c b/lib/gnutls_pubkey.c
index 32cdb72..6496537 100644
--- a/lib/gnutls_pubkey.c
+++ b/lib/gnutls_pubkey.c
@@ -1490,7 +1490,7 @@ unsigned int hash_algo;
         }
       else if (sign != GNUTLS_SIGN_UNKNOWN)
         {
-          if (_gnutls_hash_get_algo_len(_gnutls_sign_get_hash_algorithm(sign)) 
!= hash_size)
+          if (_gnutls_hash_get_algo_len(_gnutls_sign_get_hash_algorithm(sign)) 
< hash_size)
             return GNUTLS_E_UNWANTED_ALGORITHM;
         }
         
@@ -1501,7 +1501,7 @@ unsigned int hash_algo;
         {
           hash_algo = _gnutls_dsa_q_to_hash (pubkey->pk_algorithm, 
&pubkey->params, &hash_size);
 
-          if (_gnutls_hash_get_algo_len(_gnutls_sign_get_hash_algorithm(sign)) 
!= hash_size)
+          if (_gnutls_hash_get_algo_len(_gnutls_sign_get_hash_algorithm(sign)) 
< hash_size)
             return GNUTLS_E_UNWANTED_ALGORITHM;
         }
         
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index c0fdaa3..89d66f2 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -67,7 +67,7 @@ void
 _gnutls_session_ecc_curve_set (gnutls_session_t session,
                                gnutls_ecc_curve_t c)
 {
-  _gnutls_handshake_log("HSK[%p]: Selected ECC curve (%d)\n", session, c);
+  _gnutls_handshake_log("HSK[%p]: Selected ECC curve %s (%d)\n", session, 
gnutls_ecc_curve_get_name(c), c);
   session->security_parameters.ecc_curve = c;
 }
 
diff --git a/tests/suite/testcompat-main b/tests/suite/testcompat-main
index 34c5c83..e1ffb94 100755
--- a/tests/suite/testcompat-main
+++ b/tests/suite/testcompat-main
@@ -39,8 +39,12 @@ $SERV version|grep -e 1\.0 >/dev/null 2>&1
 SV=$?
 if test $SV != 0;then
   echo "OpenSSL 1.0.0 is required for ECDH and DTLS tests"
+  exit 77
 fi
 
+$SERV version|grep -e 1\.0\.1 >/dev/null 2>&1
+SV2=$?
+
 DSA_CERT=$srcdir/../dsa/cert.dsa.1024.pem
 DSA_KEY=$srcdir/../dsa/dsa.1024.pem
 
@@ -115,15 +119,11 @@ echo "Checking TLS 1.0 with DHE-RSA..."
 $CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.0:+DHE-RSA" 
--insecure --x509certfile $CLI_CERT --x509keyfile $CLI_KEY </dev/null 
>/dev/null || \
   fail $PID "Failed"
 
-if test $SV = 0;then
-
 # Test TLS 1.0 with DHE-RSA ciphersuite
 echo "Checking TLS 1.0 with ECDHE-RSA..." 
 $CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.0:+ECDHE-RSA:+CURVE-ALL"
 --insecure --x509certfile $CLI_CERT --x509keyfile $CLI_KEY </dev/null 
>/dev/null || \
   fail $PID "Failed"
 
-fi
-
 # Test TLS 1.0 with DHE-DSS ciphersuite
 echo "Checking TLS 1.0 with DHE-DSS..." 
 $CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.0:+DHE-DSS" 
--insecure --x509certfile $CLI_CERT --x509keyfile $CLI_KEY </dev/null 
>/dev/null || \
@@ -132,8 +132,6 @@ $CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL
 kill $PID
 wait
 
-if test $SV = 0;then
-
 #-cipher ECDHE-ECDSA-AES128-SHA
 launch_bare_server $$ s_server -quiet -www -accept $PORT -keyform pem 
-certform pem -tls1 -key $ECC_KEY -cert $ECC_CERT -Verify 1 -named_curve 
secp224r1 -CAfile $CA_ECC_CERT &
 PID=$!
@@ -147,13 +145,49 @@ $CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL
 kill $PID
 wait
 
-fi
+if test $SV2 = 0;then
+# Tests requiring openssl 1.0.1 - TLS 1.2
+#-cipher 
RSA-AES128-SHA:DHE-DSS-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA 
+launch_bare_server $$ s_server -quiet -www -accept $PORT -keyform pem 
-certform pem -tls1_2 -dhparam params.dh -key $RSA_KEY -cert $RSA_CERT -dkey 
$DSA_KEY -dcert $DSA_CERT -Verify 1 -CAfile $CA_CERT &
+PID=$!
+wait_server $PID
 
-launch_bare_server $$ s_server -quiet -accept $PORT -keyform pem -certform pem 
-dtls1 -timeout -dhparam params.dh -key $RSA_KEY -cert $RSA_CERT -dkey $DSA_KEY 
-dcert $DSA_CERT -Verify 1 -CAfile $CA_CERT &
+echo "Checking TLS 1.2 with RSA..." 
+$CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.2:+RSA" --insecure 
--x509certfile $CLI_CERT --x509keyfile $CLI_KEY </dev/null >/dev/null || \
+  fail $PID "Failed"
+
+echo "Checking TLS 1.2 with DHE-RSA..." 
+$CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.2:+DHE-RSA" 
--insecure --x509certfile $CLI_CERT --x509keyfile $CLI_KEY </dev/null 
>/dev/null || \
+  fail $PID "Failed"
+
+echo "Checking TLS 1.2 with ECDHE-RSA..." 
+$CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.2:+ECDHE-RSA:+CURVE-ALL"
 --insecure --x509certfile $CLI_CERT --x509keyfile $CLI_KEY </dev/null 
>/dev/null || \
+  fail $PID "Failed"
+
+echo "Checking TLS 1.2 with DHE-DSS..." 
+$CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.2:+DHE-DSS" 
--insecure --x509certfile $CLI_CERT --x509keyfile $CLI_KEY </dev/null 
>/dev/null || \
+  fail $PID "Failed"
+
+kill $PID
+wait
+
+#-cipher ECDHE-ECDSA-AES128-SHA
+launch_bare_server $$ s_server -quiet -www -accept $PORT -keyform pem 
-certform pem -tls1_2 -key $ECC_KEY -cert $ECC_CERT -Verify 1 -named_curve 
secp224r1 -CAfile $CA_ECC_CERT &
 PID=$!
 wait_server $PID
 
-if test $SV = 0;then
+echo "Checking TLS 1.2 with ECDHE-ECDSA..." 
+$CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.2:+ECDHE-ECDSA:+CURVE-ALL"
 --insecure --x509certfile $ECC_CERT --x509keyfile $ECC_KEY </dev/null 
>/dev/null || \
+  fail $PID "Failed"
+
+kill $PID
+wait
+
+fi #SV2
+
+launch_bare_server $$ s_server -quiet -accept $PORT -keyform pem -certform pem 
-dtls1 -timeout -dhparam params.dh -key $RSA_KEY -cert $RSA_CERT -dkey $DSA_KEY 
-dcert $DSA_CERT -Verify 1 -CAfile $CA_CERT &
+PID=$!
+wait_server $PID
 
 # Test DTLS 1.0 with RSA ciphersuite
 echo "Checking DTLS 1.0 with RSA..." 
@@ -184,8 +218,6 @@ echo "Checking DTLS 1.0 with DHE-DSS..."
 $CLI $DEBUG -p $PORT 127.0.0.1 --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-DTLS1.0:+DHE-DSS" --udp 
--insecure --x509certfile $CLI_CERT --x509keyfile $CLI_KEY </dev/null 
>/dev/null || \
   fail $PID "Failed"
 
-fi
-
 kill $PID
 wait
 
@@ -274,8 +306,6 @@ $OPENSSL_CLI s_client  -host localhost -tls1 -port $PORT 
-cert $CLI_CERT -key $C
 kill $PID
 wait
 
-if test $SV = 0;then
-
 echo "Check TLS 1.0 with ECDHE-RSA ciphersuite"
 launch_server $$  --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.0:+ECDHE-RSA:+CURVE-ALL"
 --x509certfile $SERV_CERT --x509keyfile $SERV_KEY --x509cafile $CA_CERT & 
PID=$!
 wait_server $PID
@@ -298,6 +328,53 @@ $OPENSSL_CLI s_client  -host localhost -tls1 -port $PORT 
-cert $ECC_CERT -key $E
 kill $PID
 wait
 
+if test $SV2 = 0;then
+
+echo "Check TLS 1.2 with DHE-RSA ciphersuite"
+launch_server $$  --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.2:+DHE-RSA" 
--x509certfile $SERV_CERT --x509keyfile $SERV_KEY --x509cafile $CA_CERT 
--dhparams params.dh  & PID=$!
+wait_server $PID
+
+$OPENSSL_CLI s_client  -host localhost -tls1_2 -port $PORT -cert $CLI_CERT 
-key $CLI_KEY -CAfile $CA_CERT </dev/null 2>&1 | grep "\:error\:" && \
+  fail $PID "Failed"
+
+kill $PID
+wait
+
+echo "Check TLS 1.2 with DHE-DSS ciphersuite"
+launch_server $$  --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.2:+DHE-DSS" 
--x509certfile $SERV_DSA_CERT --x509keyfile $SERV_DSA_KEY --dhparams params.dh  
& PID=$!
+wait_server $PID
+
+$OPENSSL_CLI s_client  -host localhost -tls1_2 -port $PORT -cert $CLI_CERT 
-key $CLI_KEY -CAfile $CA_CERT </dev/null 2>&1 | grep "\:error\:" && \
+  fail $PID "Failed"
+
+kill $PID
+wait
+
+echo "Check TLS 1.2 with ECDHE-RSA ciphersuite"
+launch_server $$  --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.2:+ECDHE-RSA:+CURVE-ALL"
 --x509certfile $SERV_CERT --x509keyfile $SERV_KEY --x509cafile $CA_CERT & 
PID=$!
+wait_server $PID
+
+#-cipher ECDHE-RSA-AES128-SHA 
+$OPENSSL_CLI s_client  -host localhost -tls1_2 -port $PORT -cert $CLI_CERT 
-key $CLI_KEY -CAfile $CA_CERT </dev/null 2>&1 | grep "\:error\:" && \
+  fail $PID "Failed"
+
+kill $PID
+wait
+
+echo "Check TLS 1.2 with ECDHE-ECDSA ciphersuite"
+launch_server $$  --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-TLS1.2:+ECDHE-ECDSA:+CURVE-ALL"
 --x509certfile $ECC_CERT --x509keyfile $ECC_KEY --x509cafile $CA_ECC_CERT & 
PID=$!
+wait_server $PID
+
+#-cipher ECDHE-ECDSA-AES128-SHA 
+$OPENSSL_CLI s_client  -host localhost -tls1_2 -port $PORT -cert $ECC_CERT 
-key $ECC_KEY -CAfile $CA_ECC_CERT </dev/null 2>&1 | grep "\:error\:" && \
+  fail $PID "Failed"
+
+kill $PID
+wait
+
+
+fi #SV2
+
 # DTLS
 echo "Check DTLS 1.0 with RSA ciphersuite"
 launch_server $$  --priority 
"NONE:+CIPHER-ALL:+SIGN-ALL:+COMP-NULL:+MAC-ALL:+VERS-DTLS1.0:+RSA" --udp 
--x509certfile $SERV_CERT --x509keyfile $SERV_KEY --x509cafile $CA_CERT 
--dhparams params.dh  & PID=$!
@@ -329,7 +406,4 @@ $CLI s_client  -host localhost -port $PORT -dtls1 -cert 
$CLI_CERT -key $CLI_KEY
 kill $PID
 wait
 
-fi
-
-
 exit 0


hooks/post-receive
-- 
GNU gnutls



reply via email to

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