diff options
author | reyk <> | 2015-01-22 09:16:24 +0000 |
---|---|---|
committer | reyk <> | 2015-01-22 09:16:24 +0000 |
commit | 138944aeef27fb00df60db6f46ef653726b4ca5a (patch) | |
tree | 0cd70582ac032f525e31a6921611469898b556c3 /src/lib/libtls/tls_config.c | |
parent | d0ef2b563d4291f81a8f9ed7cd02bdfbaa8cc5f4 (diff) | |
download | openbsd-138944aeef27fb00df60db6f46ef653726b4ca5a.tar.gz openbsd-138944aeef27fb00df60db6f46ef653726b4ca5a.tar.bz2 openbsd-138944aeef27fb00df60db6f46ef653726b4ca5a.zip |
Allow to to load the CA chain directly from memory instead of
specifying a file. This enables CA verification in privsep'ed
processes that are running chroot'ed without direct access to the
certificate files.
With feedback, tests, and OK from bluhm@
Diffstat (limited to 'src/lib/libtls/tls_config.c')
-rw-r--r-- | src/lib/libtls/tls_config.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_config.c b/src/lib/libtls/tls_config.c index 0e435f616a..16120c5e4e 100644 --- a/src/lib/libtls/tls_config.c +++ b/src/lib/libtls/tls_config.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_config.c,v 1.1 2014/10/31 13:46:17 jsing Exp $ */ | 1 | /* $OpenBSD: tls_config.c,v 1.2 2015/01/22 09:16:24 reyk Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -102,6 +102,7 @@ tls_config_free(struct tls_config *config) | |||
102 | void | 102 | void |
103 | tls_config_clear_keys(struct tls_config *config) | 103 | tls_config_clear_keys(struct tls_config *config) |
104 | { | 104 | { |
105 | tls_config_set_ca_mem(config, NULL, 0); | ||
105 | tls_config_set_cert_mem(config, NULL, 0); | 106 | tls_config_set_cert_mem(config, NULL, 0); |
106 | tls_config_set_key_mem(config, NULL, 0); | 107 | tls_config_set_key_mem(config, NULL, 0); |
107 | } | 108 | } |
@@ -119,6 +120,12 @@ tls_config_set_ca_path(struct tls_config *config, const char *ca_path) | |||
119 | } | 120 | } |
120 | 121 | ||
121 | int | 122 | int |
123 | tls_config_set_ca_mem(struct tls_config *config, const uint8_t *ca, size_t len) | ||
124 | { | ||
125 | return set_mem(&config->ca_mem, &config->ca_len, ca, len); | ||
126 | } | ||
127 | |||
128 | int | ||
122 | tls_config_set_cert_file(struct tls_config *config, const char *cert_file) | 129 | tls_config_set_cert_file(struct tls_config *config, const char *cert_file) |
123 | { | 130 | { |
124 | return set_string(&config->cert_file, cert_file); | 131 | return set_string(&config->cert_file, cert_file); |