Commit Graph

7521 Commits

Author SHA1 Message Date
Gilles Peskine
015356f8b7 Add abstract target names for index generation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-11-20 12:05:08 +01:00
Gilles Peskine
1562d9c297
Merge pull request #3894 from maroneze/mbedtls-2.7
Backport 2.7: Fix use of uinitialized memory in ssl_parse_encrypted_pms
2020-11-18 18:40:56 +01:00
André Maroneze
9fc67f0e14 Backport 2.7: Fix use of uinitialized memory in ssl_parse_encrypted_pms
Signed-off-by: André Maroneze <maroneze@users.noreply.github.com>
2020-11-18 14:27:02 +01:00
Gilles Peskine
a337176b42
Merge pull request #3888 from gilles-peskine-arm/error-include-string-2.7
Backport 2.7: Fix several configuration-related issues
2020-11-17 20:32:57 +01:00
Gilles Peskine
d754c8bad6 Add a build with MBEDTLS_ERROR_STRERROR_DUMMY
Add a build with MBEDTLS_ERROR_STRERROR_DUMMY but not MBEDTLS_ERROR_C.
Previously, both options were enabled by default, but
MBEDTLS_ERROR_STRERROR_DUMMY only matters when MBEDTLS_ERROR_C is
enabled, so its effect was not tested.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-11-16 16:13:13 +01:00
Gilles Peskine
1eb2a9582d Add missing config from test-ref-configs.pl
The sample configuration file config-no-entropy.h was not being tested.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-11-16 16:13:13 +01:00
Gilles Peskine
8305b5e936 Sort entries to make it easier to eyeball the list
No semantic change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-11-16 16:12:47 +01:00
Gilles Peskine
4159c7154c Simplify conditional guards in error.c
Simplify the guards on MBEDTLS_ERROR_C and MBEDTLS_ERROR_STRERROR_DUMMY.

No longer include superfluous headers and definition: string.h and
platform.h are only needed for MBEDTLS_ERROR_C; time_t is not needed
at all.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-11-16 16:09:41 +01:00
Gilles Peskine
3335e9f718 Ignore cscope index
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-11-09 21:28:56 +01:00
Gilles Peskine
53f74d0f86 Add a target for the cscope index
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-11-09 21:28:51 +01:00
Gilles Peskine
2d847a5e07
Merge pull request #3862 from bensze01/ecb_iv_fix-2.7
Backport 2.7: Do not set IV size for ECB mode ciphers
2020-11-06 18:00:40 +01:00
Bence Szépkúti
b4756c2e20 Do not set IV size for ECB mode ciphers
ECB mode ciphers do not use IVs

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2020-11-06 15:40:25 +01:00
Gilles Peskine
a9fd4fc550
Merge pull request #3813 from ronald-cron-arm/aes-zeroize-less-2.7
Backport 2.7: Remove a useless zeroization
2020-11-04 23:43:30 +01:00
Ronald Cron
c9e20a05a5
Merge pull request #3829 from gilles-peskine-arm/ssl-opt-gnutls-printf-2.7
Backport 2.7: Fix printf escape errors in shell scripts
2020-11-04 17:51:49 +01:00
Gilles Peskine
352a7cf3ca Fix printf escape errors in shell scripts
Fix `printf "$foo"` which treats the value of `foo` as a printf format
rather than a string.

I used the following command to find potentially problematic lines:
```
git ls-files '*.sh' | xargs egrep 'printf +("?[^"]*|[^ ]*)\$'
```
The remaining ones are false positives for this regexp.

The errors only had minor consequences: the output of `ssl-opt.sh`
contained lines like
```
Renegotiation: gnutls server strict, client-initiated .................. ./tests/ssl-opt.sh: 741: printf: %S: invalid directive
PASS
```
and in case of failure the GnuTLS command containing a substring like
`--priority=NORMAL:%SAFE_RENEGOTIATION` was not included in the log
file. With the current tests, there was no risk of a test failure
going undetected.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-27 23:48:40 +01:00
Gilles Peskine
e7a9c3aeca ssl-opt.sh --help: don't show regexps for -f and -e
Showing a regexp to say that by default all tests are executed is not
particularly helpful.

If we ever add a default exclusion list or a default filter, we can
edit the documentation again.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-27 23:44:43 +01:00
Gilles Peskine
acbf9eccb5 Put local variables in a struct
This way we can have a single call to mbedtls_zeroize, which
saves a few bytes of code size.

Additionally, on my PC, I notice a significant speed improvement
(x86_64 build with MBEDTLS_AESNI_C disabled, gcc 5.4.0 -O3). I don't
have an explanation for that (I expected no measurable difference).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2020-10-22 10:34:20 +02:00
Gilles Peskine
5706e920a4 Remove a useless zeroization
Remove the zeroization of a pointer variable in the AES block
functions. The code was valid but spurious and misleading since it
looked like a mistaken attempt to zeroize the pointed-to buffer.
Reported by Antonio de la Piedra, CEA Leti, France.

