gnutls_rehandshake(3)

πŸ’– gnutls_rehandshake(3) β€” the gnutls manual, bestie edition πŸ’–

okay so this is a page from the gnutls manual, and today's main character is gnutls_rehandshake. it's from version 3.8.13 btw, keep that in your pocket 🫢


✨ NAME ✨

gnutls_rehandshake β€” literally just an API function, that's the whole vibe πŸ’…


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

int gnutls_rehandshake(gnutls_session_t session);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_session_t session β€” bestie this is a gnutls_session_t type. that's it, that's the arg πŸ¦‹

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so listen. this function can only be called on the server side, no cap. what it does is it tells a TLS 1.2-or-earlier client to renegotiate parameters β€” like, actually do a handshake β€” by sending a hello request message. so polite of it ✨

if this function succeeds, the calling application should keep calling gnutls_record_recv() until GNUTLS_E_REHANDSHAKE comes back, so that any pending data gets cleared out. and if you don't see the GNUTLS_E_REHANDSHAKE error code? then the handshake request was not followed by the peer. and honestly, not a scandal β€” the TLS protocol does not require the client to do it, and that kind of compliance should be handled by the application protocol. so don't come for the client, it's allowed πŸ™ˆ

once the GNUTLS_E_REHANDSHAKE error code is seen, the calling application should proceed to call gnutls_handshake() to negotiate the new parameters. go go go πŸƒβ™€οΈ

and if the client does not wish to renegotiate parameters, he may reply with an alert message β€” and in that case the return code you'll see from subsequent gnutls_record_recv() calls will be GNUTLS_E_WARNING_ALERT_RECEIVED, with the specific alert being GNUTLS_A_NO_RENEGOTIATION. a client may also just choose to ignore this request entirely. silence is an answer, i guess πŸ’€

under TLS 1.3 this function is equivalent to gnutls_session_key_update() with the GNUTLS_KU_PEER flag. in that case, subsequent calls to gnutls_record_recv() will not return GNUTLS_E_REHANDSHAKE, and calls to gnutls_handshake() on the server side are a no-op. nothing happens. it's giving ghosting πŸ‘»

and yeah β€” this function always fails with GNUTLS_E_INVALID_REQUEST when called on the client side. like, always always. don't try it bestie, it's not your moment 😭

🌈 RETURNS 🌈

GNUTLS_E_SUCCESS on success πŸŽ‰, otherwise a negative error code. sad girl hours but make it a return value.


πŸ› REPORTING BUGS πŸ›

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

home page: https://www.gnutls.org β€” go say hi 🏠


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. so like, keep the receipt, that's all we ask 🧾✨


πŸ¦‹ 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, go visit:

https://www.gnutls.org/manual/

it's right there waiting for you, iykyk πŸ’–


and that's the whole page!! this was gnutls_rehandshake(3) from the gnutls manual, version 3.8.13 β€” mwah, slay, no cap, periodt πŸ’…πŸ‘‘πŸŒΈ

go renegotiate responsibly bestie 🫢

πŸ“¦ where this page comes from