Commit Graph

9373 Commits

Author SHA1 Message Date
Rodrigo Dias Correa
d31012ecea Add changelog entry file to ChangeLog.d
Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
2020-11-28 14:27:31 -03:00
Rodrigo Dias Correa
56ad24cad7 Fix GCC warning in ssl_calc_finished_tls_sha384
GCC 11 generated a warning because `padbuf` was too small to be
used as an argument for `mbedtls_sha512_finish_ret`. The `output`
parameter of `mbedtls_sha512_finish_ret` has the type
`unsigned char[64]`, but `padbuf` was only 48 bytes long.

Even though `ssl_calc_finished_tls_sha384` uses only 48 bytes for
the hash output, the size of `padbuf` was increased to 64 bytes.

Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
2020-11-28 14:27:03 -03:00
Rodrigo Dias Correa
d552630f33 Fix GCC warning about test_snprintf
GCC 11 generated the warnings because the parameter `ret_buf`
was declared as `const char[10]`, but some of the arguments
provided in `run_test_snprintf` are shorter literals, like "".

Now the type of `ret_buf` is `const char *`.
Both implementations of `test_snprintf` were fixed.

Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
2020-11-28 14:04:49 -03:00
Rodrigo Dias Correa
1a0c7fb383 Fix mismatched function parameters (prototype/definition)
In GCC 11, parameters declared as arrays in function prototypes
cannot be declared as pointers in the function definition. The
same is true for the other way around.

The definition of `mbedtls_aes_cmac_prf_128` was changed to match
its public prototype in `cmac.h`. The type `output` was
`unsigned char *`, now is `unsigned char [16]`.

In `ssl_tls.c`, all the `ssl_calc_verify_*` variants now use pointers
for the output `hash` parameter. The array parameters were removed
because those functions must be compatible with the function pointer
`calc_verify` (defined in `ssl_internal.h`).

Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
2020-11-28 12:14:57 -03:00
Rodrigo Dias Correa
0391ea39c1 Fix build failure on gcc-11
Function prototypes changed to use array parameters instead of
pointers.

Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
2020-11-28 09:26:52 -03:00
Ronald Cron
fbd0110dbd
Merge pull request #3746 from gilles-peskine-arm/verbosify-cmake-tests-2.16
Backport 2.16: all.sh: Enable verbose failure messages for CMake
2020-10-22 08:48:17 +02:00
Ronald Cron
b74e0d0bc5
Merge pull request #3596 from gilles-peskine-arm/cert-gen-cleanup-202008-2.16
Backport 2.16: Minor cleanups in certificate generation
2020-10-15 13:33:12 +02:00
Gilles Peskine
e944cac87a
Merge pull request #3529 from ronald-cron-arm/common-mbedtls_param_failed-2.16
[Backport 2.16] Backport clean-up in tests done in #3474
2020-10-06 22:15:47 +02:00
Jaeden Amero
bd1b89a354 all.sh: Enable verbose failure messages for CMake
Set the CMake-observed variable `CTEST_OUTPUT_ON_FAILURE`, so that when
a "make test" run by CMake fails, verbose test output about the detail
of failure is available.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-06 12:39:34 +02:00
Gilles Peskine
2f26bf7e88
Merge pull request #3735 from gilles-peskine-arm/entropy_poll-_gnu_source-2.16
Backport 2.16: Don't redefine _GNU_SOURCE if it's already defined
2020-10-05 17:25:29 +02:00
Gilles Peskine
90b545881c Fix the build when _GNU_SOURCE is defined to a non-empty value
Fix #3432.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-01 17:17:37 +02:00
Janos Follath
188e192eeb
Merge pull request #3732 from gilles-peskine-arm/changelog-user-visible-only-2.16
Backport 2.16: Only use ChangeLog to inform users, not for acknowledgement
2020-10-01 11:37:09 +01:00
Gilles Peskine
e1a7cad3c6 When to write a changelog: minor improvements
Mention sample programs.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-01 00:34:22 +02:00
Gilles Peskine
27db5e4405 Explain when to write a changelog entry
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-01 00:34:22 +02:00
Gilles Peskine
36c2ea5376 We no longer credit contributors in the changelog
From now on, external contributions are no longer acknowledged in the
changelog file. They of course remain acknowledged in the Git history.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-01 00:32:29 +02:00
Gilles Peskine
4785ec1dbc Remove changelog entries without a user-visible impact
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-01 00:31:55 +02:00
Janos Follath
319eee5fdd
Merge pull request #3728 from pkolbus/issue-3647-2.16
Backport 2.16: Restore retry in rsa_prepare_blinding()
2020-09-30 16:23:04 +01:00
Peter Kolbus
b2aeb75509 Restore retry in rsa_prepare_blinding()
Starting with commit 49e94e3, the do/while loop in
`rsa_prepare_blinding()` was changed to a `do...while(0)`, which
prevents retry from being effective and leaves dead code.

