diff --git a/src/ssl.c b/src/ssl.c index aa7d326074..594cc0ceee 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -15361,9 +15361,7 @@ int wolfSSL_ERR_GET_REASON(unsigned long err) ret = 0 - ret; /* setting as negative value */ /* wolfCrypt range is less than MAX (-100) wolfSSL range is MIN (-300) and lower */ - if ((ret <= WC_FIRST_E && ret >= WC_LAST_E) || - (ret <= WOLFSSL_FIRST_E && ret >= WOLFSSL_LAST_E)) - { + if (ret < MAX_CODE_E && ret > MIN_CODE_E) { return ret; } else { diff --git a/wolfssl/wolfcrypt/error-crypt.h b/wolfssl/wolfcrypt/error-crypt.h index eb392fe72b..5587850a40 100644 --- a/wolfssl/wolfcrypt/error-crypt.h +++ b/wolfssl/wolfcrypt/error-crypt.h @@ -43,7 +43,6 @@ 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 */ MP_MEM = -2, /* MP dynamic memory allocation failed. */ @@ -52,6 +51,7 @@ enum { * partial completion. */ MP_NOT_INF = -5, /* MP point not at infinity */ + MAX_CODE_E = -100, /* errors -101 - -299 -- excludes MP codes */ OPEN_RAN_E = -101, /* opening random device error */ READ_RAN_E = -102, /* reading random device error */ WINCRYPT_E = -103, /* windows crypt init error */