830 Commits

Author SHA1 Message Date
Gilles Peskine
f08ca83b4f Update spelling "mbed TLS" to "Mbed TLS"
The official spelling of the trade mark changed from all-lowercase "mbed"
to normal proper noun capitalization "Mbed" a few years ago. We've been
using the new spelling in new text but still have the old spelling in a
lot of text. This commit updates most occurrences of "mbed TLS":

```
sed -i -e 's/mbed TLS/Mbed TLS/g' $(git ls-files ':!ChangeLog' ':!tests/data_files/**' ':!tests/suites/*.data' ':!programs/x509/*' ':!configs/tfm*')
```

Justification for the omissions:

* `ChangeLog`: historical text.
* `test/data_files/**`, `tests/suites/*.data`, `programs/x509/*`: many
  occurrences are significant names in certificates and such. Changing
  the spelling would invalidate many signatures and tests.
* `configs/tfm*`: this is an imported file. We'll follow the upstream
  updates.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-12 19:21:54 +02:00
Gilles Peskine
bd44d93ee9 Allow "Mbed TLS" as the project name in Doxygen
Previously the code only recognized the old spelling "mbed TLS", so it
missed doxygen/input/doc_mainpage.h.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-12 19:21:37 +02:00
Gilles Peskine
3a11771bae Pacify pylint
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-08 11:17:09 +02:00
Gilles Peskine
937b91eb6f 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 the moved options:

* Everest is already explicitly excluded.
* The ALT options need to link against a custom function, so exclude them.
* `MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE` is ok for testing, and is
  currently never tested in `all.sh`. With this commit, we will now test the
  library with it enabled in configurations based on `full`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-07 17:40:16 +02:00
Bence Szépkúti
fb806b68ed
Merge pull request #7969 from gowthamsk-arm/use_earliest_latest_compilers_2.28
Backport 2.28: Use earliest latest compilers 2.28
2023-08-01 23:50:14 +00:00
Gowtham Suresh Kumar
2afb24f96a 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-08-01 09:45:57 +01:00
Dave Rodgman
dd7b24c3bf whitespace fix
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-07-27 20:01:04 +01:00
Dave Rodgman
e67ffd6d20 pylint tidy-up
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 18:50:50 +01:00
Dave Rodgman
73b87e39d6 Make code_style.py -s default to -s=mbedtls-2.28
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 18:44:52 +01:00
Dave Rodgman
b96dbc6486 Make code_style.py -s more precise
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 18:44:45 +01:00
Gowtham Suresh Kumar
1e3af2485f 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:55:39 +01:00
Gilles Peskine
73521b0715 Tests: provide necessary functions for MBEDTLS_PSA_INJECT_ENTROPY
The build option MBEDTLS_PSA_INJECT_ENTROPY requires some extra platform
functions, for historical reasons. To enable us to test this option, provide
a version of these functions for testing.

