summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/ssl/t1_ext.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2017-11-02 18:22:53 +0000
committerRenato Botelho <renato@netgate.com>2017-11-13 15:16:55 -0200
commit70ee3cb33663d3f5f9666994a129f8053d8ef7b5 (patch)
tree622e34c471af49c2ed2b412e8f90a73425e52c21 /crypto/openssl/ssl/t1_ext.c
parent070f0aeb25ca4395acfc08a994071db3318c3c96 (diff)
downloadFreeBSD-src-70ee3cb33663d3f5f9666994a129f8053d8ef7b5.zip
FreeBSD-src-70ee3cb33663d3f5f9666994a129f8053d8ef7b5.tar.gz
MFC: r318899
Merge OpenSSL 1.0.2l. (cherry picked from commit ffd1bb8c599181e0733f8e00d8d8198b4ea6a73b)
Diffstat (limited to 'crypto/openssl/ssl/t1_ext.c')
-rw-r--r--crypto/openssl/ssl/t1_ext.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/crypto/openssl/ssl/t1_ext.c b/crypto/openssl/ssl/t1_ext.c
index 79ed946..0f4aba0 100644
--- a/crypto/openssl/ssl/t1_ext.c
+++ b/crypto/openssl/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)
{
@@ -223,16 +242,14 @@ static int custom_ext_meth_add(custom_ext_methods *exts,
/* Search for duplicate */
if (custom_ext_find(exts, ext_type))
return 0;
- exts->meths = OPENSSL_realloc(exts->meths,
- (exts->meths_count +
- 1) * sizeof(custom_ext_method));
-
- if (!exts->meths) {
- exts->meths_count = 0;
+ meth = OPENSSL_realloc(exts->meths,
+ (exts->meths_count + 1)
+ * sizeof(custom_ext_method));
+ if (meth == NULL)
return 0;
- }
- meth = exts->meths + exts->meths_count;
+ exts->meths = meth;
+ meth += exts->meths_count;
memset(meth, 0, sizeof(custom_ext_method));
meth->parse_cb = parse_cb;
meth->add_cb = add_cb;
OpenPOWER on IntegriCloud