GNUTLS_HANDSHAKE_SET_HOOK_FUNCTION(3)
β¨ gnutls_handshake_set_hook_function β¨
okay bestie, this one lives in the gnutls manual, section 3, and it's literally about sneaking a lil callback into the TLS handshake so you can vibe-check every message as it flies by π
πΈ NAME πΈ
gnutls_handshake_set_hook_function β an API function, and yes she's the main character
π¦ SYNOPSIS π¦
#include <gnutls/gnutls.h>
void gnutls_handshake_set_hook_function(gnutls_session_t session,
unsigned int htype, int when, gnutls_handshake_hook_func func);
π ARGUMENTS π
gnutls_session_t sessionβ it's agnutls_session_ttype, the session we're hooking into, no capunsigned int htypeβ thegnutls_handshake_description_tof the message you wanna hook at πint whenβ aGNUTLS_HOOK_*value, depending on when the hook function should get calledgnutls_handshake_hook_func funcβ the function to be called, aka the lil bestie that runs when the hook fires
π DESCRIPTION π
So this function sets a callback that gets called after or before the specified handshake message has been received or generated. It's giving generalization of gnutls_handshake_set_post_client_hello_function(), fr fr.
Wanna call the hook function prior to the message being generated or processed? Use GNUTLS_HOOK_PRE as the when parameter. Wanna call it after? That's GNUTLS_HOOK_POST. And if you want both cases, GNUTLS_HOOK_BOTH has you covered π«Ά
This callback must return 0 on success, or a gnutls error code to terminate the handshake. Periodt.
And if you wanna hook at all handshake messages? Just use an htype of GNUTLS_HANDSHAKE_ANY. Slay, catch them all β¨
π WARNING π
You should not use this function to terminate the handshake based on client input unless you know what you are doing. Before the handshake is finished there is no way to know if there is a man-in-the-middle attack being performed. π
like genuinely bestie, this is not the moment for vibes-based security decisions. know what you're doing or don't do it at all π
π REPORTING BUGS π
Found a bug? Report it 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 π that was gnutls version 3.8.13, straight from the gnutls source β go forth and hook responsibly, ily π«Άβ¨
π¦ 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