(These versions would actually work in production, but providing them in the
library in a way that doesn't break existing users might be slightly tricky,
so it's out of scope of this commit.)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-20 18:08:24 +02:00
Gilles Peskine
7b780491f0 Handle deleted files correctly
Don't attempt to run on a file that isn't present now.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-04 15:47:02 +02:00
Gilles Peskine
8ceeba4f22 Add --since option to check files modified since a given commit
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-04 15:47:01 +02:00
Gilles Peskine
0f1053c13b Clean up subprocess invocation in get_src_files
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-04 15:46:59 +02:00
Fredrik Hesse
02501f6ba1 Replace references to Mbed Crypto with Mbed TLS through-out documentation and comments.
Signed-off-by: Fredrik Hesse <fredrik@hesse.se>
2023-05-15 15:28:39 +01:00
Fredrik Hesse
5b673a828d Replace references to Mbed Crypto with Mbed TLS through-out documentation and comments.
Signed-off-by: Fredrik Hesse <fredrik@hesse.se>
2023-05-15 15:27:54 +01:00
Pengyu Lv
e95df0bd70 Fix CI failure
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-16 18:12:51 +08:00
Pengyu Lv
4a37eef78f Only check files known to git
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-16 18:12:51 +08:00
Pengyu Lv
bae83d25eb Improve readability
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-16 18:12:51 +08:00
Pengyu Lv
44b75a605b adjust help message
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-16 18:12:51 +08:00
Pengyu Lv
75e11d3703 print skipped file names to stdout
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-16 18:12:51 +08:00
Pengyu Lv
a4b9b7700a code_style.py: Add helpers to print warning and skipped files
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-16 18:12:51 +08:00
Pengyu Lv
b1c9cc3ae4 code_style.py: Apply exclusions to the file list
This commit rename `--files` options to `--subset` and
it means to check a subset of the files known to git.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-16 18:12:51 +08:00
Gilles Peskine
d6bb16a5b8
Merge pull request #6976 from davidhorstmann-arm/2.28-c-build-helper-improvements
[Backport 2.28] Minor improvements to `c_build_helper.py`
2023-02-07 10:26:03 +01:00
Gilles Peskine
9a10538f20
Merge pull request #6965 from davidhorstmann-arm/2.28-code-style-improvements
[Backport 2.28] Improvements to code style script
2023-01-31 21:22:59 +01:00
David Horstmann
e28f2ee685 Add docstring for new compile function.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-30 09:52:01 +00:00
David Horstmann
0b1b97badf Make c_build_helper module respect HOSTCC
If HOSTCC is set, use that to generate files, otherwise use CC. This
should make cross-compilation with generated files slightly easier.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-27 19:56:49 +00:00
David Horstmann
ddb09e4f17 c_build_helper.py: Move compile to helper
Move compilation to a separate helper function in c_build_helper.py to
allow more generic use.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-27 19:56:47 +00:00
Manuel Pégourié-Gonnard
27276fcb97
Merge pull request #6844 from gilles-peskine-arm/test_suite_psa_crypto_metadata-20221215-2.28
Backport 2.28: Add metadata tests for CCM* and TLS1.2-ECJPAKE-to-PMS
2023-01-27 10:05:04 +01:00
David Horstmann
04aaa45ee1 Remove unnecessary '\' linebreak characters
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-25 11:39:45 +00:00
David Horstmann
659d905cf9 Give proper Dict type hints in crypto_knowledge.py
This prevents a return type error in a later function that uses the
dictionaries here properly typed.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-24 19:01:31 +00:00
David Horstmann
6956cb58ac Don't wrap stdout and stderr in UTF-8 wrapper
This is no longer needed as we only print ASCII text directly

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-24 18:43:12 +00:00
David Horstmann
5682e80266 Output diff without capturing it
Instead of capturing the output of diff and printing it, let diff do its
own outputting and se the return code to decide what to do.

This also means that the conversion of stdout to UTF-8 is not necessary,
as the reason it was needed was for printing diffs of files with UTF-8
characters in them.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-24 18:43:12 +00:00
David Horstmann
6d02f0cfa0 Add basic output on success
Whilst it is true that "silence is golden", no output at all could be
disconcerting and it makes searching in a CI log more difficult.

Add a simple status message that says "Checked N files, style ok".

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-24 18:43:12 +00:00
David Horstmann
3febe15114 Remove overly verbose output on success
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-24 18:43:12 +00:00
David Horstmann
64827e4611 Change print to print_err for an error message
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-24 18:43:12 +00:00
David Horstmann
a27d872228 Document that the script must be run from the root
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-24 18:43:12 +00:00
David Horstmann
f7b7bf7a5e Remove provisional notice on code style script
Since code style is now enforced, the notice is wrong. Remove it to
avoid confusion.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-24 18:43:12 +00:00
Gilles Peskine
1d671c90db
Merge pull request #6835 from gilles-peskine-arm/code-style-files-2.28
Backport 2.28: code_style.py: Support restyling only the specified files
2023-01-19 12:26:07 +01:00
Gilles Peskine
b71d28b695 Fix example command
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-17 18:09:39 +00:00
Gilles Peskine
1b6c09a62e Switch to the new code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-11 14:52:35 +01:00
Thomas Daubney
0c6052f041 Modify generate errors script
Modify generate_errors.pl such that it can now handle
opening files where the file path includes a directory
name containing spaces.

Raised in issue #6879. Fix provided by
@tom-cosgrove-arm in aforementioned issue.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-01-09 18:48:01 +00:00
David Horstmann
242df48cab Fix pylint warnings about comparison to True
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-05 10:04:21 +00:00
David Horstmann
fa69def8e3 Fix incorrect typing of function in code_style.py
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-05 10:03:48 +00:00
David Horstmann
b92d30f987 Check Uncrustify returncode in code_style.py
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-04 18:44:35 +00:00
Gilles Peskine
7f7630c0fe Refactoring: new method Algorithm.is_valid_for_operation
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-12-24 11:41:58 +01:00
Gilles Peskine
7528986f97 Documentation improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-12-23 18:15:50 +01:00
Gilles Peskine
38f514dbc2 Support restyling only the specified files
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-12-22 16:37:55 +01:00
Gilles Peskine
4ca54d417e Don't touch the style of generated files
Ideally the result of the generator would conform to the code style, but
this would be difficult, especially with respect to the placement of line
breaks in long logical lines. So, to avoid surprises when checking the style
of generated files (which happens in releases and in long-time support
branches), systematically skip generated files.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-12-19 00:58:25 +01:00