Commit Graph

9824 Commits

Author SHA1 Message Date
Paul Elliott
4eadb02bf9 Add checked return to cipher setup
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2021-12-09 21:38:48 +00:00
Gilles Peskine
286bd2427f Merge pull request #5271 from gilles-peskine-arm/fix-builds-with-only-mbedtls_bignum_c-defined-2.16
Backport 2.16: Fix builds when config.h only defines MBEDTLS_BIGNUM_C
2021-12-07 12:38:03 +01:00
Gilles Peskine
942f8b6854 Add changelog entry for build error fixes
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-12-06 20:56:55 +01:00
Tom Cosgrove
7b420a896f Fix builds when config.h only defines MBEDTLS_BIGNUM_C
Fixes #4929

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2021-12-06 20:42:50 +01:00
Gilles Peskine
1d2c74cee0 Merge pull request #5135 from openluopworld/origin/mbedtls-2.16
Backport 2.16: Fix GCM calculation with very long IV
2021-11-22 22:22:42 +01:00
Gilles Peskine
c634df23ac Merge pull request #5215 from tom-cosgrove-arm/pr5105-2.16
Backport 2.16: doc improvement in aes include
2021-11-22 22:21:52 +01:00
Tom Cosgrove
a5f85c860b further improvements to sha256 docs
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2021-11-22 15:35:27 +00:00
Tom Cosgrove
f4307d55da doc improvement in aes include
Remove description of non-existing "mode" parameter from the docs of mbedtls_aes_crypt_ctr

Backport of #5105

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2021-11-22 15:01:25 +00:00
Gilles Peskine
62d5f8101e Merge pull request #5151 from tom-cosgrove-arm/serialise-builds-of-archives-on-windows-2.16
Backport 2.16: Serialise builds of the .a files on Windows
2021-11-10 16:01:25 +01:00
Tom Cosgrove
0a817205cf Serialise builds of the .a files on Windows
This is a workaround for an issue with mkstemp() in older MinGW releases that
causes simultaneous creation of .a files in the same directory to fail.

Fixes #5146

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2021-11-10 12:29:30 +00:00
openluopworld
ed798a9092 An initialization vector IV can have any number of bits between 1 and
2^64. So it should be filled to the lower 64-bit in the last step
when computing ghash.

