Merge remote-tracking branch 'upstream/pr/2983' into baremetal

* upstream/pr/2983:
  Fix mbedtls_strerror to work with all wanted codes
This commit is contained in:
Arto Kinnunen 2020-01-17 11:21:53 +02:00
commit 28ecfb002f
2 changed files with 6 additions and 6 deletions

View file

@ -224,9 +224,9 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
if( ret < 0 ) if( ret < 0 )
ret = -ret; ret = -ret;
if( ret & 0xFF80 ) if( ret & 0xFFFF80 )
{ {
use_ret = ret & 0xFF80; use_ret = ret & 0xFFFF80;
// High level error codes // High level error codes
// //
@ -580,7 +580,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret ); mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
} }
use_ret = ret & ~0xFF80; use_ret = ret & ~0xFFFF80;
if( use_ret == 0 ) if( use_ret == 0 )
return; return;

View file

@ -57,9 +57,9 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
if( ret < 0 ) if( ret < 0 )
ret = -ret; ret = -ret;
if( ret & 0xFF80 ) if( ret & 0xFFFF80 )
{ {
use_ret = ret & 0xFF80; use_ret = ret & 0xFFFF80;
// High level error codes // High level error codes
// //
@ -71,7 +71,7 @@ HIGH_LEVEL_CODE_CHECKS
mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret ); mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
} }
use_ret = ret & ~0xFF80; use_ret = ret & ~0xFFFF80;
if( use_ret == 0 ) if( use_ret == 0 )
return; return;