u/mdw/catacomb
12 years agohashsum.c: Return nonzero from `checkhash' on errors.
Mark Wooding [Sat, 25 Feb 2012 23:34:16 +0000 (23:34 +0000)]
hashsum.c: Return nonzero from `checkhash' on errors.

A serious bug: `checkhash' carefully maintained the `rc' variable -- and
then ignored it and always returned zero anyway.

12 years agocc.h: Fix FHF_MASK.
Mark Wooding [Sat, 25 Feb 2012 13:41:19 +0000 (13:41 +0000)]
cc.h: Fix FHF_MASK.

Must have been a typo.  Nobody uses this for anything anyway.

12 years agokey-data.[ch]: Fix trivial typo.
Mark Wooding [Mon, 23 Jan 2012 02:46:53 +0000 (02:46 +0000)]
key-data.[ch]: Fix trivial typo.

`key_mewmp'.  Miaow.

12 years agokey-data.c (key_struct{set,steal}): Assert no other references.
Mark Wooding [Mon, 23 Jan 2012 02:37:40 +0000 (02:37 +0000)]
key-data.c (key_struct{set,steal}): Assert no other references.

Otherwise I predict serious trouble when someone gets the reference
counting wrong.

12 years agodsig.c: Allow precomputed hashes to be read from a file.
Mark Wooding [Sun, 22 Jan 2012 13:12:15 +0000 (13:12 +0000)]
dsig.c: Allow precomputed hashes to be read from a file.

This lets you convert a hashsum(1) file or similar into a dsig(1)
signature file.

12 years agocc-hash.c, hashsum.c: Move hash-file parsing stuff to `cc-hash.c'.
Mark Wooding [Sun, 22 Jan 2012 13:12:15 +0000 (13:12 +0000)]
cc-hash.c, hashsum.c: Move hash-file parsing stuff to `cc-hash.c'.

This is a bit trickier than just slinging existing functions about and
tarting them up a bit: it introduces a proper interface to parsing hash
files, which previously was interleaved with actually verifying the
hashes.

Also moved a couple of auxiliary functions which are needed by the moved
code.

12 years agocc-hash.c: New file containing hash-related code from hashsum and dsig.
Mark Wooding [Sun, 22 Jan 2012 13:12:14 +0000 (13:12 +0000)]
cc-hash.c: New file containing hash-related code from hashsum and dsig.

There's a fair amount of duplication already, most notably the
`getstring'/`putstring' functions, and `fhash'.  The encoding stuff
isn't common yet, but will be needed in a later change.

12 years agocc.h: Reorder the declarations.
Mark Wooding [Sun, 22 Jan 2012 13:12:14 +0000 (13:12 +0000)]
cc.h: Reorder the declarations.

Split the file into chunks with their own type definitions and so on,
rather than having one big section of type definitions.

This header file is getting a bit unwieldy, and I'm going to be adding
more stuff to it.  It probably ought to be split into pieces.

12 years agodsig.c: Accept `-' to mean stdin/stdout in arguments to `-f' and `-o'.
Mark Wooding [Sun, 22 Jan 2012 13:12:14 +0000 (13:12 +0000)]
dsig.c: Accept `-' to mean stdin/stdout in arguments to `-f' and `-o'.

12 years agoCatcrypt tools: Roll out progress indicator stuff from hashsum.
Mark Wooding [Sun, 22 Jan 2012 13:12:14 +0000 (13:12 +0000)]
Catcrypt tools: Roll out progress indicator stuff from hashsum.

Factor out the progress indication from hashsum, and introduce it into
the other tools.

12 years agocatcrypt.c: Don't close output file twice.
Mark Wooding [Sun, 22 Jan 2012 13:12:14 +0000 (13:12 +0000)]
catcrypt.c: Don't close output file twice.

The C library doesn't like it.  Who knew?

12 years agocatcrypt.c, catsign.c: Shorten chunk sizes.
Mark Wooding [Sun, 22 Jan 2012 13:12:14 +0000 (13:12 +0000)]
catcrypt.c, catsign.c: Shorten chunk sizes.

The chunks are written with a 16-bit length, so the maximum chunk size
is 2^16 - 1 = 65535.  Unfortunately, catsign tried to write 65536-byte
chunks, and catcrypt tried to cram a MAC tag in there too.  The result
is that chunk_write fails an assertion because the chunks are too big.

No idea why this ever worked before.

12 years agokeyutil.c: Remove stray tabs and trailing space from the list format.
Mark Wooding [Sun, 22 Jan 2012 13:02:47 +0000 (13:02 +0000)]
keyutil.c: Remove stray tabs and trailing space from the list format.

Not sure how the trailing spaces got there; the tabs are from
an overzealous tabification run.

12 years agokeyutil.c: Only copy the shared parts of a parameters key.
Mark Wooding [Sun, 22 Jan 2012 12:58:57 +0000 (12:58 +0000)]
keyutil.c: Only copy the shared parts of a parameters key.

Reported by GCC warning that `kf' wasn't used for anything.  Use the new
function key_copydata to copy only the bits which really ought to be
copied.

