* [PATCH] tls: Add l_tls_get_session_resumed
@ 2022-12-30 16:47 Andrew Zaborowski
2022-12-30 17:35 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Zaborowski @ 2022-12-30 16:47 UTC (permalink / raw)
To: ell
---
ell/ell.sym | 1 +
ell/tls-private.h | 1 +
ell/tls.c | 10 ++++++++++
ell/tls.h | 1 +
4 files changed, 13 insertions(+)
diff --git a/ell/ell.sym b/ell/ell.sym
index 6c836e1..4d8596e 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -519,6 +519,7 @@ global:
l_tls_set_version_range;
l_tls_set_domain_mask;
l_tls_set_session_cache;
+ l_tls_get_session_resumed;
l_tls_alert_to_str;
l_tls_set_debug;
l_tls_set_cert_dump_path;
diff --git a/ell/tls-private.h b/ell/tls-private.h
index 6a9bd29..46889ad 100644
--- a/ell/tls-private.h
+++ b/ell/tls-private.h
@@ -266,6 +266,7 @@ struct l_tls {
uint8_t session_cipher_suite_id[2];
uint8_t session_compression_method_id;
char *session_peer_identity;
+ bool session_resumed;
struct {
bool secure_renegotiation;
diff --git a/ell/tls.c b/ell/tls.c
index d363765..72ff4d7 100644
--- a/ell/tls.c
+++ b/ell/tls.c
@@ -213,6 +213,7 @@ static void tls_reset_handshake(struct l_tls *tls)
tls->session_id_size_replaced = 0;
tls->session_id_new = false;
l_free(l_steal_ptr(tls->session_peer_identity));
+ tls->session_resumed = false;
}
static void tls_cleanup_handshake(struct l_tls *tls)
@@ -3058,6 +3059,7 @@ static void tls_finished(struct l_tls *tls)
TLS_SET_STATE(TLS_HANDSHAKE_DONE);
tls->ready = true;
+ tls->session_resumed = resuming;
if (session_update && tls->session_update_cb) {
tls->in_callback = true;
@@ -3841,6 +3843,14 @@ LIB_EXPORT void l_tls_set_session_cache(struct l_tls *tls,
tls->session_prefix = l_strdup(group_prefix);
}
+LIB_EXPORT bool l_tls_get_session_resumed(struct l_tls *tls)
+{
+ if (unlikely(!tls || !tls->ready))
+ return false;
+
+ return tls->session_resumed;
+}
+
LIB_EXPORT const char *l_tls_alert_to_str(enum l_tls_alert_desc desc)
{
switch (desc) {
diff --git a/ell/tls.h b/ell/tls.h
index e688c7c..6964380 100644
--- a/ell/tls.h
+++ b/ell/tls.h
@@ -134,6 +134,7 @@ void l_tls_set_session_cache(struct l_tls *tls, struct l_settings *settings,
unsigned int max_sessions,
l_tls_session_update_cb_t update_cb,
void *user_data);
+bool l_tls_get_session_resumed(struct l_tls *tls);
const char *l_tls_alert_to_str(enum l_tls_alert_desc desc);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tls: Add l_tls_get_session_resumed
2022-12-30 16:47 [PATCH] tls: Add l_tls_get_session_resumed Andrew Zaborowski
@ 2022-12-30 17:35 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2022-12-30 17:35 UTC (permalink / raw)
To: Andrew Zaborowski, ell
Hi Andrew,
On 12/30/22 10:47, Andrew Zaborowski wrote:
> ---
> ell/ell.sym | 1 +
> ell/tls-private.h | 1 +
> ell/tls.c | 10 ++++++++++
> ell/tls.h | 1 +
> 4 files changed, 13 insertions(+)
>
Applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-30 17:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-30 16:47 [PATCH] tls: Add l_tls_get_session_resumed Andrew Zaborowski
2022-12-30 17:35 ` Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).