• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..11-Sep-2019-

certs/H11-Sep-2019-7,3606,953

ct/H11-Sep-2019-5140

d2i-tests/H03-May-2022-

ocsp-tests/H11-Sep-2019-1,9151,847

ossl_shim/H11-Sep-2019-2,5672,058

recipes/H03-May-2022-17,45513,391

smime-certs/H11-Sep-2019-611547

ssl-tests/H11-Sep-2019-38,66228,853

testutil/H11-Sep-2019-1,9861,440

CAss.cnfH A D11-Sep-20192.2 KiB7759

CAssdh.cnfH A D11-Sep-2019728 2518

CAssdsa.cnfH A D11-Sep-2019729 2418

CAssrsa.cnfH A D11-Sep-2019708 2518

CAtsa.cnfH A D11-Sep-20194.9 KiB166129

P1ss.cnfH A D11-Sep-20191,000 3829

P2ss.cnfH A D11-Sep-20191.1 KiB4635

READMEH A D11-Sep-20194.4 KiB150103

README.externalH A D11-Sep-20194.6 KiB165103

README.ssltest.mdH A D11-Sep-201910.1 KiB300220

Sssdsa.cnfH A D11-Sep-2019821 2820

Sssrsa.cnfH A D11-Sep-2019798 2720

Uss.cnfH A D11-Sep-20191,018 4234

aborttest.cH A D11-Sep-2019464 176

afalgtest.cH A D11-Sep-20194.3 KiB150113

asn1_decode_test.cH A D11-Sep-20194.4 KiB174119

asn1_encode_test.cH A D11-Sep-201928.9 KiB871676

asn1_internal_test.cH A D11-Sep-20193.1 KiB11669

asn1_string_table_test.cH A D11-Sep-20191.9 KiB7853

asn1_time_test.cH A D11-Sep-201915.9 KiB359294

asynciotest.cH A D11-Sep-201912.1 KiB410291

asynctest.cH A D11-Sep-20198.7 KiB292239

bad_dtls_test.cH A D11-Sep-201919.4 KiB587414

bftest.cH A D11-Sep-201915.4 KiB462390

bio_callback_test.cH A D11-Sep-20196.4 KiB179151

bio_enc_test.cH A D11-Sep-20196.7 KiB233181

bio_memleak_test.cH A D11-Sep-20195.7 KiB241199

bioprinttest.cH A D11-Sep-201911.3 KiB303242

bntest.cH A D11-Sep-201972.9 KiB2,4672,035

bntests.plH A D11-Sep-20194.5 KiB157121

build.infoH A D11-Sep-201920.1 KiB599476

casttest.cH A D11-Sep-20193.1 KiB11384

chacha_internal_test.cH A D11-Sep-20198 KiB191163

cipher_overhead_test.cH A D11-Sep-20191.1 KiB5034

cipherbytes_test.cH A D11-Sep-20194.4 KiB150115

cipherlist_test.cH A D11-Sep-20197.1 KiB259202

ciphername_test.cH A D11-Sep-201920.6 KiB471436

clienthellotest.cH A D11-Sep-20198 KiB252164

cms-examples.plH A D11-Sep-20198.7 KiB366289

cmsapitest.cH A D11-Sep-20192.2 KiB9474

conf_include_test.cH A D11-Sep-20195.4 KiB219159

constant_time_test.cH A D11-Sep-201912.3 KiB415351

crltest.cH A D11-Sep-201914.7 KiB394312

ct_test.cH A D11-Sep-201915.9 KiB536427

ctype_internal_test.cH A D11-Sep-20192.7 KiB9167

curve448_internal_test.cH A D11-Sep-201934.8 KiB714616

d2i_test.cH A D11-Sep-20194 KiB165117

danetest.cH A D11-Sep-201911.1 KiB431345

danetest.inH A D11-Sep-201987.6 KiB1,8791,822

danetest.pemH A D11-Sep-2019652 1514

destest.cH A D11-Sep-201925.5 KiB722634

