Commit Graph

15959 Commits

Author SHA1 Message Date
Mateusz Starzyk
dd55b25bd5 Require MESSAGE flag in PSA MAC setup.
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
2021-09-27 14:48:38 +02:00
Gilles Peskine
186c0216b0
Merge pull request #4978 from davidhorstmann-arm/2.x-fix-aarch64-asm-constraints
Backport 2.x: Fix aarch64 assembly for bignum multiplication
2021-09-27 09:01:12 +02:00
Gilles Peskine
97cd76988d
Merge pull request #4979 from gilles-peskine-arm/doc-use-psa-crypto-2.x
Backport 2.x: Document effects of MBEDTLS_USE_PSA_CRYPTO
2021-09-25 09:25:36 +02:00
Manuel Pégourié-Gonnard
fec7ef8270 Mention areas that are not (well) tested.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-09-24 20:44:03 +02:00
Manuel Pégourié-Gonnard
ee20baf6e1 Clarify that 1.3 is excluded
Don't mention "TLS 1.2 only" for PSK, as that could give the impression
that the other things about TLS are supported beyond 1.2, which isn't
the case currently.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-09-24 20:44:03 +02:00
Manuel Pégourié-Gonnard
12ab49aaf7 Improve wording and fix some typos.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-09-24 20:44:03 +02:00
Manuel Pégourié-Gonnard
b4113bac9a Clarify wording of "not covered" section
The section is about things that are not covered, but some lists are
about things that are covered, which was very confusing.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-09-24 20:44:03 +02:00
Manuel Pégourié-Gonnard
1fa923a5bc Fix inaccuracy in key exchange summary
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-09-24 20:44:03 +02:00
Manuel Pégourié-Gonnard
6cf7d94ab4 Document parts not covered by USE_PSA_CRYPTO
Also, remove the section about design considerations for now. It's
probably more suitable for a developer-oriented document that would also
include considerations about possible paths for the future, which would
better be separated from user documentation (separating the certain that
is now, from the uncertain that might or might not be later).

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-09-24 20:44:03 +02:00
Manuel Pégourié-Gonnard
b52b91d949 Remove warning about PSA Crypto being beta
The API reached 1.0.0 some time ago, and we've caught up with the
incompatible changes already.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-09-24 20:44:03 +02:00
Manuel Pégourié-Gonnard
04bc6875a0 Document current effects of USE_PSA_CRYPTO
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-09-24 20:44:03 +02:00
Manuel Pégourié-Gonnard
00b72fc35f Add docs/use-psa-crypto.md
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-09-24 20:44:03 +02:00
David Horstmann
27d8b5c680 Combine changelog entries for muladdc assembly fix
Combine the changelog entries for the memory constraints fix on
aarch64 and amd64, since these are essentially fixing the same
issue.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2021-09-24 16:11:15 +01:00
Gilles Peskine
7358065203
Merge pull request #4970 from jclab-joseph/pr/fix/build-alpine_2.x
Backport 2.x: Fix test code to can be built on alpine #4969
2021-09-24 15:04:09 +02:00
David Horstmann
a23be22308 Fix aarch64 assembly for bignum multiplication
Add memory constraints to the aarch64 inline assembly in MULADDC_STOP.
This fixes an issue where Clang 12 and 13 were generating
non-functional code on aarch64 platforms. See #4962, #4943
for further details.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2021-09-24 09:47:01 +01:00
joseph
00f4eae025 Fix test code to can be built on alpine
Signed-off-by: joseph <joseph@jc-lab.net>
2021-09-23 20:58:45 +09:00
Gilles Peskine
02e17c0aa5
Merge pull request #4941 from gilles-peskine-arm/muladdc-amd64-memory-2.x
Backport 2.x: Fix x86_64 assembly for bignum multiplication
2021-09-20 22:23:53 +02:00
Gilles Peskine
3c0f304848
Merge pull request #4954 from SiliconLabs/backport_4878
Backport 2.x: Remove dependency of built-in keys on storage
2021-09-20 22:20:19 +02:00
Gilles Peskine
184a688d51 Update the list of issues fixed
This had actually been reported multiple times.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-09-15 17:07:09 +02:00
Gilles Peskine
c6d977eae5 x86_64 MULADDC assembly: add missing constraints about memory
MULADDC_CORE reads from (%%rsi) and writes to (%%rdi). This fragment is
repeated up to 16 times, and %%rsi and %%rdi are s and d on entry
respectively. Hence the complete asm statement reads 16 64-bit words
from memory starting at s, and writes 16 64-bit words starting at d.

