1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +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:
Chris Jones
2021-01-26 17:50:48 +00:00
parent 808b7c8a8a
commit ef180af350
9 changed files with 57 additions and 64 deletions

View File

@ -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;