dhtest.cH A D11-Sep-201927.5 KiB696562

drbg_cavs_data.cH A D11-Sep-20197.9 MiB170,321165,984

drbg_cavs_data.hH A D11-Sep-20191.8 KiB8358

drbg_cavs_test.cH A D11-Sep-20197.5 KiB279200

drbgtest.cH A D11-Sep-201930.2 KiB1,030665

drbgtest.hH A D11-Sep-201925.9 KiB580507

dsa_no_digest_size_test.cH A D11-Sep-20198.4 KiB246184

dsatest.cH A D11-Sep-20193.7 KiB142107

dtls_mtu_test.cH A D11-Sep-20196 KiB197132

dtlstest.cH A D11-Sep-201910.9 KiB350258

dtlsv1listentest.cH A D11-Sep-201912.3 KiB358299

ec_internal_test.cH A D11-Sep-20196.5 KiB206156

ecdsatest.cH A D11-Sep-201911.2 KiB340213

ecdsatest.hH A D11-Sep-2019673.6 KiB10,21510,189

ecstresstest.cH A D11-Sep-20193.9 KiB150101

ectest.cH A D11-Sep-201982.7 KiB2,0381,618

enginetest.cH A D11-Sep-201910.7 KiB372272

errtest.cH A D11-Sep-2019941 4025

evp_extra_test.cH A D11-Sep-201942.2 KiB1,103899

evp_test.cH A D11-Sep-201972.6 KiB2,7292,203

evp_test.hH A D11-Sep-2019413 122

exdatatest.cH A D11-Sep-20196.7 KiB266208

exptest.cH A D11-Sep-20195.2 KiB207150

fatalerrtest.cH A D11-Sep-20192.7 KiB9564

generate_buildtest.plH A D11-Sep-2019793 3521

generate_ssl_tests.plH A D11-Sep-20194.4 KiB14282

gmdifftest.cH A D11-Sep-20191.8 KiB6643

gosttest.cH A D11-Sep-20193.1 KiB9266

handshake_helper.cH A D11-Sep-201959.5 KiB1,7731,301

handshake_helper.hH A D11-Sep-20192.8 KiB8243

hmactest.cH A D11-Sep-20196.6 KiB249200

ideatest.cH A D11-Sep-20193.7 KiB12091

igetest.cH A D11-Sep-201916.2 KiB455373

lhash_test.cH A D11-Sep-20195.5 KiB229169

md2test.cH A D11-Sep-20191.6 KiB6849

mdc2_internal_test.cH A D11-Sep-20191.6 KiB7239

mdc2test.cH A D11-Sep-20192 KiB7956

memleaktest.cH A D11-Sep-20191.6 KiB5729

modes_internal_test.cH A D11-Sep-201929 KiB893740

ocspapitest.cH A D11-Sep-20195.9 KiB226186

packettest.cH A D11-Sep-201915 KiB495404

pbelutest.cH A D11-Sep-20191.4 KiB5130

pemtest.cH A D11-Sep-20192.7 KiB9272

pkcs7-1.pemH A D11-Sep-2019851 1615

pkcs7.pemH A D11-Sep-20193.7 KiB5554

pkey_meth_kdf_test.cH A D11-Sep-20195.2 KiB182159

pkey_meth_test.cH A D11-Sep-20192.2 KiB8461

pkits-test.plH A D11-Sep-201931.2 KiB906843

poly1305_internal_test.cH A D11-Sep-201956.2 KiB1,5771,403

rc2test.cH A D11-Sep-20192 KiB6948

rc4test.cH A D11-Sep-20193.9 KiB129103

rc5test.cH A D11-Sep-20198.8 KiB235203

rdrand_sanitytest.cH A D11-Sep-20193.4 KiB12779

recordlentest.cH A D11-Sep-20195.1 KiB198147

rsa_complex.cH A D11-Sep-2019787 2811

rsa_mp_test.cH A D11-Sep-20199.5 KiB231187

