summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2020-01-22 13:10:51 +0000
committerjsing <>2020-01-22 13:10:51 +0000
commit7655835d7e1b8fa812246e1e652a1747a4f67b32 (patch)
tree80ca1bcd2a0b8b6d5658a3b4bbec080ceced53e3
parente53889cb5c5ff4e8801ca99623f6e16491f94358 (diff)
downloadopenbsd-7655835d7e1b8fa812246e1e652a1747a4f67b32.tar.gz
openbsd-7655835d7e1b8fa812246e1e652a1747a4f67b32.tar.bz2
openbsd-7655835d7e1b8fa812246e1e652a1747a4f67b32.zip
Pass a handshake message content CBS to TLSv1.3 receive handlers.
This avoids every receive handler from having to get the handshake message content itself. Additionally, pull the trailing data check up so that each receive handler does not have to implement it. This makes the code more readable and reduces duplication. ok beck@ tb@
-rw-r--r--src/lib/libssl/tls13_client.c81
-rw-r--r--src/lib/libssl/tls13_handshake.c22
-rw-r--r--src/lib/libssl/tls13_internal.h31
-rw-r--r--src/lib/libssl/tls13_lib.c5
-rw-r--r--src/lib/libssl/tls13_server.c16
5 files changed, 70 insertions, 85 deletions
diff --git a/src/lib/libssl/tls13_client.c b/src/lib/libssl/tls13_client.c
index 3648d09b22..4ec5e58f02 100644
--- a/src/lib/libssl/tls13_client.c
+++ b/src/lib/libssl/tls13_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_client.c,v 1.27 2020/01/22 11:26:47 beck Exp $ */ 1/* $OpenBSD: tls13_client.c,v 1.28 2020/01/22 13:10:51 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 * 4 *
@@ -288,17 +288,17 @@ tls13_server_hello_process(struct tls13_ctx *ctx, CBS *cbs)
288 if (!CBS_get_u8(cbs, &compression_method)) 288 if (!CBS_get_u8(cbs, &compression_method))
289 goto err; 289 goto err;
290 290
291 if (tls13_server_hello_is_legacy(cbs)) 291 if (tls13_server_hello_is_legacy(cbs)) {
292 if (!CBS_skip(cbs, CBS_len(cbs)))
293 goto err;
292 return tls13_use_legacy_client(ctx); 294 return tls13_use_legacy_client(ctx);
295 }
293 296
294 if (!tlsext_client_parse(s, cbs, &alert_desc, SSL_TLSEXT_MSG_SH)) { 297 if (!tlsext_client_parse(s, cbs, &alert_desc, SSL_TLSEXT_MSG_SH)) {
295 ctx->alert = alert_desc; 298 ctx->alert = alert_desc;
296 goto err; 299 goto err;
297 } 300 }
298 301
299 if (CBS_len(cbs) != 0)
300 goto err;
301
302 /* 302 /*
303 * See if a supported versions extension was returned. If it was then 303 * See if a supported versions extension was returned. If it was then
304 * the legacy version must be set to 0x0303 (RFC 8446 section 4.1.3). 304 * the legacy version must be set to 0x0303 (RFC 8446 section 4.1.3).
@@ -359,7 +359,7 @@ tls13_server_hello_process(struct tls13_ctx *ctx, CBS *cbs)
359} 359}
360 360
361int 361int
362tls13_server_hello_recv(struct tls13_ctx *ctx) 362tls13_server_hello_recv(struct tls13_ctx *ctx, CBS *cbs)
363{ 363{
364 struct tls13_secrets *secrets; 364 struct tls13_secrets *secrets;
365 struct tls13_secret context; 365 struct tls13_secret context;
@@ -368,12 +368,8 @@ tls13_server_hello_recv(struct tls13_ctx *ctx)
368 size_t hash_len; 368 size_t hash_len;
369 SSL *s = ctx->ssl; 369 SSL *s = ctx->ssl;
370 int ret = 0; 370 int ret = 0;
371 CBS cbs;
372
373 if (!tls13_handshake_msg_content(ctx->hs_msg, &cbs))
374 goto err;
375 371
376 if (!tls13_server_hello_process(ctx, &cbs)) 372 if (!tls13_server_hello_process(ctx, cbs))
377 goto err; 373 goto err;
378 374
379 /* See if we switched back to the legacy client method. */ 375 /* See if we switched back to the legacy client method. */
@@ -440,22 +436,15 @@ tls13_server_hello_recv(struct tls13_ctx *ctx)
440} 436}
441 437
442int 438int
443tls13_server_encrypted_extensions_recv(struct tls13_ctx *ctx) 439tls13_server_encrypted_extensions_recv(struct tls13_ctx *ctx, CBS *cbs)
444{ 440{
445 CBS cbs;
446 int alert_desc; 441 int alert_desc;
447 442
448 if (!tls13_handshake_msg_content(ctx->hs_msg, &cbs)) 443 if (!tlsext_client_parse(ctx->ssl, cbs, &alert_desc, SSL_TLSEXT_MSG_EE)) {
449 goto err;
450
451 if (!tlsext_client_parse(ctx->ssl, &cbs, &alert_desc, SSL_TLSEXT_MSG_EE)) {
452 ctx->alert = alert_desc; 444 ctx->alert = alert_desc;
453 goto err; 445 goto err;
454 } 446 }
455 447
456 if (CBS_len(&cbs) != 0)
457 goto err;
458
459 return 1; 448 return 1;
460 449
461 err: 450 err:
@@ -465,7 +454,7 @@ tls13_server_encrypted_extensions_recv(struct tls13_ctx *ctx)
465} 454}
466 455
467int 456int
468tls13_server_certificate_request_recv(struct tls13_ctx *ctx) 457tls13_server_certificate_request_recv(struct tls13_ctx *ctx, CBS *cbs)
469{ 458{
470 /* 459 /*
471 * Thanks to poor state design in the RFC, this function can be called 460 * Thanks to poor state design in the RFC, this function can be called
@@ -475,7 +464,7 @@ tls13_server_certificate_request_recv(struct tls13_ctx *ctx)
475 */ 464 */
476 if (tls13_handshake_msg_type(ctx->hs_msg) == TLS13_MT_CERTIFICATE) { 465 if (tls13_handshake_msg_type(ctx->hs_msg) == TLS13_MT_CERTIFICATE) {
477 ctx->handshake_stage.hs_type |= WITHOUT_CR; 466 ctx->handshake_stage.hs_type |= WITHOUT_CR;
478 return tls13_server_certificate_recv(ctx); 467 return tls13_server_certificate_recv(ctx, cbs);
479 } 468 }
480 469
481 /* XXX - unimplemented. */ 470 /* XXX - unimplemented. */
@@ -484,9 +473,9 @@ tls13_server_certificate_request_recv(struct tls13_ctx *ctx)
484} 473}
485 474
486int 475int
487tls13_server_certificate_recv(struct tls13_ctx *ctx) 476tls13_server_certificate_recv(struct tls13_ctx *ctx, CBS *cbs)
488{ 477{
489 CBS cbs, cert_request_context, cert_list, cert_data, cert_exts; 478 CBS cert_request_context, cert_list, cert_data, cert_exts;
490 struct stack_st_X509 *certs = NULL; 479 struct stack_st_X509 *certs = NULL;
491 SSL *s = ctx->ssl; 480 SSL *s = ctx->ssl;
492 X509 *cert = NULL; 481 X509 *cert = NULL;
@@ -498,16 +487,11 @@ tls13_server_certificate_recv(struct tls13_ctx *ctx)
498 if ((certs = sk_X509_new_null()) == NULL) 487 if ((certs = sk_X509_new_null()) == NULL)
499 goto err; 488 goto err;
500 489
501 if (!tls13_handshake_msg_content(ctx->hs_msg, &cbs)) 490 if (!CBS_get_u8_length_prefixed(cbs, &cert_request_context))
502 goto err;
503
504 if (!CBS_get_u8_length_prefixed(&cbs, &cert_request_context))
505 goto err; 491 goto err;
506 if (CBS_len(&cert_request_context) != 0) 492 if (CBS_len(&cert_request_context) != 0)
507 goto err; 493 goto err;
508 if (!CBS_get_u24_length_prefixed(&cbs, &cert_list)) 494 if (!CBS_get_u24_length_prefixed(cbs, &cert_list))
509 goto err;
510 if (CBS_len(&cbs) != 0)
511 goto err; 495 goto err;
512 496
513 while (CBS_len(&cert_list) > 0) { 497 while (CBS_len(&cert_list) > 0) {
@@ -595,7 +579,7 @@ static uint8_t cert_verify_pad[64] = {
595static uint8_t server_cert_verify_context[] = "TLS 1.3, server CertificateVerify"; 579static uint8_t server_cert_verify_context[] = "TLS 1.3, server CertificateVerify";
596 580
597int 581int
598tls13_server_certificate_verify_recv(struct tls13_ctx *ctx) 582tls13_server_certificate_verify_recv(struct tls13_ctx *ctx, CBS *cbs)
599{ 583{
600 const struct ssl_sigalg *sigalg; 584 const struct ssl_sigalg *sigalg;
601 uint16_t signature_scheme; 585 uint16_t signature_scheme;
@@ -605,20 +589,15 @@ tls13_server_certificate_verify_recv(struct tls13_ctx *ctx)
605 EVP_PKEY_CTX *pctx; 589 EVP_PKEY_CTX *pctx;
606 EVP_PKEY *pkey; 590 EVP_PKEY *pkey;
607 X509 *cert; 591 X509 *cert;
608 CBS cbs, signature; 592 CBS signature;
609 CBB cbb; 593 CBB cbb;
610 int ret = 0; 594 int ret = 0;
611 595
612 memset(&cbb, 0, sizeof(cbb)); 596 memset(&cbb, 0, sizeof(cbb));
613 597
614 if (!tls13_handshake_msg_content(ctx->hs_msg, &cbs)) 598 if (!CBS_get_u16(cbs, &signature_scheme))
615 goto err;
616
617 if (!CBS_get_u16(&cbs, &signature_scheme))
618 goto err;
619 if (!CBS_get_u16_length_prefixed(&cbs, &signature))
620 goto err; 599 goto err;
621 if (CBS_len(&cbs) != 0) 600 if (!CBS_get_u16_length_prefixed(cbs, &signature))
622 goto err; 601 goto err;
623 602
624 if ((sigalg = ssl_sigalg(signature_scheme, tls13_sigalgs, 603 if ((sigalg = ssl_sigalg(signature_scheme, tls13_sigalgs,
@@ -680,7 +659,7 @@ tls13_server_certificate_verify_recv(struct tls13_ctx *ctx)
680} 659}
681 660
682int 661int
683tls13_server_finished_recv(struct tls13_ctx *ctx) 662tls13_server_finished_recv(struct tls13_ctx *ctx, CBS *cbs)
684{ 663{
685 struct tls13_secrets *secrets = ctx->hs->secrets; 664 struct tls13_secrets *secrets = ctx->hs->secrets;
686 struct tls13_secret context = { .data = "", .len = 0 }; 665 struct tls13_secret context = { .data = "", .len = 0 };
@@ -693,10 +672,6 @@ tls13_server_finished_recv(struct tls13_ctx *ctx)
693 HMAC_CTX *hmac_ctx = NULL; 672 HMAC_CTX *hmac_ctx = NULL;
694 unsigned int hlen; 673 unsigned int hlen;
695 int ret = 0; 674 int ret = 0;
696 CBS cbs;
697
698 if (!tls13_handshake_msg_content(ctx->hs_msg, &cbs))
699 goto err;
700 675
701 /* 676 /*
702 * Verify server finished. 677 * Verify server finished.
@@ -725,11 +700,14 @@ tls13_server_finished_recv(struct tls13_ctx *ctx)
725 if (hlen != verify_data_len) 700 if (hlen != verify_data_len)
726 goto err; 701 goto err;
727 702
728 if (!CBS_mem_equal(&cbs, verify_data, verify_data_len)) { 703 if (!CBS_mem_equal(cbs, verify_data, verify_data_len)) {
729 ctx->alert = TLS1_AD_DECRYPTION_FAILED; 704 ctx->alert = TLS1_AD_DECRYPTION_FAILED;
730 goto err; 705 goto err;
731 } 706 }
732 707
708 if (!CBS_skip(cbs, verify_data_len))
709 goto err;
710
733 /* 711 /*
734 * Derive application traffic keys. 712 * Derive application traffic keys.
735 */ 713 */
@@ -864,9 +842,6 @@ tls13_client_hello_retry_process(struct tls13_ctx *ctx, CBS *cbs)
864 goto err; 842 goto err;
865 } 843 }
866 844
867 if (CBS_len(cbs) != 0)
868 goto err;
869
870 /* XXX for now, just say no, we will not change our hello */ 845 /* XXX for now, just say no, we will not change our hello */
871 ctx->alert = SSL_AD_ILLEGAL_PARAMETER; 846 ctx->alert = SSL_AD_ILLEGAL_PARAMETER;
872 err: 847 err:
@@ -876,15 +851,11 @@ tls13_client_hello_retry_process(struct tls13_ctx *ctx, CBS *cbs)
876} 851}
877 852
878int 853int
879tls13_client_hello_retry_recv(struct tls13_ctx *ctx) 854tls13_client_hello_retry_recv(struct tls13_ctx *ctx, CBS *cbs)
880{ 855{
881 int ret = 0; 856 int ret = 0;
882 CBS cbs;
883
884 if (!tls13_handshake_msg_content(ctx->hs_msg, &cbs))
885 goto err;
886 857
887 if (!tls13_client_hello_retry_process(ctx, &cbs)) { 858 if (!tls13_client_hello_retry_process(ctx, cbs)) {
888 if (ctx->alert == SSL_AD_ILLEGAL_PARAMETER) 859 if (ctx->alert == SSL_AD_ILLEGAL_PARAMETER)
889 tls13_set_errorx(ctx, TLS13_ERR_HRR_FAILED, 0, 860 tls13_set_errorx(ctx, TLS13_ERR_HRR_FAILED, 0,
890 "Unsatisfiable hello retry request", NULL); 861 "Unsatisfiable hello retry request", NULL);
diff --git a/src/lib/libssl/tls13_handshake.c b/src/lib/libssl/tls13_handshake.c
index ca36f879b4..d4d998248d 100644
--- a/src/lib/libssl/tls13_handshake.c
+++ b/src/lib/libssl/tls13_handshake.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_handshake.c,v 1.39 2020/01/22 02:39:45 tb Exp $ */ 1/* $OpenBSD: tls13_handshake.c,v 1.40 2020/01/22 13:10:51 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org>
4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
@@ -32,7 +32,7 @@ struct tls13_handshake_action {
32 32
33 int (*send)(struct tls13_ctx *ctx); 33 int (*send)(struct tls13_ctx *ctx);
34 int (*sent)(struct tls13_ctx *ctx); 34 int (*sent)(struct tls13_ctx *ctx);
35 int (*recv)(struct tls13_ctx *ctx); 35 int (*recv)(struct tls13_ctx *ctx, CBS *cbs);
36}; 36};
37 37
38enum tls13_message_type tls13_handshake_active_state(struct tls13_ctx *ctx); 38enum tls13_message_type tls13_handshake_active_state(struct tls13_ctx *ctx);
@@ -389,11 +389,21 @@ tls13_handshake_recv_action(struct tls13_ctx *ctx,
389 action->handshake_type != TLS13_MT_CERTIFICATE_REQUEST)) 389 action->handshake_type != TLS13_MT_CERTIFICATE_REQUEST))
390 return tls13_send_alert(ctx->rl, SSL_AD_UNEXPECTED_MESSAGE); 390 return tls13_send_alert(ctx->rl, SSL_AD_UNEXPECTED_MESSAGE);
391 391
392 /* XXX provide CBS and check all consumed. */ 392 if (!tls13_handshake_msg_content(ctx->hs_msg, &cbs))
393 return TLS13_IO_FAILURE;
394
393 ret = TLS13_IO_FAILURE; 395 ret = TLS13_IO_FAILURE;
394 if (action->recv(ctx)) 396 if (action->recv(ctx, &cbs)) {
395 ret = TLS13_IO_SUCCESS; 397 if (CBS_len(&cbs) != 0) {
396 else if (ctx->alert) 398 tls13_set_errorx(ctx, TLS13_ERR_TRAILING_DATA, 0,
399 "trailing data in handshake message", NULL);
400 ctx->alert = SSL_AD_DECODE_ERROR;
401 } else {
402 ret = TLS13_IO_SUCCESS;
403 }
404 }
405
406 if (ctx->alert)
397 ret = tls13_send_alert(ctx->rl, ctx->alert); 407 ret = tls13_send_alert(ctx->rl, ctx->alert);
398 408
399 tls13_handshake_msg_free(ctx->hs_msg); 409 tls13_handshake_msg_free(ctx->hs_msg);
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h
index 68a129a634..ba34961e33 100644
--- a/src/lib/libssl/tls13_internal.h
+++ b/src/lib/libssl/tls13_internal.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_internal.h,v 1.44 2020/01/22 06:23:00 jsing Exp $ */ 1/* $OpenBSD: tls13_internal.h,v 1.45 2020/01/22 13:10:51 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org>
4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
@@ -39,6 +39,7 @@ __BEGIN_HIDDEN_DECLS
39 39
40#define TLS13_ERR_VERIFY_FAILED 16 40#define TLS13_ERR_VERIFY_FAILED 16
41#define TLS13_ERR_HRR_FAILED 17 41#define TLS13_ERR_HRR_FAILED 17
42#define TLS13_ERR_TRAILING_DATA 18
42 43
43typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg); 44typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg);
44typedef ssize_t (*tls13_phh_recv_cb)(void *_cb_arg, CBS *cbs); 45typedef ssize_t (*tls13_phh_recv_cb)(void *_cb_arg, CBS *cbs);
@@ -258,33 +259,33 @@ int tls13_handshake_perform(struct tls13_ctx *ctx);
258 259
259int tls13_client_hello_send(struct tls13_ctx *ctx); 260int tls13_client_hello_send(struct tls13_ctx *ctx);
260int tls13_client_hello_sent(struct tls13_ctx *ctx); 261int tls13_client_hello_sent(struct tls13_ctx *ctx);
261int tls13_client_hello_recv(struct tls13_ctx *ctx); 262int tls13_client_hello_recv(struct tls13_ctx *ctx, CBS *cbs);
262int tls13_client_hello_retry_send(struct tls13_ctx *ctx); 263int tls13_client_hello_retry_send(struct tls13_ctx *ctx);
263int tls13_client_hello_retry_recv(struct tls13_ctx *ctx); 264int tls13_client_hello_retry_recv(struct tls13_ctx *ctx, CBS *cbs);
264int tls13_client_end_of_early_data_send(struct tls13_ctx *ctx); 265int tls13_client_end_of_early_data_send(struct tls13_ctx *ctx);
265int tls13_client_end_of_early_data_recv(struct tls13_ctx *ctx); 266int tls13_client_end_of_early_data_recv(struct tls13_ctx *ctx, CBS *cbs);
266int tls13_client_certificate_send(struct tls13_ctx *ctx); 267int tls13_client_certificate_send(struct tls13_ctx *ctx);
267int tls13_client_certificate_recv(struct tls13_ctx *ctx); 268int tls13_client_certificate_recv(struct tls13_ctx *ctx, CBS *cbs);
268int tls13_client_certificate_verify_send(struct tls13_ctx *ctx); 269int tls13_client_certificate_verify_send(struct tls13_ctx *ctx);
269int tls13_client_certificate_verify_recv(struct tls13_ctx *ctx); 270int tls13_client_certificate_verify_recv(struct tls13_ctx *ctx, CBS *cbs);
270int tls13_client_finished_recv(struct tls13_ctx *ctx); 271int tls13_client_finished_recv(struct tls13_ctx *ctx, CBS *cbs);
271int tls13_client_finished_send(struct tls13_ctx *ctx); 272int tls13_client_finished_send(struct tls13_ctx *ctx);
272int tls13_client_finished_sent(struct tls13_ctx *ctx); 273int tls13_client_finished_sent(struct tls13_ctx *ctx);
273int tls13_client_key_update_send(struct tls13_ctx *ctx); 274int tls13_client_key_update_send(struct tls13_ctx *ctx);
274int tls13_client_key_update_recv(struct tls13_ctx *ctx); 275int tls13_client_key_update_recv(struct tls13_ctx *ctx, CBS *cbs);
275int tls13_server_hello_recv(struct tls13_ctx *ctx); 276int tls13_server_hello_recv(struct tls13_ctx *ctx, CBS *cbs);
276int tls13_server_hello_send(struct tls13_ctx *ctx); 277int tls13_server_hello_send(struct tls13_ctx *ctx);
277int tls13_server_hello_retry_recv(struct tls13_ctx *ctx); 278int tls13_server_hello_retry_recv(struct tls13_ctx *ctx, CBS *cbs);
278int tls13_server_hello_retry_send(struct tls13_ctx *ctx); 279int tls13_server_hello_retry_send(struct tls13_ctx *ctx);
279int tls13_server_encrypted_extensions_recv(struct tls13_ctx *ctx); 280int tls13_server_encrypted_extensions_recv(struct tls13_ctx *ctx, CBS *cbs);
280int tls13_server_encrypted_extensions_send(struct tls13_ctx *ctx); 281int tls13_server_encrypted_extensions_send(struct tls13_ctx *ctx);
281int tls13_server_certificate_recv(struct tls13_ctx *ctx); 282int tls13_server_certificate_recv(struct tls13_ctx *ctx, CBS *cbs);
282int tls13_server_certificate_send(struct tls13_ctx *ctx); 283int tls13_server_certificate_send(struct tls13_ctx *ctx);
283int tls13_server_certificate_request_recv(struct tls13_ctx *ctx); 284int tls13_server_certificate_request_recv(struct tls13_ctx *ctx, CBS *cbs);
284int tls13_server_certificate_request_send(struct tls13_ctx *ctx); 285int tls13_server_certificate_request_send(struct tls13_ctx *ctx);
285int tls13_server_certificate_verify_send(struct tls13_ctx *ctx); 286int tls13_server_certificate_verify_send(struct tls13_ctx *ctx);
286int tls13_server_certificate_verify_recv(struct tls13_ctx *ctx); 287int tls13_server_certificate_verify_recv(struct tls13_ctx *ctx, CBS *cbs);
287int tls13_server_finished_recv(struct tls13_ctx *ctx); 288int tls13_server_finished_recv(struct tls13_ctx *ctx, CBS *cbs);
288int tls13_server_finished_send(struct tls13_ctx *ctx); 289int tls13_server_finished_send(struct tls13_ctx *ctx);
289 290
290void tls13_error_clear(struct tls13_error *error); 291void tls13_error_clear(struct tls13_error *error);
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c
index 73d936ac3f..51a2a383ed 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.20 2020/01/22 06:23:00 jsing Exp $ */ 1/* $OpenBSD: tls13_lib.c,v 1.21 2020/01/22 13:10:51 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>
@@ -356,6 +356,9 @@ tls13_legacy_error(SSL *ssl)
356 case TLS13_ERR_HRR_FAILED: 356 case TLS13_ERR_HRR_FAILED:
357 reason = SSL_R_NO_CIPHERS_AVAILABLE; 357 reason = SSL_R_NO_CIPHERS_AVAILABLE;
358 break; 358 break;
359 case TLS13_ERR_TRAILING_DATA:
360 reason = SSL_R_EXTRA_DATA_IN_MESSAGE;
361 break;
359 } 362 }
360 363
361 ERR_put_error(ERR_LIB_SSL, (0xfff), reason, ctx->error.file, 364 ERR_put_error(ERR_LIB_SSL, (0xfff), reason, ctx->error.file,
diff --git a/src/lib/libssl/tls13_server.c b/src/lib/libssl/tls13_server.c
index fc3e80ad58..90a339dc61 100644
--- a/src/lib/libssl/tls13_server.c
+++ b/src/lib/libssl/tls13_server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_server.c,v 1.5 2020/01/22 05:06:23 tb Exp $ */ 1/* $OpenBSD: tls13_server.c,v 1.6 2020/01/22 13:10:51 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -79,7 +79,7 @@ tls13_legacy_accept(SSL *ssl)
79} 79}
80 80
81int 81int
82tls13_client_hello_recv(struct tls13_ctx *ctx) 82tls13_client_hello_recv(struct tls13_ctx *ctx, CBS *cbs)
83{ 83{
84 tls13_record_layer_allow_ccs(ctx->rl, 1); 84 tls13_record_layer_allow_ccs(ctx->rl, 1);
85 85
@@ -93,7 +93,7 @@ tls13_client_hello_retry_send(struct tls13_ctx *ctx)
93} 93}
94 94
95int 95int
96tls13_server_hello_retry_recv(struct tls13_ctx *ctx) 96tls13_server_hello_retry_recv(struct tls13_ctx *ctx, CBS *cbs)
97{ 97{
98 return 0; 98 return 0;
99} 99}
@@ -105,7 +105,7 @@ tls13_client_end_of_early_data_send(struct tls13_ctx *ctx)
105} 105}
106 106
107int 107int
108tls13_client_end_of_early_data_recv(struct tls13_ctx *ctx) 108tls13_client_end_of_early_data_recv(struct tls13_ctx *ctx, CBS *cbs)
109{ 109{
110 return 0; 110 return 0;
111} 111}
@@ -117,7 +117,7 @@ tls13_client_certificate_send(struct tls13_ctx *ctx)
117} 117}
118 118
119int 119int
120tls13_client_certificate_recv(struct tls13_ctx *ctx) 120tls13_client_certificate_recv(struct tls13_ctx *ctx, CBS *cbs)
121{ 121{
122 return 0; 122 return 0;
123} 123}
@@ -129,13 +129,13 @@ tls13_client_certificate_verify_send(struct tls13_ctx *ctx)
129} 129}
130 130
131int 131int
132tls13_client_certificate_verify_recv(struct tls13_ctx *ctx) 132tls13_client_certificate_verify_recv(struct tls13_ctx *ctx, CBS *cbs)
133{ 133{
134 return 0; 134 return 0;
135} 135}
136 136
137int 137int
138tls13_client_finished_recv(struct tls13_ctx *ctx) 138tls13_client_finished_recv(struct tls13_ctx *ctx, CBS *cbs)
139{ 139{
140 tls13_record_layer_allow_ccs(ctx->rl, 0); 140 tls13_record_layer_allow_ccs(ctx->rl, 0);
141 141
@@ -149,7 +149,7 @@ tls13_client_key_update_send(struct tls13_ctx *ctx)
149} 149}
150 150
151int 151int
152tls13_client_key_update_recv(struct tls13_ctx *ctx) 152tls13_client_key_update_recv(struct tls13_ctx *ctx, CBS *cbs)
153{ 153{
154 return 0; 154 return 0;
155} 155}