gnutls_prf_raw(3)

πŸ’– gnutls_prf_raw(3) πŸ’–

okay bestie, welcome to the gnutls manual, this one's about gnutls_prf_raw β€” an API function, no cap. pull up a chair, grab a boba, we're doing crypto lore today 🧚✨


✨ NAME ✨

gnutls_prf_raw β€” literally just an API function, that's the whole name, short and iconic πŸ’…


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

int gnutls_prf_raw(gnutls_session_t session, size_t label_size, const
char * label, size_t seed_size, const char * seed, size_t outsize, char
* out);

look at that signature. she's long, she's precise, she's giving main character energy πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_session_t session β€” bestie this is a gnutls_session_t type. that's it. that's the vibe.
  • size_t label_size β€” how long the label variable is. count those characters, queen πŸ“
  • const char * label β€” the label used in the PRF computation, typically a short little string. keep it cute, keep it brief.
  • size_t seed_size β€” the length of the seed variable. yes we're measuring again, we love a size_t 🫢
  • const char * seed β€” optional extra data to seed the PRF with. optional! she's flexible!
  • size_t outsize β€” the size of the pre-allocated output buffer that's gonna hold the output. know your limits, bestie.
  • char * out β€” a pre-allocated buffer to hold the generated data. you bring the bucket, the function brings the water πŸ’§

πŸ¦‹ DESCRIPTION πŸ¦‹

so what are we even doing here? we're applying the TLS Pseudo-Random-Function (PRF) on the master secret and the data you hand over. periodt.

the label variable usually contains a string denoting the purpose for the generated data. like a lil name tag for your bytes 🏷️

the seed usually contains data such as the client and server random, perhaps together with some additional data that is added to guarantee uniqueness of the output for a particular purpose.

⚠️ now listen up because this part is important: because the output is not guaranteed to be unique for a particular session unless seed includes the client random and server random fields (the PRF would output the same data on another connection resumed from the first one), it is not recommended to use this function directly. 😭

the gnutls_prf() function seeds the PRF with the client and server random fields directly, and is recommended if you want to generate pseudo random data unique for each session. so like… use that one instead, fr fr. this raw one is giving "I can fix him" energy and you should NOT try to fix him πŸ’€


πŸ’œ NOTE πŸ’œ

this function will only operate under TLS versions prior to 1.3. in TLS1.3 the use of PRF is replaced with HKDF and the generic exporters like gnutls_prf_rfc5705() should be used instead. under TLS1.3 this function returns GNUTLS_E_INVALID_REQUEST.

so if you're on TLS1.3 and you're like "why isn't this working" β€” bestie, that's the whole point. she said no. πŸ™ˆ


⭐ RETURNS ⭐

GNUTLS_E_SUCCESS on success, or an error code. slay when it works, error code when it doesn't. no in-between, we love a clear boundary 🌈


πŸ“ REPORTING BUGS πŸ“

found a bug? don't gatekeep, 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.

(translation: share the love, keep the receipts πŸ’–)


🌸 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!! thanks for reading, you ate that 🫢✨ this was gnutls 3.8.13, signing off β€” stay hydrated, use gnutls_prf() instead of raw, and don't talk to TLS1.3 about PRF, she's moved on πŸ’…πŸŽ€

πŸ“¦ where this page comes from