This is unlikely to make much difference in practice since all
parameters keys we make have all of their components shared.

12 years agokey-data.[ch] (key_copydata): New function copies filtered key data.
Mark Wooding [Sun, 22 Jan 2012 12:57:45 +0000 (12:57 +0000)]
key-data.[ch] (key_copydata): New function copies filtered key data.

12 years agokey-attr.c (key_setkeydata): Decref after incref.
Mark Wooding [Sun, 22 Jan 2012 12:56:34 +0000 (12:56 +0000)]
key-attr.c (key_setkeydata): Decref after incref.

Otherwise we'd crash if someone set the key data to be itself.

12 years ago.gitignore: Ignore `ylwrap'.
Mark Wooding [Sun, 22 Jan 2012 12:55:52 +0000 (12:55 +0000)]
.gitignore: Ignore `ylwrap'.

12 years agohashsum.1: Write some notes about compatibility with GNU Coreutils.
Mark Wooding [Sun, 2 Oct 2011 12:58:19 +0000 (13:58 +0100)]
hashsum.1: Write some notes about compatibility with GNU Coreutils.

12 years agohashsum.1: Fix counting error (left over from some previous edit).
Mark Wooding [Sun, 2 Oct 2011 12:57:59 +0000 (13:57 +0100)]
hashsum.1: Fix counting error (left over from some previous edit).

12 years agohashsum.c: Optional progress indicator for large files.
Mark Wooding [Sun, 2 Oct 2011 12:41:44 +0000 (13:41 +0100)]
hashsum.c: Optional progress indicator for large files.

Hashing large files is very dull.  Optionally provide some eyecandy and
a completion time estimate (if the input is seekable) in order to keep
the user happy.

12 years agomptext.c: Fix hopeless incorrectness in raw base conversions.
Mark Wooding [Thu, 1 Sep 2011 23:49:10 +0000 (00:49 +0100)]
mptext.c: Fix hopeless incorrectness in raw base conversions.

Both mp_write and mp_read are broken.  The former would write a digit
`0' for a zero input, and attempt to prefix its output with a `-' sign
on negative input, both of which are impossible to decode unambiguously.
The latter would skip leading whitespace characters, which makes
encodings beginning with certain bytes decode incorrectly.

Include tests for these cases, and fix the bugs.

12 years agoMakefile.m4: Fix linking problems.
Mark Wooding [Tue, 5 Jul 2011 15:24:47 +0000 (16:24 +0100)]
Makefile.m4: Fix linking problems.

Debian's become pickier about propagating dependencies from libraries.
This is probably a good thing for keeping us honest, so include $(LDADD)
in various places with a glad heart.

12 years agotiger-mktab.c: Don't have printf swallow a kludge64 whole.
Mark Wooding [Fri, 20 May 2011 23:55:19 +0000 (00:55 +0100)]
tiger-mktab.c: Don't have printf swallow a kludge64 whole.

If a 64-bit type was actually found, we tried to feed the containing
kludge64 structure to printf while printing the table, rather than just
the 64-bit number inside.  This was silly.

12 years agoghash.h: Fix GH_HASHSTR64*.
Mark Wooding [Fri, 20 May 2011 23:53:37 +0000 (00:53 +0100)]
ghash.h: Fix GH_HASHSTR64*.

These were bogus redefinitions of GH_HASHSTR32* due to a stupid
copy-and-paste error.

15 years agogdsa: Include "dsa.h" for dsa_h2n.
Mark Wooding [Wed, 22 Apr 2009 19:20:56 +0000 (20:20 +0100)]
gdsa: Include "dsa.h" for dsa_h2n.

Somehow it managed to work anyway.

15 years agoperftest: Document the `-q' option for disabling checking.
Mark Wooding [Wed, 22 Apr 2009 19:02:41 +0000 (20:02 +0100)]
perftest: Document the `-q' option for disabling checking.

