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_8-55-g3360065


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_8-55-g3360065
Date: Mon, 12 Dec 2011 17:53:07 +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=3360065611857d43b7619684755f262e8cc9c0e4

The branch, master has been updated
       via  3360065611857d43b7619684755f262e8cc9c0e4 (commit)
      from  55968012dcefc50590925b4ddcf556f8ca67a8b5 (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 3360065611857d43b7619684755f262e8cc9c0e4
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Dec 12 18:54:44 2011 +0100

    gnutls_priority_get_cipher_suite was renamed to 
gnutls_priority_get_cipher_suite_index.
    This makes a more consistent API at the cost of requiring 
gnutls_get_cipher_suite_info().
    An advantage however is that more information can now be accessed.

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

Summary of changes:
 NEWS                            |    5 ++-
 doc/manpages/Makefile.am        |    1 +
 lib/algorithms/ciphersuites.c   |   49 +++++++++++++++-----------------------
 lib/includes/gnutls/gnutls.h.in |    2 +-
 lib/libgnutls.map               |    2 +-
 src/common.c                    |   10 ++++++-
 6 files changed, 33 insertions(+), 36 deletions(-)

diff --git a/NEWS b/NEWS
index cf95e50..29127d6 100644
--- a/NEWS
+++ b/NEWS
@@ -16,8 +16,9 @@ session, a server will not store that session data into its 
cache.
 
 ** libgnutls: Added the SECP192R1 curve.
 
-** libgnutls: Added gnutls_priority_get_cipher_suite() to
+** libgnutls: Added gnutls_priority_get_cipher_suite_index() to
 allow listing the ciphersuites enabled in a priority structure.
+It outputs and index to be used in gnutls_get_cipher_suite_info().
 
 ** libgnutls: Optimizations in the elliptic curve code (timing
 attacks resistant code is only used in ECDSA private key operations).
@@ -26,7 +27,7 @@ attacks resistant code is only used in ECDSA private key 
operations).
 now added again in the distribution.
 
 ** API and ABI modifications:
-gnutls_priority_get_cipher_suite: Added
+gnutls_priority_get_cipher_suite_index: Added
 
 
 * Version 3.0.8 (released 2011-11-12)
diff --git a/doc/manpages/Makefile.am b/doc/manpages/Makefile.am
index e4010fc..4b7baed 100644
--- a/doc/manpages/Makefile.am
+++ b/doc/manpages/Makefile.am
@@ -215,6 +215,7 @@ APIMANS += gnutls_session_ticket_enable_server.3
 APIMANS += gnutls_key_generate.3
 APIMANS += gnutls_priority_init.3
 APIMANS += gnutls_priority_deinit.3
+APIMANS += gnutls_priority_get_cipher_suite.3
 APIMANS += gnutls_priority_set.3
 APIMANS += gnutls_priority_set_direct.3
 APIMANS += gnutls_set_default_priority.3
