Skip to content

Commit 1a8ebe3

Browse files
Merge pull request #1050 from Mbed-TLS/update-restricted-2023-08-30
Sync development-restricted with tip of development
2 parents 115784b + 730bbee commit 1a8ebe3

File tree

315 files changed

+16205
-9948
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

315 files changed

+16205
-9948
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Random seed file created by test scripts and sample programs
22
seedfile
3+
# MBEDTLS_PSA_INJECT_ENTROPY seed file created by the test framework
4+
00000000ffffff52.psa_its
35

46
# CMake build artifacts:
57
CMakeCache.txt

.travis.yml

+36
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ jobs:
3232
packages:
3333
- clang-10
3434
- gnutls-bin
35+
env:
36+
# Platform tests have an allocation that returns null
37+
- ASAN_OPTIONS="allocator_may_return_null=1"
38+
- MSAN_OPTIONS="allocator_may_return_null=1"
3539
script:
3640
# Do a manual build+test sequence rather than using all.sh,
3741
# because there's no all.sh component that does what we want,
@@ -89,6 +93,10 @@ jobs:
8993
apt:
9094
packages:
9195
- gcc
96+
env:
97+
# Platform tests have an allocation that returns null
98+
- ASAN_OPTIONS="allocator_may_return_null=1"
99+
- MSAN_OPTIONS="allocator_may_return_null=1"
92100
script:
93101
# Do a manual build+test sequence rather than using all.sh.
94102
#
@@ -115,6 +123,10 @@ jobs:
115123
packages:
116124
- clang
117125
- gnutls-bin
126+
env:
127+
# Platform tests have an allocation that returns null
128+
- ASAN_OPTIONS="allocator_may_return_null=1"
129+
- MSAN_OPTIONS="allocator_may_return_null=1"
118130
script:
119131
# Do a manual build+test sequence rather than using all.sh.
120132
#
@@ -129,6 +141,30 @@ jobs:
129141
- tests/scripts/travis-log-failure.sh
130142
- tests/context-info.sh
131143

144+
- name: Arm64 accelerators tests on arm64 host
145+
os: linux
146+
dist: focal
147+
arch: arm64
148+
addons:
149+
apt:
150+
packages:
151+
- gcc
152+
script:
153+
# Do a manual build+test sequence rather than using all.sh.
154+
#
155+
# This is arm64 host only test for no runtime detection case. Internal
156+
# and Open CI do not include Arm64 host, and they check if components
157+
# are be tested. As result, it will always fail on `pre-test-check` in
158+
# them.
159+
- scripts/config.py unset MBEDTLS_AESNI_C
160+
- scripts/config.py unset MBEDTLS_PADLOCK_C
161+
- scripts/config.py set MBEDTLS_AESCE_C
162+
- scripts/config.py set MBEDTLS_AES_USE_HARDWARE_ONLY
163+
- make generated_files
164+
- make
165+
- programs/test/selftest aes | grep "using AESCE"
166+
- tests/context-info.sh
167+
132168
after_failure:
133169
- tests/scripts/travis-log-failure.sh
134170

3rdparty/p256-m/p256-m/p256-m.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,12 @@ static uint64_t u32_muladd64(uint32_t x, uint32_t y, uint32_t z, uint32_t t);
199199
* Currently assembly optimisations are only supported with GCC/Clang for
200200
* Arm's Cortex-A and Cortex-M lines of CPUs, which start with the v6-M and
201201
* v7-M architectures. __ARM_ARCH_PROFILE is not defined for v6 and earlier.
202+
* Thumb and 32-bit assembly is supported; aarch64 is not supported.
202203
*/
203204
#if defined(__GNUC__) &&\
204205
defined(__ARM_ARCH) && __ARM_ARCH >= 6 && defined(__ARM_ARCH_PROFILE) && \
205-
( __ARM_ARCH_PROFILE == 77 || __ARM_ARCH_PROFILE == 65 ) /* 'M' or 'A' */
206+
( __ARM_ARCH_PROFILE == 77 || __ARM_ARCH_PROFILE == 65 ) /* 'M' or 'A' */ && \
207+
!defined(__aarch64__)
206208

