2553 Commits

Author SHA1 Message Date
Gilles Peskine
fe4d93ad4d ssl_cache: return error codes on error
mbedtls_ssl_cache_get() and mbedtls_ssl_cache_set() returned 1 on many error
conditions. Change this to returning a negative MBEDTLS_ERR_xxx error code.

Completeness: after this commit, there are no longer any occurrences of
`return 1` or `ret = 1`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-29 13:40:33 +02:00
Gilles Peskine
917dd8bd81 Add new error code for SSL cache entry not found
There was no good error to return in this case.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-29 13:39:49 +02:00
Dave Rodgman
7a8ec0f56c
Merge pull request #8209 from lpy4105/issue/8168/2.28_fix-aesni-selection
2.28: Fix AESNI selection
2023-09-26 16:55:28 +00:00
Pengyu Lv
8068b0835b Fix comment
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-09-26 09:27:04 +08:00
Pengyu Lv
20384f416e Fix the comments of some guards
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-09-21 10:14:16 +08:00
Pengyu Lv
7fb6fc60ce padlock: introduce MBEDTLS_VIA_PADLOCK_HAVE_CODE
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-09-14 14:02:02 +08:00
Gilles Peskine
3d9978e9b3
Merge pull request #8172 from ronald-cron-arm/psa-config-add-comment
Backport 2.28: Add comment about HKDF in config_psa.h
2023-09-13 12:56:02 +00:00
Pengyu Lv
e707dc1bb5 aesni: refine the condition of MBEDTLS_HAVE_X86_64
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-09-13 18:10:41 +08:00
Pengyu Lv
dc5a88b6a4 aesni: make AESNI only operate on X86 and X86_64
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-09-13 18:10:41 +08:00
Pengyu Lv
5a0915953a aesni: define MBEDTLS_HAVE_X86
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-09-13 18:10:25 +08:00
Gilles Peskine
bd26a8de92 More spelling corrections
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-12 19:22:08 +02:00
Gilles Peskine
f08ca83b4f Update spelling "mbed TLS" to "Mbed TLS"
The official spelling of the trade mark changed from all-lowercase "mbed"
to normal proper noun capitalization "Mbed" a few years ago. We've been
using the new spelling in new text but still have the old spelling in a
lot of text. This commit updates most occurrences of "mbed TLS":

```
sed -i -e 's/mbed TLS/Mbed TLS/g' $(git ls-files ':!ChangeLog' ':!tests/data_files/**' ':!tests/suites/*.data' ':!programs/x509/*' ':!configs/tfm*')
```

Justification for the omissions:

* `ChangeLog`: historical text.
* `test/data_files/**`, `tests/suites/*.data`, `programs/x509/*`: many
  occurrences are significant names in certificates and such. Changing
  the spelling would invalidate many signatures and tests.
* `configs/tfm*`: this is an imported file. We'll follow the upstream
  updates.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-12 19:21:54 +02:00
Ronald Cron
fa9392abcd PSA config: Add comment about HKDF.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2023-09-12 09:22:52 +02:00
Gilles Peskine
937b91eb6f Fix boolean options in the wrong section
Boolean options that modify the behavior of a module are supposed to be in
the "feature support" section, not in the "configuration options" support:
that section is documented to contain commented-out definitions with a
value, for which the comment contains the default version. In particular,
merely uncommenting a definition in the "configuration options" section is
not supposed to change anything.

Move the offending boolean options to the proper section.

This causes those options to be enabled by `config.py full` unless
explicitly excluded. For the moved options:

* Everest is already explicitly excluded.
* The ALT options need to link against a custom function, so exclude them.
* `MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE` is ok for testing, and is
  currently never tested in `all.sh`. With this commit, we will now test the
  library with it enabled in configurations based on `full`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-07 17:40:16 +02:00
