diff options
author | Ander Juaristi <a@juaristi.eus> | 2020-03-02 16:37:10 +0100 |
---|---|---|
committer | Ander Juaristi <a@juaristi.eus> | 2020-03-23 17:00:58 +0100 |
commit | d00638997fa269a975095d852633b48b2b64fbf9 (patch) | |
tree | 2e59386d821c9e4ab07122f6189d1b8f04658452 /lib/includes/gnutls/gnutls.h.in | |
parent | 5aff47e3dad565172f0268e0b685282f816bd1b9 (diff) | |
download | gnutls-d00638997fa269a975095d852633b48b2b64fbf9.tar.gz |
psk: Allow non-NULL PSK usernames
This commit closes #586.
Two new functions are introduced: gnutls_psk_server_get_username2()
and gnutls_psk_set_client_username2(), which are identical in behavior
to those named similarly (without the final '2'), but allow arbitrary
gnutls datums (not strings) to be used as usernames.
Two new callback functions are also introduced, with their respective
setters: gnutls_psk_set_server_credentials_function2() and
gnutls_psk_set_client_credentials_function2().
In addition, the password file format is extended so that non-string
usernames can be specified. A leading '#' character tells GnuTLS that the
username should be interpreted as a raw byte string (encoded in HEX).
Example:
#deadbeef:9e32cf7786321a828ef7668f09fb35db
Signed-off-by: Ander Juaristi's avatarAnder Juaristi <a@juaristi.eus>
Diffstat (limited to 'lib/includes/gnutls/gnutls.h.in')
-rw-r--r-- | lib/includes/gnutls/gnutls.h.in | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index b0832a9bdd..9fb6afa156 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -2595,6 +2595,10 @@ int gnutls_psk_set_client_credentials(gnutls_psk_client_credentials_t res, const char *username, const gnutls_datum_t * key, gnutls_psk_key_flags flags); +int gnutls_psk_set_client_credentials2(gnutls_psk_client_credentials_t res, + const gnutls_datum_t *username, + const gnutls_datum_t *key, + gnutls_psk_key_flags flags); void gnutls_psk_free_server_credentials(gnutls_psk_server_credentials_t sc); @@ -2609,25 +2613,39 @@ gnutls_psk_set_server_credentials_hint(gnutls_psk_server_credentials_t res, const char *hint); const char *gnutls_psk_server_get_username(gnutls_session_t session); +int gnutls_psk_server_get_username2(gnutls_session_t session, + gnutls_datum_t *out); const char *gnutls_psk_client_get_hint(gnutls_session_t session); typedef int gnutls_psk_server_credentials_function(gnutls_session_t, const char *username, gnutls_datum_t * key); +typedef int gnutls_psk_server_credentials_function2(gnutls_session_t, + const gnutls_datum_t *username, + gnutls_datum_t *key); void gnutls_psk_set_server_credentials_function(gnutls_psk_server_credentials_t cred, gnutls_psk_server_credentials_function * func); +void +gnutls_psk_set_server_credentials_function2(gnutls_psk_server_credentials_t cred, + gnutls_psk_server_credentials_function2 *func); typedef int gnutls_psk_client_credentials_function(gnutls_session_t, char **username, gnutls_datum_t * key); +typedef int gnutls_psk_client_credentials_function2(gnutls_session_t, + gnutls_datum_t *username, + gnutls_datum_t *key); void gnutls_psk_set_client_credentials_function(gnutls_psk_client_credentials_t cred, gnutls_psk_client_credentials_function * func); +void +gnutls_psk_set_client_credentials_function2(gnutls_psk_client_credentials_t cred, + gnutls_psk_client_credentials_function2 *func); int gnutls_hex_encode(const gnutls_datum_t * data, char *result, size_t * result_size); |