Add a getter for SSL_set_session_id_context.

We have a test somewhere which tries to read off of it. Align the getter
roughly with upstream's SSL_SESSION_get0_id_context (which we don't
currently expose).

BUG=6

Change-Id: Iab240868838ba56c1f08d112888d9536574347b4
Reviewed-on: https://boringssl-review.googlesource.com/12636
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
David Benjamin 2016-12-07 21:13:41 -05:00 committed by CQ bot account: commit-bot@chromium.org
parent 2e839244b0
commit 07820b5cee
2 changed files with 10 additions and 0 deletions

View File

@ -1767,6 +1767,11 @@ OPENSSL_EXPORT int SSL_CTX_set_session_id_context(SSL_CTX *ctx,
OPENSSL_EXPORT int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx,
size_t sid_ctx_len);
/* SSL_get0_session_id_context returns a pointer to |ssl|'s session ID context
* and sets |*out_len| to its length. */
OPENSSL_EXPORT const uint8_t *SSL_get0_session_id_context(const SSL *ssl,
size_t *out_len);
/* SSL_SESSION_CACHE_MAX_SIZE_DEFAULT is the default maximum size of a session
* cache. */
#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024 * 20)

View File

@ -1194,6 +1194,11 @@ int SSL_set_session_id_context(SSL *ssl, const uint8_t *sid_ctx,
return 1;
}
const uint8_t *SSL_get0_session_id_context(const SSL *ssl, size_t *out_len) {
*out_len = ssl->sid_ctx_length;
return ssl->sid_ctx;
}
int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose) {
return X509_VERIFY_PARAM_set_purpose(ctx->param, purpose);
}