Skip to content

Commit

Permalink
wolfssl/wolfcrypt/error-crypt.h: move MPI error codes to range {-97, …
Browse files Browse the repository at this point in the history
…-100} to avoid collisions.
  • Loading branch information
douzzer committed Aug 21, 2024
1 parent 05c4955 commit 2448d48
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion wolfcrypt/test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2627,7 +2627,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t error_test(void)
int first;
int last;
} missing[] = {
{ -6, -100 },
{ -124, -124 },
{ -166, -169 }
};
Expand Down
2 changes: 1 addition & 1 deletion wolfssl/error-ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ enum wolfSSL_ErrorCodes {
WOLFSSL_LOCAL
void SetErrorString(int err, char* buff);

#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES
#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && defined(BUILDING_WOLFSSL)
#include <wolfssl/debug-trace-error-codes.h>
#endif

Expand Down
17 changes: 7 additions & 10 deletions wolfssl/wolfcrypt/error-crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ the error status.

/* error codes, add string for new errors !!! */
enum {
MAX_CODE_E = -1, /* errors -2 - -299 */
WC_FIRST_E = -2, /* errors -2 - -299 */
MAX_CODE_E = -96, /* errors -97 - -299 */
WC_FIRST_E = -97, /* errors -97 - -299 */

MP_MEM = -2, /* MP dynamic memory allocation failed. */
MP_VAL = -3, /* MP value passed is not able to be used. */
MP_WOULDBLOCK = -4, /* MP non-blocking operation is returning after
MP_MEM = -97, /* MP dynamic memory allocation failed. */
MP_VAL = -98, /* MP value passed is not able to be used. */
MP_WOULDBLOCK = -99, /* MP non-blocking operation is returning after
* partial completion. */
MP_NOT_INF = -5, /* MP point not at infinity */
MP_NOT_INF = -100, /* MP point not at infinity */

OPEN_RAN_E = -101, /* opening random device error */
READ_RAN_E = -102, /* reading random device error */
Expand Down Expand Up @@ -304,10 +304,7 @@ WOLFSSL_API void wc_ErrorString(int err, char* buff);
WOLFSSL_ABI WOLFSSL_API const char* wc_GetErrorString(int error);
#endif

#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && !defined(BUILDING_WOLFSSL)
#undef WOLFSSL_DEBUG_TRACE_ERROR_CODES
#endif
#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES
#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && defined(BUILDING_WOLFSSL)
extern void wc_backtrace_render(void);
#define WC_NO_ERR_TRACE(label) (CONST_NUM_ERR_ ## label)
#ifndef WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE
Expand Down

0 comments on commit 2448d48

Please sign in to comment.