1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-05 19:35:48 +03:00
Commit Graph

17571 Commits

Author SHA1 Message Date
David Horstmann
4b30783be4 Add _build/ and api/ to gitignore
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-28 15:01:34 +01:00
David Horstmann
9a2ddfd147 Clean the breathe-apidoc files with make clean
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-28 15:01:34 +01:00
David Horstmann
66ef2a06d5 Revert "Add exemption for make.bat in checks for tabs"
This is no longer needed as make.bat has been removed. We do not support
building the documentation on Windows.

This reverts commit d50daedcca.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-27 15:39:13 +01:00
David Horstmann
042d845e08 Remove make.bat for documentation
Building the docs on Windows is not supported in any case, as the apidoc
target in the main Makefile will not run on Windows.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-27 15:39:13 +01:00
David Horstmann
1c40d751b4 Improve docs Makefile to do full build
Include the make apidoc and breathe-apidoc steps in the documentation
Makefile for ease of use. In this way, depart from the Makefile
generated automatically by Sphinx.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-27 15:39:13 +01:00
David Horstmann
f15b7b6300 Improve positioning of GENERATE_XML option
It is clearer to have this option next to the GENERATE_LATEX option.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-27 15:39:11 +01:00
David Horstmann
e760c797e0 Remove Exhale from requirements and regenerate
Regenerate the requirements.txt with Exhale removed and also with Python
3.9 instead of 3.8, for parity with Read The Docs.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-27 15:36:39 +01:00
David Horstmann
89bf31d361 Add exemption for make.bat in checks for tabs
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-17 13:59:10 +00:00
David Horstmann
e04d492aad Ignore mbedtls macros causing warnings
Sphinx's breathe plugin cannot readily parse the Mbed TLS macros, so
define the less essential ones away at the doxygen step to reduce the
number of warnings.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-17 13:59:10 +00:00
David Horstmann
7f7aadded1 Add configuration for Read The Docs
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-17 13:59:10 +00:00
David Horstmann
241b0408c3 Add initial API doc configuration
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-17 13:59:10 +00:00
David Horstmann
62ef621c24 Tell Doxygen to generate XML
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-17 13:59:10 +00:00
David Horstmann
c9d8c3305d Add space to appease doxygen bug
See doxygen/doxygen#8706

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-17 13:59:10 +00:00
Dave Rodgman
4a1de0f1a4 Merge pull request #7295 from DemiMarie/oid-fix-2.28
[Backport 2.28] Fix segfault in mbedtls_oid_get_numeric_string
2023-03-16 12:21:25 +00:00
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
Gilles Peskine
a93b06dd5b Merge pull request #7204 from lpy4105/issue/backport-all_sh-do-not-list-unsupported-cases
Backport 2.28: all.sh: Do not list unsupported cases
2023-03-14 10:34:12 +01: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
Gilles Peskine
ed36bbeb9a Merge pull request #7238 from davidhorstmann-arm/2.28-move-getting-started-guide
[Backport 2.28] Move docs/getting_started.md to docs repo
2023-03-10 10:59:25 +01:00
Dave Rodgman
362142f6d3 Merge pull request #7223 from gilles-peskine-arm/doc-tls13-psa_crypto_init-2.28
2.28: Document the need to call psa_crypto_init() with USE_PSA_CRYPTO
2023-03-09 15:44:39 +00:00
David Horstmann
29216d21e7 Move docs/getting_started.md to docs repo
Delete docs/getting_started.md as it has been moved to the dedicated
documentation repo.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-09 09:59:46 +00:00
Janos Follath
803dbdbd22 Merge pull request #7232 from tom-cosgrove-arm/update-changelog-230308-2.28
Backport 2.28: Update ChangeLog to make "fix" explicit
2023-03-09 08:47:37 +00:00
Dave Rodgman
8a8e75e127 Merge pull request #7219 from tom-cosgrove-arm/fix-typos-230307-2.28
Fix typos in LTS prior to release
2023-03-08 17:20:04 +00:00
Tom Cosgrove
fc09b75023 Update ChangeLog to make "fix" explicit
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-08 15:58:47 +00:00
Gilles Peskine
07ae208f12 Document the need to call psa_crypto_init() with USE_PSA_CRYPTO
When MBEDTLS_USE_PSA_CRYPTO is enabled, the application must call
psa_crypto_init() before directly or indirectly calling cipher or PK code
that will use PSA under the hood. Document this explicitly for some
functions.