Without any declaration of modified memory, Clang 12 and Clang 13 generated
non-working code for mbedtls_mpi_mod_exp. The constraints make the unit
tests pass with Clang 12.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-09-15 15:47:37 +02:00
Gilles Peskine
394b9f2d2c
Merge pull request #4898 from mstarzyk-mobica/disable_defaults_sha1
Remove MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES in 2.28
2021-09-14 11:10:30 +02:00
Janos Follath
2079aa7838
Merge pull request #4939 from gilles-peskine-arm/psa_cipher_update_ecp-unused_parameter-2.x
Backport 2.x: Fix parameter set but unused on psa_cipher_update_ecb
2021-09-13 13:55:16 +01:00
Gilles Peskine
0390016096 Fix the size in bytes
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-09-13 12:54:46 +02:00
Gilles Peskine
a63ba6cd93 psa_cipher_update_ecb: remove parameter output_size
This parameter was set but not used, which was pointless. Clang 14 detects
this and legitimately complains.

Remove the parameter. This is an internal function, only called once. The
caller already has a sufficient check on the output buffer size which
applies in more cases, so there is no real gain in robustness in adding the
same check inside the internal function.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-09-13 12:54:46 +02:00
Gilles Peskine
7b1c916fe8 Document the internal function psa_cipher_update_ecb
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-09-13 12:54:45 +02:00
Archana
6d342f3e1d
Remove dependency of builtin keys on storage
The psa_open_key API depends on MBEDTLS_PSA_CRYPTO_STORAGE_C.
This is unnecessary for builtin keys and so is fixed.
Updated an open_fail test vector keeping with the same.

Signed-off-by: Archana <archana.madhavan@silabs.com>
2021-09-11 22:31:06 +05:30
Mateusz Starzyk
7d13539d1b Disable MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE in default config.
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
2021-09-06 12:19:25 +02:00
Mateusz Starzyk
b3d344c225 Remove MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES option.
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
2021-09-06 12:18:53 +02:00
Gilles Peskine
9be53ffd10
Merge pull request #4903 from kennethsoerensen/pkparse-warning_2.x
Backport 2.x: Remove compiler warning if only MBEDTLS_PK_PARSE_C is d…
2021-09-01 16:53:50 +02:00
Kenneth Soerensen
c4e950ea53 Backport 2.x: Remove compiler warning if only MBEDTLS_PK_PARSE_C is defined
Warning reported with IAR compiler:
"mbedtls\library\pkparse.c",1167  Warning[Pe550]: variable "ret" was set but never used

