diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-02-12 19:43:30 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-02-12 19:43:30 +0100 |
commit | 01c02691cfe16ad8c46e1186048e32ca3d5dc44f (patch) | |
tree | 8166d9bd847412fdb7dd57414f49f1c81b631820 /lib/gnutls_state.c | |
parent | 0dc634395d61b72483c13a896fdb5e82bc84821e (diff) | |
download | gnutls-01c02691cfe16ad8c46e1186048e32ca3d5dc44f.tar.gz |
Added gnutls_handshake_set_server_random
Diffstat (limited to 'lib/gnutls_state.c')
-rw-r--r-- | lib/gnutls_state.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index 40a3ff0ec2..1145d6b4df 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -1426,3 +1426,34 @@ timespec_sub_ms (struct timespec *a, struct timespec *b) return (a->tv_sec * 1000 + a->tv_nsec / (1000 * 1000) - (b->tv_sec * 1000 + b->tv_nsec / (1000 * 1000))); } + +/** + * gnutls_handshake_set_server_random: + * @session: is a #gnutls_session_t structure. + * @random: a random value of 32-bytes + * + * This function will explicitly set the server hello random value + * in the subsequent TLS handshake. The random value should be + * a 32-byte value. + * + * Note that this function should not normally be used as gnutls + * will select automatically a random value for the handshake. + * + * This function should not be used when resuming a session. + * + * Returns: %GNUTLS_E_SUCCESS on success, or an error code. + * + * Since 3.1.9 + **/ +int +gnutls_handshake_set_server_random (gnutls_session_t session, gnutls_datum_t* random) +{ + if (random->size != GNUTLS_RANDOM_SIZE) + return GNUTLS_E_INVALID_REQUEST; + + session->internals.server_random_set = 1; + memcpy(session->internals.resumed_security_parameters.server_random, random->data, random->size); + + return 0; +} + |