Skip to content

Commit

Permalink
wolfssl/wolfcrypt/error-crypt.h: when !WOLFSSL_DEBUG_TRACE_ERROR_CODE…
Browse files Browse the repository at this point in the history
…S, use macros for the MPI error codes, for backward compat; wolfssl/wolfcrypt/sp_int.h: include wolfssl/wolfcrypt/error-crypt.h, to assure MPI error codes are defined.
  • Loading branch information
douzzer committed Aug 21, 2024
1 parent a7998a2 commit 77c5aab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions wolfssl/wolfcrypt/error-crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,21 @@ enum {
MAX_CODE_E = -1, /* errors -2 - -299 */
WC_FIRST_E = -2, /* errors -2 - -299 */

#ifdef WOLFSSL_DEBUG_TRACE_ERROR_CODES
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
* partial completion. */
MP_NOT_INF = -5, /* MP point not at infinity */
#else /* !WOLFSSL_DEBUG_TRACE_ERROR_CODES */
/* by default, use macros to define the MPI error codes, for backward
* compatibility.
*/
#define MP_MEM (-2)
#define MP_VAL (-3)
#define MP_WOULDBLOCK (-4)
#define MP_NOT_INF (-5)
#endif /* !WOLFSSL_DEBUG_TRACE_ERROR_CODES */

OPEN_RAN_E = -101, /* opening random device error */
READ_RAN_E = -102, /* reading random device error */
Expand Down
5 changes: 3 additions & 2 deletions wolfssl/wolfcrypt/sp_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ This library provides single precision (SP) integer math functions.
#ifndef WOLFSSL_LINUXKM
#include <limits.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/hash.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
#include <wolfssl/wolfcrypt/hash.h>

#ifdef __cplusplus
extern "C" {
Expand Down

0 comments on commit 77c5aab

Please sign in to comment.