mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 22:35:43 +01:00
Improve documentation for error code checking
Improve comments explaining error code checking, fix incorrect comments and make a small formatting fix. Signed-off-by: Chris Jones <christopher.jones@arm.com>
This commit is contained in:
parent
fdb588b3a7
commit
e11e81413d
@ -122,7 +122,7 @@ extern "C" {
|
||||
/**
|
||||
* \brief Combines a high-level and low-level error code together.
|
||||
*
|
||||
* Wrapper function for mbedtls_err_add_ext(). See that function for
|
||||
* Wrapper macro for mbedtls_error_add_ext(). See that function for
|
||||
* more details.
|
||||
*/
|
||||
#define MBEDTLS_ERROR_ADD( high, low ) \
|
||||
|
@ -220,7 +220,7 @@ int mbedtls_ssl_cookie_check( void *p_ctx,
|
||||
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
if( mbedtls_mutex_unlock( &ctx->mutex ) != 0 )
|
||||
return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_SSL_INTERNAL_ERROR ,
|
||||
return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_SSL_INTERNAL_ERROR,
|
||||
MBEDTLS_ERR_THREADING_MUTEX_ERROR ) );
|
||||
#endif
|
||||
|
||||
|
@ -298,22 +298,34 @@ void mbedtls_test_err_add_check( int high, int low,
|
||||
* h = high level error code (includes high and module error codes).
|
||||
* l = low level error code.
|
||||
*/
|
||||
if ( high > -0x1000 && high != 0 ) // high < 0001000000000000
|
||||
if ( high > -0x1000 && high != 0 )
|
||||
/* high < 0001000000000000
|
||||
* No high level error bits are set.
|
||||
*/
|
||||
{
|
||||
mbedtls_test_fail( "'high' is not a high-level error code",
|
||||
line, file );
|
||||
}
|
||||
else if ( high < -0x7F80 ) // high > 0111111110000000
|
||||
else if ( high < -0x7F80 )
|
||||
/* high > 0111111110000000
|
||||
* Error code is larger than the greatest high + module level error.
|
||||
*/
|
||||
{
|
||||
mbedtls_test_fail( "'high' error code is greater than 15 bits",
|
||||
line, file );
|
||||
}
|
||||
else if ( ( high & 0x7F ) != 0 ) // high & 0000000001111111
|
||||
else if ( ( high & 0x7F ) != 0 )
|
||||
/* high & 0000000001111111
|
||||
* Error code contains low level error code bits.
|
||||
*/
|
||||
{
|
||||
mbedtls_test_fail( "'high' contains a low-level error code",
|
||||
line, file );
|
||||
}
|
||||
else if ( low < -0x007F ) // low > 0000000001111111
|
||||
else if ( low < -0x007F )
|
||||
/* low > 0000000001111111
|
||||
* Error code contains high or module level error code bits.
|
||||
*/
|
||||
{
|
||||
mbedtls_test_fail( "'low' error code is greater than 7 bits",
|
||||
line, file );
|
||||
|
Loading…
Reference in New Issue
Block a user