To avoid clutter, this commit only documents the need to call
psa_crypto_init() in common, non-obvious cases: using a PK object that was
not constructed using PSA, X.509 processing, or setting up an SSL context.
Functions that are normally only called after such a function (for example,
using a cipher or PK context constructed from a PSA key), or where the need
for PSA is obvious because they take a key ID as argument, do not need more
explicit documentaion.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-07 20:25:02 +01:00
Tom Cosgrove
601e839416 Fix typos
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-07 11:43:12 +00:00
Pengyu Lv
d216c0411d all.sh: add support function for build_armcc
With this change, "--list-components" will not list
"build_armcc" on the system which is not installed
with Arm Compilers.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-03-03 18:23:35 +08:00
Pengyu Lv
a19ce12e47 all.sh: Skip build_mingw correctly
If i686-w64-mingw32-gcc is not installed, then
build_mingw should be unsupported.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-03-03 18:21:14 +08:00
Dave Rodgman
40d79cef35 Merge pull request #7199 from daverodgman/armclang-sha-warning-2.28
Backport 2.28: enable -Werror for armclang
2023-03-03 09:01:50 +00:00
Dave Rodgman
6cda3d3b5b Enable -Werror for armclang
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-02 15:34:42 +00:00
Gilles Peskine
2b810e3a74 Merge pull request #7104 from AndrzejKurek/pymod-2-28
[Backport 2.28] Use config.py as a module in depends.py
2023-03-02 15:38:45 +01:00
Gilles Peskine
440535e694 Merge pull request #7153 from lpy4105/issue/1785/backport-ssl-test-script-fail
Backport 2.28: compat.sh: Skip static ECDH cases if unsupported in openssl
2023-02-28 18:11:42 +01:00
Gilles Peskine
14b61666a5 Merge pull request #7139 from daverodgman/fix-test-output-length-on-success-only-2.28
Backport 2.28 - Fix test to check output length on PSA_SUCCESS only
2023-02-28 18:09:25 +01:00
Stephan Koch
6ed143635d Feedback from Arm: guarantee that output_length <= output_size even on error, to reduce the risk that a missing error check
escalates into a buffer overflow in the application code

Signed-off-by: Stephan Koch <koch@oberon.ch>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-28 15:13:35 +00:00
oberon-sk
8a23f49ebc asymmetric_encrypt: check output length only if return code is PSA_SUCCESS.
Signed-off-by: Stephan Koch <koch@oberon.ch>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-28 15:13:35 +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
b361e04207 Merge pull request #7167 from gilles-peskine-arm/retval-non-empty-2.28
Backport 2.28: Pacify Clang 15 about empty \retval
2023-02-26 19:52:40 +00:00
Dave Rodgman
cd09d68eb1 Add tests
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-24 16:02:26 +00:00
Dave Rodgman
fb07c37cb1 Improve changelog
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-24 16:02:26 +00:00
Dave Rodgman
1215557e91 Add corresponding fix for mbedtls_ssl_write
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
ashesman
cf01d78e7e Update library/ssl_msg.c
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-24 16:02:26 +00:00
Ashley Duncan
272cc19ab5 Fixed undefined behavior in ssl_read if buf parameter is NULL.
Signed-off-by: Ashley Duncan <ashes.man@gmail.com>
2023-02-24 16:02:25 +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
809c3d5003 Words. Use them!
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-24 11:41:56 +01:00
Gilles Peskine
8377f3dec0 Further documentation improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-24 11:41:55 +01:00
Gilles Peskine
4b86f531b7 Improve documentation of documentation workaround
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-24 11:41:55 +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
Gilles Peskine
ec1eff386c Make \retval commands non-empty
Pacify Clang >=15 which complained:
```
include/psa/crypto.h:91:23: error: empty paragraph passed to '\retval' command [-Werror,-Wdocumentation]
 * \retval #PSA_SUCCESS
   ~~~~~~~~~~~~~~~~~~~^
```

This commit performs the following systematic replacement:
```
perl -i -0777 -p -e 's/([\\@])(retval +\S+)\n(?! *\*? *([^\n \\*\/]|\\[cp]\b))/$1$2 ${1}emptydescription\n/g' $(git ls-files '*.[hc]' '*.function' '*.jinja')
```
i.e. add an `\emptydescription` argument to `\retval` commands (or
`@retval`, which we don't normally used) that are followed by a single word,
unless the next line looks like it contains text which would be the
description.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-24 11:41:45 +01:00
Gilles Peskine
2fb14e93f3 Define a workaround for empty \retval description
Since Clang 15, `clang -Wdocumentation` warns about an empty description in
a Doxygen `\retval` command:

```
include/psa/crypto.h:91:23: error: empty paragraph passed to '\retval' command [-Werror,-Wdocumentation]
 * \retval #PSA_SUCCESS
   ~~~~~~~~~~~~~~~~~~~^
```

Ideally `\retval` directives should have a description that describes the
precise meaning of the return value, but we commonly use an empty
description when the return value is a status code and the status code's
description is sufficient documentation.

As a workaround, define a Doxygen command `\emptydescription` that we can
use to make the description source code non-empty, without changing the
appearance. Using the command will be done in a subsequent commit.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-24 11:40:05 +01:00