gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, gnutls_3_0_x-2, updated. gnutls_3_0_20-24-g9861


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, gnutls_3_0_x-2, updated. gnutls_3_0_20-24-g98611fd
Date: Fri, 29 Jun 2012 23:01: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=98611fd5e0a68ae0fee58dba117d0b952fce73a6

The branch, gnutls_3_0_x-2 has been updated
       via  98611fd5e0a68ae0fee58dba117d0b952fce73a6 (commit)
       via  9348c9d9acd4cf5b5b0261a24c9bd9bc0f3f1de6 (commit)
      from  6d0b4dc6ef9ed41982d82318f3aa577d8745f69f (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 98611fd5e0a68ae0fee58dba117d0b952fce73a6
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sat Jun 30 01:00:28 2012 +0200

    sign fixes

commit 9348c9d9acd4cf5b5b0261a24c9bd9bc0f3f1de6
Author: David Woodhouse <address@hidden>
Date:   Fri Jun 29 21:14:25 2012 +0100

    Add gnutls_dtls_set_data_mtu()
    
    Signed-off-by: Nikos Mavrogiannopoulos <address@hidden>

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

Summary of changes:
 lib/gnutls_dtls.c          |   43 ++++++++++++++++++++++++++++++++++++++++++-
 lib/includes/gnutls/dtls.h |    1 +
 lib/libgnutls.map          |    1 +
 3 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/lib/gnutls_dtls.c b/lib/gnutls_dtls.c
index 979198c..e798b27 100644
--- a/lib/gnutls_dtls.c
+++ b/lib/gnutls_dtls.c
@@ -35,6 +35,7 @@
 #include <gnutls_state.h>
 #include <gnutls/dtls.h>
 #include <timespec.h>
+#include <algorithms.h>
 
 /* returns a-b in ms */
 unsigned int
@@ -653,7 +654,7 @@ int total = 0, ret, iv_size;
 unsigned int gnutls_dtls_get_data_mtu (gnutls_session_t session)
 {
 int mtu = session->internals.dtls.mtu;
-int blocksize = 0;
+unsigned int blocksize = 1;
 int overhead;
  
   mtu -= RECORD_HEADER_SIZE(session);
@@ -669,6 +670,46 @@ int overhead;
 }
 
 /**
+ * gnutls_dtls_set_data_mtu:
+ * @session: is a #gnutls_session_t structure.
+ * @mtu: The maximum unencrypted transfer unit of the session
+ *
+ * This function will set the maximum size of the *unencrypted* records
+ * which will be sent over a DTLS session. It is equivalent to calculating
+ * the DTLS packet overhead with the current encryption parameters, and
+ * calling gnutls_dtls_set_mtu() with that value. In particular, this means
+ * that you may need to call this function again after any negotiation or
+ * renegotiation, in order to ensure that the MTU is still sufficient to
+ * account for the new protocol overhead.
+ *
+ * Returns: %GNUTLS_E_SUCCESS (0) on success, or a negative error code.
+ *
+ * Since: 3.1
+ **/
+int gnutls_dtls_set_data_mtu (gnutls_session_t session, unsigned int mtu)
+{
+  unsigned int blocksize;
+  int overhead = _gnutls_record_overhead_rt(session, &blocksize);
+
+  /* You can't call this until the session is actually running */
+  if (overhead < 0)
+         return GNUTLS_E_INVALID_SESSION;
+
+  /* Add the overhead inside the encrypted part */
+  mtu += overhead;
+
+  /* Round it up to the next multiple of blocksize */
+  mtu += blocksize - 1;
+  mtu -= mtu % blocksize;
+
+  /* Add the *unencrypted header size */
+  mtu += RECORD_HEADER_SIZE(session);
+
+  gnutls_dtls_set_mtu(session, mtu);
+  return GNUTLS_E_SUCCESS;
+}
+
+/**
  * gnutls_dtls_get_mtu:
  * @session: is a #gnutls_session_t structure.
  *
diff --git a/lib/includes/gnutls/dtls.h b/lib/includes/gnutls/dtls.h
index f65c009..909f0d3 100644
--- a/lib/includes/gnutls/dtls.h
+++ b/lib/includes/gnutls/dtls.h
@@ -44,6 +44,7 @@ unsigned int gnutls_dtls_get_mtu (gnutls_session_t session);
 unsigned int gnutls_dtls_get_data_mtu (gnutls_session_t session);
 
 void gnutls_dtls_set_mtu (gnutls_session_t session, unsigned int mtu);
+int gnutls_dtls_set_data_mtu (gnutls_session_t session, unsigned int mtu);
 
 unsigned int gnutls_dtls_get_timeout (gnutls_session_t session);
 
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 108c765..1078a07 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -691,6 +691,7 @@ GNUTLS_3_0_0 {
        gnutls_dtls_cookie_send;
        gnutls_dtls_prestate_set;
        gnutls_dtls_get_data_mtu;
+       gnutls_dtls_set_data_mtu;
        gnutls_cipher_set_iv;
        gnutls_pcert_deinit;
        gnutls_pcert_import_x509;


hooks/post-receive
-- 
GNU gnutls



reply via email to

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