summaryrefslogtreecommitdiffstats
path: root/lib/libssl/tls13_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2020-01-22 06:23:00 +0000
committerjsing <jsing@openbsd.org>2020-01-22 06:23:00 +0000
commit373302c0630d78dc697e7a89729e7e6b28d16512 (patch)
treebeb7d22c5e15a9fefda7eccf73f4da2e61c794a5 /lib/libssl/tls13_lib.c
parentThe Pinebook Pro's u-boot seems to add a zero-length framebuffer (diff)
downloadwireguard-openbsd-373302c0630d78dc697e7a89729e7e6b28d16512.tar.xz
wireguard-openbsd-373302c0630d78dc697e7a89729e7e6b28d16512.zip
Implement support for SSL_peek() in the TLSv1.3 record layer.
ok beck@ tb@
Diffstat (limited to 'lib/libssl/tls13_lib.c')
-rw-r--r--lib/libssl/tls13_lib.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/libssl/tls13_lib.c b/lib/libssl/tls13_lib.c
index d92d3cb8b69..73d936ac3f0 100644
--- a/lib/libssl/tls13_lib.c
+++ b/lib/libssl/tls13_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_lib.c,v 1.19 2020/01/22 03:15:43 beck Exp $ */
+/* $OpenBSD: tls13_lib.c,v 1.20 2020/01/22 06:23:00 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2019 Bob Beck <beck@openbsd.org>
@@ -412,12 +412,6 @@ tls13_legacy_read_bytes(SSL *ssl, int type, unsigned char *buf, int len, int pee
return tls13_legacy_return_code(ssl, TLS13_IO_WANT_POLLIN);
}
- if (peek) {
- /* XXX - support peek... */
- SSLerror(ssl, ERR_R_INTERNAL_ERROR);
- return -1;
- }
-
if (type != SSL3_RT_APPLICATION_DATA) {
SSLerror(ssl, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return -1;
@@ -427,7 +421,11 @@ tls13_legacy_read_bytes(SSL *ssl, int type, unsigned char *buf, int len, int pee
return -1;
}
- ret = tls13_read_application_data(ctx->rl, buf, len);
+ if (peek)
+ ret = tls13_peek_application_data(ctx->rl, buf, len);
+ else
+ ret = tls13_read_application_data(ctx->rl, buf, len);
+
return tls13_legacy_return_code(ssl, ret);
}