Add SSL_SESSION_set1_master_key()

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3670)
This commit is contained in:
Matt Caswell 2017-06-12 18:38:30 +01:00
parent df894947c4
commit 911d63f261
3 changed files with 16 additions and 0 deletions

View file

@ -1861,6 +1861,8 @@ __owur size_t SSL_get_server_random(const SSL *ssl, unsigned char *out,
size_t outlen);
__owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *ssl,
unsigned char *out, size_t outlen);
__owur int SSL_SESSION_set1_master_key(SSL_SESSION *sess, unsigned char *in,
size_t len);
#define SSL_get_ex_new_index(l, p, newf, dupf, freef) \
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef)

View file

@ -3725,6 +3725,19 @@ size_t SSL_SESSION_get_master_key(const SSL_SESSION *session,
return outlen;
}
int SSL_SESSION_set1_master_key(SSL_SESSION *sess, unsigned char *in,
size_t len)
{
if (len > sizeof(sess->master_key))
return 0;
memcpy(sess->master_key, in, len);
sess->master_key_length = len;
return 1;
}
int SSL_set_ex_data(SSL *s, int idx, void *arg)
{
return (CRYPTO_set_ex_data(&s->ex_data, idx, arg));

View file

@ -456,3 +456,4 @@ SSL_set_psk_use_session_callback 456 1_1_1 EXIST::FUNCTION:
SSL_CTX_set_psk_use_session_callback 457 1_1_1 EXIST::FUNCTION:
SSL_CTX_set_psk_find_session_callback 458 1_1_1 EXIST::FUNCTION:
SSL_CIPHER_get_handshake_digest 459 1_1_1 EXIST::FUNCTION:
SSL_SESSION_set1_master_key 460 1_1_1 EXIST::FUNCTION: