diff options
author | Simon Josefsson <simon@josefsson.org> | 2008-06-03 17:28:31 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2008-06-03 17:28:31 +0200 |
commit | 97e2fde192482d79fd836f9289ae5ff7bf96789f (patch) | |
tree | b5b5fbe20149bc457aee016fea15bc099e4e1d58 /lib | |
parent | 829ef4ba4463b65d7db54401544a91a931707385 (diff) | |
download | gnutls-97e2fde192482d79fd836f9289ae5ff7bf96789f.tar.gz |
Add gnutls_psk_client_get_hint function. Use it.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gnutls_psk.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/gnutls_psk.c b/lib/gnutls_psk.c index abfc4e56ca..e29bd2a5c7 100644 --- a/lib/gnutls_psk.c +++ b/lib/gnutls_psk.c @@ -307,6 +307,33 @@ gnutls_psk_server_get_username (gnutls_session_t session) } /** + * gnutls_psk_client_get_hint - return the PSK identity hint of the peer + * @session: is a gnutls session + * + * The PSK identity hint may give the client help in deciding which + * username to use. This should only be called in case of PSK + * authentication and in case of a client. + * + * Returns: the identity hint of the peer, or %NULL in case of an error. + **/ +const char * +gnutls_psk_client_get_hint (gnutls_session_t session) +{ + psk_auth_info_t info; + + CHECK_AUTH (GNUTLS_CRD_PSK, NULL); + + info = _gnutls_get_auth_info (session); + if (info == NULL) + return NULL; + + if (info->hint[0] != 0) + return info->hint; + + return NULL; +} + +/** * gnutls_hex_decode - decode hex encoded data * @hex_data: contain the encoded data * @result: the place where decoded data will be copied |