mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-28 00:21:48 +03:00
Move MBEDTLS_ERR_ADD
macro and functions to error.*
`error.c` and error.h are the more logical place to keep this code and it prevents issues with building `common.c` and conflicts with other projects that use mbedtls (such as mbedOS). `error.c` has been automatically generated by first adding the code to `error.fmt` and then running `./scripts/generate_errors.pl`. Also add parenthesis to the addition in `MBEDTLS_ERR_ADD`. Signed-off-by: Chris Jones <christopher.jones@arm.com>
This commit is contained in:
@ -82,6 +82,22 @@ LOW_LEVEL_CODE_CHECKS
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_TEST_HOOKS)
|
||||
static void (*err_add_hook)( int, int, const char *, int );
|
||||
|
||||
void mbedtls_set_err_add_hook(void *hook)
|
||||
{
|
||||
err_add_hook = hook;
|
||||
}
|
||||
|
||||
int mbedtls_err_add( int high, int low, const char *file, int line )
|
||||
{
|
||||
if( err_add_hook != NULL )
|
||||
(*err_add_hook)( high, low, file, line );
|
||||
return ( high + low );
|
||||
}
|
||||
#endif /* MBEDTLS_TEST_HOOKS */
|
||||
|
||||
void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||
{
|
||||
size_t len;
|
||||
|
Reference in New Issue
Block a user