207209
/*
208210
* This set of CPUs is conveniently partitioned as follows:

CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ if(CMAKE_COMPILER_IS_CLANG)
226226
endif(CMAKE_COMPILER_IS_CLANG)
227227

228228
if(CMAKE_COMPILER_IS_IAR)
229-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --warn_about_c_style_casts -Ohz")
229+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --warn_about_c_style_casts")
230+
set(CMAKE_C_FLAGS_RELEASE "-Ohz")
231+
set(CMAKE_C_FLAGS_DEBUG "--debug -On")
230232
endif(CMAKE_COMPILER_IS_IAR)
231233

232234
if(CMAKE_COMPILER_IS_MSVC)
@@ -372,7 +374,7 @@ if(NOT DISABLE_PACKAGE_CONFIG_AND_INSTALL)
372374
write_basic_package_version_file(
373375
"cmake/MbedTLSConfigVersion.cmake"
374376
COMPATIBILITY SameMajorVersion
375-
VERSION 3.4.0)
377+
VERSION 3.4.1)
376378

377379
install(
378380
FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/MbedTLSConfig.cmake"

CONTRIBUTING.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,14 @@ Mbed TLS is well documented, but if you think documentation is needed, speak out
8484
License and Copyright
8585
---------------------
8686

87-
All new files should include the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) standard license header where possible. For licensing details, please see the [License section of the README](README.md#License).
87+
Unless specifically indicated otherwise in a file, Mbed TLS files are provided under the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. See the [LICENSE](LICENSE) file for the full text of this license.
88+
89+
Contributors must accept that their contributions are made under both the Apache-2.0 AND [GPL-2.0-or-later](https://spdx.org/licenses/GPL-2.0-or-later.html) licenses. This enables LTS (Long Term Support) branches of the software to be provided under either the Apache-2.0 or GPL-2.0-or-later licenses.
90+
91+
All new files should include the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) standard license header where possible.
8892

8993
The copyright on contributions is retained by the original authors of the code. Where possible for new files, this should be noted in a comment at the top of the file in the form: "Copyright The Mbed TLS Contributors".
9094

91-
When contributing code to us, the committer and all authors are required to make the submission under the terms of the [Developer Certificate of Origin](dco.txt), confirming that the code submitted can (legally) become part of the project, and be subject to the same Apache 2.0 license. This is done by including the standard Git `Signed-off-by:` line in every commit message. If more than one person contributed to the commit, they should also add their own `Signed-off-by:` line.
95+
When contributing code to us, the committer and all authors are required to make the submission under the terms of the [Developer Certificate of Origin](dco.txt), confirming that the code submitted can (legally) become part of the project, and is submitted under both the Apache-2.0 AND GPL-2.0-or-later licenses.
96+
97+
This is done by including the standard Git `Signed-off-by:` line in every commit message. If more than one person contributed to the commit, they should also add their own `Signed-off-by:` line.

ChangeLog

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
Mbed TLS ChangeLog (Sorted per branch, date)
22

3+
= Mbed TLS 3.4.1 branch released 2023-08-04
4+
5+
Bugfix
6+
* Fix builds on Windows with clang
7+
8+
Changes
9+
* Update test data to avoid failures of unit tests after 2023-08-07.
10+
311
= Mbed TLS 3.4.0 branch released 2023-03-28
412

513
Default behavior changes

ChangeLog.d/00README.md

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ We generally don't include changelog entries for:
2121
* Performance improvements, unless they are particularly significant.
2222
* Changes to parts of the code base that users don't interact with directly,
2323
such as test code and test data.
24+
* Fixes for compiler warnings. Releases typically contain a number of fixes
25+
of this kind, so we will only mention them in the Changelog if they are
26+
particularly significant.
2427

2528
Until Mbed TLS 2.24.0, we required changelog entries in more cases.
2629
Looking at older changelog entries is good practice for how to write a

ChangeLog.d/Define-PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_yyy.txt

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ New deprecations
22
* PSA_WANT_KEY_TYPE_xxx_KEY_PAIR and
33
MBEDTLS_PSA_ACCEL_KEY_TYPE_xxx_KEY_PAIR, where xxx is either ECC or RSA,
44
are now being deprecated in favor of PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_yyy and
5-
MBEDTLS_PSA_ACCEL_KEY_TYPE_xxx_KEY_PAIR_yyy. Here yyy can be: USE, IMPORT,
6-
EXPORT, GENERATE, DERIVE. The goal is to have a finer detail about the
7-
capabilities of the PSA side for either key.
5+
MBEDTLS_PSA_ACCEL_KEY_TYPE_xxx_KEY_PAIR_yyy. Here yyy can be: BASIC,
6+
IMPORT, EXPORT, GENERATE, DERIVE. The goal is to have a finer detail about
7+
the capabilities of the PSA side for either key.
88

99
Features
1010
* New symbols PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_yyy and
1111
MBEDTLS_PSA_ACCEL_KEY_TYPE_xxx_KEY_PAIR_yyy (where xxx is either ECC, RSA
1212
or DH) were introduced in order to have finer accuracy in defining the
1313
PSA capabilities for each key. These capabilities, named yyy above, can be
14-
any of: USE, IMPORT, EXPORT, GENERATE, DERIVE.
14+
any of: BASIC, IMPORT, EXPORT, GENERATE, DERIVE.
15+
- DERIVE is only available for ECC keys, not for RSA or DH ones.
16+
- implementations are free to enable more than what it was strictly
17+
requested. For example BASIC internally enables IMPORT and EXPORT
18+
(useful for testing purposes), but this might change in the future.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Features
2+
* New configuration option MBEDTLS_AES_USE_HARDWARE_ONLY introduced. When
3+
using CPU-accelerated AES (e.g., Arm Crypto Extensions), this option
4+
disables the plain C implementation and the run-time detection for the
5+
CPU feature, which reduces code size and avoids the vulnerability of the
6+
plain C implementation.

ChangeLog.d/add-pbkdf2-cmac.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Features
2+
* Add support for PBKDF2-CMAC through the PSA API.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Features
2+
* Add a possibility to generate CSR's with RCF822 and directoryName subtype
3+
of subjectAltName extension in x509 certificates.

ChangeLog.d/driver-only-ecdh.txt ChangeLog.d/driver-only-ecc.txt

+3
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ Features
55
MBEDTLS_USE_PSA_CRYPTO. Restartable/interruptible ECDHE operations in
66
TLS 1.2 (ECDHE-ECDSA key exchange) are not supported in those builds yet,
77
as PSA does not have an API for restartable ECDH yet.
8+
* When all of ECDH, ECDSA and EC J-PAKE are either disabled or provided by
9+
a driver, it is possible to disable MBEDTLS_ECP_C and still get support
10+
for ECC keys and algorithms in PSA. See docs/driver-only-builds.txt.
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Changes
2+
* Enforce minimum RSA key size when generating a key
3+
to avoid accidental misuse.

ChangeLog.d/extend-pk-opaque-ecc.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Features
2+
* Support for "opaque" (PSA-held) ECC keys in the PK module has been
3+
extended: it is now possible to use mbedtls_pk_write_key_der(),
4+
mbedtls_pk_write_key_pem(), mbedtls_pk_check_pair(), and
5+
mbedtls_pk_verify() with opaque ECC keys (provided the PSA attributes
6+
allow it).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Bugfix
2+
* Fix some cases where mbedtls_mpi_mod_exp, RSA key construction or ECDSA
3+
signature can silently return an incorrect result in low memory conditions.

ChangeLog.d/fix-aes-cbc-iv-corruption

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Bugfix
2+
* Fix a potential corruption of the passed-in IV when mbedtls_aes_crypt_cbc()
3+
is called with zero length and padlock is not enabled.

ChangeLog.d/fix-empty-enum.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Bugfix
2+
* Fix compile failure due to empty enum in cipher_wrap.c, when building
3+
with a very minimal configuration. Fixes #7625.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Bugfix
2+
* Fix IAR compiler warnings.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Features
2+
* The documentation of mbedtls_ecp_group now describes the optimized
3+
representation of A for some curves. Fixes #8045.

ChangeLog.d/inject-entropy.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Bugfix
2+
* Fix the build with MBEDTLS_PSA_INJECT_ENTROPY. Fixes #7516.

ChangeLog.d/misc-from-psa-crypto.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Bugfix
2+
* Fix CCM* with no tag being not supported in a build with CCM as the only
3+
symmetric encryption algorithm and the PSA configuration enabled.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Bugfix
2+
* Don't try to include MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE when
3+
MBEDTLS_PSA_CRYPTO_CONFIG is disabled.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Bugfix
2+
* Fix a compilation error on some platforms when including mbedtls/ssl.h
3+
with all TLS support disabled. Fixes #6628.
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Changes
2+
* Use heap memory to allocate DER encoded RSA private key.
3+
This reduces stack usage significantly for RSA signature
4+
operations when MBEDTLS_PSA_CRYPTO_C is defined.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Bugfix
2+
* Fix x509 certificate generation to conform to RFC 5480 / RFC 5758 when
3+
using ECC key. The certificate was rejected by some crypto frameworks.
4+
Fixes #2924.

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,14 @@ When using drivers, you will generally want to enable two compilation options (s
307307
License
308308
-------
309309
310-
Unless specifically indicated otherwise in a file, Mbed TLS files are provided under the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. See the [LICENSE](LICENSE) file for the full text of this license. Contributors must accept that their contributions are made under both the Apache-2.0 AND [GPL-2.0-or-later](https://spdx.org/licenses/GPL-2.0-or-later.html) licenses. This enables LTS (Long Term Support) branches of the software to be provided under either the Apache-2.0 OR GPL-2.0-or-later licenses.
310+
Unless specifically indicated otherwise in a file, Mbed TLS files are provided under the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. See the [LICENSE](LICENSE) file for the full text of this license, and [the 'License and Copyright' section in the contributing guidelines](CONTRIBUTING.md#License-and-Copyright) for more information.
311311
312312
### Third-party code included in Mbed TLS
313+
313314
This project contains code from other projects. This code is located within the `3rdparty/` directory. The original license text is included within project subdirectories, and in source files. The projects are listed below:
314315
315316
* `3rdparty/everest/`: Files stem from [Project Everest](https://project-everest.github.io/) and are distributed under the Apache 2.0 license.
316-
* `3rdparty/p256-m/p256-m/`: Files have been taken from the [p256-m](https://github.com/mpg/p256-m) repository. The code in the original repository is distributed under the Apache 2.0 license. It is also used by the project under the Apache 2.0 license. We do not plan to regularly update these files, so they may not contain fixes and improvements present in the upstream project.
317+
* `3rdparty/p256-m/p256-m/`: Files have been taken from the [p256-m](https://github.com/mpg/p256-m) repository. The code in the original repository is distributed under the Apache 2.0 license. It is also used by Mbed TLS under the Apache 2.0 license. We do not plan to regularly update these files, so they may not contain fixes and improvements present in the upstream project.
317318
318319
Contributing
319320
------------
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* \file configs/crypto-config-ccm-aes-sha256.h
3+
*
4+
* \brief PSA crypto configuration with only symmetric cryptography: CCM-AES,
5+
* SHA-256, HMAC and key derivation
6+
*/
7+
/*
8+
* Copyright The Mbed TLS Contributors
9+
* SPDX-License-Identifier: Apache-2.0
10+
*
11+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
12+
* not use this file except in compliance with the License.
13+
* You may obtain a copy of the License at
14+
*
15+
* http://www.apache.org/licenses/LICENSE-2.0
16+
*
17+
* Unless required by applicable law or agreed to in writing, software
18+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
19+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20+
* See the License for the specific language governing permissions and
21+
* limitations under the License.
22+
*/
23+
24+
#ifndef PSA_CRYPTO_CONFIG_H
25+
#define PSA_CRYPTO_CONFIG_H
26+
27+
#define PSA_WANT_ALG_CCM 1
28+
#define PSA_WANT_ALG_HMAC 1
29+
#define PSA_WANT_ALG_SHA_256 1
30+
#define PSA_WANT_ALG_TLS12_PRF 1
31+
#define PSA_WANT_ALG_TLS12_PSK_TO_MS 1
32+
#define PSA_WANT_KEY_TYPE_DERIVE 1
33+
#define PSA_WANT_KEY_TYPE_HMAC 1
34+
#define PSA_WANT_KEY_TYPE_AES 1
35+
#define PSA_WANT_KEY_TYPE_RAW_DATA 1
36+
37+
#endif /* PSA_CRYPTO_CONFIG_H */

