mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Merge pull request #7451 from yanrayw/7376_aes_128bit_only
Introduce config option of 128-bit key only in AES calculation
This commit is contained in:
@@ -3503,6 +3503,45 @@ component_test_malloc_0_null () {
|
||||
tests/ssl-opt.sh -e 'proxy'
|
||||
}
|
||||
|
||||
component_test_aes_only_128_bit_keys () {
|
||||
msg "build: default config + AES_ONLY_128_BIT_KEY_LENGTH"
|
||||
scripts/config.py set MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
scripts/config.py unset MBEDTLS_PADLOCK_C
|
||||
|
||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra'
|
||||
|
||||
msg "test: default config + AES_ONLY_128_BIT_KEY_LENGTH"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_no_ctr_drbg_aes_only_128_bit_keys () {
|
||||
msg "build: default config + AES_ONLY_128_BIT_KEY_LENGTH - CTR_DRBG_C"
|
||||
scripts/config.py set MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
scripts/config.py unset MBEDTLS_CTR_DRBG_C
|
||||
scripts/config.py unset MBEDTLS_PADLOCK_C
|
||||
|
||||
make CC=clang CFLAGS='-Werror -Wall -Wextra'
|
||||
|
||||
msg "test: default config + AES_ONLY_128_BIT_KEY_LENGTH - CTR_DRBG_C"
|
||||
make test
|
||||
}
|
||||
|
||||
component_test_aes_only_128_bit_keys_have_builtins () {
|
||||
msg "build: default config + AES_ONLY_128_BIT_KEY_LENGTH - AESNI_C - AESCE_C"
|
||||
scripts/config.py set MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
|
||||
scripts/config.py unset MBEDTLS_PADLOCK_C
|
||||
scripts/config.py unset MBEDTLS_AESNI_C
|
||||
scripts/config.py unset MBEDTLS_AESCE_C
|
||||
|
||||
make CC=gcc CFLAGS='-Werror -Wall -Wextra'
|
||||
|
||||
msg "test: default config + AES_ONLY_128_BIT_KEY_LENGTH - AESNI_C - AESCE_C"
|
||||
make test
|
||||
|
||||
msg "selftest: default config + AES_ONLY_128_BIT_KEY_LENGTH - AESNI_C - AESCE_C"
|
||||
programs/test/selftest
|
||||
}
|
||||
|
||||
component_test_aes_fewer_tables () {
|
||||
msg "build: default config with AES_FEWER_TABLES enabled"
|
||||
scripts/config.py set MBEDTLS_AES_FEWER_TABLES
|
||||
|
@@ -77,6 +77,24 @@ def automatic_dependencies(*expressions: str) -> List[str]:
|
||||
used.difference_update(SYMBOLS_WITHOUT_DEPENDENCY)
|
||||
return sorted(psa_want_symbol(name) for name in used)
|
||||
|
||||
# Define set of regular expressions and dependencies to optionally append
|
||||
# extra dependencies for test case.
|
||||
AES_128BIT_ONLY_DEP_REGEX = r'AES\s(192|256)'
|
||||
AES_128BIT_ONLY_DEP = ["!MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH"]
|
||||
|
||||
DEPENDENCY_FROM_KEY = {
|
||||
AES_128BIT_ONLY_DEP_REGEX: AES_128BIT_ONLY_DEP
|
||||
}#type: Dict[str, List[str]]
|
||||
def generate_key_dependencies(description: str) -> List[str]:
|
||||
"""Return additional dependencies based on pairs of REGEX and dependencies.
|
||||
"""
|
||||
deps = []
|
||||
for regex, dep in DEPENDENCY_FROM_KEY.items():
|
||||
if re.search(regex, description):
|
||||
deps += dep
|
||||
|
||||
return deps
|
||||
|
||||
# A temporary hack: at the time of writing, not all dependency symbols
|
||||
# are implemented yet. Skip test cases for which the dependency symbols are
|
||||
# not available. Once all dependency symbols are available, this hack must
|
||||
@@ -574,6 +592,7 @@ class StorageFormat:
|
||||
key.alg.string, key.alg2.string,
|
||||
)
|
||||
dependencies = finish_family_dependencies(dependencies, key.bits)
|
||||
dependencies += generate_key_dependencies(key.description)
|
||||
tc.set_dependencies(dependencies)
|
||||
tc.set_function('key_storage_' + verb)
|
||||
if self.forward:
|
||||
|
Reference in New Issue
Block a user