summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--NEWS2
-rw-r--r--doc/cha-upgrade.texi24
-rw-r--r--lib/gnutls_state.c31
-rw-r--r--lib/includes/gnutls/gnutls.h.in2
-rw-r--r--lib/libgnutls.map1
6 files changed, 58 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index f99f9a2499..c60ef7c9c2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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 a15b0e8fb6..27a258c00e 100644
--- 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)
diff --git a/doc/cha-upgrade.texi b/doc/cha-upgrade.texi
index 0a7a2d3898..6b8c6133fb 100644
--- a/doc/cha-upgrade.texi
+++ b/doc/cha-upgrade.texi
@@ -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
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c
index c8773c466f..c0fdaa3f76 100644
--- a/lib/gnutls_state.c
+++ b/lib/gnutls_state.c
@@ -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);
+ }
+}
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index d67a79d388..f314be8b21 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -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
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 3cf668a074..31938482ed 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -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 {