* Allow a key-size parameter to `enc', because algorithms like
Rijndael have key-size-dependent performance. This uses the `-b'
option, because `-B' is already the buffer size for the inner loop.
* For consistency, use `-b' for the key size in `ksched' too.
* Finally, check explicit key sizes for validity rather than just
rounding off and potentially crashing.
die(1, "must specify encryption scheme name");
if ((c->c = gcipher_byname(o->name)) == 0)
die(1, "encryption scheme `%s' not known", o->name);
die(1, "must specify encryption scheme name");
if ((c->c = gcipher_byname(o->name)) == 0)
die(1, "encryption scheme `%s' not known", o->name);
- c->ksz = keysz(o->gbits/8, c->c->keysz);
+ c->ksz = keysz(o->fbits/8, c->c->keysz);
+ if (o->fbits%8 || (o->fbits && c->ksz != o->fbits/8))
+ die(1, "bad key size %u for %s", o->fbits, o->name);
c->k = xmalloc(c->ksz);
rand_get(RAND_GLOBAL, c->k, c->ksz);
return (c);
c->k = xmalloc(c->ksz);
rand_get(RAND_GLOBAL, c->k, c->ksz);
return (c);
die(1, "must specify encryption scheme name");
if ((cc = gcipher_byname(o->name)) == 0)
die(1, "encryption scheme `%s' not known", o->name);
die(1, "must specify encryption scheme name");
if ((cc = gcipher_byname(o->name)) == 0)
die(1, "encryption scheme `%s' not known", o->name);
- ksz = keysz(0, cc->keysz);
+ ksz = keysz(o->fbits/8, cc->keysz);
+ if (o->fbits%8 || (o->fbits && ksz != o->fbits/8))
+ die(1, "bad key size %u for %s", o->fbits, o->name);
k = xmalloc(ksz);
rand_get(RAND_GLOBAL, k, ksz);
c->c = GC_INIT(cc, k, ksz);
k = xmalloc(ksz);
rand_get(RAND_GLOBAL, k, ksz);
c->c = GC_INIT(cc, k, ksz);
-l, --list [ITEM...] List all the various names of things.\n\
\n\
-C, --name=NAME Select curve/DH-group/enc/hash name.\n\
-l, --list [ITEM...] List all the various names of things.\n\
\n\
-C, --name=NAME Select curve/DH-group/enc/hash name.\n\
--b, --field-bits Field size for g-prime and rsa.\n\
+-b, --field-bits Field size for g-prime and rsa;\n\
+ key bits for ksched and enc.\n\
-q, --no-check Don't check field/group for validity.\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\
+-B, --group-bits Group size for g-prime; data size for enc and hash.\n\
-n, --factors=COUNT Number of factors for {exp,mul}-sim;\n\
inner iterations for enc and hash.\n\
-i, --intervals=COUNT Number of intervals to run for. [0; forever]\n\
-n, --factors=COUNT Number of factors for {exp,mul}-sim;\n\
inner iterations for enc and hash.\n\
-i, --intervals=COUNT Number of intervals to run for. [0; forever]\n\