Commit Graph

15727 Commits

Author SHA1 Message Date
Gilles Peskine
502d889de7 Use an order-only dependency the presence matters but not the content
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-19 14:26:37 +02:00
Gilles Peskine
ef0482373f Remove Git pre-commit hook
Since generated files are no longer stored in the repository, they
don't need to be up-to-date before committing.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:28:28 +02:00
Gilles Peskine
192970bd8e Test check-generated-files.sh
Re-create a component check_generated_files. Unlike the old one, which checked
that the generated files were up-to-date, the job of the new one is to check
that tests/scripts/check-generated-files.sh works (at least to the extent of
not errorring out).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:28:28 +02:00
Gilles Peskine
4c2adea042 Fix make generated_files generating broken visualc files
Ensure that the .c files that generate_visualc_files.pl enumerates are present
before it runs. Otherwise, depending on the order in which make builds
targets, running `make generated_files` from a fresh checkout could end up
missing `library/error.c` and `library/version_features.c`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:28:28 +02:00
Gilles Peskine
4a7dfcb3d1 Avoid creating visualc/VS2010/*.bak.bak files
This could happen if a previous run of check-generated-files failed.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:28:28 +02:00
Gilles Peskine
414475710f Revert "Create visualc directory if it doesn't exist"
This reverts commit 833a389180.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:28:21 +02:00
Gilles Peskine
c8731f0204 Move VS2010 Git ignore list to the VS2010 directory
The main benefit is that this ensures that the directory always exists in a
Git checkout. This way the maintenance scripts don't have to worry about the
case where the directory doesn't exist.

Also it unclutters `/.gitignore`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:27:34 +02:00
Bence Szépkúti
32728f5eaa Remove caching of cc_is_msvc
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-05-18 16:27:34 +02:00
Bence Szépkúti
3006a9cd84 Remove object file in finally
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-05-18 16:27:34 +02:00
Bence Szépkúti
80aba9749e Move object file handling out of create_c_file()
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-05-18 16:27:34 +02:00
Bence Szépkúti
f5a0b9c405 Add notice of caching whether the compiler is MSVC
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-05-18 16:27:34 +02:00
Bence Szépkúti
3d69e29b78 Clean up object files produced by MSVC
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-05-18 16:27:34 +02:00
Bence Szépkúti
c2e029fd4e Detect MSVC without relying on compiler filename
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-05-18 16:27:34 +02:00
Gilles Peskine
80446e5496 Typo in comment
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:27:34 +02:00
Gilles Peskine
8b7595ea34 In update mode, create the files if they don't exist
`check-generated-files -u` aborted if one of the generated files
didn't exist. Now it treats a missing file as an out-of-date file.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:27:34 +02:00
Gilles Peskine
e29fad72a3 Explicitly use UTF-8 in assemble_changelog
Changelog contents should be UTF-8 text files. So explicitly open all files as
UTF-8. This makes the script independent of the ambient locale (except with
respect to exception messages, but we can live with that).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:27:34 +02:00
Gilles Peskine
191b98f0c4 Switch assemble_changelog to using text strings
Changelog contents should be UTF-8 text files. There's no need to be
binary-safe. So switch to using text strings in Python (str, not bytes). This
commit makes the following changes:
* Bytes literals (b'…') to string literals ('…').
* Subprocess output (which is all git information) is decoded as ascii.
* Inject text directly in exceptions rather than calling a decode method.

This is enough to make the script work as desired in a UTF-8 locale.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:27:34 +02:00
Gilles Peskine
984b8c3164 Changelog entry for the requirement to generate source files
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:27:34 +02:00
Gilles Peskine
dbcd722018 Document how to build the generated source files
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-18 16:27:34 +02:00
Bence Szépkúti
5fd9b6ad79 Improve MSVC detection
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-05-17 22:48:38 +02:00
Bence Szépkúti
24730051d8 Always use posix semantics when joining paths
The backslashes were causing issues with Makefile rules.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-05-17 22:48:38 +02:00
Bence Szépkúti
615b83dff7 Specify output name for MSVC as well
The output file was being created in the working directory, instead of
the temp directory.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-05-17 22:48:38 +02:00
Bence Szépkúti
17766c2db2 Explicitly specify exit code for "exit /b"
"exit /b" without an explicit exit value doesn't copy the value of the
last command executed, causing issues on Jenkins.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2021-05-17 22:48:38 +02:00
Gilles Peskine
645785a9a3 If $CC looks like MSVC, use a compatible command line syntax
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:38 +02:00
Gilles Peskine
9a36d7e6a4 Accept Windows line endings on inputs on any platform
Accept Windows line endings in input files on any platform. This makes
the scripts work even when running a Unix perl with a source tree that
has Windows line endings, as happens for example on our Travis Windows
instances. This change is harmless in the common case where the input
has the platform's default line endings.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:38 +02:00
Gilles Peskine
a045737f56 Simplify line ending management and make it work on Windows
Instead of manipulating CR explicitly to cope with CRLF (Windows) line
endings in input and produce output with CRLF line endings, just
convert files from/to CRLF line endings when reading/writing.

The minimum required Perl version remains 5.8, since this both the
version that introduced Digest::MD5 (which was used before this patch)
and the version that introduced open "<:crlf" (which this patch
introduces).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:38 +02:00
Gilles Peskine
6ff8614267 Don't require make to generate visualc files
Don't run `make list` to obtain the list of programs in
generate_visualc_files.pl. This doesn't work on Windows when a `make`
command is not available. Instead, read the makefile.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:38 +02:00
Gilles Peskine
9f955520f4 Don't make configuration-independent files depend on config.h
Don't regenerate configuration-independent files when config.h or
crypto_config.h changes. These files only depend on the set of symbols
present in the headers and not on which symbols are enabled. To avoid
rebuilding the generated files whenever the configuration changes,
don't declare the configuration as a dependency.

In the rare event that a maintainer makes an edit to *config.h that
affects the generated files, they'll have to remove the generated files.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:08 +02:00
Gilles Peskine
81dd3633c9 Generate source files before doing builds on Travis
On Linux, all.sh takes care of it. On Windows, run
make_generated_files.bat.

Perl is now required on Windows.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:08 +02:00
Gilles Peskine
920f520790 Script to generate source files on Windows
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:08 +02:00
Gilles Peskine
d1d869ced8 Ignore generated source files that are no longer checked in
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:08 +02:00
Gilles Peskine
03ecbad38e Generate source files before running any components
Now that generated source files are no longer checked in version
control, they must be generated before running any tests.

Do not check the generated files for freshness: it's no longer relevant.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:08 +02:00
Gilles Peskine
833a389180 Create visualc directory if it doesn't exist
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:08 +02:00
Gilles Peskine
9c58274484 Remove automatically generated source files
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:48:08 +02:00
Gilles Peskine
687d1ab714 Makefile targets for automatically generated files
Run `make generated_files` to generate the automatically generated
C source files and build scripts.

Run `make neat` to remove all automatically generated files, even C
source files and build scripts.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:47:02 +02:00
Gilles Peskine
b61a614cdb Use Python 3 instead of Python 2 to generate test files
Python 2 is no longer officially supported, but we were still using it
to generate test suite .c files from .function files when using GNU
make. Switch to looking for Python 3.

This change was done for CMake a long time ago.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:46:27 +02:00
Gilles Peskine
c86f20af98 Allow running source file generators from a subdirectory
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-05-17 22:46:27 +02:00
Ronald Cron
fdcde47f36 Merge pull request #4458 from davidhorstmann-arm/remove-max-content-len
Remove MBEDTLS_SSL_MAX_CONTENT_LEN option
2021-05-17 16:36:04 +02:00
Gilles Peskine
864b425156 Merge pull request #4488 from tom-daubney-arm/remove_rsa_mode_params
Remove rsa mode params part 1
2021-05-17 13:49:19 +02:00
Manuel Pégourié-Gonnard
9370f01391 Merge pull request #3927 from hanno-arm/ciphersuite_helper_macros
Unify naming scheme for macros indicating presence of classes of ciphersuites
2021-05-17 11:18:58 +02:00
Thomas Daubney
0fdd8d297a Adding correction to documentation
As picked up in review, this commit
modifies the documentation by removing some
wording that is now superfluous given the
removal of the mode parameter.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2021-05-17 09:58:05 +01:00
Manuel Pégourié-Gonnard
5605911fd3 Merge pull request #4447 from hanno-arm/ssl_config_cleanup
Avoid and remove some SSL error codes for Mbed TLS 3.0
2021-05-17 10:55:17 +02:00
Gilles Peskine
03b5ab4d54 Merge pull request #4510 from gabor-mezei-arm/3267_fp30_Implement_psa_sign_message_and_verify
[Forwardport 3.0] Implement psa_sign_message and psa_verify_message
2021-05-17 10:14:50 +02:00
Hanno Becker
8cce50d726 Remove reference to SSLv3
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2021-05-15 06:15:52 +01:00
Hanno Becker
d086bf0c62 Fix typo
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2021-05-15 06:14:56 +01:00
Hanno Becker
31351cef6f Add missing escape character in multi-line preprocessor directive
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2021-05-15 06:14:56 +01:00
Hanno Becker
0cc4661365 Introduce helper macro for presence of stream ciphersuites
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2021-05-15 06:14:56 +01:00
Hanno Becker
fd86ca8626 Rename SOME_MODES_USE_MAC -> SOME_SUITES_USE_MAC
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2021-05-15 06:07:48 +01:00
Hanno Becker
59b97bbe06 Fixup glitch in ChangeLog entry
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2021-05-14 17:12:15 +01:00
Hanno Becker
8e184e2deb Add migration guide
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2021-05-14 17:10:27 +01:00