Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

secp160r1 incorrect signatures on ARM Cortex M0 #214

Open
J08nY opened this issue May 16, 2023 · 2 comments
Open

secp160r1 incorrect signatures on ARM Cortex M0 #214

J08nY opened this issue May 16, 2023 · 2 comments

Comments

@J08nY
Copy link

J08nY commented May 16, 2023

micro-ecc computes a wrong signature on secp160r1 on ARM Cortex M0.

The compile-time settings are:

-DuECC_SUPPORTS_secp160r1=1
-DuECC_SUPPORTS_secp192r1=0
-DuECC_SUPPORTS_secp224r1=0
-DuECC_SUPPORTS_secp256r1=0
-DuECC_SUPPORTS_secp256k1=0
-DuECC_SUPPORT_COMPRESSED_POINT=0
-DuECC_OPTIMIZATION_LEVEL=3
-DuECC_SQUARE_FUNC=1
-fomit-frame-pointer

with arm-none-eabi-gcc version 13.1.0 and optimization level -O3 (but also reproduced with levels [s, 1, 2]).

For a pubkey of: (1248267197097365432264186274468065254236796158617, 518980666782735319294616719874128744577850778311)

and a hash of cdfd35e9983ed989984e026546b241803bebd02b, it produces a signature of:
(1012199123568660032231186032600072213159176233822, 416085392951447075179638451199529832674058226010), which is invalid.

When compiled to target the host (x86_64) it produces valid signatures. Other curves also work correctly.

@mrx23dot
Copy link

mrx23dot commented Jan 4, 2024

Yeah it's essential to be portable.

What if you turn -DuECC_OPTIMIZATION_LEVEL=0 ?

@J08nY
Copy link
Author

J08nY commented Jan 23, 2024

I vaguely remember that the optimization level was important for the error to show up (i.e. the error did not show up with optimization level 0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants