gnutls_prf_early(3)

πŸ’– gnutls_prf_early β€” the API function ✨

okay bestie, welcome to the gnutls_prf_early(3) page from the gnutls manual 🌸 this one's a lil niche but it's iconic, i promise. it's giving "secret key material, but make it early" πŸ’…


🌈 SYNOPSIS

#include <gnutls/gnutls.h>

int gnutls_prf_early(gnutls_session_t session, size_t label_size, const
char * label, size_t context_size, const char * context, size_t outsize,
char * out);

πŸŽ€ ARGUMENTS

  • gnutls_session_t session β€” it's a gnutls_session_t type, your whole lil session vibe 🫢
  • size_t label_size β€” the length of the label variable. just how long that string is, no cap.
  • const char * label β€” the label used in the PRF computation, typically a short string. short and slay ✨
  • size_t context_size β€” length of the extra variable. yes bestie, we're measuring that too.
  • const char * context β€” optional extra data to seed the PRF with. optional but lowkey powerful 🌟
  • size_t outsize β€” size of the pre-allocated output buffer that's gonna hold the output.
  • char * out β€” pre-allocated buffer to hold the generated data. pre-allocated, like you better have that buffer ready before you call this πŸ’€

πŸ¦‹ DESCRIPTION

so this function is similar to gnutls_prf_rfc5705(), but β€” and this is the moment β€” it only works in TLS 1.3 or later, to export early keying material. older TLS could never, fr fr πŸ”₯

bestie, listen: the keying material is only available after the ClientHello message is processed and before the application traffic keys are established. so you shall call this function inside a handshake hook function for GNUTLS_HANDSHAKE_CLIENT_HELLO. timing is literally everything here πŸ‘‘

the label variable usually contains a string denoting the purpose for the generated data. like, what is this keying material for, bestie? label it 🏷️

the context variable can be used to add more data to the seed, after the random variables. it can be used to make sure the generated output is strongly connected to some additional data (e.g., a string used in user authentication). it's giving "this output is ours, nobody else's" πŸ’œ

the output is placed in out, which must be pre-allocated. did i mention pre-allocated? pre-allocated. 😀

note that, to provide the RFC5705 context, the context variable must be non-null. don't be sending me a null context and expecting the RFC5705 vibe, okay? πŸ™ˆ

⭐ RETURNS

GNUTLS_E_SUCCESS on success, or an error code. that's it, that's the tea πŸ“


🌸 SINCE

3.6.8 β€” vintage, but make it cute πŸŽ€


πŸ› REPORTING BUGS

found a bug? don't suffer in silence bestie, spill it:


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.

(translation: you can copy and share this file, no royalties needed, just keep the copyright notice and this notice intact. the legal girlies ate with this one πŸ’…)


πŸ”— 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 pulled from the gnutls manual, version 3.8.13, and the footer was repping gnutls_prf_early(3). go forth and export that early keying material responsibly, mwah πŸ’–βœ¨

πŸ“¦ where this page comes from