Merge pull request #4765 from gilles-peskine-arm/all.sh-subshells-3.0
Run all.sh components in a subshell
This commit is contained in:
commit
0bf740ee4f
6 changed files with 489 additions and 327 deletions
1
programs/.gitignore
vendored
1
programs/.gitignore
vendored
|
@ -56,6 +56,7 @@ ssl/ssl_server
|
||||||
ssl/ssl_server2
|
ssl/ssl_server2
|
||||||
test/benchmark
|
test/benchmark
|
||||||
test/cpp_dummy_build
|
test/cpp_dummy_build
|
||||||
|
test/cpp_dummy_build.cpp
|
||||||
test/ecp-bench
|
test/ecp-bench
|
||||||
test/query_compile_time_config
|
test/query_compile_time_config
|
||||||
test/selftest
|
test/selftest
|
||||||
|
|
|
@ -335,6 +335,10 @@ test/benchmark$(EXEXT): test/benchmark.c $(DEP)
|
||||||
echo " CC test/benchmark.c"
|
echo " CC test/benchmark.c"
|
||||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/benchmark.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) test/benchmark.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
test/cpp_dummy_build.cpp: test/generate_cpp_dummy_build.sh
|
||||||
|
echo " Gen test/cpp_dummy_build.cpp"
|
||||||
|
test/generate_cpp_dummy_build.sh
|
||||||
|
|
||||||
test/cpp_dummy_build$(EXEXT): test/cpp_dummy_build.cpp $(DEP)
|
test/cpp_dummy_build$(EXEXT): test/cpp_dummy_build.cpp $(DEP)
|
||||||
echo " CXX test/cpp_dummy_build.cpp"
|
echo " CXX test/cpp_dummy_build.cpp"
|
||||||
$(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
$(CXX) $(LOCAL_CXXFLAGS) $(CXXFLAGS) test/cpp_dummy_build.cpp $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
@ -395,10 +399,11 @@ clean:
|
||||||
ifndef WINDOWS
|
ifndef WINDOWS
|
||||||
rm -f $(EXES)
|
rm -f $(EXES)
|
||||||
-rm -f ssl/ssl_pthread_server$(EXEXT)
|
-rm -f ssl/ssl_pthread_server$(EXEXT)
|
||||||
-rm -f test/cpp_dummy_build$(EXEXT)
|
-rm -f test/cpp_dummy_build.cpp test/cpp_dummy_build$(EXEXT)
|
||||||
else
|
else
|
||||||
if exist *.o del /Q /F *.o
|
if exist *.o del /Q /F *.o
|
||||||
if exist *.exe del /Q /F *.exe
|
if exist *.exe del /Q /F *.exe
|
||||||
|
if exist test\cpp_dummy_build.cpp del /Q /F test\cpp_dummy_build.cpp
|
||||||
endif
|
endif
|
||||||
$(MAKE) -C fuzz clean
|
$(MAKE) -C fuzz clean
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,17 @@ set(executables_mbedcrypto
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TEST_CPP)
|
if(TEST_CPP)
|
||||||
list(APPEND executables_mbedcrypto cpp_dummy_build)
|
set(cpp_dummy_build_cpp "${CMAKE_CURRENT_BINARY_DIR}/cpp_dummy_build.cpp")
|
||||||
|
set(generate_cpp_dummy_build "${CMAKE_CURRENT_SOURCE_DIR}/generate_cpp_dummy_build.sh")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${cpp_dummy_build_cpp}"
|
||||||
|
COMMAND "${generate_cpp_dummy_build}" "${cpp_dummy_build_cpp}"
|
||||||
|
DEPENDS "${generate_cpp_dummy_build}"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
)
|
||||||
|
add_executable(cpp_dummy_build "${cpp_dummy_build_cpp}")
|
||||||
|
target_include_directories(cpp_dummy_build PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
|
||||||
|
target_link_libraries(cpp_dummy_build ${mbedcrypto_target})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(exe IN LISTS executables_libs executables_mbedcrypto)
|
foreach(exe IN LISTS executables_libs executables_mbedcrypto)
|
||||||
|
|
|
@ -1,98 +0,0 @@
|
||||||
/*
|
|
||||||
* This program is a dummy C++ program to ensure Mbed TLS library header files
|
|
||||||
* can be included and built with a C++ compiler.
|
|
||||||
*
|
|
||||||
* Copyright The Mbed TLS Contributors
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mbedtls/build_info.h"
|
|
||||||
|
|
||||||
#include "mbedtls/aes.h"
|
|
||||||
#include "mbedtls/aria.h"
|
|
||||||
#include "mbedtls/asn1.h"
|
|
||||||
#include "mbedtls/asn1write.h"
|
|
||||||
#include "mbedtls/base64.h"
|
|
||||||
#include "mbedtls/bignum.h"
|
|
||||||
#include "mbedtls/camellia.h"
|
|
||||||
#include "mbedtls/ccm.h"
|
|
||||||
#include "mbedtls/chacha20.h"
|
|
||||||
#include "mbedtls/chachapoly.h"
|
|
||||||
#include "mbedtls/check_config.h"
|
|
||||||
#include "mbedtls/cipher.h"
|
|
||||||
#include "mbedtls/cmac.h"
|
|
||||||
#include "mbedtls/config_psa.h"
|
|
||||||
#include "mbedtls/ctr_drbg.h"
|
|
||||||
#include "mbedtls/debug.h"
|
|
||||||
#include "mbedtls/des.h"
|
|
||||||
#include "mbedtls/dhm.h"
|
|
||||||
#include "mbedtls/ecdh.h"
|
|
||||||
#include "mbedtls/ecdsa.h"
|
|
||||||
#include "mbedtls/ecjpake.h"
|
|
||||||
#include "mbedtls/ecp.h"
|
|
||||||
#include "mbedtls/entropy.h"
|
|
||||||
#include "mbedtls/error.h"
|
|
||||||
#include "mbedtls/gcm.h"
|
|
||||||
#include "mbedtls/hkdf.h"
|
|
||||||
#include "mbedtls/hmac_drbg.h"
|
|
||||||
#include "mbedtls/md.h"
|
|
||||||
#include "mbedtls/md5.h"
|
|
||||||
#include "mbedtls/net_sockets.h"
|
|
||||||
#include "mbedtls/nist_kw.h"
|
|
||||||
#include "mbedtls/oid.h"
|
|
||||||
#include "mbedtls/pem.h"
|
|
||||||
#include "mbedtls/pk.h"
|
|
||||||
#include "mbedtls/pkcs12.h"
|
|
||||||
#include "mbedtls/pkcs5.h"
|
|
||||||
#include "mbedtls/platform_time.h"
|
|
||||||
#include "mbedtls/platform_util.h"
|
|
||||||
#include "mbedtls/poly1305.h"
|
|
||||||
#include "mbedtls/psa_util.h"
|
|
||||||
#include "mbedtls/ripemd160.h"
|
|
||||||
#include "mbedtls/rsa.h"
|
|
||||||
#include "mbedtls/sha1.h"
|
|
||||||
#include "mbedtls/sha256.h"
|
|
||||||
#include "mbedtls/sha512.h"
|
|
||||||
#include "mbedtls/ssl.h"
|
|
||||||
#include "mbedtls/ssl_cache.h"
|
|
||||||
#include "mbedtls/ssl_ciphersuites.h"
|
|
||||||
#include "mbedtls/ssl_cookie.h"
|
|
||||||
#include "mbedtls/ssl_ticket.h"
|
|
||||||
#include "mbedtls/threading.h"
|
|
||||||
#include "mbedtls/timing.h"
|
|
||||||
#include "mbedtls/version.h"
|
|
||||||
#include "mbedtls/x509.h"
|
|
||||||
#include "mbedtls/x509_crl.h"
|
|
||||||
#include "mbedtls/x509_crt.h"
|
|
||||||
#include "mbedtls/x509_csr.h"
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_PLATFORM_C)
|
|
||||||
#include "mbedtls/platform.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
|
|
||||||
#include "mbedtls/memory_buffer_alloc.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "psa/crypto.h"
|
|
||||||
#include "psa/crypto_se_driver.h"
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
mbedtls_platform_context *ctx = NULL;
|
|
||||||
mbedtls_platform_setup(ctx);
|
|
||||||
mbedtls_printf("CPP Build test\n");
|
|
||||||
mbedtls_platform_teardown(ctx);
|
|
||||||
}
|
|
99
programs/test/generate_cpp_dummy_build.sh
Executable file
99
programs/test/generate_cpp_dummy_build.sh
Executable file
|
@ -0,0 +1,99 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DEFAULT_OUTPUT_FILE=programs/test/cpp_dummy_build.cpp
|
||||||
|
|
||||||
|
if [ "$1" = "--help" ]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $0 [OUTPUT]
|
||||||
|
Generate a C++ dummy build program that includes all the headers.
|
||||||
|
OUTPUT defaults to "programs/test/cpp_dummy_build.cpp".
|
||||||
|
Run this program from the root of an Mbed TLS directory tree or from
|
||||||
|
its "programs" or "programs/test" subdirectory.
|
||||||
|
EOF
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copyright The Mbed TLS Contributors
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Ensure a reproducible order for *.h
|
||||||
|
export LC_ALL=C
|
||||||
|
|
||||||
|
print_cpp () {
|
||||||
|
cat <<'EOF'
|
||||||
|
/* Automatically generated file. Do not edit.
|
||||||
|
*
|
||||||
|
* This program is a dummy C++ program to ensure Mbed TLS library header files
|
||||||
|
* can be included and built with a C++ compiler.
|
||||||
|
*
|
||||||
|
* Copyright The Mbed TLS Contributors
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mbedtls/build_info.h"
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for header in include/mbedtls/*.h include/psa/*.h; do
|
||||||
|
case ${header#include/} in
|
||||||
|
mbedtls/mbedtls_config.h) :;; # not meant for direct inclusion
|
||||||
|
psa/crypto_config.h) :;; # not meant for direct inclusion
|
||||||
|
# Some of the psa/crypto_*.h headers are not meant to be included
|
||||||
|
# directly. They do have include guards that make them no-ops if
|
||||||
|
# psa/crypto.h has been included before. Since psa/crypto.h comes
|
||||||
|
# before psa/crypto_*.h in the wildcard enumeration, we don't need
|
||||||
|
# to skip those headers.
|
||||||
|
*) echo "#include \"${header#include/}\"";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
cat <<'EOF'
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
mbedtls_platform_context *ctx = NULL;
|
||||||
|
mbedtls_platform_setup(ctx);
|
||||||
|
mbedtls_printf("CPP Build test passed\n");
|
||||||
|
mbedtls_platform_teardown(ctx);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -d include/mbedtls ]; then
|
||||||
|
:
|
||||||
|
elif [ -d ../include/mbedtls ]; then
|
||||||
|
cd ..
|
||||||
|
elif [ -d ../../include/mbedtls ]; then
|
||||||
|
cd ../..
|
||||||
|
else
|
||||||
|
echo >&2 "This script must be run from an Mbed TLS source tree."
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_cpp >"${1:-$DEFAULT_OUTPUT_FILE}"
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue