gnutls_handsha..._hello_function(3)

✨ gnutls_handshake_set_post_client_hello_function ✨

okay bestie, welcome to the gnutls manual, page three of gnutls_handshake_set_post_client_hello_function πŸ’– this one's short but it's important, so sit with me for a sec 🫢


🌸 NAME 🌸

gnutls_handshake_set_post_client_hello_function β€” it's an API function, no cap ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/gnutls.h>

void gnutls_handshake_set_post_client_hello_function(gnutls_session_t
session, gnutls_handshake_simple_hook_func func);

like… look at her. iconic signature, she's serving πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_session_t session β€” bestie this is a gnutls_session_t type. that's it, that's the whole vibe πŸ’œ
  • gnutls_handshake_simple_hook_func func β€” the function that's gonna get called. your little callback, your moment 🌟

🌈 DESCRIPTION 🌈

so what this function does is set a callback that gets called after the client hello has been received. and listen β€” this callback is valid in server side only, so if you're on the client side this is not your era πŸ™ˆ

what's it for? it lets the server adjust settings based on the received extensions ✨

and when we say "settings" we mean stuff like ciphersuites, requesting a certificate, or literally anything else β€” with one exception: version negotiation. you can't touch that one, because it already happened before the hello message even got parsed. the past is the past, she's moved on πŸ’€

this callback must return 0 on success, or a gnutls error code to terminate the handshake. no in-between, no "ehhh maybe", it's giving decisive queen πŸ‘‘

and since GnuTLS 3.3.5, the callback is allowed to return GNUTLS_E_AGAIN or GNUTLS_E_INTERRUPTED to put the handshake on hold ⏸️ when that happens, gnutls_handshake() will return GNUTLS_E_INTERRUPTED and you can resume it whenever you need to. so flexible. so considerate. we love a comeback arc πŸ’–


πŸ’€ WARNING πŸ’€

okay this part is serious, bestie, pay attention: you should not use this function to terminate the handshake based on client input unless you genuinely know what you are doing. because before the handshake is finished, there is no way to know if there's a man-in-the-middle attack being performed. no way. none. so be careful out there fr fr 😭

πŸ› REPORTING BUGS πŸ›

found a bug? report it to <bugs@gnutls.org> πŸ’Œ

home page: https://www.gnutls.org 🏠


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. slay, and also legally binding, but slay πŸ’…


πŸ”₯ 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 was the gnutls manual, 3.8.13 edition, gnutls_handsha..._hello_function(3) β€” thank u for reading, mwah πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from