gnutls_session_get_data2(3)
π gnutls_session_get_data2 π
okay bestie, gather round, because we're talking about a gnutls function and she is lowkey the whole reason your TLS sessions can come back from the dead like a main character. it's gnutls_session_get_data2, and no cap, she's iconic. let's get into it π
β¨ NAME β¨
gnutls_session_get_data2 β API function π
π¦ SYNOPSIS π¦
#include <gnutls/gnutls.h>
int gnutls_session_get_data2(gnutls_session_t session, gnutls_datum_t *
data);
πΈ ARGUMENTS πΈ
gnutls_session_t sessionβ bestie this is literally just agnutls_session_ttype. that's the vibe. that's the whole assignment. β¨gnutls_datum_t * dataβ a pointer to a datum, and that datum is gonna hold the session. she's the container, the vessel, the it-girl storage unit π«Ά
π DESCRIPTION π
so here's the tea: this function returns all the necessary parameters to support resumption. the client should call this function and store the returned session data. then later, a session can be resumed by calling gnutls_session_set_data() with the data you got back. it's giving "save your progress" energy, fr fr πΎ
β οΈ heads up though β under TLS 1.3, it's recommended for clients to use session parameters only once, to prevent passive-observers from correlating the different connections. do not be reusing that thing like a rewatch, bestie. one and done. π
the returned data are allocated and must be released using gnutls_free(). do not forget. do not ghost your memory management. that's not slay, that's a leak π
this function will fail if called prior to handshake completion. and in case of false start TLS, the handshake completes only after data have been successfully received from the peer. so like, wait your turn. the handshake is not done until it says it's done. π
under TLS1.3, session resumption is possible only after a session ticket is received by the client. to make sure such a ticket has actually arrived, use gnutls_session_get_flags() and check for flag GNUTLS_SFLAGS_SESSION_TICKET. if this flag is not set, this function will wait for a new ticket within an estimated roundtrip, and if it's not received, it will return dummy data which cannot lead to resumption. it's giving fake ID energy, honestly. it looks valid, it is not valid, do not present it at the club ποΈπ
to get notified when new tickets are received by the server, use gnutls_handshake_set_hook_function() to wait for GNUTLS_HANDSHAKE_NEW_SESSION_TICKET messages. and each call of gnutls_session_get_data2() after a ticket is received will return session resumption data corresponding to the last received ticket. last one wins, periodt β¨
π«Ά note that this function under TLS1.3 requires a callback to be set withgnutls_transport_set_pull_timeout_function()for successful operation. there was a bug before3.6.10which could make this function fail if that callback was not set. on later versions, if it's not set, the function will return a successful error code, but will return dummy data that cannot lead to a resumption. so it's smiling at you while lying to you. we've all been there π
β RETURNS β
on success, GNUTLS_E_SUCCESS (0) is returned, otherwise an error code is returned. simple. clean. exactly what you'd expect. π
π REPORTING BUGS π
found a bug? spill. report bugs to <bugs@gnutls.org>.
home page: https://www.gnutls.org
π COPYRIGHT π
Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
π SEE ALSO π
the full documentation for gnutls is maintained as a Texinfo manual. if the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:
https://www.gnutls.org/manual/
and that's the whole page, bestie π this little baddie is from gnutls 3.8.13 β go forth and resume your sessions responsibly, drink water, set your pull timeout callback, and never reuse a TLS 1.3 session parameter twice. mwah πβ¨π¦
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms