18298 Commits

Author SHA1 Message Date
Gilles Peskine
18d521a57d Don't warn about Msan/Valgrind if AESNI isn't actually built
The warning is only correct if the assembly code for AESNI is built, not if
MBEDTLS_AESNI_C is activated but MBEDTLS_HAVE_ASM is disabled or the target
architecture isn't x86_64.

This is a partial fix for #7236.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:07 +00:00
Gilles Peskine
6055b78328 Update bibliographic references
There are new versions of the Intel whitepapers and they've moved.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:05 +00: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
Paul Elliott
01298e635a Merge remote-tracking branch 'development/mbedtls-2.28' into mbedtls-2.28-restricted
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-03-17 11:12:59 +00:00
Dave Rodgman
b3b905953d
Merge pull request #999 from yanesca/threat_model_summary-2.28
Threat model summary 2.28
2023-03-16 21:58:25 +00:00
Janos Follath
83050519a7 Threat Model: fix copy paste
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-16 15:00:03 +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
Yanray Wang
3d1d418f9e Fix failure in check_generated_files
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
e16808cddc Move #define Directive into ssl_helpers.h
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
d2696f2aa2 Fix issue of conversion from size_t to int
ssl_helpers.c is treated with W3 warning level in MSVC complier.
So that it's reported as error for warning of conversion from
size_t to int. This change fixes all this type of warning seen in
Microsoft Visual Studio 12.0. Besides, some potential problems of
type conversion are also handled.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
89b4d12d4a Fix build error in CI about test_fail_if_psa_leaking
During test of component build_arm_linux_gnueabi_gcc_arm5vte and
build_arm_none_eabi_gcc_m0plus. It fails with
 - error: implicit declaration of function
   ‘test_fail_if_psa_leaking’

It happens because test_fail_if_psa_leaking is defined in
helpers.function. This block of code is not converted into C code
while compiling ssl_helpers.c. The function has been moved to
psa_crypto_helpers.c in order to fix this build error.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
3742b1211d Fix build errors in CMake
tests/src/ssl_helpers.c depends on functions defined
in library/*.c. If it's complied as an OBJECT with other c files,
cmake complains undefined reference in link stage under programs/.
Therefore, tests/src/test_helpers/ is created to hold c files with
dependency of library/*.c. Besides, tests/src/test_helper/*.c is
separated into another OBJECT, mbedtls_test_helpers, as sources
to build all test suite executables.

In addition, everest header directory is included in case
MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED is enabled.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
1ef77c01c4 ssl_helpers.c: remove duplicate comments for some functions
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:17 +08:00
Yanray Wang
4323e459e9 Resolve build errors for ssl_helpers.c and test_suite_ssl.c
Since we move many functions from test_suite_ssl.function to
ssl_helpers.c in commit bd56b03. This causes various of
build errors. This commit fixes all the build errors by
 - including header files
 - providing function definition
 - adding guards for typedef statements and functions

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-16 11:10:15 +08:00
Janos Follath
35f5ef01f2 Threat Model: adjust to 2.28
MBEDTLS_AESCE_C is not available in 2.28., remove it from workarounds.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:43:08 +00:00
Janos Follath
6cd045905f Threat Model: adjust modality
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
e3d677c6aa Threat Model: remove references
Remove references to scientific papers as they are too specific and
might be misleading.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
08094b8313 Threat Model: clarify stance on timing attacks
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
6ce259d287 Threat Model: improve wording and grammar
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
8257d8aa00 Threat Model: clarify attack vectors
Timing attacks can be launched by any of the main 3 attackers. Clarify
exactly how these are covered.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
18ffba6100 Threat Model: improve wording
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
5e68d3b05f Threat Model: move the block cipher section
The block cipher exception affects both remote and local timing attacks.
Move them to the Caveats section and reference it from both the local
and the remote attack section.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
389cdf43ab Threat model: explain dangling countermeasures
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
adc8a0bcef Threat Model: increase classification detail
Originally for the sake of simplicity there was a single category for
software based attacks, namely timing side channel attacks.

Be more precise and categorise attacks as software based whether or not
they rely on physical information.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
5adb2c2328 Threat Model: reorganise threat definitions
Simplify organisation by placing threat definitions in their respective
sections.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
e57ed98f9e Threat Model: Miscellaneous clarifications
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
661c88f2ba Threat Model: Improve wording
Signed-off-by: Janos Follath <janos.follath@arm.com>

Co-authored-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-15 15:35:29 +00:00
Janos Follath
ce2985b22c Add Threat Model Summary
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-03-15 15:35:29 +00:00
Yanray Wang
bd56b035f1 Move TLS connection related functions to ssl_helpers.c
Some functions are renamed in commit c463849. This change moves all
those functions which are used to set up a TLS connection from
test_suite_ssl.function into ssl_helpers.c.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-15 16:12:41 +08:00
Yanray Wang
82b414938e Improve code readability for test_suite_ssl.function
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-15 16:12:21 +08:00
Yanray Wang
862ef862fd Rewrap the lines to fit code standard in test_suite_ssl.function
As the typedef statements and functions are renamed in commit
abfdcd8 and commit c463849 respectively. This commit aims
to align code lines to fit code standard and improve code
readability.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-15 16:12:12 +08:00
Yanray Wang
c463849598 Rename the functions which are used to set up TLS connection
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-15 16:11:41 +08:00
Yanray Wang
59ab276ef1 Move the renamed typedef statements to ssl_helpers.h
With this change, the renamed typedef statements (commit abfdcd8)
are moved from test_suite_ssl.function into ssl_helpers.h

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-15 16:11:32 +08:00
Yanray Wang
abfdcd8ee2 Rename the typedef statements which are used for TLS connection
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-14 19:04:42 +08:00
Yanray Wang
5fce145d00 Create ssl_helpers.c to hold functions of TLS connection
test_suite_ssl.function contains many functions that are used to set
up a TLS connection. To reduce its file size, those functions would
be moved to ssl_helpers.c under tests/src. As the start of this
implementation, some necessary header files are moved in advance.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-14 19:04:42 +08: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