File error_common.h
Error codes.
Defines
-
MBEDTLS_ERR_ERROR_GENERIC_ERROR
-
MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED
-
MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
-
MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED
-
MBEDTLS_ERROR_ADD(high, low)
Combines a high-level and low-level error code together.
Wrapper macro for mbedtls_error_add(). See that function for more details.
Functions
-
static inline int mbedtls_error_add(int high, int low, const char *file, int line)
Combines a high-level and low-level error code together.
This function can be called directly however it is usually called via the #MBEDTLS_ERROR_ADD macro. While a value of zero is not a negative error code, it is still an error code (that denotes success) and can be combined with both a negative error code or another value of zero.
Note
The distinction between low-level and high-level error codes is obsolete since TF-PSA-Crypto 1.0 and Mbed TLS 4.0. It is still present in the code due to the heritage from Mbed TLS <=3, where low-level and high-level error codes could be added. New code should not make this distinction and should just propagate errors returned by lower-level modules unless there is a good reason to report a different error code in the higher-level module.
Note
When invasive testing is enabled via MBEDTLS_TEST_HOOKS, also try to call mbedtls_test_hook_error_add.
- Parameters:
high – High-level error code, i.e. error code from the module that is reporting the error. This can be 0 to just propagate a low-level error.
low – Low-level error code, i.e. error code returned by a lower-level function. This can be 0 to just return a high-level error.
file – file where this error code combination occurred.
line – line where this error code combination occurred.
Variables
-
void (*mbedtls_test_hook_error_add)(int, int, const char*, int)
Testing hook called before adding/combining two error codes together. Only used when invasive testing is enabled via MBEDTLS_TEST_HOOKS.