summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_cert.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2014-08-10 12:08:08 +0100
committerDr. Stephen Henson <steve@openssl.org>2014-08-28 18:09:05 +0100
commit0a4fe37fc6248e5efadcda34015eff122e01b1db (patch)
treeecc261ba3f2b21e6de4fb984535403c6668c0a3f /ssl/ssl_cert.c
parentda67a0ae3462f6c6447ed841a9ec514077244b02 (diff)
Custom extension revision.
Use the same structure for client and server custom extensions. Add utility functions in new file t1_ext.c. Use new utility functions to handle custom server and client extensions and remove a lot of code duplication. Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit ecf4d660902dcef6e0afc51d52926f00d409ee6b) Conflicts: ssl/ssl_lib.c ssl/ssl_locl.h ssl/t1_lib.c
Diffstat (limited to 'ssl/ssl_cert.c')
-rw-r--r--ssl/ssl_cert.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index f0035d768d..b5098eb996 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -435,24 +435,10 @@ CERT *ssl_cert_dup(CERT *cert)
ret->ciphers_raw = NULL;
#ifndef OPENSSL_NO_TLSEXT
- if (cert->custom_cli_ext_records_count)
- {
- ret->custom_cli_ext_records = BUF_memdup(cert->custom_cli_ext_records, sizeof(custom_cli_ext_record) * cert->custom_cli_ext_records_count);
- if (ret->custom_cli_ext_records == NULL)
- goto err;
- ret->custom_cli_ext_records_count =
- cert->custom_cli_ext_records_count;
- }
-
- if (cert->custom_srv_ext_records_count)
- {
- ret->custom_srv_ext_records = BUF_memdup(cert->custom_srv_ext_records, sizeof(custom_srv_ext_record) * cert->custom_srv_ext_records_count);
- if (ret->custom_srv_ext_records == NULL)
- goto err;
- ret->custom_srv_ext_records_count =
- cert->custom_srv_ext_records_count;
- }
-
+ if (!custom_exts_copy(&ret->cli_ext, &cert->cli_ext))
+ goto err;
+ if (!custom_exts_copy(&ret->srv_ext, &cert->srv_ext))
+ goto err;
#endif
return(ret);
@@ -474,10 +460,8 @@ err:
#endif
#ifndef OPENSSL_NO_TLSEXT
- if (ret->custom_cli_ext_records)
- OPENSSL_free(ret->custom_cli_ext_records);
- if (ret->custom_srv_ext_records)
- OPENSSL_free(ret->custom_srv_ext_records);
+ custom_exts_free(&ret->cli_ext);
+ custom_exts_free(&ret->srv_ext);
#endif
ssl_cert_clear_certs(ret);
@@ -571,10 +555,8 @@ void ssl_cert_free(CERT *c)
if (c->ciphers_raw)
OPENSSL_free(c->ciphers_raw);
#ifndef OPENSSL_NO_TLSEXT
- if (c->custom_cli_ext_records)
- OPENSSL_free(c->custom_cli_ext_records);
- if (c->custom_srv_ext_records)
- OPENSSL_free(c->custom_srv_ext_records);
+ custom_exts_free(&c->cli_ext);
+ custom_exts_free(&c->srv_ext);
#endif
OPENSSL_free(c);
}