1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +03:00

Merge pull request #9693 from Harry-Ramsey/split-revert-error-development

Split error.h and move back error.c to mbedtls
This commit is contained in:
Ronald Cron
2024-10-25 13:12:58 +00:00
committed by GitHub
90 changed files with 205 additions and 174 deletions

View File

@ -21,6 +21,10 @@
#error "Error: MBEDTLS_PSA_CRYPTO_C must be enabled on server build"
#endif
#if defined(MBEDTLS_TEST_HOOKS)
void (*mbedtls_test_hook_error_add)(int, int, const char *, int);
#endif
// Returns 1 for success, 0 for failure
int psa_crypto_init_wrapper(
uint8_t *in_params, size_t in_params_len,

View File

@ -170,7 +170,7 @@ check scripts/generate_driver_wrappers.py ${crypto_core_dir}/psa_crypto_driver_w
# Additional checks for Mbed TLS only
if in_mbedtls_repo; then
check scripts/generate_errors.pl ${builtin_drivers_dir}/error.c
check scripts/generate_errors.pl library/error.c
check scripts/generate_query_config.pl programs/test/query_config.c
check scripts/generate_features.pl library/version_features.c
check framework/scripts/generate_ssl_debug_helpers.py library/ssl_debug_helpers_generated.c

View File

@ -717,4 +717,7 @@ void mbedtls_test_err_add_check(int high, int low,
line, file);
}
}
void (*mbedtls_test_hook_error_add)(int, int, const char *, int);
#endif /* MBEDTLS_TEST_HOOKS */

View File

@ -0,0 +1,21 @@
Single low error
depends_on:MBEDTLS_AES_C
error_strerror:-0x0020:"AES - Invalid key length"
Single high error
depends_on:MBEDTLS_RSA_C
error_strerror:-0x4080:"RSA - Bad input parameters to function"
Low and high error
depends_on:MBEDTLS_AES_C:MBEDTLS_RSA_C
error_strerror:-0x40A0:"RSA - Bad input parameters to function \: AES - Invalid key length"
Non existing high error
error_strerror:-0x8880:"UNKNOWN ERROR CODE (8880)"
Non existing low error
error_strerror:-0x007F:"UNKNOWN ERROR CODE (007F)"
Non existing low and high error
error_strerror:-0x88FF:"UNKNOWN ERROR CODE (8880) \: UNKNOWN ERROR CODE (007F)"

View File

@ -0,0 +1,21 @@
/* BEGIN_HEADER */
#include "mbedtls/error.h"
/* END_HEADER */
/* BEGIN_DEPENDENCIES
* depends_on:MBEDTLS_ERROR_C
* END_DEPENDENCIES
*/
/* BEGIN_CASE */
void error_strerror(int code, char *result_str)
{
char buf[500];
memset(buf, 0, sizeof(buf));
mbedtls_strerror(code, buf, 500);
TEST_ASSERT(strcmp(buf, result_str) == 0);
}
/* END_CASE */