GNUTLS_PSK_SET_SERVER_CREDENTIALS_FUNCTION(3)
β¨ NAME β¨
gnutls_psk_set_server_credentials_function β it's an API function, bestie, and it's the one that lets you plug your own little callback into the server side of PSK stuff π
It lives in the gnutls manual, and we're reading the page for version 3.8.13 today. Okay so let's get into it π
πΈ SYNOPSIS πΈ
#include <gnutls/gnutls.h>
void
gnutls_psk_set_server_credentials_function(gnutls_psk_server_credentials_t
cred, gnutls_psk_server_credentials_function * func);
π ARGUMENTS π
gnutls_psk_server_credentials_t credβ is agnutls_psk_server_credentials_ttype. yes literally that, it's the creds object you're attaching stuff to π«Άgnutls_psk_server_credentials_function * funcβ is the callback function. the star of the show, the main character, the one doing the actual work π
π¦ DESCRIPTION π¦
okay so this is the moment. You can use this function to set a callback that retrieves the user's PSK credentials. That's it. That's the job. And the callback's function form is, and I'm quoting this exactly because it matters:
int (*callback)(gnutls_session_t, const char* username, gnutls_datum_t* key);
So username contains the actual username β like the real one, the one that came in. And the key must be filled in using the gnutls_malloc(). Not regular malloc, not vibes, gnutls_malloc(). periodt π
In case the callback returned a negative number then gnutls will assume that the username does not exist. So a negative return is lowkey a "who? never heard of her" from your own code.
The callback function will only be called once per handshake. One shot, one opportunity, no do-overs π
And the return rules are simple: the callback function should return 0 on success, while -1 indicates an error. slay, that's it π
π REPORTING BUGS π
Found something cursed? Report bugs to <bugs@gnutls.org>. They wanna hear it, fr fr.
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. (iconic behaviour honestly, very generous of them π)
π 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 gnutls 3.8.13 β the manual page for gnutls_psk_set_server_credentials_function, straight from the gnutls crew. go forth and fill in that key with gnutls_malloc() like the legend you are π
π¦π
π¦ 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