guard check on prime with macro WOLFSSL_VALIDATE_ECC_IMPORT

This commit is contained in:
Jacob Barthelmeh 2021-02-08 20:25:01 +07:00
parent cced2038b8
commit 812b44d58e

View File

@ -6931,7 +6931,8 @@ int wc_ecc_import_point_der_ex(byte* in, word32 inLen, const int curve_idx,
(ECC_CURVE_FIELD_PRIME | ECC_CURVE_FIELD_AF |
ECC_CURVE_FIELD_BF));
#ifdef WOLFSSL_CUSTOM_CURVES
#if defined(WOLFSSL_CUSTOM_CURVES) && \
defined(WOLFSSL_VALIDATE_ECC_IMPORT)
/* validate prime is prime for custom curves */
if (err == MP_OKAY && curve_idx == ECC_CUSTOM_IDX) {
int isPrime = MP_NO;
@ -7838,7 +7839,8 @@ int wc_ecc_import_x963_ex(const byte* in, word32 inLen, ecc_key* key,
(ECC_CURVE_FIELD_PRIME | ECC_CURVE_FIELD_AF |
ECC_CURVE_FIELD_BF));
#ifdef WOLFSSL_CUSTOM_CURVES
#if defined(WOLFSSL_CUSTOM_CURVES) && \
defined(WOLFSSL_VALIDATE_ECC_IMPORT)
/* validate prime is prime for custom curves */
if (err == MP_OKAY && key->idx == ECC_CUSTOM_IDX) {
int isPrime = MP_NO;