also regen mont/fp_mont_small.i
This commit is contained in:
parent
4eac223b54
commit
8042e3ff5f
2
src/generators/.gitignore
vendored
2
src/generators/.gitignore
vendored
@ -1,7 +1,9 @@
|
|||||||
|
comba_mont_gen
|
||||||
comba_mult_gen
|
comba_mult_gen
|
||||||
comba_mult_smallgen
|
comba_mult_smallgen
|
||||||
comba_sqr_gen
|
comba_sqr_gen
|
||||||
comba_sqr_smallgen
|
comba_sqr_smallgen
|
||||||
|
comba_mont_gen.exe
|
||||||
comba_mult_gen.exe
|
comba_mult_gen.exe
|
||||||
comba_mult_smallgen.exe
|
comba_mult_smallgen.exe
|
||||||
comba_sqr_gen.exe
|
comba_sqr_gen.exe
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main(void)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int x, y, z;
|
int x, y, z, N = 16;
|
||||||
|
if (argc > 1) N = atoi(argv[1]);
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
#if 1
|
#if 1
|
||||||
"#ifdef TFM_SMALL_SET\n"
|
"#ifdef TFM_SMALL_MONT_SET\n"
|
||||||
"/* computes x/R == x (mod N) via Montgomery Reduction */\n"
|
"/* computes x/R == x (mod N) via Montgomery Reduction */\n"
|
||||||
"void fp_montgomery_reduce_small(fp_int *a, fp_int *m, fp_digit mp)\n"
|
"void fp_montgomery_reduce_small(fp_int *a, fp_int *m, fp_digit mp)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
@ -34,7 +36,7 @@ printf(
|
|||||||
"\n"
|
"\n"
|
||||||
" switch (pa) {\n");
|
" switch (pa) {\n");
|
||||||
|
|
||||||
for (x = 1; x <= 16; x++) {
|
for (x = 1; x <= N; x++) {
|
||||||
if (x > 16 && (x != 32 && x != 48 && x != 64)) continue;
|
if (x > 16 && (x != 32 && x != 48 && x != 64)) continue;
|
||||||
if (x > 16) printf("#ifdef TFM_HUGE\n");
|
if (x > 16) printf("#ifdef TFM_HUGE\n");
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
all: comba_sqr_gen comba_sqr_smallgen
|
all: comba_sqr_gen comba_sqr_smallgen
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
rm -f comba_mont_gen
|
||||||
|
rm -f comba_mont_gen.exe
|
||||||
rm -f comba_mult_gen
|
rm -f comba_mult_gen
|
||||||
rm -f comba_mult_gen.exe
|
rm -f comba_mult_gen.exe
|
||||||
rm -f comba_mult_smallgen
|
rm -f comba_mult_smallgen
|
||||||
@ -10,6 +12,8 @@ clean:
|
|||||||
rm -f comba_sqr_smallgen
|
rm -f comba_sqr_smallgen
|
||||||
rm -f comba_sqr_smallgen.exe
|
rm -f comba_sqr_smallgen.exe
|
||||||
|
|
||||||
|
comba_mont_gen: comba_mont_gen.c
|
||||||
|
gcc -o comba_mont_gen comba_mont_gen.c
|
||||||
comba_mult_gen: comba_mult_gen.c
|
comba_mult_gen: comba_mult_gen.c
|
||||||
gcc -o comba_mult_gen comba_mult_gen.c
|
gcc -o comba_mult_gen comba_mult_gen.c
|
||||||
comba_mult_smallgen: comba_mult_smallgen.c
|
comba_mult_smallgen: comba_mult_smallgen.c
|
||||||
@ -19,7 +23,8 @@ comba_sqr_gen: comba_sqr_gen.c
|
|||||||
comba_sqr_smallgen: comba_sqr_smallgen.c
|
comba_sqr_smallgen: comba_sqr_smallgen.c
|
||||||
gcc -o comba_sqr_smallgen comba_sqr_smallgen.c
|
gcc -o comba_sqr_smallgen comba_sqr_smallgen.c
|
||||||
|
|
||||||
regen: comba_mult_gen comba_mult_smallgen comba_sqr_gen comba_sqr_smallgen
|
regen: comba_mont_gen comba_mult_gen comba_mult_smallgen comba_sqr_gen comba_sqr_smallgen
|
||||||
|
./comba_mont_gen > ../mont/fp_mont_small.i
|
||||||
for i in 3 4 6 7 8 9 12 17 20 24 28 32 48 64; do \
|
for i in 3 4 6 7 8 9 12 17 20 24 28 32 48 64; do \
|
||||||
./comba_mult_gen $$i | sed -e 's/ *$$//' > ../mul/fp_mul_comba_$$i.c; \
|
./comba_mult_gen $$i | sed -e 's/ *$$//' > ../mul/fp_mul_comba_$$i.c; \
|
||||||
done
|
done
|
||||||
@ -28,4 +33,3 @@ regen: comba_mult_gen comba_mult_smallgen comba_sqr_gen comba_sqr_smallgen
|
|||||||
./comba_sqr_gen $$i | sed -e 's/ *$$//' > ../sqr/fp_sqr_comba_$$i.c; \
|
./comba_sqr_gen $$i | sed -e 's/ *$$//' > ../sqr/fp_sqr_comba_$$i.c; \
|
||||||
done
|
done
|
||||||
./comba_sqr_smallgen > ../sqr/fp_sqr_comba_small_set.c
|
./comba_sqr_smallgen > ../sqr/fp_sqr_comba_small_set.c
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user