2 * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #ifndef HEADER_HANDSHAKE_HELPER_H
11 #define HEADER_HANDSHAKE_HELPER_H
13 #include "ssl_test_ctx.h"
15 typedef struct handshake_result {
16 ssl_test_result_t result;
17 /* These alerts are in the 2-byte format returned by the info_callback. */
18 /* (Latest) alert sent by the client; 0 if no alert. */
19 int client_alert_sent;
20 /* Number of fatal or close_notify alerts sent. */
21 int client_num_fatal_alerts_sent;
22 /* (Latest) alert received by the server; 0 if no alert. */
23 int client_alert_received;
24 /* (Latest) alert sent by the server; 0 if no alert. */
25 int server_alert_sent;
26 /* Number of fatal or close_notify alerts sent. */
27 int server_num_fatal_alerts_sent;
28 /* (Latest) alert received by the client; 0 if no alert. */
29 int server_alert_received;
30 /* Negotiated protocol. On success, these should always match. */
33 /* Server connection */
34 ssl_servername_t servername;
35 /* Session ticket status */
36 ssl_session_ticket_t session_ticket;
38 /* Was this called on the second context? */
39 int session_ticket_do_not_call;
40 char *client_npn_negotiated;
41 char *server_npn_negotiated;
42 char *client_alpn_negotiated;
43 char *server_alpn_negotiated;
44 /* Was the handshake resumed? */
47 /* Temporary key type */
49 /* server certificate key type */
51 /* server signing hash */
53 /* server signature type */
56 STACK_OF(X509_NAME) *server_ca_names;
57 /* client certificate key type */
59 /* client signing hash */
61 /* client signature type */
64 STACK_OF(X509_NAME) *client_ca_names;
65 /* Session id status */
66 ssl_session_id_t session_id;
68 /* session ticket application data */
69 char *result_session_ticket_app_data;
72 HANDSHAKE_RESULT *HANDSHAKE_RESULT_new(void);
73 void HANDSHAKE_RESULT_free(HANDSHAKE_RESULT *result);
75 /* Do a handshake and report some information about the result. */
76 HANDSHAKE_RESULT *do_handshake(SSL_CTX *server_ctx, SSL_CTX *server2_ctx,
77 SSL_CTX *client_ctx, SSL_CTX *resume_server_ctx,
78 SSL_CTX *resume_client_ctx,
79 const SSL_TEST_CTX *test_ctx);
81 #endif /* HEADER_HANDSHAKE_HELPER_H */