support non-NULL-terminated PSKs
This MR introduces two new functions, and two new associated callbacks (for client and server) to accommodate non-NULL-terminated PSK usernames.
-
gnutls_psk_set_client_credentials2()
: Lets the client set its PSK credentials. It's identical tognutls_psk_set_client_credentials()
, but it expects agnutls_datum_t
as the username instead of aconst char *
. -
gnutls_psk_server_get_username2()
: Lets the sever retrieve the peer's PSK username. It's also identical tognutls_psk_server_get_username()
, except that it outputs the username to agnutls_datum_t
.
I also introduce new callback functions as well as new setters for them.
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_function2(gnutls_psk_server_credentials_t cred,
gnutls_psk_server_credentials_function2 *func);
typedef int gnutls_psk_client_credentials_function2(gnutls_session_t,
gnutls_datum_t *username,
gnutls_datum_t *key);
void
gnutls_psk_set_client_credentials_function2(gnutls_psk_client_credentials_t cred,
gnutls_psk_client_credentials_function2 *func);
Checklist
-
Code modified for feature -
Test suite updated with functionality tests -
Test suite updated with negative tests -
Documentation updated / NEWS entry present (for non-trivial changes)
Reviewer's checklist:
-
Any issues marked for closing are addressed -
There is a test suite reasonably covering new functionality or modifications -
Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTION.md
-
This feature/change has adequate documentation added -
No obvious mistakes in the code
Edited by Nikos Mavrogiannopoulos