Codebase list openssl / 57d7b98
Test that we can handle a PHA CertificateRequest after we sent close_notify Even though we already sent close_notify the server may not have recieved it yet and could issue a CertificateRequest to us. Since we've already sent close_notify we can't send any reasonable response so we just ignore it. Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7114) Matt Caswell 5 years ago
1 changed file(s) with 25 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
53425342 * Test 3: TLSv1.3, pending NewSessionTicket messages
53435343 * Test 4: TLSv1.3, server continues to read/write after client shutdown, server
53445344 * sends key update, client reads it
5345 * Test 5: TLSv1.3, server continues to read/write after client shutdown, client
5345 * Test 5: TLSv1.3, server continues to read/write after client shutdown, server
5346 * sends CertificateRequest, client reads and ignores it
5347 * Test 6: TLSv1.3, server continues to read/write after client shutdown, client
53465348 * doesn't read it
53475349 */
53485350 static int test_shutdown(int tst)
53695371 TLS1_VERSION,
53705372 (tst <= 1) ? TLS1_2_VERSION
53715373 : TLS1_3_VERSION,
5372 &sctx, &cctx, cert, privkey))
5373 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl,
5374 &sctx, &cctx, cert, privkey)))
5375 goto end;
5376
5377 if (tst == 5)
5378 SSL_CTX_set_post_handshake_auth(cctx, 1);
5379
5380 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl,
53745381 NULL, NULL)))
53755382 goto end;
53765383
54065413 */
54075414 || !TEST_true(SSL_write(serverssl, msg, sizeof(msg))))
54085415 goto end;
5409 if (tst == 4 &&
5410 (!TEST_true(SSL_key_update(serverssl, SSL_KEY_UPDATE_REQUESTED))
5411 || !TEST_true(SSL_write(serverssl, msg, sizeof(msg)))))
5416 if (tst == 4
5417 && !TEST_true(SSL_key_update(serverssl,
5418 SSL_KEY_UPDATE_REQUESTED)))
5419 goto end;
5420 if (tst == 5) {
5421 SSL_set_verify(serverssl, SSL_VERIFY_PEER, NULL);
5422 if (!TEST_true(SSL_verify_client_post_handshake(serverssl)))
5423 goto end;
5424 }
5425 if ((tst == 4 || tst == 5)
5426 && !TEST_true(SSL_write(serverssl, msg, sizeof(msg))))
54125427 goto end;
54135428 if (!TEST_int_eq(SSL_shutdown(serverssl), 1))
54145429 goto end;
5415 if (tst == 4) {
5430 if (tst == 4 || tst == 5) {
54165431 /* Should still be able to read data from server */
54175432 if (!TEST_true(SSL_read_ex(clientssl, buf, sizeof(buf),
54185433 &readbytes))
54475462 || !TEST_true(SSL_SESSION_is_resumable(sess))
54485463 || !TEST_int_eq(SSL_shutdown(serverssl), 1))
54495464 goto end;
5450 } else if (tst == 4) {
5465 } else if (tst == 4 || tst == 5) {
54515466 /*
54525467 * In this test the client has sent close_notify and it has been
54535468 * received by the server which has responded with a close_notify. The
54595474 goto end;
54605475 } else {
54615476 /*
5462 * tst == 5
5477 * tst == 6
54635478 *
54645479 * The client has sent close_notify and is expecting a close_notify
54655480 * back, but instead there is application data first. The shutdown
55825597 ADD_ALL_TESTS(test_ssl_pending, 2);
55835598 ADD_ALL_TESTS(test_ssl_get_shared_ciphers, OSSL_NELEM(shared_ciphers_data));
55845599 ADD_ALL_TESTS(test_ticket_callbacks, 12);
5585 ADD_ALL_TESTS(test_shutdown, 6);
5600 ADD_ALL_TESTS(test_shutdown, 7);
55865601 return 1;
55875602 }
55885603