From 4fa9f9f744f3e4f1c1d9045e952f2c42d9da32d3 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 26 Feb 2020 19:05:31 +0100 Subject: [PATCH] Revert "programs, tests: Depend only on libmbedcrypto" This reverts commit 986a15199d40f354d467144f0c55ced36d161c1a. --- programs/Makefile | 6 ++++-- programs/aes/CMakeLists.txt | 4 ++-- programs/hash/CMakeLists.txt | 4 ++-- programs/pkey/CMakeLists.txt | 36 +++++++++++++++++----------------- programs/psa/CMakeLists.txt | 6 +++--- programs/random/CMakeLists.txt | 6 +++--- programs/test/CMakeLists.txt | 2 +- programs/util/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 4 ++-- tests/Makefile | 2 ++ tests/data_files/Makefile | 6 ------ 11 files changed, 38 insertions(+), 40 deletions(-) diff --git a/programs/Makefile b/programs/Makefile index 250c6483f..7074df70a 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -9,15 +9,17 @@ LDFLAGS ?= LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64 LOCAL_CXXFLAGS = $(WARNING_CXXFLAGS) -I../include -D_FILE_OFFSET_BITS=64 LOCAL_LDFLAGS = -L../library \ + -lmbedtls$(SHARED_SUFFIX) \ + -lmbedx509$(SHARED_SUFFIX) \ -lmbedcrypto$(SHARED_SUFFIX) include ../3rdparty/Makefile.inc LOCAL_CFLAGS+=$(THIRDPARTY_INCLUDES) ifndef SHARED -DEP=../library/libmbedcrypto.a +DEP=../library/libmbedcrypto.a ../library/libmbedx509.a ../library/libmbedtls.a else -DEP=../library/libmbedcrypto.$(DLEXT) +DEP=../library/libmbedcrypto.$(DLEXT) ../library/libmbedx509.$(DLEXT) ../library/libmbedtls.$(DLEXT) endif ifdef DEBUG diff --git a/programs/aes/CMakeLists.txt b/programs/aes/CMakeLists.txt index 6c4c7e10f..f5a0caabb 100644 --- a/programs/aes/CMakeLists.txt +++ b/programs/aes/CMakeLists.txt @@ -1,8 +1,8 @@ add_executable(aescrypt2 aescrypt2.c) -target_link_libraries(aescrypt2 mbedcrypto) +target_link_libraries(aescrypt2 mbedtls) add_executable(crypt_and_hash crypt_and_hash.c) -target_link_libraries(crypt_and_hash mbedcrypto) +target_link_libraries(crypt_and_hash mbedtls) install(TARGETS aescrypt2 crypt_and_hash DESTINATION "bin" diff --git a/programs/hash/CMakeLists.txt b/programs/hash/CMakeLists.txt index 3c6cca9d4..eda975bb0 100644 --- a/programs/hash/CMakeLists.txt +++ b/programs/hash/CMakeLists.txt @@ -1,8 +1,8 @@ add_executable(hello hello.c) -target_link_libraries(hello mbedcrypto) +target_link_libraries(hello mbedtls) add_executable(generic_sum generic_sum.c) -target_link_libraries(generic_sum mbedcrypto) +target_link_libraries(generic_sum mbedtls) install(TARGETS hello generic_sum DESTINATION "bin" diff --git a/programs/pkey/CMakeLists.txt b/programs/pkey/CMakeLists.txt index 14e6b142d..944a100a2 100644 --- a/programs/pkey/CMakeLists.txt +++ b/programs/pkey/CMakeLists.txt @@ -1,56 +1,56 @@ add_executable(dh_genprime dh_genprime.c) -target_link_libraries(dh_genprime mbedcrypto) +target_link_libraries(dh_genprime mbedtls) add_executable(ecdh_curve25519 ecdh_curve25519.c) -target_link_libraries(ecdh_curve25519 mbedcrypto) +target_link_libraries(ecdh_curve25519 mbedtls) add_executable(ecdsa ecdsa.c) -target_link_libraries(ecdsa mbedcrypto) +target_link_libraries(ecdsa mbedtls) add_executable(gen_key gen_key.c) -target_link_libraries(gen_key mbedcrypto) +target_link_libraries(gen_key mbedtls) add_executable(key_app key_app.c) -target_link_libraries(key_app mbedcrypto) +target_link_libraries(key_app mbedtls) add_executable(key_app_writer key_app_writer.c) -target_link_libraries(key_app_writer mbedcrypto) +target_link_libraries(key_app_writer mbedtls) add_executable(mpi_demo mpi_demo.c) -target_link_libraries(mpi_demo mbedcrypto) +target_link_libraries(mpi_demo mbedtls) add_executable(rsa_genkey rsa_genkey.c) -target_link_libraries(rsa_genkey mbedcrypto) +target_link_libraries(rsa_genkey mbedtls) add_executable(rsa_sign rsa_sign.c) -target_link_libraries(rsa_sign mbedcrypto) +target_link_libraries(rsa_sign mbedtls) add_executable(rsa_verify rsa_verify.c) -target_link_libraries(rsa_verify mbedcrypto) +target_link_libraries(rsa_verify mbedtls) add_executable(rsa_sign_pss rsa_sign_pss.c) -target_link_libraries(rsa_sign_pss mbedcrypto) +target_link_libraries(rsa_sign_pss mbedtls) add_executable(rsa_verify_pss rsa_verify_pss.c) -target_link_libraries(rsa_verify_pss mbedcrypto) +target_link_libraries(rsa_verify_pss mbedtls) add_executable(rsa_encrypt rsa_encrypt.c) -target_link_libraries(rsa_encrypt mbedcrypto) +target_link_libraries(rsa_encrypt mbedtls) add_executable(rsa_decrypt rsa_decrypt.c) -target_link_libraries(rsa_decrypt mbedcrypto) +target_link_libraries(rsa_decrypt mbedtls) add_executable(pk_sign pk_sign.c) -target_link_libraries(pk_sign mbedcrypto) +target_link_libraries(pk_sign mbedtls) add_executable(pk_verify pk_verify.c) -target_link_libraries(pk_verify mbedcrypto) +target_link_libraries(pk_verify mbedtls) add_executable(pk_encrypt pk_encrypt.c) -target_link_libraries(pk_encrypt mbedcrypto) +target_link_libraries(pk_encrypt mbedtls) add_executable(pk_decrypt pk_decrypt.c) -target_link_libraries(pk_decrypt mbedcrypto) +target_link_libraries(pk_decrypt mbedtls) install(TARGETS dh_genprime key_app mpi_demo rsa_genkey rsa_sign rsa_verify rsa_encrypt rsa_decrypt pk_encrypt pk_decrypt pk_sign pk_verify gen_key DESTINATION "bin" diff --git a/programs/psa/CMakeLists.txt b/programs/psa/CMakeLists.txt index 814368316..c80043bc4 100644 --- a/programs/psa/CMakeLists.txt +++ b/programs/psa/CMakeLists.txt @@ -1,11 +1,11 @@ add_executable(crypto_examples crypto_examples.c) -target_link_libraries(crypto_examples mbedcrypto) +target_link_libraries(crypto_examples mbedtls) add_executable(key_ladder_demo key_ladder_demo.c) -target_link_libraries(key_ladder_demo mbedcrypto) +target_link_libraries(key_ladder_demo mbedtls) add_executable(psa_constant_names psa_constant_names.c) -target_link_libraries(psa_constant_names mbedcrypto) +target_link_libraries(psa_constant_names mbedtls) add_custom_target( psa_constant_names_generated diff --git a/programs/random/CMakeLists.txt b/programs/random/CMakeLists.txt index 630c66e9d..30933d88d 100644 --- a/programs/random/CMakeLists.txt +++ b/programs/random/CMakeLists.txt @@ -1,11 +1,11 @@ add_executable(gen_random_havege gen_random_havege.c) -target_link_libraries(gen_random_havege mbedcrypto) +target_link_libraries(gen_random_havege mbedtls) add_executable(gen_random_ctr_drbg gen_random_ctr_drbg.c) -target_link_libraries(gen_random_ctr_drbg mbedcrypto) +target_link_libraries(gen_random_ctr_drbg mbedtls) add_executable(gen_entropy gen_entropy.c) -target_link_libraries(gen_entropy mbedcrypto) +target_link_libraries(gen_entropy mbedtls) install(TARGETS gen_random_havege gen_random_ctr_drbg gen_entropy DESTINATION "bin" diff --git a/programs/test/CMakeLists.txt b/programs/test/CMakeLists.txt index 192ac4cb7..2b455ee01 100644 --- a/programs/test/CMakeLists.txt +++ b/programs/test/CMakeLists.txt @@ -1,5 +1,5 @@ set(libs - mbedcrypto + mbedtls ) add_executable(selftest selftest.c) diff --git a/programs/util/CMakeLists.txt b/programs/util/CMakeLists.txt index 4c3fb0dfa..f9b660453 100644 --- a/programs/util/CMakeLists.txt +++ b/programs/util/CMakeLists.txt @@ -1,5 +1,5 @@ set(libs - mbedcrypto + mbedtls ) add_executable(strerror strerror.c) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3b923a3a3..a1194e520 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ set(libs - mbedcrypto + mbedtls ) # Set the project root directory if it's not already defined, as may happen if @@ -36,7 +36,7 @@ function(add_test_suite suite_name) add_custom_command( OUTPUT test_suite_${data_name}.c COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_test_code.py -f ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function -d ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data -t ${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function -p ${CMAKE_CURRENT_SOURCE_DIR}/suites/host_test.function -s ${CMAKE_CURRENT_SOURCE_DIR}/suites --helpers-file ${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function -o . - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_test_code.py mbedcrypto ${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/host_test.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_test_code.py mbedtls ${CMAKE_CURRENT_SOURCE_DIR}/suites/helpers.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/main_test.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/host_test.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${suite_name}.function ${CMAKE_CURRENT_SOURCE_DIR}/suites/test_suite_${data_name}.data ) set(exe_name test_suite_${data_name}) diff --git a/tests/Makefile b/tests/Makefile index 8fb187e23..3203b883e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -8,6 +8,8 @@ LDFLAGS ?= CRYPTO_INCLUDES ?= -I../include LOCAL_CFLAGS = $(WARNING_CFLAGS) $(CRYPTO_INCLUDES) -I../library -D_FILE_OFFSET_BITS=64 LOCAL_LDFLAGS = -L../library \ + -lmbedtls$(SHARED_SUFFIX) \ + -lmbedx509$(SHARED_SUFFIX) \ -lmbedcrypto$(SHARED_SUFFIX) include ../3rdparty/Makefile.inc diff --git a/tests/data_files/Makefile b/tests/data_files/Makefile index 7f31cc874..e85fd70c2 100644 --- a/tests/data_files/Makefile +++ b/tests/data_files/Makefile @@ -14,12 +14,6 @@ OPENSSL ?= openssl FAKETIME ?= faketime -# Tools from Mbed TLS -# Mbed Crypto depends on Mbed TLS programs to generate its test certificates. -# These programs can be installed from Mbed TLS. -MBEDTLS_CERT_WRITE ?= mbedtls_cert_write -MBEDTLS_CERT_REQ ?= mbedtls_cert_req - ## Build the generated test data. Note that since the final outputs ## are committed to the repository, this target should do nothing on a