The option didn't make its way to the help message.

15 years agoMakefile: Link tests against stuff like -lm.
Mark Wooding [Fri, 26 Dec 2008 12:47:12 +0000 (12:47 +0000)]
Makefile: Link tests against stuff like -lm.

Now that EC validation requires transcendental functions, some of the
tests are breaking.  This is obviously less than ideal.

15 years agoperftest: Optionally disable group checking.
Mark Wooding [Fri, 26 Dec 2008 12:41:59 +0000 (12:41 +0000)]
perftest: Optionally disable group checking.

This takes ages on big prime groups, and is almost useless.  It may be
worth making not-checking be the default.

16 years agoInfrastructure: Switch over to pkg-config.
Mark Wooding [Mon, 17 Mar 2008 18:48:12 +0000 (18:48 +0000)]
Infrastructure: Switch over to pkg-config.

16 years agogdsa: Fix the conversion of hashes to integers to conform to the spec.
Mark Wooding [Fri, 1 Feb 2008 18:29:17 +0000 (18:29 +0000)]
gdsa: Fix the conversion of hashes to integers to conform to the spec.

The spec is obviously insane.

16 years agohashsum: Write directives when hashing a list of files from stdin.
Mark Wooding [Thu, 31 Jan 2008 12:01:00 +0000 (12:01 +0000)]
hashsum: Write directives when hashing a list of files from stdin.

Otherwise the list can't be verified properly.

16 years agotests/gdsa: Test from P1363.
Mark Wooding [Mon, 5 Nov 2007 14:30:36 +0000 (14:30 +0000)]
tests/gdsa: Test from P1363.

16 years agoectab.in: Add previously unacceptable curves from X9.62.
Mark Wooding [Tue, 30 Oct 2007 10:49:40 +0000 (10:49 +0000)]
ectab.in: Add previously unacceptable curves from X9.62.

Previously we rejected curves with large cofactors.  We've now
recognized that this was unnecessary.  This change includes the curves
from X9.62 which were previously omitted for having large cofactors.

The curve c2onb239v2 seems incorrect as specified.  In particular, the
specified base point G isn't in the prime-order subgroup -- in fact, it
seems as if the curve group E is cyclic and G is primitive in E.  The
base point included in the table is actually P = 6 G, which does
correctly generate the prime-order subgroup.

17 years agoec-info: Better checking of embedding degrees.
Mark Wooding [Tue, 20 Feb 2007 17:32:07 +0000 (17:32 +0000)]
ec-info: Better checking of embedding degrees.

Replace the rather cheap embedding degree check with a more
sophisticated analysis.

  * Use the new key-size conversions from keysz-conv.c to determine a
    suitable embedding degree.

  * Following L. Hitt's paper, we ensure that no field with the same
    characteristic as the curve field is sufficiently small to cause
    concern; the old algorithm just checked extensions of the curve
    field, which can miss the smallest possible target field.

  * This involves a rather fancy algorithm which partially factors the
    curve order r - 1, making use of the new prime iteration code.

Still to do on this:

  * Work out how to identify curves where pairings will help an attacker
    solve the DDH problem.

  * Provide a mechanism for passing parameters to checking functions.

17 years agoec-info: Add trailing newline to error message.
Mark Wooding [Mon, 19 Feb 2007 17:25:49 +0000 (17:25 +0000)]
ec-info: Add trailing newline to error message.

If there are syntactically incorrect curves on the command line, an
error is reported without a trailing newline.  This has a tendency to
get eaten by bash (my prompt has a carriage return at the beginning).

17 years agoprimeiter: New functions for iterating over small primes.
Mark Wooding [Tue, 20 Feb 2007 17:22:50 +0000 (17:22 +0000)]
primeiter: New functions for iterating over small primes.

