Commit graph

1358 commits

Author SHA1 Message Date
Dave Rodgman
7fda906a68
Merge pull request #8161 from gilles-peskine-arm/config-boolean-options-wrong-section-202309
Fix module configuration options in mbedtls_config.h
2023-09-11 15:08:56 +00:00
Gilles Peskine
a8861e086e Fix boolean options in the wrong section
Boolean options that modify the behavior of a module are supposed to be in
the "feature support" section, not in the "configuration options" support:
that section is documented to contain commented-out definitions with a
value, for which the comment contains the default version. In particular,
merely uncommenting a definition in the "configuration options" section is
not supposed to change anything.

Move the offending boolean options to the proper section.

This causes those options to be enabled by `config.py full` unless
explicitly excluded. For all the offending options, this is undesirable, so
make sure those options are indeed excluded.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-05 20:20:51 +02:00
Dave Rodgman
4f69668558
Merge pull request #8082 from daverodgman/misc-code-size
Misc code size improvements
2023-09-02 11:44:31 +00:00
Dave Rodgman
a9a53a05f0 Merge remote-tracking branch 'origin/development' into misc-code-size 2023-08-31 11:53:46 +01:00
Dave Rodgman
787011542b Fully replace mbedtls_psa_safer_memcmp
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 14:20:18 +01:00
David Horstmann
2fde99962d Improve directory coverage in PSA repo detection
Check for the 'drivers' and 'programs' directories additionally to the
ones that are already there.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-08-29 09:50:16 +01:00
David Horstmann
42f42f4394 Support psa-crypto repo in psa_storage.py
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-08-24 15:18:18 +01:00
David Horstmann
795d8b523d Modify build_tree.py for the PSA Crypto repo
When detecting the root dir, look both for PSA Crypto and Mbed TLS
directories.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-08-24 15:18:18 +01:00
Gilles Peskine
ad7725d95d Fix type annotation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-22 09:59:50 +02:00
Gilles Peskine
c9187c5866 New test suite for the low-level hash interface
Some basic test coverage for now:

* Nominal operation.
* Larger output buffer.
* Clone an operation and use it after the original operation stops.

Generate test data automatically. For the time being, only do that for
hashes that Python supports natively. Supporting all algorithms is future
work.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-22 09:59:42 +02:00
Gilles Peskine
fdb722384b Move PSA information and dependency automation into their own module
This will let us use these features from other modules (yet to be created).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-21 18:32:11 +02:00
Bence Szépkúti
505dffd5e3
Merge pull request #7937 from yanrayw/code_size_compare_improvement
code_size_compare.py: preparation work to show code size changes in PR comment
2023-08-17 20:59:11 +00:00
Yanray Wang
bc775c48c9 code_size_compare: handle deleted files and new files properly
'Removed' and 'NotCreated' should be displayed in new and old column
respectively. The value of delta is reflected on change column. This
commit handles the corner cases properly.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-16 16:08:22 +08:00
Yanray Wang
8a25e6fdb2 code_size_compare: add old text and data section in CSV output
To keep a concise markdown table, we don't list text and data
section from old Git revision. However, it should be ideal to keep
those two sections in CSV output. Therefore, we list comparison
result for CSV output in following format:

 filename new(text) new(data) old(text) old(data) change(text) change(data)