Signed-off-by: openluopworld <wuhanluop@163.com>
2021-11-05 19:40:40 +08:00
Manuel Pégourié-Gonnard
d895668359 Merge pull request #5088 from gilles-peskine-arm/test_ssl_o2-2.16
Backport 2.16: Build with -O2 when running ssl-opt
2021-10-29 09:25:37 +02:00
paul-elliott-arm
27fc78690c Merge pull request #5098 from gilles-peskine-arm/ssl-opt-resend-retry-2.16
Backport 2.16: Retry a test case if it fails due to an unexpected resend
2021-10-27 16:24:05 +01:00
Manuel Pégourié-Gonnard
70227d217d Merge pull request #4819 from gilles-peskine-arm/base64-no-table-2.16
Backport 2.16: range-based constant-flow base64
2021-10-27 12:18:42 +02:00
Gilles Peskine
cd1d83c9b2 Merge pull request #5112 from paul-elliott-arm/ssl_opt_fixes_2.16
Backport 2.16: Ssl opt fixes
2021-10-26 20:50:56 +02:00
Paul Elliott
46e57d986b Remove bash specific code
Use case pattern matching instead of multiline split, given there is
only the well formatted PIDs to match on this should be safe.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2021-10-26 11:07:24 +01:00
Paul Elliott
355a1f4bc8 Remove use of -p with lsof
On machines with more modern kernels (>5.4 from testing so far) the
useage of -b seems to conflict with the usage of -p. Whilst the usage of
-b seems like a good idea to avoid blocks as we are tight looping on it,
the usage of -p seems to require the usage of stat() (specifically in
/proc) which -b forbids. All you get is a load of warnings
(suppressable by -w) but never a positive result, which means that all
servers are reported as "Failed to start". We are not keen on losing
-b, so instead parse the output of lsof (using -F to format it) to
check the if PIDs that it outputs match that we are looking for.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2021-10-26 11:07:13 +01:00
Gilles Peskine
8e82c78954 Fix typo in documentation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-25 21:14:06 +02:00
Gilles Peskine
cda1281ee2 Fix copypasta in comment
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-25 21:13:27 +02:00
Gilles Peskine
3712501465 Move is-it-resend logic into a function
Improve the code structure in case we want to add other similar conditions
later. Document better what we're doing, and document why we're doing it.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-21 11:25:40 +02:00
Gilles Peskine
838902547c Retry if a test case fails because of an unexpected resend
Palliative for https://github.com/ARMmbed/mbedtls/issues/3377. If a test
case fails due to an unexpected resend, allow retrying, like in the case of
a client timeout.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-21 11:25:40 +02:00
Gilles Peskine
e31a9ea601 Move retry logic into check_test_failure
This will allow having other retry conditions, in particular based on
run_test options.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-21 11:25:40 +02:00
Gilles Peskine
ad58e92eac Move the core loop of run_test into an auxiliary function
No behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-21 11:25:40 +02:00
Gilles Peskine
342147a8a8 Move some code of run_test into auxiliary functions
No behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-21 11:25:40 +02:00
Gilles Peskine
87b036f572 Add trivial record_outcome function to facilitate backports
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-21 11:25:40 +02:00
Gilles Peskine
30b8132ca9 Remove redundant "should we skip?" block
There's a second one just below.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-21 11:25:40 +02:00
Gilles Peskine
77624b2bd8 Always set a build type for cmake when building for testing
Set the build type to Release (-O2) when running CPU-intensive tests (ssl-opt,
or unit tests with debug features). A build type of Check (-Os) would be best
when the main objective of the build is to check for build errors or warnings
and there aren't many tests to run; in this commit there are no such test
cases to change. Only use cmake with no build type (which results in not
passing a -O option, and thus missing some GCC warnings) when exercising cmake
features.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-19 21:39:45 +02:00
Gilles Peskine
13236707a2 Fix cmake invocation syntax
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-18 20:28:00 +02:00
Gilles Peskine
858373a26e Switch cmake -O2 builds around to where we test a lot
Use Release mode (-O2) for component_test_full_cmake_clang which runs SSL
tests.

To have some coverage with Check mode (which enables more compiler warnings
but compiles with -Os), change a few other builds that only run unit tests
at most to Check mode.