The primeiter functions return consecutive prime numbers from a given
starting point.  To help do this efficiently we use a `wheel': a table
of steps to make which avoid integers with small factors.  The wheel is
generated by a new build-time utility genwheel.c.

17 years agokeysz-conv: Conversions between different kinds of key types.
Mark Wooding [Mon, 19 Feb 2007 13:09:58 +0000 (13:09 +0000)]
keysz-conv: Conversions between different kinds of key types.

It's useful to be able to convert between, say, a DL key length and an
EC key length.  The functions are here; they'll probably want to be
fiddled with as time goes on and the relationships change.

17 years agokeysz.h: Extract key-size stuff into a separate header file.
Mark Wooding [Mon, 19 Feb 2007 13:07:38 +0000 (13:07 +0000)]
keysz.h: Extract key-size stuff into a separate header file.

This is going to grow later; for now, just move the stuff from gcipher.
Include keysz.h in gcipher.h for backwards compatibility, even though
it's not strictly necessary.

17 years agompbarrett: Mark newly-split d as UNDEF.
Mark Wooding [Tue, 20 Feb 2007 00:10:47 +0000 (00:10 +0000)]
mpbarrett: Mark newly-split d as UNDEF.

After being split off from m (or whatever), we write q - mb->m into d's
storage; obviously we don't need whatever was there before, so it's safe
to set UNDEF.  We'll clear the flag shortly afterwards when d inherits
its sign and burn flags.

17 years agompbarrett: Fix memory leak in early exit from mpbarrett_reduce.
Mark Wooding [Tue, 20 Feb 2007 00:08:55 +0000 (00:08 +0000)]
mpbarrett: Fix memory leak in early exit from mpbarrett_reduce.

If we exit in the first stage, we leaked q.  This isn't tested, because
I couldn't contrive a test case for it.

17 years agompbarrett: Found mpbarrett_reduce hanging on this testcase.
Mark Wooding [Tue, 20 Feb 2007 00:04:39 +0000 (00:04 +0000)]
mpbarrett: Found mpbarrett_reduce hanging on this testcase.

A Python program spun inside mpbarrett_reduce, attempting the
computation in this testcase.  The test program hung too, and debugging
it yielded the following information.  On entry, d and m were equal; for
some reason, in the MP_DEST call, d was being aliased to m again, even
though m was still active; of course, m/d now had refcount 1, and all
hell broke loose when m got dropped.

A ground-up rebuild made the problem go away, so maybe it was just fluff
in the build tree.  I'm leaving this test here anyway so that it'll
catch a return of the bug, and maybe I can investigate it more carefully
then.

17 years agogroup-parse: Emit useful error messages when parsing fails.
Mark Wooding [Sat, 17 Feb 2007 12:11:26 +0000 (12:11 +0000)]
group-parse: Emit useful error messages when parsing fails.

Previously it would overwrite the useful message from lower-level
parsers with its own bland and unhelpful error.

17 years agoA number of small bug fixes, some motivated by compiler warnings.
Mark Wooding [Thu, 15 Feb 2007 16:36:42 +0000 (16:36 +0000)]
A number of small bug fixes, some motivated by compiler warnings.

  * key-data.c:key_nextsubkey -- explicitly return nonzero if we found
    something.

  * key-io.c:key_new -- cast the constant type pointer during the
    unpleasant hack.

  * mp-mem.c:mp_build -- store an arena in the built integer; otherwise
    pgen_primep (for example) gets confused later on.

  * mp-modsqrt.c:mp_modsqrt -- fix the maths in a comment; the code was
    fine.

  * oaep.c:oaep_decode -- don't try to do too much in one expression.

  * pgen-simul.c:pgen_simultest -- always return a sensible result code.

  * cc.h:sig -- hash classes are constant.

  * cc-{kem,sig}.c:get{kem,sig} -- initialize the kp structure member,
    just in case.

  * rijndael*.c, square.c -- fix const-correctness errors.

17 years agomp-gcd, gf-gcd: Tweak memory management subtly.
Mark Wooding [Thu, 15 Feb 2007 16:38:15 +0000 (16:38 +0000)]
mp-gcd, gf-gcd: Tweak memory management subtly.

Avoid mp churn by keeping a single spare integer lying around during the
main loop.

17 years agomp-jacobi: Implement Kronecker symbol.
Mark Wooding [Sat, 10 Feb 2007 22:47:20 +0000 (22:47 +0000)]
mp-jacobi: Implement Kronecker symbol.

The Kronecker symbol is a generalization of the Jacobi symbol whose
domain is the entire space of integers.  This just lets us return
something vaguely sensible even when the arguments are messed up.

17 years agoec-info: Overhaul elliptic curve domain parameter checking.
Mark Wooding [Thu, 18 Jan 2007 16:51:18 +0000 (16:51 +0000)]
ec-info: Overhaul elliptic curve domain parameter checking.

  * Separate out the common parts of prime and binary curve checking into
    its own function.

  * Replace the cofactor checking with a new, rather more complicated,
    algorithm which verifies that it has the correct value without
    needing an explicit square-root.  Also allow larger cofactors; it's
    not our responsibility to avoid small-subgroup attacks.

  * Replace the embedding-degree check with one that's rather more
    enlightened.  Unfortunately, it has to intuit the desired security
    level, and that's not going to work well.

Also check for memory leaks in the test harness (one snuck in during
development and was caught by another test).

17 years agocleanup: Big pile of whitespace fixes, all at once.
Mark Wooding [Sun, 28 Jan 2007 22:51:01 +0000 (22:51 +0000)]
cleanup: Big pile of whitespace fixes, all at once.

17 years agoec-bin (ec_binproj): Make curve setup faster.
Mark Wooding [Wed, 17 Jan 2007 17:32:04 +0000 (17:32 +0000)]
ec-bin (ec_binproj): Make curve setup faster.

Rather than computing bb from b by two square roots, each of which
actually calculates sqrt(x) as x^{2^{m-1}}, we can save time by
computing qdrt(x) as x^{2^{m-2}}.

I think this means that nobody uses F_SQRT on binary fields any more,
but I'll keep them around just in case.

17 years agoModify syntax of field and curve specs to reserve `/'.
Mark Wooding [Tue, 16 Jan 2007 22:09:55 +0000 (22:09 +0000)]
Modify syntax of field and curve specs to reserve `/'.

I'll want `/' as an operator in the expression syntax, so they can't
have it any more.  Use `;' instead.

17 years agomodexp: Implement simple mp_modexp function.
Mark Wooding [Tue, 16 Jan 2007 22:09:51 +0000 (22:09 +0000)]
modexp: Implement simple mp_modexp function.

This has been a serious omission for rather too long.

17 years agogenlimits: New program to generate useful limit MPs for C types.
Mark Wooding [Tue, 16 Jan 2007 22:09:36 +0000 (22:09 +0000)]
genlimits: New program to generate useful limit MPs for C types.

Also another fix to mpint.h, to suppress pointless leading zero workds.

17 years agoMerge branch 'fixes'
Mark Wooding [Tue, 16 Jan 2007 22:20:15 +0000 (22:20 +0000)]
Merge branch 'fixes'

* fixes:
  mpint: Fix misbehaviour on larger-than-mpw integer types.
  Fix various assumptions about mpw sizes.
  utils/mpreducetests.py: Tool to generate unpleasant mpreduce tests.
  mpreduce: Don't crash if we've accumulated no instructions.
  mpreduce: Don't stop bit scanner too early.
  mpreduce: Debug decomposition corrupts initial state for code generator.
  factorial: Fix usage message to fit in with conventions.
  cleanup: Various aesthetic fiddlings of little consequence.

17 years agompint: Fix misbehaviour on larger-than-mpw integer types.
Mark Wooding [Tue, 4 Apr 2006 16:20:05 +0000 (17:20 +0100)]
mpint: Fix misbehaviour on larger-than-mpw integer types.

The old implementation of MP_FROMINT was grievously broken, it turns
out.  Handle positive and negative numbers separately.

17 years agoFix various assumptions about mpw sizes.
Mark Wooding [Tue, 4 Apr 2006 16:17:45 +0000 (17:17 +0100)]
Fix various assumptions about mpw sizes.

  * configure, mptypes: New configure switches force mpw type to either
    sane but small (16/32 bits) or cussid (19/38 bits).  This found a
    bunch of exciting bugs...

  * gfreduce, mpreduce: If MPW_BITS is not a power of two, modular
    reduction of a `negative' unsigned value does the wrong thing.

  * mpx_lsl and friends: Shifting ops weren't masking high-order bits
    correctly when writing the output.  Apply MPW().

  * mpx_usubnlsl: More failure to elide high-order junk bits.

  * mptypes, mpx_udiv, mpx_bits, mp_odd: The binary search is neato, but
    starts in the wrong place if MPW_BITS is not a power of two.  Have
    mptypes  compute MPW_P2 as the largest power of two less than
    MPW_BITS.