Restore the while condition to retry, and lift the calls to finish the
computation out of the while loop by by observing that they are
performed only when `mbedtls_mpi_inv_mod()` returns zero.

Signed-off-by: Peter Kolbus <peter.kolbus@garmin.com>
2020-09-30 07:22:42 -05:00
Gilles Peskine
e39d14b142 Fix "make -C tests/data_files -f ..."
The toplevel directory is actually just ../..: the makefile commands
are executed in the subdirectory. $(PWD) earlier was wrong because it
comes from the shell, not from make. Looking up $(MAKEFILE_LIST) is
wrong because it indicates where the makefile is (make -f), not which
directory to work in (make -C).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-09-24 16:45:45 +02:00
Gilles Peskine
506498eaa3
Merge pull request #3708 from ronald-cron-arm/feature/fix_return_code_1-2.16
Backport 2.16: Fix return code expression in pkparse
2020-09-22 18:52:03 +02:00
Jens Reimann
84d4f022e2 fix return code
Signed-off-by: Jens Reimann <jreimann@redhat.com>
2020-09-22 16:22:27 +02:00
Gilles Peskine
e72c8d28f1
Merge pull request #3687 from Jongy/fix-docs-mbedtls-2.16
Backport 2.16: Fix docs to desribe written-into buffer parameter as writable
2020-09-17 00:02:36 +02:00
Yonatan Goldschmidt
f9604bbdc1 Fix docs to desribe written-into buffer parameter as writable
Signed-off-by: Yonatan Goldschmidt <yon.goldschmidt@gmail.com>
2020-09-16 21:56:11 +03:00
Gilles Peskine
30b242de50
Merge pull request #3660 from bensze01/typo-2.16
Backport 2.16: Fix typo in mbedtls_ssl_set_bio description.
2020-09-11 21:17:44 +02:00
Christopher
2681e99a41 Update ChangeLog.d/comment_typo_in_mbedtls_ssl_set_bio.txt
Co-authored-by: Hanno Becker <hanno.becker@arm.com>
Signed-off-by: Christopher Moynihan <christophm@gmail.com>
2020-09-09 14:05:02 +02:00
Christopher Moynihan
0c633dab7f Fix typo in mbedtls_ssl_set_bio description.
Description referred to mbedtls_ssl_sent_t callback,
but the callback is named mbedtls_ssl_send_t.

Signed-off-by: Christopher Moynihan <christophm@gmail.com>
2020-09-09 14:05:01 +02:00
Manuel Pégourié-Gonnard
99693aab21
Merge pull request #3651 from d-otte/mbedtls-2.16
Backport 2.16: adjusting size of sliding window array to correct size
2020-09-09 10:00:11 +02:00
Daniel Otte
1bfb45cb93 adding entry file to ChangeLog.d for backport of PR3592
Signed-off-by: Daniel Otte <d.otte@wut.de>
2020-09-08 12:09:34 +02:00
Daniel Otte
e4dbb99f9f adjusting comment on sliding window memory usage.
The comment now uses '**' as exponentiation operator.

Signed-off-by: Daniel Otte <d.otte@wut.de>
2020-09-08 12:08:15 +02:00
Daniel Otte
639c5e5713 fixing spelling mistakes (window <-- windows)
Signed-off-by: Daniel Otte <d.otte@wut.de>
2020-09-08 12:08:00 +02:00
Daniel Otte
359d049f1b adjusting size of sliding window array to correct size.
Probably the `W[2 << MBEDTLS_MPI_WINDOW_SIZE]` notation is based on a transcription of 2**MBEDTLS_MPI_WINDOW_SIZE.

Signed-off-by: Daniel Otte <d.otte@wut.de>
2020-09-08 12:07:19 +02:00
Gilles Peskine
ad5c5a2763
Merge pull request #3626 from gilles-peskine-arm/test-fail-report-first-2.16
Backport 2.16: Report the first unit test failure, not the last one
2020-09-05 11:16:02 +02:00
Gilles Peskine
319ecf3192 Initialize ret from test code
The test function mbedtls_mpi_lt_mpi_ct did not initialize ret in test
code. If there was a bug in library code whereby the library function
mbedtls_mpi_lt_mpi_ct() did not set ret when it should, we might have
missed it if ret happened to contain the expected value. So initialize
ret to a value that we never expect.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-09-02 15:33:11 +02:00
Gilles Peskine
dfb5cff2f5 Report the first failure, not the last one
If test_fail is called multiple times in the same test case, report
the location of the first failure, not the last one.

