summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_internal.h
diff options
context:
space:
mode:
authorjsing <>2016-11-03 10:05:32 +0000
committerjsing <>2016-11-03 10:05:32 +0000
commitc8f23a73c54fa03e5487282a15314fd81bdcef57 (patch)
treebd289b4e8ede05ba1e2074b7be3604ce3c1e12b8 /src/lib/libtls/tls_internal.h
parent05264184755e9ad926b368969ae307f8b4784f6e (diff)
downloadopenbsd-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.h7
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 {
39struct tls_error { 39struct tls_error {
40 char *msg; 40 char *msg;
41 int num; 41 int num;
42 int tls;
42}; 43};
43 44
44struct tls_keypair { 45struct tls_keypair {
@@ -174,6 +175,7 @@ int tls_host_port(const char *hostport, char **host, char **port);
174int tls_set_cbs(struct tls *ctx, 175int 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
178void tls_error_clear(struct tls_error *error);
177int tls_error_set(struct tls_error *error, const char *fmt, ...) 179int 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, ...)
192int tls_set_errorx(struct tls *ctx, const char *fmt, ...) 194int 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)));
197int tls_set_ssl_errorx(struct tls *ctx, const char *fmt, ...)
198 __attribute__((__format__ (printf, 2, 3)))
199 __attribute__((__nonnull__ (2)));
195 200
196int tls_ssl_error(struct tls *ctx, SSL *ssl_conn, int ssl_ret, 201int tls_ssl_error(struct tls *ctx, SSL *ssl_conn, int ssl_ret,
197 const char *prefix); 202 const char *prefix);