Giter Club home page Giter Club logo

Comments (1)

kmackay avatar kmackay commented on August 31, 2024

No. Rx[0] and Ry[0] are initialized by XYcZ_initial_double(). Also,
bitcount_t is signed, so adding a check to see if p_numBits > 2 is
unnecessary.

On Fri, Feb 27, 2015 at 2:37 AM, azahido [email protected] wrote:

hello,
please I detect a bug in the function:
EccPoint_mult(EccPoint * RESTRICT p_result, EccPoint * RESTRICT p_point,
const uECC_word_t * RESTRICT p_scalar, const uECC_word_t * RESTRICT
p_initialZ, bitcount_t p_numBits),

the issue are, missed an initialization for Rx[0] and Ry[0] :
the solution proposed is to add the Rx[0] initial value:
vli_set(Rx[0], p_point->x);//Rx[0]
vli_set(Ry[0], p_point->y); //Rx[0]
we should add a test for p_numBits because there as an 2

P are added in the result , please find the code modified below, now it
work fine and the result compared with others calculators now we can
compute the multiplication points successfully. code corrected: static void
EccPoint_mult(EccPoint * RESTRICT p_result, EccPoint * RESTRICT p_point,
const uECC_word_t * RESTRICT p_scalar, const uECC_word_t * RESTRICT
p_initialZ, bitcount_t p_numBits) { /
R0 and R1 */
uECC_word_t Rx[2][uECC_WORDS];
uECC_word_t Ry[2][uECC_WORDS];
uECC_word_t A[1][uECC_WORDS];
uECC_word_t t;
uECC_word_t z[uECC_WORDS];

bitcount_t i;
uECC_word_t nb;

vli_set(Rx[1], p_point->x);//Rx[1]
vli_set(Ry[1], p_point->y); //Rx[1]
vli_set(Rx[0], p_point->x);//Rx[0]
vli_set(Ry[0], p_point->y); //Rx[0]
if((p_numBits)>=2)
{
XYcZ_initial_double(Rx[1], Ry[1], Rx[0], Ry[0], p_initialZ);
for(i = p_numBits - 2; i > 0; --i)
{
nb =! vli_testBit(p_scalar, i);//=!
XYcZ_addC(Rx[1-nb], Ry[1-nb], Rx[nb], Ry[nb]);
XYcZ_add(Rx[nb], Ry[nb], Rx[1-nb], Ry[1-nb]);
}
nb =! vli_testBit(p_scalar, 0);//=!
XYcZ_addC(Rx[1-nb], Ry[1-nb], Rx[nb], Ry[nb]);
vli_modSub_fast(z, Rx[1], Rx[0]); /* X1 - X0 /
vli_modMult_fast(z, z, Ry[1-nb]); /
Yb * (X1 - X0) /
vli_modMult_fast(z, z, p_point->x); /
xP * Yb * (X1 - X0) /
vli_modInv(z, z, curve_p); /
1 / (xP * Yb * (X1 - X0)) /
vli_modMult_fast(z, z, p_point->y); /
yP / (xP * Yb * (X1 - X0)) /
vli_modMult_fast(z, z, Rx[1-nb]); /
Xb * yP / (xP * Yb * (X1 - X0)) /
/
End 1/Z calculation */

XYcZ_add(Rx[nb], Ry[nb], Rx[1-nb], Ry[1-nb]);
apply_z(Rx[0], Ry[0], z);

/* Find final 1/Z value. */

}

vli_set(p_result->x, Rx[0]);
vli_set(p_result->y, Ry[0]);

}

good luck


Reply to this email directly or view it on GitHub
#21.

from micro-ecc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.