summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls13_lib.c
diff options
context:
space:
mode:
authorjsing <>2020-01-22 06:23:00 +0000
committerjsing <>2020-01-22 06:23:00 +0000
commit9e9db88c593e9fe3ec46a015b783a8903db297c3 (patch)
treeb500b4cd4fbfdaf1e52f3a0b754eb1e97bd5f92f /src/lib/libssl/tls13_lib.c
parent0cbc880fa36f08c10caa253c5b025333c684fa2f (diff)
downloadopenbsd-9e9db88c593e9fe3ec46a015b783a8903db297c3.tar.gz
openbsd-9e9db88c593e9fe3ec46a015b783a8903db297c3.tar.bz2
openbsd-9e9db88c593e9fe3ec46a015b783a8903db297c3.zip
Implement support for SSL_peek() in the TLSv1.3 record layer.
ok beck@ tb@
Diffstat (limited to 'src/lib/libssl/tls13_lib.c')
-rw-r--r--src/lib/libssl/tls13_lib.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c
index d92d3cb8b6..73d936ac3f 100644
--- a/src/lib/libssl/tls13_lib.c
+++ b/src/lib/libssl/tls13_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_lib.c,v 1.19 2020/01/22 03:15:43 beck Exp $ */ 1/* $OpenBSD: tls13_lib.c,v 1.20 2020/01/22 06:23:00 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2019 Bob Beck <beck@openbsd.org> 4 * 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
412 return tls13_legacy_return_code(ssl, TLS13_IO_WANT_POLLIN); 412 return tls13_legacy_return_code(ssl, TLS13_IO_WANT_POLLIN);
413 } 413 }
414 414
415 if (peek) {
416 /* XXX - support peek... */
417 SSLerror(ssl, ERR_R_INTERNAL_ERROR);
418 return -1;
419 }
420
421 if (type != SSL3_RT_APPLICATION_DATA) { 415 if (type != SSL3_RT_APPLICATION_DATA) {
422 SSLerror(ssl, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 416 SSLerror(ssl, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
423 return -1; 417 return -1;
@@ -427,7 +421,11 @@ tls13_legacy_read_bytes(SSL *ssl, int type, unsigned char *buf, int len, int pee
427 return -1; 421 return -1;
428 } 422 }
429 423
430 ret = tls13_read_application_data(ctx->rl, buf, len); 424 if (peek)
425 ret = tls13_peek_application_data(ctx->rl, buf, len);
426 else
427 ret = tls13_read_application_data(ctx->rl, buf, len);
428
431 return tls13_legacy_return_code(ssl, ret); 429 return tls13_legacy_return_code(ssl, ret);
432} 430}
433 431