17 years agoutils/mpreducetests.py: Tool to generate unpleasant mpreduce tests.
Mark Wooding [Tue, 16 Jan 2007 22:19:57 +0000 (22:19 +0000)]
utils/mpreducetests.py: Tool to generate unpleasant mpreduce tests.

17 years agopgroups: Ship a keyring file containing the custom prime groups.
Mark Wooding [Tue, 16 Jan 2007 21:50:40 +0000 (21:50 +0000)]
pgroups: Ship a keyring file containing the custom prime groups.

This is largely as a useful reference for the benefit of, oh, say the
TrIPE RFC document.

17 years agoignore: tinymp build tree for small-word-size MP library.
Mark Wooding [Tue, 16 Jan 2007 21:35:20 +0000 (21:35 +0000)]
ignore: tinymp build tree for small-word-size MP library.

17 years agoMerge branch 'master' of /home/mdw/public-git/catacomb
Mark Wooding [Wed, 6 Dec 2006 17:56:30 +0000 (17:56 +0000)]
Merge branch 'master' of /home/mdw/public-git/catacomb

* 'master' of /home/mdw/public-git/catacomb:
  rijndael: Make implementation big-endian.
  infra: Ignore possible profiling build.

17 years agorijndael: Make implementation big-endian.
Mark Wooding [Wed, 6 Dec 2006 17:56:03 +0000 (17:56 +0000)]
rijndael: Make implementation big-endian.

