summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2020-03-25 14:29:36 +0000
committerDaiki Ueno <ueno@gnu.org>2020-03-25 14:29:36 +0000
commit0b06c99dd730e6239db38553386a26a25c27e6cb (patch)
treea5c11df9d8dd19ad795e197bddb4705f70d880b9
parentc78665483dd7b6a222ec071df99ee7333b1e295a (diff)
parent313f58a4772b905091e1506b0880e2c2014eeb28 (diff)
downloadgnutls-0b06c99dd730e6239db38553386a26a25c27e6cb.tar.gz
Merge branch 'tmp-get-keylog-func' into 'master'
gnutls_session_get_keylog_function: new function See merge request gnutls/gnutls!1220
-rw-r--r--NEWS1
-rw-r--r--devel/libgnutls-latest-x86_64.abi1
-rw-r--r--devel/symbols.last1
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/manpages/Makefile.am1
-rw-r--r--lib/includes/gnutls/gnutls.h.in1
-rw-r--r--lib/kx.c17
-rw-r--r--lib/libgnutls.map1
-rw-r--r--tests/keylog-func.c2
9 files changed, 27 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 5348151679..f9f8f5acad 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ See the end for copying conditions.
gnutls_hkdf_extract: Added
gnutls_hkdf_expand: Added
gnutls_pbkdf2: Added
+gnutls_session_get_keylog_function: Added
gnutls_session_set_keylog_function: Added
gnutls_prf_hash_get: Added
gnutls_psk_server_get_username2: Added
diff --git a/devel/libgnutls-latest-x86_64.abi b/devel/libgnutls-latest-x86_64.abi
index c953e01352..12d5f5b7af 100644
--- a/devel/libgnutls-latest-x86_64.abi
+++ b/devel/libgnutls-latest-x86_64.abi
@@ -792,6 +792,7 @@
<elf-symbol name='gnutls_session_get_flags' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='gnutls_session_get_id2' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='gnutls_session_get_id' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ <elf-symbol name='gnutls_session_get_keylog_function' version='GNUTLS_3_6_13' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='gnutls_session_get_master_secret' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='gnutls_session_get_ptr' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='gnutls_session_get_random' version='GNUTLS_3_4' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
diff --git a/devel/symbols.last b/devel/symbols.last
index a3a11ab7c2..5a8343a0f0 100644
--- a/devel/symbols.last
+++ b/devel/symbols.last
@@ -760,6 +760,7 @@ gnutls_session_get_desc@GNUTLS_3_4
gnutls_session_get_flags@GNUTLS_3_4
gnutls_session_get_id2@GNUTLS_3_4
gnutls_session_get_id@GNUTLS_3_4
+gnutls_session_get_keylog_function@GNUTLS_3_6_13
gnutls_session_get_master_secret@GNUTLS_3_4
gnutls_session_get_ptr@GNUTLS_3_4
gnutls_session_get_random@GNUTLS_3_4
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 9c72b01281..0f16eeccc8 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1939,6 +1939,8 @@ FUNCS += functions/gnutls_session_get_id
FUNCS += functions/gnutls_session_get_id.short
FUNCS += functions/gnutls_session_get_id2
FUNCS += functions/gnutls_session_get_id2.short
+FUNCS += functions/gnutls_session_get_keylog_function
+FUNCS += functions/gnutls_session_get_keylog_function.short
FUNCS += functions/gnutls_session_get_master_secret
FUNCS += functions/gnutls_session_get_master_secret.short
FUNCS += functions/gnutls_session_get_ptr
diff --git a/doc/manpages/Makefile.am b/doc/manpages/Makefile.am
index 60c937da83..97cc80ed6e 100644
--- a/doc/manpages/Makefile.am
+++ b/doc/manpages/Makefile.am
@@ -771,6 +771,7 @@ APIMANS += gnutls_session_get_desc.3
APIMANS += gnutls_session_get_flags.3
APIMANS += gnutls_session_get_id.3
APIMANS += gnutls_session_get_id2.3
+APIMANS += gnutls_session_get_keylog_function.3
APIMANS += gnutls_session_get_master_secret.3
APIMANS += gnutls_session_get_ptr.3
APIMANS += gnutls_session_get_random.3
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index 9fb6afa156..a6c3c0ef30 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -2312,6 +2312,7 @@ void gnutls_global_set_log_level(int level);
typedef int (*gnutls_keylog_func) (gnutls_session_t session,
const char *label,
const gnutls_datum_t *secret);
+gnutls_keylog_func gnutls_session_get_keylog_function(const gnutls_session_t session);
void gnutls_session_set_keylog_function(gnutls_session_t session,
gnutls_keylog_func func);
diff --git a/lib/kx.c b/lib/kx.c
index d5abf69ea7..a874f15114 100644
--- a/lib/kx.c
+++ b/lib/kx.c
@@ -71,6 +71,23 @@ int _gnutls_generate_master(gnutls_session_t session, int keep_premaster)
}
/**
+ * gnutls_session_get_keylog_function:
+ * @session: is #gnutls_session_t type
+ *
+ * This function will return the callback function set using
+ * gnutls_session_set_keylog_function().
+ *
+ * Returns: The function set or %NULL otherwise.
+ *
+ * Since: 3.6.13
+ */
+gnutls_keylog_func
+gnutls_session_get_keylog_function(const gnutls_session_t session)
+{
+ return session->internals.keylog_func;
+}
+
+/**
* gnutls_session_set_keylog_function:
* @session: is #gnutls_session_t type
* @func: is the function to be called
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 7c3187541d..5541e9caba 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -1315,6 +1315,7 @@ GNUTLS_3_6_13
gnutls_hkdf_extract;
gnutls_hkdf_expand;
gnutls_pbkdf2;
+ gnutls_session_get_keylog_function;
gnutls_session_set_keylog_function;
gnutls_prf_hash_get;
gnutls_psk_server_get_username2;
diff --git a/tests/keylog-func.c b/tests/keylog-func.c
index 8c4d321142..4350698e6b 100644
--- a/tests/keylog-func.c
+++ b/tests/keylog-func.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <assert.h>
#if !defined(__linux__) || !defined(__GNUC__)
@@ -141,6 +142,7 @@ static void client(int fd, const char *prio, unsigned int exp_call_count)
gnutls_transport_set_int(session, fd);
gnutls_session_set_keylog_function(session, keylog_func);
+ assert(gnutls_session_get_keylog_function(session) == keylog_func);
/* Perform the TLS handshake
*/