#include <time.h>
#include <secsidh/secsidh.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "cycle.h"
#include "fp-counters.h"
#include "primes.h"
#include "ctidh.h"
#include "ctidh_api.h"
#include "fp/fp2.h"
Go to the source code of this file.
◆ CEVALUATOR
◆ CONSTNAMESPACE
◆ CPASTER
◆ cprintf
◆ derive
◆ FEVALUATOR
◆ FNAMESPACE
◆ FPASTER
◆ keygen
◆ PK_SIZE
◆ pk_size
◆ SK_SIZE
◆ sk_size
◆ SS_SIZE
◆ ss_size
◆ main()
| int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 59 of file ctidh.c.
60{
61#if !defined(_M1_) && !defined(_M2_) && !defined(_M3_) && !defined(_M4_) && !defined(_M5_)
62 printf(
"\nNOT using radical 3-isogenies (original dCTIDH).\n\n");
63#else
65#endif
67 {
69 {
70 run_benchmark_action(
atoi(
argv[2]), 10);
71 }
73 {
74 run_benchmark_keygen(
atoi(
argv[2]), 10);
75 }
77 {
79 }
80 else
81 {
82 printf(
"usage: \t%s\t\t\t\t// for a quick test\n\t%s -bact [number of runs]\t//run benchmark for the action\n\t%s -bfp [number of runs]\t//run benchmark for fp_mul",
argv[0],
argv[0],
argv[0]);
83 }
84 return 0;
85 }
87 {
88
90 {
91 printf(
"Starting fp^2 test ...\n");
94 printf(
"All tests passed!\n");
95 return 0;
96 }
97 else
98 {
99 printf(
"usage: \t%s\t\t\t\t// for a quick test\n\t%s -bact [number of runs]\t//run benchmark for the action\n\t%s -bfp [number of runs]\t//run benchmark for fp_mul",
argv[0],
argv[0],
argv[0]);
100 }
101 }
102
104
105
106
107
108
109
110
111
112
113 printf(
"\033[0;33m// --------------\033[0m\n");
114 printf(
"\033[0;33m// Key generation\033[0m\n");
115
118
119
120
121 printf(
"\n\033[0;35m// Alice\033[0m\n");
122
129 cprintf(
"Running-time (millions): %2.03lfM + %2.03lfS + %2.03lfa = \033[1;35m%2.03lfM\033[0m\n", (1.0 *
fpmul) / 1000000.0, (1.0 *
fpsqr) / 1000000.0, (1.0 *
fpadd) / 1000000.0, (1.0 * (
fpmul +
fpsqr)) / 1000000.0);
130 printf(
"Clock cycles (millions): \033[1;35m%7.03lf\033[0m\n", (1.0 * (
cc1 -
cc0)) / 1000000.0);
131
132
133 printf(
"\n\033[0;34m// Bob\033[0m\n");
140 cprintf(
"Running-time (millions): %2.03lfM + %2.03lfS + %2.03lfa = \033[1;34m%2.03lfM\033[0m\n", (1.0 *
fpmul) / 1000000.0, (1.0 *
fpsqr) / 1000000.0, (1.0 *
fpadd) / 1000000.0, (1.0 * (
fpmul +
fpsqr)) / 1000000.0);
141 printf(
"Clock cycles (millions): \033[1;34m%7.03lf\033[0m\n", (1.0 * (
cc1 -
cc0)) / 1000000.0);
142
144
145
146 printf(
"\n\033[0;33m// -------------------------\033[0m\n");
147 printf(
"\033[0;33m// Secret sharing generation\033[0m\n");
148
149
150
151 printf(
"\n\033[0;35m// Alice\033[0m\n");
156 cprintf(
"Running-time (millions) [without validation]: %2.03lfM + %2.03lfS + %2.03lfa = \033[1;35m%2.03lfM\033[0m\n",
158 printf(
"Clock cycles (millions) [including validation]: \033[1;35m%7.03lf\033[0m\n", (1.0 * (
cc1 -
cc0)) / 1000000.0);
159
161
162
163 printf(
"\n\033[0;34m// Bob\033[0m\n");
168 cprintf(
"Running-time (millions) [without validation]: %2.03lfM + %2.03lfS + %2.03lfa = \033[1;34m%ld\033[0m\n",
170 printf(
"Clock cycles (millions) [including validation]: \033[1;34m%7.03lf\033[0m\n", (1.0 * (
cc1 -
cc0)) / 1000000.0);
172
173
175
176
177 printf(
"\n\033[0;32m// Successfully secret sharing computation!\033[0m\n");
178 return 0;
179}
References a, assert(), batch_start, cprintf, derive, fp2_test, keygen, main(), PK_SIZE, SK_SIZE, and SS_SIZE.