]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Added gnutls_session_get_random()
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 19 Mar 2012 18:18:37 +0000 (19:18 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 19 Mar 2012 18:18:37 +0000 (19:18 +0100)
.gitignore
NEWS
doc/cha-upgrade.texi
lib/gnutls_state.c
lib/includes/gnutls/gnutls.h.in
lib/libgnutls.map

index f99f9a2499365cd397913333f6a1428f58dc10e7..c60ef7c9c28b3720462e7c9b704e631137ef8568 100644 (file)
@@ -592,3 +592,5 @@ tests/mini-tdb
 tests/resume-dtls
 tests/mini-record
 tests/srp/mini-srp
+doc/stamp_functions
+doc/latex/cha-upgrade.tex
diff --git a/NEWS b/NEWS
index a15b0e8fb6da5b9a8a10558aad35f49cb5230e9a..27a258c00ecbac718d3567351067db3dce1f1b27 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ gnutls_x509_crt_set_private_key_usage_period: Added
 gnutls_x509_crt_get_private_key_usage_period: Added
 gnutls_x509_crq_set_private_key_usage_period: Added
 gnutls_x509_crq_get_private_key_usage_period: Added
+gnutls_session_get_random: Added
+
 
 * Version 3.0.17 (released 2012-03-17)
 
index 0a7a2d3898fdc3c21dcb1e686f2b415c49ac8f65..6b8c6133fbf34733e821bd50f8a7cdc968cc3f61 100644 (file)
@@ -25,8 +25,24 @@ functionality as described in @ref{Asynchronous operation}.
 
 @heading Upgrading to 3.0.x from previous versions
 
-GnuTLS 3.0.x is source compatible with previous versions but discarded the function
-@funcintref{gnutls_transport_set_lowat}.
-The function @funcref{gnutls_record_check_pending} has to be used to achieve 
-the same functionality as described in @ref{Asynchronous operation}.
+GnuTLS 3.0.x is source compatible with previous versions but discarded the functions
+@funcintref{gnutls_transport_set_lowat}, @funcintref{gnutls_session_get_client_random},
+@funcintref{gnutls_session_get_server_random}, @funcintref{gnutls_session_get_master_secret}.
+
+@multitable @columnfractions .30 .60
+@headitem Old function @tab Replacement
+
+@item @funcintref{gnutls_transport_set_lowat} @tab
+To replace its functionality the function @funcref{gnutls_record_check_pending} has to be used,
+as described in @ref{Asynchronous operation}
+
+@item @funcintref{gnutls_session_get_server_random},
+@funcintref{gnutls_session_get_client_random} 
+@tab 
+They are replaced by the safer function @ref{gnutls_session_get_random}
+
+@item @funcintref{gnutls_session_get_master_secret} 
+@tab Replaced by the keying material exporters discussed in @ref{Keying Material Exporters}
+
+@end multitable
 
index c8773c466f5e7727b73fc5750270379dede54d70..c0fdaa3f761f459b9c71d1a2240b7a13721e67ac 100644 (file)
@@ -1431,3 +1431,34 @@ gnutls_protocol_get_version (gnutls_session_t session)
 {
   return _gnutls_protocol_get_version(session);
 }
+
+/**
+ * gnutls_session_get_random:
+ * @session: is a #gnutls_session_t structure.
+ * @client: the client part of the random
+ * @server: the server part of the random
+ *
+ * This functions returns pointers to the client and server
+ * random fields used in the TLS handshake. The pointers are
+ * not to be modified or deallocated.
+ *
+ * If a client random value has not yet been established, the output
+ * will be garbage.
+ *
+ * Since: 3.0
+ **/
+void
+gnutls_session_get_random (gnutls_session_t session, gnutls_datum_t* client, gnutls_datum_t* server)
+{
+  if (client)
+    {
+      client->data = session->security_parameters.client_random;
+      client->size = sizeof(session->security_parameters.client_random);
+    }
+
+  if (server)
+    {
+      server->data = session->security_parameters.server_random;
+      server->size = sizeof(session->security_parameters.server_random);
+    }
+}
index d67a79d3887bd8946748a7243a765799ee13f157..f314be8b212a98bacd22578d3962e65ec3a3ec1e 100644 (file)
@@ -960,6 +960,8 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session);
                                size_t * session_data_size);
   int gnutls_session_get_data2 (gnutls_session_t session,
                                 gnutls_datum_t * data);
+  void gnutls_session_get_random (gnutls_session_t session, gnutls_datum_t* client, 
+                                  gnutls_datum_t* server);
 
 /* returns the session ID */
 #define GNUTLS_MAX_SESSION_ID 32
index 3cf668a0745fa8cf1dedfe6596d37c6060fb627a..31938482ed92549081a60c67f106669cbd91a003 100644 (file)
@@ -785,6 +785,7 @@ GNUTLS_3_0_0 {
        gnutls_x509_crq_get_private_key_usage_period;
        gnutls_x509_crt_set_private_key_usage_period;
        gnutls_x509_crq_set_private_key_usage_period;
+       gnutls_session_get_random;
 } GNUTLS_2_12;
 
 GNUTLS_PRIVATE {