diff --git a/library/error.c b/library/error.c index 74c9d0b39..ecdec785b 100644 --- a/library/error.c +++ b/library/error.c @@ -224,9 +224,9 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen ) if( ret < 0 ) ret = -ret; - if( ret & 0xFF80 ) + if( ret & 0xFFFF80 ) { - use_ret = ret & 0xFF80; + use_ret = ret & 0xFFFF80; // 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 ); } - use_ret = ret & ~0xFF80; + use_ret = ret & ~0xFFFF80; if( use_ret == 0 ) return; diff --git a/scripts/data_files/error.fmt b/scripts/data_files/error.fmt index 4be2d85d0..2e2a5b394 100644 --- a/scripts/data_files/error.fmt +++ b/scripts/data_files/error.fmt @@ -57,9 +57,9 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen ) if( ret < 0 ) ret = -ret; - if( ret & 0xFF80 ) + if( ret & 0xFFFF80 ) { - use_ret = ret & 0xFF80; + use_ret = ret & 0xFFFF80; // High level error codes // @@ -71,7 +71,7 @@ HIGH_LEVEL_CODE_CHECKS mbedtls_snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret ); } - use_ret = ret & ~0xFF80; + use_ret = ret & ~0xFFFF80; if( use_ret == 0 ) return;