Lines Matching refs:peer

750 static int create_peer(PEER *peer, SSL_CTX *ctx)  in create_peer()  argument
761 peer->ssl = ssl; in create_peer()
762 peer->write_buf = write_buf; in create_peer()
763 peer->read_buf = read_buf; in create_peer()
764 peer->write_buf_len = peer->read_buf_len = peer_buffer_size; in create_peer()
773 static void peer_free_data(PEER *peer) in peer_free_data() argument
775 SSL_free(peer->ssl); in peer_free_data()
776 OPENSSL_free(peer->write_buf); in peer_free_data()
777 OPENSSL_free(peer->read_buf); in peer_free_data()
784 static void do_handshake_step(PEER *peer) in do_handshake_step() argument
786 if (!TEST_int_eq(peer->status, PEER_RETRY)) { in do_handshake_step()
787 peer->status = PEER_TEST_FAILURE; in do_handshake_step()
789 int ret = SSL_do_handshake(peer->ssl); in do_handshake_step()
792 peer->status = PEER_SUCCESS; in do_handshake_step()
794 peer->status = PEER_ERROR; in do_handshake_step()
796 int error = SSL_get_error(peer->ssl, ret); in do_handshake_step()
801 peer->status = PEER_ERROR; in do_handshake_step()
815 static void do_app_data_step(PEER *peer) in do_app_data_step() argument
819 if (!TEST_int_eq(peer->status, PEER_RETRY)) { in do_app_data_step()
820 peer->status = PEER_TEST_FAILURE; in do_app_data_step()
825 while (ret > 0 && peer->bytes_to_read) { in do_app_data_step()
826 ret = SSL_read(peer->ssl, peer->read_buf, peer->read_buf_len); in do_app_data_step()
828 if (!TEST_int_le(ret, peer->bytes_to_read)) { in do_app_data_step()
829 peer->status = PEER_TEST_FAILURE; in do_app_data_step()
832 peer->bytes_to_read -= ret; in do_app_data_step()
834 peer->status = PEER_ERROR; in do_app_data_step()
837 int error = SSL_get_error(peer->ssl, ret); in do_app_data_step()
839 peer->status = PEER_ERROR; in do_app_data_step()
846 write_bytes = peer->bytes_to_write < peer->write_buf_len ? peer->bytes_to_write : in do_app_data_step()
847 peer->write_buf_len; in do_app_data_step()
849 ret = SSL_write(peer->ssl, peer->write_buf, write_bytes); in do_app_data_step()
853 peer->status = PEER_TEST_FAILURE; in do_app_data_step()
856 peer->bytes_to_write -= ret; in do_app_data_step()
862 peer->status = PEER_ERROR; in do_app_data_step()
873 if (peer->bytes_to_write == 0 && peer->bytes_to_read == 0) { in do_app_data_step()
874 peer->status = PEER_SUCCESS; in do_app_data_step()
878 static void do_reneg_setup_step(const SSL_TEST_CTX *test_ctx, PEER *peer) in do_reneg_setup_step() argument
883 if (peer->status == PEER_SUCCESS) { in do_reneg_setup_step()
889 peer->status = PEER_RETRY; in do_reneg_setup_step()
890 do_handshake_step(peer); in do_reneg_setup_step()
894 if (!TEST_int_eq(peer->status, PEER_RETRY) in do_reneg_setup_step()
905 peer->status = PEER_TEST_FAILURE; in do_reneg_setup_step()
910 peer->bytes_to_write = peer->bytes_to_read = test_ctx->app_data_size; in do_reneg_setup_step()
914 && SSL_is_server(peer->ssl)) in do_reneg_setup_step()
916 && !SSL_is_server(peer->ssl))) { in do_reneg_setup_step()
921 if (!SSL_renegotiate_pending(peer->ssl)) { in do_reneg_setup_step()
927 if (SSL_is_server(peer->ssl)) { in do_reneg_setup_step()
928 ret = SSL_renegotiate(peer->ssl); in do_reneg_setup_step()
933 SSL_set_options(peer->ssl, SSL_OP_NO_EXTENDED_MASTER_SECRET); in do_reneg_setup_step()
937 if (!SSL_set_cipher_list(peer->ssl, in do_reneg_setup_step()
939 peer->status = PEER_ERROR; in do_reneg_setup_step()
945 ret = SSL_renegotiate(peer->ssl); in do_reneg_setup_step()
947 ret = SSL_renegotiate_abbreviated(peer->ssl); in do_reneg_setup_step()
950 peer->status = PEER_ERROR; in do_reneg_setup_step()
953 do_handshake_step(peer); in do_reneg_setup_step()
964 if (peer->status == PEER_RETRY) in do_reneg_setup_step()
965 peer->status = PEER_SUCCESS; in do_reneg_setup_step()
966 else if (peer->status == PEER_SUCCESS) in do_reneg_setup_step()
967 peer->status = PEER_RETRY; in do_reneg_setup_step()
973 if (SSL_is_server(peer->ssl) in do_reneg_setup_step()
976 peer->status = PEER_SUCCESS; in do_reneg_setup_step()
980 ret = SSL_key_update(peer->ssl, test_ctx->key_update_type); in do_reneg_setup_step()
982 peer->status = PEER_ERROR; in do_reneg_setup_step()
985 do_handshake_step(peer); in do_reneg_setup_step()
990 if (peer->status != PEER_SUCCESS) in do_reneg_setup_step()
991 peer->status = PEER_ERROR; in do_reneg_setup_step()
994 if (SSL_is_server(peer->ssl)) { in do_reneg_setup_step()
995 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(peer->ssl); in do_reneg_setup_step()
998 peer->status = PEER_ERROR; in do_reneg_setup_step()
1004 ret = SSL_verify_client_post_handshake(peer->ssl); in do_reneg_setup_step()
1006 peer->status = PEER_ERROR; in do_reneg_setup_step()
1010 do_handshake_step(peer); in do_reneg_setup_step()
1015 if (peer->status != PEER_SUCCESS) in do_reneg_setup_step()
1016 peer->status = PEER_ERROR; in do_reneg_setup_step()
1025 ret = SSL_read(peer->ssl, &buf, sizeof(buf)); in do_reneg_setup_step()
1031 peer->status = PEER_ERROR; in do_reneg_setup_step()
1034 int error = SSL_get_error(peer->ssl, ret); in do_reneg_setup_step()
1036 peer->status = PEER_ERROR; in do_reneg_setup_step()
1040 if (!SSL_in_init(peer->ssl)) in do_reneg_setup_step()
1044 peer->status = PEER_SUCCESS; in do_reneg_setup_step()
1063 static void do_shutdown_step(PEER *peer) in do_shutdown_step() argument
1067 if (!TEST_int_eq(peer->status, PEER_RETRY)) { in do_shutdown_step()
1068 peer->status = PEER_TEST_FAILURE; in do_shutdown_step()
1071 ret = SSL_shutdown(peer->ssl); in do_shutdown_step()
1074 peer->status = PEER_SUCCESS; in do_shutdown_step()
1076 int error = SSL_get_error(peer->ssl, ret); in do_shutdown_step()
1079 peer->status = PEER_ERROR; in do_shutdown_step()
1143 static void do_connect_step(const SSL_TEST_CTX *test_ctx, PEER *peer, in do_connect_step() argument
1148 do_handshake_step(peer); in do_connect_step()
1151 do_app_data_step(peer); in do_connect_step()
1154 do_reneg_setup_step(test_ctx, peer); in do_connect_step()
1157 do_handshake_step(peer); in do_connect_step()
1160 do_app_data_step(peer); in do_connect_step()
1163 do_shutdown_step(peer); in do_connect_step()