summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorRemi Gacogne <rgacogne-github@coredump.fr>2016-08-06 12:54:29 +0200
committerMatt Caswell <matt@openssl.org>2016-08-17 10:38:20 +0100
commitfddfc0afc84728f8a5140685163e66ce6471742d (patch)
treeb05067c6ca0c4edd19affd7476fd5e04cee451b8 /ssl
parent46117d31fe420124dd07f8f16d7a76fecc290980 (diff)
Add missing session id and tlsext_status accessors
* SSL_SESSION_set1_id() * SSL_SESSION_get0_id_context() * SSL_CTX_get_tlsext_status_cb() * SSL_CTX_get_tlsext_status_arg() Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'ssl')
-rw-r--r--ssl/s3_lib.c8
-rw-r--r--ssl/ssl_err.c3
-rw-r--r--ssl/ssl_sess.c20
3 files changed, 31 insertions, 0 deletions
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index eea75a3c5d..81d21f2b68 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -3340,6 +3340,14 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
ctx->tlsext_status_arg = parg;
return 1;
+ case SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG:
+ *(void**)parg = ctx->tlsext_status_arg;
+ break;
+
+ case SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB:
+ *(int (**)(SSL*, void*))parg = ctx->tlsext_status_cb;
+ break;
+
#ifndef OPENSSL_NO_SRP
case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME:
ctx->srp_ctx.srp_Mask |= SSL_kSRP;
diff --git a/ssl/ssl_err.c b/ssl/ssl_err.c
index f573633ac6..9644fd2466 100644
--- a/ssl/ssl_err.c
+++ b/ssl/ssl_err.c
@@ -182,6 +182,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
{ERR_FUNC(SSL_F_SSL_SESSION_DUP), "ssl_session_dup"},
{ERR_FUNC(SSL_F_SSL_SESSION_NEW), "SSL_SESSION_new"},
{ERR_FUNC(SSL_F_SSL_SESSION_PRINT_FP), "SSL_SESSION_print_fp"},
+ {ERR_FUNC(SSL_F_SSL_SESSION_SET1_ID), "SSL_SESSION_set1_id"},
{ERR_FUNC(SSL_F_SSL_SESSION_SET1_ID_CONTEXT),
"SSL_SESSION_set1_id_context"},
{ERR_FUNC(SSL_F_SSL_SET_ALPN_PROTOS), "SSL_set_alpn_protos"},
@@ -564,6 +565,8 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
{ERR_REASON(SSL_R_SSL_SESSION_ID_CONFLICT), "ssl session id conflict"},
{ERR_REASON(SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG),
"ssl session id context too long"},
+ {ERR_REASON(SSL_R_SSL_SESSION_ID_TOO_LONG),
+ "ssl session id too long"},
{ERR_REASON(SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH),
"ssl session id has bad length"},
{ERR_REASON(SSL_R_SSL_SESSION_VERSION_MISMATCH),
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index 1a2872c6e0..509175b1ab 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -240,6 +240,13 @@ const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,
*len = s->session_id_length;
return s->session_id;
}
+const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s,
+ unsigned int *len)
+{
+ if (len != NULL)
+ *len = s->sid_ctx_length;
+ return s->sid_ctx;
+}
unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s)
{
@@ -792,6 +799,19 @@ int SSL_set_session(SSL *s, SSL_SESSION *session)
return 1;
}
+int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid,
+ unsigned int sid_len)
+{
+ if (sid_len > SSL_MAX_SSL_SESSION_ID_LENGTH) {
+ SSLerr(SSL_F_SSL_SESSION_SET1_ID,
+ SSL_R_SSL_SESSION_ID_TOO_LONG);
+ return 0;
+ }
+ s->session_id_length = sid_len;
+ memcpy(s->session_id, sid, sid_len);
+ return 1;
+}
+
long SSL_SESSION_set_timeout(SSL_SESSION *s, long t)
{
if (s == NULL)