Don't add any new builds, to keep the total build volume down. We don't need
extensive coverage of all combinations, just a reasonable set.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-18 20:27:05 +02:00
Gilles Peskine
3638a962bc Clarify a comment
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-18 20:24:41 +02:00
Gilles Peskine
2ae243139d Correct support function name
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-18 20:24:38 +02:00
Gilles Peskine
c1317759f2 Build with -O2 when running ssl-opt
SSL testing benefits from faster executables, so use -O2 rather than -O1.
Some builds use -O1, but that's intended for jobs that only run unit tests,
where the build takes longer than the tests.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-18 20:24:35 +02:00
Gilles Peskine
90b10c379f Merge pull request #4847 from mstarzyk-mobica/ecb-alt-ret-2.16
Backport 2.16: Catch failures of mbedtls_aes_crypt_ecb and its DES equivalents
2021-10-14 12:10:58 +02:00
Gilles Peskine
91341c35f9 Merge pull request #5074 from paul-elliott-arm/fix-resumption-openssl-client-tests-2.16
Backport 2.16: Use newer OpenSSL for tests failing with the old
2021-10-13 21:05:09 +02:00
Paul Elliott
0ab794103d Use 127.0.0.1 rather than localhost
This was causing some tests using the openssl s_client to not connect -
I suspect this was due to localhost (at least on my machine) resolving
to ::1 rather than 127.0.0.1. Note that the error seen would have been
that the session file specified with -sess_out did not get created.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2021-10-13 18:43:54 +01:00
Paul Elliott
316a6aaae4 Fix incorrect check for DTLS
Missing wildcards meant that some servers were not identified as DTLS,
which lead to port checking on TCP rather than UDP, and thus mistakenly
cancelling tests as the server had not come up.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2021-10-13 18:43:54 +01:00
Paul Elliott
6c64983e32 Spelling fix
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2021-10-13 18:43:54 +01:00
Manuel Pégourié-Gonnard
a4700756a4 Use newer OpenSSL for tests failing with the old
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-10-13 18:43:50 +01:00
Paul Elliott
19f1f786fc Backport OPENSSL_NEXT to ssl-opt.sh
Add support for a newer version of OpenSSL, as well as a legacy version.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2021-10-13 18:42:19 +01:00
Gilles Peskine
9e0402b040 Merge pull request #5036 from gilles-peskine-arm/readme-add-contacts-2.16
Backport 2.16: Add contact information directly on the home page
2021-10-06 19:35:37 +02:00
Gilles Peskine
1c9137d8d1 Merge pull request #5034 from gilles-peskine-arm/all.sh-makeflags-nproc-2.16
Backport 2.16: Limit make parallelism to the number of CPUs in all.sh
2021-10-06 19:35:19 +02:00
Gilles Peskine
0bf8f98743 Add contact information directly on the home page
This information was already present in SECURITY.md and SUPPORT.md, but that
wasn't very apparent.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-06 17:52:51 +02:00
Gilles Peskine
bbce37755a Limit make parallelism to the number of CPUs
Don't default to unbridled -j, which causes a load spike and isn't really
faster.

"Number of CPUs" is implemented here as a reasonable compromise between
portability, correctness and simplicity. This is just a default that can be
overridden by setting MAKEFLAGS in the environment.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-06 17:23:24 +02:00
Gilles Peskine
c72255fa37 Fix the build without MBEDTLS_PLATFORM_C
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-10-01 18:08:41 +02:00
Gilles Peskine
ccfc2bff6f Merge pull request #4958 from gilles-peskine-arm/make-tests-v-2.16
Backport 2.16: Facilitate reproducing unit tests from all.sh
2021-09-30 16:09:01 +02:00
Gilles Peskine
24180accf5 'make test': show failing test cases when cmake does
When building with make, `make test` runs `run-test-suites.pl` which has a
verbose mode that reports the failing test cases, but it didn't provide a
way to enable this verbose mode. With the present commit, you can run `make
test TEST_FLAGS=-v` to use verbose mode.

Base the default for verbose mode on the same environment variable that
`make test` uses when building with CMake: default off, but enabled if
`CTEST_OUTPUT_ON_FAILURE` is true. In particular, verbose mode will now be
on when building from `all.sh`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-09-21 09:41:58 +02:00
Gilles Peskine
c68b9e0839 Merge pull request #4948 from gilles-peskine-arm/muladdc-amd64-memory-2.16
Backport 2.16: Fix x86_64 assembly for bignum multiplication
2021-09-20 22:23:45 +02:00
Gilles Peskine
666e3df80b Update the list of issues fixed
This had actually been reported multiple times.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-09-15 17:04:31 +02:00
Gilles Peskine
7c847235e8 x86_64 MULADDC assembly: add missing constraints about memory
MULADDC_CORE reads from (%%rsi) and writes to (%%rdi). This fragment is
repeated up to 16 times, and %%rsi and %%rdi are s and d on entry
respectively. Hence the complete asm statement reads 16 64-bit words
from memory starting at s, and writes 16 64-bit words starting at d.

Without any declaration of modified memory, Clang 12 and Clang 13 generated
non-working code for mbedtls_mpi_mod_exp. The constraints make the unit
tests pass with Clang 12.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-09-15 15:52:30 +02:00
Gilles Peskine
c7bd734063 Merge pull request #4904 from kennethsoerensen/pkparse-warning_2_16
Backport 2.16: Remove compiler warning if only MBEDTLS_PK_PARSE_C is …
2021-09-01 16:53:54 +02:00