tests: Test crypto via the crypto submodule
Test the crypto implementation via tests from the Mbed Crypto submodule instead of at the Mbed TLS top level. The version test is the only test that is tested from both TLS and Crypto, despite being entirely in libmbedcrypto. This is because the test data is code-gen'd from the version updating script and the version between Mbed TLS and Mbed Crypto don't necessarily always agree. The test data must come from the top level module, as only the top level module will have test data that matches the expected version.
This commit is contained in:
parent
a96f4fe94e
commit
b78b300b2e
4 changed files with 150 additions and 67 deletions
|
@ -195,6 +195,9 @@ if(ENABLE_TESTING)
|
|||
enable_testing()
|
||||
|
||||
add_subdirectory(tests)
|
||||
if(USE_CRYPTO_SUBMODULE)
|
||||
add_subdirectory(crypto/tests)
|
||||
endif()
|
||||
|
||||
# additional convenience targets for Unix only
|
||||
if(UNIX)
|
||||
|
|
6
Makefile
6
Makefile
|
@ -19,6 +19,9 @@ lib:
|
|||
|
||||
tests: lib
|
||||
$(MAKE) -C tests
|
||||
ifdef USE_CRYPTO_SUBMODULE
|
||||
$(MAKE) CRYPTO_INCLUDES:="-I../../include -I../include" -C crypto/tests
|
||||
endif
|
||||
|
||||
ifndef WINDOWS
|
||||
install: no_test
|
||||
|
@ -103,6 +106,9 @@ endif
|
|||
|
||||
check: lib tests
|
||||
$(MAKE) -C tests check
|
||||
ifdef USE_CRYPTO_SUBMODULE
|
||||
$(MAKE) CRYPTO_INCLUDES:="-I../../include -I../include" -C crypto/tests check
|
||||
endif
|
||||
|
||||
test: check
|
||||
|
||||
|
|
|
@ -60,76 +60,78 @@ if(MSVC)
|
|||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX-")
|
||||
endif(MSVC)
|
||||
|
||||
add_test_suite(aes aes.ecb)
|
||||
add_test_suite(aes aes.cbc)
|
||||
add_test_suite(aes aes.cfb)
|
||||
add_test_suite(aes aes.ofb)
|
||||
add_test_suite(aes aes.rest)
|
||||
add_test_suite(aes aes.xts)
|
||||
add_test_suite(arc4)
|
||||
add_test_suite(aria)
|
||||
add_test_suite(asn1write)
|
||||
add_test_suite(base64)
|
||||
add_test_suite(blowfish)
|
||||
add_test_suite(camellia)
|
||||
add_test_suite(ccm)
|
||||
add_test_suite(chacha20)
|
||||
add_test_suite(chachapoly)
|
||||
add_test_suite(cipher cipher.aes)
|
||||
add_test_suite(cipher cipher.arc4)
|
||||
add_test_suite(cipher cipher.blowfish)
|
||||
add_test_suite(cipher cipher.camellia)
|
||||
add_test_suite(cipher cipher.ccm)
|
||||
add_test_suite(cipher cipher.chacha20)
|
||||
add_test_suite(cipher cipher.chachapoly)
|
||||
add_test_suite(cipher cipher.des)
|
||||
add_test_suite(cipher cipher.gcm)
|
||||
add_test_suite(cipher cipher.misc)
|
||||
add_test_suite(cipher cipher.null)
|
||||
add_test_suite(cipher cipher.padding)
|
||||
add_test_suite(cmac)
|
||||
add_test_suite(ctr_drbg)
|
||||
if(NOT USE_CRYPTO_SUBMODULE)
|
||||
add_test_suite(aes aes.ecb)
|
||||
add_test_suite(aes aes.cbc)
|
||||
add_test_suite(aes aes.cfb)
|
||||
add_test_suite(aes aes.ofb)
|
||||
add_test_suite(aes aes.rest)
|
||||
add_test_suite(aes aes.xts)
|
||||
add_test_suite(arc4)
|
||||
add_test_suite(aria)
|
||||
add_test_suite(asn1write)
|
||||
add_test_suite(base64)
|
||||
add_test_suite(blowfish)
|
||||
add_test_suite(camellia)
|
||||
add_test_suite(ccm)
|
||||
add_test_suite(chacha20)
|
||||
add_test_suite(chachapoly)
|
||||
add_test_suite(cipher cipher.aes)
|
||||
add_test_suite(cipher cipher.arc4)
|
||||
add_test_suite(cipher cipher.blowfish)
|
||||
add_test_suite(cipher cipher.camellia)
|
||||
add_test_suite(cipher cipher.ccm)
|
||||
add_test_suite(cipher cipher.chacha20)
|
||||
add_test_suite(cipher cipher.chachapoly)
|
||||
add_test_suite(cipher cipher.des)
|
||||
add_test_suite(cipher cipher.gcm)
|
||||
add_test_suite(cipher cipher.misc)
|
||||
add_test_suite(cipher cipher.null)
|
||||
add_test_suite(cipher cipher.padding)
|
||||
add_test_suite(cmac)
|
||||
add_test_suite(ctr_drbg)
|
||||
add_test_suite(des)
|
||||
add_test_suite(dhm)
|
||||
add_test_suite(ecdh)
|
||||
add_test_suite(ecdsa)
|
||||
add_test_suite(ecjpake)
|
||||
add_test_suite(ecp)
|
||||
add_test_suite(entropy)
|
||||
add_test_suite(error)
|
||||
add_test_suite(gcm gcm.aes128_en)
|
||||
add_test_suite(gcm gcm.aes192_en)
|
||||
add_test_suite(gcm gcm.aes256_en)
|
||||
add_test_suite(gcm gcm.aes128_de)
|
||||
add_test_suite(gcm gcm.aes192_de)
|
||||
add_test_suite(gcm gcm.aes256_de)
|
||||
add_test_suite(gcm gcm.camellia)
|
||||
add_test_suite(gcm gcm.misc)
|
||||
add_test_suite(hkdf)
|
||||
add_test_suite(hmac_drbg hmac_drbg.misc)
|
||||
add_test_suite(hmac_drbg hmac_drbg.no_reseed)
|
||||
add_test_suite(hmac_drbg hmac_drbg.nopr)
|
||||
add_test_suite(hmac_drbg hmac_drbg.pr)
|
||||
add_test_suite(md)
|
||||
add_test_suite(mdx)
|
||||
add_test_suite(memory_buffer_alloc)
|
||||
add_test_suite(mpi)
|
||||
add_test_suite(nist_kw)
|
||||
add_test_suite(pem)
|
||||
add_test_suite(pkcs1_v15)
|
||||
add_test_suite(pkcs1_v21)
|
||||
add_test_suite(pkcs5)
|
||||
add_test_suite(pk)
|
||||
add_test_suite(pkparse)
|
||||
add_test_suite(pkwrite)
|
||||
add_test_suite(poly1305)
|
||||
add_test_suite(shax)
|
||||
add_test_suite(timing)
|
||||
add_test_suite(rsa)
|
||||
add_test_suite(xtea)
|
||||
endif()
|
||||
add_test_suite(debug)
|
||||
add_test_suite(des)
|
||||
add_test_suite(dhm)
|
||||
add_test_suite(ecdh)
|
||||
add_test_suite(ecdsa)
|
||||
add_test_suite(ecjpake)
|
||||
add_test_suite(ecp)
|
||||
add_test_suite(entropy)
|
||||
add_test_suite(error)
|
||||
add_test_suite(gcm gcm.aes128_en)
|
||||
add_test_suite(gcm gcm.aes192_en)
|
||||
add_test_suite(gcm gcm.aes256_en)
|
||||
add_test_suite(gcm gcm.aes128_de)
|
||||
add_test_suite(gcm gcm.aes192_de)
|
||||
add_test_suite(gcm gcm.aes256_de)
|
||||
add_test_suite(gcm gcm.camellia)
|
||||
add_test_suite(gcm gcm.misc)
|
||||
add_test_suite(hkdf)
|
||||
add_test_suite(hmac_drbg hmac_drbg.misc)
|
||||
add_test_suite(hmac_drbg hmac_drbg.no_reseed)
|
||||
add_test_suite(hmac_drbg hmac_drbg.nopr)
|
||||
add_test_suite(hmac_drbg hmac_drbg.pr)
|
||||
add_test_suite(md)
|
||||
add_test_suite(mdx)
|
||||
add_test_suite(memory_buffer_alloc)
|
||||
add_test_suite(mpi)
|
||||
add_test_suite(nist_kw)
|
||||
add_test_suite(pem)
|
||||
add_test_suite(pkcs1_v15)
|
||||
add_test_suite(pkcs1_v21)
|
||||
add_test_suite(pkcs5)
|
||||
add_test_suite(pk)
|
||||
add_test_suite(pkparse)
|
||||
add_test_suite(pkwrite)
|
||||
add_test_suite(poly1305)
|
||||
add_test_suite(shax)
|
||||
add_test_suite(ssl)
|
||||
add_test_suite(timing)
|
||||
add_test_suite(rsa)
|
||||
add_test_suite(version)
|
||||
add_test_suite(xtea)
|
||||
add_test_suite(x509parse)
|
||||
add_test_suite(x509write)
|
||||
|
||||
|
|
|
@ -66,6 +66,78 @@ endif
|
|||
# constructed by stripping path 'suites/' and extension .data.
|
||||
APPS = $(basename $(subst suites/,,$(wildcard suites/test_suite_*.data)))
|
||||
|
||||
ifdef USE_CRYPTO_SUBMODULE
|
||||
APPS := $(filter-out \
|
||||
test_suite_aes.cbc \
|
||||
test_suite_aes.cfb \
|
||||
test_suite_aes.ecb \
|
||||
test_suite_aes.ofb \
|
||||
test_suite_aes.rest \
|
||||
test_suite_aes.xts \
|
||||
test_suite_arc4 \
|
||||
test_suite_aria \
|
||||
test_suite_asn1write \
|
||||
test_suite_base64 \
|
||||
test_suite_blowfish \
|
||||
test_suite_camellia \
|
||||
test_suite_ccm \
|
||||
test_suite_chacha20 \
|
||||
test_suite_chachapoly \
|
||||
test_suite_cipher.aes \
|
||||
test_suite_cipher.arc4 \
|
||||
test_suite_cipher.blowfish \
|
||||
test_suite_cipher.camellia \
|
||||
test_suite_cipher.ccm \
|
||||
test_suite_cipher.chacha20 \
|
||||
test_suite_cipher.chachapoly \
|
||||
test_suite_cipher.des \
|
||||
test_suite_cipher.gcm \
|
||||
test_suite_cipher.misc \
|
||||
test_suite_cipher.null \
|
||||
test_suite_cipher.padding \
|
||||
test_suite_cmac \
|
||||
test_suite_ctr_drbg \
|
||||
test_suite_des \
|
||||
test_suite_dhm \
|
||||
test_suite_ecdh \
|
||||
test_suite_ecdsa \
|
||||
test_suite_ecjpake \
|
||||
test_suite_ecp \
|
||||
test_suite_entropy \
|
||||
test_suite_error \
|
||||
test_suite_gcm.aes128_de \
|
||||
test_suite_gcm.aes128_en \
|
||||
test_suite_gcm.aes192_de \
|
||||
test_suite_gcm.aes192_en \
|
||||
test_suite_gcm.aes256_de \
|
||||
test_suite_gcm.aes256_en \
|
||||
test_suite_gcm.camellia \
|
||||
test_suite_gcm.misc \
|
||||
test_suite_hkdf \
|
||||
test_suite_hmac_drbg.misc \
|
||||
test_suite_hmac_drbg.nopr \
|
||||
test_suite_hmac_drbg.no_reseed \
|
||||
test_suite_hmac_drbg.pr \
|
||||
test_suite_md \
|
||||
test_suite_mdx \
|
||||
test_suite_memory_buffer_alloc \
|
||||
test_suite_mpi \
|
||||
test_suite_nist_kw \
|
||||
test_suite_pem \
|
||||
test_suite_pk \
|
||||
test_suite_pkcs1_v15 \
|
||||
test_suite_pkcs1_v21 \
|
||||
test_suite_pkcs5 \
|
||||
test_suite_pkparse \
|
||||
test_suite_pkwrite \
|
||||
test_suite_poly1305 \
|
||||
test_suite_rsa \
|
||||
test_suite_shax \
|
||||
test_suite_timing \
|
||||
test_suite_xtea \
|
||||
,$(APPS))
|
||||
endif
|
||||
|
||||
# Construct executable name by adding OS specific suffix $(EXEXT).
|
||||
BINARIES := $(addsuffix $(EXEXT),$(APPS))
|
||||
|
||||
|
|
Loading…
Reference in a new issue