gnutls_psk_set...tials_function3(3)
β¨ NAME β¨
gnutls_psk_set_client_credentials_function3 β it's an API function bestie, and it's the one that lets you plug in your own lil callback to hand over the PSK username + password for client auth π (this page lives in the gnutls manual, section 3, iykyk)
π SYNOPSIS π
#include <gnutls/gnutls.h>
void
gnutls_psk_set_client_credentials_function3(gnutls_psk_client_credentials_t
cred, gnutls_psk_client_credentials_function3 * func);
π¦ ARGUMENTS π¦
gnutls_psk_client_credentials_t credβ okay so the manpage literally says this "is agnutls_psk_server_credentials_ttype." That's what it says, fr fr, so that's what you get. πgnutls_psk_client_credentials_function3 * funcβ this one's the callback function, the lil guy that does the actual work β¨
πΈ DESCRIPTION πΈ
So basically, this function sets up a callback whose whole job is to fetch the username and password for client PSK authentication. That's it, that's the vibe.
The callback's function form is, no cap:
int (*callback)(gnutls_session_t, gnutls_datum_t* username,
gnutls_datum_t* key, gnutls_datum_t* context, gnutls_psk_key_flags
*flags);
This callback has the same semantics as the one in gnutls_psk_set_client_credentials_function2(), except β plot twist β it also returns flags associated with the key π. And the callback is allowed to import an external PSK using the method described in RFC 9258 by calling gnutls_psk_format_imported_identity(). Iconic behaviour, honestly.
Now for the rules, and bestie these are not optional π:
- The
datafield ofusername,key, andcontextmust be allocated usinggnutls_malloc(). - The
usernameshould be an ASCII string or a UTF-8 string. If you're going the UTF-8 route, it's recommended that it follows the PRECIS framework for usernames (rfc8265). Do with that what you will π
Also important: the callback function will be called once per handshake. Every single time. It's committed like that.
And the return value? The callback function should return 0 on success. -1 indicates an error. Simple as.
β οΈ Lowkey do not forget the gnutls_malloc() thing. That's a real requirement, not a suggestion, and I'm not gonna let you fumble it.
π REPORTING BUGS π
Found a bug? Don't suffer in silence, tell the people:
- 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.
(Yes bestie, that means you can share it. Slay.)
π 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, go visit:
https://www.gnutls.org/manual/
That's the whole page, you ate it π«Ά This was brought to you by gnutls, version 3.8.13, and the page name gnutls_psk_set...tials_function3(3) β yes the title is abbreviated like that, it's giving mysterious, we love her for it π
β¨
π¦ 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