|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| certs/ | | 12-May-2024 | - | 7,747 | 7,307 |
| ct/ | | 12-May-2024 | - | 51 | 40 |
| d2i-tests/ | | 12-May-2024 | - | | |
| ocsp-tests/ | | 12-May-2024 | - | 1,915 | 1,847 |
| ossl_shim/ | | 12-May-2024 | - | 2,567 | 2,058 |
| recipes/ | | 12-May-2024 | - | 97,861 | 77,936 |
| smime-certs/ | | 12-May-2024 | - | 611 | 547 |
| ssl-tests/ | | 12-May-2024 | - | 38,738 | 28,913 |
| testutil/ | | 12-May-2024 | - | 1,990 | 1,444 |
| CAss.cnf | D | 12-May-2024 | 2.2 KiB | 77 | 59 |
| CAssdh.cnf | D | 12-May-2024 | 728 | 25 | 18 |
| CAssdsa.cnf | D | 12-May-2024 | 729 | 24 | 18 |
| CAssrsa.cnf | D | 12-May-2024 | 708 | 25 | 18 |
| CAtsa.cnf | D | 12-May-2024 | 4.9 KiB | 166 | 129 |
| P1ss.cnf | D | 12-May-2024 | 1,000 | 38 | 29 |
| P2ss.cnf | D | 12-May-2024 | 1.1 KiB | 46 | 35 |
| README | D | 12-May-2024 | 4.4 KiB | 150 | 103 |
| README.external | D | 12-May-2024 | 4.6 KiB | 165 | 103 |
| README.ssltest.md | D | 12-May-2024 | 10.1 KiB | 300 | 220 |
| Sssdsa.cnf | D | 12-May-2024 | 821 | 28 | 20 |
| Sssrsa.cnf | D | 12-May-2024 | 798 | 27 | 20 |
| Uss.cnf | D | 12-May-2024 | 1,018 | 42 | 34 |
| aborttest.c | D | 12-May-2024 | 464 | 17 | 6 |
| afalgtest.c | D | 12-May-2024 | 4.2 KiB | 146 | 115 |
| asn1_decode_test.c | D | 12-May-2024 | 6.3 KiB | 236 | 163 |
| asn1_encode_test.c | D | 12-May-2024 | 29.7 KiB | 904 | 695 |
| asn1_internal_test.c | D | 12-May-2024 | 3.7 KiB | 143 | 84 |
| asn1_string_table_test.c | D | 12-May-2024 | 1.9 KiB | 78 | 53 |
| asn1_time_test.c | D | 12-May-2024 | 15.9 KiB | 359 | 294 |
| asynciotest.c | D | 12-May-2024 | 12.1 KiB | 410 | 291 |
| asynctest.c | D | 12-May-2024 | 8.7 KiB | 292 | 239 |
| bad_dtls_test.c | D | 12-May-2024 | 19.4 KiB | 587 | 414 |
| bftest.c | D | 12-May-2024 | 15.4 KiB | 462 | 390 |
| bio_callback_test.c | D | 12-May-2024 | 6.4 KiB | 179 | 151 |
| bio_enc_test.c | D | 12-May-2024 | 6.7 KiB | 233 | 181 |
| bio_memleak_test.c | D | 12-May-2024 | 7.5 KiB | 305 | 248 |
| bioprinttest.c | D | 12-May-2024 | 11.3 KiB | 304 | 242 |
| bntest.c | D | 12-May-2024 | 92 KiB | 2,973 | 2,483 |
| bntests.pl | D | 12-May-2024 | 4.5 KiB | 157 | 121 |
| build.info | D | 12-May-2024 | 20.4 KiB | 614 | 489 |
| casttest.c | D | 12-May-2024 | 3.1 KiB | 113 | 84 |
| chacha_internal_test.c | D | 12-May-2024 | 8 KiB | 191 | 163 |
| cipher_overhead_test.c | D | 12-May-2024 | 1.1 KiB | 50 | 34 |
| cipherbytes_test.c | D | 12-May-2024 | 4.4 KiB | 150 | 115 |
| cipherlist_test.c | D | 12-May-2024 | 7.1 KiB | 259 | 202 |
| ciphername_test.c | D | 12-May-2024 | 20.6 KiB | 471 | 436 |
| clienthellotest.c | D | 12-May-2024 | 8.3 KiB | 258 | 169 |
| cmactest.c | D | 12-May-2024 | 5.9 KiB | 211 | 167 |
| cms-examples.pl | D | 12-May-2024 | 8.7 KiB | 366 | 289 |
| cmsapitest.c | D | 12-May-2024 | 2.2 KiB | 94 | 74 |
| conf_include_test.c | D | 12-May-2024 | 5.4 KiB | 219 | 159 |
| constant_time_test.c | D | 12-May-2024 | 12.3 KiB | 415 | 351 |
| crltest.c | D | 12-May-2024 | 14.7 KiB | 394 | 312 |
| ct_test.c | D | 12-May-2024 | 15.9 KiB | 536 | 427 |
| ctype_internal_test.c | D | 12-May-2024 | 2.6 KiB | 91 | 67 |
| curve448_internal_test.c | D | 12-May-2024 | 34.8 KiB | 714 | 616 |
| d2i_test.c | D | 12-May-2024 | 4 KiB | 165 | 117 |
| dane-cross.in | D | 12-May-2024 | 6.9 KiB | 114 | 112 |
| danetest.c | D | 12-May-2024 | 11.1 KiB | 431 | 345 |
| danetest.in | D | 12-May-2024 | 87.6 KiB | 1,879 | 1,822 |
| danetest.pem | D | 12-May-2024 | 652 | 15 | 14 |
| data.bin | D | 12-May-2024 | 128 | 5 | 3 |
| destest.c | D | 12-May-2024 | 25.5 KiB | 722 | 634 |
| dhtest.c | D | 12-May-2024 | 27.5 KiB | 696 | 562 |
| drbg_cavs_data.c | D | 12-May-2024 | 7.9 MiB | 170,321 | 165,984 |
| drbg_cavs_data.h | D | 12-May-2024 | 1.8 KiB | 83 | 58 |
| drbg_cavs_test.c | D | 12-May-2024 | 7.5 KiB | 279 | 200 |
| drbgtest.c | D | 12-May-2024 | 30 KiB | 1,029 | 666 |
| drbgtest.h | D | 12-May-2024 | 25.9 KiB | 580 | 507 |
| dsa_no_digest_size_test.c | D | 12-May-2024 | 8.4 KiB | 246 | 184 |
| dsatest.c | D | 12-May-2024 | 3.7 KiB | 142 | 107 |
| dtls_mtu_test.c | D | 12-May-2024 | 6 KiB | 197 | 132 |
| dtlstest.c | D | 12-May-2024 | 10.9 KiB | 350 | 258 |
| dtlsv1listentest.c | D | 12-May-2024 | 12.3 KiB | 358 | 299 |
| ec_internal_test.c | D | 12-May-2024 | 11.3 KiB | 350 | 262 |
| ecdsatest.c | D | 12-May-2024 | 11.2 KiB | 340 | 213 |
| ecdsatest.h | D | 12-May-2024 | 673.6 KiB | 10,215 | 10,189 |
| ecstresstest.c | D | 12-May-2024 | 3.9 KiB | 150 | 101 |
| ectest.c | D | 12-May-2024 | 90.8 KiB | 2,271 | 1,789 |
| enginetest.c | D | 12-May-2024 | 10.7 KiB | 372 | 272 |
| errtest.c | D | 12-May-2024 | 941 | 40 | 25 |
| evp_extra_test.c | D | 12-May-2024 | 70.7 KiB | 2,057 | 1,726 |
| evp_test.c | D | 12-May-2024 | 72.6 KiB | 2,729 | 2,203 |
| evp_test.h | D | 12-May-2024 | 413 | 12 | 2 |
| exdatatest.c | D | 12-May-2024 | 6.7 KiB | 266 | 208 |
| exptest.c | D | 12-May-2024 | 5.2 KiB | 207 | 150 |
| fatalerrtest.c | D | 12-May-2024 | 2.7 KiB | 95 | 64 |
| generate_buildtest.pl | D | 12-May-2024 | 793 | 35 | 21 |
| generate_ssl_tests.pl | D | 12-May-2024 | 4.4 KiB | 142 | 82 |
| gmdifftest.c | D | 12-May-2024 | 1.8 KiB | 66 | 43 |
| gosttest.c | D | 12-May-2024 | 3.1 KiB | 92 | 66 |
| handshake_helper.c | D | 12-May-2024 | 59.5 KiB | 1,774 | 1,301 |
| handshake_helper.h | D | 12-May-2024 | 2.9 KiB | 82 | 43 |
| hmactest.c | D | 12-May-2024 | 7.4 KiB | 270 | 214 |
| ideatest.c | D | 12-May-2024 | 3.7 KiB | 120 | 91 |
| igetest.c | D | 12-May-2024 | 16.2 KiB | 455 | 373 |
| lhash_test.c | D | 12-May-2024 | 5.5 KiB | 229 | 169 |
| md2test.c | D | 12-May-2024 | 1.6 KiB | 68 | 49 |
| mdc2_internal_test.c | D | 12-May-2024 | 1.6 KiB | 72 | 39 |
| mdc2test.c | D | 12-May-2024 | 2 KiB | 79 | 56 |
| memleaktest.c | D | 12-May-2024 | 1.6 KiB | 57 | 29 |
| modes_internal_test.c | D | 12-May-2024 | 29 KiB | 893 | 740 |
| ocspapitest.c | D | 12-May-2024 | 5.9 KiB | 226 | 186 |
| packettest.c | D | 12-May-2024 | 15 KiB | 495 | 404 |
| pbelutest.c | D | 12-May-2024 | 1.4 KiB | 51 | 30 |
| pemtest.c | D | 12-May-2024 | 3.4 KiB | 122 | 97 |
| pkcs7-1.pem | D | 12-May-2024 | 851 | 16 | 15 |
| pkcs7.pem | D | 12-May-2024 | 3.7 KiB | 55 | 54 |
| pkey_meth_kdf_test.c | D | 12-May-2024 | 5.2 KiB | 182 | 159 |
| pkey_meth_test.c | D | 12-May-2024 | 2.2 KiB | 84 | 61 |
| pkits-test.pl | D | 12-May-2024 | 31.2 KiB | 906 | 843 |
| poly1305_internal_test.c | D | 12-May-2024 | 56.2 KiB | 1,577 | 1,403 |
| rc2test.c | D | 12-May-2024 | 2 KiB | 69 | 48 |
| rc4test.c | D | 12-May-2024 | 3.9 KiB | 129 | 103 |
| rc5test.c | D | 12-May-2024 | 8.8 KiB | 235 | 203 |
| rdrand_sanitytest.c | D | 12-May-2024 | 3.4 KiB | 127 | 79 |
| recordlentest.c | D | 12-May-2024 | 5.1 KiB | 198 | 147 |
| rsa_complex.c | D | 12-May-2024 | 787 | 28 | 11 |
| rsa_mp_test.c | D | 12-May-2024 | 9.5 KiB | 231 | 187 |
| rsa_test.c | D | 12-May-2024 | 12.7 KiB | 360 | 282 |
| run_tests.pl | D | 12-May-2024 | 4 KiB | 144 | 97 |
| sanitytest.c | D | 12-May-2024 | 3 KiB | 104 | 77 |
| secmemtest.c | D | 12-May-2024 | 5.9 KiB | 184 | 112 |
| serverinfo.pem | D | 12-May-2024 | 740 | 17 | 15 |
| serverinfo2.pem | D | 12-May-2024 | 412 | 9 | 8 |
| servername_test.c | D | 12-May-2024 | 6.7 KiB | 243 | 173 |
| session.pem | D | 12-May-2024 | 1.9 KiB | 32 | 31 |
| shibboleth.pfx | D | 12-May-2024 | 2.5 KiB | | |
| shlibloadtest.c | D | 12-May-2024 | 9.1 KiB | 336 | 259 |
| siphash_internal_test.c | D | 12-May-2024 | 17 KiB | 291 | 243 |
| sm2_internal_test.c | D | 12-May-2024 | 13.2 KiB | 419 | 334 |
| sm4_internal_test.c | D | 12-May-2024 | 2.3 KiB | 87 | 49 |
| smcont.txt | D | 12-May-2024 | 83 | 1 | 1 |
| srptest.c | D | 12-May-2024 | 8 KiB | 277 | 203 |
| ssl_cert_table_internal_test.c | D | 12-May-2024 | 2.3 KiB | 84 | 59 |
| ssl_ctx_test.c | D | 12-May-2024 | 2.2 KiB | 77 | 56 |
| ssl_test.c | D | 12-May-2024 | 18.3 KiB | 531 | 438 |
| ssl_test.tmpl | D | 12-May-2024 | 4.3 KiB | 127 | 122 |
| ssl_test_ctx.c | D | 12-May-2024 | 28.6 KiB | 896 | 722 |
| ssl_test_ctx.h | D | 12-May-2024 | 8.5 KiB | 254 | 148 |
| ssl_test_ctx_test.c | D | 12-May-2024 | 9 KiB | 263 | 215 |
| ssl_test_ctx_test.conf | D | 12-May-2024 | 2 KiB | 98 | 69 |
| sslapitest.c | D | 12-May-2024 | 236.3 KiB | 6,989 | 5,124 |
| sslbuffertest.c | D | 12-May-2024 | 5.2 KiB | 184 | 118 |
| sslcorrupttest.c | D | 12-May-2024 | 7 KiB | 268 | 188 |
| ssltest_old.c | D | 12-May-2024 | 102.9 KiB | 3,187 | 2,633 |
| ssltestlib.c | D | 12-May-2024 | 28 KiB | 945 | 759 |
| ssltestlib.h | D | 12-May-2024 | 2 KiB | 57 | 30 |
| stack_test.c | D | 12-May-2024 | 9.2 KiB | 381 | 296 |
| sysdefault.cnf | D | 12-May-2024 | 241 | 16 | 9 |
| sysdefaulttest.c | D | 12-May-2024 | 1.1 KiB | 51 | 35 |
| test.cnf | D | 12-May-2024 | 2.6 KiB | 89 | 71 |
| test_test.c | D | 12-May-2024 | 17.6 KiB | 558 | 489 |
| testcrl.pem | D | 12-May-2024 | 938 | 17 | 16 |
| testdsa.pem | D | 12-May-2024 | 672 | 13 | 12 |
| testdsapub.pem | D | 12-May-2024 | 654 | 13 | 12 |
| testec-p256.pem | D | 12-May-2024 | 227 | 6 | 5 |
| testecpub-p256.pem | D | 12-May-2024 | 178 | 5 | 4 |
| tested25519.pem | D | 12-May-2024 | 119 | 4 | 3 |
| tested25519pub.pem | D | 12-May-2024 | 113 | 4 | 3 |
| tested448.pem | D | 12-May-2024 | 156 | 5 | 4 |
| tested448pub.pem | D | 12-May-2024 | 146 | 5 | 4 |
| testp7.pem | D | 12-May-2024 | 2.8 KiB | 47 | 46 |
| testreq2.pem | D | 12-May-2024 | 371 | 8 | 7 |
| testrsa.pem | D | 12-May-2024 | 497 | 10 | 9 |
| testrsa_withattrs.der | D | 12-May-2024 | 1.2 KiB | | |
| testrsa_withattrs.pem | D | 12-May-2024 | 1.7 KiB | 30 | 29 |
| testrsapub.pem | D | 12-May-2024 | 182 | 5 | 4 |
| testsid.pem | D | 12-May-2024 | 2.3 KiB | 39 | 38 |
| testutil.h | D | 12-May-2024 | 19.4 KiB | 469 | 227 |
| testx509.pem | D | 12-May-2024 | 530 | 11 | 10 |
| threadstest.c | D | 12-May-2024 | 3.9 KiB | 194 | 138 |
| time_offset_test.c | D | 12-May-2024 | 3.2 KiB | 114 | 83 |
| tls13ccstest.c | D | 12-May-2024 | 14.9 KiB | 499 | 374 |
| tls13encryptiontest.c | D | 12-May-2024 | 13.9 KiB | 429 | 331 |
| tls13secretstest.c | D | 12-May-2024 | 11.3 KiB | 401 | 305 |
| uitest.c | D | 12-May-2024 | 2.3 KiB | 97 | 64 |
| v3-cert1.pem | D | 12-May-2024 | 944 | 17 | 16 |
| v3-cert2.pem | D | 12-May-2024 | 940 | 17 | 16 |
| v3ext.c | D | 12-May-2024 | 1 KiB | 48 | 30 |
| v3nametest.c | D | 12-May-2024 | 19.8 KiB | 719 | 510 |
| verify_extra_test.c | D | 12-May-2024 | 8.6 KiB | 346 | 239 |
| versions.c | D | 12-May-2024 | 645 | 21 | 9 |
| wpackettest.c | D | 12-May-2024 | 14.8 KiB | 381 | 275 |
| x509_check_cert_pkey_test.c | D | 12-May-2024 | 3 KiB | 123 | 84 |
| x509_dup_cert_test.c | D | 12-May-2024 | 1.3 KiB | 48 | 30 |
| x509_internal_test.c | D | 12-May-2024 | 1.4 KiB | 65 | 39 |
| x509_time_test.c | D | 12-May-2024 | 13.6 KiB | 496 | 368 |
| x509aux.c | D | 12-May-2024 | 5.1 KiB | 181 | 145 |
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_eq(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