From 03bfc58000f7e6ff35a0f4a97821619c054ee275 Mon Sep 17 00:00:00 2001 From: Minos Galanakis Date: Mon, 15 Jul 2024 14:07:52 +0100 Subject: [PATCH] psa_wrapper: Moved input_headers from configuration class. Signed-off-by: Minos Galanakis --- .../code_wrapper/psa_test_wrapper.py | 2 +- scripts/mbedtls_framework/code_wrapper/psa_wrapper.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/mbedtls_framework/code_wrapper/psa_test_wrapper.py b/scripts/mbedtls_framework/code_wrapper/psa_test_wrapper.py index 1337fdb3f..78aec973d 100644 --- a/scripts/mbedtls_framework/code_wrapper/psa_test_wrapper.py +++ b/scripts/mbedtls_framework/code_wrapper/psa_test_wrapper.py @@ -34,7 +34,7 @@ class PSALoggingTestWrapper(PSATestWrapper, PSALoggingWrapper): def __init__(self, out_h_f: str, out_c_f: str, stream: str, - in_headers: List[str] = PSAWrapperConfiguration.input_headers) -> None: + in_headers: List[str] = []) -> None: super().__init__(out_h_f, out_c_f, in_headers)# type: ignore[arg-type] self.set_stream(stream) diff --git a/scripts/mbedtls_framework/code_wrapper/psa_wrapper.py b/scripts/mbedtls_framework/code_wrapper/psa_wrapper.py index 03a067878..dd94b97d8 100644 --- a/scripts/mbedtls_framework/code_wrapper/psa_wrapper.py +++ b/scripts/mbedtls_framework/code_wrapper/psa_wrapper.py @@ -19,7 +19,6 @@ from .psa_buffer import BufferParameter class PSAWrapperConfiguration: """Configuration dataclass for PSA Wrapper.""" - input_headers = ['crypto.h', 'crypto_extra.h'] cpp_guards = ["MBEDTLS_PSA_CRYPTO_C", "MBEDTLS_TEST_HOOKS", "!RECORD_PSA_STATUS_COVERAGE_LOG"] skipped_functions = frozenset([ @@ -67,15 +66,15 @@ class PSAWrapper(c_wrapper_generator.Base): _WRAPPER_NAME_SUFFIX = '' _PSA_WRAPPER_INCLUDES = [''] + _DEFAULT_IN_HEADERS = ['crypto.h', 'crypto_extra.h'] def __init__(self, out_h_f: str, out_c_f: str, - in_headers: List[str] = PSAWrapperConfiguration.input_headers, + in_headers: List[str] = [], config: PSAWrapperConfiguration = PSAWrapperConfiguration()) -> None: super().__init__() - self.in_headers = in_headers self.out_c_f = out_c_f self.out_h_f = out_h_f @@ -91,11 +90,11 @@ class PSAWrapper(c_wrapper_generator.Base): self._SKIP_FUNCTIONS = cfg.skipped_functions self._FUNCTION_GUARDS.update(cfg.function_guards) self._NOT_IMPLEMENTED = cfg.skipped_argument_types - self.read_headers(cfg.input_headers) def read_headers(self, headers: Collection[str]) -> None: """Reads functions to be wrapped from source header files into self.functions.""" - for header_name in headers: + self.in_headers = headers if headers else self._DEFAULT_IN_HEADERS + for header_name in self.in_headers: header_path = self.rel_path(header_name) c_parsing_helper.read_function_declarations(self.functions, header_path) @@ -247,7 +246,7 @@ class PSALoggingWrapper(PSAWrapper, c_wrapper_generator.Logging): stream: str, out_h_f: str, out_c_f: str, - in_headers: List[str] = PSAWrapperConfiguration.input_headers, + in_headers: List[str] = [], config: PSAWrapperConfiguration = PSAWrapperConfiguration()) -> None: super().__init__(out_h_f, out_c_f, in_headers, config)