add second wolfCrypt error code span, and add DEADLOCK_AVERTED_E.

This commit is contained in:
Daniel Pouzzner
2024-11-13 13:01:00 -06:00
parent 524f0f5799
commit 0ebd86d668
8 changed files with 81 additions and 31 deletions

View File

@@ -642,11 +642,14 @@ const char* wc_GetErrorString(int error)
case PBKDF2_KAT_FIPS_E:
return "wolfCrypt FIPS PBKDF2 Known Answer Test Failure";
case DEADLOCK_AVERTED_E:
return "Deadlock averted -- retry the call";
case MAX_CODE_E:
case WC_SPAN1_MIN_CODE_E:
case MIN_CODE_E:
default:
return "unknown error number";
}
}
@@ -660,4 +663,3 @@ void wc_ErrorString(int error, char* buffer)
buffer[WOLFSSL_MAX_ERROR_SZ-1] = 0;
}
#endif /* !NO_ERROR_STRINGS */

View File

@@ -2777,14 +2777,16 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t error_test(void)
int last;
} missing[] = {
{ -124, -124 },
{ -166, -169 }
{ -166, -169 },
{ WC_SPAN1_LAST_E - 1, WC_SPAN2_FIRST_E + 1 },
{ WC_SPAN2_LAST_E - 1, WC_SPAN2_MIN_CODE_E }
};
/* Check that all errors have a string and it's the same through the two
* APIs. Check that the values that are not errors map to the unknown
* string.
*/
for (i = WC_FIRST_E; i >= WC_LAST_E; i--) {
for (i = WC_SPAN1_FIRST_E; i >= WC_SPAN2_MIN_CODE_E; i--) {
int this_missing = 0;
for (j = 0; j < (int)XELEM_CNT(missing); ++j) {
if ((i <= missing[j].first) && (i >= missing[j].last)) {