diff options
author | jsing <> | 2016-11-03 10:05:32 +0000 |
---|---|---|
committer | jsing <> | 2016-11-03 10:05:32 +0000 |
commit | c8f23a73c54fa03e5487282a15314fd81bdcef57 (patch) | |
tree | bd289b4e8ede05ba1e2074b7be3604ce3c1e12b8 /src/lib/libtls/tls_internal.h | |
parent | 05264184755e9ad926b368969ae307f8b4784f6e (diff) | |
download | openbsd-c8f23a73c54fa03e5487282a15314fd81bdcef57.tar.gz openbsd-c8f23a73c54fa03e5487282a15314fd81bdcef57.tar.bz2 openbsd-c8f23a73c54fa03e5487282a15314fd81bdcef57.zip |
Only set an error from libssl related code, if an error has not already
been set by libtls code. This avoids the situation where a libtls callback
has set an error, only to have it replaced by a less useful libssl based
error.
ok beck@
Diffstat (limited to 'src/lib/libtls/tls_internal.h')
-rw-r--r-- | src/lib/libtls/tls_internal.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_internal.h b/src/lib/libtls/tls_internal.h index df35db37f2..fde4066f7c 100644 --- a/src/lib/libtls/tls_internal.h +++ b/src/lib/libtls/tls_internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_internal.h,v 1.44 2016/11/02 15:18:42 beck Exp $ */ | 1 | /* $OpenBSD: tls_internal.h,v 1.45 2016/11/03 10:05:32 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> | 3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> |
4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
@@ -39,6 +39,7 @@ union tls_addr { | |||
39 | struct tls_error { | 39 | struct tls_error { |
40 | char *msg; | 40 | char *msg; |
41 | int num; | 41 | int num; |
42 | int tls; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | struct tls_keypair { | 45 | struct tls_keypair { |
@@ -174,6 +175,7 @@ int tls_host_port(const char *hostport, char **host, char **port); | |||
174 | int tls_set_cbs(struct tls *ctx, | 175 | int tls_set_cbs(struct tls *ctx, |
175 | tls_read_cb read_cb, tls_write_cb write_cb, void *cb_arg); | 176 | tls_read_cb read_cb, tls_write_cb write_cb, void *cb_arg); |
176 | 177 | ||
178 | void tls_error_clear(struct tls_error *error); | ||
177 | int tls_error_set(struct tls_error *error, const char *fmt, ...) | 179 | int tls_error_set(struct tls_error *error, const char *fmt, ...) |
178 | __attribute__((__format__ (printf, 2, 3))) | 180 | __attribute__((__format__ (printf, 2, 3))) |
179 | __attribute__((__nonnull__ (2))); | 181 | __attribute__((__nonnull__ (2))); |
@@ -192,6 +194,9 @@ int tls_set_error(struct tls *ctx, const char *fmt, ...) | |||
192 | int tls_set_errorx(struct tls *ctx, const char *fmt, ...) | 194 | int tls_set_errorx(struct tls *ctx, const char *fmt, ...) |
193 | __attribute__((__format__ (printf, 2, 3))) | 195 | __attribute__((__format__ (printf, 2, 3))) |
194 | __attribute__((__nonnull__ (2))); | 196 | __attribute__((__nonnull__ (2))); |
197 | int tls_set_ssl_errorx(struct tls *ctx, const char *fmt, ...) | ||
198 | __attribute__((__format__ (printf, 2, 3))) | ||
199 | __attribute__((__nonnull__ (2))); | ||
195 | 200 | ||
196 | int tls_ssl_error(struct tls *ctx, SSL *ssl_conn, int ssl_ret, | 201 | int tls_ssl_error(struct tls *ctx, SSL *ssl_conn, int ssl_ret, |
197 | const char *prefix); | 202 | const char *prefix); |