/* tlsv1_server_get_keys - Get master key and random data from TLS connection @conn: TLSv1 server connection data from tlsv1_server_init() @keys: Structure of key/random data (filled on success) Returns: 0 on success, -1 on failure  */
int tlsv1_server_get_keys(struct tlsv1_server *conn, struct tls_keys *keys)
/* tlsv1_server_get_keys - Get master key and random data from TLS connection @conn: TLSv1 server connection data from tlsv1_server_init() @keys: Structure of key/random data (filled on success) Returns: 0 on success, -1 on failure  */
int tlsv1_server_get_keys(struct tlsv1_server *conn, struct tls_keys *keys)
{
	os_memset(keys, 0, sizeof(*keys));
	if (conn->state == CLIENT_HELLO)
		return -1;
	keys->client_random = conn->client_random;
	keys->client_random_len = TLS_RANDOM_LEN;
	if (conn->state != SERVER_HELLO) {
		keys->server_random = conn->server_random;
		keys->server_random_len = TLS_RANDOM_LEN;
		keys->master_key = conn->master_secret;
		keys->master_key_len = TLS_MASTER_SECRET_LEN;
	}
	return 0;
}