This makes very little difference to the performance, and makes GCM
possible.  (GCM is both-endian -- the field-element representation is
little-endian and the counter is big-endian.  This is obviously mad, but
there you go.)

17 years agoprime groups: Fix tests
Mark Wooding [Mon, 27 Nov 2006 16:38:14 +0000 (16:38 +0000)]
prime groups: Fix tests

Some of the tests still used the old groups, so they needed fixing.
Also the group checker was too zealous, and skipped groups depending on
their subgroup order, not field size, which can now cause all sorts of
stupidity.

17 years agoinfra: Ignore possible profiling build.
Mark Wooding [Wed, 22 Nov 2006 11:59:15 +0000 (11:59 +0000)]
infra: Ignore possible profiling build.

17 years agoMerge branch 'master' of git+ssh://metalzone.distorted.org.uk/~mdw/public-git/catacomb/
Mark Wooding [Wed, 22 Nov 2006 11:38:39 +0000 (11:38 +0000)]
Merge branch 'master' of git+ssh://metalzone.distorted.org.uk/~mdw/public-git/catacomb/

17 years agokeyutil: Allow explicit setting of key-id.
Mark Wooding [Wed, 22 Nov 2006 11:36:49 +0000 (11:36 +0000)]
keyutil: Allow explicit setting of key-id.

This is useful (indeed, essential!) for reproducibility of, say, domain
parameters, since otherwise the fingerprints will come out different and
you have to do the comparison by hand.

17 years agoptab: Replace the Catacomb groups.
Mark Wooding [Wed, 22 Nov 2006 11:29:32 +0000 (11:29 +0000)]
ptab: Replace the Catacomb groups.

These new ones are generated by a more reproducible (but very slow)
process.  The key sizes are taken from NIST SP800-57, and cover the full
range, including a truly daft-sized 15360-bit field.

17 years agonoise: Fix freewheel generator's use of setitimer(2).
Mark Wooding [Wed, 20 Sep 2006 15:20:23 +0000 (16:20 +0100)]
noise: Fix freewheel generator's use of setitimer(2).

If the old timer was turned off, don't accidentally turn it on.  While
on some Linux versions, this seems harmless enough, on others it causes
spurious SIGALRM signals to be sent to the process, which is terribly
unhelpful.

17 years agocatcrypt: Increase encryption buffer to 64K.
Mark Wooding [Sat, 13 May 2006 12:05:01 +0000 (13:05 +0100)]
catcrypt: Increase encryption buffer to 64K.

No reason not to, really.

17 years agocatcrypt: Implement symmetric key-encapsulation and signature schemes.
Mark Wooding [Sat, 13 May 2006 11:49:39 +0000 (12:49 +0100)]
catcrypt: Implement symmetric key-encapsulation and signature schemes.

For cases where you don't actually want to send messages, just keep
stuff lying around locally.

17 years agocc-kem: Fix memory leak in DH KEMs.
Mark Wooding [Sat, 13 May 2006 10:10:48 +0000 (11:10 +0100)]
cc-kem: Fix memory leak in DH KEMs.

Just didn't free the context at the end.  How strange.

18 years agompreduce: Don't crash if we've accumulated no instructions.
Mark Wooding [Tue, 4 Apr 2006 16:17:45 +0000 (17:17 +0100)]
mpreduce: Don't crash if we've accumulated no instructions.

Return failure; I think we might be able to do better, but think about
this later.

18 years agompreduce: Don't stop bit scanner too early.
Mark Wooding [Tue, 4 Apr 2006 16:17:45 +0000 (17:17 +0100)]
mpreduce: Don't stop bit scanner too early.

The code generation decomposition pass stopped too early, and failed to
note a change in the next-to-top bit.

