Matt Caswell d3d2c0dc68 Adapt ssltest_old to not use deprecated DH APIs | %!s(int64=4) %!d(string=hai) anos | |
---|---|---|
.. | ||
certs | %!s(int64=4) %!d(string=hai) anos | |
ct | %!s(int64=4) %!d(string=hai) anos | |
d2i-tests | %!s(int64=8) %!d(string=hai) anos | |
ocsp-tests | %!s(int64=7) %!d(string=hai) anos | |
ossl_shim | %!s(int64=4) %!d(string=hai) anos | |
recipes | %!s(int64=4) %!d(string=hai) anos | |
smime-certs | %!s(int64=4) %!d(string=hai) anos | |
ssl-tests | %!s(int64=4) %!d(string=hai) anos | |
testutil | %!s(int64=4) %!d(string=hai) anos | |
CAtsa.cnf | %!s(int64=5) %!d(string=hai) anos | |
README-dev.md | %!s(int64=4) %!d(string=hai) anos | |
README-external.md | %!s(int64=4) %!d(string=hai) anos | |
README.md | %!s(int64=4) %!d(string=hai) anos | |
README.ssltest.md | %!s(int64=4) %!d(string=hai) anos | |
aborttest.c | %!s(int64=6) %!d(string=hai) anos | |
acvp_test.c | %!s(int64=4) %!d(string=hai) anos | |
acvp_test.inc | %!s(int64=4) %!d(string=hai) anos | |
aesgcmtest.c | %!s(int64=4) %!d(string=hai) anos | |
afalgtest.c | %!s(int64=4) %!d(string=hai) anos | |
asn1_decode_test.c | %!s(int64=5) %!d(string=hai) anos | |
asn1_dsa_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
asn1_encode_test.c | %!s(int64=5) %!d(string=hai) anos | |
asn1_internal_test.c | %!s(int64=5) %!d(string=hai) anos | |
asn1_string_table_test.c | %!s(int64=6) %!d(string=hai) anos | |
asn1_time_test.c | %!s(int64=4) %!d(string=hai) anos | |
asynciotest.c | %!s(int64=4) %!d(string=hai) anos | |
asynctest.c | %!s(int64=4) %!d(string=hai) anos | |
bad_dtls_test.c | %!s(int64=4) %!d(string=hai) anos | |
bftest.c | %!s(int64=4) %!d(string=hai) anos | |
bio_callback_test.c | %!s(int64=6) %!d(string=hai) anos | |
bio_enc_test.c | %!s(int64=6) %!d(string=hai) anos | |
bio_memleak_test.c | %!s(int64=4) %!d(string=hai) anos | |
bio_prefix_text.c | %!s(int64=4) %!d(string=hai) anos | |
bioprinttest.c | %!s(int64=4) %!d(string=hai) anos | |
bn_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
bn_rand_range.h | %!s(int64=5) %!d(string=hai) anos | |
bntest.c | %!s(int64=4) %!d(string=hai) anos | |
bntests.pl | %!s(int64=6) %!d(string=hai) anos | |
build.info | %!s(int64=4) %!d(string=hai) anos | |
ca-and-certs.cnf | %!s(int64=4) %!d(string=hai) anos | |
casttest.c | %!s(int64=4) %!d(string=hai) anos | |
chacha_internal_test.c | %!s(int64=5) %!d(string=hai) anos | |
cipher_overhead_test.c | %!s(int64=5) %!d(string=hai) anos | |
cipherbytes_test.c | %!s(int64=4) %!d(string=hai) anos | |
cipherlist_test.c | %!s(int64=4) %!d(string=hai) anos | |
ciphername_test.c | %!s(int64=4) %!d(string=hai) anos | |
clienthellotest.c | %!s(int64=4) %!d(string=hai) anos | |
cmactest.c | %!s(int64=4) %!d(string=hai) anos | |
cmp_asn_test.c | %!s(int64=5) %!d(string=hai) anos | |
cmp_client_test.c | %!s(int64=4) %!d(string=hai) anos | |
cmp_ctx_test.c | %!s(int64=4) %!d(string=hai) anos | |
cmp_hdr_test.c | %!s(int64=4) %!d(string=hai) anos | |
cmp_msg_test.c | %!s(int64=4) %!d(string=hai) anos | |
cmp_protect_test.c | %!s(int64=4) %!d(string=hai) anos | |
cmp_server_test.c | %!s(int64=4) %!d(string=hai) anos | |
cmp_status_test.c | %!s(int64=4) %!d(string=hai) anos | |
cmp_testlib.c | %!s(int64=4) %!d(string=hai) anos | |
cmp_testlib.h | %!s(int64=4) %!d(string=hai) anos | |
cmp_vfy_test.c | %!s(int64=4) %!d(string=hai) anos | |
cms-examples.pl | %!s(int64=6) %!d(string=hai) anos | |
cmsapitest.c | %!s(int64=4) %!d(string=hai) anos | |
conf_include_test.c | %!s(int64=5) %!d(string=hai) anos | |
confdump.c | %!s(int64=4) %!d(string=hai) anos | |
constant_time_test.c | %!s(int64=5) %!d(string=hai) anos | |
context_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
crltest.c | %!s(int64=4) %!d(string=hai) anos | |
ct_test.c | %!s(int64=4) %!d(string=hai) anos | |
ctype_internal_test.c | %!s(int64=5) %!d(string=hai) anos | |
curve448_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
d2i_test.c | %!s(int64=4) %!d(string=hai) anos | |
danetest.c | %!s(int64=4) %!d(string=hai) anos | |
danetest.in | %!s(int64=6) %!d(string=hai) anos | |
danetest.pem | %!s(int64=8) %!d(string=hai) anos | |
data.txt | %!s(int64=4) %!d(string=hai) anos | |
data2.txt | %!s(int64=4) %!d(string=hai) anos | |
default-and-fips.cnf | %!s(int64=4) %!d(string=hai) anos | |
default-and-legacy.cnf | %!s(int64=5) %!d(string=hai) anos | |
default.cnf | %!s(int64=5) %!d(string=hai) anos | |
defltfips_test.c | %!s(int64=4) %!d(string=hai) anos | |
destest.c | %!s(int64=4) %!d(string=hai) anos | |
dhtest.c | %!s(int64=4) %!d(string=hai) anos | |
drbg_cavs_data.h | %!s(int64=5) %!d(string=hai) anos | |
drbg_extra_test.h | %!s(int64=4) %!d(string=hai) anos | |
drbgtest.c | %!s(int64=4) %!d(string=hai) anos | |
drbgtest.h | %!s(int64=6) %!d(string=hai) anos | |
dsa_no_digest_size_test.c | %!s(int64=4) %!d(string=hai) anos | |
dsatest.c | %!s(int64=4) %!d(string=hai) anos | |
dtls_mtu_test.c | %!s(int64=4) %!d(string=hai) anos | |
dtlstest.c | %!s(int64=4) %!d(string=hai) anos | |
dtlsv1listentest.c | %!s(int64=6) %!d(string=hai) anos | |
ec_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
ecdsatest.c | %!s(int64=4) %!d(string=hai) anos | |
ecdsatest.h | %!s(int64=5) %!d(string=hai) anos | |
ecstresstest.c | %!s(int64=5) %!d(string=hai) anos | |
ectest.c | %!s(int64=4) %!d(string=hai) anos | |
endecode_test.c | %!s(int64=4) %!d(string=hai) anos | |
endecoder_legacy_test.c | %!s(int64=4) %!d(string=hai) anos | |
enginetest.c | %!s(int64=4) %!d(string=hai) anos | |
errtest.c | %!s(int64=4) %!d(string=hai) anos | |
evp_extra_test.c | %!s(int64=4) %!d(string=hai) anos | |
evp_extra_test2.c | %!s(int64=4) %!d(string=hai) anos | |
evp_fetch_prov_test.c | %!s(int64=4) %!d(string=hai) anos | |
evp_kdf_test.c | %!s(int64=4) %!d(string=hai) anos | |
evp_libctx_test.c | %!s(int64=4) %!d(string=hai) anos | |
evp_pkey_dparams_test.c | %!s(int64=5) %!d(string=hai) anos | |
evp_pkey_provided_test.c | %!s(int64=4) %!d(string=hai) anos | |
evp_test.c | %!s(int64=4) %!d(string=hai) anos | |
evp_test.h | %!s(int64=6) %!d(string=hai) anos | |
exdatatest.c | %!s(int64=4) %!d(string=hai) anos | |
exptest.c | %!s(int64=6) %!d(string=hai) anos | |
fatalerrtest.c | %!s(int64=4) %!d(string=hai) anos | |
ffc_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
filterprov.c | %!s(int64=4) %!d(string=hai) anos | |
fips-and-base.cnf | %!s(int64=4) %!d(string=hai) anos | |
fips.cnf | %!s(int64=4) %!d(string=hai) anos | |
generate_buildtest.pl | %!s(int64=6) %!d(string=hai) anos | |
generate_ssl_tests.pl | %!s(int64=4) %!d(string=hai) anos | |
gmdifftest.c | %!s(int64=6) %!d(string=hai) anos | |
gosttest.c | %!s(int64=4) %!d(string=hai) anos | |
handshake_helper.c | %!s(int64=4) %!d(string=hai) anos | |
handshake_helper.h | %!s(int64=5) %!d(string=hai) anos | |
hexstr_test.c | %!s(int64=4) %!d(string=hai) anos | |
hmactest.c | %!s(int64=4) %!d(string=hai) anos | |
http_test.c | %!s(int64=4) %!d(string=hai) anos | |
ideatest.c | %!s(int64=4) %!d(string=hai) anos | |
igetest.c | %!s(int64=5) %!d(string=hai) anos | |
insta.priv.pem | %!s(int64=4) %!d(string=hai) anos | |
insta_ca.cert.pem | %!s(int64=4) %!d(string=hai) anos | |
keymgmt_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
legacy.cnf | %!s(int64=5) %!d(string=hai) anos | |
lhash_test.c | %!s(int64=4) %!d(string=hai) anos | |
mdc2_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
mdc2test.c | %!s(int64=4) %!d(string=hai) anos | |
memleaktest.c | %!s(int64=5) %!d(string=hai) anos | |
modes_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
namemap_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
ocspapitest.c | %!s(int64=4) %!d(string=hai) anos | |
ossl_store_test.c | %!s(int64=4) %!d(string=hai) anos | |
p_test.c | %!s(int64=4) %!d(string=hai) anos | |
packettest.c | %!s(int64=5) %!d(string=hai) anos | |
param_build_test.c | %!s(int64=4) %!d(string=hai) anos | |
params_api_test.c | %!s(int64=4) %!d(string=hai) anos | |
params_conversion_test.c | %!s(int64=4) %!d(string=hai) anos | |
params_test.c | %!s(int64=4) %!d(string=hai) anos | |
pbelutest.c | %!s(int64=6) %!d(string=hai) anos | |
pemtest.c | %!s(int64=6) %!d(string=hai) anos | |
pkcs12_format_test.c | %!s(int64=4) %!d(string=hai) anos | |
pkcs12_helper.c | %!s(int64=4) %!d(string=hai) anos | |
pkcs12_helper.h | %!s(int64=4) %!d(string=hai) anos | |
pkcs7-1.pem | %!s(int64=26) %!d(string=hai) anos | |
pkcs7.pem | %!s(int64=26) %!d(string=hai) anos | |
pkey_meth_kdf_test.c | %!s(int64=4) %!d(string=hai) anos | |
pkey_meth_test.c | %!s(int64=4) %!d(string=hai) anos | |
pkits-test.pl | %!s(int64=6) %!d(string=hai) anos | |
poly1305_internal_test.c | %!s(int64=5) %!d(string=hai) anos | |
property_test.c | %!s(int64=4) %!d(string=hai) anos | |
provider_fallback_test.c | %!s(int64=4) %!d(string=hai) anos | |
provider_internal_test.c | %!s(int64=5) %!d(string=hai) anos | |
provider_internal_test.cnf.in | %!s(int64=4) %!d(string=hai) anos | |
provider_status_test.c | %!s(int64=4) %!d(string=hai) anos | |
provider_test.c | %!s(int64=5) %!d(string=hai) anos | |
proxy.cnf | %!s(int64=4) %!d(string=hai) anos | |
rand_status_test.c | %!s(int64=4) %!d(string=hai) anos | |
rc2test.c | %!s(int64=4) %!d(string=hai) anos | |
rc4test.c | %!s(int64=4) %!d(string=hai) anos | |
rc5test.c | %!s(int64=4) %!d(string=hai) anos | |
rdrand_sanitytest.c | %!s(int64=5) %!d(string=hai) anos | |
recordlentest.c | %!s(int64=4) %!d(string=hai) anos | |
rsa_complex.c | %!s(int64=6) %!d(string=hai) anos | |
rsa_mp_test.c | %!s(int64=4) %!d(string=hai) anos | |
rsa_sp800_56b_test.c | %!s(int64=4) %!d(string=hai) anos | |
rsa_test.c | %!s(int64=4) %!d(string=hai) anos | |
run_tests.pl | %!s(int64=4) %!d(string=hai) anos | |
sanitytest.c | %!s(int64=6) %!d(string=hai) anos | |
secmemtest.c | %!s(int64=4) %!d(string=hai) anos | |
serverinfo.pem | %!s(int64=11) %!d(string=hai) anos | |
serverinfo2.pem | %!s(int64=7) %!d(string=hai) anos | |
servername_test.c | %!s(int64=4) %!d(string=hai) anos | |
session.pem | %!s(int64=6) %!d(string=hai) anos | |
shibboleth.pfx | %!s(int64=8) %!d(string=hai) anos | |
shlibloadtest.c | %!s(int64=5) %!d(string=hai) anos | |
siphash_internal_test.c | %!s(int64=5) %!d(string=hai) anos | |
sm2_internal_test.c | %!s(int64=4) %!d(string=hai) anos | |
sm4_internal_test.c | %!s(int64=5) %!d(string=hai) anos | |
smcont.txt | %!s(int64=8) %!d(string=hai) anos | |
smcont_zero.txt | %!s(int64=4) %!d(string=hai) anos | |
sparse_array_test.c | %!s(int64=5) %!d(string=hai) anos | |
srptest.c | %!s(int64=6) %!d(string=hai) anos | |
ssl_cert_table_internal_test.c | %!s(int64=5) %!d(string=hai) anos | |
ssl_ctx_test.c | %!s(int64=4) %!d(string=hai) anos | |
ssl_test.c | %!s(int64=4) %!d(string=hai) anos | |
ssl_test.tmpl | %!s(int64=8) %!d(string=hai) anos | |
ssl_test_ctx.c | %!s(int64=4) %!d(string=hai) anos | |
ssl_test_ctx.h | %!s(int64=4) %!d(string=hai) anos | |
ssl_test_ctx_test.c | %!s(int64=4) %!d(string=hai) anos | |
ssl_test_ctx_test.cnf | %!s(int64=4) %!d(string=hai) anos | |
sslapitest.c | %!s(int64=4) %!d(string=hai) anos | |
sslbuffertest.c | %!s(int64=4) %!d(string=hai) anos | |
sslcorrupttest.c | %!s(int64=4) %!d(string=hai) anos | |
ssltest_old.c | %!s(int64=4) %!d(string=hai) anos | |
ssltestlib.c | %!s(int64=4) %!d(string=hai) anos | |
ssltestlib.h | %!s(int64=4) %!d(string=hai) anos | |
stack_test.c | %!s(int64=4) %!d(string=hai) anos | |
sysdefault.cnf | %!s(int64=6) %!d(string=hai) anos | |
sysdefaulttest.c | %!s(int64=6) %!d(string=hai) anos | |
test.cnf | %!s(int64=4) %!d(string=hai) anos | |
test_test.c | %!s(int64=5) %!d(string=hai) anos | |
testcrl.pem | %!s(int64=26) %!d(string=hai) anos | |
testdsa.pem | %!s(int64=9) %!d(string=hai) anos | |
testdsapub.pem | %!s(int64=9) %!d(string=hai) anos | |
testec-p256.pem | %!s(int64=9) %!d(string=hai) anos | |
testecpub-p256.pem | %!s(int64=9) %!d(string=hai) anos | |
tested25519.pem | %!s(int64=5) %!d(string=hai) anos | |
tested25519pub.pem | %!s(int64=5) %!d(string=hai) anos | |
tested448.pem | %!s(int64=5) %!d(string=hai) anos | |
tested448pub.pem | %!s(int64=5) %!d(string=hai) anos | |
testp7.pem | %!s(int64=24) %!d(string=hai) anos | |
testreq2.pem | %!s(int64=26) %!d(string=hai) anos | |
testrsa.pem | %!s(int64=4) %!d(string=hai) anos | |
testrsa2048.pem | %!s(int64=4) %!d(string=hai) anos | |
testrsapub.pem | %!s(int64=9) %!d(string=hai) anos | |
testsid.pem | %!s(int64=10) %!d(string=hai) anos | |
testutil.h | %!s(int64=4) %!d(string=hai) anos | |
testx509.pem | %!s(int64=4) %!d(string=hai) anos | |
threadstest.c | %!s(int64=6) %!d(string=hai) anos | |
time_offset_test.c | %!s(int64=6) %!d(string=hai) anos | |
tls-provider.c | %!s(int64=4) %!d(string=hai) anos | |
tls13ccstest.c | %!s(int64=4) %!d(string=hai) anos | |
tls13encryptiontest.c | %!s(int64=4) %!d(string=hai) anos | |
tls13secretstest.c | %!s(int64=4) %!d(string=hai) anos | |
uitest.c | %!s(int64=4) %!d(string=hai) anos | |
v3-cert1.pem | %!s(int64=26) %!d(string=hai) anos | |
v3-cert2.pem | %!s(int64=26) %!d(string=hai) anos | |
v3_ca_exts.cnf | %!s(int64=4) %!d(string=hai) anos | |
v3ext.c | %!s(int64=4) %!d(string=hai) anos | |
v3nametest.c | %!s(int64=4) %!d(string=hai) anos | |
verify_extra_test.c | %!s(int64=4) %!d(string=hai) anos | |
versions.c | %!s(int64=6) %!d(string=hai) anos | |
wpackettest.c | %!s(int64=4) %!d(string=hai) anos | |
x509_check_cert_pkey_test.c | %!s(int64=4) %!d(string=hai) anos | |
x509_dup_cert_test.c | %!s(int64=4) %!d(string=hai) anos | |
x509_internal_test.c | %!s(int64=5) %!d(string=hai) anos | |
x509_time_test.c | %!s(int64=4) %!d(string=hai) anos | |
x509aux.c | %!s(int64=4) %!d(string=hai) anos |
For any test that you want to perform, you write a script located in
test/recipes/
, named {nn}-test_{name}.t
,
where {nn}
is a two digit number and
{name}
is a unique name of your choice.
Please note that if a test involves a new testing executable, you will need to do some additions in test/build.info. Please refer to the section "Changes to test/build.info" below.
A test executable is named test/{name}test.c
A test recipe is named test/recipes/{nn}-test_{name}.t
, where {nn}
is a two
digit number and {name}
is a unique name of your choice.
The number {nn}
is (somewhat loosely) grouped as follows:
00-04 sanity, internal and essential API tests
05-09 individual symmetric cipher algorithms
10-14 math (bignum)
15-19 individual asymmetric cipher algorithms
20-24 openssl commands (some otherwise not tested)
25-29 certificate forms, generation and verification
30-35 engine and evp
60-79 APIs:
60 X509 subsystem
61 BIO subsystem
65 CMP subsystem
70 PACKET layer
80-89 "larger" protocols (CA, CMS, OCSP, SSL, TSA)
90-98 misc
99 most time consuming tests [such as test_fuzz]
A script that just runs a program looks like this:
#! /usr/bin/perl
use OpenSSL::Test::Simple;
simple_test("test_{name}", "{name}test", "{name}");
{name}
is the unique name you have chosen for your test.
The second argument to simple_test
is the test executable, and simple_test
expects it to be located in test/
For documentation on OpenSSL::Test::Simple
,
do perldoc util/perl/OpenSSL/Test/Simple.pm
.
For more complex tests, you will need to read up on Test::More and
OpenSSL::Test. Test::More is normally preinstalled, do man Test::More
for
documentation. For OpenSSL::Test, do perldoc util/perl/OpenSSL/Test.pm
.
A script to start from could be this:
#! /usr/bin/perl
use strict;
use warnings;
use OpenSSL::Test;
setup("test_{name}");
plan tests => 2; # The number of tests being performed
ok(test1, "test1");
ok(test2, "test1");
sub test1
{
# test feature 1
}
sub test2
{
# test feature 2
}
Whenever a new test involves a new test executable you need to do the following (at all times, replace {NAME} and {name} with the name of your test):
add {name}
to the list of programs under PROGRAMS_NO_INST
create a three line description of how to build the test, you will have to modify the include paths and source files if you don't want to use the basic test framework:
SOURCE[{name}]={name}.c INCLUDE[{name}]=.. ../include ../apps/include DEPEND[{name}]=../libcrypto libtestutil.a
#include "testutil.h"
static int my_test(void)
{
int testresult = 0; /* Assume the test will fail */
int observed;
observed = function(); /* Call the code under test */
if (!TEST_int_eq(observed, 2)) /* Check the result is correct */
goto end; /* Exit on failure - optional */
testresult = 1; /* Mark the test case a success */
end:
cleanup(); /* Any cleanup you require */
return testresult;
}
int setup_tests(void)
{
ADD_TEST(my_test); /* Add each test separately */
return 1; /* Indicate success */
}
You should use the TEST_xxx
macros provided by testutil.h
to test all failure
conditions. These macros produce an error message in a standard format if the
condition is not met (and nothing if the condition is met). Additional
information can be presented with the TEST_info
macro that takes a printf
format string and arguments. TEST_error
is useful for complicated conditions,
it also takes a printf
format string and argument. In all cases the TEST_xxx
macros are guaranteed to evaluate their arguments exactly once. This means
that expressions with side effects are allowed as parameters. Thus,
if (!TEST_ptr(ptr = OPENSSL_malloc(..)))
works fine and can be used in place of:
ptr = OPENSSL_malloc(..);
if (!TEST_ptr(ptr))
The former produces a more meaningful message on failure than the latter.
Note that the test infrastructure automatically sets up all required environment
variables (such as OPENSSL_MODULES
, OPENSSL_CONF
, etc.) for the tests.
Individual tests may choose to override the default settings as required.