aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Peskine <gilles.peskine@arm.com>2020-08-25 09:46:42 +0200
committerGitHub <noreply@github.com>2020-08-25 09:46:42 +0200
commit46b3fc221e421e04c5e8e3874eaca1169d7eebab (patch)
tree03f09bd02e1ae99c76f35b941cd8efef1576dbc5
parent24e2217922bcb5e08ba1ecf7410af85de7418bb9 (diff)
parent329fe7e0438f390815a01d127aabe37dd2eca525 (diff)
downloadmbed-tls-46b3fc221e421e04c5e8e3874eaca1169d7eebab.tar.gz
Merge pull request #3599 from makise-homura/mbedtls-2.7
Backport 2.7: Support building on e2k (Elbrus) architecture
-rw-r--r--ChangeLog.d/e2k-support.txt5
-rw-r--r--library/ssl_tls.c4
-rw-r--r--programs/pkey/dh_genprime.c2
-rw-r--r--tests/suites/helpers.function2
4 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog.d/e2k-support.txt b/ChangeLog.d/e2k-support.txt
new file mode 100644
index 000000000..023b1888e
--- /dev/null
+++ b/ChangeLog.d/e2k-support.txt
@@ -0,0 +1,5 @@
+Features
+ * Support building on e2k (Elbrus) architecture: correctly enable
+ -Wformat-signedness, and fix the code that causes signed-one-bit-field
+ and sign-compare warnings. Contributed by makise-homura (Igor Molchanov)
+ <akemi_homura@kurisa.ch>.
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 7df109d01..ee7a1cfb3 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -2579,7 +2579,7 @@ int mbedtls_ssl_fetch_input( mbedtls_ssl_context *ssl, size_t nb_want )
if( ret < 0 )
return( ret );
- if ( (size_t)ret > len || ( INT_MAX > SIZE_MAX && ret > SIZE_MAX ) )
+ if ( (size_t)ret > len || ( INT_MAX > SIZE_MAX && ret > (int)SIZE_MAX ) )
{
MBEDTLS_SSL_DEBUG_MSG( 1,
( "f_recv returned %d bytes but only %lu were requested",
@@ -2634,7 +2634,7 @@ int mbedtls_ssl_flush_output( mbedtls_ssl_context *ssl )
if( ret <= 0 )
return( ret );
- if( (size_t)ret > ssl->out_left || ( INT_MAX > SIZE_MAX && ret > SIZE_MAX ) )
+ if( (size_t)ret > ssl->out_left || ( INT_MAX > SIZE_MAX && ret > (int)SIZE_MAX ) )
{
MBEDTLS_SSL_DEBUG_MSG( 1,
( "f_send returned %d bytes but only %lu bytes were sent",
diff --git a/programs/pkey/dh_genprime.c b/programs/pkey/dh_genprime.c
index e2fe24b86..b0a6d7755 100644
--- a/programs/pkey/dh_genprime.c
+++ b/programs/pkey/dh_genprime.c
@@ -115,7 +115,7 @@ int main( int argc, char **argv )
{
usage:
mbedtls_printf( USAGE );
- mbedtls_exit( exit_code );
+ goto exit;
}
for( i = 1; i < argc; i++ )
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function
index d122dd69b..d2057861f 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -87,7 +87,7 @@ typedef UINT32 uint32_t;
/* A compile-time constant with the value 0. If `const_expr` is not a
* compile-time constant with a nonzero value, cause a compile-time error. */
#define STATIC_ASSERT_EXPR( const_expr ) \
- ( 0 && sizeof( struct { int STATIC_ASSERT : 1 - 2 * ! ( const_expr ); } ) )
+ ( 0 && sizeof( struct { unsigned int STATIC_ASSERT : 1 - 2 * ! ( const_expr ); } ) )
/* Return the scalar value `value` (possibly promoted). This is a compile-time
* constant if `value` is. `condition` must be a compile-time constant.
* If `condition` is false, arrange to cause a compile-time error. */