A local copy of OpenSSL from GitHub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Patrick Steuer abfc73f374 Fix EVP_DigestSign interface when used with DES CMAC 2 years ago
..
certs Add test cases for the non CA certificate with pathlen:0 2 years ago
ct Use .cnf for config files, not .conf 2 years ago
d2i-tests add test for CVE-2016-7053 6 years ago
ocsp-tests Fix OCSP_basic_verify() cert chain construction in case bs->certs is NULL 5 years ago
ossl_shim Replace BUF_ string function calls with OPENSSL_ ones 3 years ago
recipes Fix EVP_DigestSign interface when used with DES CMAC 2 years ago
smime-certs Remove RANDFILE settings from configuration files 3 years ago
ssl-tests Use .cnf for config files, not .conf 2 years ago
testutil Fix common test framework options 2 years ago
CAss.cnf Use .cnf for config files, not .conf 2 years ago
CAtsa.cnf Remove RANDFILE settings from configuration files 3 years ago
P1ss.cnf Use .cnf for config files, not .conf 2 years ago
P2ss.cnf Use .cnf for config files, not .conf 2 years ago
README TEST: Add test recipe and help program to test BIO_f_prefix() 2 years ago
README.external Remove unnecessary trailing whitespace 3 years ago
README.ssltest.md Use .cnf for config files, not .conf 2 years ago
Uss.cnf Use .cnf for config files, not .conf 2 years ago
aborttest.c Following the license change, modify the boilerplates in test/ 4 years ago
aesgcmtest.c Add EVP_CIPHER_CTX_tag_length() 3 years ago
afalgtest.c Following the license change, modify the boilerplates in test/ 4 years ago
asn1_decode_test.c Update source files for deprecation at 3.0 3 years ago
asn1_dsa_internal_test.c Reorganize private crypto header files 3 years ago
asn1_encode_test.c Update source files for deprecation at 3.0 3 years ago
asn1_internal_test.c Reorganize private crypto header files 3 years ago
asn1_string_table_test.c typo ANS1 -> ASN1 4 years ago
asn1_time_test.c Add duplication APIs to ASN1_TIME and related types 2 years ago
asynciotest.c Fix common test framework options 2 years ago
asynctest.c Deprecate most of debug-memory 2 years ago
bad_dtls_test.c TLS: use EVP for HMAC throughout libssl. 2 years ago
bftest.c Deprecate Low Level Blowfish APIs 2 years ago
bio_callback_test.c Following the license change, modify the boilerplates in test/ 4 years ago
bio_enc_test.c Following the license change, modify the boilerplates in test/ 4 years ago
bio_memleak_test.c Deprecate most of debug-memory 2 years ago
bio_prefix_text.c TEST: Add test recipe and help program to test BIO_f_prefix() 2 years ago
bioprinttest.c fix truncation of integers on 32bit AIX 3 years ago
bn_internal_test.c Reorganize private crypto header files 3 years ago
bn_rand_range.h Test of uniformity of BN_rand_range output. 3 years ago
bntest.c Fix some typos 2 years ago
bntests.pl Following the license change, modify the boilerplates in test/ 4 years ago
build.info HTTP client: make server/proxy and port params more consistent; minor other improvements 2 years ago
casttest.c Deprecate the Low Level CAST APIs 2 years ago
chacha_internal_test.c Reorganize private crypto header files 3 years ago
cipher_overhead_test.c Reorganize local header files 3 years ago
cipherbytes_test.c Following the license change, modify the boilerplates in test/ 4 years ago
cipherlist_test.c Ignore cipher suites when setting cipher list 3 years ago
ciphername_test.c TLS Cipher Suite 0xC102 Support 2 years ago
clienthellotest.c Fix common test framework options 2 years ago
cmp_asn_test.c chunk 6 of CMP contribution to OpenSSL 2 years ago
cmp_client_test.c Chunk 9 of CMP contribution to OpenSSL: CMP client and related tests 2 years ago
cmp_ctx_test.c HTTP client: make server/proxy and port params more consistent; minor other improvements 2 years ago
cmp_hdr_test.c Fix handling of CMP msg senderKID and improve doc of related CTX functions 2 years ago
cmp_msg_test.c Chunk 9 of CMP contribution to OpenSSL: CMP client and related tests 2 years ago
cmp_protect_test.c Fix handling of CMP msg senderKID and improve doc of related CTX functions 2 years ago
cmp_server_test.c Chunk 8 of CMP contribution to OpenSSL: CMP server and cmp_mock_srv.c for testing 2 years ago
cmp_status_test.c Chunk 8 of CMP contribution to OpenSSL: CMP server and cmp_mock_srv.c for testing 2 years ago
cmp_testlib.c Chunk 9 of CMP contribution to OpenSSL: CMP client and related tests 2 years ago
cmp_testlib.h Chunk 9 of CMP contribution to OpenSSL: CMP client and related tests 2 years ago
cmp_vfy_test.c Chunk 9 of CMP contribution to OpenSSL: CMP client and related tests 2 years ago
cms-examples.pl Following the license change, modify the boilerplates in test/ 4 years ago
cmsapitest.c Fix common test framework options 2 years ago
conf_include_test.c Remove RANDFILE settings from configuration files 3 years ago
confdump.c Make sure we free the CONF structure allocated by confdump 3 years ago
constant_time_test.c Reorganize local header files 3 years ago
context_internal_test.c Instead of global data store it in an OPENSSL_CTX 3 years ago
crltest.c Fix a memory leak with di2_X509_CRL reuse 3 years ago
ct_test.c Create a new embeddedSCTs1 that's signed using SHA256 2 years ago
ctype_internal_test.c Reorganize private crypto header files 3 years ago
curve448_internal_test.c Implement a stricter ECX_KEY type 2 years ago
d2i_test.c Fix common test framework options 2 years ago
danetest.c Fix common test framework options 2 years ago
danetest.in Following the license change, modify the boilerplates in test/ 4 years ago
danetest.pem DANE support for X509_verify_cert() 6 years ago
default-and-fips.cnf Use .cnf for config files, not .conf 2 years ago
default-and-legacy.cnf test/recipes/30-test_evp.t: Modify to test with different providers 3 years ago
default.cnf test/recipes/30-test_evp.t: Modify to test with different providers 3 years ago
destest.c Deprecate the low level DES functions. 2 years ago
dhtest.c Change DH_get_nid() to set the value of q if it is not already set 2 years ago
drbg_cavs_data.h Fix header file include guard names 3 years ago
drbg_cavs_data_ctr.c Following the license change, modify the boilerplates in test/ 4 years ago
drbg_cavs_data_hash.c Following the license change, modify the boilerplates in test/ 4 years ago
drbg_cavs_data_hmac.c Following the license change, modify the boilerplates in test/ 4 years ago
drbg_cavs_test.c Reorganize local header files 3 years ago
drbg_extra_test.c AES CTR-DRGB: add test for 32-bit counter overflow 2 years ago
drbg_extra_test.h AES CTR-DRGB: add test for 32-bit counter overflow 2 years ago
drbgtest.c tests/drbgtest: use new RAND_DRBG callback_data API instead of ex_data 2 years ago
drbgtest.h Following the license change, modify the boilerplates in test/ 4 years ago
dsa_no_digest_size_test.c Deprecate the low level DSA functions. 2 years ago
dsatest.c Deprecate the low level DSA functions. 2 years ago
dtls_mtu_test.c Reorganize local header files 3 years ago
dtlstest.c Fix common test framework options 2 years ago
dtlsv1listentest.c Following the license change, modify the boilerplates in test/ 4 years ago
ec_internal_test.c Deprecate the ECDSA and EV_KEY_METHOD functions. 2 years ago
ecdsatest.c TEST: Adapt all applicable tests to the new distinguishing ID 2 years ago
ecdsatest.h Fix header file include guard names 3 years ago
ecstresstest.c Remove tab characters from C source files. 3 years ago
ectest.c Add self-test for EC_POINT_hex2point 3 years ago
enginetest.c test/enginetest.c: Make sure no config file is loaded 3 years ago
errtest.c Modernise the ERR functionality further (new functions and deprecations) 3 years ago
evp_extra_test.c Make it possible to easily specify a libctx for EVP_DigestSign* 2 years ago
evp_fetch_prov_test.c Add support for passing the libctx to the config loader 2 years ago
evp_kdf_test.c Fix no-cmac and no-camellia 3 years ago
evp_pkey_dparams_test.c EC only uses approved curves in FIPS mode. 3 years ago
evp_pkey_provided_test.c Add EVP_PKEY_gettable_params support for accessing EVP_PKEY key data fields 2 years ago
evp_test.c test/evp_test.c: fix keygen_test_run() 2 years ago
evp_test.h Following the license change, modify the boilerplates in test/ 4 years ago
exdatatest.c Add CRYPTO_alloc_ex_data() 3 years ago
exptest.c Following the license change, modify the boilerplates in test/ 4 years ago
fatalerrtest.c Fix common test framework options 2 years ago
ffc_internal_test.c Coverity 1458438: fix uninitialised memory access. 2 years ago
fips.cnf Use .cnf for config files, not .conf 2 years ago
generate_buildtest.pl Following the license change, modify the boilerplates in test/ 4 years ago
generate_ssl_tests.pl TEST: Optionally silence OpenSSL::Test::setup() 2 years ago
gmdifftest.c Following the license change, modify the boilerplates in test/ 4 years ago
gosttest.c TLS Cipher Suite 0xC102 Support 2 years ago
handshake_helper.c TLS: use EVP for HMAC throughout libssl. 2 years ago
handshake_helper.h Fix header file include guard names 3 years ago
hmactest.c Deprecate the low level HMAC functions 2 years ago
http_test.c Chunk 10 of CMP contribution to OpenSSL: CMP http client and related tests 2 years ago
ideatest.c Deprecate the low level IDEA functions. 2 years ago
igetest.c Deprecate the AES_ige_*() functions 3 years ago
keymgmt_internal_test.c Add EVP_PKEY_gettable_params support for accessing EVP_PKEY key data fields 2 years ago
legacy.cnf test/recipes/30-test_evp.t: Modify to test with different providers 3 years ago
lhash_test.c Following the license change, modify the boilerplates in test/ 4 years ago
mdc2_internal_test.c Deprecate the low level MDC2 functions. 2 years ago
mdc2test.c Deprecate the low level MDC2 functions. 2 years ago
memleaktest.c test/memleaktest.c: Modify for use with address/leak sanitizer 2 years ago
modes_internal_test.c Deprecate the low level AES functions 2 years ago
namemap_internal_test.c Modify EVP_CIPHER_is_a() and EVP_MD_is_a() to handle legacy methods too 2 years ago
ocspapitest.c Constify various mostly X509-related parameter types in crypto/ and apps/ 2 years ago
ossl_test_endian.h Fix header file include guard names 3 years ago
p_test.c Add test for providers exposing OSSL_FUNC_PROVIDER_GET_REASON_STRINGS 2 years ago
packettest.c Make the PACKET/WPACKET code available to both libcrypto and libssl 3 years ago
param_build_test.c Param builder: Remove the static size limit. 2 years ago
params_api_test.c test/params_api_test.c: Correct the checks of OSSL_PARAM_set_BN() 3 years ago
params_conversion_test.c Fix common test framework options 2 years ago
params_test.c Fix Typos 3 years ago
pbelutest.c Following the license change, modify the boilerplates in test/ 4 years ago
pemtest.c Following the license change, modify the boilerplates in test/ 4 years ago
pkcs7-1.pem Import of old SSLeay release: SSLeay 0.8.1b 24 years ago
pkcs7.pem Import of old SSLeay release: SSLeay 0.8.1b 24 years ago
pkey_meth_kdf_test.c Added new EVP/KDF API. 3 years ago
pkey_meth_test.c Following the license change, modify the boilerplates in test/ 4 years ago
pkits-test.pl Following the license change, modify the boilerplates in test/ 4 years ago
poly1305_internal_test.c Add ChaCha related ciphers to default provider 3 years ago
property_test.c Properties: make query cache reference count aware. 3 years ago
provider_internal_test.c Load the config file by default 3 years ago
provider_internal_test.cnf.in Use .cnf for config files, not .conf 2 years ago
provider_test.c Change OSSL_PARAM return size to not be a pointer. 3 years ago
rc2test.c Deprecate the low level RC2 functions 2 years ago
rc4test.c Deprecate the low level SHA functions. 2 years ago
rc5test.c Deprecate the low level RC5 functions 2 years ago
rdrand_sanitytest.c Remove extern declarations of OPENSSL_ia32cap_P 3 years ago
recordlentest.c Fix common test framework options 2 years ago
rsa_complex.c Following the license change, modify the boilerplates in test/ 4 years ago
rsa_mp_test.c Deprecate the low level RSA functions. 2 years ago
rsa_sp800_56b_test.c RSA generation: Use more bits of 1/sqrt(2) 3 years ago
rsa_test.c Deprecate the low level RSA functions. 2 years ago
run_tests.pl Rework test/run_tests.pl to support selective verbosity and TAP copy 3 years ago
sanitytest.c Following the license change, modify the boilerplates in test/ 4 years ago
secmemtest.c Make secure-memory be a config option 2 years ago
serverinfo.pem Require ServerInfo PEMs to be named "BEGIN SERVERINFO FOR"... 9 years ago
serverinfo2.pem Add a SERVERINFOV2 format test file 5 years ago
servername_test.c Fix common test framework options 2 years ago
session.pem Don't store the ticket nonce in the session 4 years ago
shibboleth.pfx Add PKCS#12 UTF-8 interoperability test. 6 years ago
shlibloadtest.c Reorganize public header files (part 1) 3 years ago
siphash_internal_test.c Reorganize private crypto header files 3 years ago
sm2_internal_test.c [test] Make sm2_internal_test less fragile to changes in the ec module 2 years ago
sm4_internal_test.c Reorganize private crypto header files 3 years ago
smcont.txt test/smcont.txt: trigger assertion in bio_enc.c. 6 years ago
sparse_array_test.c Reorganize private crypto header files 3 years ago
srptest.c Following the license change, modify the boilerplates in test/ 4 years ago
ssl_cert_table_internal_test.c Reorganize local header files 3 years ago
ssl_ctx_test.c Add ssl_ctx_test to test suite. 3 years ago
ssl_test.c Fix common test framework options 2 years ago
ssl_test.tmpl test/ssl_test.tmpl: make it work with elderly perl. 6 years ago
ssl_test_ctx.c Fix end-point shared secret for DTLS/SCTP 3 years ago
ssl_test_ctx.h Fix header file include guard names 3 years ago
ssl_test_ctx_test.c Use .cnf for config files, not .conf 2 years ago
ssl_test_ctx_test.cnf Use .cnf for config files, not .conf 2 years ago
sslapitest.c Use the new library context aware SRP functions in sslapitest 2 years ago
sslbuffertest.c Fix common test framework options 2 years ago
sslcorrupttest.c Fix common test framework options 2 years ago
sslprovidertest.c Extend the sslprovider_test to be able to additionally test FIPS 2 years ago
ssltest_old.c Deprecate the low level Diffie-Hellman functions. 2 years ago
ssltestlib.c Describe the "want" parameter in int create_bare_ssl_connection() 2 years ago
ssltestlib.h Fix header file include guard names 3 years ago
stack_test.c Following the license change, modify the boilerplates in test/ 4 years ago
sysdefault.cnf Apply system_default configuration on SSL_CTX_new(). 4 years ago
sysdefaulttest.c Following the license change, modify the boilerplates in test/ 4 years ago
test.cnf Add -section option to 'req' command 2 years ago
test_test.c Fix --strict-warnings build 3 years ago
testcrl.pem Import of old SSLeay release: SSLeay 0.8.1b 24 years ago
testdsa.pem Add private/public key conversion tests 7 years ago
testdsapub.pem Add private/public key conversion tests 7 years ago
testec-p256.pem Add private/public key conversion tests 7 years ago
testecpub-p256.pem Add private/public key conversion tests 7 years ago
tested448.pem More testing for CLI usage of Ed25519 and Ed448 keys 2 years ago
tested448pub.pem More testing for CLI usage of Ed25519 and Ed448 keys 2 years ago
tested25519.pem More testing for CLI usage of Ed25519 and Ed448 keys 2 years ago
tested25519pub.pem More testing for CLI usage of Ed25519 and Ed448 keys 2 years ago
testp7.pem Change PKCS#7 test data to take account of removal of 22 years ago
testreq2.pem Import of old SSLeay release: SSLeay 0.8.1b 24 years ago
testrsa.pem Import of old SSLeay release: SSLeay 0.8.1b 24 years ago
testrsapub.pem Add private/public key conversion tests 7 years ago
testsid.pem Remove SSLv2 support 8 years ago
testutil.h Fix common test framework options 2 years ago
testx509.pem Import of old SSLeay release: SSLeay 0.8.1b 24 years ago
threadstest.c Following the license change, modify the boilerplates in test/ 4 years ago
time_offset_test.c Following the license change, modify the boilerplates in test/ 4 years ago
tls13ccstest.c Fix common test framework options 2 years ago
tls13encryptiontest.c Reorganize local header files 3 years ago
tls13secretstest.c Use a fetched cipher for the TLSv1.3 early secret 2 years ago
uitest.c Updated test command line parsing to support commmon commands 3 years ago
v3-cert1.pem Import of old SSLeay release: SSLeay 0.8.1b 24 years ago
v3-cert2.pem Import of old SSLeay release: SSLeay 0.8.1b 24 years ago
v3ext.c Fix common test framework options 2 years ago
v3nametest.c Following the license change, modify the boilerplates in test/ 4 years ago
verify_extra_test.c TEST: Adapt all applicable tests to the new distinguishing ID 2 years ago
versions.c Following the license change, modify the boilerplates in test/ 4 years ago
wpackettest.c Add a WPACKET test for the new DER capability 2 years ago
x509_check_cert_pkey_test.c Fix common test framework options 2 years ago
x509_dup_cert_test.c Fix common test framework options 2 years ago
x509_internal_test.c Join the x509 and x509v3 directories 3 years ago
x509_time_test.c coverity 1456639: fix NULL dereference 2 years ago
x509aux.c Fix common test framework options 2 years ago

README

How to add recipes
==================

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.


Naming conventions
=================

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 recipe that just runs a test executable
=========================================

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'.


A recipe that runs a more complex test
======================================

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
}


Changes to test/build.info
==========================

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

Generic form of C test executables
==================================

#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.