aboutsummaryrefslogtreecommitdiff
path: root/ssl/ssl_sess.c
diff options
context:
space:
mode:
authorEmilia Kasper <emilia@openssl.org>2016-02-01 15:26:18 +0100
committerEmilia Kasper <emilia@openssl.org>2016-02-01 16:21:57 +0100
commitb69817449315f3818a8472468b3328ea755819db (patch)
treebb2abb48ce582d6d9b8fdc6e216ee0028deff817 /ssl/ssl_sess.c
parent0c787647ded59a81311d905024bc93df5d3a061c (diff)
downloadopenssl-b69817449315f3818a8472468b3328ea755819db.zip
openssl-b69817449315f3818a8472468b3328ea755819db.tar.gz
openssl-b69817449315f3818a8472468b3328ea755819db.tar.bz2
constify PACKET
PACKET contents should be read-only. To achieve this, also - constify two user callbacks - constify BUF_reverse. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/ssl_sess.c')
-rw-r--r--ssl/ssl_sess.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index 1ca0f96..85f6c7f 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -576,13 +576,9 @@ int ssl_get_prev_session(SSL *s, const PACKET *ext, const PACKET *session_id)
if (try_session_cache &&
ret == NULL && s->session_ctx->get_session_cb != NULL) {
int copy = 1;
- /* The user callback takes a non-const pointer, so grab a local copy. */
- unsigned char *sid = NULL;
- size_t sid_len;
- if (!PACKET_memdup(session_id, &sid, &sid_len))
- goto err;
- ret = s->session_ctx->get_session_cb(s, sid, sid_len, &copy);
- OPENSSL_free(sid);
+ ret = s->session_ctx->get_session_cb(s, PACKET_data(session_id),
+ PACKET_remaining(session_id),
+ &copy);
if (ret != NULL) {
s->session_ctx->stats.sess_cb_hit++;
@@ -1158,14 +1154,14 @@ void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (SSL_CTX *ctx,
void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
SSL_SESSION *(*cb) (struct ssl_st *ssl,
- unsigned char *data, int len,
- int *copy))
+ const unsigned char *data,
+ int len, int *copy))
{
ctx->get_session_cb = cb;
}
SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (SSL *ssl,
- unsigned char *data,
+ const unsigned char *data,
int len, int *copy) {
return ctx->get_session_cb;
}