forked from wolfSSL/wolfssl
revert some macro guards for support with sp math
This commit is contained in:
@@ -260,7 +260,6 @@ ECC Curve Sizes:
|
|||||||
#define HAVE_ECC_CHECK_PUBKEY_ORDER
|
#define HAVE_ECC_CHECK_PUBKEY_ORDER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(WOLFSSL_SP_MATH_ALL) && SP_INT_BITS < MAX_ECC_BITS_NEEDED
|
#if defined(WOLFSSL_SP_MATH_ALL) && SP_INT_BITS < MAX_ECC_BITS_NEEDED
|
||||||
#define MAX_ECC_BITS_USE SP_INT_BITS
|
#define MAX_ECC_BITS_USE SP_INT_BITS
|
||||||
#else
|
#else
|
||||||
@@ -1848,7 +1847,10 @@ static void alt_fp_init(mp_int* a)
|
|||||||
#endif /* ALT_ECC_SIZE */
|
#endif /* ALT_ECC_SIZE */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
|
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
|
||||||
|
!defined(WOLFSSL_CRYPTOCELL) && \
|
||||||
|
(!defined(WOLF_CRYPTO_CB_ONLY_ECC) || defined(WOLFSSL_QNX_CAAM) || \
|
||||||
|
defined(WOLFSSL_IMXRT1170_CAAM))
|
||||||
|
|
||||||
#if !defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_PUBLIC_ECC_ADD_DBL)
|
#if !defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_PUBLIC_ECC_ADD_DBL)
|
||||||
static int _ecc_projective_dbl_point(ecc_point *P, ecc_point *R, mp_int* a,
|
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,
|
|||||||
return wc_ecc_mulmod_ex(k, G, R, a, modulus, map, NULL);
|
return wc_ecc_mulmod_ex(k, G, R, a, modulus, map, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !WOLFSSL_ATECC508A */
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a new ECC point (if one not provided)
|
* 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)
|
|||||||
}
|
}
|
||||||
#endif /* USE_ECC_B_PARAM */
|
#endif /* USE_ECC_B_PARAM */
|
||||||
|
|
||||||
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
|
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
|
||||||
|
!defined(WOLFSSL_CRYPTOCELL) && \
|
||||||
|
(!defined(WOLF_CRYPTO_CB_ONLY_ECC) || defined(WOLFSSL_QNX_CAAM) || \
|
||||||
|
defined(WOLFSSL_IMXRT1170_CAAM))
|
||||||
/* return 1 if point is at infinity, 0 if not, < 0 on error */
|
/* return 1 if point is at infinity, 0 if not, < 0 on error */
|
||||||
int wc_ecc_point_is_at_infinity(ecc_point* p)
|
int wc_ecc_point_is_at_infinity(ecc_point* p)
|
||||||
{
|
{
|
||||||
@@ -5155,7 +5160,7 @@ int wc_ecc_point_is_at_infinity(ecc_point* p)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ECC_CHECK_PUBKEY_ORDER */
|
#endif
|
||||||
|
|
||||||
/* generate random and ensure its greater than 0 and less than order */
|
/* generate random and ensure its greater than 0 and less than order */
|
||||||
int wc_ecc_gen_k(WC_RNG* rng, int size, mp_int* k, mp_int* order)
|
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)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
|
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
|
||||||
|
!defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_SP_MATH) && \
|
||||||
|
(!defined(WOLF_CRYPTO_CB_ONLY_ECC) || defined(WOLFSSL_QNX_CAAM) || \
|
||||||
|
defined(WOLFSSL_IMXRT1170_CAAM))
|
||||||
|
|
||||||
/* Handles add failure cases:
|
/* Handles add failure cases:
|
||||||
*
|
*
|
||||||
@@ -7887,7 +7895,11 @@ int ecc_projective_dbl_point_safe(ecc_point *P, ecc_point *R, mp_int* a,
|
|||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ECC_CHECK_PUBKEY_ORDER */
|
#endif /* !(WOLFSSL_ATECC508A) && !(WOLFSSL_ATECC608A) && \
|
||||||
|
!(WOLFSSL_CRYPTOCELL) && !(WOLFSSL_SP_MATH) && \
|
||||||
|
(!(WOLF_CRYPTO_CB_ONLY_ECC) || (WOLFSSL_QNX_CAAM) || \
|
||||||
|
(WOLFSSL_IMXRT1170_CAAM))
|
||||||
|
*/
|
||||||
|
|
||||||
#if !defined(WOLFSSL_SP_MATH) && !defined(WOLFSSL_ATECC508A) && \
|
#if !defined(WOLFSSL_SP_MATH) && !defined(WOLFSSL_ATECC508A) && \
|
||||||
!defined(WOLFSSL_ATECC608A) && !defined(WOLFSSL_CRYPTOCELL) && \
|
!defined(WOLFSSL_ATECC608A) && !defined(WOLFSSL_CRYPTOCELL) && \
|
||||||
@@ -9609,7 +9621,11 @@ int wc_ecc_export_x963_ex(ecc_key* key, byte* out, word32* outLen,
|
|||||||
#endif /* HAVE_ECC_KEY_EXPORT */
|
#endif /* HAVE_ECC_KEY_EXPORT */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
|
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
|
||||||
|
!defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_SE050) && \
|
||||||
|
!defined(WOLFSSL_STM32_PKA) && \
|
||||||
|
(!defined(WOLF_CRYPTO_CB_ONLY_ECC) || defined(WOLFSSL_QNX_CAAM) || \
|
||||||
|
defined(WOLFSSL_IMXRT1170_CAAM))
|
||||||
|
|
||||||
/* is ecc point on curve described by dp ? */
|
/* is ecc point on curve described by dp ? */
|
||||||
static int _ecc_is_point(ecc_point* ecp, mp_int* a, mp_int* b, mp_int* prime)
|
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,
|
|||||||
}
|
}
|
||||||
#endif /* !WOLFSSL_SP_MATH */
|
#endif /* !WOLFSSL_SP_MATH */
|
||||||
|
|
||||||
#endif /* HAVE_ECC_CHECK_PUBKEY_ORDER */
|
#endif /* !WOLFSSL_ATECC508A && !WOLFSSL_ATECC608A &&
|
||||||
|
!WOLFSSL_CRYPTOCELL && !WOLFSSL_SE050 && !WOLFSSL_STM32_PKA &&
|
||||||
|
(!WOLF_CRYPTO_CB_ONLY_ECC || WOLFSSL_QNX_CAAM ||
|
||||||
|
WOLFSSL_IMXRT1170_CAAM)
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef OPENSSL_EXTRA
|
#ifdef OPENSSL_EXTRA
|
||||||
int wc_ecc_get_generator(ecc_point* ecp, int curve_idx)
|
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)
|
|||||||
static int _ecc_validate_public_key(ecc_key* key, int partial, int priv)
|
static int _ecc_validate_public_key(ecc_key* key, int partial, int priv)
|
||||||
{
|
{
|
||||||
int err = MP_OKAY;
|
int err = MP_OKAY;
|
||||||
#ifndef WOLFSSL_SP_MATH
|
|
||||||
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
|
#ifdef HAVE_ECC_CHECK_PUBKEY_ORDER
|
||||||
mp_int* b = NULL;
|
mp_int* b = NULL;
|
||||||
#ifdef USE_ECC_B_PARAM
|
#ifdef USE_ECC_B_PARAM
|
||||||
@@ -10160,7 +10179,6 @@ static int _ecc_validate_public_key(ecc_key* key, int partial, int priv)
|
|||||||
DECLARE_CURVE_SPECS(3);
|
DECLARE_CURVE_SPECS(3);
|
||||||
#endif /* USE_ECC_B_PARAM */
|
#endif /* USE_ECC_B_PARAM */
|
||||||
#endif /* HAVE_ECC_CHECK_PUBKEY_ORDER */
|
#endif /* HAVE_ECC_CHECK_PUBKEY_ORDER */
|
||||||
#endif /* !WOLFSSL_SP_MATH */
|
|
||||||
|
|
||||||
ASSERT_SAVED_VECTOR_REGISTERS();
|
ASSERT_SAVED_VECTOR_REGISTERS();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user