rsa_test.cH A D11-Sep-201912.7 KiB370298

run_tests.plH A D11-Sep-20194 KiB14497

sanitytest.cH A D11-Sep-20193 KiB10477

secmemtest.cH A D11-Sep-20195.9 KiB184112

serverinfo.pemH A D11-Sep-2019740 1715

serverinfo2.pemH A D11-Sep-2019412 98

servername_test.cH A D11-Sep-20196.7 KiB243173

session.pemH A D11-Sep-20191.9 KiB3231

shlibloadtest.cH A D11-Sep-20199.1 KiB336259

siphash_internal_test.cH A D11-Sep-201917 KiB291243

sm2_internal_test.cH A D11-Sep-201911.4 KiB379306

sm4_internal_test.cH A D11-Sep-20192.3 KiB8749

srptest.cH A D11-Sep-20198 KiB277203

ssl_cert_table_internal_test.cH A D11-Sep-20192.3 KiB8459

ssl_test.cH A D11-Sep-201918.3 KiB531438

ssl_test.tmplH A D11-Sep-20194.3 KiB127122

ssl_test_ctx.cH A D11-Sep-201928.6 KiB896722

ssl_test_ctx.hH A D11-Sep-20198.4 KiB254148

ssl_test_ctx_test.cH A D11-Sep-20199 KiB263215

ssl_test_ctx_test.confH A D11-Sep-20192 KiB9869

sslapitest.cH A D11-Sep-2019213.4 KiB6,3354,643

sslbuffertest.cH A D11-Sep-20195.2 KiB184118

sslcorrupttest.cH A D11-Sep-20197 KiB268188

ssltest_old.cH A D11-Sep-2019100.8 KiB3,0882,549

ssltestlib.cH A D11-Sep-201928 KiB945759

ssltestlib.hH A D11-Sep-20192 KiB5730

stack_test.cH A D11-Sep-20199.2 KiB381296

sysdefault.cnfH A D11-Sep-2019241 169

sysdefaulttest.cH A D11-Sep-20191.1 KiB5135

test.cnfH A D11-Sep-20192.6 KiB8971

test_test.cH A D11-Sep-201917.6 KiB558489

testcrl.pemH A D11-Sep-2019938 1716

testdsa.pemH A D11-Sep-2019672 1312

testdsapub.pemH A D11-Sep-2019654 1312

testec-p256.pemH A D11-Sep-2019227 65

testecpub-p256.pemH A D11-Sep-2019178 54

testp7.pemH A D11-Sep-20192.8 KiB4746

testreq2.pemH A D11-Sep-2019371 87

testrsa.pemH A D11-Sep-2019497 109

testrsapub.pemH A D11-Sep-2019182 54

testsid.pemH A D11-Sep-20192.3 KiB3938

testutil.hH A D11-Sep-201919.4 KiB469227

testx509.pemH A D11-Sep-2019530 1110

threadstest.cH A D11-Sep-20193.9 KiB194138

time_offset_test.cH A D11-Sep-20193.2 KiB11483

tls13ccstest.cH A D11-Sep-201914.9 KiB499374

tls13encryptiontest.cH A D11-Sep-201913.9 KiB429331

tls13secretstest.cH A D11-Sep-201911.3 KiB401305

uitest.cH A D11-Sep-20192.3 KiB9764

v3-cert1.pemH A D11-Sep-2019944 1716

v3-cert2.pemH A D11-Sep-2019940 1716

v3ext.cH A D11-Sep-20191 KiB4830

v3nametest.cH A D11-Sep-201911.4 KiB367312

verify_extra_test.cH A D11-Sep-20194.5 KiB191117

versions.cH A D11-Sep-2019645 219

wpackettest.cH A D11-Sep-201914.8 KiB381275

x509_check_cert_pkey_test.cH A D11-Sep-20193 KiB12384

x509_dup_cert_test.cH A D11-Sep-20191.3 KiB4830

x509_internal_test.cH A D11-Sep-20191.4 KiB6539

