Lines Matching refs:serverssl
351 SSL *clientssl = NULL, *serverssl = NULL; in test_keylog() local
390 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_keylog()
392 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_keylog()
412 if (!TEST_true(test_keylog_output(server_log_buffer, serverssl, in test_keylog()
413 SSL_get_session(serverssl), &expected))) in test_keylog()
419 SSL_free(serverssl); in test_keylog()
432 SSL *clientssl = NULL, *serverssl = NULL; in test_keylog_no_master_key() local
469 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_keylog_no_master_key()
471 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_keylog_no_master_key()
488 || !TEST_true(test_keylog_output(server_log_buffer, serverssl, in test_keylog_no_master_key()
489 SSL_get_session(serverssl), in test_keylog_no_master_key()
496 SSL_shutdown(serverssl); in test_keylog_no_master_key()
497 SSL_free(serverssl); in test_keylog_no_master_key()
499 serverssl = clientssl = NULL; in test_keylog_no_master_key()
507 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_keylog_no_master_key()
512 || !TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_keylog_no_master_key()
515 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in test_keylog_no_master_key()
517 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_keylog_no_master_key()
527 || !TEST_true(test_keylog_output(server_log_buffer, serverssl, in test_keylog_no_master_key()
528 SSL_get_session(serverssl), in test_keylog_no_master_key()
536 SSL_free(serverssl); in test_keylog_no_master_key()
575 SSL *clientssl = NULL, *serverssl = NULL; in test_client_cert_verify_cb() local
591 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_client_cert_verify_cb()
596 if (!TEST_false(create_ssl_connection(serverssl, clientssl, in test_client_cert_verify_cb()
614 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_client_cert_verify_cb()
627 if (serverssl != NULL) { in test_client_cert_verify_cb()
628 SSL_shutdown(serverssl); in test_client_cert_verify_cb()
629 SSL_free(serverssl); in test_client_cert_verify_cb()
755 SSL *clientssl = NULL, *serverssl = NULL; in test_client_hello_cb() local
769 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_client_hello_cb()
771 || !TEST_false(create_ssl_connection(serverssl, clientssl, in test_client_hello_cb()
777 || !TEST_int_eq(SSL_get_error(serverssl, -1), in test_client_hello_cb()
779 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_client_hello_cb()
786 SSL_free(serverssl); in test_client_hello_cb()
797 SSL *clientssl = NULL, *serverssl = NULL; in test_no_ems() local
809 if (!create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, NULL)) { in test_no_ems()
814 status = create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE); in test_no_ems()
825 if (SSL_get_extms_support(serverssl)) { in test_no_ems()
837 SSL_free(serverssl); in test_no_ems()
854 SSL *clientssl = NULL, *serverssl = NULL; in test_ccs_change_cipher() local
870 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ccs_change_cipher()
873 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ccs_change_cipher()
875 || !TEST_ptr(sesspre = SSL_get0_session(serverssl)) in test_ccs_change_cipher()
879 shutdown_ssl_connection(serverssl, clientssl); in test_ccs_change_cipher()
880 serverssl = clientssl = NULL; in test_ccs_change_cipher()
884 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ccs_change_cipher()
888 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ccs_change_cipher()
891 || !TEST_true(SSL_session_reused(serverssl)) in test_ccs_change_cipher()
892 || !TEST_ptr(sesspost = SSL_get0_session(serverssl)) in test_ccs_change_cipher()
897 shutdown_ssl_connection(serverssl, clientssl); in test_ccs_change_cipher()
898 serverssl = clientssl = NULL; in test_ccs_change_cipher()
904 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ccs_change_cipher()
907 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ccs_change_cipher()
909 || !TEST_ptr(sesspre = SSL_get0_session(serverssl)) in test_ccs_change_cipher()
923 if (SSL_read_ex(serverssl, &buf, sizeof(buf), &readbytes) > 0) { in test_ccs_change_cipher()
926 } else if (!TEST_int_eq(SSL_get_error(serverssl, 0), in test_ccs_change_cipher()
934 || !TEST_false(SSL_session_reused(serverssl)) in test_ccs_change_cipher()
935 || !TEST_ptr(sesspost = SSL_get0_session(serverssl)) in test_ccs_change_cipher()
941 shutdown_ssl_connection(serverssl, clientssl); in test_ccs_change_cipher()
942 serverssl = clientssl = NULL; in test_ccs_change_cipher()
947 SSL_free(serverssl); in test_ccs_change_cipher()
963 SSL *clientssl = NULL, *serverssl = NULL; in execute_test_large_message() local
995 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in execute_test_large_message()
997 || !TEST_true(create_ssl_connection(serverssl, clientssl, in execute_test_large_message()
1005 if (!TEST_true(SSL_clear(serverssl))) in execute_test_large_message()
1010 SSL_free(serverssl); in execute_test_large_message()
1028 static int ping_pong_query(SSL *clientssl, SSL *serverssl) in ping_pong_query() argument
1045 || !TEST_ptr(serversc = SSL_CONNECTION_FROM_SSL_ONLY(serverssl))) in ping_pong_query()
1057 while ((err = SSL_read(serverssl, &sbuf, sizeof(sbuf))) != sizeof(sbuf)) { in ping_pong_query()
1058 if (SSL_get_error(serverssl, err) != SSL_ERROR_WANT_READ) { in ping_pong_query()
1063 if (!TEST_true(SSL_write(serverssl, sbuf, sizeof(sbuf)) == sizeof(sbuf))) in ping_pong_query()
1134 SSL *clientssl = NULL, *serverssl = NULL; in execute_test_ktls() local
1175 if (!TEST_true(create_ssl_objects2(sctx, cctx, &serverssl, in execute_test_ktls()
1180 || !TEST_ptr(serversc = SSL_CONNECTION_FROM_SSL_ONLY(serverssl))) in execute_test_ktls()
1189 if (!TEST_true(SSL_set_options(serverssl, SSL_OP_ENABLE_KTLS))) in execute_test_ktls()
1193 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in execute_test_ktls()
1245 if (!TEST_true(ping_pong_query(clientssl, serverssl))) in execute_test_ktls()
1263 ret = SSL_read(serverssl, buf + offset, bufsz - offset); in execute_test_ktls()
1265 if (!TEST_true(SSL_get_error(serverssl, ret) == SSL_ERROR_WANT_READ)) in execute_test_ktls()
1285 if (serverssl) { in execute_test_ktls()
1286 SSL_shutdown(serverssl); in execute_test_ktls()
1287 SSL_free(serverssl); in execute_test_ktls()
1291 serverssl = clientssl = NULL; in execute_test_ktls()
1307 SSL *clientssl = NULL, *serverssl = NULL; in execute_test_ktls_sendfile() local
1351 if (!TEST_true(create_ssl_objects2(sctx, cctx, &serverssl, in execute_test_ktls_sendfile()
1355 if (!TEST_ptr(serversc = SSL_CONNECTION_FROM_SSL_ONLY(serverssl))) in execute_test_ktls_sendfile()
1358 if (!TEST_true(SSL_set_options(serverssl, SSL_OP_ENABLE_KTLS))) in execute_test_ktls_sendfile()
1362 if (!TEST_true(SSL_set_options(serverssl, in execute_test_ktls_sendfile()
1367 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in execute_test_ktls_sendfile()
1396 while ((err = SSL_sendfile(serverssl, in execute_test_ktls_sendfile()
1401 if (SSL_get_error(serverssl, err) != SSL_ERROR_WANT_WRITE) in execute_test_ktls_sendfile()
1427 if (serverssl) { in execute_test_ktls_sendfile()
1428 SSL_shutdown(serverssl); in execute_test_ktls_sendfile()
1429 SSL_free(serverssl); in execute_test_ktls_sendfile()
1433 serverssl = clientssl = NULL; in execute_test_ktls_sendfile()
1552 SSL *clientssl = NULL, *serverssl = NULL; in test_large_app_data() local
1653 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_large_app_data()
1659 if (!TEST_true(SSL_set_options(serverssl, in test_large_app_data()
1671 if (!TEST_true(SSL_set_options(serverssl, SSL_OP_NO_ENCRYPT_THEN_MAC)) in test_large_app_data()
1677 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_large_app_data()
1686 if (!TEST_true(SSL_read_ex(serverssl, buf, SSL3_RT_MAX_PLAIN_LENGTH + 1, in test_large_app_data()
1697 SSL_free(serverssl); in test_large_app_data()
1712 SSL *clientssl = NULL, *serverssl = NULL; in execute_cleanse_plaintext() local
1746 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in execute_cleanse_plaintext()
1750 if (!TEST_true(SSL_set_options(serverssl, SSL_OP_CLEANSE_PLAINTEXT))) in execute_cleanse_plaintext()
1753 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in execute_cleanse_plaintext()
1764 if (!TEST_int_eq(SSL_peek(serverssl, &sbuf, sizeof(sbuf)), sizeof(sbuf))) in execute_cleanse_plaintext()
1775 if (!TEST_ptr(serversc = SSL_CONNECTION_FROM_SSL_ONLY(serverssl))) in execute_cleanse_plaintext()
1791 if (!TEST_int_eq(SSL_read(serverssl, &sbuf, sizeof(sbuf)), sizeof(sbuf))) in execute_cleanse_plaintext()
1804 SSL_free(serverssl); in execute_cleanse_plaintext()
1899 SSL *clientssl = NULL, *serverssl = NULL; in test_tlsext_status_type() local
1948 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_tlsext_status_type()
1950 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_tlsext_status_type()
1955 SSL_free(serverssl); in test_tlsext_status_type()
1957 serverssl = NULL; in test_tlsext_status_type()
1964 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_tlsext_status_type()
1967 || !TEST_false(create_ssl_connection(serverssl, clientssl, in test_tlsext_status_type()
1972 SSL_free(serverssl); in test_tlsext_status_type()
1974 serverssl = NULL; in test_tlsext_status_type()
1984 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_tlsext_status_type()
2008 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_tlsext_status_type()
2017 SSL_free(serverssl); in test_tlsext_status_type()
2493 SSL *serverssl = NULL, *clientssl = NULL; in check_resumption() local
2499 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in check_resumption()
2506 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in check_resumption()
2527 && (!post_handshake_verify(serverssl, clientssl) in check_resumption()
2532 SSL_shutdown(serverssl); in check_resumption()
2533 SSL_free(serverssl); in check_resumption()
2535 serverssl = clientssl = NULL; in check_resumption()
2544 SSL_free(serverssl); in check_resumption()
2551 SSL *serverssl = NULL, *clientssl = NULL; in test_tickets() local
2563 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_tickets()
2567 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_tickets()
2574 SSL_shutdown(serverssl); in test_tickets()
2575 SSL_free(serverssl); in test_tickets()
2579 clientssl = serverssl = NULL; in test_tickets()
2607 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_tickets()
2613 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_tickets()
2620 if (!post_handshake_verify(serverssl, clientssl) in test_tickets()
2625 SSL_shutdown(serverssl); in test_tickets()
2626 SSL_free(serverssl); in test_tickets()
2628 serverssl = clientssl = NULL; in test_tickets()
2643 SSL_free(serverssl); in test_tickets()
2668 SSL *serverssl = NULL, *clientssl = NULL; in test_psk_tickets() local
2690 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_psk_tickets()
2698 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_psk_tickets()
2709 SSL_free(serverssl); in test_psk_tickets()
2723 SSL *serverssl = NULL, *clientssl = NULL; in test_extra_tickets() local
2745 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_extra_tickets()
2753 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_extra_tickets()
2757 || !TEST_true(SSL_new_session_ticket(serverssl)) in test_extra_tickets()
2758 || !TEST_true(SSL_new_session_ticket(serverssl)) in test_extra_tickets()
2764 if (!TEST_true(SSL_write_ex(serverssl, &c, 1, &nbytes)) in test_extra_tickets()
2777 if (!TEST_true(SSL_new_session_ticket(serverssl)) in test_extra_tickets()
2778 || !TEST_true(SSL_write_ex(serverssl, &c, sizeof(c), &nbytes)) in test_extra_tickets()
2790 if (!TEST_true(SSL_new_session_ticket(serverssl)) in test_extra_tickets()
2791 || !TEST_true(SSL_new_session_ticket(serverssl)) in test_extra_tickets()
2792 || !TEST_true(SSL_write_ex(serverssl, &c, 0, &nbytes)) in test_extra_tickets()
2802 if (!TEST_true(SSL_new_session_ticket(serverssl)) in test_extra_tickets()
2803 || !TEST_true(SSL_new_session_ticket(serverssl)) in test_extra_tickets()
2804 || !TEST_true(SSL_do_handshake(serverssl)) in test_extra_tickets()
2816 tmp = SSL_get_wbio(serverssl); in test_extra_tickets()
2821 SSL_set0_wbio(serverssl, bretry); in test_extra_tickets()
2823 if (!TEST_false(SSL_write_ex(serverssl, &c, 1, &nbytes)) in test_extra_tickets()
2824 || !TEST_int_eq(SSL_get_error(serverssl, 0), SSL_ERROR_WANT_WRITE) in test_extra_tickets()
2828 SSL_set0_wbio(serverssl, tmp); in test_extra_tickets()
2834 if (!TEST_true(SSL_new_session_ticket(serverssl)) in test_extra_tickets()
2835 || !TEST_true(SSL_new_session_ticket(serverssl)) in test_extra_tickets()
2837 || !TEST_true(SSL_do_handshake(serverssl)) in test_extra_tickets()
2841 if (!TEST_true(SSL_write_ex(serverssl, &c, 1, &nbytes)) in test_extra_tickets()
2851 if (!TEST_true(SSL_do_handshake(serverssl)) in test_extra_tickets()
2856 if (!TEST_true(SSL_write_ex(serverssl, &c, 1, &nbytes)) in test_extra_tickets()
2867 SSL_shutdown(serverssl); in test_extra_tickets()
2873 SSL_free(serverssl); in test_extra_tickets()
2877 clientssl = serverssl = NULL; in test_extra_tickets()
2937 SSL *serverssl = NULL, *clientssl = NULL; in test_ssl_set_bio() local
2976 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ssl_set_bio()
3013 && !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ssl_set_bio()
3048 SSL_free(serverssl); in test_ssl_set_bio()
3173 SSL *clientssl = NULL, *serverssl = NULL; in test_set_sigalgs() local
3214 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_set_sigalgs()
3236 if (!TEST_int_eq(create_ssl_connection(serverssl, clientssl, in test_set_sigalgs()
3244 SSL_free(serverssl); in test_set_sigalgs()
3416 SSL **serverssl, SSL_SESSION **sess, int idx, in setupearly_data_test() argument
3447 if (!TEST_true(create_ssl_objects(*sctx, *cctx, serverssl, clientssl, in setupearly_data_test()
3492 if (!TEST_true(create_ssl_connection(*serverssl, *clientssl, in setupearly_data_test()
3498 SSL_shutdown(*serverssl); in setupearly_data_test()
3499 SSL_free(*serverssl); in setupearly_data_test()
3501 *serverssl = *clientssl = NULL; in setupearly_data_test()
3511 if (!TEST_true(create_ssl_objects(*sctx, *cctx, serverssl, in setupearly_data_test()
3541 SSL *clientssl = NULL, *serverssl = NULL; in test_early_data_read_write() local
3553 &serverssl, &sess, idx, in test_early_data_read_write()
3567 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_read_write()
3575 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in test_early_data_read_write()
3583 if (!TEST_true(SSL_write_early_data(serverssl, MSG2, strlen(MSG2), in test_early_data_read_write()
3597 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_read_write()
3604 if (!TEST_true(SSL_write_early_data(serverssl, MSG4, strlen(MSG4), in test_early_data_read_write()
3627 rbio = SSL_get_rbio(serverssl); in test_early_data_read_write()
3640 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_read_write()
3650 if (!TEST_true(SSL_write_early_data(serverssl, MSG6, strlen(MSG6), in test_early_data_read_write()
3662 if (!TEST_true(SSL_read_ex(serverssl, buf, sizeof(buf), &readbytes)) in test_early_data_read_write()
3671 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_read_write()
3693 if (!TEST_true(SSL_write_ex(serverssl, MSG7, strlen(MSG7), &written)) in test_early_data_read_write()
3705 SSL_shutdown(serverssl); in test_early_data_read_write()
3706 SSL_free(serverssl); in test_early_data_read_write()
3708 serverssl = clientssl = NULL; in test_early_data_read_write()
3709 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_early_data_read_write()
3718 || !TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_read_write()
3725 || !TEST_int_gt(SSL_accept(serverssl), 0)) in test_early_data_read_write()
3733 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_read_write()
3742 || !TEST_true(SSL_read_ex(serverssl, buf, sizeof(buf), &readbytes)) in test_early_data_read_write()
3753 SSL_free(serverssl); in test_early_data_read_write()
3786 SSL *clientssl = NULL, *serverssl = NULL; in test_early_data_replay_int() local
3822 &serverssl, &sess, idx, in test_early_data_replay_int()
3830 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) in test_early_data_replay_int()
3835 SSL_shutdown(serverssl); in test_early_data_replay_int()
3836 SSL_free(serverssl); in test_early_data_replay_int()
3838 serverssl = clientssl = NULL; in test_early_data_replay_int()
3840 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_early_data_replay_int()
3853 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_replay_int()
3860 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in test_early_data_replay_int()
3865 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_replay_int()
3877 || !TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_replay_int()
3880 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in test_early_data_replay_int()
3886 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) in test_early_data_replay_int()
3898 SSL_free(serverssl); in test_early_data_replay_int()
3944 SSL *clientssl = NULL, *serverssl = NULL; in early_data_skip_helper() local
3972 &serverssl, &sess, idx, in early_data_skip_helper()
3981 if (!TEST_true(SSL_set1_groups_list(serverssl, "ffdhe3072"))) in early_data_skip_helper()
3984 if (!TEST_true(SSL_set1_groups_list(serverssl, "P-384"))) in early_data_skip_helper()
4004 && !TEST_true(SSL_set_recv_max_early_data(serverssl, 0))) in early_data_skip_helper()
4014 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in early_data_skip_helper()
4018 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in early_data_skip_helper()
4034 || !TEST_false(SSL_read_ex(serverssl, buf, sizeof(buf), in early_data_skip_helper()
4072 if (!TEST_false(SSL_read_ex(serverssl, buf, sizeof(buf), &readbytes)) in early_data_skip_helper()
4073 || !TEST_int_eq(SSL_get_error(serverssl, 0), SSL_ERROR_SSL)) in early_data_skip_helper()
4094 || !TEST_true(SSL_read_ex(serverssl, buf, sizeof(buf), &readbytes)) in early_data_skip_helper()
4112 SSL_free(serverssl); in early_data_skip_helper()
4171 SSL *clientssl = NULL, *serverssl = NULL; in test_early_data_not_sent() local
4178 &serverssl, &sess, idx, in test_early_data_not_sent()
4188 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_not_sent()
4192 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in test_early_data_not_sent()
4201 || !TEST_true(SSL_read_ex(serverssl, buf, sizeof(buf), &readbytes)) in test_early_data_not_sent()
4203 || !SSL_write_ex(serverssl, MSG2, strlen(MSG2), &written) in test_early_data_not_sent()
4218 SSL_free(serverssl); in test_early_data_not_sent()
4254 SSL *clientssl = NULL, *serverssl = NULL; in test_early_data_psk() local
4273 &serverssl, &sess, 2, in test_early_data_psk()
4404 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_psk()
4412 || !TEST_int_eq(SSL_get_early_data_status(serverssl), edstatus) in test_early_data_psk()
4424 SSL_free(serverssl); in test_early_data_psk()
4444 SSL *clientssl = NULL, *serverssl = NULL; in test_early_data_psk_with_all_ciphers() local
4499 &serverssl, &sess, 2, in test_early_data_psk_with_all_ciphers()
4509 SSL_set_security_level(serverssl, 0); in test_early_data_psk_with_all_ciphers()
4513 || !TEST_true(SSL_set_ciphersuites(serverssl, cipher_str[idx]))) in test_early_data_psk_with_all_ciphers()
4533 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_psk_with_all_ciphers()
4541 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in test_early_data_psk_with_all_ciphers()
4544 || !TEST_int_eq(SSL_accept(serverssl), 1)) in test_early_data_psk_with_all_ciphers()
4552 if (!TEST_true(SSL_read_ex(serverssl, buf, sizeof(buf), &readbytes)) in test_early_data_psk_with_all_ciphers()
4564 if (serverssl != NULL) in test_early_data_psk_with_all_ciphers()
4565 SSL_shutdown(serverssl); in test_early_data_psk_with_all_ciphers()
4566 SSL_free(serverssl); in test_early_data_psk_with_all_ciphers()
4580 SSL *clientssl = NULL, *serverssl = NULL; in test_early_data_not_expected() local
4587 &serverssl, &sess, idx, in test_early_data_not_expected()
4600 if (!TEST_int_le(SSL_accept(serverssl), 0) in test_early_data_not_expected()
4602 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in test_early_data_not_expected()
4604 || !TEST_int_gt(SSL_accept(serverssl), 0) in test_early_data_not_expected()
4614 if (!TEST_true(SSL_read_ex(serverssl, buf, sizeof(buf), &readbytes)) in test_early_data_not_expected()
4625 SSL_free(serverssl); in test_early_data_not_expected()
4641 SSL *clientssl = NULL, *serverssl = NULL; in test_early_data_tls1_2() local
4647 &serverssl, NULL, idx, in test_early_data_tls1_2()
4662 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_tls1_2()
4672 || !TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_early_data_tls1_2()
4676 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in test_early_data_tls1_2()
4685 || !TEST_true(SSL_read_ex(serverssl, buf, sizeof(buf), &readbytes)) in test_early_data_tls1_2()
4687 || !TEST_true(SSL_write_ex(serverssl, MSG2, strlen(MSG2), &written)) in test_early_data_tls1_2()
4699 SSL_free(serverssl); in test_early_data_tls1_2()
4725 SSL *clientssl = NULL, *serverssl = NULL; in test_set_ciphersuite() local
4753 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_set_ciphersuite()
4775 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_set_ciphersuite()
4781 SSL_free(serverssl); in test_set_ciphersuite()
4792 SSL *clientssl = NULL, *serverssl = NULL; in test_ciphersuite_change() local
4809 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ciphersuite_change()
4811 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ciphersuite_change()
4819 SSL_shutdown(serverssl); in test_ciphersuite_change()
4820 SSL_free(serverssl); in test_ciphersuite_change()
4822 serverssl = clientssl = NULL; in test_ciphersuite_change()
4827 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_ciphersuite_change()
4830 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ciphersuite_change()
4838 SSL_shutdown(serverssl); in test_ciphersuite_change()
4839 SSL_free(serverssl); in test_ciphersuite_change()
4841 serverssl = clientssl = NULL; in test_ciphersuite_change()
4848 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ciphersuite_change()
4851 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ciphersuite_change()
4859 SSL_shutdown(serverssl); in test_ciphersuite_change()
4860 SSL_free(serverssl); in test_ciphersuite_change()
4862 serverssl = clientssl = NULL; in test_ciphersuite_change()
4866 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_ciphersuite_change()
4868 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ciphersuite_change()
4874 SSL_shutdown(serverssl); in test_ciphersuite_change()
4875 SSL_free(serverssl); in test_ciphersuite_change()
4877 serverssl = clientssl = NULL; in test_ciphersuite_change()
4883 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ciphersuite_change()
4891 || !TEST_false(create_ssl_connection(serverssl, clientssl, in test_ciphersuite_change()
4904 if (!TEST_false(create_ssl_connection(serverssl, clientssl, in test_ciphersuite_change()
4914 SSL_free(serverssl); in test_ciphersuite_change()
4954 SSL *serverssl = NULL, *clientssl = NULL; in test_key_exchange() local
5070 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_key_exchange()
5074 if (!TEST_true(SSL_set1_groups(serverssl, kexch_groups, kexch_groups_size)) in test_key_exchange()
5078 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_key_exchange()
5086 if (!TEST_int_eq(SSL_get_shared_group(serverssl, 0), in test_key_exchange()
5090 if (!TEST_str_eq(SSL_group_to_name(serverssl, kexch_groups[0]), in test_key_exchange()
5096 if (!TEST_str_eq(SSL_get0_group_name(serverssl), kexch_name0) in test_key_exchange()
5099 if (!TEST_int_eq(SSL_get_negotiated_group(serverssl), kexch_groups[0])) in test_key_exchange()
5107 SSL_free(serverssl); in test_key_exchange()
5117 static int set_ssl_groups(SSL *serverssl, SSL *clientssl, int clientmulti, in set_ssl_groups() argument
5132 if (!TEST_true(SSL_set1_groups(serverssl, kexch_groups, 1))) in set_ssl_groups()
5147 if (!TEST_true(SSL_set1_groups(serverssl, ecdhe_kexch_groups, in set_ssl_groups()
5151 if (!TEST_true(SSL_set1_groups(serverssl, ffdhe_kexch_groups, in set_ssl_groups()
5187 SSL *serverssl = NULL, *clientssl = NULL; in test_negotiated_group() local
5240 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_negotiated_group()
5244 if (!TEST_true(set_ssl_groups(serverssl, clientssl, clientmulti, isecdhe, in test_negotiated_group()
5248 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_negotiated_group()
5253 || !TEST_uint_eq(SSL_get_negotiated_group(serverssl), expectednid)) in test_negotiated_group()
5260 SSL_shutdown(serverssl); in test_negotiated_group()
5261 SSL_free(serverssl); in test_negotiated_group()
5263 serverssl = clientssl = NULL; in test_negotiated_group()
5266 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_negotiated_group()
5269 || !TEST_true(set_ssl_groups(serverssl, clientssl, clientmulti, in test_negotiated_group()
5273 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) in test_negotiated_group()
5279 || !TEST_uint_eq(SSL_get_negotiated_group(serverssl), expectednid)) in test_negotiated_group()
5283 SSL_shutdown(serverssl); in test_negotiated_group()
5284 SSL_free(serverssl); in test_negotiated_group()
5286 serverssl = clientssl = NULL; in test_negotiated_group()
5312 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_negotiated_group()
5315 || !TEST_true(set_ssl_groups(serverssl, clientssl, clientmulti, in test_negotiated_group()
5319 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) in test_negotiated_group()
5325 || !TEST_uint_eq(SSL_get_negotiated_group(serverssl), expectednid)) in test_negotiated_group()
5330 SSL_free(serverssl); in test_negotiated_group()
5349 SSL *serverssl = NULL, *clientssl = NULL; in test_tls13_ciphersuite() local
5431 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_tls13_ciphersuite()
5436 if (!TEST_true(SSL_set_ciphersuites(serverssl, t13_cipher)) in test_tls13_ciphersuite()
5440 if (!TEST_true(SSL_set_cipher_list(serverssl, t12_cipher)) in test_tls13_ciphersuite()
5447 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_tls13_ciphersuite()
5452 serverssl)); in test_tls13_ciphersuite()
5474 SSL_free(serverssl); in test_tls13_ciphersuite()
5475 serverssl = NULL; in test_tls13_ciphersuite()
5487 SSL_free(serverssl); in test_tls13_ciphersuite()
5504 SSL *serverssl = NULL, *clientssl = NULL; in test_tls13_psk() local
5568 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_tls13_psk()
5570 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_tls13_psk()
5573 || !TEST_false(SSL_session_reused(serverssl))) in test_tls13_psk()
5594 shutdown_ssl_connection(serverssl, clientssl); in test_tls13_psk()
5595 serverssl = clientssl = NULL; in test_tls13_psk()
5599 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_tls13_psk()
5618 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) in test_tls13_psk()
5620 || !TEST_true(SSL_session_reused(serverssl))) in test_tls13_psk()
5637 shutdown_ssl_connection(serverssl, clientssl); in test_tls13_psk()
5638 serverssl = clientssl = NULL; in test_tls13_psk()
5642 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_tls13_psk()
5648 if (!TEST_true(SSL_set1_groups_list(serverssl, "ffdhe3072"))) in test_tls13_psk()
5651 if (!TEST_true(SSL_set1_groups_list(serverssl, "P-384"))) in test_tls13_psk()
5659 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)) in test_tls13_psk()
5661 || !TEST_true(SSL_session_reused(serverssl))) in test_tls13_psk()
5678 shutdown_ssl_connection(serverssl, clientssl); in test_tls13_psk()
5679 serverssl = clientssl = NULL; in test_tls13_psk()
5689 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_tls13_psk()
5691 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_tls13_psk()
5694 || !TEST_false(SSL_session_reused(serverssl))) in test_tls13_psk()
5715 shutdown_ssl_connection(serverssl, clientssl); in test_tls13_psk()
5716 serverssl = clientssl = NULL; in test_tls13_psk()
5724 SSL_free(serverssl); in test_tls13_psk()
5745 SSL *serverssl = NULL, *clientssl = NULL; in test_tls13_no_dhe_kex() local
5777 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_tls13_no_dhe_kex()
5781 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_tls13_no_dhe_kex()
5791 SSL_shutdown(serverssl); in test_tls13_no_dhe_kex()
5792 SSL_free(serverssl); in test_tls13_no_dhe_kex()
5795 clientssl = serverssl = NULL; in test_tls13_no_dhe_kex()
5810 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_tls13_no_dhe_kex()
5815 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_tls13_no_dhe_kex()
5826 SSL_shutdown(serverssl); in test_tls13_no_dhe_kex()
5831 SSL_free(serverssl); in test_tls13_no_dhe_kex()
5887 SSL *serverssl = NULL, *clientssl = NULL; in test_stateless() local
5898 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_stateless()
5901 || !TEST_false(create_ssl_connection(serverssl, clientssl, in test_stateless()
5907 || !TEST_int_eq(SSL_stateless(serverssl), -1)) in test_stateless()
5922 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_stateless()
5925 || !TEST_false(create_ssl_connection(serverssl, clientssl, in test_stateless()
5928 || !TEST_int_eq(SSL_stateless(serverssl), 0)) in test_stateless()
5939 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_stateless()
5942 || !TEST_false(create_ssl_connection(serverssl, clientssl, in test_stateless()
5945 || !TEST_int_eq(SSL_stateless(serverssl), 0) in test_stateless()
5947 || !TEST_false(create_ssl_connection(serverssl, clientssl, in test_stateless()
5950 || !TEST_int_eq(SSL_stateless(serverssl), 1) in test_stateless()
5952 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_stateless()
5956 shutdown_ssl_connection(serverssl, clientssl); in test_stateless()
5957 serverssl = clientssl = NULL; in test_stateless()
5961 SSL_free(serverssl); in test_stateless()
6102 SSL *clientssl = NULL, *serverssl = NULL; in test_custom_exts() local
6227 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_custom_exts()
6229 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_custom_exts()
6264 SSL_shutdown(serverssl); in test_custom_exts()
6265 SSL_free(serverssl); in test_custom_exts()
6267 serverssl = clientssl = NULL; in test_custom_exts()
6275 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_custom_exts()
6278 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_custom_exts()
6316 SSL_free(serverssl); in test_custom_exts()
6372 SSL *clientssl = NULL, *serverssl = NULL; in test_serverinfo_custom() local
6435 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_serverinfo_custom()
6437 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_serverinfo_custom()
6448 SSL_free(serverssl); in test_serverinfo_custom()
6468 SSL *clientssl = NULL, *serverssl = NULL; in test_export_key_mat() local
6517 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, in test_export_key_mat()
6530 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_export_key_mat()
6576 || !TEST_int_eq(SSL_export_keying_material(serverssl, skeymat1, in test_export_key_mat()
6582 || !TEST_int_eq(SSL_export_keying_material(serverssl, skeymat2, in test_export_key_mat()
6587 || !TEST_int_eq(SSL_export_keying_material(serverssl, skeymat3, in test_export_key_mat()
6592 && !TEST_int_eq(SSL_export_keying_material(serverssl, skeymat4, in test_export_key_mat()
6641 SSL_free(serverssl); in test_export_key_mat()
6663 SSL *clientssl = NULL, *serverssl = NULL; in test_export_key_mat_early() local
6671 if (!TEST_true(setupearly_data_test(&cctx, &sctx, &clientssl, &serverssl, in test_export_key_mat_early()
6677 || !TEST_int_eq(SSL_read_early_data(serverssl, buf, sizeof(buf), in test_export_key_mat_early()
6680 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in test_export_key_mat_early()
6691 serverssl, skeymat1, sizeof(skeymat1), label, in test_export_key_mat_early()
6694 serverssl, skeymat2, sizeof(skeymat2), label, in test_export_key_mat_early()
6720 SSL_free(serverssl); in test_export_key_mat_early()
6735 SSL *clientssl = NULL, *serverssl = NULL; in test_key_update() local
6745 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_key_update()
6747 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_key_update()
6764 || !TEST_int_eq(SSL_read(serverssl, buf, sizeof(buf)), in test_key_update()
6768 if (!TEST_int_eq(SSL_write(serverssl, mess, strlen(mess)), strlen(mess)) in test_key_update()
6777 SSL_free(serverssl); in test_key_update()
6794 SSL *clientssl = NULL, *serverssl = NULL; in test_key_update_peer_in_write() local
6808 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_key_update_peer_in_write()
6810 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_key_update_peer_in_write()
6814 peerupdate = tst == 0 ? clientssl : serverssl; in test_key_update_peer_in_write()
6815 peerwrite = tst == 0 ? serverssl : clientssl; in test_key_update_peer_in_write()
6869 SSL_free(serverssl); in test_key_update_peer_in_write()
6889 SSL *clientssl = NULL, *serverssl = NULL; in test_key_update_peer_in_read() local
6901 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_key_update_peer_in_read()
6903 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_key_update_peer_in_read()
6907 local = tst == 0 ? clientssl : serverssl; in test_key_update_peer_in_read()
6908 peer = tst == 0 ? serverssl : clientssl; in test_key_update_peer_in_read()
6955 SSL_free(serverssl); in test_key_update_peer_in_read()
6972 SSL *clientssl = NULL, *serverssl = NULL; in test_key_update_local_in_write() local
6986 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_key_update_local_in_write()
6988 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_key_update_local_in_write()
6992 local = tst == 0 ? clientssl : serverssl; in test_key_update_local_in_write()
6993 peer = tst == 0 ? serverssl : clientssl; in test_key_update_local_in_write()
7044 SSL_free(serverssl); in test_key_update_local_in_write()
7063 SSL *clientssl = NULL, *serverssl = NULL; in test_key_update_local_in_read() local
7075 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_key_update_local_in_read()
7077 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_key_update_local_in_read()
7081 local = tst == 0 ? clientssl : serverssl; in test_key_update_local_in_read()
7082 peer = tst == 0 ? serverssl : clientssl; in test_key_update_local_in_read()
7129 SSL_free(serverssl); in test_key_update_local_in_read()
7153 SSL *clientssl = NULL, *serverssl = NULL; in test_ssl_clear() local
7179 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_ssl_clear()
7181 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ssl_clear()
7187 reader = serverssl; in test_ssl_clear()
7189 writer = serverssl; in test_ssl_clear()
7207 SSL_shutdown(serverssl); in test_ssl_clear()
7212 if (!TEST_true(SSL_clear(serverssl))) in test_ssl_clear()
7215 SSL_set_accept_state(serverssl); in test_ssl_clear()
7227 if (!TEST_true(SSL_set_session(serverssl, NULL))) in test_ssl_clear()
7238 SSL_free(serverssl); in test_ssl_clear()
7239 serverssl = NULL; in test_ssl_clear()
7242 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ssl_clear()
7244 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ssl_clear()
7250 SSL_shutdown(serverssl); in test_ssl_clear()
7255 SSL_free(serverssl); in test_ssl_clear()
7379 SSL *clientssl = NULL, *serverssl = NULL; in test_pha_key_update() local
7395 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_pha_key_update()
7399 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_pha_key_update()
7403 SSL_set_verify(serverssl, SSL_VERIFY_PEER, NULL); in test_pha_key_update()
7404 if (!TEST_true(SSL_verify_client_post_handshake(serverssl))) in test_pha_key_update()
7411 if (!TEST_int_eq(SSL_do_handshake(serverssl), 1)) in test_pha_key_update()
7415 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_pha_key_update()
7420 SSL_shutdown(serverssl); in test_pha_key_update()
7425 SSL_free(serverssl); in test_pha_key_update()
7583 SSL *clientssl = NULL, *serverssl = NULL; in test_srp() local
7625 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_srp()
7629 ret = create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE); in test_srp()
7643 SSL_free(serverssl); in test_srp()
7837 SSL *clientssl = NULL, *serverssl = NULL; in test_info_callback() local
7872 &serverssl, &sess, 0, in test_info_callback()
7879 SSL_set_info_callback((tst % 2) == 0 ? serverssl : clientssl, in test_info_callback()
7889 if (!TEST_int_eq(SSL_read_early_data(serverssl, buf, in test_info_callback()
7897 || !TEST_int_eq(SSL_get_early_data_status(serverssl), in test_info_callback()
7899 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_info_callback()
7929 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_info_callback()
7931 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_info_callback()
7940 SSL_shutdown(serverssl); in test_info_callback()
7941 SSL_free(serverssl); in test_info_callback()
7943 serverssl = clientssl = NULL; in test_info_callback()
7946 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, in test_info_callback()
7949 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_info_callback()
7958 SSL_free(serverssl); in test_info_callback()
7969 SSL *clientssl = NULL, *serverssl = NULL; in test_ssl_pending() local
8009 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ssl_pending()
8011 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ssl_pending()
8017 || !TEST_int_eq(SSL_pending(serverssl), 0) in test_ssl_pending()
8018 || !TEST_false(SSL_has_pending(serverssl)) in test_ssl_pending()
8019 || !TEST_true(SSL_write_ex(serverssl, msg, sizeof(msg), &written)) in test_ssl_pending()
8030 SSL_free(serverssl); in test_ssl_pending()
8126 SSL *clientssl = NULL, *serverssl = NULL; in int_test_ssl_get_shared_ciphers() local
8171 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in int_test_ssl_get_shared_ciphers()
8173 || !TEST_true(create_ssl_connection(serverssl, clientssl, in int_test_ssl_get_shared_ciphers()
8177 if (!TEST_ptr(SSL_get_shared_ciphers(serverssl, buf, sizeof(buf))) in int_test_ssl_get_shared_ciphers()
8190 SSL_free(serverssl); in int_test_ssl_get_shared_ciphers()
8369 SSL *clientssl = NULL, *serverssl = NULL; in test_ticket_callbacks() local
8452 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ticket_callbacks()
8454 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ticket_callbacks()
8473 SSL_shutdown(serverssl); in test_ticket_callbacks()
8474 SSL_free(serverssl); in test_ticket_callbacks()
8476 serverssl = clientssl = NULL; in test_ticket_callbacks()
8479 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, in test_ticket_callbacks()
8482 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ticket_callbacks()
8509 SSL_free(serverssl); in test_ticket_callbacks()
8529 SSL *clientssl = NULL, *serverssl = NULL; in test_incorrect_shutdown() local
8542 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_incorrect_shutdown()
8546 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_incorrect_shutdown()
8550 c2s = SSL_get_rbio(serverssl); in test_incorrect_shutdown()
8553 if (!TEST_false(SSL_read(serverssl, buf, sizeof(buf)))) in test_incorrect_shutdown()
8556 if (tst == 0 && !TEST_int_eq(SSL_get_error(serverssl, 0), SSL_ERROR_SSL) ) in test_incorrect_shutdown()
8558 if (tst == 1 && !TEST_int_eq(SSL_get_error(serverssl, 0), SSL_ERROR_ZERO_RETURN) ) in test_incorrect_shutdown()
8564 SSL_free(serverssl); in test_incorrect_shutdown()
8588 SSL *clientssl = NULL, *serverssl = NULL; in test_shutdown() local
8615 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_shutdown()
8620 if (!TEST_true(create_bare_ssl_connection(serverssl, clientssl, in test_shutdown()
8625 } else if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_shutdown()
8640 if (!TEST_false(SSL_read_ex(serverssl, buf, sizeof(buf), &readbytes)) in test_shutdown()
8641 || !TEST_int_eq(SSL_get_error(serverssl, 0), in test_shutdown()
8643 || !TEST_int_eq(SSL_get_shutdown(serverssl), in test_shutdown()
8649 || !TEST_true(SSL_write(serverssl, msg, sizeof(msg)))) in test_shutdown()
8652 && !TEST_true(SSL_key_update(serverssl, in test_shutdown()
8656 SSL_set_verify(serverssl, SSL_VERIFY_PEER, NULL); in test_shutdown()
8657 if (!TEST_true(SSL_verify_client_post_handshake(serverssl))) in test_shutdown()
8661 && !TEST_true(SSL_write(serverssl, msg, sizeof(msg)))) in test_shutdown()
8663 if (!TEST_int_eq(SSL_shutdown(serverssl), 1)) in test_shutdown()
8689 if (!TEST_int_eq(SSL_shutdown(serverssl), 0) in test_shutdown()
8694 || !TEST_false(SSL_write_ex(serverssl, msg, sizeof(msg), &written)) in test_shutdown()
8698 || !TEST_int_eq(SSL_shutdown(serverssl), 1)) in test_shutdown()
8726 SSL_free(serverssl); in test_shutdown()
8741 SSL *clientssl = NULL, *serverssl = NULL; in test_async_shutdown() local
8754 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, in test_async_shutdown()
8758 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_async_shutdown()
8765 tmp = SSL_get_wbio(serverssl); in test_async_shutdown()
8770 SSL_set0_wbio(serverssl, bretry); in test_async_shutdown()
8774 if (!TEST_int_eq(SSL_shutdown(serverssl), -1) in test_async_shutdown()
8775 || !TEST_int_eq(SSL_get_error(serverssl, -1), SSL_ERROR_WANT_WRITE)) in test_async_shutdown()
8779 if (!TEST_int_eq(SSL_shutdown(serverssl), -1) in test_async_shutdown()
8780 || !TEST_int_eq(SSL_get_error(serverssl, -1), SSL_ERROR_WANT_WRITE)) in test_async_shutdown()
8783 SSL_set0_wbio(serverssl, tmp); in test_async_shutdown()
8787 if (!TEST_int_eq(SSL_shutdown(serverssl), 0)) in test_async_shutdown()
8791 if (!TEST_int_eq(SSL_shutdown(serverssl), 1)) in test_async_shutdown()
8800 SSL_free(serverssl); in test_async_shutdown()
8915 SSL *clientssl = NULL, *serverssl = NULL; in test_cert_cb_int() local
8946 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_cert_cb_int()
8968 ret = create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE); in test_cert_cb_int()
8978 SSL_free(serverssl); in test_cert_cb_int()
9041 SSL *clientssl = NULL, *serverssl = NULL; in test_client_cert_cb() local
9070 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_client_cert_cb()
9072 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_client_cert_cb()
9079 SSL_free(serverssl); in test_client_cert_cb()
9098 SSL *clientssl = NULL, *serverssl = NULL; in test_ca_names_int() local
9153 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ca_names_int()
9155 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_ca_names_int()
9163 sktmp = SSL_get0_peer_CA_list(serverssl); in test_ca_names_int()
9194 SSL_free(serverssl); in test_ca_names_int()
9248 SSL *clientssl = NULL, *serverssl = NULL; in test_multiblock_write() local
9283 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_multiblock_write()
9288 SSL_set_options(serverssl, SSL_OP_NO_ENCRYPT_THEN_MAC); in test_multiblock_write()
9292 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_multiblock_write()
9295 if (!TEST_true(SSL_write_ex(serverssl, msg, sizeof(msg), &written)) in test_multiblock_write()
9311 SSL_free(serverssl); in test_multiblock_write()
9454 SSL *serverssl = NULL, *clientssl = NULL; in test_session_cache_overflow() local
9482 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_session_cache_overflow()
9486 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_session_cache_overflow()
9490 sess = SSL_get_session(serverssl); in test_session_cache_overflow()
9505 SSL_shutdown(serverssl); in test_session_cache_overflow()
9507 SSL_free(serverssl); in test_session_cache_overflow()
9509 serverssl = clientssl = NULL; in test_session_cache_overflow()
9516 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_session_cache_overflow()
9520 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_session_cache_overflow()
9527 get_sess_val = SSL_get_session(serverssl); in test_session_cache_overflow()
9534 SSL_shutdown(serverssl); in test_session_cache_overflow()
9536 SSL_free(serverssl); in test_session_cache_overflow()
9538 serverssl = clientssl = NULL; in test_session_cache_overflow()
9540 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_session_cache_overflow()
9547 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_session_cache_overflow()
9553 SSL_free(serverssl); in test_session_cache_overflow()
9578 SSL *clientssl = NULL, *serverssl = NULL; in test_servername() local
9598 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_servername()
9614 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_servername()
9619 || !TEST_str_eq(SSL_get_servername(serverssl, in test_servername()
9629 || !TEST_int_eq(SSL_shutdown(serverssl), 0)) in test_servername()
9633 SSL_free(serverssl); in test_servername()
9634 clientssl = serverssl = NULL; in test_servername()
9636 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, in test_servername()
9692 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_servername()
9696 || !TEST_true(SSL_session_reused(serverssl)) in test_servername()
9700 || !TEST_str_eq(SSL_get_servername(serverssl, in test_servername()
9709 SSL_free(serverssl); in test_servername()
9836 SSL *clientssl = NULL, *serverssl = NULL; in test_sigalgs_available() local
9940 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_sigalgs_available()
9944 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_sigalgs_available()
9948 if (!TEST_int_eq(SSL_get_shared_sigalgs(serverssl, 0, &sig, &hash, NULL, in test_sigalgs_available()
9963 SSL_free(serverssl); in test_sigalgs_available()
9982 SSL *clientssl = NULL, *serverssl = NULL; in test_pluggable_group() local
9997 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_pluggable_group()
10002 …if (!TEST_true(SSL_set1_groups_list(serverssl, "xorgroup:xorkemgroup:dummy1:dummy2:dummy3:dummy4:d… in test_pluggable_group()
10007 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_pluggable_group()
10011 SSL_group_to_name(serverssl, SSL_get_shared_group(serverssl, 0)))) in test_pluggable_group()
10014 if (!TEST_str_eq(group_name, SSL_get0_group_name(serverssl)) in test_pluggable_group()
10021 SSL_free(serverssl); in test_pluggable_group()
10090 SSL *clientssl = NULL, *serverssl = NULL; in test_pluggable_signature() local
10109 || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_pluggable_signature()
10115 if (!TEST_true(SSL_set1_server_cert_type(serverssl, cert_type_rpk, sizeof(cert_type_rpk))) in test_pluggable_signature()
10121 if (!TEST_true(SSL_set1_groups_list(serverssl, "xorgroup")) in test_pluggable_signature()
10130 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_pluggable_signature()
10140 SSL_free(serverssl); in test_pluggable_signature()
10155 SSL *clientssl = NULL, *serverssl = NULL, *client2ssl = NULL; in test_ssl_dup() local
10166 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_ssl_dup()
10197 if (!TEST_true(create_ssl_connection(serverssl, client2ssl, SSL_ERROR_NONE))) in test_ssl_dup()
10210 SSL_free(serverssl); in test_ssl_dup()
10241 SSL *clientssl = NULL, *serverssl = NULL; in test_session_secret_cb() local
10253 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_session_secret_cb()
10259 || !TEST_true(SSL_set_max_proto_version(serverssl, TLS1_2_VERSION))) in test_session_secret_cb()
10262 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_session_secret_cb()
10268 shutdown_ssl_connection(serverssl, clientssl); in test_session_secret_cb()
10269 serverssl = clientssl = NULL; in test_session_secret_cb()
10272 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_session_secret_cb()
10284 || !TEST_true(SSL_set_max_proto_version(serverssl, TLS1_2_VERSION)) in test_session_secret_cb()
10285 || !TEST_true(SSL_set_session_secret_cb(serverssl, secret_cb, in test_session_secret_cb()
10292 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_session_secret_cb()
10299 SSL_free(serverssl); in test_session_secret_cb()
10406 SSL *clientssl = NULL, *serverssl = NULL; in test_set_tmp_dh() local
10458 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_set_tmp_dh()
10463 if (!TEST_true(SSL_set_dh_auto(serverssl, dhauto))) in test_set_tmp_dh()
10467 if (!TEST_true(SSL_set0_tmp_dh_pkey(serverssl, dhpkey))) in test_set_tmp_dh()
10473 if (!TEST_true(SSL_set_tmp_dh(serverssl, dh))) in test_set_tmp_dh()
10476 SSL_set_tmp_dh_callback(serverssl, tmp_dh_callback); in test_set_tmp_dh()
10480 if (!TEST_true(SSL_set_min_proto_version(serverssl, TLS1_2_VERSION)) in test_set_tmp_dh()
10481 || !TEST_true(SSL_set_max_proto_version(serverssl, TLS1_2_VERSION)) in test_set_tmp_dh()
10482 || !TEST_true(SSL_set_cipher_list(serverssl, "DHE-RSA-AES128-SHA"))) in test_set_tmp_dh()
10489 if (!TEST_int_eq(create_ssl_connection(serverssl, clientssl, in test_set_tmp_dh()
10499 SSL_free(serverssl); in test_set_tmp_dh()
10515 SSL *clientssl = NULL, *serverssl = NULL; in test_dh_auto() local
10585 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_dh_auto()
10589 if (!TEST_true(SSL_set_dh_auto(serverssl, 1)) in test_dh_auto()
10590 || !TEST_true(SSL_set_min_proto_version(serverssl, TLS1_2_VERSION)) in test_dh_auto()
10591 || !TEST_true(SSL_set_max_proto_version(serverssl, TLS1_2_VERSION)) in test_dh_auto()
10592 || !TEST_true(SSL_set_cipher_list(serverssl, ciphersuite)) in test_dh_auto()
10602 || !TEST_int_le(SSL_accept(serverssl), 0)) in test_dh_auto()
10605 if (!TEST_int_gt(SSL_get_tmp_key(serverssl, &tmpkey), 0)) in test_dh_auto()
10610 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_dh_auto()
10616 SSL_free(serverssl); in test_dh_auto()
10637 SSL *clientssl = NULL, *serverssl = NULL; in test_sni_tls13() local
10662 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_sni_tls13()
10664 || !TEST_true(create_ssl_connection(serverssl, clientssl, in test_sni_tls13()
10675 SSL_free(serverssl); in test_sni_tls13()
10691 SSL *clientssl = NULL, *serverssl = NULL; in test_ticket_lifetime() local
10711 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_ticket_lifetime()
10720 SSL_get_default_timeout(serverssl))) in test_ticket_lifetime()
10723 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_ticket_lifetime()
10738 SSL_free(serverssl); in test_ticket_lifetime()
11064 SSL *clientssl = NULL, *serverssl = NULL; in test_read_ahead_key_change() local
11078 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_read_ahead_key_change()
11082 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_read_ahead_key_change()
11105 if (!TEST_true(SSL_read_ex(serverssl, buf, sizeof(buf) - 1, in test_read_ahead_key_change()
11117 SSL_free(serverssl); in test_read_ahead_key_change()
11164 SSL *clientssl = NULL, *serverssl = NULL; in test_tls13_record_padding() local
11195 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_tls13_record_padding()
11219 if (!TEST_true(SSL_set_block_padding_ex(serverssl, 0, 512))) in test_tls13_record_padding()
11223 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_tls13_record_padding()
11239 if (!TEST_true(SSL_read_ex(serverssl, buf, sizeof(buf) - 1, in test_tls13_record_padding()
11254 SSL_free(serverssl); in test_tls13_record_padding()
11284 SSL *clientssl = NULL, *serverssl = NULL, *peera, *peerb; in test_pipelining() local
11314 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_pipelining()
11323 peera = serverssl; in test_pipelining()
11328 peerb = serverssl; in test_pipelining()
11373 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_pipelining()
11445 SSL_free(serverssl); in test_pipelining()
11500 SSL *clientssl = NULL, *serverssl = NULL; in test_version() local
11570 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_version()
11574 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_version()
11577 if (!TEST_int_eq(SSL_version(serverssl), version) in test_version()
11579 || !TEST_true(check_version_string(serverssl, version)) in test_version()
11584 if (!TEST_true(SSL_is_dtls(serverssl)) in test_version()
11586 || !TEST_false(SSL_is_tls(serverssl)) in test_version()
11588 || !TEST_false(SSL_is_quic(serverssl)) in test_version()
11592 if (!TEST_true(SSL_is_tls(serverssl)) in test_version()
11594 || !TEST_false(SSL_is_dtls(serverssl)) in test_version()
11596 || !TEST_false(SSL_is_quic(serverssl)) in test_version()
11603 SSL_free(serverssl); in test_version()
11616 SSL *clientssl = NULL, *serverssl = NULL; in test_rstate_string() local
11634 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_rstate_string()
11638 if (!TEST_str_eq(SSL_rstate_string(serverssl), "RH") in test_rstate_string()
11639 || !TEST_str_eq(SSL_rstate_string_long(serverssl), "read header")) in test_rstate_string()
11642 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_rstate_string()
11645 if (!TEST_str_eq(SSL_rstate_string(serverssl), "RH") in test_rstate_string()
11646 || !TEST_str_eq(SSL_rstate_string_long(serverssl), "read header")) in test_rstate_string()
11650 version = SSL_version(serverssl); in test_rstate_string()
11659 if (!TEST_true(BIO_write_ex(SSL_get_rbio(serverssl), dummyheader, in test_rstate_string()
11664 if (!TEST_false(SSL_read_ex(serverssl, buf, sizeof(buf), &readbytes))) in test_rstate_string()
11667 if (!TEST_str_eq(SSL_rstate_string(serverssl), "RB") in test_rstate_string()
11668 || !TEST_str_eq(SSL_rstate_string_long(serverssl), "read body")) in test_rstate_string()
11673 SSL_free(serverssl); in test_rstate_string()
11700 SSL *clientssl = NULL, *serverssl = NULL; in test_handshake_retry() local
11738 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, in test_handshake_retry()
11742 tmp = SSL_get_wbio(serverssl); in test_handshake_retry()
11747 SSL_set0_wbio(serverssl, bretry); in test_handshake_retry()
11753 if (!TEST_int_eq(SSL_accept(serverssl), -1) in test_handshake_retry()
11754 || !TEST_int_eq(SSL_get_error(serverssl, -1), SSL_ERROR_WANT_WRITE)) in test_handshake_retry()
11758 SSL_set0_wbio(serverssl, tmp); in test_handshake_retry()
11761 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_handshake_retry()
11766 SSL_free(serverssl); in test_handshake_retry()
11782 SSL *clientssl = NULL, *serverssl = NULL; in test_data_retry() local
11802 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, in test_data_retry()
11806 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_data_retry()
11855 while (SSL_read_ex(serverssl, outbuf + totread, sizeof(outbuf) - totread, in test_data_retry()
11863 SSL_free(serverssl); in test_data_retry()
11887 SSL *serverssl = NULL, *clientssl = NULL; in resume_servername_cb() local
11898 if (!TEST_true(create_ssl_objects(cbdata->sctx, cbdata->cctx, &serverssl, in resume_servername_cb()
11908 if (!TEST_false(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) { in resume_servername_cb()
11916 SSL_free(serverssl); in resume_servername_cb()
11932 SSL *serverssl = NULL, *clientssl = NULL; in test_multi_resume() local
11978 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, in test_multi_resume()
12000 SSL_set_max_early_data(serverssl, 0); in test_multi_resume()
12002 if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE))) in test_multi_resume()
12023 SSL_shutdown(serverssl); in test_multi_resume()
12024 SSL_free(serverssl); in test_multi_resume()
12026 serverssl = clientssl = NULL; in test_multi_resume()
12035 SSL_free(serverssl); in test_multi_resume()
12242 SSL *serverssl = NULL, *clientssl = NULL; in test_npn() local
12253 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, in test_npn()
12259 if (!TEST_false(create_ssl_connection(serverssl, clientssl, in test_npn()
12266 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_npn()
12270 SSL_get0_next_proto_negotiated(serverssl, &prot, &protlen); in test_npn()
12293 SSL_free(serverssl); in test_npn()
12340 SSL *serverssl = NULL, *clientssl = NULL; in test_alpn() local
12352 if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, in test_alpn()
12367 if (!TEST_false(create_ssl_connection(serverssl, clientssl, in test_alpn()
12374 if (!TEST_true(create_ssl_connection(serverssl, clientssl, in test_alpn()
12396 SSL_free(serverssl); in test_alpn()