Comments (1)
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 2P 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)
- Contact for responsible disclosure HOT 2
- Check for identity element is missing during verification
- Question about the public private key generation using secp160r1
- how to set the RNG function? HOT 2
- HASH out value differnet on same file? HOT 6
- Hard fault on cortex M0+
- With latest IAR ARM Embedded workbench version 9.32 not able to compile this code HOT 2
- Earlyclobber inline asm input registers
- easy-ecc compatability?
- secp160r1 incorrect signatures on ARM Cortex M0 HOT 2
- Expression cannot be used as a function
- Point addition of same point
- Different results on different platforms
- mbedtls_ecdh_gen_public speed dosen't improve HOT 1
- not fast enought HOT 1
- GCC + `-Wpedantic` throws warning about `__int128` HOT 1
- 16-bit Implementation (MSP430)
- Will micro-ecc support for openharmony in thre future?
- Public key uncompression issue for secp384r1
- Algorithm used in asm_arm_mult_square.inc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micro-ecc.