projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
.gitignore: Ignore `ylwrap'.
[u/mdw/catacomb]
/
perftest.c
diff --git
a/perftest.c
b/perftest.c
index
ad1f182
..
3a0df7e
100644
(file)
--- a/
perftest.c
+++ b/
perftest.c
@@
-7,7
+7,7
@@
* (c) 2004 Straylight/Edgeware
*/
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
*
* This file is part of Catacomb.
*
@@
-15,12
+15,12
@@
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
* Catacomb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
@@
-79,6
+79,8
@@
typedef struct opts {
unsigned n; /* Number of factors */
unsigned i; /* Number of intervals (or zero) */
double t; /* Time for each interval (secs) */
unsigned n; /* Number of factors */
unsigned i; /* Number of intervals (or zero) */
double t; /* Time for each interval (secs) */
+ unsigned f; /* Flags */
+#define OF_NOCHECK 1u /* Don't do group checking */
} opts;
/*----- Job switch --------------------------------------------------------*/
} opts;
/*----- Job switch --------------------------------------------------------*/
@@
-206,7
+208,7
@@
static void *grp_init(opts *o)
dh_gen(&gp, o->gbits, o->fbits, 0, &rand_global, pgen_evspin, 0);
}
c->g = group_prime(&gp);
dh_gen(&gp, o->gbits, o->fbits, 0, &rand_global, pgen_evspin, 0);
}
c->g = group_prime(&gp);
- if ((e = G_CHECK(c->g, &rand_global)) != 0)
+ if (
!(o->f & OF_NOCHECK) &&
(e = G_CHECK(c->g, &rand_global)) != 0)
die(1, "bad group: %s", e);
if (!o->n) o->n = 1;
c->n = o->n;
die(1, "bad group: %s", e);
if (!o->n) o->n = 1;
c->n = o->n;
@@
-234,7
+236,7
@@
static void *grec_init(opts *o)
if ((e = ec_getinfo(&ei, o->name)) != 0)
die(1, "bad curve: %s", e);
c->g = group_ec(&ei);
if ((e = ec_getinfo(&ei, o->name)) != 0)
die(1, "bad curve: %s", e);
c->g = group_ec(&ei);
- if ((e = G_CHECK(c->g, &rand_global)) != 0)
+ if (
!(o->f & OF_NOCHECK) &&
(e = G_CHECK(c->g, &rand_global)) != 0)
die(1, "bad group: %s", e);
if (!o->n) o->n = 1;
c->n = o->n;
die(1, "bad group: %s", e);
if (!o->n) o->n = 1;
c->n = o->n;
@@
-436,7
+438,7
@@
typedef struct jobops {
} jobops;
static const jobops jobtab[] = {
} jobops;
static const jobops jobtab[] = {
- { "g-prime-exp", grp_init, gr_run },
+ { "g-prime-exp", grp_init, gr_run },
{ "g-ec-mul", grec_init, gr_run },
{ "g-prime-exp-sim", grp_init, grsim_run },
{ "g-ec-mul-sim", grec_init, grsim_run },
{ "g-ec-mul", grec_init, gr_run },
{ "g-prime-exp-sim", grp_init, grsim_run },
{ "g-ec-mul-sim", grec_init, grsim_run },
@@
-482,6
+484,7
@@
Options:\n\
\n\
-C, --name=NAME Select curve/DH-group/enc/hash name.\n\
-b, --field-bits Field size for g-prime and rsa.\n\
\n\
-C, --name=NAME Select curve/DH-group/enc/hash name.\n\
-b, --field-bits Field size for g-prime and rsa.\n\
+-q, --no-check Don't check field/group for validity.\n\
-B, --group-bits Group size for g-prime; key size for ksched;\n\
data size for enc and hash.\n\
-n, --factors=COUNT Number of factors for {exp,mul}-sim.\n\
-B, --group-bits Group size for g-prime; key size for ksched;\n\
data size for enc and hash.\n\
-n, --factors=COUNT Number of factors for {exp,mul}-sim.\n\
@@
-555,10
+558,11
@@
int main(int argc, char *argv[])
{ "factors", OPTF_ARGREQ, 0, 'n' },
{ "intervals", OPTF_ARGREQ, 0, 'i' },
{ "time", OPTF_ARGREQ, 0, 't' },
{ "factors", OPTF_ARGREQ, 0, 'n' },
{ "intervals", OPTF_ARGREQ, 0, 'i' },
{ "time", OPTF_ARGREQ, 0, 't' },
+ { "no-check", 0, 0, 'q' },
{ 0, 0, 0, 0 }
};
{ 0, 0, 0, 0 }
};
- i = mdwopt(argc, argv, "hvulC:b:B:n:i:t:", opts, 0, 0, 0);
+ i = mdwopt(argc, argv, "hvulC:b:B:n:i:t:
q
", opts, 0, 0, 0);
if (i < 0) break;
switch (i) {
case 'h': help(stdout); exit(0);
if (i < 0) break;
switch (i) {
case 'h': help(stdout); exit(0);
@@
-571,6
+575,7
@@
int main(int argc, char *argv[])
case 'n': o.n = uarg("factor count", optarg); break;
case 'i': o.i = uarg("interval count", optarg); break;
case 't': o.t = farg("interval length", optarg); break;
case 'n': o.n = uarg("factor count", optarg); break;
case 'i': o.i = uarg("interval count", optarg); break;
case 't': o.t = farg("interval length", optarg); break;
+ case 'q': o.f |= OF_NOCHECK; break;
default: usage(stderr); exit(1);
}
}
default: usage(stderr); exit(1);
}
}
@@
-582,7
+587,7
@@
int main(int argc, char *argv[])
p = j->init(&o);
n = 0;
p = j->init(&o);
n = 0;
- ttot = itot = 0;
+ ttot = itot =
0;
gettimeofday(&tv_now, 0);
do {
tv_addl(&tv_next, &tv_now, o.t, fmod(o.t * MILLION, MILLION));
gettimeofday(&tv_now, 0);
do {
tv_addl(&tv_next, &tv_now, o.t, fmod(o.t * MILLION, MILLION));