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

Trying To Understand #10

Open
naveedabbasi opened this issue Mar 7, 2022 · 0 comments
Open

Trying To Understand #10

naveedabbasi opened this issue Mar 7, 2022 · 0 comments

Comments

@naveedabbasi
Copy link

I am trying to understand the Interpolation part, here Loop will execute 64 times, and all r0 up to r7 is of 16bit(or uint16_t in c), the interpolation part will take input from stack [....] , can you explain a little bit how the kara_strd_mem_asm function works, input and output of this function, I understand C but unable to understand the assembly,
In // EVALUATION the output will be of (Seven arrays w1 to w7 with 64 coefficients of the intermediate products each) but no of bits in w1 , w2 .... w7 ?
then these bit are the input of kara_strd_mem_asm function, I guess, (i calculated 16 x 64 = 1024 are will be bits of aws 1 , aws2 ,, upto aws7 and same goes for bws1 bws2..... bws7 as well)

after this for Multiplication here used kara_strd_mem_asm So question if aws1 and bws1 are of 1024 bit each the output will be of 2048 bits, and for interpolation, part loop should run for 128 times, becasue all r0 up to r7 is of 16bit(or uint16_t in c),
so 2048 / 16 = 128 .

Referring to paper Polynomial multiplication on embedded vector architectures
ByHanno Becker Jose Maria Bermudo Mera Angshuman Karmakar Joseph Yiu and Ingrid Verbauwhede
paper link https://eprint.iacr.org/2021/998.pdf algo 10 and algo 12

   // MULTIPLICATION
kara_strd_mem_asm(stack,b,&b[64], &b[128]);
kara_strd_mem_asm(&stack[64],&stack[7*64],b   , &b[128]);
kara_strd_mem_asm(&stack[2*64],&stack[8*64],&stack[7*64] , &b[128]);
kara_strd_mem_asm(&stack[3*64],&stack[9*64],&stack[8*64] , &b[128]);
kara_strd_mem_asm(&stack[4*64],&stack[10*64],&stack[9*64] , &b[128]);
kara_strd_mem_asm(&stack[5*64],&stack[11*64],&stack[10*64] , &b[128]);
kara_strd_mem_asm(&stack[6*64],&stack[12*64],&stack[11*64] , &b[128]);

          // INTERPOLATION
for (i = 0; i < 64; i++) {
	//save last round's r0, r1, r2
	r7=r0;
	r8=r1;
	r9=r2;

	r0 = b[64+i];
	r1 = b[i];
	r2 = stack[7*64+i];
	r3 = stack[8*64+i];
	r4 = stack[9*64+i];
	r5 = stack[10*64+i];
	r6 = stack[11*64+i];
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

1 participant