about summary refs log tree commit diff
path: root/tls_config.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-04-18 17:54:23 -0400
committerJune McEnroe <june@causal.agency>2021-04-18 17:54:23 -0400
commit3bb2203d08dbddd9356334d350275be577e9fa84 (patch)
treedfc4bf1648d4e0e4d3161267235b1b392e832228 /tls_config.c
parentBump version to 3.3.1p1 (diff)
parentImport LibreSSL 3.3.2 (diff)
downloadlibretls-3bb2203d08dbddd9356334d350275be577e9fa84.tar.gz
libretls-3bb2203d08dbddd9356334d350275be577e9fa84.zip
Merge LibreSSL 3.3.2 into master
Diffstat (limited to '')
-rw-r--r--tls_config.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/tls_config.c b/tls_config.c
index 6c3404c..3b1f4ff 100644
--- a/tls_config.c
+++ b/tls_config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls_config.c,v 1.58 2020/01/20 08:39:21 jsing Exp $ */
+/* $OpenBSD: tls_config.c,v 1.63 2021/01/21 22:03:25 eric Exp $ */
 /*
  * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
  *
@@ -180,6 +180,8 @@ tls_config_free(struct tls_config *config)
 	free((char *)config->crl_mem);
 	free(config->ecdhecurves);
 
+	pthread_mutex_destroy(&config->mutex);
+
 	free(config);
 }
 
@@ -352,7 +354,8 @@ tls_config_add_keypair_file_internal(struct tls_config *config,
 		return (-1);
 	if (tls_keypair_set_cert_file(keypair, &config->error, cert_file) != 0)
 		goto err;
-	if (tls_keypair_set_key_file(keypair, &config->error, key_file) != 0)
+	if (key_file != NULL &&
+	    tls_keypair_set_key_file(keypair, &config->error, key_file) != 0)
 		goto err;
 	if (ocsp_file != NULL &&
 	    tls_keypair_set_ocsp_staple_file(keypair, &config->error,
@@ -379,7 +382,8 @@ tls_config_add_keypair_mem_internal(struct tls_config *config, const uint8_t *ce
 		return (-1);
 	if (tls_keypair_set_cert_mem(keypair, &config->error, cert, cert_len) != 0)
 		goto err;
-	if (tls_keypair_set_key_mem(keypair, &config->error, key, key_len) != 0)
+	if (key != NULL &&
+	    tls_keypair_set_key_mem(keypair, &config->error, key, key_len) != 0)
 		goto err;
 	if (staple != NULL &&
 	    tls_keypair_set_ocsp_staple_mem(keypair, &config->error, staple,
@@ -804,6 +808,13 @@ tls_config_skip_private_key_check(struct tls_config *config)
 	config->skip_private_key_check = 1;
 }
 
+void
+tls_config_use_fake_private_key(struct tls_config *config)
+{
+	config->use_fake_private_key = 1;
+	config->skip_private_key_check = 1;
+}
+
 int
 tls_config_set_ocsp_staple_file(struct tls_config *config, const char *staple_file)
 {