mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-01 09:10:03 +00:00
Pass the setting's value to adapters
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
8904570b31
commit
702d75a2f9
@ -1 +1 @@
|
|||||||
Subproject commit 8c488b1b8f86384450c922f22cd1bee0b996be13
|
Subproject commit 745122dc172a77897df15d9e61fcb8d2dd51230b
|
@ -27,7 +27,7 @@ def is_full_section(section):
|
|||||||
"""
|
"""
|
||||||
return section is None or section.endswith('support') or section.endswith('modules')
|
return section is None or section.endswith('support') or section.endswith('modules')
|
||||||
|
|
||||||
def realfull_adapter(_name, active, section):
|
def realfull_adapter(_name, _value, active, section):
|
||||||
"""Activate all symbols found in the global and boolean feature sections.
|
"""Activate all symbols found in the global and boolean feature sections.
|
||||||
|
|
||||||
This is intended for building the documentation, including the
|
This is intended for building the documentation, including the
|
||||||
@ -138,7 +138,7 @@ def include_in_full(name):
|
|||||||
return is_seamless_alt(name)
|
return is_seamless_alt(name)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def full_adapter(name, active, section):
|
def full_adapter(name, _value, active, section):
|
||||||
"""Config adapter for "full"."""
|
"""Config adapter for "full"."""
|
||||||
if not is_full_section(section):
|
if not is_full_section(section):
|
||||||
return active
|
return active
|
||||||
@ -176,7 +176,7 @@ def keep_in_baremetal(name):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def baremetal_adapter(name, active, section):
|
def baremetal_adapter(name, _value, active, section):
|
||||||
"""Config adapter for "baremetal"."""
|
"""Config adapter for "baremetal"."""
|
||||||
if not is_full_section(section):
|
if not is_full_section(section):
|
||||||
return active
|
return active
|
||||||
@ -195,10 +195,10 @@ EXCLUDE_FOR_SIZE = frozenset([
|
|||||||
'MBEDTLS_TEST_HOOKS', # only useful with the hosted test framework, increases code size
|
'MBEDTLS_TEST_HOOKS', # only useful with the hosted test framework, increases code size
|
||||||
])
|
])
|
||||||
|
|
||||||
def baremetal_size_adapter(name, active, section):
|
def baremetal_size_adapter(name, value, active, section):
|
||||||
if name in EXCLUDE_FOR_SIZE:
|
if name in EXCLUDE_FOR_SIZE:
|
||||||
return False
|
return False
|
||||||
return baremetal_adapter(name, active, section)
|
return baremetal_adapter(name, value, active, section)
|
||||||
|
|
||||||
def include_in_crypto(name):
|
def include_in_crypto(name):
|
||||||
"""Rules for symbols in a crypto configuration."""
|
"""Rules for symbols in a crypto configuration."""
|
||||||
@ -219,15 +219,15 @@ def include_in_crypto(name):
|
|||||||
def crypto_adapter(adapter):
|
def crypto_adapter(adapter):
|
||||||
"""Modify an adapter to disable non-crypto symbols.
|
"""Modify an adapter to disable non-crypto symbols.
|
||||||
|
|
||||||
``crypto_adapter(adapter)(name, active, section)`` is like
|
``crypto_adapter(adapter)(name, value, active, section)`` is like
|
||||||
``adapter(name, active, section)``, but unsets all X.509 and TLS symbols.
|
``adapter(name, value, active, section)``, but unsets all X.509 and TLS symbols.
|
||||||
"""
|
"""
|
||||||
def continuation(name, active, section):
|
def continuation(name, value, active, section):
|
||||||
if not include_in_crypto(name):
|
if not include_in_crypto(name):
|
||||||
return False
|
return False
|
||||||
if adapter is None:
|
if adapter is None:
|
||||||
return active
|
return active
|
||||||
return adapter(name, active, section)
|
return adapter(name, value, active, section)
|
||||||
return continuation
|
return continuation
|
||||||
|
|
||||||
DEPRECATED = frozenset([
|
DEPRECATED = frozenset([
|
||||||
@ -237,34 +237,34 @@ DEPRECATED = frozenset([
|
|||||||
def no_deprecated_adapter(adapter):
|
def no_deprecated_adapter(adapter):
|
||||||
"""Modify an adapter to disable deprecated symbols.
|
"""Modify an adapter to disable deprecated symbols.
|
||||||
|
|
||||||
``no_deprecated_adapter(adapter)(name, active, section)`` is like
|
``no_deprecated_adapter(adapter)(name, value, active, section)`` is like
|
||||||
``adapter(name, active, section)``, but unsets all deprecated symbols
|
``adapter(name, value, active, section)``, but unsets all deprecated symbols
|
||||||
and sets ``MBEDTLS_DEPRECATED_REMOVED``.
|
and sets ``MBEDTLS_DEPRECATED_REMOVED``.
|
||||||
"""
|
"""
|
||||||
def continuation(name, active, section):
|
def continuation(name, value, active, section):
|
||||||
if name == 'MBEDTLS_DEPRECATED_REMOVED':
|
if name == 'MBEDTLS_DEPRECATED_REMOVED':
|
||||||
return True
|
return True
|
||||||
if name in DEPRECATED:
|
if name in DEPRECATED:
|
||||||
return False
|
return False
|
||||||
if adapter is None:
|
if adapter is None:
|
||||||
return active
|
return active
|
||||||
return adapter(name, active, section)
|
return adapter(name, value, active, section)
|
||||||
return continuation
|
return continuation
|
||||||
|
|
||||||
def no_platform_adapter(adapter):
|
def no_platform_adapter(adapter):
|
||||||
"""Modify an adapter to disable platform symbols.
|
"""Modify an adapter to disable platform symbols.
|
||||||
|
|
||||||
``no_platform_adapter(adapter)(name, active, section)`` is like
|
``no_platform_adapter(adapter)(name, value, active, section)`` is like
|
||||||
``adapter(name, active, section)``, but unsets all platform symbols other
|
``adapter(name, value, active, section)``, but unsets all platform symbols other
|
||||||
``than MBEDTLS_PLATFORM_C.
|
``than MBEDTLS_PLATFORM_C.
|
||||||
"""
|
"""
|
||||||
def continuation(name, active, section):
|
def continuation(name, value, active, section):
|
||||||
# Allow MBEDTLS_PLATFORM_C but remove all other platform symbols.
|
# Allow MBEDTLS_PLATFORM_C but remove all other platform symbols.
|
||||||
if name.startswith('MBEDTLS_PLATFORM_') and name != 'MBEDTLS_PLATFORM_C':
|
if name.startswith('MBEDTLS_PLATFORM_') and name != 'MBEDTLS_PLATFORM_C':
|
||||||
return False
|
return False
|
||||||
if adapter is None:
|
if adapter is None:
|
||||||
return active
|
return active
|
||||||
return adapter(name, active, section)
|
return adapter(name, value, active, section)
|
||||||
return continuation
|
return continuation
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user