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

uECC_OPTIMIZATION_LEVEL=4 breaks uECC_sign()/uECC_verify() on atmega328p #154

Open
gitcnd opened this issue May 14, 2019 · 9 comments
Open

Comments

@gitcnd
Copy link

gitcnd commented May 14, 2019

test/test_ecdsa.c WORKS with this:-
#define uECC_OPTIMIZATION_LEVEL 2

but FAILS with this:-
#define uECC_OPTIMIZATION_LEVEL 4

@L1uTongweiNewAccount
Copy link

L1uTongweiNewAccount commented Feb 18, 2024

I found a truth when I was viewing asm_avr.inc:255 and asm_avr_mult_square.inc.

The truth is: you write a loooooong asm like FAST_MULT_ASM_.

I really feel curious about this, and why? My compiler (avr-gcc 13.2.0) tell me that size of string literal is too large.

@L1uTongweiNewAccount
Copy link

L1uTongweiNewAccount commented Feb 18, 2024

Issue #50 is where asm_avr.inc:255 and asm_avr_mult_square.inc from. It referred to a method to optimize the performance.

But @kmackay are you tested this? Maybe it is a issue of avr-gcc?

We need a method to let the compiler accept the looooong inline-asm string literal.

@L1uTongweiNewAccount
Copy link

Well, #50 's method is so STUPID. No compiler can accept so huge codes.
I'm trying to reoptimize these code.

@WestfW
Copy link

WestfW commented Feb 18, 2024

i think (assembler) macros could fix this.

@L1uTongweiNewAccount
Copy link

i think (assembler) macros could fix this.

Yes, i think so. But GCC inline assembler cannot compute the real size of the assemble. (See at GCC document)

But if we ignore this, can you fix it with assembler macros?

@L1uTongweiNewAccount
Copy link

i think (assembler) macros could fix this.

Subroutine may works, i think

@L1uTongweiNewAccount
Copy link

i think (assembler) macros could fix this.

I found something: the asm are be divided by some subprocess.

Maybe we can define many function to reduce single string literal.

L1uTongweiNewAccount added a commit to L1uTongweiNewAccount/micro-ecc that referenced this issue Feb 18, 2024
@L1uTongweiNewAccount
Copy link

i think (assembler) macros could fix this.

Fixed. But I think the performance will reduce a little and the code is huge like the past.

The code is in https://github.com/L1uTongweiNewAccount/micro-ecc

see asm_avr.inc and asm_avr_mult_square.inc

I did not tested this so be careful.

@L1uTongweiNewAccount
Copy link

#224 I opened a PR. see this

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

3 participants