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-176-g1d74678


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_18-176-g1d74678
Date: Fri, 29 Jun 2012 23:00:42 +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=1d746783318262343117ffb0fc45a9a8137a0e7c

The branch, master has been updated
       via  1d746783318262343117ffb0fc45a9a8137a0e7c (commit)
       via  0ded10864312368ff2862a716e29d7db387996f4 (commit)
      from  ceb092a86ca3c6eb1030f90d842962278e52970d (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 1d746783318262343117ffb0fc45a9a8137a0e7c
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Sat Jun 30 01:00:28 2012 +0200

    sign fixes

commit 0ded10864312368ff2862a716e29d7db387996f4
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 0629bbd..bd8f5f0 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]