diff --git a/docs/architecture/psa-crypto-implementation-structure.md b/docs/architecture/psa-crypto-implementation-structure.md index d7e4f9c488..7e0e37d251 100644 --- a/docs/architecture/psa-crypto-implementation-structure.md +++ b/docs/architecture/psa-crypto-implementation-structure.md @@ -86,7 +86,7 @@ Summary of files to modify when adding a new algorithm or key type: * [ ] `tests/suites/test_suite_psa_crypto_metadata.data` — [New functions and macros](#new-functions-and-macros) * (If adding `PSA_IS_xxx`) `tests/suites/test_suite_psa_crypto_metadata.function` — [New functions and macros](#new-functions-and-macros) * [ ] `tests/suites/test_suite_psa_crypto*.data`, `tests/suites/test_suite_psa_crypto*.function` — [Unit tests](#unit-tests) -* [ ] `scripts/mbedtls_dev/crypto_knowledge.py`, `scripts/mbedtls_dev/asymmetric_key_data.py` — [Unit tests](#unit-tests) +* [ ] `framework/scripts/mbedtls_framework/crypto_knowledge.py`, `framework/scripts/mbedtls_framework/asymmetric_key_data.py` — [Unit tests](#unit-tests) * [ ] `ChangeLog.d/*.txt` — changelog entry Summary of files to modify when adding new API functions: @@ -161,8 +161,8 @@ A number of unit tests are automatically generated by `tests/scripts/generate_ps When adding a new key type or algorithm: -* `scripts/mbedtls_dev/crypto_knowledge.py` contains knowledge about the compatibility of key types, key sizes and algorithms. -* `scripts/mbedtls_dev/asymmetric_key_data.py` contains valid key data for asymmetric key types. +* `framework/scripts/mbedtls_framework/crypto_knowledge.py` contains knowledge about the compatibility of key types, key sizes and algorithms. +* `framework/scripts/mbedtls_framework/asymmetric_key_data.py` contains valid key data for asymmetric key types. Other things need to be tested manually, either in `tests/suites/test_sutie_psa_crypto.data` or in another file. For example (this is not an exhaustive list): diff --git a/scripts/abi_check.py b/scripts/abi_check.py index 8a604c4e24..d3d2bd02f6 100755 --- a/scripts/abi_check.py +++ b/scripts/abi_check.py @@ -101,7 +101,7 @@ from types import SimpleNamespace import xml.etree.ElementTree as ET -from mbedtls_dev import build_tree +from mbedtls_framework import build_tree class AbiChecker: diff --git a/scripts/code_size_compare.py b/scripts/code_size_compare.py index abd13df240..eefda311a0 100755 --- a/scripts/code_size_compare.py +++ b/scripts/code_size_compare.py @@ -21,9 +21,9 @@ import sys import typing from enum import Enum -from mbedtls_dev import build_tree -from mbedtls_dev import logging_util -from mbedtls_dev import typing_util +from mbedtls_framework import build_tree +from mbedtls_framework import logging_util +from mbedtls_framework import typing_util class SupportedArch(Enum): """Supported architecture for code size measurement.""" diff --git a/scripts/generate_driver_wrappers.py b/scripts/generate_driver_wrappers.py index 624ab81df1..ec79c4e647 100755 --- a/scripts/generate_driver_wrappers.py +++ b/scripts/generate_driver_wrappers.py @@ -17,7 +17,7 @@ from traceback import format_tb import argparse import jsonschema import jinja2 -from mbedtls_dev import build_tree +from mbedtls_framework import build_tree JSONSchema = NewType('JSONSchema', object) # The Driver is an Object, but practically it's indexable and can called a dictionary to diff --git a/scripts/generate_psa_constants.py b/scripts/generate_psa_constants.py index f13b507d0d..119a6325fb 100755 --- a/scripts/generate_psa_constants.py +++ b/scripts/generate_psa_constants.py @@ -17,8 +17,8 @@ file is written: import os import sys -from mbedtls_dev import build_tree -from mbedtls_dev import macro_collector +from mbedtls_framework import build_tree +from mbedtls_framework import macro_collector OUTPUT_TEMPLATE = '''\ /* Automatically generated by generate_psa_constant.py. DO NOT EDIT. */ diff --git a/scripts/generate_ssl_debug_helpers.py b/scripts/generate_ssl_debug_helpers.py index a0544f1537..80d2fc76c0 100755 --- a/scripts/generate_ssl_debug_helpers.py +++ b/scripts/generate_ssl_debug_helpers.py @@ -14,7 +14,7 @@ import re import os import textwrap import argparse -from mbedtls_dev import build_tree +from mbedtls_framework import build_tree def remove_c_comments(string): diff --git a/scripts/min_requirements.py b/scripts/min_requirements.py index 9888abe085..c588a01d85 100755 --- a/scripts/min_requirements.py +++ b/scripts/min_requirements.py @@ -14,7 +14,7 @@ import tempfile import typing from typing import List, Optional -from mbedtls_dev import typing_util +from mbedtls_framework import typing_util def pylint_doesn_t_notice_that_certain_types_are_used_in_annotations( _list: List[typing.Any], diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 589643a806..ffe3cc85ae 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -85,12 +85,12 @@ if(GEN_FILES) --directory ${CMAKE_CURRENT_BINARY_DIR}/suites DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/scripts/generate_bignum_tests.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/bignum_common.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/bignum_core.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/bignum_mod_raw.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/bignum_mod.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/test_case.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/test_data_generation.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/bignum_common.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/bignum_core.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/bignum_mod_raw.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/bignum_mod.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_case.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_data_generation.py ) add_custom_command( OUTPUT @@ -103,10 +103,10 @@ if(GEN_FILES) --directory ${CMAKE_CURRENT_BINARY_DIR}/suites DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/scripts/generate_ecp_tests.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/bignum_common.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/ecp.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/test_case.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/test_data_generation.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/bignum_common.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/ecp.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_case.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_data_generation.py ) add_custom_command( OUTPUT @@ -119,13 +119,13 @@ if(GEN_FILES) --directory ${CMAKE_CURRENT_BINARY_DIR}/suites DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/scripts/generate_psa_tests.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/crypto_data_tests.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/crypto_knowledge.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/macro_collector.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/psa_information.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/psa_storage.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/test_case.py - ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/mbedtls_dev/test_data_generation.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/crypto_data_tests.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/crypto_knowledge.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/macro_collector.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/psa_information.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/psa_storage.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_case.py + ${CMAKE_CURRENT_SOURCE_DIR}/../framework/scripts/mbedtls_framework/test_data_generation.py ${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_config.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_values.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/psa/crypto_extra.h diff --git a/tests/Makefile b/tests/Makefile index 7fb4f357cc..3d7a605ab7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -50,35 +50,35 @@ generated_files: $(GENERATED_FILES) src/test_keys.h src/test_certs.h .SECONDARY: generated_bignum_test_data generated_ecp_test_data generated_psa_test_data $(GENERATED_BIGNUM_DATA_FILES): $(gen_file_dep) generated_bignum_test_data generated_bignum_test_data: scripts/generate_bignum_tests.py -generated_bignum_test_data: ../scripts/mbedtls_dev/bignum_common.py -generated_bignum_test_data: ../scripts/mbedtls_dev/bignum_core.py -generated_bignum_test_data: ../scripts/mbedtls_dev/bignum_mod_raw.py -generated_bignum_test_data: ../scripts/mbedtls_dev/bignum_mod.py -generated_bignum_test_data: ../scripts/mbedtls_dev/test_case.py -generated_bignum_test_data: ../scripts/mbedtls_dev/test_data_generation.py +generated_bignum_test_data: ../framework/scripts/mbedtls_framework/bignum_common.py +generated_bignum_test_data: ../framework/scripts/mbedtls_framework/bignum_core.py +generated_bignum_test_data: ../framework/scripts/mbedtls_framework/bignum_mod_raw.py +generated_bignum_test_data: ../framework/scripts/mbedtls_framework/bignum_mod.py +generated_bignum_test_data: ../framework/scripts/mbedtls_framework/test_case.py +generated_bignum_test_data: ../framework/scripts/mbedtls_framework/test_data_generation.py generated_bignum_test_data: echo " Gen $(GENERATED_BIGNUM_DATA_FILES)" $(PYTHON) scripts/generate_bignum_tests.py $(GENERATED_ECP_DATA_FILES): $(gen_file_dep) generated_ecp_test_data generated_ecp_test_data: scripts/generate_ecp_tests.py -generated_ecp_test_data: ../scripts/mbedtls_dev/bignum_common.py -generated_ecp_test_data: ../scripts/mbedtls_dev/ecp.py -generated_ecp_test_data: ../scripts/mbedtls_dev/test_case.py -generated_ecp_test_data: ../scripts/mbedtls_dev/test_data_generation.py +generated_ecp_test_data: ../framework/scripts/mbedtls_framework/bignum_common.py +generated_ecp_test_data: ../framework/scripts/mbedtls_framework/ecp.py +generated_ecp_test_data: ../framework/scripts/mbedtls_framework/test_case.py +generated_ecp_test_data: ../framework/scripts/mbedtls_framework/test_data_generation.py generated_ecp_test_data: echo " Gen $(GENERATED_ECP_DATA_FILES)" $(PYTHON) scripts/generate_ecp_tests.py $(GENERATED_PSA_DATA_FILES): $(gen_file_dep) generated_psa_test_data generated_psa_test_data: scripts/generate_psa_tests.py -generated_psa_test_data: ../scripts/mbedtls_dev/crypto_data_tests.py -generated_psa_test_data: ../scripts/mbedtls_dev/crypto_knowledge.py -generated_psa_test_data: ../scripts/mbedtls_dev/macro_collector.py -generated_psa_test_data: ../scripts/mbedtls_dev/psa_information.py -generated_psa_test_data: ../scripts/mbedtls_dev/psa_storage.py -generated_psa_test_data: ../scripts/mbedtls_dev/test_case.py -generated_psa_test_data: ../scripts/mbedtls_dev/test_data_generation.py +generated_psa_test_data: ../framework/scripts/mbedtls_framework/crypto_data_tests.py +generated_psa_test_data: ../framework/scripts/mbedtls_framework/crypto_knowledge.py +generated_psa_test_data: ../framework/scripts/mbedtls_framework/macro_collector.py +generated_psa_test_data: ../framework/scripts/mbedtls_framework/psa_information.py +generated_psa_test_data: ../framework/scripts/mbedtls_framework/psa_storage.py +generated_psa_test_data: ../framework/scripts/mbedtls_framework/test_case.py +generated_psa_test_data: ../framework/scripts/mbedtls_framework/test_data_generation.py ## The generated file only depends on the options that are present in ## crypto_config.h, not on which options are set. To avoid regenerating this ## file all the time when switching between configurations, don't declare diff --git a/tests/scripts/audit-validity-dates.py b/tests/scripts/audit-validity-dates.py index 96b705a281..44b083dcfc 100755 --- a/tests/scripts/audit-validity-dates.py +++ b/tests/scripts/audit-validity-dates.py @@ -29,8 +29,8 @@ from cryptography import x509 from generate_test_code import FileWrapper import scripts_path # pylint: disable=unused-import -from mbedtls_dev import build_tree -from mbedtls_dev import logging_util +from mbedtls_framework import build_tree +from mbedtls_framework import logging_util def check_cryptography_version(): match = re.match(r'^[0-9]+', cryptography.__version__) diff --git a/tests/scripts/check-python-files.sh b/tests/scripts/check-python-files.sh index 51e80792b0..f3f48538a6 100755 --- a/tests/scripts/check-python-files.sh +++ b/tests/scripts/check-python-files.sh @@ -31,14 +31,14 @@ EOF can_pylint () { # Pylint 1.5.2 from Ubuntu 16.04 is too old: - # E: 34, 0: Unable to import 'mbedtls_dev' (import-error) + # E: 34, 0: Unable to import 'mbedtls_framework' (import-error) # Pylint 1.8.3 from Ubuntu 18.04 passed on the first commit containing this line. check_version pylint 1.8.3 } can_mypy () { # mypy 0.770 is too old: - # tests/scripts/test_psa_constant_names.py:34: error: Cannot find implementation or library stub for module named 'mbedtls_dev' + # tests/scripts/test_psa_constant_names.py:34: error: Cannot find implementation or library stub for module named 'mbedtls_framework' # mypy 0.780 from pip passed on the first commit containing this line. check_version mypy.version 0.780 } @@ -55,7 +55,7 @@ elif [ "$1" = "--can-mypy" ]; then fi echo 'Running pylint ...' -$PYTHON -m pylint scripts/mbedtls_dev/*.py scripts/*.py tests/scripts/*.py || { +$PYTHON -m pylint framework/scripts/mbedtls_framework/*.py scripts/*.py tests/scripts/*.py || { echo >&2 "pylint reported errors" ret=1 } diff --git a/tests/scripts/check_files.py b/tests/scripts/check_files.py index d5a4b921e4..45d7895949 100755 --- a/tests/scripts/check_files.py +++ b/tests/scripts/check_files.py @@ -24,7 +24,7 @@ except ImportError: pass import scripts_path # pylint: disable=unused-import -from mbedtls_dev import build_tree +from mbedtls_framework import build_tree class FileIssueTracker: diff --git a/tests/scripts/check_names.py b/tests/scripts/check_names.py index 9e8ed219a4..5128dc8e0d 100755 --- a/tests/scripts/check_names.py +++ b/tests/scripts/check_names.py @@ -45,7 +45,7 @@ import subprocess import logging import scripts_path # pylint: disable=unused-import -from mbedtls_dev import build_tree +from mbedtls_framework import build_tree # Naming patterns to check against. These are defined outside the NameCheck diff --git a/tests/scripts/generate_bignum_tests.py b/tests/scripts/generate_bignum_tests.py index 8dbb6ed783..b855e91abf 100755 --- a/tests/scripts/generate_bignum_tests.py +++ b/tests/scripts/generate_bignum_tests.py @@ -48,12 +48,12 @@ from abc import ABCMeta from typing import List import scripts_path # pylint: disable=unused-import -from mbedtls_dev import test_data_generation -from mbedtls_dev import bignum_common +from mbedtls_framework import test_data_generation +from mbedtls_framework import bignum_common # Import modules containing additional test classes # Test function classes in these modules will be registered by # the framework -from mbedtls_dev import bignum_core, bignum_mod_raw, bignum_mod # pylint: disable=unused-import +from mbedtls_framework import bignum_core, bignum_mod_raw, bignum_mod # pylint: disable=unused-import class BignumTarget(test_data_generation.BaseTarget): #pylint: disable=too-few-public-methods diff --git a/tests/scripts/generate_ecp_tests.py b/tests/scripts/generate_ecp_tests.py index df1e4696a0..c5281ad02b 100755 --- a/tests/scripts/generate_ecp_tests.py +++ b/tests/scripts/generate_ecp_tests.py @@ -11,11 +11,11 @@ as in generate_bignum_tests.py. import sys import scripts_path # pylint: disable=unused-import -from mbedtls_dev import test_data_generation +from mbedtls_framework import test_data_generation # Import modules containing additional test classes # Test function classes in these modules will be registered by # the framework -from mbedtls_dev import ecp # pylint: disable=unused-import +from mbedtls_framework import ecp # pylint: disable=unused-import if __name__ == '__main__': # Use the section of the docstring relevant to the CLI as description diff --git a/tests/scripts/generate_psa_tests.py b/tests/scripts/generate_psa_tests.py index fd278f8ffc..75d02b9e23 100755 --- a/tests/scripts/generate_psa_tests.py +++ b/tests/scripts/generate_psa_tests.py @@ -14,13 +14,13 @@ import sys from typing import Callable, Dict, FrozenSet, Iterable, Iterator, List, Optional import scripts_path # pylint: disable=unused-import -from mbedtls_dev import crypto_data_tests -from mbedtls_dev import crypto_knowledge -from mbedtls_dev import macro_collector #pylint: disable=unused-import -from mbedtls_dev import psa_information -from mbedtls_dev import psa_storage -from mbedtls_dev import test_case -from mbedtls_dev import test_data_generation +from mbedtls_framework import crypto_data_tests +from mbedtls_framework import crypto_knowledge +from mbedtls_framework import macro_collector #pylint: disable=unused-import +from mbedtls_framework import psa_information +from mbedtls_framework import psa_storage +from mbedtls_framework import test_case +from mbedtls_framework import test_data_generation diff --git a/tests/scripts/generate_psa_wrappers.py b/tests/scripts/generate_psa_wrappers.py index 07d1450ff3..500693bdae 100755 --- a/tests/scripts/generate_psa_wrappers.py +++ b/tests/scripts/generate_psa_wrappers.py @@ -15,10 +15,10 @@ import os from typing import Iterator, List, Optional, Tuple import scripts_path #pylint: disable=unused-import -from mbedtls_dev import build_tree -from mbedtls_dev import c_parsing_helper -from mbedtls_dev import c_wrapper_generator -from mbedtls_dev import typing_util +from mbedtls_framework import build_tree +from mbedtls_framework import c_parsing_helper +from mbedtls_framework import c_wrapper_generator +from mbedtls_framework import typing_util class BufferParameter: diff --git a/tests/scripts/generate_test_cert_macros.py b/tests/scripts/generate_test_cert_macros.py index 07c5b7de2d..14270e0603 100755 --- a/tests/scripts/generate_test_cert_macros.py +++ b/tests/scripts/generate_test_cert_macros.py @@ -14,7 +14,7 @@ import sys import argparse import jinja2 import scripts_path # pylint: disable=unused-import -from mbedtls_dev.build_tree import guess_project_root +from mbedtls_framework.build_tree import guess_project_root TEST_DIR = os.path.join(guess_project_root(), 'tests') DATA_FILES_PATH = os.path.join(TEST_DIR, 'data_files') diff --git a/tests/scripts/generate_test_keys.py b/tests/scripts/generate_test_keys.py index 62b756031f..9946c24976 100755 --- a/tests/scripts/generate_test_keys.py +++ b/tests/scripts/generate_test_keys.py @@ -10,8 +10,8 @@ from typing import Iterator, List, Tuple import re import argparse import scripts_path # pylint: disable=unused-import -from mbedtls_dev.asymmetric_key_data import ASYMMETRIC_KEY_DATA -from mbedtls_dev.build_tree import guess_project_root +from mbedtls_framework.asymmetric_key_data import ASYMMETRIC_KEY_DATA +from mbedtls_framework.build_tree import guess_project_root BYTES_PER_LINE = 16 diff --git a/tests/scripts/test_psa_compliance.py b/tests/scripts/test_psa_compliance.py index 8d70cbca38..f7d18954ca 100755 --- a/tests/scripts/test_psa_compliance.py +++ b/tests/scripts/test_psa_compliance.py @@ -20,7 +20,7 @@ from typing import List #pylint: disable=unused-import import scripts_path -from mbedtls_dev import build_tree +from mbedtls_framework import build_tree # PSA Compliance tests we expect to fail due to known defects in Mbed TLS / # TF-PSA-Crypto (or the test suite). diff --git a/tests/scripts/test_psa_constant_names.py b/tests/scripts/test_psa_constant_names.py index 6883e279fa..86d9e6f2be 100755 --- a/tests/scripts/test_psa_constant_names.py +++ b/tests/scripts/test_psa_constant_names.py @@ -19,9 +19,9 @@ import sys from typing import Iterable, List, Optional, Tuple import scripts_path # pylint: disable=unused-import -from mbedtls_dev import c_build_helper -from mbedtls_dev.macro_collector import InputsForTest, PSAMacroEnumerator -from mbedtls_dev import typing_util +from mbedtls_framework import c_build_helper +from mbedtls_framework.macro_collector import InputsForTest, PSAMacroEnumerator +from mbedtls_framework import typing_util def gather_inputs(headers: Iterable[str], test_suites: Iterable[str],