summaryrefslogtreecommitdiff
path: root/lib/gnutls_psk.c
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2008-06-04 06:55:15 +0200
committerSimon Josefsson <simon@josefsson.org>2008-06-04 06:55:15 +0200
commit22534570d23a82b0b0707c49400fd094e4f92ff8 (patch)
tree9c740c5d3c58e498e865192e12ac76c4369e49fb /lib/gnutls_psk.c
parent97e2fde192482d79fd836f9289ae5ff7bf96789f (diff)
downloadgnutls-22534570d23a82b0b0707c49400fd094e4f92ff8.tar.gz
Add gnutls_psk_set_server_credentials_hint.
Diffstat (limited to 'lib/gnutls_psk.c')
-rw-r--r--lib/gnutls_psk.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/lib/gnutls_psk.c b/lib/gnutls_psk.c
index e29bd2a5c7..fb09279682 100644
--- a/lib/gnutls_psk.c
+++ b/lib/gnutls_psk.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2007 Free Software Foundation
+ * Copyright (C) 2005, 2007, 2008 Free Software Foundation
*
* Author: Nikos Mavrogiannopoulos
*
@@ -220,6 +220,31 @@ gnutls_psk_set_server_credentials_file (gnutls_psk_server_credentials_t
return 0;
}
+/**
+ * gnutls_psk_set_server_credentials_hint - Set a identity hint, in a %gnutls_psk_server_credentials_t structure
+ * @res: is an #gnutls_psk_server_credentials_t structure.
+ * @hint: is the PSK identity hint string
+ *
+ * This function sets the identity hint, in a
+ * %gnutls_psk_server_credentials_t structure. This hint is sent to
+ * the client to help it chose a good PSK credential (i.e., username
+ * and password).
+ *
+ * Returns: %GNUTLS_E_SUCCESS on success, or an error code.
+ **/
+int
+gnutls_psk_set_server_credentials_hint (gnutls_psk_server_credentials_t res,
+ const char *hint)
+{
+ res->hint = gnutls_strdup (hint);
+ if (res->hint == NULL)
+ {
+ gnutls_assert ();
+ return GNUTLS_E_MEMORY_ERROR;
+ }
+
+ return 0;
+}
/**
* gnutls_psk_set_server_credentials_function - Used to set a callback to retrieve the user's PSK credentials
@@ -261,7 +286,7 @@ gnutls_psk_set_server_credentials_function (gnutls_psk_server_credentials_t
* int (*callback)(gnutls_session_t, char** username,
* gnutls_datum_t* key);
*
- * The @username and @key must be allocated using gnutls_malloc().
+ * The @username and @key->data must be allocated using gnutls_malloc().
* @username should be ASCII strings or UTF-8 strings prepared using
* the "SASLprep" profile of "stringprep".
*