diff --git a/wolfcrypt/src/dh.c b/wolfcrypt/src/dh.c index 0aa313616..91f00a1f1 100644 --- a/wolfcrypt/src/dh.c +++ b/wolfcrypt/src/dh.c @@ -1357,6 +1357,8 @@ static int wc_DhGenerateKeyPair_Sync(DhKey* key, WC_RNG* rng, ret = GeneratePublicDh(key, priv, *privSz, pub, pubSz); if (ret == 0) ret = _ffc_validate_public_key(key, pub, *pubSz, NULL, 0, 0); + if (ret == 0) + ret = _ffc_pairwise_consistency_test(key, pub, *pubSz, priv, *privSz); return ret; } diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index ee337683e..b38b7054a 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -4829,6 +4829,11 @@ int wc_ecc_make_key_ex2(WC_RNG* rng, int keysize, ecc_key* key, int curve_id, if (err == MP_OKAY) { err = _ecc_validate_public_key(key, 0, 0); } +#if defined(WOLFSSL_VALIDATE_ECC_KEYGEN) || defined(WOLFSSL_VALIDATE_ECC_IMPORT) + if (err == MP_OKAY) { + err = _ecc_pairwise_consistency_test(key); + } +#endif return err; }