Signed-off-by: Kenneth Soerensen <knnthsrnsn@gmail.com>
2021-09-01 11:18:30 +02:00
Ronald Cron
b4c0668fa5
Merge pull request #4841 from JoeSubbiani/ByteReadingMacros2_2.x
Backport 2.x: Byte reading macros
2021-08-24 09:02:01 +02:00
Joe Subbiani
11b7131c2e Fix macro use in ssl_msg.c
After implementing MBEDTLS_PUT_UINT16_BE, I did not remove the
assignment to a variable

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-23 12:49:14 +01:00
Joe Subbiani
b1f6eef88b Remove commented out code
Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-23 11:45:36 +01:00
Joe Subbiani
a651e6f762 Tidy up grouped MBEDTLS_BYTE_x macros
exchange groups of the byte reading macros with MBEDTLS_PUT_UINTxyz
and then shift the pointer afterwards. Easier to read as you can
see how big the data is that you are putting in, and in the case of
UINT32 AND UINT64 it saves some vertical space.

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-23 11:35:25 +01:00
Joe Subbiani
24647c5cd2 Minor coding style improvement
Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-20 15:56:22 +01:00
Joe Subbiani
efb8fae492 Compress byte reading macros in if statements
exchange MBEDTLS_BYTE_x in if statements with MBEDTLS_GET_UINT16_BE

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-20 12:57:09 +01:00
Joe Subbiani
2f98d791c3 Tidy up ssl_*.c grouped MBEDTLS_BYTE_x macros
exchange groups of the byte reading macros with MBEDTLS_PUT_UINTxyz
and then shift the pointer afterwards. Easier to read as you can
see how big the data is that you are putting in, and in the case of
UINT32 AND UINT64 it saves some vertical space.

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-20 11:44:44 +01:00
Joe Subbiani
23fec2538e Replace remaining byte shift with macro
Replace another instance of >> 8 with MBEDTLS_BYTE_1

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-18 16:23:47 +01:00
Joe Subbiani
d6ea063371 Move #include "common.h" where config.h used to be
After removing config.h, the inclusion of it in common.h would be too late
in the code. Therefore common.h has been moved to where config.h used to
be included.

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-18 12:57:54 +01:00
Joe Subbiani
4446e82146 Remove redundant config.h includes definitions
common.h already includes config.h, so a a file uses common.h
it no longer requires the definition/inclusion of config.h

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-18 12:50:12 +01:00
Joe Subbiani
a724ef9d11 Add more instances of Byte Reading Macros
added more uses of byte reading macros where appropriate.
changed the positioning of some brackets for consitancy in
coding style

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-18 12:06:57 +01:00
Joe Subbiani
b763ba4198 Remove macro that does not belong in 2.x
MBEDTLS_ALLOW_PRIVATE_ACCESS existed in development and was copied
over whilst cherry-picking commits.

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
2021-08-18 11:59:16 +01:00
Manuel Pégourié-Gonnard
5c385aca19
Merge pull request #4873 from mpg/bio_recv_ret_0_eof-2.x
Backport 2.x: Document that returning 0 from the recv callback means EOF
2021-08-17 10:30:59 +02:00
Hanno Becker
c8ac785fc3 Document that returning 0 from the recv callback means EOF
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2021-08-16 13:00:06 +02:00
Manuel Pégourié-Gonnard
f87422f019
Merge pull request #4427 from gilles-peskine-arm/tls_ext_cid-config-2.x
Backport 2.x: Allow configuring MBEDTLS_TLS_EXT_CID at compile time
2021-08-13 10:50:02 +02:00
Manuel Pégourié-Gonnard
9c6cc6945e
Merge pull request #4855 from mpg/add-arm-linux-build-2.x
Backport 2.x: Add arm-linux-gnueabi-gcc build
2021-08-12 13:16:07 +02:00
Manuel Pégourié-Gonnard
9a260a628a Fix missing dependency on Travis
Was getting errors like:

In file included from /usr/include/limits.h:25:0,
                 from /usr/lib/gcc-cross/arm-linux-gnueabi/5/include-fixed/limits.h:168,
                 from /usr/lib/gcc-cross/arm-linux-gnueabi/5/include-fixed/syslimits.h:7,
                 from /usr/lib/gcc-cross/arm-linux-gnueabi/5/include-fixed/limits.h:34,
                 from ../include/mbedtls/check_config.h:30,
                 from ../include/mbedtls/build_info.h:81,
                 from common.h:26,
                 from asn1write.c:20:
/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory

There are two packages to choose from: armhf or armel. Since the comment
in all.sh says we're trying to be close to Debian's "armel"
architecture, choose that, and fix a comment that was mentioning
gnueabihf for no apparent reason.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-08-09 12:09:41 +02:00
Manuel Pégourié-Gonnard
cbb365ce3b Enable arm-linux-gnueabi-gcc build on Travis
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-08-09 12:09:38 +02:00
Manuel Pégourié-Gonnard
719301693d Add arm-linux-gnueabi-gcc build to all.sh
Currently it can't be mandatory, since we can't install the required toolchain
on Jenkins right away.

Also, while at it, remove `SHELL='sh -x'` from the other arm5vte component; it
was a leftover from debugging.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-08-09 12:08:39 +02:00
Gilles Peskine
1b95b34c4b
Merge pull request #4696 from yutotakano/fix-ssl-opt.sh-hard-abort-2.x
Backport 2.x: ssl-opt.sh: Skip tests instead of conditional hard abort
2021-08-04 10:16:42 +02:00