Tom Cosgrove
5c46332184
Merge pull request #8146 from tom-cosgrove-arm/define-psa-macros-to-1-2.28
Backport 2.28: Define all PSA_xxx macros to 1 rather than have them empty, for consistency
2023-09-04 22:26:54 +01:00
Tom Cosgrove
95b5d79cbf Move the description of MBEDTLS_TEST_DEFINES_ZEROIZE to before its use
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 14:44:09 +01:00
Tom Cosgrove
7f18f44053 Move zeroize-as-memset into a config file under tests/
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 14:43:48 +01:00
Tom Cosgrove
73285cc075 Define all PSA_xxx macros to 1 rather than have them empty, for consistency
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 13:07:39 +01:00
Tom Cosgrove
43210b56f3 Add the ability to verify mbedtls_platform_zeroize() calls with -Wsizeof-pointer-memaccess
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-01 11:24:27 +01:00
Gilles Peskine
9471815dd3
Merge pull request #7828 from davidhorstmann-arm/2.28-reword-net-free-description-2544
[Backport 2.28] Reword the description of `mbedtls_net_free()`
2023-08-21 21:17:14 +00:00
Gilles Peskine
7fbbb61238 Merge remote-tracking branch 'mbedtls-2.28' into calloc-also-zeroizes-2-28 2023-08-21 17:25:47 +02:00
Chien Wong
8aa8d78ed9
Add potential missing inline definition
Signed-off-by: Chien Wong <m@xv97.com>
2023-08-10 12:24:43 +08:00
Chien Wong
12f6f28e15
Improve doc on special use of A in ecp group structure
Signed-off-by: Chien Wong <m@xv97.com>
2023-08-09 22:15:14 +08:00
Gilles Peskine
b438348774
Merge pull request #8010 from marekjansta/fix-x509-ec-algorithm-identifier-2.28
Backport 2.28: Fixed x509 certificate generation to conform to RFCs when using ECC key
2023-08-07 19:14:52 +00:00
Dave Rodgman
403ce0a6cc Bump version numbers
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-02 15:35:45 +01:00
Marek Jansta
0a6743b2de Fixed AlgorithmIdentifier parameters when used with ECDSA signature algorithm in x509 certificate
Signed-off-by: Marek Jansta <jansta@2n.cz>
2023-07-31 17:33:23 +02:00
Marek Jansta
f5257c06d1 Cherry picked required prerequisites from dev branch, git hash 0167244b
Signed-off-by: Marek Jansta <jansta@2n.cz>
2023-07-31 17:33:16 +02:00
Gilles Peskine
e5507d5f20 Fix empty union when TLS is disabled
When all TLS 1.2 support is disabled, union mbedtls_ssl_premaster_secret was
empty, which is not valid C even if the union is never used. Fixes #6628.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-26 17:22:04 +02:00
Andrzej Kurek
3f87d63c71 Improve the documentation of MBEDTLS_PLATFORM_MEMORY
Introduce requests from review comments.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:22:34 -04:00
Andrzej Kurek
33b1222c88 Enable certain documented defines only when generating doxygen
Avoid an "unrecognized define" error.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:14:29 -04:00
Andrzej Kurek
8ca66a0795 Add an mbedtls_calloc(SIZE_MAX/2, SIZE_MAX/2) test
It should return NULL and not a valid pointer.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:13:26 -04:00
Andrzej Kurek
c83d49ebc2 Add a description of how mbedtls_calloc is determined
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 09:58:17 -04:00
Andrzej Kurek
ba16859cc6 Documentation and cosmetic fixes
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 09:56:02 -04:00
Andrzej Kurek
dc11cd1668 Extend mbedtls_calloc and mbedtls_free documentation
Co-authored-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 09:47:05 -04:00
Andrzej Kurek
db54dbdc56 Fix \p misuses in documentation
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 05:35:38 -04:00
Andrzej Kurek
532ec20983 doxygen: \p commands misuse - review comments
Apply comments suggested in review.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 05:29:33 -04:00
Andrzej Kurek
c00fb7f379 doxygen: fix parameter name typos and misused \p commands
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 05:29:20 -04:00
Andrzej Kurek
0cbfbd96c1 doxygen: fix misused \p commands in rsa.h
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 05:22:57 -04:00
Andrzej Kurek
96ce1b04ea doxygen: fix parameter name typos and misused \p commands
\p is reserved for function parameters.
\c is used to describe other values and variables.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 05:22:42 -04:00
Andrzej Kurek
a490042f1c Fix documentation - parameter name mistakes
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-13 10:16:08 -04:00
Andrzej Kurek
a3d315a216 doxygen: remove unnecessary description
Due to the nature of CTR, there is no mode parameter.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-13 10:15:02 -04:00
David Horstmann
4184e5c926 Move clarification to a separate note
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-27 12:22:00 +01:00
David Horstmann
0e93877b66 Reword the description of mbedtls_net_free()
This makes it clearer that the context itself is not being freed.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-23 23:24:46 +01:00
Dave Rodgman
763c8b96cc Fix armclang compile fail
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-05 21:24:57 -04:00
Aaron M. Ucko
82e06cb7bc mbedtls/platform.h: Avoid potential macro redefinition warnings.
Some identifiers (e.g. mbedtls_free) can name either functions or
macros depending on configuration settings.  For those that turn out
to name macros, first clear out any existing macro definitions to
accommodate possible unconditional bulk symbol renaming.  (There
remains no standard provision for such renaming, but it's nevertheless
straightforward enough to do as desired, particularly with this change
in place.)

Signed-off-by: Aaron M. Ucko <ucko@ncbi.nlm.nih.gov>
2023-05-22 10:07:17 -04:00
Andrzej Kurek
97cbff7c0d Add a test for calloc zeroization
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-04-25 05:51:34 -04:00
Andrzej Kurek
a242c757c2 Document mbedtls_calloc zeroization
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-04-25 05:23:10 -04:00
Dave Rodgman
87af9c38d6
Merge pull request #7310 from Mbed-TLS/2.28-sphinx-versioned-documentation
[Backport 2.28] Generate API documentation with Sphinx and Breathe
2023-03-29 14:43:08 +01:00
Dave Rodgman
e4f1aac0fd Bump version to 2.28.3
Command used: ./scripts/bump_version.sh --version 2.28.3

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-23 18:06:54 +00:00
Tom Cosgrove
779199faac Document that MBEDTLS_AESNI_HAVE_INTRINSICS and MBEDTLS_AESNI_HAVE_CODE are internal
macros, despite appearing in a public header file.

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-17 17:16:53 +00:00