diff options
author | Matt Caswell <matt@openssl.org> | 2017-05-10 11:28:53 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2017-05-10 14:06:58 +0100 |
commit | ea3fc6010f56bad83560592b54bc54de962bbd39 (patch) | |
tree | e791f7f24fced75d38fa8702b502607033503a57 /ssl/t1_ext.c | |
parent | 4ae5993cab1b1c42cfc99180c00ae0a235ce940c (diff) |
Copy custom extension flags in a call to SSL_set_SSL_CTX()
The function SSL_set_SSL_CTX() can be used to swap the SSL_CTX used for
a connection as part of an SNI callback. One result of this is that the
s->cert structure is replaced. However this structure contains information
about any custom extensions that have been loaded. In particular flags are
set indicating whether a particular extension has been received in the
ClientHello. By replacing the s->cert structure we lose the custom
extension flag values, and it appears as if a client has not sent those
extensions.
SSL_set_SSL_CTX() should copy any flags for custom extensions that appear
in both the old and the new cert structure.
Fixes #2180
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3427)
Diffstat (limited to 'ssl/t1_ext.c')
-rw-r--r-- | ssl/t1_ext.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ssl/t1_ext.c b/ssl/t1_ext.c index 89099142e1..0f4aba0226 100644 --- a/ssl/t1_ext.c +++ b/ssl/t1_ext.c @@ -179,6 +179,25 @@ int custom_ext_add(SSL *s, int server, return 1; } +/* Copy the flags from src to dst for any extensions that exist in both */ +int custom_exts_copy_flags(custom_ext_methods *dst, + const custom_ext_methods *src) +{ + size_t i; + custom_ext_method *methsrc = src->meths; + + for (i = 0; i < src->meths_count; i++, methsrc++) { + custom_ext_method *methdst = custom_ext_find(dst, methsrc->ext_type); + + if (methdst == NULL) + continue; + + methdst->ext_flags = methsrc->ext_flags; + } + + return 1; +} + /* Copy table of custom extensions */ int custom_exts_copy(custom_ext_methods *dst, const custom_ext_methods *src) { |