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 agnutls_session_ttype, your whole lil session vibe π«Άsize_t label_sizeβ the length of thelabelvariable. 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:
- 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.
(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
- 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