Lines Matching +full:- +full:alert

2  * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
26 /* Currently the section names are of the form test-<number>, e.g. test-15. */
29 static const char *print_alert(int alert) in print_alert() argument
31 return alert ? SSL_alert_desc_string_long(alert) : "no alert"; in print_alert()
36 if (!TEST_int_eq(result->result, test_ctx->expected_result)) { in check_result()
38 ssl_test_result_name(test_ctx->expected_result), in check_result()
39 ssl_test_result_name(result->result)); in check_result()
47 if (!TEST_int_eq(result->client_alert_sent, in check_alerts()
48 result->client_alert_received)) { in check_alerts()
49 TEST_info("Client sent alert %s but server received %s.", in check_alerts()
50 print_alert(result->client_alert_sent), in check_alerts()
51 print_alert(result->client_alert_received)); in check_alerts()
54 * to process a received alert. Specifically, in protocol version in check_alerts()
58 * Client now sends a protocol alert, using TLS v1.2 in the header. in check_alerts()
59 * The server, however, rejects the alert because of version mismatch in check_alerts()
61 * receive the alert. in check_alerts()
66 if (!TEST_int_eq(result->server_alert_sent, in check_alerts()
67 result->server_alert_received)) { in check_alerts()
68 TEST_info("Server sent alert %s but client received %s.", in check_alerts()
69 print_alert(result->server_alert_sent), in check_alerts()
70 print_alert(result->server_alert_received)); in check_alerts()
74 /* Tolerate an alert if one wasn't explicitly specified in the test. */ in check_alerts()
75 if (test_ctx->expected_client_alert in check_alerts()
77 * The info callback alert value is computed as in check_alerts()
78 * (s->s3->send_alert[0] << 8) | s->s3->send_alert[1] in check_alerts()
79 * where the low byte is the alert code and the high byte is other stuff. in check_alerts()
81 && (result->client_alert_sent & 0xff) != test_ctx->expected_client_alert) { in check_alerts()
83 print_alert(test_ctx->expected_client_alert), in check_alerts()
84 print_alert(result->client_alert_sent)); in check_alerts()
88 if (test_ctx->expected_server_alert in check_alerts()
89 && (result->server_alert_sent & 0xff) != test_ctx->expected_server_alert) { in check_alerts()
91 print_alert(test_ctx->expected_server_alert), in check_alerts()
92 print_alert(result->server_alert_sent)); in check_alerts()
96 if (!TEST_int_le(result->client_num_fatal_alerts_sent, 1)) in check_alerts()
98 if (!TEST_int_le(result->server_num_fatal_alerts_sent, 1)) in check_alerts()
105 if (!TEST_int_eq(result->client_protocol, result->server_protocol)) { in check_protocol()
107 ssl_protocol_name(result->client_protocol), in check_protocol()
108 ssl_protocol_name(result->server_protocol)); in check_protocol()
112 if (test_ctx->expected_protocol) { in check_protocol()
113 if (!TEST_int_eq(result->client_protocol, in check_protocol()
114 test_ctx->expected_protocol)) { in check_protocol()
116 ssl_protocol_name(test_ctx->expected_protocol), in check_protocol()
117 ssl_protocol_name(result->client_protocol)); in check_protocol()
126 if (!TEST_int_eq(result->servername, test_ctx->expected_servername)) { in check_servername()
128 ssl_servername_name(test_ctx->expected_servername), in check_servername()
129 ssl_servername_name(result->servername)); in check_servername()
137 if (test_ctx->session_ticket_expected == SSL_TEST_SESSION_TICKET_IGNORE) in check_session_ticket()
139 if (!TEST_int_eq(result->session_ticket, in check_session_ticket()
140 test_ctx->session_ticket_expected)) { in check_session_ticket()
142 ssl_session_ticket_name(test_ctx->session_ticket_expected), in check_session_ticket()
143 ssl_session_ticket_name(result->session_ticket)); in check_session_ticket()
151 if (test_ctx->session_id_expected == SSL_TEST_SESSION_ID_IGNORE) in check_session_id()
153 if (!TEST_int_eq(result->session_id, test_ctx->session_id_expected)) { in check_session_id()
155 ssl_session_id_name(test_ctx->session_id_expected), in check_session_id()
156 ssl_session_id_name(result->session_id)); in check_session_id()
164 if (!TEST_int_eq(result->compression, test_ctx->compression_expected)) in check_compression()
172 if (!TEST_str_eq(result->client_npn_negotiated, in check_npn()
173 result->server_npn_negotiated)) in check_npn()
175 if (!TEST_str_eq(test_ctx->expected_npn_protocol, in check_npn()
176 result->client_npn_negotiated)) in check_npn()
185 if (!TEST_str_eq(result->client_alpn_negotiated, in check_alpn()
186 result->server_alpn_negotiated)) in check_alpn()
188 if (!TEST_str_eq(test_ctx->expected_alpn_protocol, in check_alpn()
189 result->client_alpn_negotiated)) in check_alpn()
201 if (result->result_session_ticket_app_data != NULL) in check_session_ticket_app_data()
202 result_len = strlen(result->result_session_ticket_app_data); in check_session_ticket_app_data()
203 if (test_ctx->expected_session_ticket_app_data != NULL) in check_session_ticket_app_data()
204 expected_len = strlen(test_ctx->expected_session_ticket_app_data); in check_session_ticket_app_data()
208 if (!TEST_str_eq(result->result_session_ticket_app_data, in check_session_ticket_app_data()
209 test_ctx->expected_session_ticket_app_data)) in check_session_ticket_app_data()
217 if (!TEST_int_eq(result->client_resumed, result->server_resumed)) in check_resumption()
219 if (!TEST_int_eq(result->client_resumed, test_ctx->resumption_expected)) in check_resumption()
283 return check_nid("Tmp key", test_ctx->expected_tmp_key_type, in check_tmp_key()
284 result->tmp_key_type); in check_tmp_key()
290 return check_nid("Server certificate", test_ctx->expected_server_cert_type, in check_server_cert_type()
291 result->server_cert_type); in check_server_cert_type()
297 return check_nid("Server signing hash", test_ctx->expected_server_sign_hash, in check_server_sign_hash()
298 result->server_sign_hash); in check_server_sign_hash()
304 return check_nid("Server signing", test_ctx->expected_server_sign_type, in check_server_sign_type()
305 result->server_sign_type); in check_server_sign_type()
312 test_ctx->expected_server_ca_names, in check_server_ca_names()
313 result->server_ca_names); in check_server_ca_names()
319 return check_nid("Client certificate", test_ctx->expected_client_cert_type, in check_client_cert_type()
320 result->client_cert_type); in check_client_cert_type()
326 return check_nid("Client signing hash", test_ctx->expected_client_sign_hash, in check_client_sign_hash()
327 result->client_sign_hash); in check_client_sign_hash()
333 return check_nid("Client signing", test_ctx->expected_client_sign_type, in check_client_sign_type()
334 result->client_sign_type); in check_client_sign_type()
341 test_ctx->expected_client_ca_names, in check_client_ca_names()
342 result->client_ca_names); in check_client_ca_names()
347 if (test_ctx->expected_cipher == NULL) in check_cipher()
349 if (!TEST_ptr(result->cipher)) in check_cipher()
351 if (!TEST_str_eq(test_ctx->expected_cipher, in check_cipher()
352 result->cipher)) in check_cipher()
367 if (result->result == SSL_TEST_SUCCESS) { in check_test()
373 ret &= (result->session_ticket_do_not_call == 0); in check_test()
403 BIO_snprintf(test_app, sizeof(test_app), "test-%d", idx); in test_handshake()
410 if (test_ctx->method == SSL_TEST_METHOD_DTLS) { in test_handshake()
416 if (test_ctx->extra.server.servername_callback != in test_handshake()
427 if (test_ctx->handshake_mode == SSL_TEST_HANDSHAKE_RESUME) { in test_handshake()
444 if (test_ctx->method == SSL_TEST_METHOD_TLS) { in test_handshake()
448 /* Without ec or dh there are no built-in groups for TLSv1.3 */ in test_handshake()
460 if (test_ctx->extra.server.servername_callback != in test_handshake()
475 if (test_ctx->handshake_mode == SSL_TEST_HANDSHAKE_RESUME) { in test_handshake()
512 && !SSL_CTX_config(resume_server_ctx, "resume-server")) in test_handshake()
515 && !SSL_CTX_config(resume_client_ctx, "resume-client")) in test_handshake()