2 * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (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_SSL_TEST_CTX_H
11 #define HEADER_SSL_TEST_CTX_H
13 #include <openssl/conf.h>
14 #include <openssl/ssl.h>
17 SSL_TEST_SUCCESS = 0, /* Default */
20 SSL_TEST_INTERNAL_ERROR
24 SSL_TEST_VERIFY_NONE = 0, /* Default */
25 SSL_TEST_VERIFY_ACCEPT_ALL,
26 SSL_TEST_VERIFY_REJECT_ALL
27 } ssl_verify_callback_t;
30 SSL_TEST_SERVERNAME_NONE = 0, /* Default */
31 SSL_TEST_SERVERNAME_SERVER1,
32 SSL_TEST_SERVERNAME_SERVER2
36 SSL_TEST_SESSION_TICKET_IGNORE = 0, /* Default */
37 SSL_TEST_SESSION_TICKET_YES,
38 SSL_TEST_SESSION_TICKET_NO,
39 SSL_TEST_SESSION_TICKET_BROKEN, /* Special test */
40 } ssl_session_ticket_t;
42 typedef struct ssl_test_ctx {
43 /* Test expectations. */
44 /* Defaults to SUCCESS. */
45 ssl_test_result_t expected_result;
46 /* Alerts. 0 if no expectation. */
47 /* See ssl.h for alert codes. */
48 /* Alert sent by the client / received by the server. */
50 /* Alert sent by the server / received by the client. */
52 /* Negotiated protocol version. 0 if no expectation. */
53 /* See ssl.h for protocol versions. */
55 /* One of a number of predefined custom callbacks. */
56 ssl_verify_callback_t client_verify_callback;
57 /* One of a number of predefined server names use by the client */
58 ssl_servername_t servername;
59 ssl_session_ticket_t session_ticket_expected;
62 const char *ssl_test_result_name(ssl_test_result_t result);
63 const char *ssl_alert_name(int alert);
64 const char *ssl_protocol_name(int protocol);
65 const char *ssl_verify_callback_name(ssl_verify_callback_t verify_callback);
66 const char *ssl_servername_name(ssl_servername_t server);
67 const char *ssl_session_ticket_name(ssl_session_ticket_t server);
70 * Load the test case context from |conf|.
71 * See test/README.ssl_test for details on the conf file format.
73 SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section);
75 SSL_TEST_CTX *SSL_TEST_CTX_new(void);
77 void SSL_TEST_CTX_free(SSL_TEST_CTX *ctx);
79 #endif /* HEADER_SSL_TEST_CTX_H */