Note that we do not zeroize the buffer here because these are the
round keys, and they need to stay until all the blocks are processed.
They will be zeroized in mbedtls_aes_free().

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-22 09:43:53 +02:00
Ronald Cron
dac5edc01f
Merge pull request #3747 from gilles-peskine-arm/verbosify-cmake-tests-2.7
Backport 2.7: all.sh: Enable verbose failure messages for CMake
2020-10-21 10:41:07 +02:00
Ronald Cron
c10e6022ee
Merge pull request #3597 from gilles-peskine-arm/cert-gen-cleanup-202008-2.7
Backport 2.7: Minor cleanups in certificate generation
2020-10-15 13:33:49 +02:00
Gilles Peskine
85e05d87b5 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-10-07 11:22:35 +02:00
Gilles Peskine
b8d0c2a7b6 Fix "make -C tests/data_files"
It wasn't working when invoking programs/x509/cert_write or
programs/x509/cert_req due to relying on the current directory rather
than the location of the makefile.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-07 11:16:56 +02:00
Gilles Peskine
7399b8abd6 Commit the intermediate files cert_md*.csr
They are used to generate cert_md*.crt.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-07 11:16:56 +02:00
Gilles Peskine
8a1face5a5 Remove duplicate rule to generate cert_md5.crt
There were two rules that generated similar files, but with different
dates. Keep the one that's similar to md2 and md4.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-07 11:16:56 +02:00
Gilles Peskine
b72d131ff0 cert_req: discover hash algorithms automatically
Discover hash algorithms automatically rather than hard-coding a list,
as was previously done in cert_write.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-07 11:16:56 +02:00
Jaeden Amero
de97d1f2f8 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:54 +02:00
Janos Follath
7e7c815aa0
Merge pull request #3733 from gilles-peskine-arm/changelog-user-visible-only-2.7
Backport 2.7: Only use ChangeLog to inform users, not for acknowledgement
2020-10-01 11:36:59 +01:00
Gilles Peskine
8c79c3f985 When to write a changelog: minor improvements
Mention sample programs.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-01 00:35:25 +02:00
Gilles Peskine
1ffd967411 Explain when to write a changelog entry
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-01 00:35:25 +02:00
Gilles Peskine
57205b2297 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:35:05 +02:00
Gilles Peskine
a89b650314 Remove changelog entries without a user-visible impact
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-10-01 00:35:05 +02:00
Janos Follath
b016d8d524
Merge pull request #3729 from pkolbus/issue-3647-2.7
Backport 2.7: Restore retry in rsa_prepare_blinding()
2020-09-30 16:22:56 +01:00
Peter Kolbus
e634564381 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:39:15 -05:00
Gilles Peskine
9dd91ecf53 Add changelog entry for the memory management fixes
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-09-30 00:46:57 +02:00
Gilles Peskine
b51c8a29b5 Fix uncaught error if fix_negative fails
fix_negative allocates memory for its result. The calling site didn't
check the return value, so an out-of-memory error could lead to an
incorrect calculation. Fix this.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-09-30 00:22:37 +02:00
Gilles Peskine
91070e43a6 Fix memory leak in mbedtls_mpi_sub_abs
Fix a memory leak in mbedtls_mpi_sub_abs when the output parameter is
aliased to the second operand (X = A - X) and the result is negative.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-09-30 00:22:37 +02:00
Gilles Peskine
e7876341af Always test in-place addition and subtraction
Run all the addition and subtraction tests with the result aliased to
the first operand and with the result aliased to the second operand.
Before, only some of the aliasing possibilities were tested, for only
some of the functions, with only some inputs.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2020-09-30 00:22:37 +02:00
Gilles Peskine
2983b27a08
Merge pull request #3707 from ronald-cron-arm/feature/fix_return_code_1-2.7
Backport 2.7: Fix return code expression in pkparse
2020-09-22 18:52:09 +02:00
Jens Reimann
45a595845d fix return code
Signed-off-by: Jens Reimann <jreimann@redhat.com>
2020-09-22 16:19:25 +02:00
Gilles Peskine
4685d501e8
Merge pull request #756 from gabor-mezei-arm/692_bp27_missing_zeroizations_of_sensitive_data
[Backport 2.7] Missing zeroizations of sensitive data
2020-09-18 16:20:17 +02:00
Gilles Peskine
dc5fd035e6
Merge pull request #3661 from bensze01/typo-2.7
Backport 2.7: Fix typo in mbedtls_ssl_set_bio description.
2020-09-11 21:17:48 +02:00
gabor-mezei-arm
bfdbd4305a
Put local variables and buffers in a struct
This reduces the impact of the code size increase due to the addition
of calls to mbedtls_platform_zeroize.

Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2020-09-09 15:05:00 +02:00
gabor-mezei-arm
cb3a742d1d
Zeroize internal buffers and variables in MD hashes
Zeroising of local buffers and variables which are used for calculations in
mbedtls_internal_md*_process() and mbedtls_internal_ripemd160_process()
functions to erase sensitive data from memory.
Checked all function for possible missing zeroisation in MD.

Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2020-09-09 14:58:28 +02:00
gabor-mezei-arm
77d9401705
Force cleanup before return
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2020-09-09 14:51:03 +02:00
gabor-mezei-arm
461c5a89df
Zeroize internal buffers and variables in PKCS and SHA
Zeroising of local buffers and variables which are used for calculations in
mbedtls_pkcs5_pbkdf2_hmac() and mbedtls_internal_sha*_process() functions
to erase sensitive data from memory.
Checked all function for possible missing zeroisation in PKCS and SHA.

Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2020-09-09 14:49:31 +02:00
Christopher
bfb2d13642 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:15:22 +02:00
Christopher Moynihan
7ad671b96e 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:15:22 +02:00
Manuel Pégourié-Gonnard
5796dfe197
Merge pull request #3652 from d-otte/mbedtls-2.7
Backport 2.7: adjusting size of sliding window array to correct size
2020-09-09 10:00:01 +02:00
Daniel Otte
72a410dcfc adding entry file to ChangeLog.d for backport of PR3592
Signed-off-by: Daniel Otte <d.otte@wut.de>
2020-09-08 12:25:01 +02:00
Daniel Otte
d9854684b9 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:24:48 +02:00