From fe9666b8c037a515281764c140b4aaf7c3174231 Mon Sep 17 00:00:00 2001 From: Xiaokang Qian Date: Mon, 11 Sep 2023 10:36:20 +0000 Subject: [PATCH] Change the extension type of the file psa_crypto_driver_wrapper Signed-off-by: Xiaokang Qian --- 3rdparty/p256-m/p256-m_driver_entrypoints.c | 3 +-- library/CMakeLists.txt | 6 ++++-- library/Makefile | 10 ++++++---- library/psa_crypto.c | 2 +- ...appers.h => psa_crypto_driver_wrappers_no_static.h} | 0 library/psa_crypto_slot_management.c | 2 +- ...pers.c.jinja => psa_crypto_driver_wrappers.h.jinja} | 2 +- .../psa_crypto_driver_wrappers_no_static.c.jinja | 2 +- scripts/generate_driver_wrappers.py | 2 +- tests/scripts/check-generated-files.sh | 2 +- tests/scripts/check_names.py | 2 +- 11 files changed, 18 insertions(+), 15 deletions(-) rename library/{psa_crypto_driver_wrappers.h => psa_crypto_driver_wrappers_no_static.h} (100%) rename scripts/data_files/driver_templates/{psa_crypto_driver_wrappers.c.jinja => psa_crypto_driver_wrappers.h.jinja} (99%) diff --git a/3rdparty/p256-m/p256-m_driver_entrypoints.c b/3rdparty/p256-m/p256-m_driver_entrypoints.c index f8eeb6767..61310a87b 100644 --- a/3rdparty/p256-m/p256-m_driver_entrypoints.c +++ b/3rdparty/p256-m/p256-m_driver_entrypoints.c @@ -24,8 +24,7 @@ #include "psa/crypto.h" #include #include -#include "psa_crypto_driver_wrappers.h" -#include +#include "psa_crypto_driver_wrappers_no_static.h" #if defined(MBEDTLS_PSA_P256M_DRIVER_ENABLED) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 865cacc83..65b957abf 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -174,14 +174,16 @@ if(GEN_FILES) add_custom_command( OUTPUT - ${CMAKE_CURRENT_BINARY_DIR}/psa_crypto_driver_wrappers.c + ${CMAKE_CURRENT_BINARY_DIR}/psa_crypto_driver_wrappers.h + ${CMAKE_CURRENT_BINARY_DIR}/psa_crypto_driver_wrappers_no_static.c COMMAND ${MBEDTLS_PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_driver_wrappers.py ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/generate_driver_wrappers.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files/driver_templates/psa_crypto_driver_wrappers.c.jinja + ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files/driver_templates/psa_crypto_driver_wrappers.h.jinja + ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/data_files/driver_templates/psa_crypto_driver_wrappers_no_static.c.jinja ) diff --git a/library/Makefile b/library/Makefile index 3d5cdb83a..15816385d 100644 --- a/library/Makefile +++ b/library/Makefile @@ -208,7 +208,7 @@ else all: shared static endif -psa_crypto.o:psa_crypto_driver_wrappers.c +psa_crypto.o:psa_crypto_driver_wrappers.h static: libmbedcrypto.a libmbedx509.a libmbedtls.a cd ../tests && echo "This is a seedfile that contains 64 bytes (65 on Windows)......" > seedfile @@ -318,7 +318,8 @@ libmbedcrypto.dll: $(OBJS_CRYPTO) GENERATED_FILES = \ error.c version_features.c \ ssl_debug_helpers_generated.c \ - psa_crypto_driver_wrappers.c + psa_crypto_driver_wrappers.h \ + psa_crypto_driver_wrappers_no_static.c generated_files: $(GENERATED_FILES) # See root Makefile @@ -355,10 +356,11 @@ version_features.c: $(PERL) ../scripts/generate_features.pl GENERATED_WRAPPER_FILES = \ - psa_crypto_driver_wrappers.c \ + psa_crypto_driver_wrappers.h \ psa_crypto_driver_wrappers_no_static.c $(GENERATED_WRAPPER_FILES): ../scripts/generate_driver_wrappers.py -$(GENERATED_WRAPPER_FILES): ../scripts/data_files/driver_templates/psa_crypto_driver_wrappers.c.jinja +$(GENERATED_WRAPPER_FILES): ../scripts/data_files/driver_templates/psa_crypto_driver_wrappers.h.jinja +$(GENERATED_WRAPPER_FILES): ../scripts/data_files/driver_templates/psa_crypto_driver_wrappers_no_static.c.jinja $(GENERATED_WRAPPER_FILES): echo " Gen $(GENERATED_WRAPPER_FILES)" $(PYTHON) ../scripts/generate_driver_wrappers.py diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 4d3399deb..9ad9c5c8c 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -33,8 +33,8 @@ #include "psa_crypto_cipher.h" #include "psa_crypto_core.h" #include "psa_crypto_invasive.h" -#include "psa_crypto_driver_wrappers.c" #include "psa_crypto_driver_wrappers.h" +#include "psa_crypto_driver_wrappers_no_static.h" #include "psa_crypto_ecp.h" #include "psa_crypto_ffdh.h" #include "psa_crypto_hash.h" diff --git a/library/psa_crypto_driver_wrappers.h b/library/psa_crypto_driver_wrappers_no_static.h similarity index 100% rename from library/psa_crypto_driver_wrappers.h rename to library/psa_crypto_driver_wrappers_no_static.h diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c index ef285acb1..92646c07c 100644 --- a/library/psa_crypto_slot_management.c +++ b/library/psa_crypto_slot_management.c @@ -25,7 +25,7 @@ #include "psa/crypto.h" #include "psa_crypto_core.h" -#include "psa_crypto_driver_wrappers.h" +#include "psa_crypto_driver_wrappers_no_static.h" #include "psa_crypto_slot_management.h" #include "psa_crypto_storage.h" #if defined(MBEDTLS_PSA_CRYPTO_SE_C) diff --git a/scripts/data_files/driver_templates/psa_crypto_driver_wrappers.c.jinja b/scripts/data_files/driver_templates/psa_crypto_driver_wrappers.h.jinja similarity index 99% rename from scripts/data_files/driver_templates/psa_crypto_driver_wrappers.c.jinja rename to scripts/data_files/driver_templates/psa_crypto_driver_wrappers.h.jinja index 6af68ab78..a446d4ad1 100644 --- a/scripts/data_files/driver_templates/psa_crypto_driver_wrappers.c.jinja +++ b/scripts/data_files/driver_templates/psa_crypto_driver_wrappers.h.jinja @@ -25,7 +25,7 @@ #include "psa_crypto_aead.h" #include "psa_crypto_cipher.h" #include "psa_crypto_core.h" -#include "psa_crypto_driver_wrappers.h" +#include "psa_crypto_driver_wrappers_no_static.h" #include "psa_crypto_hash.h" #include "psa_crypto_mac.h" #include "psa_crypto_pake.h" diff --git a/scripts/data_files/driver_templates/psa_crypto_driver_wrappers_no_static.c.jinja b/scripts/data_files/driver_templates/psa_crypto_driver_wrappers_no_static.c.jinja index 6c580167c..9e23a5da2 100644 --- a/scripts/data_files/driver_templates/psa_crypto_driver_wrappers_no_static.c.jinja +++ b/scripts/data_files/driver_templates/psa_crypto_driver_wrappers_no_static.c.jinja @@ -25,7 +25,7 @@ #include "psa_crypto_aead.h" #include "psa_crypto_cipher.h" #include "psa_crypto_core.h" -#include "psa_crypto_driver_wrappers.h" +#include "psa_crypto_driver_wrappers_no_static.h" #include "psa_crypto_hash.h" #include "psa_crypto_mac.h" #include "psa_crypto_pake.h" diff --git a/scripts/generate_driver_wrappers.py b/scripts/generate_driver_wrappers.py index 5e2e5a9c0..ba5c4c27a 100755 --- a/scripts/generate_driver_wrappers.py +++ b/scripts/generate_driver_wrappers.py @@ -168,7 +168,7 @@ def trace_exception(e: Exception, file=sys.stderr) -> None: ), file) -TEMPLATE_FILENAMES = ["psa_crypto_driver_wrappers.c.jinja", +TEMPLATE_FILENAMES = ["psa_crypto_driver_wrappers.h.jinja", "psa_crypto_driver_wrappers_no_static.c.jinja"] def main() -> int: diff --git a/tests/scripts/check-generated-files.sh b/tests/scripts/check-generated-files.sh index a1c37e9f1..9140b4c25 100755 --- a/tests/scripts/check-generated-files.sh +++ b/tests/scripts/check-generated-files.sh @@ -128,7 +128,7 @@ check() check scripts/generate_errors.pl library/error.c check scripts/generate_query_config.pl programs/test/query_config.c -check scripts/generate_driver_wrappers.py library/psa_crypto_driver_wrappers.c +check scripts/generate_driver_wrappers.py library/psa_crypto_driver_wrappers.h check scripts/generate_features.pl library/version_features.c check scripts/generate_ssl_debug_helpers.py library/ssl_debug_helpers_generated.c # generate_visualc_files enumerates source files (library/*.c). It doesn't diff --git a/tests/scripts/check_names.py b/tests/scripts/check_names.py index e6a38ba3e..f812929c7 100755 --- a/tests/scripts/check_names.py +++ b/tests/scripts/check_names.py @@ -284,7 +284,7 @@ class CodeParser(): "library/*.c", "3rdparty/everest/library/everest.c", "3rdparty/everest/library/x25519.c" - ], ["library/psa_crypto_driver_wrappers.c"]) + ], ["library/psa_crypto_driver_wrappers.h"]) symbols = self.parse_symbols() # Remove identifier macros like mbedtls_printf or mbedtls_calloc