1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00
Commit Graph

588 Commits

Author SHA1 Message Date
Demi Marie Obenour
6b8e8ff079 Fix segfault in mbedtls_oid_get_numeric_string
When passed an empty OID, mbedtls_oid_get_numeric_string would read one
byte from the zero-sized buffer and return an error code that depends on
its value.  This is demonstrated by the test suite changes, which
check that an OID with length zero and an invalid buffer pointer does
not cause Mbed TLS to segfault.

Also check that second and subsequent subidentifiers are terminated, and
add a test case for that.  Furthermore, stop relying on integer division
by 40, use the same loop for both the first and subsequent
subidentifiers, and add additional tests.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-03-16 01:07:35 -04:00
Dave Rodgman
39987ebde7 Merge pull request #7172 from daverodgman/fix_UB_in_ssl_read-2.28
Backport 2.28: Fix undefined behavior in ssl_read if buf parameter is NULL
2023-03-13 10:46:24 +00:00
Dave Rodgman
7a5168e90d Merge pull request #7170 from AndrzejKurek/mpi-window-size-2.28
[Backport 2.28] Reduce the default MBEDTLS_ECP_WINDOW_SIZE value to 2
2023-02-27 17:12:29 +00:00
Dave Rodgman
fb07c37cb1 Improve changelog
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-24 16:02:26 +00:00
Ashley Duncan
13938b84e9 Added changelog entry.
Signed-off-by: Ashley Duncan <ashley.duncan@evnex.com>
2023-02-24 16:02:26 +00:00
Andrzej Kurek
6e9385b832 Reduce the default MBEDTLS_ECP_WINDOW_SIZE value to 2
As tested in https://github.com/Mbed-TLS/mbedtls/issues/6790,
after introducing side-channel counter-measures to bignum,
the performance of RSA decryption in correlation to the
MBEDTLS_ECP_WINDOW_SIZE has changed.
The default value of 2 has been chosen as it provides best
or close-to-best results for tests on Cortex-M4 and Intel i7.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-24 08:05:18 -05:00
Gilles Peskine
d784833a1b Silence a warning from Clang >=15 about an unused local variable
The assembly code uses t only on some architectures. Fixes #7166.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-24 12:08:57 +01:00
Gilles Peskine
44fe5ea532 Changelog entry for pacifying clang -Wdocumentation about \retval
Fixes #6960

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-24 11:41:55 +01:00
David Horstmann
b91ba4b7bf Add ChangeLog for OID-to-string fixes
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-20 14:44:18 +00:00
Paul Elliott
fc820d96e0 Fix IAR warnings
IAR was warning that conditional execution could bypass initialisation of
variables, although those same variables were not used uninitialised. Fix
this along with some other IAR warnings.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-02-13 15:07:44 +00:00
Gilles Peskine
a4c10abaf9 Merge pull request #7063 from AndrzejKurek/2.28_x508_san_parsing_testing
[2.28 Backport] X.509: Fix bug in SAN parsing and enhance negative testin
2023-02-10 15:05:30 +01:00
Gilles Peskine
b5e9cd37a0 Announce coding style change in the changelog
It doesn't affect users, but it affects some other external consumers of the
library.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-08 19:45:41 +01:00
Hanno Becker
3818fd9d58 Add a ChangeLog entry
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-08 09:19:09 -05: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
Dave Rodgman
b028531a3b Merge pull request #7013 from gilles-peskine-arm/build-without-certs-2.28.2
2.28 only: Fix the build without MBEDTLS_CERTS_C
2023-02-06 11:39:01 +00:00
Aditya Deshpande
e87ed421be Amend changelog entry
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-02-02 12:07:07 +00:00
Aditya Deshpande
a7d879185e Add changelog entry
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-02-02 12:07:06 +00:00
Gilles Peskine
4d483a1814 Fix misplaced #endif in test program
This broke the build when MBEDTLS_CERTS_C is undefined. Fixes #6243.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-01 18:19:23 +01:00
David Horstmann
5e29196561 Fix near-tautological repetition in ChangeLog
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-01 13:41:34 +00:00
Aaron M. Ucko
78b823ab0e mbedtls_mpi_sub_abs: Skip memcpy when redundant (#6701).
In some contexts, the output pointer may equal the first input
pointer, in which case copying is not only superfluous but results in
"Source and destination overlap in memcpy" errors from Valgrind (as I
observed in the context of ecp_double_jac) and a diagnostic message
from TrustInSoft Analyzer (as Pascal Cuoq reported in the context of
other ECP functions called by cert-app with a suitable certificate).

Signed-off-by: Aaron M. Ucko <ucko@ncbi.nlm.nih.gov>
2023-01-31 15:45:44 -05:00
Manuel Pégourié-Gonnard
4b7cb8c737 Merge pull request #6919 from valeriosetti/issue6843-backport
Backport: Improve X.509 cert writing serial number management
2023-01-30 13:09:09 +01:00
David Horstmann
41fbc3ad3a Add ChangeLog for c_build_helper improvements
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-27 19:56:49 +00:00
Gilles Peskine
f57f3db920 Merge pull request #6931 from AndrzejKurek/timeless-selftest-waz-bad
[2.28] Enable the timing.c selftest with MBEDTLS_TIMING_ALT
2023-01-26 21:55:44 +01:00
Andrzej Kurek
26d383998d Be consistent with self-test naming
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-01-26 04:38:37 -05:00
Dave Rodgman
6b8d42444d Add Changelog
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-01-20 11:43:01 +00:00
Andrzej Kurek
4136a9ec5a Shorten lines of changelog entry
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-01-17 06:09:37 -05:00
Andrzej Kurek
b36fa910e9 Add a changelog entry
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-01-17 05:28:25 -05:00
Valerio Setti
8cf549d047 changelog: document the enforced check on x509 serial setting
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-13 08:41:15 +01:00
Gilles Peskine
0aba751326 Merge pull request #6894 from tom-daubney-arm/modify_generate_errors_script_2-28
Backport 2.28: Make generate_errors.pl handle directory names containing spaces when opening files
2023-01-10 22:09:44 +01:00
Dave Rodgman
b3aefa3983 Add Changelog
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-01-10 10:08:53 +00:00
Thomas Daubney
b462005958 Add ChangeLog entry
Add ChangeLog entry documenting bugfix.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-01-10 09:37:43 +00:00
Dave Rodgman
e5c5b1d3ea Add Changelog entry
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-12-20 13:21:19 +00:00
Dave Rodgman
4547eae341 Merge pull request #984 from Mbed-TLS/mbedtls-2.28.2-merge-back
Mbedtls 2.28.2 merge back
2022-12-14 17:51:58 +00:00
Manuel Pégourié-Gonnard
08f7f0d1f6 Merge pull request #6744 from gilles-peskine-arm/windows-different-drives-build-error-2.28
Backport 2.28: Copy files instead of hard-linking on Windows
2022-12-12 11:59:06 +01:00
Aditya Deshpande
a26938aec6 Assemble ChangeLog
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2022-12-08 11:04:16 +00:00
Aditya Deshpande
dbefba7b5c Merge branch 'mbedtls-2.28-restricted' into mbedtls-2.28.2rc0-pr 2022-12-08 10:57:08 +00:00
Dominik Gschwind
b0423a260c Copy files instead of hard-linking on Windows
Fixes an issue on Windows where when source and build directory are on different drives hard-linking
to files or directory fails as it doesn't work across filesystem boundaries. Note that symlinking is also
not possible because it requires administrator privileges on Windows.

The solution copies the files using the built-in cmake `configure_file(src dest COPYONLY)` command.
As this command only operates on files, if a directory is specified the files will be globbed recursively
and through symlinks.

Signed-off-by: Dominik Gschwind <dominik.gschwind99@gmail.com>
2022-12-07 19:34:52 +01:00
Gilles Peskine
a3e8dd4054 Improve wording, punctuation, etc.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-12-06 10:52:32 +01:00
Dave Rodgman
f0090d85e5 Merge remote-tracking branch 'origin/mbedtls-2.28' into merge-2.28 2022-12-05 11:04:05 +00:00
Gilles Peskine
01bf631159 Fix NULL+0 undefined behavior in ECB encryption and decryption
psa_cipher_encrypt() and psa_cipher_decrypt() sometimes add a zero offset to
a null pointer when the cipher does not use an IV. This is undefined
behavior, although it works as naively expected on most platforms. This
can cause a crash with modern Clang+ASan (depending on compiler optimizations).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-23 17:23:44 +01:00
Manuel Pégourié-Gonnard
99ac73d963 Merge pull request #969 from yanesca/issue-946-backport
[2.28 Backport] Fix RSA side channel
2022-11-23 10:30:40 +01:00
Janos Follath
c772869713 Changelog: expand conference acronym for clarity
Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-11-22 10:51:25 +00:00
Gilles Peskine
b358e46c8e Merge pull request #6618 from gilles-peskine-arm/mpi_sint-min-ub-2.28
Backport 2.28: Fix undefined behavior in bignum: NULL+0 and -most-negative-sint
2022-11-21 19:52:03 +01:00
Janos Follath
82e8133edc Add paper title to Changelog
Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-11-21 16:22:35 +00:00
Ronald Cron
7345073aaf Add ChangeLog
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2022-11-17 15:21:07 +01:00
Gilles Peskine
de1629aff9 Fix undefined behavior with the most negative mbedtls_mpi_sint
When x is the most negative value of a two's complement type,
`(unsigned_type)(-x)` has undefined behavior, whereas `-(unsigned_type)x`
has well-defined behavior and does what was intended.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-17 11:03:46 +01:00
Gilles Peskine
103cf59e46 Fix NULL+0 in addition 0 + 0
Fix undefined behavior (typically harmless in practice) of
mbedtls_mpi_add_mpi(), mbedtls_mpi_add_abs() and mbedtls_mpi_add_int() when
both operands are 0 and the left operand is represented with 0 limbs.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-17 11:03:46 +01:00
Janos Follath
e530b5b4c4 Merge pull request #6579 from gilles-peskine-arm/negative-zero-from-add-2.28
Backport 2.28: Fix negative zero from bignum add/subtract
2022-11-16 14:06:04 +00:00
Aditya Deshpande
f22f73ef4e Fix issue in dh_genprime.c where the error code returned by mbedtls_mpi_write_file() is incorrectly reported on failure
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2022-11-10 15:33:11 +00:00
Gilles Peskine
195e1c8107 Changelog entry for the negative zero from add/sub
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-10 15:15:25 +01:00