gnutls_prf(3)

✨ gnutls_prf β€” the glow-up edition ✨

okay bestie, buckle up, this one's from the gnutls manual, section 3 πŸ’–


🌸 NAME 🌸

gnutls_prf β€” literally just an API function, no cap


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/gnutls.h>

int gnutls_prf(gnutls_session_t session, size_t label_size, const char *
label, int server_random_first, size_t extra_size, const char * extra,
size_t outsize, char * out);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_session_t session β€” it's a gnutls_session_t type, that's the whole vibe πŸ’…
  • size_t label_size β€” how long the label variable is
  • const char * label β€” the label we use in the PRF computation, usually a lil short string πŸ“
  • int server_random_first β€” non-zero if the server random field should be first in the seed πŸ‘‘
  • size_t extra_size β€” how long the extra variable is
  • const char * extra β€” optional extra data to seed the PRF with, if you're feeling extra (which, same)
  • 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, she's ready and waiting 🫢

πŸ’œ DESCRIPTION πŸ’œ

So what this does is apply the TLS Pseudo-Random-Function (PRF) on the master secret and the data you handed it, seeded with the client and server random fields. For the key expansion specified in RFC5705, go look at gnutls_prf_rfc5705() instead, iykyk.

The label variable usually contains a string denoting the purpose for the generated data. The server_random_first tells you whether the client random field or the server random field should be first in the seed. Non-zero means the server random field is first, 0 means the client random field is first. Simple as.

The extra variable can be used to add more data to the seed, and it goes after the random variables. Use it to make sure the generated output is strongly connected to some additional data β€” like, say, a string used in user authentication. Cute, right? 🌈

The output goes in out, which must be pre-allocated. No take-backs, no auto-allocating, she needs her buffer ready before you show up. 😭


⭐ NOTE ⭐

This function produces identical output to gnutls_prf_rfc5705() when server_random_first is set to 0 and extra is NULL. But under TLS1.3 this function will only operate when these conditions are true β€” otherwise it returns GNUTLS_E_INVALID_REQUEST. So like, respect the conditions or get told no πŸ’€


πŸ”₯ RETURNS πŸ”₯

GNUTLS_E_SUCCESS on success, or an error code. That's it, that's the whole energy.


πŸ™ˆ REPORTING BUGS πŸ™ˆ

Report bugs 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.


πŸ’– 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, mwah πŸ’…βœ¨

this masterpiece comes to you courtesy of gnutls 3.8.13 β€” periodt, stay hydrated, go read your man pages πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from