Additionally, if a file only exits in new Git revision not in old
Git revision, it's marked as `NotCreated` as we haven't created this
file yet from perspective of old Git revision.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-14 15:22:36 +08:00
Yanray Wang
0de1183e4c code_size_compare: add + in front of positive values
In comparison result, to indicate it's a delta value, we add `+` in
front of positive values. For unchanged attributes, it's still
shown as `0'.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-14 11:58:48 +08:00
Yanray Wang
9a6ee71f6f code_size_compare: right-align numbers in the comparison result
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-14 11:30:27 +08:00
Yanray Wang
1998aac349 logging_util: support to tweak loglevel directed to stderr/stdout
Previously we set loglevel >= WARNING printed to stderr and
loglevel < WARNING printed to stdout. To be more flexible, we
replace this `WARNING` value with an argument: split_level and leave
`WARNING` as default split_level if not set.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-14 11:22:34 +08:00
Paul Elliott
2f12a29cdd
Merge pull request #7896 from AgathiyanB/gitignore-generated-files-toggle
Add script to toggle ignoring generated files
2023-08-09 14:54:32 +00:00
Manuel Pégourié-Gonnard
8550e0f746 Remove "export_key" from transparent driver json
Transparent drivers don't have this entry points. Other entry points
that are only for opaque drivers are not listed here but only in the
opaque_driver.json file, so this was likely a mistake.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-08-08 09:39:39 +02:00
Tom Cosgrove
2588f8d36d
Merge pull request #8018 from AgathiyanB/add-overflow-test-inputs-bignum
[Bignum] Add overflow test inputs for add and add if
2023-08-04 14:00:39 +00:00
Agathiyan Bragadeesh
b8bd604379 Remove trailing whitespace
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-04 14:14:11 +01:00
Agathiyan Bragadeesh
3bcff5431a Put both gitignore modifications in one script
New file also contains a header file and uses sed

Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-04 14:13:08 +01:00
Agathiyan Bragadeesh
3c963eefe2 Remove trailing whitespace
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-03 12:32:09 +01:00
Bence Szépkúti
9661f8ab0d
Merge pull request #7968 from gowthamsk-arm/use_earliest_latest_compilers
Use earliest latest compilers
2023-08-02 05:58:02 +00:00
Agathiyan Bragadeesh
ab329c0dfc Rename ADD_SUB_DEFAULT to ADD_SUB_DATA
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-01 17:18:31 +01:00
Agathiyan Bragadeesh
59003c70ae Use ADD_SUB_DEFAULT as test input for bignum tests
In BignumCoreAddAndAddIf and BignumCoreSub we use the new dedicated
test inputs.

Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-01 16:32:36 +01:00
Agathiyan Bragadeesh
7847eaef20 Add default test cases for add/subtract in bignum
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-01 16:30:51 +01:00
Janos Follath
5b7c38f673 Sort full config exceptions in config.py
The EXCLUDE_FROM_FULL list in config.py should be, and used to be, but
no longer is, in alphabetical order, and with a comma on the last
element.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-08-01 08:51:12 +01:00
Janos Follath
3ed980d60f Fix full config in config.py
By default, the full configuration enables all options. But we
specifically don't want to enable MBEDTLS_ECP_WITH_MPI_UINT except where
it's done explicitly, because it disables the old ecp. So it needs to be
added to the exceptions in config.py (EXCLUDE_FROM_FULL).

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-07-31 16:27:04 +01:00
Gowtham Suresh Kumar
6f1977bf20 Use variables for selecting compilers
The latest and earliest clang/GCC compilers are now used through
variables instead of symlinks and also the all.sh script is updated
to support options for overriding the default values.

Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-07-28 17:04:47 +01:00
Yanray Wang
ee07afa205 code_size_compare: add option '--show-all'
When '--show-all' is enabled, all the objects will be displayed in
comparison result no matter if there is code size change or not.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-28 16:43:56 +08:00
Yanray Wang
b167320e27 code_size_compare: use '.md' suffix if '--markdown' enabled
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-28 16:24:17 +08:00
Yanray Wang
dcf360dd72 code_size_compare: track removed object as well
It makes sense to display code size changes if a file has been
removed in our library. With this commit we track old objects as
well. If a file is not present in the new Git revision,
we display -old_size in the new_size column. The size change is
marked as `Removed` to indicate the file has been removed.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-28 16:05:37 +08:00
Dave Rodgman
fccc5f8b9d whitespace fix
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-07-27 20:00:41 +01:00
Dave Rodgman
82d174a6a8 pylint tidy-up
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 18:51:06 +01:00
Dave Rodgman
eaf2761ae1 Make code_style.py -s default to -s=development
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 17:43:55 +01:00
Dave Rodgman
05b60f40ac Make code_style.py -s more precise
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 17:43:48 +01:00
Yanray Wang
4dfc132bcb code_size_compare: change format for comparison result
The result format for code size comparison is:

filename new(text) new(data) change(text) change(data)
yyy.o    xxx       xxx       xx           xx

The numbers followed are in bytes.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-27 10:47:21 +08:00
Yanray Wang
6f09267646 code_size_compare: remove column of percentage for code size change
Percentage is not a useful number when looking at code size changes.
Since it depends on the base of the code size. It might give
misleading information by simply looking at the numbers.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-27 10:19:38 +08:00
Gowtham Suresh Kumar
a12baf8c5f Update test scripts to use latest/earliest compilers
The Ubuntu 16.04 and 22.04 docker images have been updated with
earliest and latest versions of gcc and clang respectively.
This patch adds the necessary component and support functions
required for the CI to run these compilers.

For FreeBSD we invoke the function by name so a condition is added
to disable the existing test_clang_opt function for linux.

Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-07-26 16:51:45 +01:00
Yanray Wang
ca9a3cbc1d code_size_compare: detect architecture of x86_32 properly
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 17:21:10 +08:00
Yanray Wang
6ae94a0a72 code_size_compare: make sure _remove_worktree executed
Add try and finally to make sure we remove worktree as expected even
if we hit errors by accident.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 17:13:24 +08:00
Yanray Wang
9e8b671b1c code_size_compare: check --record-dir properly
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 15:37:29 +08:00
Manuel Pégourié-Gonnard
182eb1514e Fix KeyType.can_do() for DH+FFDH
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-26 09:34:30 +02:00
Manuel Pégourié-Gonnard
636d85724a Shorten DH_FAMILY just like ECC_FAMILY
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-26 09:32:42 +02:00
Manuel Pégourié-Gonnard
afe4b79114 Enable DH in generate_psa_tests.py
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-26 09:32:42 +02:00
Yanray Wang
a279ca9ff8 code_size_compare: remove unnecessary -r in cp command
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 15:01:12 +08:00
Yanray Wang
6ef5049b9f code_size_compare: simplify some code for python dictionary
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 14:59:39 +08:00
Yanray Wang
15b1358f22 logging_util: rename argument
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 14:48:12 +08:00
Yanray Wang
68265f41d7 code_size_compare: use current as default new Git revision
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-26 14:45:00 +08:00