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_1_0-88-gf1ead0f


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_1_0-88-gf1ead0f
Date: Mon, 17 Sep 2012 18:08:28 +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=f1ead0f60c33b14831f330b0cc8692e38315f6ed

The branch, master has been updated
       via  f1ead0f60c33b14831f330b0cc8692e38315f6ed (commit)
       via  fdc5ee28a5e7c4f4d55ac99a8371ca529482c164 (commit)
       via  416655970fdf466289d8db1ef9387388e4f1e0dc (commit)
       via  c17c57ff450814fccf4a7cc3c764447c998886e0 (commit)
      from  de90e7f1e82925e11486bf791086145ccd6801d4 (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 f1ead0f60c33b14831f330b0cc8692e38315f6ed
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Sep 17 20:07:54 2012 +0200

    Allow negatives in enumerations.

commit fdc5ee28a5e7c4f4d55ac99a8371ca529482c164
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Sep 17 19:46:29 2012 +0200

    do not complain on overlength strings

commit 416655970fdf466289d8db1ef9387388e4f1e0dc
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Sep 17 19:45:18 2012 +0200

    gnutls_session_enable_compatibility_mode() is equivalent to %COMPAT 
priority string.

commit c17c57ff450814fccf4a7cc3c764447c998886e0
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Sep 17 19:55:50 2012 +0200

    Warn on certificate with weak security levels. (re)introduces 
GNUTLS_SEC_PARAM_WEAK.

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

Summary of changes:
 configure.ac                    |    1 +
 doc/scripts/gdoc                |    2 +-
 lib/algorithms/secparams.c      |   35 ++++++++++-------------------------
 lib/gnutls_int.h                |    6 ++++++
 lib/gnutls_priority.c           |    4 +---
 lib/gnutls_state.c              |   12 +++---------
 lib/gnutls_state.h              |    7 ++++++-
 lib/gnutls_x509.c               |   15 ++++++++++++---
 lib/includes/gnutls/gnutls.h.in |    8 ++++----
 9 files changed, 44 insertions(+), 46 deletions(-)

diff --git a/configure.ac b/configure.ac
index 81b6e8a..48cc4db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -272,6 +272,7 @@ if test "$gl_gcc_warnings" = yes; then
   nw="$nw -Wconversion"             # Too many warnings for now
   nw="$nw -Wsign-conversion"        # Too many warnings for now
   nw="$nw -Wformat-y2k"             # Too many warnings for now
+  nw="$nw -Woverlength-strings"     # We use some in tests/
   nw="$nw -Wvla"                    # There is no point to avoid C99 variable 
length arrays
   nw="$nw -Wformat-nonliteral"      # Incompatible with gettext _()
   nw="$nw -Wunsafe-loop-optimizations"
diff --git a/doc/scripts/gdoc b/doc/scripts/gdoc
index 61b870d..953cd57 100755
--- a/doc/scripts/gdoc
+++ b/doc/scripts/gdoc
@@ -857,7 +857,7 @@ sub dump_function {
 sub dump_enum {
     my $prototype = shift @_;
 
-    if (($prototype =~ 
m/^\s*typedef\s+enum\s*[a-zA-Z0-9_~:]*\s*\{([a-zA-Z0-9_~=,:\s\(\)\<]+)\s*\}\s*([a-zA-Z0-9_]+);.*/))
 {
+    if (($prototype =~ 
m/^\s*typedef\s+enum\s*[a-zA-Z0-9_~:]*\s*\{([\-a-zA-Z0-9_~=,:\s\(\)\<]+)\s*\}\s*([a-zA-Z0-9_]+);.*/))
 {
 #        || $prototype =~ m/^\s*enum\s+([a-zA-Z0-9_~:]+).*/) {
         $args = $1;
        $name = $2;
diff --git a/lib/algorithms/secparams.c b/lib/algorithms/secparams.c
index 5bfd646..fabd34e 100644
--- a/lib/algorithms/secparams.c
+++ b/lib/algorithms/secparams.c
@@ -39,6 +39,7 @@ typedef struct
 } gnutls_sec_params_entry;
 
 static const gnutls_sec_params_entry sec_params[] = {
+  {"Weak", GNUTLS_SEC_PARAM_WEAK, 0, 0, 0, 0, 0},
   {"Low", GNUTLS_SEC_PARAM_LOW, 80, 1248, 2048, 160, 160},
   {"Legacy", GNUTLS_SEC_PARAM_LEGACY, 96, 1776, 2048, 192, 192},
   {"Normal", GNUTLS_SEC_PARAM_NORMAL, 112, 2432, 3072, 224, 224},
@@ -73,34 +74,18 @@ gnutls_sec_param_to_pk_bits (gnutls_pk_algorithm_t algo,
   unsigned int ret = 0;
 
   /* handle DSA differently */
-  if (algo == GNUTLS_PK_DSA)
-    {
-      GNUTLS_SEC_PARAM_LOOP (if (p->sec_param == param)
-                             {
-                               ret = p->dsa_bits; break;
-                             }
-      );
-      return ret;
-    }
-  else if (algo == GNUTLS_PK_EC)
-    {
-      GNUTLS_SEC_PARAM_LOOP (if (p->sec_param == param)
+  GNUTLS_SEC_PARAM_LOOP (if (p->sec_param == param)
                              {
-                               ret = p->ecc_bits; break;
+                               if (algo == GNUTLS_PK_DSA)
+                                 ret = p->dsa_bits;
+                               else if (algo == GNUTLS_PK_EC)
+                                 ret = p->ecc_bits;
+                               else
+                                 ret = p->pk_bits;
+                               break;
                              }
       );
       return ret;
-    }
-  else
-    {
-      GNUTLS_SEC_PARAM_LOOP (if (p->sec_param == param)
-                         {
-                           ret = p->pk_bits; break;
-                         }
-      );
-
-      return ret;
-    }
 }
 
 /* Returns the corresponding size for subgroup bits (q),
@@ -161,7 +146,7 @@ gnutls_sec_param_get_name (gnutls_sec_param_t param)
 gnutls_sec_param_t
 gnutls_pk_bits_to_sec_param (gnutls_pk_algorithm_t algo, unsigned int bits)
 {
-  gnutls_sec_param_t ret = GNUTLS_SEC_PARAM_LOW;
+  gnutls_sec_param_t ret = GNUTLS_SEC_PARAM_WEAK;
 
   if (bits == 0)
     return GNUTLS_SEC_PARAM_UNKNOWN;
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index c781439..eb19b6c 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -589,11 +589,17 @@ struct gnutls_priority_st
   unsigned int ssl3_record_version:1;
   unsigned int server_precedence:1;
   unsigned int allow_key_usage_violation:1;
+  unsigned int allow_weak_keys:1;
   /* Whether stateless compression will be used */
   unsigned int stateless_compression:1;
   unsigned int additional_verify_flags;
 };
 
+#define ENABLE_COMPAT(x) \
+              (x)->no_padding = 1; \
+              (x)->allow_large_records = 1; \
+              (x)->allow_key_usage_violation = 1; \
+              (x)->allow_weak_keys = 1
 
 /* DH and RSA parameters types.
  */
diff --git a/lib/gnutls_priority.c b/lib/gnutls_priority.c
index c5db0a2..9c0eed9 100644
--- a/lib/gnutls_priority.c
+++ b/lib/gnutls_priority.c
@@ -978,9 +978,7 @@ gnutls_priority_init (gnutls_priority_t * priority_cache,
         {
           if (strcasecmp (&broken_list[i][1], "COMPAT") == 0)
             {
-              (*priority_cache)->no_padding = 1;
-              (*priority_cache)->allow_large_records = 1;
-              (*priority_cache)->allow_key_usage_violation = 1;
+              ENABLE_COMPAT((*priority_cache));
             }
           else if (strcasecmp (&broken_list[i][1], "NO_EXTENSIONS") == 0)
             {
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index c9c09ce..a2feb5b 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -485,12 +485,6 @@ gnutls_deinit (gnutls_session_t session)
 /* Returns the minimum prime bits that are acceptable.
  */
 int
-_gnutls_dh_get_allowed_prime_bits (gnutls_session_t session)
-{
-  return session->internals.dh_prime_bits;
-}
-
-int
 _gnutls_dh_set_peer_public (gnutls_session_t session, bigint_t public)
 {
   dh_info_st *dh;
@@ -1309,8 +1303,8 @@ gnutls_handshake_set_post_client_hello_function 
(gnutls_session_t session,
  *
  * This function can be used to disable certain (security) features in
  * TLS in order to maintain maximum compatibility with buggy
- * clients. It is equivalent to calling:
- * gnutls_record_disable_padding()
+ * clients. Because several trade-offs with security are enabled,
+ * if required they will be reported through the audit subsystem.
  *
  * Normally only servers that require maximum compatibility with
  * everything out there, need to call this function.
@@ -1318,7 +1312,7 @@ gnutls_handshake_set_post_client_hello_function 
(gnutls_session_t session,
 void
 gnutls_session_enable_compatibility_mode (gnutls_session_t session)
 {
-  gnutls_record_disable_padding (session);
+  ENABLE_COMPAT(&session->internals.priorities);
 }
 
 /**
diff --git a/lib/gnutls_state.h b/lib/gnutls_state.h
index a89e181..cbb8a63 100644
--- a/lib/gnutls_state.h
+++ b/lib/gnutls_state.h
@@ -60,7 +60,12 @@ int _gnutls_dh_set_peer_public (gnutls_session_t session, 
bigint_t public);
 int _gnutls_dh_set_group (gnutls_session_t session, bigint_t gen,
                           bigint_t prime);
 
-int _gnutls_dh_get_allowed_prime_bits (gnutls_session_t session);
+static inline int
+_gnutls_dh_get_allowed_prime_bits (gnutls_session_t session)
+{
+  return session->internals.dh_prime_bits;
+}
+
 void _gnutls_handshake_internal_state_clear (gnutls_session_t);
 
 int _gnutls_rsa_export_set_pubkey (gnutls_session_t session,
diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c
index b9719de..7ddd626 100644
--- a/lib/gnutls_x509.c
+++ b/lib/gnutls_x509.c
@@ -54,9 +54,9 @@
  * is unacceptable.
   */
 inline static int
-check_bits (gnutls_x509_crt_t crt, unsigned int max_bits)
+check_bits (gnutls_session_t session, gnutls_x509_crt_t crt, unsigned int 
max_bits)
 {
-  int ret;
+  int ret, pk;
   unsigned int bits;
 
   ret = gnutls_x509_crt_get_pk_algorithm (crt, &bits);
@@ -65,6 +65,7 @@ check_bits (gnutls_x509_crt_t crt, unsigned int max_bits)
       gnutls_assert ();
       return ret;
     }
+  pk = ret;
 
   if (bits > max_bits && max_bits > 0)
     {
@@ -72,6 +73,14 @@ check_bits (gnutls_x509_crt_t crt, unsigned int max_bits)
       return GNUTLS_E_CONSTRAINT_ERROR;
     }
 
+  if (gnutls_pk_bits_to_sec_param(pk, bits) == GNUTLS_SEC_PARAM_WEAK)
+    {
+      gnutls_assert();
+      _gnutls_audit_log(session, "The security level of the certificate (%s: 
%u) is weak\n", gnutls_pk_get_name(pk), bits);
+      if (session->internals.priorities.allow_weak_keys == 0)
+        return gnutls_assert_val(GNUTLS_E_CERTIFICATE_ERROR);
+    }
+
   return 0;
 }
 
@@ -159,7 +168,7 @@ _gnutls_x509_cert_verify_peers (gnutls_session_t session,
           return ret;
         }
 
-      ret = check_bits (peer_certificate_list[i], cred->verify_bits);
+      ret = check_bits (session, peer_certificate_list[i], cred->verify_bits);
       if (ret < 0)
         {
           gnutls_assert ();
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index ef00c5b..c0e5c8e 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -662,12 +662,11 @@ typedef enum
   GNUTLS_ECC_CURVE_SECP192R1,
 } gnutls_ecc_curve_t;
 
-#define GNUTLS_SEC_PARAM_WEAK GNUTLS_SEC_PARAM_LOW
-
 /**
  * gnutls_sec_param_t:
+ * @GNUTLS_SEC_PARAM_WEAK: security level known to be weak
  * @GNUTLS_SEC_PARAM_UNKNOWN: Cannot be known
- * @GNUTLS_SEC_PARAM_LOW: low security level
+ * @GNUTLS_SEC_PARAM_LOW: 80 bits of security
  * @GNUTLS_SEC_PARAM_LEGACY: 96 bits of security
  * @GNUTLS_SEC_PARAM_NORMAL: 112 bits of security
  * @GNUTLS_SEC_PARAM_HIGH: 128 bits of security
@@ -677,7 +676,8 @@ typedef enum
  */
   typedef enum
   {
-    GNUTLS_SEC_PARAM_UNKNOWN,
+    GNUTLS_SEC_PARAM_WEAK = -10,
+    GNUTLS_SEC_PARAM_UNKNOWN = 0,
     GNUTLS_SEC_PARAM_LOW = 1,
     GNUTLS_SEC_PARAM_LEGACY = 2,
     GNUTLS_SEC_PARAM_NORMAL = 3,


hooks/post-receive
-- 
GNU gnutls



reply via email to

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