diff --git a/lib/algorithms/ciphersuites.c b/lib/algorithms/ciphersuites.c
index bdffef7..6b4f034 100644
--- a/lib/algorithms/ciphersuites.c
+++ b/lib/algorithms/ciphersuites.c
@@ -824,24 +824,24 @@ _gnutls_supported_ciphersuites (gnutls_session_t session,
 /**
  * gnutls_priority_get_cipher_suite:
  * @pcache: is a #gnutls_prioritity_t structure.
- * @idx: is an index number
- * @name: Will point to the ciphersuite name
- * @cs_id: output buffer with room for 2 bytes, indicating cipher suite value
+ * @idx: is an index number.
+ * @sidx: internal index of cipher suite to get information about.
  *
- * Provides ciphersuite information. The index provided is an internal
- * index kept at the priorities structure. It might be that a valid index
- * does not correspond to a ciphersuite and in that case 
%GNUTLS_E_UNKNOWN_CIPHER_SUITE
- * will be returned. Once the last available index is crossed then 
+ * Provides the internal ciphersuite index to be used with
+ * gnutls_cipher_suite_info(). The index @idx provided is an 
+ * index kept at the priorities structure. It might be that a valid
+ * priorities index does not correspond to a ciphersuite and in 
+ * that case %GNUTLS_E_UNKNOWN_CIPHER_SUITE will be returned. 
+ * Once the last available index is crossed then 
  * %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
  *
  * Returns: On success it returns %GNUTLS_E_SUCCESS (0), or a negative error 
value otherwise.
  **/
 int
-gnutls_priority_get_cipher_suite (gnutls_priority_t pcache, int idx, const 
char** name, unsigned char cs_id[2])
+gnutls_priority_get_cipher_suite_index (gnutls_priority_t pcache, unsigned int 
idx, unsigned int *sidx)
 {
-int mac_idx, cipher_idx, kx_idx;
+int mac_idx, cipher_idx, kx_idx, i;
 int total = pcache->mac.algorithms * pcache->cipher.algorithms * 
pcache->kx.algorithms;
-const gnutls_cipher_suite_entry * ce;
 
   if (idx >= total)
     return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE;
@@ -854,26 +854,15 @@ const gnutls_cipher_suite_entry * ce;
   idx /= pcache->cipher.algorithms;
   kx_idx = idx % pcache->kx.algorithms;
 
-  ce = cipher_suite_get(pcache->kx.priority[kx_idx], 
pcache->cipher.priority[cipher_idx],
-                        pcache->mac.priority[mac_idx]);
-  
-  if (ce == NULL) 
-    {
-      *name = NULL;
-      memset(cs_id, 0, 2);
-    }
-  else 
-    {
-      *name = ce->name;
-      memcpy(cs_id, ce->id.suite, 2);
-    }
-
-  if (*name == NULL) 
+  for (i=0;i<CIPHER_SUITES_COUNT;i++)
     {
-      *name = "(no corresponding ciphersuite)";
-      return GNUTLS_E_UNKNOWN_CIPHER_SUITE;
+      if (cs_algorithms[i].kx_algorithm == pcache->kx.priority[kx_idx] &&
+          cs_algorithms[i].block_algorithm == 
pcache->cipher.priority[cipher_idx] &&
+          cs_algorithms[i].mac_algorithm == pcache->mac.priority[mac_idx])
+        {
+          *sidx = i;
+          return 0;
+        }
     }
-    
-  return 0;
+  return GNUTLS_E_UNKNOWN_CIPHER_SUITE;
 }
-
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index 5b5fa58..2906eaa 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -909,7 +909,7 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t 
session);
   int gnutls_priority_init (gnutls_priority_t * priority_cache,
                             const char *priorities, const char **err_pos);
   void gnutls_priority_deinit (gnutls_priority_t priority_cache);
-  int gnutls_priority_get_cipher_suite (gnutls_priority_t pcache, int idx, 
const char** name, unsigned char cs_id[2]);
+  int gnutls_priority_get_cipher_suite_index (gnutls_priority_t pcache, 
unsigned int idx, unsigned int *sidx);
 
   int gnutls_priority_set (gnutls_session_t session,
                            gnutls_priority_t priority);
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 0abb800..24f04f0 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -725,7 +725,7 @@ GNUTLS_3_0_0 {
        gnutls_srp_4096_group_generator;
        gnutls_srp_4096_group_prime;
        gnutls_x509_privkey_verify_params;
-       gnutls_priority_get_cipher_suite;
+       gnutls_priority_get_cipher_suite_index;
 } GNUTLS_2_12;
 
 GNUTLS_PRIVATE {
diff --git a/src/common.c b/src/common.c
index 0cfc0aa..d00bf57 100644
--- a/src/common.c
+++ b/src/common.c
@@ -574,6 +574,7 @@ print_list (const char* priorities, int verbose)
 {
     size_t i;
     int ret;
+    unsigned int idx;
     const char *name;
     const char *err;
     unsigned char id[2];
@@ -596,11 +597,16 @@ print_list (const char* priorities, int verbose)
       
         for (i=0;;i++)
           {
-            ret = gnutls_priority_get_cipher_suite(pcache, i, &name, id);
+            ret = gnutls_priority_get_cipher_suite_index(pcache, i, &idx);
             if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) break;
             if (ret == GNUTLS_E_UNKNOWN_CIPHER_SUITE) continue;
             
-            printf ("%-50s\t0x%02x, 0x%02x\n", name, id[0], id[1]);
+            name = gnutls_cipher_suite_info(idx, id, NULL, NULL, NULL, 
&version);
+            
+            if (name != NULL)
+              printf ("%-50s\t0x%02x, 0x%02x\t%s\n",
+                      name, (unsigned char) id[0], (unsigned char) id[1],
+                      gnutls_protocol_get_name (version));
           }
           
         return;


hooks/post-receive
-- 
GNU gnutls



reply via email to

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