1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-06-02 02:01:43 +03:00

17112 Commits

Author SHA1 Message Date
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
Gilles Peskine
cab02f6bc8 Document mbedtls_mpi_uint and mbedtls_mpi_sint
Since they're part of the public API (even if only through a few functions),
they should be documented.

I deliberately skipped documenting how to configure the size of the type.
Right now, MBEDTLS_HAVE_INT32 and MBEDTLS_HAVE_INT64 have no Doxygen
documentation, so it's ambiguous whether they're part of the public API.
Resolving this ambiguity is out of scope of my current work.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-17 11:03:46 +01:00
Gilles Peskine
0fcc1cb4c2
Merge pull request #6583 from aditya-deshpande-arm/bugfix-dh_genprime
[Backport 2.28] dh_genprime: Fix issue where the error code returned by mbedtls_mpi_write_file() is incorrectly reported on failure
2022-11-15 12:38:38 +01:00
Manuel Pégourié-Gonnard
8d8266468b
Merge pull request #6509 from valeriosetti/issue4577-backport
Backport 2.28: Adding unit test for mbedtls_x509write_csr_set_extension
2022-11-15 09:39:11 +01:00
Valerio Setti
d3f7df4b8a Adding unit test for mbedtls_x509write_csr_set_extension()
The already existing "x509_csr_check()" function is extended in order
to support/test also CSR's extensions. The test is performed by
adding an extended key usage.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-11-14 13:32:48 +01:00
Janos Follath
5c03ec3429
Merge pull request #6575 from tom-cosgrove-arm/convert-mpi_mod_int-test-cases-to-hex-228
Backport 2.28: Enable mpi_mod_int test case to take full-range MPI integers
2022-11-14 12:03:00 +00:00
Tom Cosgrove
020ab7f0af Add additional (would fail) test cases for mpi_mod_int with 0 remainder
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-11-10 16:21:06 +00:00
Tom Cosgrove
5c307b9bbe Use mbedtls_mpi_sint not mbedtls_mpi_uint in mpi_mod_int test
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-11-10 16:21:06 +00:00
Tom Cosgrove
c2c6fcbcc5 Enable mpi_mod_int test case to take full-range MPI integers
Also add commented-out test cases that currently fail

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-11-10 16:21:06 +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
Paul Elliott
4637ed2205
Merge pull request #6545 from davidhorstmann-arm/2.28-fix-unusual-macros-0-followup
Refactor/tidy after fixing unusual macros
2022-11-10 14:27:14 +00:00
Gilles Peskine
676df8ec88
Merge pull request #6578 from gilles-peskine-arm/bignum-test-suite-names-2.28
Backport 2.28: Rename test_suite_bignum for consistency
2022-11-10 14:40:16 +01:00
Gilles Peskine
6b5fca12f4
Merge pull request #6580 from yanrayw/mbedtls-2.28
Backport 2.28: Add build version to the output of ssl_client2 and ssl_server2
2022-11-10 14:39:35 +01:00
Gilles Peskine
d7d5e9a328
Merge pull request #6536 from davidhorstmann-arm/2.28-change-test-templating-syntax
[Backport 2.28] Change test templating syntax to be valid C
2022-11-10 12:05:58 +01:00
Yanray Wang
d818c0856c Fix: include version.h in ssl_test_lib.h
In development, mbedtls/version.h is getting included indirectly
in via mbedtls/build_info.h, but this doesn't happen in 2.28.
This commit add this dependency in ssl_test_lib.h

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2022-11-10 16:31:02 +08:00
Yanray Wang
4d4b077751 Add output of build version in ssl_server2 and ssl_client2
Backport the changes in PR 6436 to mbedtls-2.28.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2022-11-10 14:37:49 +08:00
Gilles Peskine
d5c76cfd9f Avoid having both test_suite_XXX.data and test_suite_XXX.*.data
Although our build scripts support that, it's annoying, because it makes
"test_suite_XXX" ambiguous between "all the data for
test_suite_XXX.function" and "just test_suite_XXX.data".

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-09 21:00:28 +01:00
Gilles Peskine
618f989954 Don't use test_suite_mpi as an example
It just got renamed, and it's also not the most canonical example since it's
a somewhat deprecated interface in the development branch. Make a different
module the example.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-09 21:00:28 +01:00
Gilles Peskine
5b68608b40 Rename test_suite_bignum for consistency with bignum.{h,c}
Align the name of the bignum test suite with the source module (which was
renamed from mpi.c to bignum.c in the PolarSSL 1.x days). This also brings
it into line with the test suites for the low-level bignum interfaces.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-09 21:00:28 +01:00
Gilles Peskine
2478b3499f
Merge pull request #6572 from mpg/improve-test-suites-listing-2.28
[backport 2.28] Improve test suite detection in run-test-suites.pl
2022-11-09 19:03:24 +01:00
David Horstmann
8eff06f1d6 Minor improvements to test code script
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-09 17:31:08 +00:00
David Horstmann
da2fe26db7 Fix incorrect condition in is_compression_bad()
The transport is allowed to be MBEDTLS_SSL_TRANSPORT_DATAGRAM when the
compression is MBEDTLS_SSL_COMPRESS_NULL.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-09 15:08:36 +00:00
aditya-deshpande-arm
1d00c3dea6 Add comments after #endif
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-09 15:08:36 +00:00
Manuel Pégourié-Gonnard
78dea63de9 Improve test suite detection in run-test-suites.pl
Looking for executables causes problems with leftover compiled test
suites from other branches when we forget to run make clean before
switching branches. Using the .data files is more robust as most of them
are tracked, so will be removed when switching branches.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-11-09 12:06:43 +01:00
Gilles Peskine
b6e93b6441
Merge pull request #6560 from gilles-peskine-arm/bignum-aliasing-6552-2.28
Backport 2.28: Add comments for some forbidden aliasing in bignum.h interfaces
2022-11-08 17:15:33 +01:00
Gilles Peskine
760d1ffef9
Merge pull request #6554 from daverodgman/development-2.28
Backport 2.28: Fix outdated reference in debug message
2022-11-08 17:12:27 +01:00
Gilles Peskine
cb492102bf
Merge pull request #6380 from Kabbah/backport2.28-x509-info-hwmodulename-hex
[Backport 2.28] `x509_info_subject_alt_name`: Render HardwareModuleName as hex
2022-11-08 17:11:09 +01:00
Glenn Strauss
1dccfdb904 Add comments for some forbidden aliasing in bignum
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2022-11-08 13:55:53 +01:00
Jan Bruckner
a084c93be9 Fix outdated reference in debug message
Signed-off-by: Jan Bruckner <jan@janbruckner.de>
2022-11-08 10:55:44 +00:00
David Horstmann
b410566ba7 Reverse logic for compression in ssl_cli.c
Change is_compression_ok() to is_compression_bad() for more semantics
that are a better match for what's really going on in the case of no
compression support.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-07 16:33:57 +00:00
David Horstmann
08a37516ff Minor style fixes to ssl_cli.c
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-07 15:55:00 +00:00
David Horstmann
bcc18f2bec Simplify PSA fallback logic in ssl_ticket.c
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-07 14:48:38 +00:00
David Horstmann
9fc2f959b3 Change 0-checks to NULL-checks in ecp.c
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-07 14:48:38 +00:00
David Horstmann
0955f82642 Tidy up compression logic with auxiliary function
This refactors some logic in ssl_cli.c, removing some previously added
technical debt.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-07 14:48:29 +00:00
David Horstmann
0448de58d7 Simplify logic in ssl_cli.c
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-07 14:08:12 +00:00
David Horstmann
dbb6f08c3f Eliminate bad_params variable
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-07 14:08:12 +00:00
David Horstmann
79bb19f702 Remove redundant checks for renegotiation
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-07 14:08:12 +00:00
David Horstmann
14bae83ca0 Change test templating syntax to be valid C
For the benefit of auto-formatting tools, move from the '$placeholder'
templating syntax to a new syntax of the form:

