diff options
author | Matt Caswell <matt@openssl.org> | 2017-01-19 15:01:55 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2017-01-30 10:18:22 +0000 |
commit | 534a43ffeaec03e50768ccf84d431f96f11256e3 (patch) | |
tree | b13507098f77003ce9bbb64955ec8b0b38918462 /ssl/ssl_asn1.c | |
parent | 4086b42b2d58773bee8463f69eee4bf8c299b589 (diff) |
Always ensure that session->cipher is set
If we have deserialized the SSL_SESSION then in some circumstances the
session->cipher value is NULL. We were patching up in some places but not
in others. We should just do it as part of loading the SSL_SESSION.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2259)
Diffstat (limited to 'ssl/ssl_asn1.c')
-rw-r--r-- | ssl/ssl_asn1.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c index ced6a51f4b..568f41ff5b 100644 --- a/ssl/ssl_asn1.c +++ b/ssl/ssl_asn1.c @@ -284,8 +284,10 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, p = as->cipher->data; id = 0x03000000L | ((unsigned long)p[0] << 8L) | (unsigned long)p[1]; - ret->cipher = NULL; ret->cipher_id = id; + ret->cipher = ssl3_get_cipher_by_id(id); + if (ret->cipher == NULL) + goto err; if (!ssl_session_memcpy(ret->session_id, &ret->session_id_length, as->session_id, SSL3_MAX_SSL_SESSION_ID_LENGTH)) |