Comments (8)
- 16 Bit processor
from micro-ecc.
It is certainly possible. You basically need to add support for
uECC_WORD_SIZE == 2. There are all the #defines and typedefs at the top of
uECC.c that need to be defined correctly, and then there are a few
functions that are word-size-specific. The functions are
omega_mult()/vli_mmod_fast(), vli_nativeToBytes(), and vli_bytesToNative().
You can basically search for uECC_WORD_SIZE in uECC.c to see code that is
word-size-specific.
I recommend implementing asm versions of vli_add(), vli_sub(), vli_mult(),
and vli_square() to significantly improve performance.
Depending on what your timeline is, I can implement the necessary C code
and you can test it on your device. You would need to implement and asm
code since I have no way to test it.
On Mon, Mar 2, 2015 at 12:28 PM, Johannes [email protected] wrote:
- 16 Bit processor
—
Reply to this email directly or view it on GitHub
#23 (comment).
from micro-ecc.
Ok, i implemented the typedefs and the functions for the 160 bit curve based on the implementations for the 8 bit and 32 bit processor.
Sometimes i was not sure what to do- i added TODO at those places.
Can you have a look at it when you have some time? Would be great!
Link: https://github.com/johb/micro-ecc
from micro-ecc.
Some notes:
- Yes, wordcount_t is unsigned
- bitcount_t only needs to be an int16_t (since the largest supported curve
is 256 bits). - uECC_N_WORDS_1 only needs to be 11 (and you can remove the last 0x0000
from Curve_N_1) - Curve_P_3 is incorrect (the last 4 words should be 0x0001, 0x0000,
0xFFFF, 0xFFFF) - In omega_mult(), unsigned or uint16_t are both fine (they should be the
same on your platform). You should do vli_set(p_result+2, p_right) to
multiply by 2^32 (since 2 words is 32 bits). Then vli_rshift(p_result + 2)
to shift back one, and then p_result[1] = p_right[0] << 15 to get the last
bit. The rest of the function looks fine. - Your vli_nativeToBytes() and vli_bytesToNative() look fine, but you have
a copy-paste error (your vli_bytesToNative() implementation is named
"vli_nativeToBytes").
On Tue, Mar 3, 2015 at 3:08 PM, Johannes [email protected] wrote:
Ok, i implemented the typedefs and the functions for the 160 bit curve
based on the implementations for the 8 bit and 32 bit processor.
Sometimes i was not sure what to do- i added TODO at those places.
Can you have a look at it when you have some time? Would be great!—
Reply to this email directly or view it on GitHub
#23 (comment).
from micro-ecc.
Ok, thank you.
I changed the things you mentioned. Now I'm testing it and it is always failing (signing and verifying). I used the test example and the fake_generator there.
(Lines are relating to my fork)
Verify fails because v != r (line 2451)
/* Accept only if v == r. */
return vli_equal(rx, r)
Sign fails at line 2275:
if(!g_rng((uint8_t *)k, sizeof(k)) || (l_tries++ >= MAX_TRIES))
{
return 0;
}
The code is in the forked repo (I didn't commit the #define PLATFORM etc. macros because I hardcoded them for simplicity, but I think they aren't the reason for failing. I'll later change them.)
Do you have any ideas?
from micro-ecc.
If you are just using test_ecdsa.c for testing, you need to modify it so
that the fake RNG function is used (in my code it is only used if LPC11XX
is defined). That's probably why the signing is failing.
Your omega_mult() function has an error on line 906; it should be p_result[1]
= p_right[0] << 15;
On Thu, Mar 5, 2015 at 9:04 AM, Johannes [email protected] wrote:
Ok, thank you.
I changed the things you mentioned. Now I'm testing it and it is always
failing (signing and verifying). I used the test example and the
fake_generator there.(Lines are relating to my fork)
Verify fails because v != r (line 2451)/* Accept only if v == r. */
return vli_equal(rx, r)Sign fails at line 2275:
if(!g_rng((uint8_t *)k, sizeof(k)) || (l_tries++ >= MAX_TRIES))
{
return 0;
}The code is in the forked repo (I didn't commit the #define PLATFORM etc.
macros because I hardcoded them for simplicity, but I think they aren't the
reason for failing. I'll later change them.)Do you have any ideas?
—
Reply to this email directly or view it on GitHub
#23 (comment).
from micro-ecc.
Yeah, that's it!
I changed it to p_result[1]. (I removed the #ifdef LPC11XX already)
But sometimes (1 out of 4) the signing fails. I think that's because of the number_generator?
from micro-ecc.
Yes, signing only fails if the RNG doesn't generate a good value. I'm kind
of surprised it is failing so frequently though since it tries 16 times
(MAX_TRIES). It is more likely to fail with secp160r1 since even a true
random number generator will only create a good value for k about 50% of
the time. I guess you could try increasing the MAX_TRIES value.
On Thu, Mar 5, 2015 at 9:38 AM, Johannes [email protected] wrote:
Yeah, that's it!
I changed it to p_result[1].But sometimes (1 out of 4) the signing fails. I think that's because of
the number_generator?—
Reply to this email directly or view it on GitHub
#23 (comment).
from micro-ecc.
Related Issues (20)
- cannot build with LLVM-embedded-toolchain-for-Arm HOT 1
- Problem validating C509 test vectors -- ECC signature does not validate HOT 1
- Support for P-384?
- Interoperability with python-ecdsa regarding the SECP160r1 curve HOT 2
- uECC_decompress() gives garbage when passed an already-decompressed key
- P-256 failing cases HOT 5
- asm_mult for uECC_PLATFORM == uECC_arm_thumb
- Arduino compatibility
- Does micro-ecc works with signature (secp256r1) where R or S is lower than 32 bytes? HOT 2
- Questions about ECDSA HOT 2
- 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
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.