From 9f2b817fa78b3058e5382eec58e65542036253f0 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Tue, 6 Aug 2024 12:02:18 +0200 Subject: [PATCH 01/13] Update documentation Signed-off-by: Gabor Mezei --- scripts/config.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/scripts/config.py b/scripts/config.py index 150078a695..17dac4fc11 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -1,17 +1,12 @@ #!/usr/bin/env python3 -"""Mbed TLS configuration file manipulation library and tool +"""Mbed TLS and PSA configuration file manipulation library and tool Basic usage, to read the Mbed TLS configuration: - config = ConfigFile() + config = CombinedConfigFile() if 'MBEDTLS_RSA_C' in config: print('RSA is enabled') """ -# Note that as long as Mbed TLS 2.28 LTS is maintained, the version of -# this script in the mbedtls-2.28 branch must remain compatible with -# Python 3.4. The version in development may only use more recent features -# in parts that are not backported to 2.28. - ## Copyright The Mbed TLS Contributors ## SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later ## @@ -22,7 +17,7 @@ import re from abc import ABCMeta class Setting: - """Representation of one Mbed TLS mbedtls_config.h setting. + """Representation of one Mbed TLS mbedtls_config.h pr PSA crypto_config.h setting. Fields: * name: the symbol name ('MBEDTLS_xxx'). @@ -41,7 +36,7 @@ class Setting: self.configfile = configfile class Config: - """Representation of the Mbed TLS configuration. + """Representation of the Mbed TLS and PSA configuration. In the documentation of this class, a symbol is said to be *active* if there is a #define for it that is not commented out, and *known* From c659c1b1648f43c8796f33c03075e8aa37917dd5 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Tue, 6 Aug 2024 17:37:55 +0200 Subject: [PATCH 02/13] Move config file modification flag handling to the Config class Signed-off-by: Gabor Mezei --- scripts/config.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/scripts/config.py b/scripts/config.py index 17dac4fc11..7b815e485a 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -101,21 +101,29 @@ class Config: If name is not known, raise KeyError. """ - self.settings[name].value = value + setting = self.settings[name] + if setting.configfile and setting != value: + setting.configfile.modified = True - def set(self, name, value=None): + setting.value = value + + def set(self, name, value=None, configfile=None): """Set name to the given value and make it active. If value is None and name is already known, don't change its value. - If value is None and name is not known, set its value to the empty - string. + If value is None and name is not known, set its value. """ if name in self.settings: + setting = self.settings[name] + if setting.configfile and (setting.value != value or not setting.active): + setting.configfile.modified = True if value is not None: - self.settings[name].value = value - self.settings[name].active = True + setting.value = value + setting.active = True else: - self.settings[name] = Setting(True, name, value=value) + self.settings[name] = Setting(True, name, value=value, configfile=configfile) + if configfile: + self.settings[name].configfile.modified = True def unset(self, name): """Make name unset (inactive). @@ -589,6 +597,7 @@ class MbedTLSConfig(Config): for (active, name, value, section) in self.configfile.parse_file()}) + #pylint: disable=arguments-differ def set(self, name, value=None): """Set name to the given value and make it active.""" @@ -626,6 +635,7 @@ class CryptoConfig(Config): for (active, name, value, section) in self.configfile.parse_file()}) + #pylint: disable=arguments-differ def set(self, name, value='1'): """Set name to the given value and make it active.""" @@ -684,10 +694,7 @@ class CombinedConfig(Config): else: return self.mbedtls_configfile - def __setitem__(self, name, value): - super().__setitem__(name, value) - self.settings[name].configfile.modified = True - + #pylint: disable=arguments-differ def set(self, name, value=None): """Set name to the given value and make it active.""" @@ -703,15 +710,10 @@ class CombinedConfig(Config): if not value: value = '1' - if name in self.settings: - setting = self.settings[name] - if not setting.active or (value is not None and setting.value != value): - configfile.modified = True - else: + if name not in self.settings: configfile.templates.append((name, '', '#define ' + name + ' ')) - configfile.modified = True - super().set(name, value) + super().set(name, value, configfile) def write(self, mbedtls_file=None, crypto_file=None): """Write the whole configuration to the file it was read from. From daf807f02da52f2125f1053d3d50f5cbb2f322bf Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Wed, 14 Aug 2024 11:33:46 +0200 Subject: [PATCH 03/13] Fix pylint issues Signed-off-by: Gabor Mezei --- scripts/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/config.py b/scripts/config.py index 7b815e485a..89b05a689a 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -52,7 +52,6 @@ class Config: name to become set. """ - # pylint: disable=unused-argument def __init__(self): self.settings = {} @@ -66,11 +65,11 @@ class Config: def all(self, *names): """True if all the elements of names are active (i.e. set).""" - return all(self.__contains__(name) for name in names) + return all(name in self for name in names) def any(self, *names): """True if at least one symbol in names are active (i.e. set).""" - return any(self.__contains__(name) for name in names) + return any(name in self for name in names) def known(self, name): """True if a #define for name is present, whether it's commented out or not.""" @@ -715,6 +714,7 @@ class CombinedConfig(Config): super().set(name, value, configfile) + #pylint: disable=arguments-differ def write(self, mbedtls_file=None, crypto_file=None): """Write the whole configuration to the file it was read from. From d53080da2ac85e8ccc683a2cac7002ae59a93e74 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Tue, 27 Aug 2024 14:06:54 +0200 Subject: [PATCH 04/13] Make the `Config` a proper base class Due to the forward declaration issues, move the common descendant functions and configfile handling to the `Config` base class. Signed-off-by: Gabor Mezei --- scripts/config.py | 100 +++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/scripts/config.py b/scripts/config.py index 89b05a689a..77a09ad9c5 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -26,9 +26,10 @@ class Setting: * active: True if name is defined, False if a #define for name is present in mbedtls_config.h but commented out. * section: the name of the section that contains this symbol. + * configfile: the file the settings is defined """ # pylint: disable=too-few-public-methods, too-many-arguments - def __init__(self, active, name, value='', section=None, configfile=None): + def __init__(self, configfile, active, name, value='', section=None): self.active = active self.name = name self.value = value @@ -54,6 +55,7 @@ class Config: def __init__(self): self.settings = {} + self.configfiles = [] def __contains__(self, name): """True if the given symbol is active (i.e. set). @@ -101,12 +103,12 @@ class Config: If name is not known, raise KeyError. """ setting = self.settings[name] - if setting.configfile and setting != value: + if setting != value: setting.configfile.modified = True setting.value = value - def set(self, name, value=None, configfile=None): + def set(self, name, value=None): """Set name to the given value and make it active. If value is None and name is already known, don't change its value. @@ -114,15 +116,15 @@ class Config: """ if name in self.settings: setting = self.settings[name] - if setting.configfile and (setting.value != value or not setting.active): + if setting.value != value or not setting.active: setting.configfile.modified = True if value is not None: setting.value = value setting.active = True else: - self.settings[name] = Setting(True, name, value=value, configfile=configfile) - if configfile: - self.settings[name].configfile.modified = True + configfile = self._get_configfile(name) + self.settings[name] = Setting(configfile, True, name, value=value) + configfile.modified = True def unset(self, name): """Make name unset (inactive). @@ -134,7 +136,7 @@ class Config: setting = self.settings[name] # Check if modifying the config file - if setting.configfile and setting.active: + if setting.active: setting.configfile.modified = True setting.active = False @@ -154,7 +156,7 @@ class Config: setting.active = adapter(setting.name, setting.active, setting.section) # Check if modifying the config file - if setting.configfile and setting.active != is_active: + if setting.active != is_active: setting.configfile.modified = True def change_matching(self, regexs, enable): @@ -165,10 +167,34 @@ class Config: for setting in self.settings.values(): if regex.search(setting.name): # Check if modifying the config file - if setting.configfile and setting.active != enable: + if setting.active != enable: setting.configfile.modified = True setting.active = enable + def _get_configfile(self, name=None): + """Find a config for a setting name. + + If more then one configfile is used this function must be overridden. + """ + + if name and name in self.settings: + return self.get(name).configfile + return self.configfiles[0] + + def write(self, filename=None): + """Write the whole configuration to the file it was read from. + + If filename is specified, write to this file instead. + """ + + for configfile in self.configfiles: + configfile.write(self.settings, filename) + + def filename(self, name=None): + """Get the name of the config file.""" + + return self._get_configfile(name).filename + def is_full_section(section): """Is this section affected by "config.py full" and friends? @@ -591,33 +617,20 @@ class MbedTLSConfig(Config): """Read the Mbed TLS configuration file.""" super().__init__() - self.configfile = MbedTLSConfigFile(filename) - self.settings.update({name: Setting(active, name, value, section, self.configfile) + configfile = MbedTLSConfigFile(filename) + self.configfiles.append(configfile) + self.settings.update({name: Setting(configfile, active, name, value, section) for (active, name, value, section) - in self.configfile.parse_file()}) + in configfile.parse_file()}) - #pylint: disable=arguments-differ def set(self, name, value=None): """Set name to the given value and make it active.""" if name not in self.settings: - self.configfile.templates.append((name, '', '#define ' + name + ' ')) + self._get_configfile().templates.append((name, '', '#define ' + name + ' ')) super().set(name, value) - def write(self, filename=None): - """Write the whole configuration to the file it was read from. - - If filename is specified, write to this file instead. - """ - - self.configfile.write(self.settings, filename) - - def filename(self): - """Get the name of the config file.""" - - return self.configfile.filename - class CryptoConfig(Config): """Representation of the PSA crypto configuration. @@ -629,12 +642,12 @@ class CryptoConfig(Config): """Read the PSA crypto configuration file.""" super().__init__() - self.configfile = CryptoConfigFile(filename) - self.settings.update({name: Setting(active, name, value, section, self.configfile) + configfile = CryptoConfigFile(filename) + self.configfiles.append(configfile) + self.settings.update({name: Setting(configfile, active, name, value, section) for (active, name, value, section) - in self.configfile.parse_file()}) + in configfile.parse_file()}) - #pylint: disable=arguments-differ def set(self, name, value='1'): """Set name to the given value and make it active.""" @@ -644,23 +657,10 @@ class CryptoConfig(Config): raise ValueError(f'Feature is unstable: \'{name}\'') if name not in self.settings: - self.configfile.templates.append((name, '', '#define ' + name + ' ')) + self._get_configfile().templates.append((name, '', '#define ' + name + ' ')) super().set(name, value) - def write(self, filename=None): - """Write the whole configuration to the file it was read from. - - If filename is specified, write to this file instead. - """ - - self.configfile.write(self.settings, filename) - - def filename(self): - """Get the name of the config file.""" - - return self.configfile.filename - class CombinedConfig(Config): """Representation of MbedTLS and PSA crypto configuration @@ -677,13 +677,14 @@ class CombinedConfig(Config): self.crypto_configfile = config else: raise ValueError(f'Invalid configfile: {config}') + self.configfiles.append(config) - self.settings.update({name: Setting(active, name, value, section, configfile) + self.settings.update({name: Setting(configfile, active, name, value, section) for configfile in [self.mbedtls_configfile, self.crypto_configfile] for (active, name, value, section) in configfile.parse_file()}) _crypto_regexp = re.compile(r'$PSA_.*') - def _get_configfile(self, name): + def _get_configfile(self, name=None): """Find a config type for a setting name""" if name in self.settings: @@ -693,7 +694,6 @@ class CombinedConfig(Config): else: return self.mbedtls_configfile - #pylint: disable=arguments-differ def set(self, name, value=None): """Set name to the given value and make it active.""" @@ -712,7 +712,7 @@ class CombinedConfig(Config): if name not in self.settings: configfile.templates.append((name, '', '#define ' + name + ' ')) - super().set(name, value, configfile) + super().set(name, value) #pylint: disable=arguments-differ def write(self, mbedtls_file=None, crypto_file=None): From 776ee9068d3fdc84bd025b111e54386b55587d15 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Mon, 9 Sep 2024 17:00:50 +0200 Subject: [PATCH 05/13] Fix header file detection Make the include directory check relative to the source file in case not called from the project root. Signed-off-by: Gabor Mezei --- scripts/config.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/config.py b/scripts/config.py index 77a09ad9c5..d2de7a7233 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -593,9 +593,11 @@ class CryptoConfigFile(ConfigFile): # Temporary, while Mbed TLS does not just rely on the TF-PSA-Crypto # build system to build its crypto library. When it does, the # condition can just be removed. - _path_in_tree = 'include/psa/crypto_config.h' \ - if os.path.isfile('include/psa/crypto_config.h') else \ - 'tf-psa-crypto/include/psa/crypto_config.h' + _path_in_tree = ('include/psa/crypto_config.h' + if not os.path.isdir(os.path.join(os.path.dirname(__file__), + os.pardir, + 'tf-psa-crypto')) else + 'tf-psa-crypto/include/psa/crypto_config.h') default_path = [_path_in_tree, os.path.join(os.path.dirname(__file__), os.pardir, From 24d7cc71af3cef5b288b7b9b2e297a66c8796385 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Tue, 6 Aug 2024 15:11:24 +0200 Subject: [PATCH 06/13] Create a class for command line config manipulation Signed-off-by: Gabor Mezei --- scripts/config.py | 207 +++++++++++++++++++++++++++------------------- 1 file changed, 122 insertions(+), 85 deletions(-) diff --git a/scripts/config.py b/scripts/config.py index d2de7a7233..d2735ee214 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -11,8 +11,10 @@ Basic usage, to read the Mbed TLS configuration: ## SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later ## +import argparse import os import re +import sys from abc import ABCMeta @@ -738,66 +740,132 @@ class CombinedConfig(Config): return self._get_configfile(name).filename -if __name__ == '__main__': - #pylint: disable=too-many-statements - def main(): - """Command line mbedtls_config.h manipulation tool.""" - parser = argparse.ArgumentParser(description=""" - Mbed TLS configuration file manipulation tool. - """) - parser.add_argument('--file', '-f', - help="""File to read (and modify if requested). - Default: {}. - """.format(MbedTLSConfigFile.default_path)) - parser.add_argument('--cryptofile', '-c', - help="""Crypto file to read (and modify if requested). - Default: {}. - """.format(CryptoConfigFile.default_path)) - parser.add_argument('--force', '-o', - action='store_true', - help="""For the set command, if SYMBOL is not - present, add a definition for it.""") - parser.add_argument('--write', '-w', metavar='FILE', - help="""File to write to instead of the input file.""") - subparsers = parser.add_subparsers(dest='command', - title='Commands') - parser_get = subparsers.add_parser('get', - help="""Find the value of SYMBOL - and print it. Exit with - status 0 if a #define for SYMBOL is - found, 1 otherwise. - """) + +class ConfigTool(metaclass=ABCMeta): + """Command line config manipulation tool. + + Custom parser option can be added by overriding 'custom_parser_options'. + """ + + def __init__(self, file_type): + """Create parser for config manipulation tool.""" + + self.parser = argparse.ArgumentParser(description=""" + Configuration file manipulation tool.""") + self.subparsers = self.parser.add_subparsers(dest='command', + title='Commands') + self._common_parser_options(file_type) + self.custom_parser_options() + self.parser_args = self.parser.parse_args() + self.config = Config() # Make the pylint happy + + def add_adapter(self, name, function, description): + """Creates a command in the tool for a configuration adapter.""" + + subparser = self.subparsers.add_parser(name, help=description) + subparser.set_defaults(adapter=function) + + def _common_parser_options(self, file_type): + """Common parser options for config manipulation tool.""" + + self.parser.add_argument('--file', '-f', + help="""File to read (and modify if requested). + Default: {}. + """.format(file_type.default_path)) + self.parser.add_argument('--force', '-o', + action='store_true', + help="""For the set command, if SYMBOL is not + present, add a definition for it.""") + self.parser.add_argument('--write', '-w', metavar='FILE', + help="""File to write to instead of the input file.""") + + parser_get = self.subparsers.add_parser('get', + help="""Find the value of SYMBOL + and print it. Exit with + status 0 if a #define for SYMBOL is + found, 1 otherwise. + """) parser_get.add_argument('symbol', metavar='SYMBOL') - parser_set = subparsers.add_parser('set', - help="""Set SYMBOL to VALUE. - If VALUE is omitted, just uncomment - the #define for SYMBOL. - Error out of a line defining - SYMBOL (commented or not) is not - found, unless --force is passed. - """) + parser_set = self.subparsers.add_parser('set', + help="""Set SYMBOL to VALUE. + If VALUE is omitted, just uncomment + the #define for SYMBOL. + Error out of a line defining + SYMBOL (commented or not) is not + found, unless --force is passed. + """) parser_set.add_argument('symbol', metavar='SYMBOL') parser_set.add_argument('value', metavar='VALUE', nargs='?', default='') - parser_set_all = subparsers.add_parser('set-all', - help="""Uncomment all #define - whose name contains a match for - REGEX.""") + parser_set_all = self.subparsers.add_parser('set-all', + help="""Uncomment all #define + whose name contains a match for + REGEX.""") parser_set_all.add_argument('regexs', metavar='REGEX', nargs='*') - parser_unset = subparsers.add_parser('unset', - help="""Comment out the #define - for SYMBOL. Do nothing if none - is present.""") + parser_unset = self.subparsers.add_parser('unset', + help="""Comment out the #define + for SYMBOL. Do nothing if none + is present.""") parser_unset.add_argument('symbol', metavar='SYMBOL') - parser_unset_all = subparsers.add_parser('unset-all', - help="""Comment out all #define - whose name contains a match for - REGEX.""") + parser_unset_all = self.subparsers.add_parser('unset-all', + help="""Comment out all #define + whose name contains a match for + REGEX.""") parser_unset_all.add_argument('regexs', metavar='REGEX', nargs='*') - def add_adapter(name, function, description): - subparser = subparsers.add_parser(name, help=description) - subparser.set_defaults(adapter=function) + def custom_parser_options(self): + """Adds custom options for the parser. Designed for overridden by descendant.""" + pass + + def main(self): + """Common main fuction for config manipulation tool.""" + + if self.parser_args.command is None: + self.parser.print_help() + return 1 + if self.parser_args.command == 'get': + if self.parser_args.symbol in self.config: + value = self.config[self.parser_args.symbol] + if value: + sys.stdout.write(value + '\n') + return 0 if self.parser_args.symbol in self.config else 1 + elif self.parser_args.command == 'set': + if not self.parser_args.force and self.parser_args.symbol not in self.config.settings: + sys.stderr.write( + "A #define for the symbol {} was not found in {}\n" + .format(self.parser_args.symbol, + self.config.filename(self.parser_args.symbol))) + return 1 + self.config.set(self.parser_args.symbol, value=self.parser_args.value) + elif self.parser_args.command == 'set-all': + self.config.change_matching(self.parser_args.regexs, True) + elif self.parser_args.command == 'unset': + self.config.unset(self.parser_args.symbol) + elif self.parser_args.command == 'unset-all': + self.config.change_matching(self.parser_args.regexs, False) + else: + self.config.adapt(self.parser_args.adapter) + self.config.write(self.parser_args.write) + + return 0 + + +class MbedTLSConfigTool(ConfigTool): + """Command line mbedtls_config.h and crypto_config.h manipulation tool.""" + + def __init__(self): + super().__init__(MbedTLSConfigFile) + self.config = CombinedConfig(MbedTLSConfigFile(self.parser_args.file), + CryptoConfigFile(self.parser_args.cryptofile)) + + def custom_parser_options(self): + """Adds MbedTLS specific options for the parser.""" + + self.parser.add_argument('--cryptofile', '-c', + help="""Crypto file to read (and modify if requested). + Default: {}. + """.format(CryptoConfigFile.default_path)) + add_adapter('baremetal', baremetal_adapter, """Like full, but exclude features that require platform features such as file input-output.""") @@ -829,37 +897,6 @@ if __name__ == '__main__': """Like full, but with only crypto features, excluding X.509 and TLS.""") - args = parser.parse_args() - config = CombinedConfig(MbedTLSConfigFile(args.file), CryptoConfigFile(args.cryptofile)) - if args.command is None: - parser.print_help() - return 1 - elif args.command == 'get': - if args.symbol in config: - value = config[args.symbol] - if value: - sys.stdout.write(value + '\n') - return 0 if args.symbol in config else 1 - elif args.command == 'set': - if not args.force and args.symbol not in config.settings: - sys.stderr.write("A #define for the symbol {} " - "was not found in {}\n" - .format(args.symbol, config.filename(args.symbol))) - return 1 - config.set(args.symbol, value=args.value) - elif args.command == 'set-all': - config.change_matching(args.regexs, True) - elif args.command == 'unset': - config.unset(args.symbol) - elif args.command == 'unset-all': - config.change_matching(args.regexs, False) - else: - config.adapt(args.adapter) - config.write(args.write) - return 0 - # Import modules only used by main only if main is defined and called. - # pylint: disable=wrong-import-position - import argparse - import sys - sys.exit(main()) +if __name__ == '__main__': + sys.exit(MbedTLSConfigTool().main()) From a12ed6bcb7234f75719e2c85703759b51479e8b0 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Mon, 9 Sep 2024 17:20:49 +0200 Subject: [PATCH 07/13] Unify spacing Signed-off-by: Gabor Mezei --- scripts/config.py | 154 ++++++++++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 72 deletions(-) diff --git a/scripts/config.py b/scripts/config.py index d2735ee214..f58efa6246 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -18,6 +18,7 @@ import sys from abc import ABCMeta + class Setting: """Representation of one Mbed TLS mbedtls_config.h pr PSA crypto_config.h setting. @@ -38,6 +39,7 @@ class Setting: self.section = section self.configfile = configfile + class Config: """Representation of the Mbed TLS and PSA configuration. @@ -197,6 +199,7 @@ class Config: return self._get_configfile(name).filename + def is_full_section(section): """Is this section affected by "config.py full" and friends? @@ -445,6 +448,7 @@ def no_platform_adapter(adapter): return adapter(name, active, section) return continuation + class ConfigFile(metaclass=ABCMeta): """Representation of a configuration file.""" @@ -574,6 +578,7 @@ class ConfigFile(metaclass=ABCMeta): with open(filename, 'w', encoding='utf-8') as output: self.write_to_stream(settings, output) + class MbedTLSConfigFile(ConfigFile): """Representation of an MbedTLS configuration file.""" @@ -589,6 +594,7 @@ class MbedTLSConfigFile(ConfigFile): super().__init__(self.default_path, 'Mbed TLS', filename) self.current_section = 'header' + class CryptoConfigFile(ConfigFile): """Representation of a Crypto configuration file.""" @@ -610,6 +616,7 @@ class CryptoConfigFile(ConfigFile): def __init__(self, filename=None): super().__init__(self.default_path, 'Crypto', filename) + class MbedTLSConfig(Config): """Representation of the Mbed TLS configuration. @@ -635,6 +642,7 @@ class MbedTLSConfig(Config): super().set(name, value) + class CryptoConfig(Config): """Representation of the PSA crypto configuration. @@ -665,6 +673,7 @@ class CryptoConfig(Config): super().set(name, value) + class CombinedConfig(Config): """Representation of MbedTLS and PSA crypto configuration @@ -768,49 +777,42 @@ class ConfigTool(metaclass=ABCMeta): def _common_parser_options(self, file_type): """Common parser options for config manipulation tool.""" - self.parser.add_argument('--file', '-f', - help="""File to read (and modify if requested). - Default: {}. - """.format(file_type.default_path)) - self.parser.add_argument('--force', '-o', - action='store_true', - help="""For the set command, if SYMBOL is not - present, add a definition for it.""") - self.parser.add_argument('--write', '-w', metavar='FILE', - help="""File to write to instead of the input file.""") + self.parser.add_argument( + '--file', '-f', + help="""File to read (and modify if requested). Default: {}. + """.format(file_type.default_path)) + self.parser.add_argument( + '--force', '-o', + action='store_true', + help="""For the set command, if SYMBOL is not present, add a definition for it.""") + self.parser.add_argument( + '--write', '-w', + metavar='FILE', + help="""File to write to instead of the input file.""") - parser_get = self.subparsers.add_parser('get', - help="""Find the value of SYMBOL - and print it. Exit with - status 0 if a #define for SYMBOL is - found, 1 otherwise. - """) + parser_get = self.subparsers.add_parser( + 'get', + help="""Find the value of SYMBOL and print it. Exit with + status 0 if a #define for SYMBOL is found, 1 otherwise.""") parser_get.add_argument('symbol', metavar='SYMBOL') - parser_set = self.subparsers.add_parser('set', - help="""Set SYMBOL to VALUE. - If VALUE is omitted, just uncomment - the #define for SYMBOL. - Error out of a line defining - SYMBOL (commented or not) is not - found, unless --force is passed. - """) + parser_set = self.subparsers.add_parser( + 'set', + help="""Set SYMBOL to VALUE. If VALUE is omitted, just uncomment + the #define for SYMBOL. Error out of a line defining + SYMBOL (commented or not) is not found, unless --force is passed. """) parser_set.add_argument('symbol', metavar='SYMBOL') - parser_set.add_argument('value', metavar='VALUE', nargs='?', - default='') - parser_set_all = self.subparsers.add_parser('set-all', - help="""Uncomment all #define - whose name contains a match for - REGEX.""") + parser_set.add_argument('value', metavar='VALUE', nargs='?', default='') + parser_set_all = self.subparsers.add_parser( + 'set-all', + help="""Uncomment all #define whose name contains a match for REGEX.""") parser_set_all.add_argument('regexs', metavar='REGEX', nargs='*') - parser_unset = self.subparsers.add_parser('unset', - help="""Comment out the #define - for SYMBOL. Do nothing if none - is present.""") + parser_unset = self.subparsers.add_parser( + 'unset', + help="""Comment out the #define for SYMBOL. Do nothing if none is present.""") parser_unset.add_argument('symbol', metavar='SYMBOL') - parser_unset_all = self.subparsers.add_parser('unset-all', - help="""Comment out all #define - whose name contains a match for - REGEX.""") + parser_unset_all = self.subparsers.add_parser( + 'unset-all', + help="""Comment out all #define whose name contains a match for REGEX.""") parser_unset_all.add_argument('regexs', metavar='REGEX', nargs='*') def custom_parser_options(self): @@ -861,41 +863,49 @@ class MbedTLSConfigTool(ConfigTool): def custom_parser_options(self): """Adds MbedTLS specific options for the parser.""" - self.parser.add_argument('--cryptofile', '-c', - help="""Crypto file to read (and modify if requested). - Default: {}. - """.format(CryptoConfigFile.default_path)) + self.parser.add_argument( + '--cryptofile', '-c', + help="""Crypto file to read (and modify if requested). Default: {}.""" + .format(CryptoConfigFile.default_path)) - add_adapter('baremetal', baremetal_adapter, - """Like full, but exclude features that require platform - features such as file input-output.""") - add_adapter('baremetal_size', baremetal_size_adapter, - """Like baremetal, but exclude debugging features. - Useful for code size measurements.""") - add_adapter('full', full_adapter, - """Uncomment most features. - Exclude alternative implementations and platform support - options, as well as some options that are awkward to test. - """) - add_adapter('full_no_deprecated', no_deprecated_adapter(full_adapter), - """Uncomment most non-deprecated features. - Like "full", but without deprecated features. - """) - add_adapter('full_no_platform', no_platform_adapter(full_adapter), - """Uncomment most non-platform features. - Like "full", but without platform features. - """) - add_adapter('realfull', realfull_adapter, - """Uncomment all boolean #defines. - Suitable for generating documentation, but not for building.""") - add_adapter('crypto', crypto_adapter(None), - """Only include crypto features. Exclude X.509 and TLS.""") - add_adapter('crypto_baremetal', crypto_adapter(baremetal_adapter), - """Like baremetal, but with only crypto features, - excluding X.509 and TLS.""") - add_adapter('crypto_full', crypto_adapter(full_adapter), - """Like full, but with only crypto features, - excluding X.509 and TLS.""") + self.add_adapter( + 'baremetal', baremetal_adapter, + """Like full, but exclude features that require platform features + such as file input-output. + """) + self.add_adapter( + 'baremetal_size', baremetal_size_adapter, + """Like baremetal, but exclude debugging features. Useful for code size measurements. + """) + self.add_adapter( + 'full', full_adapter, + """Uncomment most features. + Exclude alternative implementations and platform support options, as well as + some options that are awkward to test. + """) + self.add_adapter( + 'full_no_deprecated', no_deprecated_adapter(full_adapter), + """Uncomment most non-deprecated features. + Like "full", but without deprecated features. + """) + self.add_adapter( + 'full_no_platform', no_platform_adapter(full_adapter), + """Uncomment most non-platform features. Like "full", but without platform features. + """) + self.add_adapter( + 'realfull', realfull_adapter, + """Uncomment all boolean #defines. + Suitable for generating documentation, but not for building. + """) + self.add_adapter( + 'crypto', crypto_adapter(None), + """Only include crypto features. Exclude X.509 and TLS.""") + self.add_adapter( + 'crypto_baremetal', crypto_adapter(baremetal_adapter), + """Like baremetal, but with only crypto features, excluding X.509 and TLS.""") + self.add_adapter( + 'crypto_full', crypto_adapter(full_adapter), + """Like full, but with only crypto features, excluding X.509 and TLS.""") if __name__ == '__main__': From 0e9e4cbbd82271576eb827e8043abf912f5c512c Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Tue, 10 Sep 2024 16:16:35 +0200 Subject: [PATCH 08/13] Move commonly used part to config_common Move the Setting, Config, ConfigFile and ConfigTool classes to config_common. Also update the referencies to the moved classes. Signed-off-by: Gabor Mezei --- scripts/config.py | 435 ++-------------------------------------------- 1 file changed, 11 insertions(+), 424 deletions(-) diff --git a/scripts/config.py b/scripts/config.py index f58efa6246..25709567cf 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -11,193 +11,12 @@ Basic usage, to read the Mbed TLS configuration: ## SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later ## -import argparse import os import re import sys -from abc import ABCMeta - - -class Setting: - """Representation of one Mbed TLS mbedtls_config.h pr PSA crypto_config.h setting. - - Fields: - * name: the symbol name ('MBEDTLS_xxx'). - * value: the value of the macro. The empty string for a plain #define - with no value. - * active: True if name is defined, False if a #define for name is - present in mbedtls_config.h but commented out. - * section: the name of the section that contains this symbol. - * configfile: the file the settings is defined - """ - # pylint: disable=too-few-public-methods, too-many-arguments - def __init__(self, configfile, active, name, value='', section=None): - self.active = active - self.name = name - self.value = value - self.section = section - self.configfile = configfile - - -class Config: - """Representation of the Mbed TLS and PSA configuration. - - In the documentation of this class, a symbol is said to be *active* - if there is a #define for it that is not commented out, and *known* - if there is a #define for it whether commented out or not. - - This class supports the following protocols: - * `name in config` is `True` if the symbol `name` is active, `False` - otherwise (whether `name` is inactive or not known). - * `config[name]` is the value of the macro `name`. If `name` is inactive, - raise `KeyError` (even if `name` is known). - * `config[name] = value` sets the value associated to `name`. `name` - must be known, but does not need to be set. This does not cause - name to become set. - """ - - def __init__(self): - self.settings = {} - self.configfiles = [] - - def __contains__(self, name): - """True if the given symbol is active (i.e. set). - - False if the given symbol is not set, even if a definition - is present but commented out. - """ - return name in self.settings and self.settings[name].active - - def all(self, *names): - """True if all the elements of names are active (i.e. set).""" - return all(name in self for name in names) - - def any(self, *names): - """True if at least one symbol in names are active (i.e. set).""" - return any(name in self for name in names) - - def known(self, name): - """True if a #define for name is present, whether it's commented out or not.""" - return name in self.settings - - def __getitem__(self, name): - """Get the value of name, i.e. what the preprocessor symbol expands to. - - If name is not known, raise KeyError. name does not need to be active. - """ - return self.settings[name].value - - def get(self, name, default=None): - """Get the value of name. If name is inactive (not set), return default. - - If a #define for name is present and not commented out, return - its expansion, even if this is the empty string. - - If a #define for name is present but commented out, return default. - """ - if name in self.settings: - return self.settings[name].value - else: - return default - - def __setitem__(self, name, value): - """If name is known, set its value. - - If name is not known, raise KeyError. - """ - setting = self.settings[name] - if setting != value: - setting.configfile.modified = True - - setting.value = value - - def set(self, name, value=None): - """Set name to the given value and make it active. - - If value is None and name is already known, don't change its value. - If value is None and name is not known, set its value. - """ - if name in self.settings: - setting = self.settings[name] - if setting.value != value or not setting.active: - setting.configfile.modified = True - if value is not None: - setting.value = value - setting.active = True - else: - configfile = self._get_configfile(name) - self.settings[name] = Setting(configfile, True, name, value=value) - configfile.modified = True - - def unset(self, name): - """Make name unset (inactive). - - name remains known if it was known before. - """ - if name not in self.settings: - return - - setting = self.settings[name] - # Check if modifying the config file - if setting.active: - setting.configfile.modified = True - - setting.active = False - - def adapt(self, adapter): - """Run adapter on each known symbol and (de)activate it accordingly. - - `adapter` must be a function that returns a boolean. It is called as - `adapter(name, active, section)` for each setting, where `active` is - `True` if `name` is set and `False` if `name` is known but unset, - and `section` is the name of the section containing `name`. If - `adapter` returns `True`, then set `name` (i.e. make it active), - otherwise unset `name` (i.e. make it known but inactive). - """ - for setting in self.settings.values(): - is_active = setting.active - setting.active = adapter(setting.name, setting.active, - setting.section) - # Check if modifying the config file - if setting.active != is_active: - setting.configfile.modified = True - - def change_matching(self, regexs, enable): - """Change all symbols matching one of the regexs to the desired state.""" - if not regexs: - return - regex = re.compile('|'.join(regexs)) - for setting in self.settings.values(): - if regex.search(setting.name): - # Check if modifying the config file - if setting.active != enable: - setting.configfile.modified = True - setting.active = enable - - def _get_configfile(self, name=None): - """Find a config for a setting name. - - If more then one configfile is used this function must be overridden. - """ - - if name and name in self.settings: - return self.get(name).configfile - return self.configfiles[0] - - def write(self, filename=None): - """Write the whole configuration to the file it was read from. - - If filename is specified, write to this file instead. - """ - - for configfile in self.configfiles: - configfile.write(self.settings, filename) - - def filename(self, name=None): - """Get the name of the config file.""" - - return self._get_configfile(name).filename +import framework_scripts_path # pylint: disable=unused-import +from mbedtls_framework import config_common def is_full_section(section): @@ -449,137 +268,7 @@ def no_platform_adapter(adapter): return continuation -class ConfigFile(metaclass=ABCMeta): - """Representation of a configuration file.""" - - def __init__(self, default_path, name, filename=None): - """Check if the config file exists.""" - if filename is None: - for candidate in default_path: - if os.path.lexists(candidate): - filename = candidate - break - else: - raise FileNotFoundError(f'{name} configuration file not found: ' - f'{filename if filename else default_path}') - - self.filename = filename - self.templates = [] - self.current_section = None - self.inclusion_guard = None - self.modified = False - - _define_line_regexp = (r'(?P\s*)' + - r'(?P(//\s*)?)' + - r'(?P#\s*define\s+)' + - r'(?P\w+)' + - r'(?P(?:\((?:\w|\s|,)*\))?)' + - r'(?P\s*)' + - r'(?P.*)') - _ifndef_line_regexp = r'#ifndef (?P\w+)' - _section_line_regexp = (r'\s*/?\*+\s*[\\@]name\s+SECTION:\s*' + - r'(?P
.*)[ */]*') - _config_line_regexp = re.compile(r'|'.join([_define_line_regexp, - _ifndef_line_regexp, - _section_line_regexp])) - def _parse_line(self, line): - """Parse a line in the config file, save the templates representing the lines - and return the corresponding setting element. - """ - - line = line.rstrip('\r\n') - m = re.match(self._config_line_regexp, line) - if m is None: - self.templates.append(line) - return None - elif m.group('section'): - self.current_section = m.group('section') - self.templates.append(line) - return None - elif m.group('inclusion_guard') and self.inclusion_guard is None: - self.inclusion_guard = m.group('inclusion_guard') - self.templates.append(line) - return None - else: - active = not m.group('commented_out') - name = m.group('name') - value = m.group('value') - if name == self.inclusion_guard and value == '': - # The file double-inclusion guard is not an option. - self.templates.append(line) - return None - template = (name, - m.group('indentation'), - m.group('define') + name + - m.group('arguments') + m.group('separator')) - self.templates.append(template) - - return (active, name, value, self.current_section) - - def parse_file(self): - """Parse the whole file and return the settings.""" - - with open(self.filename, 'r', encoding='utf-8') as file: - for line in file: - setting = self._parse_line(line) - if setting is not None: - yield setting - self.current_section = None - - #pylint: disable=no-self-use - def _format_template(self, setting, indent, middle): - """Build a line for the config file for the given setting. - - The line has the form "#define " - where is "#define ". - """ - - value = setting.value - if value is None: - value = '' - # Normally the whitespace to separate the symbol name from the - # value is part of middle, and there's no whitespace for a symbol - # with no value. But if a symbol has been changed from having a - # value to not having one, the whitespace is wrong, so fix it. - if value: - if middle[-1] not in '\t ': - middle += ' ' - else: - middle = middle.rstrip() - return ''.join([indent, - '' if setting.active else '//', - middle, - value]).rstrip() - - def write_to_stream(self, settings, output): - """Write the whole configuration to output.""" - - for template in self.templates: - if isinstance(template, str): - line = template - else: - name, indent, middle = template - line = self._format_template(settings[name], indent, middle) - output.write(line + '\n') - - def write(self, settings, filename=None): - """Write the whole configuration to the file it was read from. - - If filename is specified, write to this file instead. - """ - - if filename is None: - filename = self.filename - - # Not modified so no need to write to the file - if not self.modified and filename == self.filename: - return - - with open(filename, 'w', encoding='utf-8') as output: - self.write_to_stream(settings, output) - - -class MbedTLSConfigFile(ConfigFile): +class MbedTLSConfigFile(config_common.ConfigFile): """Representation of an MbedTLS configuration file.""" _path_in_tree = 'include/mbedtls/mbedtls_config.h' @@ -595,7 +284,7 @@ class MbedTLSConfigFile(ConfigFile): self.current_section = 'header' -class CryptoConfigFile(ConfigFile): +class CryptoConfigFile(config_common.ConfigFile): """Representation of a Crypto configuration file.""" # Temporary, while Mbed TLS does not just rely on the TF-PSA-Crypto @@ -617,7 +306,7 @@ class CryptoConfigFile(ConfigFile): super().__init__(self.default_path, 'Crypto', filename) -class MbedTLSConfig(Config): +class MbedTLSConfig(config_common.Config): """Representation of the Mbed TLS configuration. See the documentation of the `Config` class for methods to query @@ -630,7 +319,7 @@ class MbedTLSConfig(Config): super().__init__() configfile = MbedTLSConfigFile(filename) self.configfiles.append(configfile) - self.settings.update({name: Setting(configfile, active, name, value, section) + self.settings.update({name: config_common.Setting(configfile, active, name, value, section) for (active, name, value, section) in configfile.parse_file()}) @@ -643,7 +332,7 @@ class MbedTLSConfig(Config): super().set(name, value) -class CryptoConfig(Config): +class CryptoConfig(config_common.Config): """Representation of the PSA crypto configuration. See the documentation of the `Config` class for methods to query @@ -656,7 +345,7 @@ class CryptoConfig(Config): super().__init__() configfile = CryptoConfigFile(filename) self.configfiles.append(configfile) - self.settings.update({name: Setting(configfile, active, name, value, section) + self.settings.update({name: config_common.Setting(configfile, active, name, value, section) for (active, name, value, section) in configfile.parse_file()}) @@ -674,7 +363,7 @@ class CryptoConfig(Config): super().set(name, value) -class CombinedConfig(Config): +class CombinedConfig(config_common.Config): """Representation of MbedTLS and PSA crypto configuration See the documentation of the `Config` class for methods to query @@ -692,7 +381,7 @@ class CombinedConfig(Config): raise ValueError(f'Invalid configfile: {config}') self.configfiles.append(config) - self.settings.update({name: Setting(configfile, active, name, value, section) + self.settings.update({name: config_common.Setting(configfile, active, name, value, section) for configfile in [self.mbedtls_configfile, self.crypto_configfile] for (active, name, value, section) in configfile.parse_file()}) @@ -750,109 +439,7 @@ class CombinedConfig(Config): return self._get_configfile(name).filename -class ConfigTool(metaclass=ABCMeta): - """Command line config manipulation tool. - - Custom parser option can be added by overriding 'custom_parser_options'. - """ - - def __init__(self, file_type): - """Create parser for config manipulation tool.""" - - self.parser = argparse.ArgumentParser(description=""" - Configuration file manipulation tool.""") - self.subparsers = self.parser.add_subparsers(dest='command', - title='Commands') - self._common_parser_options(file_type) - self.custom_parser_options() - self.parser_args = self.parser.parse_args() - self.config = Config() # Make the pylint happy - - def add_adapter(self, name, function, description): - """Creates a command in the tool for a configuration adapter.""" - - subparser = self.subparsers.add_parser(name, help=description) - subparser.set_defaults(adapter=function) - - def _common_parser_options(self, file_type): - """Common parser options for config manipulation tool.""" - - self.parser.add_argument( - '--file', '-f', - help="""File to read (and modify if requested). Default: {}. - """.format(file_type.default_path)) - self.parser.add_argument( - '--force', '-o', - action='store_true', - help="""For the set command, if SYMBOL is not present, add a definition for it.""") - self.parser.add_argument( - '--write', '-w', - metavar='FILE', - help="""File to write to instead of the input file.""") - - parser_get = self.subparsers.add_parser( - 'get', - help="""Find the value of SYMBOL and print it. Exit with - status 0 if a #define for SYMBOL is found, 1 otherwise.""") - parser_get.add_argument('symbol', metavar='SYMBOL') - parser_set = self.subparsers.add_parser( - 'set', - help="""Set SYMBOL to VALUE. If VALUE is omitted, just uncomment - the #define for SYMBOL. Error out of a line defining - SYMBOL (commented or not) is not found, unless --force is passed. """) - parser_set.add_argument('symbol', metavar='SYMBOL') - parser_set.add_argument('value', metavar='VALUE', nargs='?', default='') - parser_set_all = self.subparsers.add_parser( - 'set-all', - help="""Uncomment all #define whose name contains a match for REGEX.""") - parser_set_all.add_argument('regexs', metavar='REGEX', nargs='*') - parser_unset = self.subparsers.add_parser( - 'unset', - help="""Comment out the #define for SYMBOL. Do nothing if none is present.""") - parser_unset.add_argument('symbol', metavar='SYMBOL') - parser_unset_all = self.subparsers.add_parser( - 'unset-all', - help="""Comment out all #define whose name contains a match for REGEX.""") - parser_unset_all.add_argument('regexs', metavar='REGEX', nargs='*') - - def custom_parser_options(self): - """Adds custom options for the parser. Designed for overridden by descendant.""" - pass - - def main(self): - """Common main fuction for config manipulation tool.""" - - if self.parser_args.command is None: - self.parser.print_help() - return 1 - if self.parser_args.command == 'get': - if self.parser_args.symbol in self.config: - value = self.config[self.parser_args.symbol] - if value: - sys.stdout.write(value + '\n') - return 0 if self.parser_args.symbol in self.config else 1 - elif self.parser_args.command == 'set': - if not self.parser_args.force and self.parser_args.symbol not in self.config.settings: - sys.stderr.write( - "A #define for the symbol {} was not found in {}\n" - .format(self.parser_args.symbol, - self.config.filename(self.parser_args.symbol))) - return 1 - self.config.set(self.parser_args.symbol, value=self.parser_args.value) - elif self.parser_args.command == 'set-all': - self.config.change_matching(self.parser_args.regexs, True) - elif self.parser_args.command == 'unset': - self.config.unset(self.parser_args.symbol) - elif self.parser_args.command == 'unset-all': - self.config.change_matching(self.parser_args.regexs, False) - else: - self.config.adapt(self.parser_args.adapter) - self.config.write(self.parser_args.write) - - return 0 - - -class MbedTLSConfigTool(ConfigTool): +class MbedTLSConfigTool(config_common.ConfigTool): """Command line mbedtls_config.h and crypto_config.h manipulation tool.""" def __init__(self): From f5f130879cd065bb079583b6ee8d05a1c8e1f9c5 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Wed, 18 Sep 2024 13:02:16 +0200 Subject: [PATCH 09/13] Fix documentation Signed-off-by: Gabor Mezei --- scripts/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/config.py b/scripts/config.py index 25709567cf..299e2dedb4 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -422,13 +422,16 @@ class CombinedConfig(config_common.Config): If mbedtls_file or crypto_file is specified, write the specific configuration to the corresponding file instead. + + The parameter name is differ from the definition of the super class to handle + two different config files. """ self.mbedtls_configfile.write(self.settings, mbedtls_file) self.crypto_configfile.write(self.settings, crypto_file) def filename(self, name=None): - """Get the names of the config files. + """Get the name of the config files. If 'name' is specified return the name of the config file where it is defined. """ From 568808a41aed52bd87224bbfb4fbc6f64f519c45 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Wed, 18 Sep 2024 13:02:42 +0200 Subject: [PATCH 10/13] Update member variable names Signed-off-by: Gabor Mezei --- scripts/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/config.py b/scripts/config.py index 299e2dedb4..28dfb53204 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -447,8 +447,8 @@ class MbedTLSConfigTool(config_common.ConfigTool): def __init__(self): super().__init__(MbedTLSConfigFile) - self.config = CombinedConfig(MbedTLSConfigFile(self.parser_args.file), - CryptoConfigFile(self.parser_args.cryptofile)) + self.config = CombinedConfig(MbedTLSConfigFile(self.args.file), + CryptoConfigFile(self.args.cryptofile)) def custom_parser_options(self): """Adds MbedTLS specific options for the parser.""" From 317a2a3fed6c8cb1a3bf038892dd958a6b6fa53a Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Wed, 18 Sep 2024 16:51:27 +0200 Subject: [PATCH 11/13] Fix documentation Signed-off-by: Gabor Mezei --- scripts/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/config.py b/scripts/config.py index 28dfb53204..fb7055898f 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -423,8 +423,8 @@ class CombinedConfig(config_common.Config): If mbedtls_file or crypto_file is specified, write the specific configuration to the corresponding file instead. - The parameter name is differ from the definition of the super class to handle - two different config files. + Two file name parameters and not only one as in the super class as we handle + two configuration files in this class. """ self.mbedtls_configfile.write(self.settings, mbedtls_file) From cd326bfc496e8ed5eeae4a6082e8b4c39096e948 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Wed, 18 Sep 2024 16:53:03 +0200 Subject: [PATCH 12/13] Apply the parameter change Signed-off-by: Gabor Mezei --- scripts/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config.py b/scripts/config.py index fb7055898f..50889fc9a1 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -446,7 +446,7 @@ class MbedTLSConfigTool(config_common.ConfigTool): """Command line mbedtls_config.h and crypto_config.h manipulation tool.""" def __init__(self): - super().__init__(MbedTLSConfigFile) + super().__init__(MbedTLSConfigFile.default_path) self.config = CombinedConfig(MbedTLSConfigFile(self.args.file), CryptoConfigFile(self.args.cryptofile)) From a941e14b4cd75fb7bb09e06d8272aed902c8ae10 Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Tue, 10 Sep 2024 16:27:04 +0200 Subject: [PATCH 13/13] Update framework Signed-off-by: Gabor Mezei --- framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework b/framework index 071831e25b..8c488b1b8f 160000 --- a/framework +++ b/framework @@ -1 +1 @@ -Subproject commit 071831e25bd336baa58bbdf65e985283f56e1b86 +Subproject commit 8c488b1b8f86384450c922f22cd1bee0b996be13