mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-05-01 10:16:33 +00:00
Merge remote-tracking branch 'public/pr/3093' into baremetal
This commit is contained in:
commit
eb7428cc33
|
@ -2,6 +2,10 @@ mbed TLS ChangeLog (Sorted per branch, date)
|
||||||
|
|
||||||
= mbed TLS "baremetal" branch
|
= mbed TLS "baremetal" branch
|
||||||
|
|
||||||
|
Bugfix
|
||||||
|
* Fix build failure with MBEDTLS_ZLIB_SUPPORT enabled. Reported by
|
||||||
|
Jack Lloyd in #2859. Fix submitted by jiblime in #2963.
|
||||||
|
|
||||||
Features
|
Features
|
||||||
* Add new configuration option MBEDTLS_SSL_NO_SESSION_CACHE that enables
|
* Add new configuration option MBEDTLS_SSL_NO_SESSION_CACHE that enables
|
||||||
code size savings in configurations where cache-based session resumption is
|
code size savings in configurations where cache-based session resumption is
|
||||||
|
|
|
@ -1960,7 +1960,7 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
|
||||||
|
|
||||||
/* Allocate compression buffer */
|
/* Allocate compression buffer */
|
||||||
#if defined(MBEDTLS_ZLIB_SUPPORT)
|
#if defined(MBEDTLS_ZLIB_SUPPORT)
|
||||||
if( session->compression == MBEDTLS_SSL_COMPRESS_DEFLATE &&
|
if( ssl->session_negotiate->compression == MBEDTLS_SSL_COMPRESS_DEFLATE &&
|
||||||
ssl->compress_buf == NULL )
|
ssl->compress_buf == NULL )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "Allocating compression buffer" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "Allocating compression buffer" ) );
|
||||||
|
@ -5587,7 +5587,7 @@ static int ssl_check_client_reconnect( mbedtls_ssl_context *ssl )
|
||||||
#endif /* MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE && MBEDTLS_SSL_SRV_C */
|
#endif /* MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE && MBEDTLS_SSL_SRV_C */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If applicable, decrypt (and decompress) record content
|
* If applicable, decrypt record content
|
||||||
*/
|
*/
|
||||||
static int ssl_prepare_record_content( mbedtls_ssl_context *ssl,
|
static int ssl_prepare_record_content( mbedtls_ssl_context *ssl,
|
||||||
mbedtls_record *rec )
|
mbedtls_record *rec )
|
||||||
|
@ -5710,18 +5710,6 @@ static int ssl_prepare_record_content( mbedtls_ssl_context *ssl,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_ZLIB_SUPPORT)
|
|
||||||
if( ssl->transform_in != NULL &&
|
|
||||||
ssl->session_in->compression == MBEDTLS_SSL_COMPRESS_DEFLATE )
|
|
||||||
{
|
|
||||||
if( ( ret = ssl_decompress_buf( ssl ) ) != 0 )
|
|
||||||
{
|
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "ssl_decompress_buf", ret );
|
|
||||||
return( ret );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* MBEDTLS_ZLIB_SUPPORT */
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
|
#if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)
|
||||||
if( MBEDTLS_SSL_TRANSPORT_IS_DTLS( ssl->conf->transport ) )
|
if( MBEDTLS_SSL_TRANSPORT_IS_DTLS( ssl->conf->transport ) )
|
||||||
{
|
{
|
||||||
|
@ -6609,6 +6597,26 @@ static int ssl_get_next_record( mbedtls_ssl_context *ssl )
|
||||||
ssl->in_msglen = rec.data_len;
|
ssl->in_msglen = rec.data_len;
|
||||||
(void)mbedtls_platform_put_uint16_be( ssl->in_len, rec.data_len );
|
(void)mbedtls_platform_put_uint16_be( ssl->in_len, rec.data_len );
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ZLIB_SUPPORT)
|
||||||
|
if( ssl->transform_in != NULL &&
|
||||||
|
ssl->session_in->compression == MBEDTLS_SSL_COMPRESS_DEFLATE )
|
||||||
|
{
|
||||||
|
if( ( ret = ssl_decompress_buf( ssl ) ) != 0 )
|
||||||
|
{
|
||||||
|
MBEDTLS_SSL_DEBUG_RET( 1, "ssl_decompress_buf", ret );
|
||||||
|
return( ret );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check actual (decompress) record content length against
|
||||||
|
* configured maximum. */
|
||||||
|
if( ssl->in_msglen > MBEDTLS_SSL_IN_CONTENT_LEN )
|
||||||
|
{
|
||||||
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad message length" ) );
|
||||||
|
return( MBEDTLS_ERR_SSL_INVALID_RECORD );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* MBEDTLS_ZLIB_SUPPORT */
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -651,6 +651,45 @@ component_test_full_cmake_gcc_asan () {
|
||||||
if_build_succeeded tests/compat.sh
|
if_build_succeeded tests/compat.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component_test_zlib_make() {
|
||||||
|
msg "build: zlib enabled, make"
|
||||||
|
scripts/config.pl set MBEDTLS_ZLIB_SUPPORT
|
||||||
|
make ZLIB=1 CFLAGS='-Werror -O1'
|
||||||
|
|
||||||
|
msg "test: main suites (zlib, make)"
|
||||||
|
make test
|
||||||
|
|
||||||
|
msg "test: ssl-opt.sh (zlib, make)"
|
||||||
|
if_build_succeeded tests/ssl-opt.sh
|
||||||
|
}
|
||||||
|
support_test_zlib_make () {
|
||||||
|
base=support_test_zlib_$$
|
||||||
|
cat <<'EOF' > ${base}.c
|
||||||
|
#include "zlib.h"
|
||||||
|
int main(void) { return 0; }
|
||||||
|
EOF
|
||||||
|
gcc -o ${base}.exe ${base}.c -lz 2>/dev/null
|
||||||
|
ret=$?
|
||||||
|
rm -f ${base}.*
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
component_test_zlib_cmake() {
|
||||||
|
msg "build: zlib enabled, cmake"
|
||||||
|
scripts/config.pl set MBEDTLS_ZLIB_SUPPORT
|
||||||
|
cmake -D ENABLE_ZLIB_SUPPORT=On -D CMAKE_BUILD_TYPE:String=Check .
|
||||||
|
make
|
||||||
|
|
||||||
|
msg "test: main suites (zlib, cmake)"
|
||||||
|
make test
|
||||||
|
|
||||||
|
msg "test: ssl-opt.sh (zlib, cmake)"
|
||||||
|
if_build_succeeded tests/ssl-opt.sh
|
||||||
|
}
|
||||||
|
support_test_zlib_cmake () {
|
||||||
|
support_test_zlib_make "$@"
|
||||||
|
}
|
||||||
|
|
||||||
component_test_ref_configs () {
|
component_test_ref_configs () {
|
||||||
msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s
|
msg "test/build: ref-configs (ASan build)" # ~ 6 min 20s
|
||||||
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
CC=gcc cmake -D CMAKE_BUILD_TYPE:String=Asan .
|
||||||
|
|
|
@ -1150,6 +1150,18 @@ run_test "Default, choose highest security suite and hash, DTLS" \
|
||||||
-s "client hello v3, signature_algorithm ext: 6" \
|
-s "client hello v3, signature_algorithm ext: 6" \
|
||||||
-s "ECDHE curve: secp521r1"
|
-s "ECDHE curve: secp521r1"
|
||||||
|
|
||||||
|
requires_config_enabled MBEDTLS_ZLIB_SUPPORT
|
||||||
|
run_test "Default (compression enabled)" \
|
||||||
|
"$P_SRV debug_level=3" \
|
||||||
|
"$P_CLI debug_level=3" \
|
||||||
|
0 \
|
||||||
|
-s "Allocating compression buffer" \
|
||||||
|
-c "Allocating compression buffer" \
|
||||||
|
-s "Record expansion is unknown (compression)" \
|
||||||
|
-c "Record expansion is unknown (compression)" \
|
||||||
|
-S "error" \
|
||||||
|
-C "error"
|
||||||
|
|
||||||
# Test current time in ServerHello
|
# Test current time in ServerHello
|
||||||
requires_config_enabled MBEDTLS_HAVE_TIME
|
requires_config_enabled MBEDTLS_HAVE_TIME
|
||||||
run_test "ServerHello contains gmt_unix_time" \
|
run_test "ServerHello contains gmt_unix_time" \
|
||||||
|
|
Loading…
Reference in a new issue