Skip to content

Commit 2f6cd76

Browse files
revert some macro guards for support with sp math
1 parent 2364b69 commit 2f6cd76

1 file changed

Lines changed: 29 additions & 11 deletions

File tree

wolfcrypt/src/ecc.c

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ ECC Curve Sizes:
260260
#define HAVE_ECC_CHECK_PUBKEY_ORDER
261261
#endif
262262

263-
264263
#if defined(WOLFSSL_SP_MATH_ALL) && SP_INT_BITS < MAX_ECC_BITS_NEEDED
265264
#define MAX_ECC_BITS_USE SP_INT_BITS
266265
#else
@@ -1848,7 +1847,10 @@ static void alt_fp_init(mp_int* a)
18481847
#endif /* ALT_ECC_SIZE */
18491848

18501849

1851-
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
1850+
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
1851+
!defined(WOLFSSL_CRYPTOCELL) && \
1852+
(!defined(WOLF_CRYPTO_CB_ONLY_ECC) || defined(WOLFSSL_QNX_CAAM) || \
1853+
defined(WOLFSSL_IMXRT1170_CAAM))
18521854

18531855
#if !defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_PUBLIC_ECC_ADD_DBL)
18541856
static int _ecc_projective_dbl_point(ecc_point *P, ecc_point *R, mp_int* a,
@@ -3977,7 +3979,7 @@ int wc_ecc_mulmod(const mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
39773979
return wc_ecc_mulmod_ex(k, G, R, a, modulus, map, NULL);
39783980
}
39793981

3980-
#endif /* !WOLFSSL_ATECC508A */
3982+
#endif
39813983

39823984
/**
39833985
* Allocate a new ECC point (if one not provided)
@@ -5144,7 +5146,10 @@ int wc_ecc_point_is_on_curve(ecc_point *p, int curve_idx)
51445146
}
51455147
#endif /* USE_ECC_B_PARAM */
51465148

5147-
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
5149+
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
5150+
!defined(WOLFSSL_CRYPTOCELL) && \
5151+
(!defined(WOLF_CRYPTO_CB_ONLY_ECC) || defined(WOLFSSL_QNX_CAAM) || \
5152+
defined(WOLFSSL_IMXRT1170_CAAM))
51485153
/* return 1 if point is at infinity, 0 if not, < 0 on error */
51495154
int wc_ecc_point_is_at_infinity(ecc_point* p)
51505155
{
@@ -5155,7 +5160,7 @@ int wc_ecc_point_is_at_infinity(ecc_point* p)
51555160

51565161
return 0;
51575162
}
5158-
#endif /* HAVE_ECC_CHECK_PUBKEY_ORDER */
5163+
#endif
51595164

51605165
/* generate random and ensure its greater than 0 and less than order */
51615166
int wc_ecc_gen_k(WC_RNG* rng, int size, mp_int* k, mp_int* order)
@@ -7772,7 +7777,10 @@ int wc_ecc_free(ecc_key* key)
77727777
return 0;
77737778
}
77747779

7775-
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
7780+
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
7781+
!defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_SP_MATH) && \
7782+
(!defined(WOLF_CRYPTO_CB_ONLY_ECC) || defined(WOLFSSL_QNX_CAAM) || \
7783+
defined(WOLFSSL_IMXRT1170_CAAM))
77767784

77777785
/* Handles add failure cases:
77787786
*
@@ -7887,7 +7895,11 @@ int ecc_projective_dbl_point_safe(ecc_point *P, ecc_point *R, mp_int* a,
78877895

78887896
return err;
78897897
}
7890-
#endif /* HAVE_ECC_CHECK_PUBKEY_ORDER */
7898+
#endif /* !(WOLFSSL_ATECC508A) && !(WOLFSSL_ATECC608A) && \
7899+
!(WOLFSSL_CRYPTOCELL) && !(WOLFSSL_SP_MATH) && \
7900+
(!(WOLF_CRYPTO_CB_ONLY_ECC) || (WOLFSSL_QNX_CAAM) || \
7901+
(WOLFSSL_IMXRT1170_CAAM))
7902+
*/
78917903

78927904
#if !defined(WOLFSSL_SP_MATH) && !defined(WOLFSSL_ATECC508A) && \
78937905
!defined(WOLFSSL_ATECC608A) && !defined(WOLFSSL_CRYPTOCELL) && \
@@ -9609,7 +9621,11 @@ int wc_ecc_export_x963_ex(ecc_key* key, byte* out, word32* outLen,
96099621
#endif /* HAVE_ECC_KEY_EXPORT */
96109622

96119623

9612-
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
9624+
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
9625+
!defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_SE050) && \
9626+
!defined(WOLFSSL_STM32_PKA) && \
9627+
(!defined(WOLF_CRYPTO_CB_ONLY_ECC) || defined(WOLFSSL_QNX_CAAM) || \
9628+
defined(WOLFSSL_IMXRT1170_CAAM))
96139629

96149630
/* is ecc point on curve described by dp ? */
96159631
static int _ecc_is_point(ecc_point* ecp, mp_int* a, mp_int* b, mp_int* prime)
@@ -10108,7 +10124,11 @@ static int ecc_check_pubkey_order(ecc_key* key, ecc_point* pubkey, mp_int* a,
1010810124
}
1010910125
#endif /* !WOLFSSL_SP_MATH */
1011010126

10111-
#endif /* HAVE_ECC_CHECK_PUBKEY_ORDER */
10127+
#endif /* !WOLFSSL_ATECC508A && !WOLFSSL_ATECC608A &&
10128+
!WOLFSSL_CRYPTOCELL && !WOLFSSL_SE050 && !WOLFSSL_STM32_PKA &&
10129+
(!WOLF_CRYPTO_CB_ONLY_ECC || WOLFSSL_QNX_CAAM ||
10130+
WOLFSSL_IMXRT1170_CAAM)
10131+
*/
1011210132

1011310133
#ifdef OPENSSL_EXTRA
1011410134
int wc_ecc_get_generator(ecc_point* ecp, int curve_idx)
@@ -10148,7 +10168,6 @@ int wc_ecc_get_generator(ecc_point* ecp, int curve_idx)
1014810168
static int _ecc_validate_public_key(ecc_key* key, int partial, int priv)
1014910169
{
1015010170
int err = MP_OKAY;
10151-
#ifndef WOLFSSL_SP_MATH
1015210171
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
1015310172
mp_int* b = NULL;
1015410173
#ifdef USE_ECC_B_PARAM
@@ -10160,7 +10179,6 @@ static int _ecc_validate_public_key(ecc_key* key, int partial, int priv)
1016010179
DECLARE_CURVE_SPECS(3);
1016110180
#endif /* USE_ECC_B_PARAM */
1016210181
#endif /* HAVE_ECC_CHECK_PUBKEY_ORDER */
10163-
#endif /* !WOLFSSL_SP_MATH */
1016410182

1016510183
ASSERT_SAVED_VECTOR_REGISTERS();
1016610184

0 commit comments

Comments
 (0)