With this change, you no longer need to take care in tests that use
auxiliary functions not to fail in the main function if the auxiliary
function has failed.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-08-31 10:11:47 +02:00
Janos Follath
848a4e06b3
Merge pull request #749 from ARMmbed/mbedtls-2.16.8r0-pr
Prepare Release Candidate for Mbed TLS 2.16.8
2020-08-27 11:32:13 +01:00
Janos Follath
627aeef6ae Update ChangeLog header
Signed-off-by: Janos Follath <janos.follath@arm.com>
2020-08-26 15:34:41 +01:00
Janos Follath
1bfb580f8c Bump version to Mbed TLS 2.16.8
Executed "./scripts/bump_version.sh --version 2.16.8"

Signed-off-by: Janos Follath <janos.follath@arm.com>
2020-08-26 15:26:49 +01:00
Janos Follath
4ac5a7be5a Assemble ChangeLog
Executed scripts/assemble_changelog.py.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2020-08-26 14:49:52 +01:00
Janos Follath
36169d479f Merge branch 'mbedtls-2.16-restricted' 2020-08-26 14:16:04 +01:00
Gilles Peskine
de4bcf22c1
Merge pull request #3562 from raoulstrackx/raoul/verify_crl_without_time_bp2.16
Backport 2.16: Always revoke certificate on CRL
2020-08-26 12:56:15 +02:00
Manuel Pégourié-Gonnard
fa3b3e0d88
Merge pull request #745 from mpg/changelog-for-local-lucky13-2.16-restricted
[Backport 2.16] Add a ChangeLog entry for local Lucky13 variant
2020-08-26 11:52:25 +02:00
Raoul Strackx
75475d8465 Always revoke certificate on CRL
RFC5280 does not state that the `revocationDate` should be checked.

In addition, when no time source is available (i.e., when MBEDTLS_HAVE_TIME_DATE is not defined), `mbedtls_x509_time_is_past` always returns 0. This results in the CRL not being checked at all.

https://tools.ietf.org/html/rfc5280
Signed-off-by: Raoul Strackx <raoul.strackx@fortanix.com>
2020-08-26 11:42:52 +02:00
Manuel Pégourié-Gonnard
f0a3cddefe Clarify that the Lucky 13 fix is quite general
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-26 10:58:02 +02:00
Manuel Pégourié-Gonnard
c9ebbd5843 Add a ChangeLog entry for local Lucky13 variant
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-26 10:58:02 +02:00
Janos Follath
5b2e60dc36
Merge pull request #741 from mpg/cf-varpos-copy-2.16-restricted
[backport 2.16] Constant-flow copy of HMAC from variable position
2020-08-25 14:35:45 +01:00
Manuel Pégourié-Gonnard
ab9ec32879 Fix a typo in a comment
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-25 11:43:10 +02:00
Manuel Pégourié-Gonnard
46f49a8bbc Improve comments on constant-flow testing in config.h
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-25 11:42:21 +02:00
Manuel Pégourié-Gonnard
f08284769d Add an option to test constant-flow with valgrind
Currently the new component in all.sh fails because
mbedtls_ssl_cf_memcpy_offset() is not actually constant flow - this is on
purpose to be able to verify that the new test works.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-25 11:26:37 +02:00
Manuel Pégourié-Gonnard
590b2d9614 Add mbedtls_ssl_cf_memcpy_offset() with tests
The tests are supposed to be failing now (in all.sh component
test_memsan_constant_flow), but they don't as apparently MemSan doesn't
complain when the src argument of memcpy() is uninitialized, see
https://github.com/google/sanitizers/issues/1296

The next commit will add an option to test constant flow with valgrind, which
will hopefully correctly flag the current non-constant-flow implementation.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-25 11:18:11 +02:00
Manuel Pégourié-Gonnard
ce45d1a759 Use temporary buffer to hold the peer's HMAC
This paves the way for a constant-flow implementation of HMAC checking, by
making sure that the comparison happens at a constant address. The missing
step is obviously to copy the HMAC from the secret offset to this temporary
buffer with constant flow, which will be done in the next few commits.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2020-08-25 11:07:25 +02:00