Commit graph

78 commits

Author SHA1 Message Date
Gilles Peskine
2552bc73d4 Fix "#define ... not found" error when using the default file name
Also make that error message end with a newline.
2019-11-13 14:33:34 +00:00
Gilles Peskine
63cdb2855f Fix "--force set" without a value sneaking a None in 2019-11-13 14:33:34 +00:00
Gilles Peskine
a52f97d5a5 Fix --force requiring an argument 2019-11-13 14:33:34 +00:00
Gilles Peskine
b6fa7970a6 Fix Config.unset() making the name known 2019-11-13 14:33:34 +00:00
Gilles Peskine
812f185bc8 Also search config.h near the script
By default, this script looks for include/mbedtls/config.h relative to
the current directory. This allows running config.py from outside the
build tree.

To support out-of-tree builds where config.h and config.py are in the
source tree and the current directory is in the build tree, also try
DIRECTORY_CONTAINING_SCRIPT/../include/mbedtls/config.h, and the
equivalent with symbolic links traversed.
2019-11-13 14:33:34 +00:00
Gilles Peskine
5d650c86b4 Fix 'config.py set' without --force
The `set` command can act on any known symbol.
2019-11-13 14:33:34 +00:00
Gilles Peskine
a26ea87dde Fix encoding errors
config.h is encoded in UTF-8.
2019-11-13 14:33:34 +00:00
Gilles Peskine
a47ab22852 Print help when invoked with no arguments 2019-11-13 14:33:34 +00:00
Gilles Peskine
4efaeba48b Support writing to a different file 2019-11-13 14:32:04 +00:00
Gilles Peskine
651a64de7d Sort symbol lists in alphabetical order
They're easier to maintain that way. The old lists were partly
alphabetized, partly based on config.h order, and partly in the order
in which symbols had been added to config.pl.
2019-11-13 14:32:04 +00:00
Gilles Peskine
f6f5ea21b5 Remove obsolete options from config.py
These options haven't existed for a long time.
2019-11-13 14:32:04 +00:00
Gilles Peskine
61f3c0ce85 Implement the 'full' and 'baremetal' configurations
Also fix 'realfull' to only affect the appropriate sections.

Tested to produce the same results as config.pl on the default
configuration. This commit deliberately contains a direct copy the
lists of symbol names from config.pl.
2019-11-13 14:32:04 +00:00
Gilles Peskine
39bd5e7f9e Mbed TLS configuration file manipulation library and tool
This is meant to be a drop-in replacement for config.pl which can
additionally be used as a library in a Python script.

So far this script supports the commands 'get', 'set' and 'realfull'
but not the other built-in configurations.
2019-11-13 14:32:04 +00:00
Gilles Peskine
f686042554 Fix config.py output when a symbol has acquired or lost a value
Normally a valueless symbol remains valueless and a symbol with a
value keeps having one. But just in case a symbol does get changed
from valueless to having a value, make sure there's a space between
the symbol and the value. And if a symbol gets changed from having a
value to valueless, strip trailing whitespace.

Add corresponding tests.

Also fix the case of a valueless symbol added with the set method,
which would have resulted in attempting to use None as a string. This
only happened with the Python API, not with the command line API.
2019-09-13 11:04:24 +02:00
Gilles Peskine
c190c90889 Documentation improvements 2019-09-13 11:04:24 +02:00
Gilles Peskine
221df1e0ef Fix "#define ... not found" error when using the default file name
Also make that error message end with a newline.
2019-09-13 11:04:24 +02:00
Gilles Peskine
0c7fcd210f Fix "--force set" without a value sneaking a None in 2019-09-13 11:04:24 +02:00
Gilles Peskine
435ce22920 Fix --force requiring an argument 2019-09-13 11:04:23 +02:00
Gilles Peskine
55cc4dbb5c Fix Config.unset() making the name known 2019-09-13 11:04:23 +02:00
Gilles Peskine
208e4ec5d3 Also search config.h near the script
By default, this script looks for include/mbedtls/config.h relative to
the current directory. This allows running config.py from outside the
build tree.

To support out-of-tree builds where config.h and config.py are in the
source tree and the current directory is in the build tree, also try
DIRECTORY_CONTAINING_SCRIPT/../include/mbedtls/config.h, and the
equivalent with symbolic links traversed.
2019-09-13 11:04:23 +02:00
Gilles Peskine
98eb36557d Fix 'config.py set' without --force
The `set` command can act on any known symbol.
2019-09-13 11:04:23 +02:00
Gilles Peskine
0fa5efb7ce Fix encoding errors
config.h is encoded in UTF-8.
2019-09-13 11:04:23 +02:00
Gilles Peskine
90b30b618b Print help when invoked with no arguments 2019-09-13 11:04:23 +02:00
Gilles Peskine
40f103cea2 Support writing to a different file 2019-09-13 11:04:23 +02:00
Gilles Peskine
2d89ccced5 Sort symbol lists in alphabetical order
They're easier to maintain that way. The old lists were partly
alphabetized, partly based on config.h order, and partly in the order
in which symbols had been added to config.pl.
2019-09-13 11:04:21 +02:00
Gilles Peskine
6c2d078935 Remove obsolete options from config.py
These options haven't existed for a long time.
2019-09-13 10:56:03 +02:00
Gilles Peskine
53d41ae872 Implement the 'full' and 'baremetal' configurations
Also fix 'realfull' to only affect the appropriate sections.

Tested to produce the same results as config.pl on the default
configuration. This commit deliberately contains a direct copy the
lists of symbol names from config.pl.
2019-09-13 10:55:25 +02:00
Gilles Peskine
b4063890e8 Mbed TLS configuration file manipulation library and tool
This is meant to be a drop-in replacement for config.pl which can
additionally be used as a library in a Python script.

So far this script supports the commands 'get', 'set' and 'realfull'
but not the other built-in configurations.
2019-09-13 10:49:20 +02:00