2534 Commits

Author SHA1 Message Date
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
Gilles Peskine
9494a99c2f Fix preprocessor conditional
This was intended as an if-else-if chain. Make it so.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:36:05 +00:00
Gilles Peskine
3efd3149f8 Finish sentence in comment
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:35:54 +00:00
Gilles Peskine
e5038c666e Document the new state of AESNI support
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:32:01 +00:00
Gilles Peskine
6dec541e68 AESNI: Overhaul implementation selection
Have clearly separated code to:
* determine whether the assembly-based implementation is available;
* determine whether the intrinsics-based implementation is available;
* select one of the available implementations if any.

Now MBEDTLS_AESNI_HAVE_CODE can be the single interface for aes.c and
aesni.c to determine which AESNI is built.

Change the implementation selection: now, if both implementations are
available, always prefer assembly. Before, the intrinsics were used if
available. This preference is to minimize disruption, and will likely
be revised in a later minor release.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:59 +00:00
Gilles Peskine
3ba81d3217 Remove the dependency of MBEDTLS_AESNI_C on MBEDTLS_HAVE_ASM
AESNI can now be implemented with intrinsics.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:55 +00:00
Gilles Peskine
5511a34566 New preprocessor symbol indicating that AESNI support is present
The configuration symbol MBEDTLS_AESNI_C requests AESNI support, but it is
ignored if the platform doesn't have AESNI. This allows keeping
MBEDTLS_AESNI_C enabled (as it is in the default build) when building for
platforms other than x86_64, or when MBEDTLS_HAVE_ASM is disabled.

To facilitate maintenance, always use the symbol MBEDTLS_AESNI_HAVE_CODE to
answer the question "can I call mbedtls_aesni_xxx functions?", rather than
repeating the check `defined(MBEDTLS_AESNI_C) && ...`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:12 +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
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
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
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
Dave Rodgman
b6c5d046c4 Additional warnings in cipher.h
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-02 13:42:38 +00:00
Dave Rodgman
4ff023147c Update warnings in cipher.h
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-02 13:25:39 +00:00
Dave Rodgman
b43d5e7aa7 Improve warnings for DES/3DES
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-02 10:49:17 +00:00
Gilles Peskine
1b6c09a62e Switch to the new code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-11 14:52:35 +01:00
David Horstmann
2ccd77ac83 Don't restyle end of file
Move the *INDENT-ON* annotation to the end of the file so that
uncrustify does not restyle the later sections (since it introduces a
risk of future problems).

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-05 09:53:22 +00:00
David Horstmann
d6818e3f94 Disable code style correction for bignum assembly
The inline assembly defined in bn_mul.h confuses code style parsing,
causing code style correction to fail. Disable code style correction for
the whole section gated by "#if defined(MBEDTLS_HAVE_ASM)" to prevent
this.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-04 17:57:00 +00:00
David Horstmann
b6bf5f5533 Workaround Uncrustify parsing of "asm"
The following code:

 #ifndef asm
 #define asm __asm
 #endif

causes Uncrustify to stop correcting the rest of the file. This may be
due to parsing the "asm" keyword in the definition.

Work around this by wrapping the idiom in an *INDENT-OFF* comment
wherever it appears.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-03 11:27:18 +00:00
Gilles Peskine
63c8be6075
Merge pull request #6753 from mpg/restartable-docfix-2.28
[Backport 2.28] Document ECP_RESTARTABLE
2022-12-15 19:47:47 +01:00