Skip to content

Commit bdbc2ab

Browse files
authored
Merge pull request Mbed-TLS#958 from Mbed-TLS/merge-into-2.28
Merge 2.28.1 into 2.28
2 parents ada62f2 + dd79db1 commit bdbc2ab

Some content is hidden

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

47 files changed

+711
-186
lines changed

ChangeLog

+95-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,98 @@
1-
mbed TLS ChangeLog (Sorted per branch, date)
1+
Mbed TLS ChangeLog (Sorted per branch, date)
2+
3+
= Mbed TLS 2.28.1 branch released 2022-07-11
4+
5+
Default behavior changes
6+
* mbedtls_cipher_set_iv will now fail with ChaCha20 and ChaCha20+Poly1305
7+
for IV lengths other than 12. The library was silently overwriting this
8+
length with 12, but did not inform the caller about it. Fixes #4301.
9+
10+
Features
11+
* When MBEDTLS_PSA_CRYPTO_CONFIG is enabled, you may list the PSA crypto
12+
feature requirements in the file named by the new macro
13+
MBEDTLS_PSA_CRYPTO_CONFIG_FILE instead of the default psa/crypto_config.h.
14+
Furthermore you may name an additional file to include after the main
15+
file with the macro MBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE.
16+
17+
Security
18+
* Zeroize dynamically-allocated buffers used by the PSA Crypto key storage
19+
module before freeing them. These buffers contain secret key material, and
20+
could thus potentially leak the key through freed heap.
21+
* Fix a potential heap buffer overread in TLS 1.2 server-side when
22+
MBEDTLS_USE_PSA_CRYPTO is enabled, an opaque key (created with
23+
mbedtls_pk_setup_opaque()) is provisioned, and a static ECDH ciphersuite
24+
is selected. This may result in an application crash or potentially an
25+
information leak.
26+
* Fix a buffer overread in DTLS ClientHello parsing in servers with
27+
MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE enabled. An unauthenticated client
28+
or a man-in-the-middle could cause a DTLS server to read up to 255 bytes
29+
after the end of the SSL input buffer. The buffer overread only happens
30+
when MBEDTLS_SSL_IN_CONTENT_LEN is less than a threshold that depends on
31+
the exact configuration: 258 bytes if using mbedtls_ssl_cookie_check(),
32+
and possibly up to 571 bytes with a custom cookie check function.
33+
Reported by the Cybeats PSI Team.
34+
35+
Bugfix
36+
* Fix a memory leak if mbedtls_ssl_config_defaults() is called twice.
37+
* Fix several bugs (warnings, compiler and linker errors, test failures)
38+
in reduced configurations when MBEDTLS_USE_PSA_CRYPTO is enabled.
39+
* Fix a bug in (D)TLS curve negotiation: when MBEDTLS_USE_PSA_CRYPTO was
40+
enabled and an ECDHE-ECDSA or ECDHE-RSA key exchange was used, the
41+
client would fail to check that the curve selected by the server for
42+
ECDHE was indeed one that was offered. As a result, the client would
43+
accept any curve that it supported, even if that curve was not allowed
44+
according to its configuration. Fixes #5291.
45+
* Fix unit tests that used 0 as the file UID. This failed on some
46+
implementations of PSA ITS. Fixes #3838.
47+
* Fix API violation in mbedtls_md_process() test by adding a call to
48+
mbedtls_md_starts(). Fixes #2227.
49+
* Fix compile errors when MBEDTLS_HAVE_TIME is not defined. Add tests
50+
to catch bad uses of time.h.
51+
* Fix the library search path when building a shared library with CMake
52+
on Windows.
53+
* Fix bug in the alert sending function mbedtls_ssl_send_alert_message()
54+
potentially leading to corrupted alert messages being sent in case
55+
the function needs to be re-called after initially returning
56+
MBEDTLS_SSL_WANT_WRITE. Fixes #1916.
57+
* In configurations with MBEDTLS_SSL_DTLS_CONNECTION_ID enabled but none of
58+
MBEDTLS_SSL_HW_RECORD_ACCEL, MBEDTLS_SSL_EXPORT_KEYS or MBEDTLS_DEBUG_C,
59+
DTLS handshakes using CID would crash due to a null pointer dereference.
60+
Fix this. Fixes #3998.
61+
* Fix incorrect documentation of mbedtls_x509_crt_profile. The previous
62+
documentation stated that the `allowed_pks` field applies to signatures
63+
only, but in fact it does apply to the public key type of the end entity
64+
certificate, too. Fixes #1992.
65+
* Fix PSA cipher multipart operations using ARC4. Previously, an IV was
66+
required but discarded. Now, an IV is rejected, as it should be.
67+
* Fix undefined behavior in mbedtls_asn1_find_named_data(), where val is
68+
not NULL and val_len is zero.
69+
* psa_raw_key_agreement() now returns PSA_ERROR_BUFFER_TOO_SMALL when
70+
applicable. Fixes #5735.
71+
* Fix a bug in the x25519 example program where the removal of
72+
MBEDTLS_ECDH_LEGACY_CONTEXT caused the program not to run. Fixes #4901 and
73+
#3191.
74+
* Encode X.509 dates before 1/1/2000 as UTCTime rather than
75+
GeneralizedTime. Fixes #5465.
76+
* Fix order value of curve x448.
77+
* Fix string representation of DNs when outputting values containing commas
78+
and other special characters, conforming to RFC 1779. Fixes #769.
79+
* Silence a warning from GCC 12 in the selftest program. Fixes #5974.
80+
* Fix mbedtls_asn1_write_mpi() writing an incorrect encoding of 0.
81+
* Fix resource leaks in mbedtls_pk_parse_public_key() in low
82+
memory conditions.
83+
* Fix server connection identifier setting for outgoing encrypted records
84+
on DTLS 1.2 session resumption. After DTLS 1.2 session resumption with
85+
connection identifier, the Mbed TLS client now properly sends the server
86+
connection identifier in encrypted record headers. Fix #5872.
87+
* Fix a null pointer dereference when performing some operations on zero
88+
represented with 0 limbs (specifically mbedtls_mpi_mod_int() dividing
89+
by 2, and mbedtls_mpi_write_string() in base 2).
90+
* Fix record sizes larger than 16384 being sometimes accepted despite being
91+
non-compliant. This could not lead to a buffer overflow. In particular,
92+
application data size was already checked correctly.
93+
94+
Changes
95+
* Assume source files are in UTF-8 when using MSVC with CMake.
296