__MBEDTLS_TEST_TEMPLATE__PLACEHOLDER

This change allows the test code template to be almost entirely valid C.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-11-07 09:55:35 +00:00
Gilles Peskine
c4698502d6
Merge pull request #6491 from davidhorstmann-arm/2.28-fix-unusual-macros-0
[Backport-ish 2.28] Fix unusual macros
2022-11-03 10:29:06 +01:00
Dave Rodgman
e9e0eeccec
Merge pull request #6525 from daverodgman/fix-duplicate-header-2.28
Remove duplicate function prototype - 2.28 backport
2022-11-02 13:06:04 +00:00
Dave Rodgman
e43caca4ab
Merge pull request #6527 from daverodgman/update_pr_template-2.28
Update pr template - 2.28 backport
2022-11-02 13:05:03 +00:00
Dave Rodgman
a4f10bec28
Merge pull request #6526 from daverodgman/psalinks-2.28
Update PSA links in README.md - 2.28 backport
2022-11-02 10:02:03 +00:00
Dave Rodgman
490f804555 Improve documentation for psa_crypto_cipher.h
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-02 09:29:35 +00:00
Dave Rodgman
8e322b1e99 Move declaration of mbedtls_cipher_info_from_psa into psa_crypto_cipher.h
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-02 09:27:01 +00:00
Dave Rodgman
d39cf1e07c Align CONTRIBUTING.md with development
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:58:30 +00:00
Dave Rodgman
bc1e670fb7 Improve list formatting
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:56:49 +00:00
Dave Rodgman
9a1c38a3c1 Reinstate note about all PRs receiving review
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:56:45 +00:00
Dave Rodgman
53b65f65ff Update CONTRIBUTING.md, and refer to this from the template
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:55:32 +00:00
Dave Rodgman
f1d74acb18 Update PR template
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:55:20 +00:00
Dave Rodgman
35e2b2b2bd
Merge pull request #6523 from daverodgman/fix_ssl_zeroize-2.28
Fix zeroization at NULL pointer - 2.28 backport
2022-11-01 20:50:33 +00:00