From 19aaaf4620dd671d502ef4630715870f6af82261 Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Fri, 16 Jul 2021 14:43:14 +0800 Subject: [PATCH 1/2] fix unused-function warning Prepare for enable MBEDTLS_PROTO_* Change-Id: Ib55054eb1e6a0cd0a337ae64105817f025717150 CustomizedGitHooks: yes Signed-off-by: Jerry Yu --- tests/suites/test_suite_mps.function | 44 ---------------------------- 1 file changed, 44 deletions(-) diff --git a/tests/suites/test_suite_mps.function b/tests/suites/test_suite_mps.function index 02e0166d7661..8f84b338bc80 100644 --- a/tests/suites/test_suite_mps.function +++ b/tests/suites/test_suite_mps.function @@ -528,50 +528,6 @@ static void build_mock_transforms( mbedtls_mps_transform_wrap_t *ptr0, ptr1->mock.pad = pad; } -static void write_version( int major, int minor, int transport, - unsigned char ver[2] ) -{ -#if defined(MBEDTLS_SSL_PROTO_DTLS) - if( transport == MBEDTLS_MPS_MODE_DATAGRAM ) - { - if( minor == MBEDTLS_SSL_MINOR_VERSION_2 ) - --minor; /* DTLS 1.0 stored as TLS 1.1 internally */ - - ver[0] = (unsigned char)( 255 - ( major - 2 ) ); - ver[1] = (unsigned char)( 255 - ( minor - 1 ) ); - } - else -#else - ((void) transport); -#endif - { - ver[0] = (unsigned char) major; - ver[1] = (unsigned char) minor; - } -} - -static void read_version( int *major, int *minor, int transport, - const unsigned char ver[2] ) -{ -#if defined(MBEDTLS_SSL_PROTO_DTLS) - if( transport == MBEDTLS_MPS_MODE_DATAGRAM ) - { - *major = 255 - ver[0] + 2; - *minor = 255 - ver[1] + 1; - - if( *minor == MBEDTLS_SSL_MINOR_VERSION_1 ) - ++*minor; /* DTLS 1.0 stored as TLS 1.1 internally */ - } - else -#else - ((void) transport); -#endif - { - *major = ver[0]; - *minor = ver[1]; - } -} - #define CHK( x ) \ do \ { \ From c3ff9294e70ff0f98e99bd33965002e475158117 Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Tue, 20 Jul 2021 17:52:45 +0800 Subject: [PATCH 2/2] remove MBEDTLS_SSL_PROTO_TLS1_2_OR_EARLIER MBEDTLS_SSL_PROTO_TLS1_2_OR_EARLIER is defined in ssl_internal.h. It is not included in all files. So it should not be used in ssl.h Change-Id: Iedc65ca1287db1a4accad9a89e83e8ab1612e65b CustomizedGitHooks: yes Signed-off-by: Jerry Yu --- include/mbedtls/ssl.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index 30ed6c9be2f8..6b8317c30f2c 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -1577,10 +1577,16 @@ struct mbedtls_ssl_context mbedtls_ssl_transform *transform_in; /*!< current transform params (in) */ mbedtls_ssl_transform *transform_out; /*!< current transform params (in) */ -#if defined(MBEDTLS_SSL_PROTO_TLS1_2_OR_EARLIER) +#if defined(MBEDTLS_SSL_PROTO_SSL3) || \ + defined(MBEDTLS_SSL_PROTO_TLS1) || \ + defined(MBEDTLS_SSL_PROTO_TLS1_1) || \ + defined(MBEDTLS_SSL_PROTO_TLS1_2) mbedtls_ssl_transform *transform; /*!< negotiated transform params */ mbedtls_ssl_transform *transform_negotiate; /*!< transform params in negotiation */ -#endif /* MBEDTLS_SSL_PROTO_TLS1_2_OR_EARLIER */ +#endif /* defined(MBEDTLS_SSL_PROTO_SSL3) || \ + defined(MBEDTLS_SSL_PROTO_TLS1) || \ + defined(MBEDTLS_SSL_PROTO_TLS1_1) || \ + defined(MBEDTLS_SSL_PROTO_TLS1_2) */ #if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL) mbedtls_ssl_transform *transform_handshake;