diff options
author | jsing <> | 2018-03-19 16:34:47 +0000 |
---|---|---|
committer | jsing <> | 2018-03-19 16:34:47 +0000 |
commit | 5fd38b4657cfd0f2e0b0b92fd650c6710e8fbc8b (patch) | |
tree | a3c296b727ec4d2bb5671d0189458d547b6c3865 /src/lib/libtls/tls_config.c | |
parent | 7dfb474cf3fbbf623463a9b51f61e868a92beb97 (diff) | |
download | openbsd-5fd38b4657cfd0f2e0b0b92fd650c6710e8fbc8b.tar.gz openbsd-5fd38b4657cfd0f2e0b0b92fd650c6710e8fbc8b.tar.bz2 openbsd-5fd38b4657cfd0f2e0b0b92fd650c6710e8fbc8b.zip |
Automatically handle library initialisation for libtls.
Now that we have tls_init() under pthread_once(), automatically initialise
libtls from the entry point functions (tls_config(), tls_client() and
tls_server()) - this makes an explicit tls_init() call no longer a
requirement.
ok bcook@ beck@ inoguchi@
Diffstat (limited to 'src/lib/libtls/tls_config.c')
-rw-r--r-- | src/lib/libtls/tls_config.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/libtls/tls_config.c b/src/lib/libtls/tls_config.c index 2dab4fc7d8..02f2b3c6e9 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.49 2018/02/10 04:57:35 jsing Exp $ */ | 1 | /* $OpenBSD: tls_config.c,v 1.50 2018/03/19 16:34:47 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -77,7 +77,7 @@ tls_config_load_file(struct tls_error *error, const char *filetype, | |||
77 | } | 77 | } |
78 | 78 | ||
79 | struct tls_config * | 79 | struct tls_config * |
80 | tls_config_new(void) | 80 | tls_config_new_internal(void) |
81 | { | 81 | { |
82 | struct tls_config *config; | 82 | struct tls_config *config; |
83 | unsigned char sid[TLS_MAX_SESSION_ID_LENGTH]; | 83 | unsigned char sid[TLS_MAX_SESSION_ID_LENGTH]; |
@@ -128,6 +128,15 @@ tls_config_new(void) | |||
128 | return (NULL); | 128 | return (NULL); |
129 | } | 129 | } |
130 | 130 | ||
131 | struct tls_config * | ||
132 | tls_config_new(void) | ||
133 | { | ||
134 | if (tls_init() == -1) | ||
135 | return (NULL); | ||
136 | |||
137 | return tls_config_new_internal(); | ||
138 | } | ||
139 | |||
131 | void | 140 | void |
132 | tls_config_free(struct tls_config *config) | 141 | tls_config_free(struct tls_config *config) |
133 | { | 142 | { |