Topic: Problem with ECC point multiplication
Hi,
I am verifying ECC functionality with wolfssl library v3.3.0.
I am Facing issue while testing point multiplication operation.
I am taking input vectors from Bluetooth SIG certification standard to verify curve P-256 point multiplication .
I have attached screenshot for the input vectors.
I have taken vectors from P-256 Data set 1(Please check the attachment).
P-256 ECC multiplication :
DH Key = Private A * (Public B(x), Public B(y), Bz)
Where Bz = 00000000000000000000000000000001
Please note that values from left to right is LSB to MSB.
Modulus values used as below:
const uint8 p256_modulus[32] = {0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
I am using following wolfssl function for computing point multiplication.
static int ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R, mp_int* modulus, int map)
Wolfssl library is expecting inputs in mp_int format. So I have converted standard inputs into mp_int format and then given to ecc_mulmod() function.
But result is not coming as expected.(Results should match as per the standard)
input conversion:
Private A value is converted to mp_int format and provided as 'k' to ecc_mulmod()
Public Bx, Public By, Bz values are converted into mp_int formats and converted as ecc_point then provided as 'G' to ecc_mulmod()
p256_modulus is converted as mp_int format and given as 'modulus' to ecc_mulmod()
'map' value is given as '0'
Function is not returning any error but final result is not matching with the expected result
(Please check DH key value in the attachment for the expected result)
Could you please check why result is not matching with these vectors ?
Thanks in advance.