@@ -4455,7 +4455,7 @@ int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out,
44554455 !defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_KCAPI_ECC) && \
44564456 !defined(WOLF_CRYPTO_CB_ONLY_ECC)
44574457
4458- static int wc_ecc_shared_secret_gen_sync(ecc_key* private_key, ecc_point* point,
4458+ int wc_ecc_shared_secret_gen_sync(ecc_key* private_key, ecc_point* point,
44594459 byte* out, word32* outlen)
44604460{
44614461 int err = MP_OKAY;
@@ -4749,11 +4749,6 @@ static int wc_ecc_shared_secret_gen_async(ecc_key* private_key,
47494749 &curve->Af->raw, &curve->Bf->raw, &curve->prime->raw,
47504750 private_key->dp->cofactor);
47514751 #endif
4752-
4753- if (err == WC_PENDING_E) {
4754- /* advance state, next call will handle return code processing */
4755- private_key->state++;
4756- }
47574752 }
47584753 else
47594754#elif defined(WOLFSSL_ASYNC_CRYPT_SW)
@@ -4772,6 +4767,10 @@ static int wc_ecc_shared_secret_gen_async(ecc_key* private_key,
47724767 err = wc_ecc_shared_secret_gen_sync(private_key, point, out, outlen);
47734768 }
47744769
4770+ if (err == WC_PENDING_E) {
4771+ private_key->state++;
4772+ }
4773+
47754774#if defined(HAVE_CAVIUM_V) || defined(HAVE_INTEL_QA)
47764775 wc_ecc_curve_free(curve);
47774776 FREE_CURVE_SPECS();
@@ -4826,8 +4825,7 @@ int wc_ecc_shared_secret_ex(ecc_key* private_key, ecc_point* point,
48264825 err = wc_ecc_shared_secret_gen_async(private_key, point,
48274826 out, outlen);
48284827 if (err == 0) {
4829- /* advance state and exit early */
4830- private_key->state++;
4828+ /* exit early */
48314829 RESTORE_VECTOR_REGISTERS();
48324830 return err;
48334831 }
@@ -8352,6 +8350,7 @@ static int ecc_verify_hash(mp_int *r, mp_int *s, const byte* hash,
83528350 if (NitroxEccIsCurveSupported(key))
83538351 #endif
83548352 {
8353+ word32 keySz = (word32)key->dp->size;
83558354 err = wc_mp_to_bigint_sz(e, &e->raw, keySz);
83568355 if (err == MP_OKAY)
83578356 err = wc_mp_to_bigint_sz(key->pubkey.x, &key->pubkey.x->raw, keySz);
0 commit comments