summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2017-01-12 16:01:47 +0000
committerjsing <jsing@openbsd.org>2017-01-12 16:01:47 +0000
commitb332f924d251e0ca52a83b3f11949a05a3b19e1e (patch)
tree1bbebc5ccf8cde252b50b7b5df043578f0dda8f4
parentIf no callbacks are specified, return after setting an error rather than (diff)
downloadwireguard-openbsd-b332f924d251e0ca52a83b3f11949a05a3b19e1e.tar.xz
wireguard-openbsd-b332f924d251e0ca52a83b3f11949a05a3b19e1e.zip
If tls_get_new_cb_bio() fails, an error will already be set.
-rw-r--r--lib/libtls/tls_bio_cb.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libtls/tls_bio_cb.c b/lib/libtls/tls_bio_cb.c
index 813d98d9908..f53039fa009 100644
--- a/lib/libtls/tls_bio_cb.c
+++ b/lib/libtls/tls_bio_cb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls_bio_cb.c,v 1.15 2017/01/12 15:58:56 jsing Exp $ */
+/* $OpenBSD: tls_bio_cb.c,v 1.16 2017/01/12 16:01:47 jsing Exp $ */
/*
* Copyright (c) 2016 Tobias Pape <tobias@netshed.de>
*
@@ -180,7 +180,6 @@ tls_get_new_cb_bio(struct tls *ctx)
tls_set_errorx(ctx, "no callbacks registered");
return (NULL);
}
-
if ((bio = BIO_new(bio_s_cb())) == NULL) {
tls_set_errorx(ctx, "failed to create callback i/o");
return (NULL);
@@ -205,10 +204,8 @@ tls_set_cbs(struct tls *ctx, tls_read_cb read_cb, tls_write_cb write_cb,
ctx->write_cb = write_cb;
ctx->cb_arg = cb_arg;
- if ((bio = tls_get_new_cb_bio(ctx)) == NULL) {
- tls_set_errorx(ctx, "failed to create callback i/o");
+ if ((bio = tls_get_new_cb_bio(ctx)) == NULL)
goto err;
- }
SSL_set_bio(ctx->ssl_conn, bio, bio);