diff options
author | Emilia Kasper <emilia@openssl.org> | 2016-02-01 15:26:18 +0100 |
---|---|---|
committer | Emilia Kasper <emilia@openssl.org> | 2016-02-01 16:21:57 +0100 |
commit | b69817449315f3818a8472468b3328ea755819db (patch) | |
tree | bb2abb48ce582d6d9b8fdc6e216ee0028deff817 /ssl/ssl_sess.c | |
parent | 0c787647ded59a81311d905024bc93df5d3a061c (diff) |
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.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index 1ca0f964a2..85f6c7ff67 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, ©); - OPENSSL_free(sid); + ret = s->session_ctx->get_session_cb(s, PACKET_data(session_id), + PACKET_remaining(session_id), + ©); 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; } |