Skip to content

Commit 803a160

Browse files
authored
Merge pull request wolfSSL#8601 from dgarske/stm32_pka
Fix for STM32 PKA with P521 and shared secret
2 parents 3969dd5 + d235013 commit 803a160

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

wolfcrypt/src/port/st/stm32.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,6 @@ int wc_ecc_mulmod_ex2(const mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
702702
PKA_ECCMulInTypeDef pka_mul;
703703
PKA_ECCMulOutTypeDef pka_mul_res;
704704
int szModulus;
705-
int szkbin;
706705
int status;
707706
int res;
708707
uint8_t Gxbin[STM32_MAX_ECC_SIZE];
@@ -730,9 +729,8 @@ int wc_ecc_mulmod_ex2(const mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
730729
}
731730

732731
szModulus = mp_unsigned_bin_size(modulus);
733-
szkbin = mp_unsigned_bin_size(k);
734732

735-
res = stm32_get_from_mp_int(kbin, k, szkbin);
733+
res = stm32_get_from_mp_int(kbin, k, szModulus);
736734
if (res == MP_OKAY)
737735
res = stm32_get_from_mp_int(Gxbin, G->x, szModulus);
738736
if (res == MP_OKAY)
@@ -767,7 +765,7 @@ int wc_ecc_mulmod_ex2(const mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
767765
pka_mul.modulus = prime;
768766
pka_mul.pointX = Gxbin;
769767
pka_mul.pointY = Gybin;
770-
pka_mul.scalarMulSize = szkbin;
768+
pka_mul.scalarMulSize = szModulus;
771769
pka_mul.scalarMul = kbin;
772770
#ifdef WOLFSSL_STM32_PKA_V2
773771
pka_mul.coefB = coefB;

0 commit comments

Comments
 (0)