Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore data appearing after close_notify #1950

Merged
merged 6 commits into from
May 16, 2024
Merged

Ignore data appearing after close_notify #1950

merged 6 commits into from
May 16, 2024

Conversation

djc
Copy link
Member

@djc djc commented May 15, 2024

@djc djc requested a review from ctz May 15, 2024 13:11
Copy link

rustls-benchmarking bot commented May 15, 2024

Benchmark results

Instruction counts

Significant differences

There are no significant instruction count differences

Other differences

Click to expand
Scenario Baseline Candidate Diff Threshold
handshake_tickets_aws_lc_rs_1.2_rsa_aes_server 4436717 4355225 -81492 (-1.84%) 2.97%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_client 8743522 8701400 -42122 (-0.48%) 1.21%
handshake_no_resume_aws_lc_rs_1.2_rsa_aes_server 13394720 13431585 36865 (0.28%) 1.24%
handshake_no_resume_aws_lc_rs_1.3_rsa_aes_server 13793290 13827452 34162 (0.25%) 0.85%
handshake_session_id_aws_lc_rs_1.2_rsa_aes_server 3913617 3905753 -7864 (-0.20%) 6.52%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha_client 30349820 30400625 50805 (0.17%) 0.41%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes_client 8738365 8751640 13275 (0.15%) 0.80%
handshake_tickets_aws_lc_rs_1.3_rsa_aes_server 32688133 32645025 -43108 (-0.13%) 0.78%
handshake_tickets_aws_lc_rs_1.3_rsa_chacha_server 32672469 32715535 43066 (0.13%) 0.46%
handshake_no_resume_aws_lc_rs_1.3_rsa_chacha_server 13801362 13788619 -12743 (-0.09%) 1.08%
transfer_no_resume_aws_lc_rs_1.2_rsa_aes_server 46438634 46399117 -39517 (-0.09%) 0.35%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes_client 30177265 30153717 -23548 (-0.08%) 0.28%
transfer_no_resume_aws_lc_rs_1.3_rsa_aes_server 46445859 46411040 -34819 (-0.07%) 0.27%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes_client 30381189 30358696 -22493 (-0.07%) 0.52%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha_client 30160205 30179666 19461 (0.06%) 0.31%
transfer_no_resume_aws_lc_rs_1.3_rsa_chacha_server 80568909 80620619 51710 (0.06%) 0.28%
handshake_tickets_ring_1.2_rsa_aes_server 4663757 4666283 2526 (0.05%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes_client 3366659 3364952 -1707 (-0.05%) 0.28%
handshake_session_id_aws_lc_rs_1.3_rsa_chacha_server 32436839 32421059 -15780 (-0.05%) 0.54%
handshake_session_id_aws_lc_rs_1.3_rsa_aes_server 32437803 32425963 -11840 (-0.04%) 0.78%
handshake_tickets_aws_lc_rs_1.2_rsa_aes_client 4299473 4300976 1503 (0.03%) 0.20%
handshake_session_id_ring_1.2_rsa_aes_server 4231639 4233103 1464 (0.03%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_server 1896134 1895485 -649 (-0.03%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_client 3369633 3368615 -1018 (-0.03%) 0.24%
handshake_tickets_ring_1.2_rsa_aes_client 4507518 4508800 1282 (0.03%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_client 92687462 92710850 23388 (0.03%) 0.20%
handshake_session_id_aws_lc_rs_1.2_rsa_aes_client 3972631 3973561 930 (0.02%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes_client 30181970 30188916 6946 (0.02%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha_client 30357357 30363507 6150 (0.02%) 0.20%
handshake_session_id_ring_1.3_ecdsap256_chacha_client 41764397 41771206 6809 (0.02%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes_server 1892789 1892509 -280 (-0.01%) 0.20%
handshake_session_id_aws_lc_rs_1.3_rsa_chacha_client 30171537 30175955 4418 (0.01%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha_client 30158756 30163083 4327 (0.01%) 0.20%
handshake_tickets_aws_lc_rs_1.3_rsa_aes_client 30395351 30399591 4240 (0.01%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes_client 30382673 30386842 4169 (0.01%) 0.20%
handshake_no_resume_ring_1.3_ecdsap256_chacha_server 2131401 2131692 291 (0.01%) 0.20%
handshake_session_id_ring_1.3_rsa_chacha_client 41779959 41784826 4867 (0.01%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes_server 32438497 32442272 3775 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap256_aes_server 43411277 43416290 5013 (0.01%) 0.20%
handshake_session_id_ring_1.3_rsa_aes_client 41861404 41866214 4810 (0.01%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_aes_client 58318779 58312206 -6573 (-0.01%) 0.20%
handshake_session_id_aws_lc_rs_1.3_rsa_aes_client 30196648 30200005 3357 (0.01%) 0.20%
handshake_no_resume_ring_1.3_ecdsap256_aes_client 3914471 3914905 434 (0.01%) 0.20%
handshake_tickets_aws_lc_rs_1.3_rsa_chacha_client 30373293 30376485 3192 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_aes_client 42032049 42036461 4412 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_aes_server 43411825 43416324 4499 (0.01%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha_server 32399408 32402730 3322 (0.01%) 0.20%
handshake_tickets_ring_1.3_rsa_chacha_client 41980633 41984927 4294 (0.01%) 0.20%
handshake_session_id_ring_1.3_rsa_aes_server 43408803 43413151 4348 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_chacha_client 41763026 41767133 4107 (0.01%) 0.20%
handshake_tickets_ring_1.3_rsa_aes_client 42050153 42054134 3981 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_aes_client 41844210 41848171 3961 (0.01%) 0.20%
handshake_tickets_ring_1.3_rsa_aes_server 43689418 43693365 3947 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_chacha_client 41967216 41970966 3750 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_chacha_server 43310132 43313977 3845 (0.01%) 0.20%
handshake_session_id_ring_1.3_rsa_chacha_server 43307911 43311616 3705 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_aes_server 43692436 43696107 3671 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_chacha_client 41963348 41966831 3483 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap256_aes_client 41848366 41851775 3409 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_aes_server 43692484 43696001 3517 (0.01%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_aes_client 42035503 42038775 3272 (0.01%) 0.20%
handshake_no_resume_ring_1.2_rsa_aes_client 2856276 2856055 -221 (-0.01%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes_server 32439759 32442248 2489 (0.01%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes_server 32700795 32703291 2496 (0.01%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha_server 32399651 32401994 2343 (0.01%) 0.20%
handshake_session_id_ring_1.3_ecdsap256_chacha_server 43310922 43313792 2870 (0.01%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes_server 32701421 32703503 2082 (0.01%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_aes_client 58209312 58212854 3542 (0.01%) 0.20%
handshake_no_resume_ring_1.3_ecdsap256_chacha_client 3915806 3916039 233 (0.01%) 0.20%
handshake_no_resume_ring_1.3_rsa_aes_client 2948918 2949068 150 (0.01%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_rsa_aes_client 2216048 2216154 106 (0.00%) 0.20%
handshake_session_id_ring_1.2_rsa_aes_client 4234320 4234521 201 (0.00%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha_server 32677564 32679100 1536 (0.00%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_chacha_server 43618085 43620078 1993 (0.00%) 0.20%
handshake_no_resume_aws_lc_rs_1.2_rsa_aes_client 2015006 2014918 -88 (-0.00%) 0.20%
transfer_no_resume_ring_1.2_rsa_aes_client 58202724 58200275 -2449 (-0.00%) 0.20%
handshake_tickets_ring_1.3_rsa_chacha_server 43615031 43616782 1751 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.2_rsa_aes_client 68655897 68653216 -2681 (-0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_aes_client 58229436 58231632 2196 (0.00%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_chacha_server 43617995 43619429 1434 (0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_aes_client 58319756 58318005 -1751 (-0.00%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha_server 32678162 32679129 967 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_rsa_aes_client 58234264 58232945 -1319 (-0.00%) 0.20%
handshake_no_resume_ring_1.3_rsa_aes_server 12168283 12168510 227 (0.00%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_rsa_chacha_client 2223293 2223254 -39 (-0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap256_aes_server 2129531 2129494 -37 (-0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_aes_server 13737794 13737570 -224 (-0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_chacha_server 13739931 13739713 -218 (-0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_chacha_client 92651213 92649746 -1467 (-0.00%) 0.20%
handshake_no_resume_ring_1.2_rsa_aes_server 11985252 11985436 184 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_chacha_client 92647527 92646298 -1229 (-0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_aes_client 58315273 58314578 -695 (-0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_server 80608862 80609812 950 (0.00%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes_server 4273352 4273399 47 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_rsa_chacha_client 92692106 92691153 -953 (-0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_aes_server 46429598 46429971 373 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_chacha_server 80507161 80506576 -585 (-0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_chacha_client 92652186 92651558 -628 (-0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_aes_client 35471817 35471616 -201 (-0.00%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_server 4276761 4276737 -24 (-0.00%) 0.20%
handshake_no_resume_ring_1.3_rsa_chacha_server 12174252 12174185 -67 (-0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_aes_server 46454031 46453783 -248 (-0.00%) 0.20%
transfer_no_resume_ring_1.2_rsa_aes_server 46361691 46361464 -227 (-0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_client 92689145 92688719 -426 (-0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_chacha_server 80510230 80510596 366 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_aes_server 46457209 46457405 196 (0.00%) 0.20%
handshake_no_resume_ring_1.3_rsa_chacha_client 2954905 2954917 12 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_aes_server 46430272 46430430 158 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_server 80609612 80609837 225 (0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_chacha_client 35473679 35473769 90 (0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_aes_server 46461420 46461330 -90 (-0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_chacha_server 80514714 80514869 155 (0.00%) 0.20%

Wall-time

Significant differences

There are no significant wall-time differences

Other differences

Click to expand
Scenario Baseline Candidate Diff Threshold
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes 482.07 µs 476.02 µs -6.05 µs (-1.26%) 3.96%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_aes 4.54 ms 4.49 ms -0.05 ms (-1.09%) 5.88%
transfer_no_resume_aws_lc_rs_1.2_rsa_aes 5.48 ms 5.44 ms -0.05 ms (-0.91%) 4.19%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_aes 5.26 ms 5.21 ms -0.05 ms (-0.89%) 4.55%
transfer_no_resume_aws_lc_rs_1.3_rsa_aes 5.48 ms 5.43 ms -0.05 ms (-0.86%) 4.46%
handshake_no_resume_ring_1.3_ecdsap256_aes 507.97 µs 503.90 µs -4.06 µs (-0.80%) 2.50%
transfer_no_resume_ring_1.3_ecdsap256_aes 6.37 ms 6.32 ms -0.05 ms (-0.77%) 3.98%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha 478.77 µs 475.39 µs -3.38 µs (-0.71%) 3.51%
transfer_no_resume_ring_1.3_rsa_aes 6.86 ms 6.81 ms -0.05 ms (-0.68%) 3.66%
transfer_no_resume_ring_1.2_rsa_aes 6.77 ms 6.73 ms -0.04 ms (-0.64%) 3.82%
handshake_no_resume_ring_1.3_ecdsap256_chacha 504.81 µs 502.36 µs -2.45 µs (-0.49%) 2.41%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes 5.25 ms 5.27 ms 0.02 ms (0.43%) 1.18%
handshake_session_id_ring_1.3_ecdsap256_chacha 6.66 ms 6.69 ms 0.03 ms (0.42%) 1.00%
transfer_no_resume_ring_1.3_ecdsap384_aes 9.46 ms 9.42 ms -0.04 ms (-0.42%) 2.53%
handshake_session_id_ring_1.3_ecdsap256_aes 6.70 ms 6.72 ms 0.03 ms (0.40%) 1.00%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes 1.20 ms 1.19 ms -0.00 ms (-0.38%) 1.38%
transfer_no_resume_aws_lc_rs_1.3_rsa_chacha 13.95 ms 13.90 ms -0.05 ms (-0.37%) 1.80%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes 5.97 ms 6.00 ms 0.02 ms (0.37%) 1.00%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_chacha 13.00 ms 12.96 ms -0.05 ms (-0.36%) 1.98%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha 5.24 ms 5.25 ms 0.02 ms (0.35%) 1.15%
handshake_tickets_aws_lc_rs_1.3_rsa_aes 6.20 ms 6.22 ms 0.02 ms (0.33%) 1.00%
handshake_tickets_ring_1.3_ecdsap256_chacha 6.69 ms 6.71 ms 0.02 ms (0.33%) 1.37%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes 5.95 ms 5.97 ms 0.02 ms (0.33%) 1.00%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_chacha 13.72 ms 13.67 ms -0.04 ms (-0.32%) 1.84%
handshake_tickets_ring_1.3_ecdsap256_aes 6.73 ms 6.75 ms 0.02 ms (0.31%) 1.00%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes 5.24 ms 5.26 ms 0.02 ms (0.31%) 1.00%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha 5.26 ms 5.27 ms 0.02 ms (0.30%) 1.00%
handshake_session_id_aws_lc_rs_1.3_rsa_aes 6.19 ms 6.21 ms 0.02 ms (0.29%) 1.05%
handshake_session_id_ring_1.3_ecdsap384_aes 9.79 ms 9.82 ms 0.03 ms (0.29%) 1.00%
handshake_session_id_ring_1.3_ecdsap384_chacha 9.76 ms 9.78 ms 0.03 ms (0.28%) 1.00%
handshake_tickets_aws_lc_rs_1.2_rsa_aes 2.21 ms 2.22 ms 0.01 ms (0.28%) 1.57%
handshake_no_resume_ring_1.2_rsa_aes 979.22 µs 976.54 µs -2.67 µs (-0.27%) 1.00%
handshake_session_id_ring_1.3_rsa_aes 7.20 ms 7.22 ms 0.02 ms (0.26%) 1.00%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha 5.97 ms 5.98 ms 0.02 ms (0.26%) 1.00%
handshake_session_id_ring_1.3_rsa_chacha 7.15 ms 7.17 ms 0.02 ms (0.25%) 1.00%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha 5.94 ms 5.95 ms 0.01 ms (0.24%) 1.00%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha 1.18 ms 1.18 ms -0.00 ms (-0.24%) 1.15%
handshake_tickets_ring_1.3_rsa_chacha 7.18 ms 7.19 ms 0.02 ms (0.23%) 1.00%
handshake_tickets_aws_lc_rs_1.3_rsa_chacha 6.20 ms 6.22 ms 0.01 ms (0.21%) 1.05%
handshake_session_id_aws_lc_rs_1.3_rsa_chacha 6.18 ms 6.19 ms 0.01 ms (0.21%) 1.02%
handshake_tickets_ring_1.3_ecdsap384_aes 9.82 ms 9.84 ms 0.02 ms (0.20%) 1.00%
transfer_no_resume_ring_1.3_ecdsap256_chacha 13.02 ms 12.99 ms -0.03 ms (-0.20%) 1.91%
handshake_no_resume_aws_lc_rs_1.2_rsa_aes 1.36 ms 1.36 ms -0.00 ms (-0.19%) 1.42%
handshake_tickets_ring_1.3_ecdsap384_chacha 9.78 ms 9.80 ms 0.02 ms (0.17%) 1.00%
transfer_no_resume_ring_1.3_rsa_chacha 13.51 ms 13.49 ms -0.02 ms (-0.16%) 2.05%
handshake_no_resume_ring_1.3_rsa_chacha 999.78 µs 998.31 µs -1.47 µs (-0.15%) 1.09%
handshake_no_resume_ring_1.3_rsa_aes 999.03 µs 997.56 µs -1.47 µs (-0.15%) 1.36%
handshake_tickets_ring_1.3_rsa_aes 7.22 ms 7.23 ms 0.01 ms (0.13%) 1.00%
handshake_no_resume_aws_lc_rs_1.3_rsa_chacha 1.40 ms 1.40 ms -0.00 ms (-0.12%) 1.21%
handshake_session_id_aws_lc_rs_1.2_rsa_aes 2.06 ms 2.06 ms 0.00 ms (0.12%) 1.81%
transfer_no_resume_ring_1.3_ecdsap384_chacha 16.11 ms 16.10 ms -0.02 ms (-0.11%) 1.39%
handshake_no_resume_ring_1.3_ecdsap384_chacha 3.60 ms 3.61 ms 0.00 ms (0.10%) 1.00%
handshake_tickets_ring_1.2_rsa_aes 1.63 ms 1.63 ms 0.00 ms (0.09%) 1.08%
handshake_no_resume_aws_lc_rs_1.3_rsa_aes 1.41 ms 1.41 ms -0.00 ms (-0.07%) 1.11%
handshake_no_resume_ring_1.3_ecdsap384_aes 3.61 ms 3.61 ms 0.00 ms (0.02%) 1.00%
handshake_session_id_ring_1.2_rsa_aes 1.55 ms 1.55 ms -0.00 ms (-0.00%) 1.35%

Additional information

Historical results

Checkout details:

Copy link

codecov bot commented May 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.48%. Comparing base (27d81e0) to head (0acde9a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1950   +/-   ##
=======================================
  Coverage   95.48%   95.48%           
=======================================
  Files          86       86           
  Lines       18654    18664   +10     
=======================================
+ Hits        17811    17821   +10     
  Misses        843      843           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ctz
Copy link
Member

ctz commented May 15, 2024

Hm, the duplication of this code for read_buf is pretty annoying. Maybe we could hoist that out?

@djc
Copy link
Member Author

djc commented May 15, 2024

Hm, the duplication of this code for read_buf is pretty annoying. Maybe we could hoist that out?

Was just working on that. Probably need to add a test. Any suggestions on which test to crib off of/would you be able to take care of that?

@VladimirBramstedt
Copy link

hmm, is error the correct thing to do?
the specs for both tls 1.2 and 1.3 state that any data received after closure must be ignored. throwing an error is kind of ignoring it in the way that it isnt reading it, but the alternative is to pretend everything is fine and dandy and really treat is as if we havnt seen any data (i.e discard everything in the deframer and carry on)

@ctz
Copy link
Member

ctz commented May 15, 2024

would you be able to take care of that?

Sure!

@djc
Copy link
Member Author

djc commented May 15, 2024

hmm, is error the correct thing to do? the specs for both tls 1.2 and 1.3 state that any data received after closure must be ignored. throwing an error is kind of ignoring it in the way that it isnt reading it, but the alternative is to pretend everything is fine and dandy and really treat is as if we havnt seen any data (i.e discard everything in the deframer and carry on)

Do you have references to the appropriate sections? (See #1951 which handles that cleanly for application data.)

@ctz
Copy link
Member

ctz commented May 15, 2024

I guess this is a question of what is meant by "data". It could be application data (my interpretation in #1951), or more generally data that appears on the wire. Probably the latter makes the most sense, in retrospect?

@VladimirBramstedt
Copy link

VladimirBramstedt commented May 15, 2024

my interpretation is that data = any bytes after close_notify has been received, regardless of if its a valid ApplicationData frame, or random bytes, as you are not supposed to try and read and of it... i think.

@djc
Copy link
Member Author

djc commented May 15, 2024

Yeah, I think dropping any data that was read after a CloseNotify probably makes sense.

@VladimirBramstedt
Copy link

we could take a peek at what other implementations (openssl?) deal with this, maybe theres prior art.

@VladimirBramstedt
Copy link

im not sure im looking at the right place, but https://github.com/openssl/openssl/blob/master/ssl/record/rec_layer_s3.c#L970 seems to only deal with application data after close notify, but that seems to send fatal alert if that happens...
i dont know enough about this to speak with certainty about the right course of action, but i felt itd be wrong of me to not at least ask what option is correct...

@djc
Copy link
Member Author

djc commented May 15, 2024

@ctz do you want to pronounce on whether the case of junk after CloseNotify is Ok(..) or Err(..)?

@ctz
Copy link
Member

ctz commented May 15, 2024

I think we should ignore the data after the close notify, and return an EOF as if it didn't exist. I'll update the test to that effect in the morning. @VladimirBramstedt are you in a position to see how your application behaves with this branch as it currently stands?

@VladimirBramstedt
Copy link

VladimirBramstedt commented May 15, 2024

i think it should be possible, i'll have to look tomorrow morning (UTC+2) ish.
@ctz just to clarify, "as it currently stands" means without #1951 and with this branch returning error rather than EOF?

rustls/src/conn.rs Show resolved Hide resolved
@djc djc changed the title Yield error after receiving CloseNotify with trailer Ignore data appearing after close_notify May 16, 2024
@djc
Copy link
Member Author

djc commented May 16, 2024

LGTM. I think we'll probably want a release for this? Maybe also for 0.21/0.22?

@VladimirBramstedt
Copy link

tested this out, seems to help, no more excessive wakeups. 👍

@ctz
Copy link
Member

ctz commented May 16, 2024

Great -- thank you for checking that!

Copy link
Member

@ctz ctz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(fwiw)

@ctz ctz added this pull request to the merge queue May 16, 2024
Merged via the queue into main with commit 55890f0 May 16, 2024
46 checks passed
@ctz ctz deleted the pending-tls branch May 16, 2024 12:48
This was referenced May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite wakeup loop issue in version 0.23 and onwards
3 participants