397
= mbed TLS 2.28.0 branch released 2021-12-17
498

ChangeLog.d/PSA-test-suites-NOT-using-UID-0.txt

-3
This file was deleted.

ChangeLog.d/add-mbedtls_md_starts-to-mbedtls_md_process-test.txt

-3
This file was deleted.

ChangeLog.d/alert_reentrant.txt

-5
This file was deleted.

ChangeLog.d/asn1write-0-fix

-2
This file was deleted.

ChangeLog.d/bug_x448.txt

-2
This file was deleted.

ChangeLog.d/chacha20_invalid_iv_len_fix.txt

-4
This file was deleted.

ChangeLog.d/cmake_msvc_utf8.txt

-2
This file was deleted.

ChangeLog.d/doc-x509-profile-pk.txt

-5
This file was deleted.

ChangeLog.d/dtls-cid-null.txt

-5
This file was deleted.

ChangeLog.d/fix-csr_subject_commas.txt

-3
This file was deleted.

ChangeLog.d/fix-time-format-pre-2000.txt

-3
This file was deleted.

ChangeLog.d/fix-undefined-memcpy-mbedtls_asn1_named_data.txt

-3
This file was deleted.

ChangeLog.d/fix-windows-cmake-build-with-shared-libraries.txt

-3
This file was deleted.

ChangeLog.d/fix-x25519-program.txt

-4
This file was deleted.

ChangeLog.d/fix_some_resource_leaks.txt

-4
This file was deleted.

ChangeLog.d/mbedtls_ssl_config_defaults-memleak.txt

-2
This file was deleted.

ChangeLog.d/psa-rc4.txt

-3
This file was deleted.

ChangeLog.d/psa_crypto_config_file.txt

-6
This file was deleted.

ChangeLog.d/psa_crypto_reduced_configs_bugs.txt

-3
This file was deleted.

ChangeLog.d/psa_raw_key_agreement-buffer_too_small.txt

-3
This file was deleted.

ChangeLog.d/resumption_cid.txt

-5
This file was deleted.

ChangeLog.d/selftest-gcc12.txt

-2
This file was deleted.

ChangeLog.d/timeless.txt

-3
This file was deleted.

ChangeLog.d/use-psa-ecdhe-curve.txt

-7
This file was deleted.

ChangeLog.d/zeroize_key_buffers_before_free.txt

-4
This file was deleted.

doxygen/input/doc_mainpage.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323

