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.
 
 
 
 
 
 
Richard Levitte 1935a5861c Rework the perl fallback functionality 3 years ago
..
certs Add Restricted PSS certificate and key 3 years ago
ct Verify SCT signatures 6 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 Build: Change all _NO_INST to use attributes instead. 3 years ago
recipes Lowercase command line 'N' argument since params have lower case names 3 years ago
smime-certs Following the license change, modify the boilerplates in test/ 4 years ago
ssl-tests Add TLS tests for RSA-PSS Restricted certificates 3 years ago
testutil Extend tests of SSL_check_chain() 3 years ago
CAss.cnf RT3809: basicConstraints is critical 6 years ago
CAssdh.cnf Import of old SSLeay release: SSLeay 0.9.0b 24 years ago
CAssdsa.cnf Import of old SSLeay release: SSLeay 0.9.0b 24 years ago
CAssrsa.cnf Import of old SSLeay release: SSLeay 0.9.0b 24 years ago
CAtsa.cnf Added support for ESSCertIDv2 5 years ago
P1ss.cnf Use 2K RSA and SHA256 in tests 7 years ago
P2ss.cnf Use 2K RSA and SHA256 in tests 7 years ago
README Update test/README 3 years ago
README.external Remove unnecessary trailing whitespace 3 years ago
README.ssltest.md Session resume broken switching contexts 5 years ago
Sssdsa.cnf Import of old SSLeay release: SSLeay 0.9.0b 24 years ago
Sssrsa.cnf Import of old SSLeay release: SSLeay 0.9.0b 24 years ago
Uss.cnf Create DSA and ECDSA certificates. 7 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 Following the license change, modify the boilerplates in test/ 4 years ago
asn1_dsa_internal_test.c Add simple ASN.1 utils for DSA signature DER. 3 years ago
asn1_encode_test.c fix truncation of integers on 32bit AIX 3 years ago
asn1_internal_test.c Following the license change, modify the boilerplates in test/ 4 years ago
asn1_string_table_test.c typo ANS1 -> ASN1 4 years ago
asn1_time_test.c Fix Typos 3 years ago
asynciotest.c Make the PACKET/WPACKET code available to both libcrypto and libssl 3 years ago
asynctest.c add an additional async notification communication method based on callback 3 years ago
bad_dtls_test.c Make the PACKET/WPACKET code available to both libcrypto and libssl 3 years ago
bftest.c Updated test command line parsing to support commmon commands 3 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 Fix and document BIO_FLAGS_NONCLEAR_RST behavior on memory BIO 3 years ago
bioprinttest.c fix truncation of integers on 32bit AIX 3 years ago
bn_internal_test.c removed BN_clear NULL checks 3 years ago
bn_rand_range.h Test of uniformity of BN_rand_range output. 3 years ago
bntest.c Remove tab characters from C source files. 3 years ago
bntests.pl Following the license change, modify the boilerplates in test/ 4 years ago
build.info Move libapps.a source to apps/lib 3 years ago
casttest.c Following the license change, modify the boilerplates in test/ 4 years ago
chacha_internal_test.c Following the license change, modify the boilerplates in test/ 4 years ago
cipher_overhead_test.c Following the license change, modify the boilerplates in test/ 4 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 Following the license change, modify the boilerplates in test/ 4 years ago
clienthellotest.c Test SSL_set_ciphersuites 3 years ago
cms-examples.pl Following the license change, modify the boilerplates in test/ 4 years ago
cmsapitest.c Updated test command line parsing to support commmon commands 3 years ago
conf_include_test.c Fix Typos 3 years ago
constant_time_test.c Following the license change, modify the boilerplates in test/ 4 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 Extend tests of SSL_check_chain() 3 years ago
ctype_internal_test.c Following the license change, modify the boilerplates in test/ 4 years ago
curve448_internal_test.c Make the EC code available from inside the FIPS provider 3 years ago
d2i_test.c Updated test command line parsing to support commmon commands 3 years ago
danetest.c Updated test command line parsing to support commmon commands 3 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-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 add missing const 4 years ago
dhtest.c Check the DH modulus bit length 3 years ago
drbg_cavs_data.h Following the license change, modify the boilerplates in test/ 4 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 Remove tab characters from C source files. 3 years ago
drbgtest.c drbg: ensure fork-safety without using a pthread_atfork handler 3 years ago
drbgtest.h Following the license change, modify the boilerplates in test/ 4 years ago
dsa_no_digest_size_test.c Following the license change, modify the boilerplates in test/ 4 years ago
dsatest.c Following the license change, modify the boilerplates in test/ 4 years ago
dtls_mtu_test.c Following the license change, modify the boilerplates in test/ 4 years ago
dtlstest.c Fix Typos 3 years ago
dtlsv1listentest.c Following the license change, modify the boilerplates in test/ 4 years ago
ec_internal_test.c [test] unit test for field_inv function pointer in EC_METHOD 3 years ago
ecdsatest.c EC only uses approved curves in FIPS mode. 3 years ago
ecdsatest.h [test] modernize ecdsatest and extend ECDSA sign KATs 3 years ago
ecstresstest.c Remove tab characters from C source files. 3 years ago
ectest.c [test] ECC: check the bounds for auto computing cofactor 3 years ago
enginetest.c test/enginetest.c: Make sure no config file is loaded 3 years ago
errtest.c test/errtest.c: more conditions for checking __FILE__ and __LINE__ 3 years ago
evp_extra_test.c Fix no-dsa 3 years ago
evp_kdf_test.c Update tests to (mostly) use KDF names 3 years ago
evp_pkey_dparams_test.c EC only uses approved curves in FIPS mode. 3 years ago
evp_test.c Fix test error if scrypt is disabled 3 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 Updated test command line parsing to support commmon commands 3 years ago
fips.cnf test/recipes/30-test_evp.t: Modify to test with different providers 3 years ago
generate_buildtest.pl Following the license change, modify the boilerplates in test/ 4 years ago
generate_ssl_tests.pl Rework the perl fallback functionality 3 years ago
gmdifftest.c Following the license change, modify the boilerplates in test/ 4 years ago
gosttest.c Updated test command line parsing to support commmon commands 3 years ago
handshake_helper.c Fix end-point shared secret for DTLS/SCTP 3 years ago
handshake_helper.h Following the license change, modify the boilerplates in test/ 4 years ago
hmactest.c Cleaner disposal of ephemeral engine ids and names 4 years ago
ideatest.c Eliminate NOP cast 4 years ago
igetest.c Deprecate AES_ige_encrypt() and AES_bi_ige_encrypt() 3 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
md2test.c Add a legacy provider and put MD2 in it 3 years ago
mdc2_internal_test.c Following the license change, modify the boilerplates in test/ 4 years ago
mdc2test.c Change provider params from int to size_t 3 years ago
memleaktest.c Following the license change, modify the boilerplates in test/ 4 years ago
modes_internal_test.c Add Common shared code needed to move aes ciphers to providers 3 years ago
namemap_internal_test.c OSSL_NAMEMAP: make names case insensitive 3 years ago
ocspapitest.c OCSP: fix memory leak in OCSP_url_svcloc_new method. 3 years ago
ossl_test_endian.h Fix test builds. 3 years ago
p_test.c Rename provider and core get_param_types functions 3 years ago
packettest.c Make the PACKET/WPACKET code available to both libcrypto and libssl 3 years ago
param_build_test.c Add param builder free function. 3 years ago
params_api_test.c Change OSSL_PARAM return size to not be a pointer. 3 years ago
params_conversion_test.c Change OSSL_PARAM return size to not be a pointer. 3 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 Following the license change, modify the boilerplates in test/ 4 years ago
property_test.c Modify ossl_method_store_add() to accept an OSSL_PROVIDER and check for it 3 years ago
provider_internal_test.c Load the config file by default 3 years ago
provider_internal_test.conf.in Add test for the provider configuration module 3 years ago
provider_test.c Change OSSL_PARAM return size to not be a pointer. 3 years ago
rc2test.c Following the license change, modify the boilerplates in test/ 4 years ago
rc4test.c Following the license change, modify the boilerplates in test/ 4 years ago
rc5test.c Change RC5_32_set_key to return an int type 3 years ago
rdrand_sanitytest.c Remove extern declarations of OPENSSL_ia32cap_P 3 years ago
recordlentest.c Updated test command line parsing to support commmon commands 3 years ago
rsa_complex.c Following the license change, modify the boilerplates in test/ 4 years ago
rsa_mp_test.c Following the license change, modify the boilerplates in test/ 4 years ago
rsa_sp800_56b_test.c removed BN_clear NULL checks 3 years ago
rsa_test.c FIPS 186-4 RSA Generation & Validation 3 years ago
run_tests.pl Following the license change, modify the boilerplates in test/ 4 years ago
sanitytest.c Following the license change, modify the boilerplates in test/ 4 years ago
secmemtest.c Following the license change, modify the boilerplates in test/ 4 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 Make the PACKET/WPACKET code available to both libcrypto and libssl 3 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 Introduce a no-pinshared option 3 years ago
siphash_internal_test.c Following the license change, modify the boilerplates in test/ 4 years ago
sm2_internal_test.c Following the license change, modify the boilerplates in test/ 4 years ago
sm4_internal_test.c Following the license change, modify the boilerplates in test/ 4 years ago
smcont.txt test/smcont.txt: trigger assertion in bio_enc.c. 6 years ago
sparse_array_test.c Fix BIO_printf format warnings 3 years ago
srptest.c Following the license change, modify the boilerplates in test/ 4 years ago
ssl_cert_table_internal_test.c Following the license change, modify the boilerplates in test/ 4 years ago
ssl_test.c Updated test command line parsing to support commmon commands 3 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 end-point shared secret for DTLS/SCTP 3 years ago
ssl_test_ctx_test.c Updated test command line parsing to support commmon commands 3 years ago
ssl_test_ctx_test.conf Implement Maximum Fragment Length TLS extension. 5 years ago
sslapitest.c Fix no-ec 3 years ago
sslbuffertest.c Make the PACKET/WPACKET code available to both libcrypto and libssl 3 years ago
sslcorrupttest.c Updated test command line parsing to support commmon commands 3 years ago
ssltest_old.c Remove NextStep support 3 years ago
ssltestlib.c Fix Typos 3 years ago
ssltestlib.h Write a test for receiving a KeyUpdate (update requested) while writing 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 Use 2K RSA and SHA256 in tests 7 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
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 Extend tests of SSL_check_chain() 3 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 Make the PACKET/WPACKET code available to both libcrypto and libssl 3 years ago
tls13encryptiontest.c Collapse ssl3_state_st (s3) into ssl_st 3 years ago
tls13secretstest.c Fix Typos 3 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 Updated test command line parsing to support commmon commands 3 years ago
v3nametest.c Following the license change, modify the boilerplates in test/ 4 years ago
verify_extra_test.c Support SM2 certificate signing 3 years ago
versions.c Following the license change, modify the boilerplates in test/ 4 years ago
wpackettest.c Make the PACKET/WPACKET code available to both libcrypto and libssl 3 years ago
x509_check_cert_pkey_test.c Fix incorrect usage of a test case 3 years ago
x509_dup_cert_test.c Updated test command line parsing to support commmon commands 3 years ago
x509_internal_test.c Join the x509 and x509v3 directories 3 years ago
x509_time_test.c Following the license change, modify the boilerplates in test/ 4 years ago
x509aux.c constify *_dup() and *i2d_*() and related functions as far as possible, introducing DECLARE_ASN1_DUP_FUNCTION 3 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
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.