x509_time_test.cH A D11-Sep-201913.5 KiB494366

x509aux.cH A D11-Sep-20195 KiB176139

README

1How to add recipes
2==================
3
4For any test that you want to perform, you write a script located in
5test/recipes/, named {nn}-test_{name}.t, where {nn} is a two digit number and
6{name} is a unique name of your choice.
7
8Please note that if a test involves a new testing executable, you will need to
9do some additions in test/Makefile.  More on this later.
10
11
12Naming conventions
13=================
14
15A test executable is named test/{name}test.c
16
17A test recipe is named test/recipes/{nn}-test_{name}.t, where {nn} is a two
18digit number and {name} is a unique name of your choice.
19
20The number {nn} is (somewhat loosely) grouped as follows:
21
2200-04  sanity, internal and essential API tests
2305-09  individual symmetric cipher algorithms
2410-14  math (bignum)
2515-19  individual asymmetric cipher algorithms
2620-24  openssl commands (some otherwise not tested)
2725-29  certificate forms, generation and verification
2830-35  engine and evp
2960-79  APIs
30   70  PACKET layer
3180-89  "larger" protocols (CA, CMS, OCSP, SSL, TSA)
3290-98  misc
3399     most time consuming tests [such as test_fuzz]
34
35
36A recipe that just runs a test executable
37=========================================
38
39A script that just runs a program looks like this:
40
41    #! /usr/bin/perl
42
43    use OpenSSL::Test::Simple;
44
45    simple_test("test_{name}", "{name}test", "{name}");
46
47{name} is the unique name you have chosen for your test.
48
49The second argument to `simple_test' is the test executable, and `simple_test'
50expects it to be located in test/
51
52For documentation on OpenSSL::Test::Simple, do
53`perldoc util/perl/OpenSSL/Test/Simple.pm'.
54
55
56A recipe that runs a more complex test
57======================================
58
59For more complex tests, you will need to read up on Test::More and
60OpenSSL::Test.  Test::More is normally preinstalled, do `man Test::More' for
61documentation.  For OpenSSL::Test, do `perldoc util/perl/OpenSSL/Test.pm'.
62
63A script to start from could be this:
64
65    #! /usr/bin/perl
66
67    use strict;
68    use warnings;
69    use OpenSSL::Test;
70
71    setup("test_{name}");
72
73    plan tests => 2;                # The number of tests being performed
74
75    ok(test1, "test1");
76    ok(test2, "test1");
77
78    sub test1
79    {
80        # test feature 1
81    }
82
83    sub test2
84    {
85        # test feature 2
86    }
87
88
89Changes to test/build.info
90==========================
91
92Whenever a new test involves a new test executable you need to do the
93following (at all times, replace {NAME} and {name} with the name of your
94test):
95
96* add {name} to the list of programs under PROGRAMS_NO_INST
97
98* create a three line description of how to build the test, you will have
99to modify the include paths and source files if you don't want to use the
100basic test framework:
101
102    SOURCE[{name}]={name}.c
103    INCLUDE[{name}]=.. ../include
104    DEPEND[{name}]=../libcrypto libtestutil.a
105
106Generic form of C test executables
107==================================
108
109    #include "testutil.h"
110
111    static int my_test(void)
112    {
113        int testresult = 0;                 /* Assume the test will fail    */
114        int observed;
115
116        observed = function();              /* Call the code under test     */
117        if (!TEST_int_equal(observed, 2))   /* Check the result is correct  */
118            goto end;                       /* Exit on failure - optional   */
119
120        testresult = 1;                     /* Mark the test case a success */
121    end:
122        cleanup();                          /* Any cleanup you require      */
123        return testresult;
124    }
125
126    int setup_tests(void)
127    {
128        ADD_TEST(my_test);                  /* Add each test separately     */
129        return 1;                           /* Indicate success             */
130    }
131
132You should use the TEST_xxx macros provided by testutil.h to test all failure
133conditions.  These macros produce an error message in a standard format if the
134condition is not met (and nothing if the condition is met).  Additional
135information can be presented with the TEST_info macro that takes a printf
136format string and arguments.  TEST_error is useful for complicated conditions,
137it also takes a printf format string and argument.  In all cases the TEST_xxx
138macros are guaranteed to evaluate their arguments exactly once.  This means
139that expressions with side effects are allowed as parameters.  Thus,
140
141    if (!TEST_ptr(ptr = OPENSSL_malloc(..)))
142
143works fine and can be used in place of:
144
145    ptr = OPENSSL_malloc(..);
146    if (!TEST_ptr(ptr))
147
148The former produces a more meaningful message on failure than the latter.
149
150

README.external

1Running external test suites with OpenSSL
2=========================================
3
4It is possible to integrate external test suites into OpenSSL's "make test".
5This capability is considered a developer option and does not work on all
6platforms.
7
8
9
10The BoringSSL test suite
11========================
12
13In order to run the BoringSSL tests with OpenSSL, first checkout the BoringSSL
14source code into an appropriate directory. This can be done in two ways:
15
161) Separately from the OpenSSL checkout using:
17
18  $ git clone https://boringssl.googlesource.com/boringssl boringssl
19
20  The BoringSSL tests are only confirmed to work at a specific commit in the
21  BoringSSL repository. Later commits may or may not pass the test suite:
22
23  $ cd boringssl
24  $ git checkout 490469f850e
25
262) Using the already configured submodule settings in OpenSSL:
27
28  $ git submodule update --init
29
30Configure the OpenSSL source code to enable the external tests:
31
32$ cd ../openssl
33$ ./config enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers \
34  enable-external-tests
35
36Note that using other config options than those given above may cause the tests
37to fail.
38
39Run the OpenSSL tests by providing the path to the BoringSSL test runner in the
40BORING_RUNNER_DIR environment variable:
41
42$ BORING_RUNNER_DIR=/path/to/boringssl/ssl/test/runner make test
43
44Note that the test suite may change directory while running so the path provided
45should be absolute and not relative to the current working directory.
46
47To see more detailed output you can run just the BoringSSL tests with the
48verbose option:
49
50$ VERBOSE=1 BORING_RUNNER_DIR=/path/to/boringssl/ssl/test/runner make \
51  TESTS="test_external_boringssl" test
52
53
54Test failures and suppressions
55------------------------------
56
57A large number of the BoringSSL tests are known to fail. A test could fail
58because of many possible reasons. For example:
59
60- A bug in OpenSSL
61- Different interpretations of standards
62- Assumptions about the way BoringSSL works that do not apply to OpenSSL
63- The test uses APIs added to BoringSSL that are not present in OpenSSL
64- etc
65
66In order to provide a "clean" baseline run with all the tests passing a config
67file has been provided that suppresses the running of tests that are known to
68fail. These suppressions are held in the file "test/ossl_shim/ossl_config.json"
69within the OpenSSL source code.
70
71The community is encouraged to contribute patches which reduce the number of
72suppressions that are currently present.
73
74
75Python PYCA/Cryptography test suite
76===================================
77
78This python test suite runs cryptographic tests with a local OpenSSL build as
79the implementation.
80
81First checkout the PYCA/Cryptography module into ./pyca-cryptography using:
82
83$ git submodule update --init
84
85Then configure/build OpenSSL compatible with the python module:
86
87$ ./config shared enable-external-tests
88$ make
89
90The tests will run in a python virtual environment which requires virtualenv
91to be installed.
92
93$ make test VERBOSE=1 TESTS=test_external_pyca
94
95Test failures and suppressions
96------------------------------
97
98Some tests target older (<=1.0.2) versions so will not run. Other tests target
99other crypto implementations so are not relevant. Currently no tests fail.
100
101
102krb5 test suite
103===============
104
105Much like the PYCA/Cryptography test suite, this builds and runs the krb5
106tests against the local OpenSSL build.
107
108You will need a git checkout of krb5 at the top level:
109
110$ git clone https://github.com/krb5/krb5
111
112krb5's master has to pass this same CI, but a known-good version is
113krb5-1.15.1-final if you want to be sure.
114
115$ cd krb5
116$ git checkout krb5-1.15.1-final
117$ cd ..
118
119OpenSSL must be built with external tests enabled:
120
121$ ./config enable-external-tests
122$ make
123
124krb5's tests will then be run as part of the rest of the suite, or can be
125explicitly run (with more debugging):
126
127$ VERBOSE=1 make TESTS=test_external_krb5 test
128
129Test-failures suppressions
130--------------------------
131
132krb5 will automatically adapt its test suite to account for the configuration
133of your system.  Certain tests may require more installed packages to run.  No
134tests are expected to fail.
135
136
137Updating test suites
138====================
139
140To update the commit for any of the above test suites:
141
142- Make sure the submodules are cloned locally:
143
144  $ git submodule update --init --recursive
145
146- Enter subdirectory and pull from the repository (use a specific branch/tag if required):
147
148  $ cd <submodule-dir>
149  $ git pull origin master
150
151- Go to root directory, there should be a new git status:
152
153  $ cd ../
154  $ git status
155  ...
156  #       modified:   <submodule-dir> (new commits)
157  ...
158
159- Add/commit/push the update
160
161  git add <submodule-dir>
162  git commit -m "Updated <submodule> to latest commit"
163  git push
164
165

README.ssltest.md

1# SSL tests
2
3SSL testcases are configured in the `ssl-tests` directory.
4
5Each `ssl_*.conf.in` file contains a number of test configurations. These files
6are used to generate testcases in the OpenSSL CONF format.
7
8The precise test output can be dependent on the library configuration. The test
9harness generates the output files on the fly.
10
11However, for verification, we also include checked-in configuration outputs
12corresponding to the default configuration. These testcases live in
13`test/ssl-tests/*.conf` files.
14
15For more details, see `ssl-tests/01-simple.conf.in` for an example.
16
17## Configuring the test
18
19First, give your test a name. The names do not have to be unique.
20
21An example test input looks like this:
22
23```
24    {
25        name => "test-default",
26        server => { "CipherString" => "DEFAULT" },
27        client => { "CipherString" => "DEFAULT" },
28        test   => { "ExpectedResult" => "Success" },
29    }
30```
31
32The test section supports the following options
33
34### Test mode
35
36* Method - the method to test. One of DTLS or TLS.
37
38* HandshakeMode - which handshake flavour to test:
39  - Simple - plain handshake (default)
40  - Resume - test resumption
41  - RenegotiateServer - test server initiated renegotiation
42  - RenegotiateClient - test client initiated renegotiation
43
44When HandshakeMode is Resume or Renegotiate, the original handshake is expected
45to succeed. All configured test expectations are verified against the second
46handshake.
47
48* ApplicationData - amount of application data bytes to send (integer, defaults
49  to 256 bytes). Applies to both client and server. Application data is sent in
50  64kB chunks (but limited by MaxFragmentSize and available parallelization, see
51  below).
52
53* MaxFragmentSize - maximum send fragment size (integer, defaults to 512 in
54  tests - see `SSL_CTX_set_max_send_fragment` for documentation). Applies to
55  both client and server. Lowering the fragment size will split handshake and
56  application data up between more `SSL_write` calls, thus allowing to exercise
57  different code paths. In particular, if the buffer size (64kB) is at least
58  four times as large as the maximum fragment, interleaved multi-buffer crypto
59  implementations may be used on some platforms.
60
61### Test expectations
62
63* ExpectedResult - expected handshake outcome. One of
64  - Success - handshake success
65  - ServerFail - serverside handshake failure
66  - ClientFail - clientside handshake failure
67  - InternalError - some other error
68
69* ExpectedClientAlert, ExpectedServerAlert - expected alert. See
70  `ssl_test_ctx.c` for known values. Note: the expected alert is currently
71  matched against the _last_ received alert (i.e., a fatal alert or a
72  `close_notify`). Warning alert expectations are not yet supported. (A warning
73  alert will not be correctly matched, if followed by a `close_notify` or
74  another alert.)
75
76* ExpectedProtocol - expected negotiated protocol. One of
77  SSLv3, TLSv1, TLSv1.1, TLSv1.2.
78
79* SessionTicketExpected - whether or not a session ticket is expected
80  - Ignore - do not check for a session ticket (default)
81  - Yes - a session ticket is expected
82  - No - a session ticket is not expected
83
84* SessionIdExpected - whether or not a session id is expected
85  - Ignore - do not check for a session id (default)
86  - Yes - a session id is expected
87  - No - a session id is not expected
88
89* ResumptionExpected - whether or not resumption is expected (Resume mode only)
90  - Yes - resumed handshake
91  - No - full handshake (default)
92
93* ExpectedNPNProtocol, ExpectedALPNProtocol - NPN and ALPN expectations.
94
95* ExpectedTmpKeyType - the expected algorithm or curve of server temp key
96
97* ExpectedServerCertType, ExpectedClientCertType - the expected algorithm or
98  curve of server or client certificate
99
100* ExpectedServerSignHash, ExpectedClientSignHash - the expected
101  signing hash used by server or client certificate
102
103* ExpectedServerSignType, ExpectedClientSignType - the expected
104  signature type used by server or client when signing messages
105
106* ExpectedClientCANames - for client auth list of CA names the server must
107  send. If this is "empty" the list is expected to be empty otherwise it
108  is a file of certificates whose subject names form the list.
109
110* ExpectedServerCANames - list of CA names the client must send, TLS 1.3 only.
111  If this is "empty" the list is expected to be empty otherwise it is a file
112  of certificates whose subject names form the list.
113
114## Configuring the client and server
115
116The client and server configurations can be any valid `SSL_CTX`
117configurations. For details, see the manpages for `SSL_CONF_cmd`.
118
119Give your configurations as a dictionary of CONF commands, e.g.
120
121```
122server => {
123    "CipherString" => "DEFAULT",
124    "MinProtocol" => "TLSv1",
125}
126```
127
128The following sections may optionally be defined:
129
130* server2 - this section configures a secondary context that is selected via the
131  ServerName test option. This context is used whenever a ServerNameCallback is
132  specified. If the server2 section is not present, then the configuration
133  matches server.
134* resume_server - this section configures the client to resume its session
135  against a different server. This context is used whenever HandshakeMode is
136  Resume. If the resume_server section is not present, then the configuration
137  matches server.
138* resume_client - this section configures the client to resume its session with
139  a different configuration. In practice this may occur when, for example,
140  upgraded clients reuse sessions persisted on disk.  This context is used
141  whenever HandshakeMode is Resume. If the resume_client section is not present,
142  then the configuration matches client.
143
144### Configuring callbacks and additional options
145
146Additional handshake settings can be configured in the `extra` section of each
147client and server:
148
149```
150client => {
151    "CipherString" => "DEFAULT",
152    extra => {
153        "ServerName" => "server2",
154    }
155}
156```
157
158#### Supported client-side options
159
160* ClientVerifyCallback - the client's custom certificate verify callback.
161  Used to test callback behaviour. One of
162  - None - no custom callback (default)
163  - AcceptAll - accepts all certificates.
164  - RejectAll - rejects all certificates.
165
166* ServerName - the server the client should attempt to connect to. One of
167  - None - do not use SNI (default)
168  - server1 - the initial context
169  - server2 - the secondary context
170  - invalid - an unknown context
171
172* CTValidation - Certificate Transparency validation strategy. One of
173  - None - no validation (default)
174  - Permissive - SSL_CT_VALIDATION_PERMISSIVE
175  - Strict - SSL_CT_VALIDATION_STRICT
176
177#### Supported server-side options
178
179* ServerNameCallback - the SNI switching callback to use
180  - None - no callback (default)
181  - IgnoreMismatch - continue the handshake on SNI mismatch
182  - RejectMismatch - abort the handshake on SNI mismatch
183
184* BrokenSessionTicket - a special test case where the session ticket callback
185  does not initialize crypto.
186  - No (default)
187  - Yes
188
189#### Mutually supported options
190
191* NPNProtocols, ALPNProtocols - NPN and ALPN settings. Server and client
192  protocols can be specified as a comma-separated list, and a callback with the
193  recommended behaviour will be installed automatically.
194
195* SRPUser, SRPPassword - SRP settings. For client, this is the SRP user to
196  connect as; for server, this is a known SRP user.
197
198### Default server and client configurations
199
200The default server certificate and CA files are added to the configurations
201automatically. Server certificate verification is requested by default.
202
203You can override these options by redefining them:
204
205```
206client => {
207    "VerifyCAFile" => "/path/to/custom/file"
208}
209```
210
211or by deleting them
212
213```
214client => {
215    "VerifyCAFile" => undef
216}
217```
218
219## Adding a test to the test harness
220
2211. Add a new test configuration to `test/ssl-tests`, following the examples of
222   existing `*.conf.in` files (for example, `01-simple.conf.in`).
223
2242. Generate the generated `*.conf` test input file. You can do so by running
225   `generate_ssl_tests.pl`:
226
227```
228$ ./config
229$ cd test
230$ TOP=.. perl -I ../util/perl/ generate_ssl_tests.pl ssl-tests/my.conf.in \
231  > ssl-tests/my.conf
232```
233
234where `my.conf.in` is your test input file.
235
236For example, to generate the test cases in `ssl-tests/01-simple.conf.in`, do
237
238```
239$ TOP=.. perl -I ../util/perl/ generate_ssl_tests.pl ssl-tests/01-simple.conf.in > ssl-tests/01-simple.conf
240```
241
242Alternatively (hackish but simple), you can comment out
243
244```
245unlink glob $tmp_file;
246```
247
248in `test/recipes/80-test_ssl_new.t` and run
249
250```
251$ make TESTS=test_ssl_new test
252```
253
254This will save the generated output in a `*.tmp` file in the build directory.
255
2563. Update the number of tests planned in `test/recipes/80-test_ssl_new.t`. If
257   the test suite has any skip conditions, update those too (see
258   `test/recipes/80-test_ssl_new.t` for details).
259
260## Running the tests with the test harness
261
262```
263HARNESS_VERBOSE=yes make TESTS=test_ssl_new test
264```
265
266## Running a test manually
267
268These steps are only needed during development. End users should run `make test`
269or follow the instructions above to run the SSL test suite.
270
271To run an SSL test manually from the command line, the `TEST_CERTS_DIR`
272environment variable to point to the location of the certs. E.g., from the root
273OpenSSL directory, do
274
275```
276$ CTLOG_FILE=test/ct/log_list.conf TEST_CERTS_DIR=test/certs test/ssl_test \
277  test/ssl-tests/01-simple.conf
278```
279
280or for shared builds
281
282```
283$ CTLOG_FILE=test/ct/log_list.conf  TEST_CERTS_DIR=test/certs \
284  util/shlib_wrap.sh test/ssl_test test/ssl-tests/01-simple.conf
285```
286
287Note that the test expectations sometimes depend on the Configure settings. For
288example, the negotiated protocol depends on the set of available (enabled)
289protocols: a build with `enable-ssl3` has different test expectations than a
290build with `no-ssl3`.
291
292The Perl test harness automatically generates expected outputs, so users who
293just run `make test` do not need any extra steps.
294
295However, when running a test manually, keep in mind that the repository version
296of the generated `test/ssl-tests/*.conf` correspond to expected outputs in with
297the default Configure options. To run `ssl_test` manually from the command line
298in a build with a different configuration, you may need to generate the right
299`*.conf` file from the `*.conf.in` input first.
300