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_11_6-293-g3badb46


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_2_11_6-293-g3badb46
Date: Sat, 12 Mar 2011 23:18:37 +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=3badb4696154b4d3504e119f0b02fc386925fa2f

The branch, master has been updated
       via  3badb4696154b4d3504e119f0b02fc386925fa2f (commit)
       via  b79afae2425454bcf61afd7be243bf2b7b35e10c (commit)
      from  3b9a0c6c37dc9d68d5bcf190ce614898ae95e015 (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 3badb4696154b4d3504e119f0b02fc386925fa2f
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sun Mar 13 00:11:50 2011 +0100

    session->internals.compression_method was removed. It was no longer 
required since the new compression algorithm was stored to next epoch as well.

commit b79afae2425454bcf61afd7be243bf2b7b35e10c
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sat Mar 12 23:50:39 2011 +0100

    _gnutls_is_dtls() is no more. IS_DTLS() is being used instead.

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

Summary of changes:
 lib/gnutls_buffers.c   |    4 ++--
 lib/gnutls_cipher.c    |    2 +-
 lib/gnutls_constate.c  |   19 ++++++++++++++++---
 lib/gnutls_constate.h  |    1 +
 lib/gnutls_handshake.c |   30 +++++++++++-------------------
 lib/gnutls_int.h       |    3 ---
 lib/gnutls_record.c    |    2 +-
 lib/gnutls_state.h     |   13 -------------
 lib/gnutls_v2_compat.c |    3 +--
 9 files changed, 33 insertions(+), 44 deletions(-)

diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c
index 50ca2d7..725d4a1 100644
--- a/lib/gnutls_buffers.c
+++ b/lib/gnutls_buffers.c
@@ -315,7 +315,7 @@ static ssize_t
 _gnutls_read (gnutls_session_t session, mbuffer_st **bufel,
              size_t size, gnutls_pull_func pull_func)
 {
-  if (_gnutls_is_dtls (session))
+  if (IS_DTLS (session))
     /* Size is not passed, since a whole datagram will be read. */
     return _gnutls_dgram_read (session, bufel, pull_func);
   else
@@ -482,7 +482,7 @@ _gnutls_io_read_buffered (gnutls_session_t session, size_t 
total,
       return 0;
     }
 
-  if(_gnutls_is_dtls(session))
+  if(IS_DTLS(session))
     ret = MIN(total, session->internals.record_recv_buffer.byte_length);
   else
     ret = session->internals.record_recv_buffer.byte_length;
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
index 6225cb1..ccbbbf5 100644
--- a/lib/gnutls_cipher.c
+++ b/lib/gnutls_cipher.c
@@ -127,7 +127,7 @@ _gnutls_encrypt (gnutls_session_t session, const opaque * 
headers,
   /* copy the headers */
   memcpy (ciphertext, headers, headers_size);
   
-  if(_gnutls_is_dtls(session))
+  if(IS_DTLS(session))
     _gnutls_write_uint16 (ret, &ciphertext[11]);
   else
     _gnutls_write_uint16 (ret, &ciphertext[3]);
diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c
index 2ec6ab8..a853098 100644
--- a/lib/gnutls_constate.c
+++ b/lib/gnutls_constate.c
@@ -526,6 +526,18 @@ _gnutls_check_algos (gnutls_session_t session,
   return 0;
 }
 
+int _gnutls_epoch_get_compression(gnutls_session_t session, int epoch)
+{
+record_parameters_st *params;
+int ret;
+
+  ret = _gnutls_epoch_get (session, epoch, &params);
+  if (ret < 0)
+    return GNUTLS_COMP_UNKNOWN;
+
+  return params->compression_algorithm;
+}
+
 /* Initializes the read connection session
  * (read encrypted data)
  */
@@ -540,10 +552,11 @@ _gnutls_read_connection_state_init (gnutls_session_t 
session)
    */
   if (session->internals.resumed == RESUME_FALSE)
     {
+
       ret = _gnutls_check_algos (session,
                                  &session->
                                  security_parameters.current_cipher_suite,
-                                 session->internals.compression_method);
+                                 _gnutls_epoch_get_compression(session, 
epoch_next));
       if (ret < 0)
         return ret;
 
@@ -591,7 +604,7 @@ _gnutls_write_connection_state_init (gnutls_session_t 
session)
       ret = _gnutls_check_algos (session,
                                  &session->
                                  security_parameters.current_cipher_suite,
-                                 session->internals.compression_method);
+                                 _gnutls_epoch_get_compression(session, 
epoch_next));
       if (ret < 0)
         return ret;
 
@@ -730,7 +743,7 @@ _gnutls_epoch_alloc (gnutls_session_t session, uint16_t 
epoch,
   (*slot)->mac_algorithm = GNUTLS_MAC_UNKNOWN;
   (*slot)->compression_algorithm = GNUTLS_COMP_UNKNOWN;
 
-  if (_gnutls_is_dtls (session))
+  if (IS_DTLS (session))
     _gnutls_write_uint16 (epoch, UINT64DATA((*slot)->write.sequence_number));
 
   if (out != NULL)
diff --git a/lib/gnutls_constate.h b/lib/gnutls_constate.h
index 82744cb..49164a2 100644
--- a/lib/gnutls_constate.h
+++ b/lib/gnutls_constate.h
@@ -30,6 +30,7 @@ int _gnutls_epoch_set_cipher_suite (gnutls_session_t session, 
int epoch_rel,
                                     cipher_suite_st * suite);
 int _gnutls_epoch_set_compression (gnutls_session_t session, int epoch_rel,
                                    gnutls_compression_method_t comp_algo);
+int _gnutls_epoch_get_compression (gnutls_session_t session, int epoch_rel);
 void _gnutls_epoch_set_null_algos (gnutls_session_t session,
                                    record_parameters_st * params);
 int _gnutls_epoch_set_keys (gnutls_session_t session, uint16_t epoch);
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
index 883e38a..4d90642 100644
--- a/lib/gnutls_handshake.c
+++ b/lib/gnutls_handshake.c
@@ -513,7 +513,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque 
* data,
       session->internals.resumed = RESUME_FALSE;
     }
 
-  if (_gnutls_is_dtls(session))
+  if (IS_DTLS(session))
    {
      int cookie_size;
 
@@ -1045,8 +1045,6 @@ _gnutls_server_select_comp_method (gnutls_session_t 
session,
       return x;
     }
 
-  session->internals.compression_method = 0;
-
   for (j = 0; j < datalen; j++)
     {
       for (i = 0; i < x; i++)
@@ -1056,15 +1054,13 @@ _gnutls_server_select_comp_method (gnutls_session_t 
session,
               gnutls_compression_method_t method =
                 _gnutls_compression_get_id (comps[i]);
 
-              session->internals.compression_method = method;
               gnutls_free (comps);
 
               _gnutls_epoch_set_compression (session, EPOCH_NEXT, method);
 
               _gnutls_handshake_log
                 ("HSK[%p]: Selected Compression Method: %s\n", session,
-                 gnutls_compression_get_name (session->
-                                              internals.compression_method));
+                 gnutls_compression_get_name (method));
 
 
               return 0;
@@ -1197,7 +1193,7 @@ _gnutls_send_handshake (gnutls_session_t session, 
mbuffer_st * bufel,
    * fragmented later by the fragmentation sub-layer. All fields must
    * be set properly for HMAC. The HMAC requires we pretend that the
    * message was sent in a single fragment. */
-  if (_gnutls_is_dtls(session))
+  if (IS_DTLS(session))
     {
       _gnutls_write_uint16 (session->internals.dtls.hsk_write_seq++, 
&data[pos]);
       pos += 2;
@@ -1553,10 +1549,7 @@ _gnutls_client_set_comp_method (gnutls_session_t 
session, opaque comp_method)
       return GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM;
     }
 
-  session->internals.compression_method =
-    _gnutls_compression_get_id (comp_method);
-  _gnutls_epoch_set_compression (session, EPOCH_NEXT,
-                                 session->internals.compression_method);
+  _gnutls_epoch_set_compression (session, EPOCH_NEXT, 
_gnutls_compression_get_id(comp_method));
 
   return 0;
 }
@@ -1904,7 +1897,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int 
again)
 
   if (again == 0)
     {
-      if(_gnutls_is_dtls(session))
+      if(IS_DTLS(session))
         {
           cookie_len = session->internals.dtls.cookie_len + 1;
         }
@@ -1974,7 +1967,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int 
again)
 
       /* Generate random data 
        */
-      if (!_gnutls_is_dtls (session)
+      if (!IS_DTLS (session)
         || session->internals.dtls.hsk_hello_verify_requests == 0)
         {
           _gnutls_tls_create_random (rnd);
@@ -2001,7 +1994,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int 
again)
 
       /* Copy the DTLS cookie
        */
-      if (_gnutls_is_dtls(session))
+      if (IS_DTLS(session))
         {
           data[pos++] = session->internals.dtls.cookie_len;
           memcpy(&data[pos], &session->internals.dtls.cookie, 
session->internals.dtls.cookie_len);
@@ -2142,11 +2135,10 @@ _gnutls_send_server_hello (gnutls_session_t session, 
int again)
       pos += 2;
 
       comp =
-        (uint8_t) _gnutls_compression_get_num (session->internals.
-                                               compression_method);
+        (uint8_t) _gnutls_compression_get_num ( 
+         _gnutls_epoch_get_compression (session, 
session->security_parameters.epoch_next));
       data[pos++] = comp;
 
-
       if (extdata.length > 0)
         {
           datalen += extdata.length;
@@ -2228,7 +2220,7 @@ _gnutls_recv_hello_verify_request (gnutls_session_t 
session,
   uint8_t cookie_len;
   unsigned int nb_verifs;
 
-  if (!_gnutls_is_dtls (session)
+  if (!IS_DTLS (session)
       || session->security_parameters.entity == GNUTLS_SERVER)
     {
       gnutls_assert ();
@@ -2660,7 +2652,7 @@ _gnutls_handshake_client (gnutls_session_t session)
       IMED_RET ("send hello", ret, 1);
 
     case STATE11:
-      if (_gnutls_is_dtls (session))
+      if (IS_DTLS (session))
         {
           ret =
             _gnutls_recv_handshake (session, 
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index aa8e44f..1c18817 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -646,9 +646,6 @@ typedef struct
   int last_handshake_in;
   int last_handshake_out;
 
-  /* this is the compression method we are going to use */
-  gnutls_compression_method_t compression_method;
-
   /* priorities */
   struct gnutls_priority_st priorities;
 
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
index f721438..cc259c4 100644
--- a/lib/gnutls_record.c
+++ b/lib/gnutls_record.c
@@ -307,7 +307,7 @@ inline static int
 sequence_increment (gnutls_session_t session,
                    uint64 * value)
 {
-  if (_gnutls_is_dtls(session))
+  if (IS_DTLS(session))
     {
       return _gnutls_uint48pp(value);
     }
diff --git a/lib/gnutls_state.h b/lib/gnutls_state.h
index 0035bb5..8132a2f 100644
--- a/lib/gnutls_state.h
+++ b/lib/gnutls_state.h
@@ -74,16 +74,3 @@ int _gnutls_PRF (gnutls_session_t session,
 
 #define DEFAULT_CERT_TYPE GNUTLS_CRT_X509
 
-/*-
- * _gnutls_is_dtls - Used to check whether this session uses DTLS.
- * @session: is a #gnutls_session_t structure.
- *
- * This function will return non zero if this session uses DTLS.
- *
- -*/
-static inline
-int
-_gnutls_is_dtls (gnutls_session_t session)
-{
-  return session->internals.transport == GNUTLS_DGRAM;
-}
diff --git a/lib/gnutls_v2_compat.c b/lib/gnutls_v2_compat.c
index 9d78287..add3274 100644
--- a/lib/gnutls_v2_compat.c
+++ b/lib/gnutls_v2_compat.c
@@ -250,8 +250,7 @@ _gnutls_read_client_hello_v2 (gnutls_session_t session, 
opaque * data,
       session->internals.resumed = RESUME_FALSE;
     }
 
-  session->internals.compression_method = GNUTLS_COMP_NULL;
-  _gnutls_epoch_set_compression (session, EPOCH_NEXT, 
session->internals.compression_method);
+  _gnutls_epoch_set_compression (session, EPOCH_NEXT, GNUTLS_COMP_NULL);
 
   return 0;
 }


hooks/post-receive
-- 
GNU gnutls



reply via email to

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