]>
Commit | Line | Data |
---|---|---|
453dfd8d EK |
1 | /* |
2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. | |
3 | * | |
440e5d80 RS |
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 | |
453dfd8d | 7 | * https://www.openssl.org/source/license.html |
453dfd8d EK |
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 { | |
a263f320 | 17 | SSL_TEST_SUCCESS = 0, /* Default */ |
453dfd8d EK |
18 | SSL_TEST_SERVER_FAIL, |
19 | SSL_TEST_CLIENT_FAIL, | |
20 | SSL_TEST_INTERNAL_ERROR | |
21 | } ssl_test_result_t; | |
22 | ||
a263f320 EK |
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 | ||
5c753de6 | 29 | typedef enum { |
81fc33c9 EK |
30 | SSL_TEST_SERVERNAME_NONE = 0, /* Default */ |
31 | SSL_TEST_SERVERNAME_SERVER1, | |
5c753de6 TS |
32 | SSL_TEST_SERVERNAME_SERVER2 |
33 | } ssl_servername_t; | |
34 | ||
35 | typedef enum { | |
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 */ | |
81fc33c9 | 40 | } ssl_session_ticket_t; |
5c753de6 | 41 | |
74726750 EK |
42 | typedef enum { |
43 | SSL_TEST_METHOD_TLS = 0, /* Default */ | |
44 | SSL_TEST_METHOD_DTLS, | |
45 | } ssl_test_method_t; | |
46 | ||
453dfd8d EK |
47 | typedef struct ssl_test_ctx { |
48 | /* Test expectations. */ | |
49 | /* Defaults to SUCCESS. */ | |
50 | ssl_test_result_t expected_result; | |
51 | /* Alerts. 0 if no expectation. */ | |
52 | /* See ssl.h for alert codes. */ | |
53 | /* Alert sent by the client / received by the server. */ | |
54 | int client_alert; | |
55 | /* Alert sent by the server / received by the client. */ | |
56 | int server_alert; | |
57 | /* Negotiated protocol version. 0 if no expectation. */ | |
58 | /* See ssl.h for protocol versions. */ | |
59 | int protocol; | |
a263f320 EK |
60 | /* One of a number of predefined custom callbacks. */ |
61 | ssl_verify_callback_t client_verify_callback; | |
5c753de6 TS |
62 | /* One of a number of predefined server names use by the client */ |
63 | ssl_servername_t servername; | |
81fc33c9 | 64 | ssl_session_ticket_t session_ticket_expected; |
74726750 EK |
65 | /* Whether the server/client CTX should use DTLS or TLS. */ |
66 | ssl_test_method_t method; | |
453dfd8d EK |
67 | } SSL_TEST_CTX; |
68 | ||
a263f320 | 69 | const char *ssl_test_result_name(ssl_test_result_t result); |
453dfd8d EK |
70 | const char *ssl_alert_name(int alert); |
71 | const char *ssl_protocol_name(int protocol); | |
a263f320 | 72 | const char *ssl_verify_callback_name(ssl_verify_callback_t verify_callback); |
5c753de6 | 73 | const char *ssl_servername_name(ssl_servername_t server); |
81fc33c9 | 74 | const char *ssl_session_ticket_name(ssl_session_ticket_t server); |
74726750 | 75 | const char *ssl_test_method_name(ssl_test_method_t method); |
453dfd8d EK |
76 | |
77 | /* | |
78 | * Load the test case context from |conf|. | |
79 | * See test/README.ssl_test for details on the conf file format. | |
80 | */ | |
81 | SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section); | |
82 | ||
83 | SSL_TEST_CTX *SSL_TEST_CTX_new(void); | |
84 | ||
85 | void SSL_TEST_CTX_free(SSL_TEST_CTX *ctx); | |
86 | ||
87 | #endif /* HEADER_SSL_TEST_CTX_H */ |