18 years agompreduce: Debug decomposition corrupts initial state for code generator.
Mark Wooding [Tue, 4 Apr 2006 16:17:30 +0000 (17:17 +0100)]
mpreduce: Debug decomposition corrupts initial state for code generator.

The code generation pass uses whatever final state the debugging run
left behind.  Have the debug pass force the final state back to Z when
it finishes.

Also, produce correct output from the debugging pass.

18 years agofactorial: Fix usage message to fit in with conventions.
Mark Wooding [Tue, 4 Apr 2006 16:17:27 +0000 (17:17 +0100)]
factorial: Fix usage message to fit in with conventions.

18 years agocleanup: Various aesthetic fiddlings of little consequence.
Mark Wooding [Tue, 4 Apr 2006 16:17:25 +0000 (17:17 +0100)]
cleanup: Various aesthetic fiddlings of little consequence.

18 years agoutils: Make very bad ECM factoring program.
Mark Wooding [Fri, 17 Feb 2006 12:01:17 +0000 (12:01 +0000)]
utils: Make very bad ECM factoring program.

  * Extract factoring code from existing `prim' program.

  * Write driver front-end.

18 years agodebian: Fix package sections.
Mark Wooding [Wed, 15 Feb 2006 12:30:11 +0000 (12:30 +0000)]
debian: Fix package sections.

18 years agodh_kcdsagen: Generate cofactor first.
Mark Wooding [Sat, 11 Feb 2006 23:55:26 +0000 (23:55 +0000)]
dh_kcdsagen: Generate cofactor first.

Reorganize the parameter generation so that we generate the cofactor
%$v = (p - 1)/2 q$% first, on its own, and then run a simultaneous
primality search to find %$q$% and %$p$%.  Because %$q$%-sized primes
are (usually) much more common than %$p$%-sized primes, this makes the
search go considerably faster -- though it seems to print many more
dots.

18 years agodh, keyutil: Implement KCDSA key generation.
Mark Wooding [Sat, 11 Feb 2006 20:50:29 +0000 (20:50 +0000)]
dh, keyutil: Implement KCDSA key generation.

New function dh_kcdsagen generates KCDSA prime groups.  It's less quick
than I'd hoped, but it appears to do the right thing.  Make the keyutil
generate keys of this kind, and add documentation.

Currently no tests.

18 years agodh-limlee: Make code return PGEN_ABORT on error, like the comments say.
Mark Wooding [Sat, 11 Feb 2006 20:00:12 +0000 (20:00 +0000)]
dh-limlee: Make code return PGEN_ABORT on error, like the comments say.

The documentation says it returns PGEN_ABORT on error, but it doesn't:
it returns PGEN_FAIL instead.  Since PGEN_ABORT is -1, it makes sense to
do what the comments say, so make it do that.

18 years agopgen-safe: Expunge.
Mark Wooding [Sat, 11 Feb 2006 15:37:20 +0000 (15:37 +0000)]
pgen-safe: Expunge.

No trace remains.  This is an incompatible change, but I doubt anybody
cares.  The high-level key-generation functions still exist and do the
same things they ever did.

18 years agobbs-gen: Don't use the safe stepper.
Mark Wooding [Sat, 11 Feb 2006 15:34:37 +0000 (15:34 +0000)]
bbs-gen: Don't use the safe stepper.

This didn't use the safe-tester anyway.  I no longer understand why this
code was ever written this way, and since I want to eradicate the safe
stepper, this seems a good change now.

18 years agodh-gen: Use new simultaneous prime search.
Mark Wooding [Sat, 11 Feb 2006 15:21:43 +0000 (15:21 +0000)]
dh-gen: Use new simultaneous prime search.

I'm trying to expunge the old `safe prime' search.  This seems to work
now.

18 years agopgen: Implement general simultaneous-primality searching.
Mark Wooding [Sat, 11 Feb 2006 15:20:51 +0000 (15:20 +0000)]
pgen: Implement general simultaneous-primality searching.

Find a collection of primes of the form %$a x + b$% for fixed constants
%$a$% and %$b$%, and a variable %$x$%.

18 years agopgen: Declare steppers and so on as being `pgen_proc's.
Mark Wooding [Sat, 11 Feb 2006 14:02:28 +0000 (14:02 +0000)]
pgen: Declare steppers and so on as being `pgen_proc's.

Just saves some mental effort reading them, and finger effort writing
them.

