Skip to content

Commit 2448d48

Browse files
committed
wolfssl/wolfcrypt/error-crypt.h: move MPI error codes to range {-97, -100} to avoid collisions.
1 parent 05c4955 commit 2448d48

3 files changed

Lines changed: 8 additions & 12 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2627,7 +2627,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t error_test(void)
26272627
int first;
26282628
int last;
26292629
} missing[] = {
2630-
{ -6, -100 },
26312630
{ -124, -124 },
26322631
{ -166, -169 }
26332632
};

wolfssl/error-ssl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ enum wolfSSL_ErrorCodes {
220220
WOLFSSL_LOCAL
221221
void SetErrorString(int err, char* buff);
222222

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

wolfssl/wolfcrypt/error-crypt.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ the error status.
4343

4444
/* error codes, add string for new errors !!! */
4545
enum {
46-
MAX_CODE_E = -1, /* errors -2 - -299 */
47-
WC_FIRST_E = -2, /* errors -2 - -299 */
46+
MAX_CODE_E = -96, /* errors -97 - -299 */
47+
WC_FIRST_E = -97, /* errors -97 - -299 */
4848

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

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

307-
#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && !defined(BUILDING_WOLFSSL)
308-
#undef WOLFSSL_DEBUG_TRACE_ERROR_CODES
309-
#endif
310-
#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES
307+
#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && defined(BUILDING_WOLFSSL)
311308
extern void wc_backtrace_render(void);
312309
#define WC_NO_ERR_TRACE(label) (CONST_NUM_ERR_ ## label)
313310
#ifndef WOLFSSL_DEBUG_BACKTRACE_RENDER_CLAUSE

0 commit comments

Comments
 (0)