Merge pull request #8188 from douzzer/20241114-wc_mp_sign_t

20241114-wc_mp_sign_t
This commit is contained in:
David Garske
2024-11-15 08:36:42 -08:00
committed by GitHub
4 changed files with 10 additions and 10 deletions

View File

@ -149,10 +149,10 @@ int mp_cond_copy(mp_int* a, int copy, mp_int* b)
for (; i < b->used; i++) { for (; i < b->used; i++) {
b->dp[i] ^= (get_digit(a, (int)i) ^ get_digit(b, (int)i)) & mask; b->dp[i] ^= (get_digit(a, (int)i) ^ get_digit(b, (int)i)) & mask;
} }
b->used ^= (a->used ^ b->used) & (mp_size_t)mask; b->used ^= (a->used ^ b->used) & (wc_mp_size_t)mask;
#if (!defined(WOLFSSL_SP_MATH) && !defined(WOLFSSL_SP_MATH_ALL)) || \ #if (!defined(WOLFSSL_SP_MATH) && !defined(WOLFSSL_SP_MATH_ALL)) || \
defined(WOLFSSL_SP_INT_NEGATIVE) defined(WOLFSSL_SP_INT_NEGATIVE)
b->sign ^= (mp_sign_t)(a->sign ^ b->sign) & (mp_sign_t)mask; b->sign ^= (wc_mp_sign_t)(a->sign ^ b->sign) & (wc_mp_sign_t)mask;
#endif #endif
} }
@ -194,7 +194,7 @@ int mp_rand(mp_int* a, int digits, WC_RNG* rng)
ret = BAD_FUNC_ARG; ret = BAD_FUNC_ARG;
} }
if (ret == MP_OKAY) { if (ret == MP_OKAY) {
a->used = (mp_size_t)digits; a->used = (wc_mp_size_t)digits;
} }
#endif #endif
/* fill the data with random bytes */ /* fill the data with random bytes */

View File

@ -222,8 +222,8 @@ typedef int mp_err;
#define WOLF_BIGINT_DEFINED #define WOLF_BIGINT_DEFINED
#endif #endif
#define mp_size_t int #define wc_mp_size_t int
#define mp_sign_t int #define wc_mp_sign_t int
/* the mp_int structure */ /* the mp_int structure */
typedef struct mp_int { typedef struct mp_int {

View File

@ -704,7 +704,7 @@ typedef struct sp_ecc_ctx {
if ((a)->used > 0) { \ if ((a)->used > 0) { \
for (ii = (int)(a)->used - 1; ii >= 0 && (a)->dp[ii] == 0; ii--) { \ for (ii = (int)(a)->used - 1; ii >= 0 && (a)->dp[ii] == 0; ii--) { \
} \ } \
(a)->used = (mp_size_t)(ii + 1); \ (a)->used = (wc_mp_size_t)(ii + 1); \
} \ } \
} while (0) } while (0)
@ -880,10 +880,10 @@ typedef unsigned int sp_size_t;
#endif #endif
/* Type for number of digits. */ /* Type for number of digits. */
#define mp_size_t sp_size_t #define wc_mp_size_t sp_size_t
#ifdef WOLFSSL_SP_INT_NEGATIVE #ifdef WOLFSSL_SP_INT_NEGATIVE
typedef sp_uint8 sp_sign_t; typedef sp_uint8 sp_sign_t;
#define mp_sign_t sp_sign_t #define wc_mp_sign_t sp_sign_t
#endif #endif
/** /**

View File

@ -379,8 +379,8 @@ while (0)
#define WOLF_BIGINT_DEFINED #define WOLF_BIGINT_DEFINED
#endif #endif
#define mp_size_t int #define wc_mp_size_t int
#define mp_sign_t int #define wc_mp_sign_t int
/* a FP type */ /* a FP type */
typedef struct fp_int { typedef struct fp_int {