2424
/**
25-
* @mainpage mbed TLS v2.28.0 source code documentation
25+
* @mainpage mbed TLS v2.28.1 source code documentation
2626
*
2727
* This documentation describes the internal structure of mbed TLS. It was
2828
* automatically generated from specially formatted comment blocks in

doxygen/mbedtls.doxyfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PROJECT_NAME = "mbed TLS v2.28.0"
1+
PROJECT_NAME = "mbed TLS v2.28.1"
22
OUTPUT_DIRECTORY = ../apidoc/
33
FULL_PATH_NAMES = NO
44
OPTIMIZE_OUTPUT_FOR_C = YES

include/mbedtls/pk.h

+49-26
Original file line numberDiff line numberDiff line change
@@ -217,32 +217,6 @@ typedef struct
217217
typedef void mbedtls_pk_restart_ctx;
218218
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */
219219

220-
#if defined(MBEDTLS_RSA_C)
221-
/**
222-
* Quick access to an RSA context inside a PK context.
223-
*
224-
* \warning You must make sure the PK context actually holds an RSA context
225-
* before using this function!
226-
*/
227-
static inline mbedtls_rsa_context *mbedtls_pk_rsa( const mbedtls_pk_context pk )
228-
{
229-
return( (mbedtls_rsa_context *) (pk).pk_ctx );
230-
}
231-
#endif /* MBEDTLS_RSA_C */
232-
233-
#if defined(MBEDTLS_ECP_C)
234-
/**
235-
* Quick access to an EC context inside a PK context.
236-
*
237-
* \warning You must make sure the PK context actually holds an EC context
238-
* before using this function!
239-
*/
240-
static inline mbedtls_ecp_keypair *mbedtls_pk_ec( const mbedtls_pk_context pk )
241-
{
242-
return( (mbedtls_ecp_keypair *) (pk).pk_ctx );
243-
}
244-
#endif /* MBEDTLS_ECP_C */
245-
246220
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
247221
/**
248222
* \brief Types for RSA-alt abstraction
@@ -656,6 +630,55 @@ const char * mbedtls_pk_get_name( const mbedtls_pk_context *ctx );
656630
*/
657631
mbedtls_pk_type_t mbedtls_pk_get_type( const mbedtls_pk_context *ctx );
658632

633+
#if defined(MBEDTLS_RSA_C)
634+
/**
635+
* Quick access to an RSA context inside a PK context.
636+
*
637+
* \warning This function can only be used when the type of the context, as
638+
* returned by mbedtls_pk_get_type(), is #MBEDTLS_PK_RSA.
639+
* Ensuring that is the caller's responsibility.
640+
* Alternatively, you can check whether this function returns NULL.
641+
*
642+
* \return The internal RSA context held by the PK context, or NULL.
643+
*/
644+
static inline mbedtls_rsa_context *mbedtls_pk_rsa( const mbedtls_pk_context pk )
645+
{
646+
switch( mbedtls_pk_get_type( &pk ) )
647+
{
648+
case MBEDTLS_PK_RSA:
649+
return( (mbedtls_rsa_context *) (pk).pk_ctx );
650+
default:
651+
return( NULL );
652+
}
653+
}
654+
#endif /* MBEDTLS_RSA_C */
655+
656+
#if defined(MBEDTLS_ECP_C)
657+
/**
658+
* Quick access to an EC context inside a PK context.
659+
*
660+
* \warning This function can only be used when the type of the context, as
661+
* returned by mbedtls_pk_get_type(), is #MBEDTLS_PK_ECKEY,
662+
* #MBEDTLS_PK_ECKEY_DH, or #MBEDTLS_PK_ECDSA.
663+
* Ensuring that is the caller's responsibility.
664+
* Alternatively, you can check whether this function returns NULL.
665+
*
666+
* \return The internal EC context held by the PK context, or NULL.
667+
*/
668+
static inline mbedtls_ecp_keypair *mbedtls_pk_ec( const mbedtls_pk_context pk )
669+
{
670+
switch( mbedtls_pk_get_type( &pk ) )
671+
{
672+
case MBEDTLS_PK_ECKEY:
673+
case MBEDTLS_PK_ECKEY_DH:
674+
case MBEDTLS_PK_ECDSA:
675+
return( (mbedtls_ecp_keypair *) (pk).pk_ctx );
676+
default:
677+
return( NULL );
678+
}
679+
}
680+
#endif /* MBEDTLS_ECP_C */
681+
659682
#if defined(MBEDTLS_PK_PARSE_C)
660683
/** \ingroup pk_module */
661684
/**

0 commit comments

Comments
 (0)