18 years agopgen_safetest: Use a separate witness for each test.
Mark Wooding [Sat, 11 Feb 2006 12:41:26 +0000 (12:41 +0000)]
pgen_safetest: Use a separate witness for each test.

I have a suspicion that not doing this can do bad things to the
probability of returning a non-prime.

18 years agogcd: General tidying up.
Mark Wooding [Tue, 7 Feb 2006 19:32:47 +0000 (19:32 +0000)]
gcd: General tidying up.

  * Implement a GCD algorithm in calc/gfx.cal (partly to help with
    testing the Python bindings).

  * Clean up the MP and GF implementations: expunge incorrect commentary
    and redundant code.

18 years agoinfra: Clean up project setup
Mark Wooding [Tue, 7 Feb 2006 19:29:56 +0000 (19:29 +0000)]
infra: Clean up project setup

18 years agogf: Fix gf_irreduciblep() for small-degree polynomials.
Mark Wooding [Sat, 4 Feb 2006 16:19:03 +0000 (16:19 +0000)]
gf: Fix gf_irreduciblep() for small-degree polynomials.

Fix division-by-zero error for argument zero, and segfaults for
arguments with degree less than 2 due to skipping the main loop.  Handle
these as a special case.

18 years agopgen/pfilt: Special cases for primality checking.
Mark Wooding [Sat, 4 Feb 2006 13:01:25 +0000 (13:01 +0000)]
pgen/pfilt: Special cases for primality checking.

Don't consider 1, 0, or anything negative to be prime.  Also, add a test
for pgen_primep(), because it's probably useful.

18 years agotests: Fix tests for 222c8a43... (mp-modsqrt change).
Mark Wooding [Sat, 4 Feb 2006 11:59:55 +0000 (11:59 +0000)]
tests: Fix tests for 222c8a43... (mp-modsqrt change).

Ooops.  I accidentally broke some tests (in elliptic curve point-
finding) when I made that change, and (naughty me!) didn't run the full
suite.  I've checked that the breakages are acceptable (i.e., we just
get the positive y-coordinate rather than a random one now) and fixed
the tests.

18 years agoinfra: Remove BRANCHES file.
Mark Wooding [Wed, 1 Feb 2006 18:38:57 +0000 (18:38 +0000)]
infra: Remove BRANCHES file.

This was only interesting when severe discipline was required for
managing branches.  The switch to GIT makes this redundant.  Besides,
I've no longer any idea where all the branches might be. ;-)

18 years agomp-modsqrt: Always return the smaller possible square root.
Mark Wooding [Wed, 1 Feb 2006 18:26:33 +0000 (18:26 +0000)]
mp-modsqrt: Always return the smaller possible square root.

This makes the function more predictable in its behaviour, and therefore
easier to test.

18 years agomp-gcd: Add tests for mp_modinv.
Mark Wooding [Sun, 29 Jan 2006 15:11:16 +0000 (15:11 +0000)]
mp-gcd: Add tests for mp_modinv.

Just noticed there aren't any.  Naughty me.

18 years agoExtract Subversion ignore data.
Mark Wooding [Sat, 28 Jan 2006 10:19:04 +0000 (10:19 +0000)]
Extract Subversion ignore data.

18 years agocatcrypt security fix: sign metadata.
mdw [Tue, 6 Dec 2005 00:23:03 +0000 (00:23 +0000)]
catcrypt security fix: sign metadata.

18 years agoAllow insertion of new random data into the pool as a miscop.
mdw [Wed, 26 Oct 2005 15:43:09 +0000 (15:43 +0000)]
Allow insertion of new random data into the pool as a miscop.

18 years agoCorrectly work with the bizarre negative bases the @mptext@ functions allow.
mdw [Wed, 26 Oct 2005 15:42:43 +0000 (15:42 +0000)]
Correctly work with the bizarre negative bases the @mptext@ functions allow.

18 years agoFix maintainer email address.
mdw [Mon, 24 Oct 2005 14:33:49 +0000 (14:33 +0000)]
Fix maintainer email address.

18 years agoFix segfault in retagging.
mdw [Wed, 5 Oct 2005 09:40:35 +0000 (09:40 +0000)]
Fix segfault in retagging.

18 years agoAccept `-' as a name for standard input.
mdw [Fri, 30 Sep 2005 16:45:54 +0000 (16:45 +0000)]
Accept `-' as a name for standard input.

18 years agoFix catsign verify for -C.
mdw [Tue, 27 Sep 2005 18:25:25 +0000 (18:25 +0000)]
Fix catsign verify for -C.