Deprecate the flags that switch off constant time
[openssl.git] / test / ssl_test_ctx.h
1 /*
2  * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
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
8  */
9
10 #ifndef HEADER_SSL_TEST_CTX_H
11 #define HEADER_SSL_TEST_CTX_H
12
13 #include <openssl/conf.h>
14 #include <openssl/ssl.h>
15
16 typedef enum {
17     SSL_TEST_SUCCESS = 0,  /* Default */
18     SSL_TEST_SERVER_FAIL,
19     SSL_TEST_CLIENT_FAIL,
20     SSL_TEST_INTERNAL_ERROR
21 } ssl_test_result_t;
22
23 typedef enum {
24     SSL_TEST_VERIFY_NONE = 0, /* Default */
25     SSL_TEST_VERIFY_ACCEPT_ALL,
26     SSL_TEST_VERIFY_REJECT_ALL
27 } ssl_verify_callback_t;
28
29 typedef struct ssl_test_ctx {
30     /* Test expectations. */
31     /* Defaults to SUCCESS. */
32     ssl_test_result_t expected_result;
33     /* Alerts. 0 if no expectation. */
34     /* See ssl.h for alert codes. */
35     /* Alert sent by the client / received by the server. */
36     int client_alert;
37     /* Alert sent by the server / received by the client. */
38     int server_alert;
39     /* Negotiated protocol version. 0 if no expectation. */
40     /* See ssl.h for protocol versions. */
41     int protocol;
42     /* One of a number of predefined custom callbacks. */
43     ssl_verify_callback_t client_verify_callback;
44 } SSL_TEST_CTX;
45
46 const char *ssl_test_result_name(ssl_test_result_t result);
47 const char *ssl_alert_name(int alert);
48 const char *ssl_protocol_name(int protocol);
49 const char *ssl_verify_callback_name(ssl_verify_callback_t verify_callback);
50
51 /*
52  * Load the test case context from |conf|.
53  * See test/README.ssl_test for details on the conf file format.
54  */
55 SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section);
56
57 SSL_TEST_CTX *SSL_TEST_CTX_new(void);
58
59 void SSL_TEST_CTX_free(SSL_TEST_CTX *ctx);
60
61 #endif  /* HEADER_SSL_TEST_CTX_H */