configs/crypto_config_profile_medium.h

+19
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,23 @@
116116
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR 1
117117
//#define PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY 1
118118

119+
/***********************************************************************
120+
* Local edits below this delimiter
121+
**********************************************************************/
122+
123+
/* Between Mbed TLS 3.4 and 3.5, the PSA_WANT_KEY_TYPE_RSA_KEY_PAIR macro
124+
* (commented-out above) has been replaced with the following new macros: */
125+
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC 1
126+
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT 1
127+
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT 1
128+
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE 1
129+
//#define PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE 1 /* Not supported */
130+
131+
/* Between Mbed TLS 3.4 and 3.5, the following macros have been added: */
132+
//#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_BASIC 1
133+
//#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_IMPORT 1
134+
//#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_EXPORT 1
135+
//#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_GENERATE 1
136+
//#define PSA_WANT_KEY_TYPE_DH_KEY_PAIR_DERIVE 1 // Not supported
137+
119138
#endif /* PROFILE_M_PSA_CRYPTO_CONFIG_H */

docs/architecture/psa-migration/outcome-analysis.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ record() {
4343
fi
4444
}
4545

46-
# save current HEAD
47-
HEAD=$(git branch --show-current)
46+
# save current HEAD.
47+
# Note: this can optionally be updated to
48+
# HEAD=$(git branch --show-current)
49+
# when using a Git version above 2.22
50+
HEAD=$(git rev-parse --abbrev-ref HEAD)
4851

4952
# get the numbers before this PR for default and full
5053
cleanup

0 commit comments

Comments
 (0)