diff options
author | Matt Caswell <matt@openssl.org> | 2017-04-05 11:59:23 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2017-04-07 13:41:04 +0100 |
commit | 43ae5eed6f8665b88f45445df666ab2688aae7b0 (patch) | |
tree | 33413025b37f6fb6f4d406591c9fbbb066702d1b /ssl/ssl_rsa.c | |
parent | fe874d27d33faa527b5e945137787bf6b0f5c253 (diff) | |
download | openssl-43ae5eed6f8665b88f45445df666ab2688aae7b0.zip openssl-43ae5eed6f8665b88f45445df666ab2688aae7b0.tar.gz openssl-43ae5eed6f8665b88f45445df666ab2688aae7b0.tar.bz2 |
Implement a new custom extensions API
The old custom extensions API was not TLSv1.3 aware. Extensions are used
extensively in TLSv1.3 and they can appear in many different types of
messages. Therefore we need a new API to be able to cope with that.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3139)
Diffstat (limited to 'ssl/ssl_rsa.c')
-rw-r--r-- | ssl/ssl_rsa.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/ssl/ssl_rsa.c b/ssl/ssl_rsa.c index a94fb13..ecf2ff3 100644 --- a/ssl/ssl_rsa.c +++ b/ssl/ssl_rsa.c @@ -797,26 +797,15 @@ static int serverinfo_process_buffer(const unsigned char *serverinfo, /* Register callbacks for extensions */ ext_type = (serverinfo[0] << 8) + serverinfo[1]; - if (ctx) { - int have_ext_cbs = 0; - size_t i; - custom_ext_methods *exts = &ctx->cert->srv_ext; - custom_ext_method *meth = exts->meths; - - for (i = 0; i < exts->meths_count; i++, meth++) { - if (ext_type == meth->ext_type) { - have_ext_cbs = 1; - break; - } - } - - if (!have_ext_cbs && !SSL_CTX_add_server_custom_ext(ctx, ext_type, - serverinfo_srv_add_cb, - NULL, NULL, - serverinfo_srv_parse_cb, - NULL)) - return 0; - } + if (ctx != NULL + && custom_ext_find(&ctx->cert->custext, 1, ext_type, NULL) + == NULL + && !SSL_CTX_add_server_custom_ext(ctx, ext_type, + serverinfo_srv_add_cb, + NULL, NULL, + serverinfo_srv_parse_cb, + NULL)) + return 0; serverinfo += 2; serverinfo_length -= 2; |