catacomb
9 years agosymm: Expunge stubby header files from the source tree.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
symm: Expunge stubby header files from the source tree.

Construct them at compile time instead.

9 years agosymm/Makefile.am: Modes files listed as `EXTRA_DIST' and `nodist_...'.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
symm/Makefile.am: Modes files listed as `EXTRA_DIST' and `nodist_...'.

The generated per-mode files were listed both as `nodist_...' and in
`EXTRA_DIST'.  Sort this out by just adding them to the appropriate
distribution list instead.

9 years agosymm/Makefile.am: Have modes things depend on `Makefile.am'.
Mark Wooding [Sun, 15 Mar 2015 02:11:40 +0000 (02:11 +0000)]
symm/Makefile.am: Have modes things depend on `Makefile.am'.

This is, after all, where the master list comes from.  This includes the
modes files, and the various generated lists.

9 years agosymm/modes.am.in: Fix `Generated from ...' header.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
symm/modes.am.in: Fix `Generated from ...' header.

9 years agopub/rsa-recover.c: Give up if we run out of prime numbers.
Mark Wooding [Fri, 13 Mar 2015 20:36:31 +0000 (20:36 +0000)]
pub/rsa-recover.c: Give up if we run out of prime numbers.

We have a 1/2 probability of winning for each prime, and `NPRIME' is at
least 256, so the chances of us giving up on an input which we could, in
fact, factor if we persevered are negligible.  We therefore neglect them.

9 years agoMerge branch 'mdw/ec-ptcmpr'
Mark Wooding [Fri, 27 Feb 2015 21:19:41 +0000 (21:19 +0000)]
Merge branch 'mdw/ec-ptcmpr'

* mdw/ec-ptcmpr:
  math/: Support EC2OSP and OS2ECP operations, with point compression.
  math/f-{prime,niceprime}.c: Fix reduction for `add', `sub' and `neg'.
  math/mp-modsqrt.c: Zero has a square root.  Return it correctly.
  math/: Improve some commentary in the binary-field arithmetic.

9 years agomath/: Support EC2OSP and OS2ECP operations, with point compression.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
math/: Support EC2OSP and OS2ECP operations, with point compression.

We handle both LSB and (IEEE 1363) SORT compression, and hybrid forms.
The `ec_fromraw' function now accepts compressed forms, but (for
compatibility's sake) `ec_toraw' doesn't generate them.  Lots of tests
included.

9 years agomath/f-{prime,niceprime}.c: Fix reduction for `add', `sub' and `neg'.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
math/f-{prime,niceprime}.c: Fix reduction for `add', `sub' and `neg'.

None of these worked properly at the modulus itself.  This causes the
`neg' method of prime curves to fail at 2-torsion points.

9 years agomath/mp-modsqrt.c: Zero has a square root. Return it correctly.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
math/mp-modsqrt.c: Zero has a square root.  Return it correctly.

This causes `find' on prime curves to fail when given the x-coordinate
of a 2-torsion point.

9 years agomath/: Improve some commentary in the binary-field arithmetic.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
math/: Improve some commentary in the binary-field arithmetic.

  * Explain why `gfreduce_trace' can safely return its answer as an int.

  * Explain how `gfreduce_quadsolve' actually works.  Also explicitly
    guarantee that its result is deterministic.

  * Explain how the `find' method works in `ec-bin.c'.

There's a little fiddling with braces to fit the new commentary in, but
no significant code change.

9 years agoprogs/factorial.c: Reject negative inputs.
Mark Wooding [Fri, 27 Feb 2015 14:44:45 +0000 (14:44 +0000)]
progs/factorial.c: Reject negative inputs.

Otherwise they get reduced mod 2^large, and the program takes forever.
It's not like we'd get a better answer by using the full-on Gamma
function, so just report an error.

9 years agopub/rsa-recover.c: Fail gracefully if `mpmont_create' fails.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
pub/rsa-recover.c: Fail gracefully if `mpmont_create' fails.

Otherwise we'll crash and burn if, e.g., `n' is even for some reason.

9 years agopub/rsa-recover.c: Gather cleanup to the end of the function.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
pub/rsa-recover.c: Gather cleanup to the end of the function.

We get to delete a whole lot of leave-in-the-middle cleanup, and
concentrate it all at the end.  This also lets us recycle temporaries
slightly better.

There's a little light reformatting thrown in, but nothing too aggressive.

9 years agopub/rsa-recover.c: Take out explicit factoring-retry loop.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
pub/rsa-recover.c: Take out explicit factoring-retry loop.

We have the `again' label anyway, because we need to retry from the
nested square-root-finding loop, and the hope is that we do the thing
once and it works, retrying on failure, rather than iterating over a
thing, so I think I prefer the `goto' here.

9 years agorsa-recover.c: First stage cleanup: hoist variable declarations.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
rsa-recover.c: First stage cleanup: hoist variable declarations.

Remove all of the variable declarations from inner blocks and hoist them
to toplevel.  Initialize `mp' variables once, and use their initial
values, rather than writing `MP_NEW' explicitly in the first assignment.

There's no functional change here.

Two small (temporary) warts. Firstly, the handling of `z' and `zz' in
the factoring loop is rather nasty, repeatedly freeing and recreating
`zz'; and secondly `p1' and `q1' are used in two separate places.  To
prevent conflicts here, reset the relevant variables to `MP_NEW' after
freeing them.

9 years agopub/rsa-recover.c, pub/rsa.h: Say what's left when `rsa_recover' fails.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
pub/rsa-recover.c, pub/rsa.h: Say what's left when `rsa_recover' fails.

9 years agobase/ct.[ch]: Fix stupid editorial error in commentary for `ct_intle'.
Mark Wooding [Wed, 24 Dec 2014 17:57:53 +0000 (17:57 +0000)]
base/ct.[ch]: Fix stupid editorial error in commentary for `ct_intle'.

Also, I checked through the disassembly for these functions, just to
check that GCC isn't inserting comparisons or branches where they aren't
wanted.  It isn't -- at least, not yet.

9 years agoRelease 2.1.7. 2.1.7
Mark Wooding [Sat, 24 May 2014 13:00:03 +0000 (14:00 +0100)]
Release 2.1.7.

9 years agoMakefile.am, configure.ac, progs/Makefile.am: Link math library explicitly.
Mark Wooding [Wed, 16 Jul 2014 09:11:37 +0000 (10:11 +0100)]
Makefile.am, configure.ac, progs/Makefile.am: Link math library explicitly.

Rename `CATACOMB_LIBS' to `MATHLIBS' and use it explicitly in some of
the utility builds.

If the main library needs more library dependencies then it'll probably
be best to sort them out in the Makefile.

9 years agoprogs/mkphrase.[c1]: Optionally drop apostrophes.
Mark Wooding [Sat, 5 Apr 2014 09:52:07 +0000 (10:52 +0100)]
progs/mkphrase.[c1]: Optionally drop apostrophes.

They don't do much good, really.

9 years agoprogs/hashsum.c (checkhash): Fix stupid bugs.
Mark Wooding [Sat, 5 Jul 2014 01:09:05 +0000 (02:09 +0100)]
progs/hashsum.c (checkhash): Fix stupid bugs.

  * Initialize the return code.  Not sure why this didn't get a warning.

  * Pick up changes of hash function properly.

9 years agomath/ectab.in: Add the BADA55 curves by Bernstein et al.
Mark Wooding [Mon, 19 May 2014 15:49:22 +0000 (16:49 +0100)]
math/ectab.in: Add the BADA55 curves by Bernstein et al.

9 years agomath/ectab.in: Add the Brainpool curves.
Mark Wooding [Mon, 19 May 2014 11:36:37 +0000 (12:36 +0100)]
math/ectab.in: Add the Brainpool curves.

Really I should have done this years ago.

10 years agomath/mpgen, symm/multigen: Add copious commentary.
Mark Wooding [Wed, 14 May 2014 20:35:40 +0000 (21:35 +0100)]
math/mpgen, symm/multigen: Add copious commentary.

10 years agomath/mpgen, symm/multigen: Various minor cleanups.
Mark Wooding [Wed, 14 May 2014 20:35:21 +0000 (21:35 +0100)]
math/mpgen, symm/multigen: Various minor cleanups.

Reordering some code; deleting pointless code; some very minor bug fixing.

Most notably, avoid a crash when reporting a row size mismatch, in
Relation.addrow.

10 years agomath/mpgen: Fix bugs in slot handling.
Mark Wooding [Wed, 14 May 2014 20:29:29 +0000 (21:29 +0100)]
math/mpgen: Fix bugs in slot handling.

Several bugs, which conspired to cover their tracks.

  * BaseSlot never actually stored the `omitp' and `allowp' functions.

  * The MPSlot handler didn't chain up to the BaseSlot implementation
    of `setup'.

  * The EllipticCurveGroup's `beta' slot definition's `omitp' and `allowp'
    functions used the slot name `type' instead of the object.

The incorrect lookups were hidden because the functions were never called.
The omission of `beta' values for most curve groups should then have
caused an error, only MPSlot.setup didn't chain up to the method which
would have noticed.

10 years agoprogs/{catsign,mkphrase}.1: Fix synopsis line breaks.
Mark Wooding [Sat, 13 Jul 2013 15:34:40 +0000 (16:34 +0100)]
progs/{catsign,mkphrase}.1: Fix synopsis line breaks.

Some lines which only contained tabs got clobbered in a whitespace
cleanup.  Those lines were asking for trouble anyway; instead, use
\h'8n', which won't get caught in the same way, makes more space, and is
consistent with other manpages in the package.

10 years agomath/mpx.c: Eliminate clone-and-hack from `mpx_{load,store}{l,b}{,2cn}.
Mark Wooding [Wed, 2 Apr 2014 23:04:24 +0000 (00:04 +0100)]
math/mpx.c: Eliminate clone-and-hack from `mpx_{load,store}{l,b}{,2cn}.

Introduce another pile of macros.  The implementations probably aren't
as efficient as the hand-coded versions, but I don't think they were
ever time-critical.

10 years agomath/mpx.c: Eliminate clone-and-hack of shifting primitives.
Mark Wooding [Thu, 27 Mar 2014 03:18:32 +0000 (03:18 +0000)]
math/mpx.c: Eliminate clone-and-hack of shifting primitives.

Replace with some fancy macros.

10 years agorand/noise.c (noise_filter): Use the <mLib/sel.h> machinery.
Mark Wooding [Sat, 13 Jul 2013 15:34:40 +0000 (16:34 +0100)]
rand/noise.c (noise_filter): Use the <mLib/sel.h> machinery.

Makes things a little more verbose but rather simpler.

10 years agorand/noise.c (noise_filter): Use <mLib/mdup.h>.
Mark Wooding [Sat, 13 Jul 2013 15:34:40 +0000 (16:34 +0100)]
rand/noise.c (noise_filter): Use <mLib/mdup.h>.

The code was slightly incorrect previously: if the standard descriptors
are closed to begin with, then the pipe ends up being closed on entry.
As far as I know, this has never actually happened, but I have the
machinery to fix this bug so I might as well use it.

10 years agorand/noise.c (noise_filter): Invoke the shell properly.
Mark Wooding [Sat, 13 Jul 2013 15:34:40 +0000 (16:34 +0100)]
rand/noise.c (noise_filter): Invoke the shell properly.

This has been buggered forever. :-/

10 years agorand/noise.c: Environment variable to force use of `noise_filter'.
Mark Wooding [Sat, 13 Jul 2013 15:34:40 +0000 (16:34 +0100)]
rand/noise.c: Environment variable to force use of `noise_filter'.

For debugging, mostly.  Don't use this in real life.

10 years agorand/noise.c: Order <signal.h> properly.
Mark Wooding [Sat, 13 Jul 2013 15:34:40 +0000 (16:34 +0100)]
rand/noise.c: Order <signal.h> properly.

I try to keep them alphabetical.

10 years agomath/gfreduce.c: Fix commentary.
Mark Wooding [Wed, 12 Mar 2014 16:20:35 +0000 (16:20 +0000)]
math/gfreduce.c: Fix commentary.

Nothing very serious.

10 years agomath/mpreduce.c: Fix some typos in commentary.
Mark Wooding [Wed, 12 Mar 2014 16:20:06 +0000 (16:20 +0000)]
math/mpreduce.c: Fix some typos in commentary.

10 years agorand/noise.c (noise_timer): Actually update previous time.
Mark Wooding [Sat, 13 Jul 2013 15:34:40 +0000 (16:34 +0100)]
rand/noise.c (noise_timer): Actually update previous time.

A long-standing bug.  Oops.

10 years agorand/noise.c (noise_devrandom): Fix reading from the kernel random device.
Mark Wooding [Sat, 13 Jul 2013 15:34:40 +0000 (16:34 +0100)]
rand/noise.c (noise_devrandom): Fix reading from the kernel random device.

It was, unfortunately, filled with badgers.

  * Don't take short reads for an answer.  Loop until the read actually
    fails, or we've filled the buffer.

  * If we didn't actually read enough to fill the buffer, then don't
    return success!  The fallback collectors will engage and hopefully
    save our bacon.

10 years agogdsa: Generate nonces more securely.
Mark Wooding [Fri, 6 Sep 2013 09:46:54 +0000 (10:46 +0100)]
gdsa: Generate nonces more securely.

Hash the private key and message, together with some random stuff.  This
ought to be hard to guess even if the randomness is bad.

10 years agopub/gkcdsa.c: Fix label in test failure output.
Mark Wooding [Fri, 6 Sep 2013 09:45:22 +0000 (10:45 +0100)]
pub/gkcdsa.c: Fix label in test failure output.

10 years agoRelease 2.1.6.1. 2.1.6.1
Mark Wooding [Sat, 28 Dec 2013 14:21:51 +0000 (14:21 +0000)]
Release 2.1.6.1.

10 years agosymm/multigen: Fix for Python 2.5.
Mark Wooding [Sat, 28 Dec 2013 13:59:44 +0000 (13:59 +0000)]
symm/multigen: Fix for Python 2.5.

The top-level `next' function was introduced in 2.6, so use `.next()'
and catch `StopIteration'.

10 years agomath/gen{primes,wheel}.c: Don't use full header file name in `#include'.
Mark Wooding [Sat, 28 Dec 2013 13:36:37 +0000 (13:36 +0000)]
math/gen{primes,wheel}.c: Don't use full header file name in `#include'.

This makes source distributions fail badly.

10 years agoRelease 2.1.6. 2.1.6
Mark Wooding [Fri, 27 Dec 2013 14:29:16 +0000 (14:29 +0000)]
Release 2.1.6.

10 years agomath/mp-jacobi.c: Fix embarrassing spelling mistake in documentation.
Mark Wooding [Fri, 27 Dec 2013 12:32:12 +0000 (12:32 +0000)]
math/mp-jacobi.c: Fix embarrassing spelling mistake in documentation.

10 years agomath/mp-gcd.c: Minor reformatting.
Mark Wooding [Fri, 27 Dec 2013 12:02:26 +0000 (12:02 +0000)]
math/mp-gcd.c: Minor reformatting.

So that it matches the recent fix a little better.

10 years agomath/mp-gcd.c: Avoid clobbering constants during the sign fixup.
Mark Wooding [Fri, 27 Dec 2013 12:00:53 +0000 (12:00 +0000)]
math/mp-gcd.c: Avoid clobbering constants during the sign fixup.

If the GCD computation was trivial, then the state still contains
references to the constants `MP_ZERO' and `MP_ONE'.  It would be Really Bad
to trash their signs -- in particular, this causes comparisons with
`MP_ONE' to fail, leading to an assertion failure from `mp_modinv'.

10 years agoMakefile.am: Add some forgotten files to the distribution archive.
Mark Wooding [Fri, 27 Dec 2013 11:56:48 +0000 (11:56 +0000)]
Makefile.am: Add some forgotten files to the distribution archive.

10 years agoMore whitespace fixes.
Mark Wooding [Sun, 11 Aug 2013 01:07:41 +0000 (02:07 +0100)]
More whitespace fixes.

With a little luck, that'll be the last for a while.

10 years ago.gitattributes: New file; Python programs shouldn't have tabs.
Mark Wooding [Sun, 11 Aug 2013 01:08:00 +0000 (02:08 +0100)]
.gitattributes: New file; Python programs shouldn't have tabs.

10 years agoSome more whitespace cleanups.
Mark Wooding [Sat, 10 Aug 2013 20:19:58 +0000 (21:19 +0100)]
Some more whitespace cleanups.

10 years agomath/gfreduce.c, math/mpreduce.c: Remove unused macro from testing code.
Mark Wooding [Sat, 10 Aug 2013 08:48:52 +0000 (09:48 +0100)]
math/gfreduce.c, math/mpreduce.c: Remove unused macro from testing code.

Must have been cut-and-paste lossage when the tests were added.

Also remove a spurious blank line.

10 years agomath/gfreduce.[ch]: Fix out-of-bounds memory access.
Mark Wooding [Fri, 9 Aug 2013 12:22:47 +0000 (13:22 +0100)]
math/gfreduce.[ch]: Fix out-of-bounds memory access.

The final pass of the reduction adds a multiple of the extra top bits
from the most significant word; but at this point, the generated
instruction sequence will access a word one beyond the bottom of the
supplied memory vector.  While it (probably) won't modify this word, it
will still attempt to read and write it.

This is relatively harmless, since typically the vector will have been
allocated from our custom arena, and therefore there'll be a header word
in this position, but hand-built polynomials may cause trouble.

Fix this bug by keeping track of the first instruction which accesses a
word other than the least significant, and using this alternative entry
point in the final pass.  Fortunately, there's an unused slot, `liv', in
the context structure which we can use for this purpose!

(Yes, the previous refactoring was largely for the purpose of fixing
this bug.)

10 years agomath/gfreduce.c: Refactor and document.
Mark Wooding [Fri, 9 Aug 2013 09:30:48 +0000 (10:30 +0100)]
math/gfreduce.c: Refactor and document.

There was an unfortunate amount of code duplication in the old code,
particularly around the issuing of LSR instruction sequences.  Gather
the relevant state into a structure, and split the repeated code into
separate functions.

A casualty of this refactoring work is the work put into calculating the
`liv' slot in the `gfreduce' structure, carefully calculated to be a
pointer immediately after the first `STORE' instruction.  Alas, this
information is completely useless.

Also add a bunch of commentary explaining the underlying theory.

10 years agomath/gfreduce.h: Missing include.
Mark Wooding [Fri, 9 Aug 2013 09:13:15 +0000 (10:13 +0100)]
math/gfreduce.h: Missing include.

10 years agomath/*.awk: These should have been killed when `mpgen' appeared.
Mark Wooding [Fri, 9 Aug 2013 09:12:16 +0000 (10:12 +0100)]
math/*.awk: These should have been killed when `mpgen' appeared.

10 years agomath/t/mpreduce: Add a slew more randomized tests.
Mark Wooding [Tue, 6 Aug 2013 18:50:02 +0000 (19:50 +0100)]
math/t/mpreduce: Add a slew more randomized tests.

With a little luck, that's the main edge cases in the algorithm
tested (as well as merely proven correct).

10 years agomath/mpreduce.[ch]: Extend the domain to all positive integers.
Mark Wooding [Tue, 6 Aug 2013 18:49:08 +0000 (19:49 +0100)]
math/mpreduce.[ch]: Extend the domain to all positive integers.

Integers of the form (100...)_2 are now acceptable, at last, now that
I've got a grip on the underlying theory.  (It's somewhat embarrassing
that it's taken so long, given that the algorithm was my own work to
begin with, but it was all rather trial-and-error.)

Negative numbers still don't work, and probably never will.

10 years agoutils/naf.c: Wrap up the state machine correctly.
Mark Wooding [Tue, 6 Aug 2013 18:37:34 +0000 (19:37 +0100)]
utils/naf.c: Wrap up the state machine correctly.

The old code just assumed a particular resulution (in particular, the
`X' case), which is far from universally applicable.  Now we simulate up
to two more steps, feeding in zero bits.

10 years agomath/mpgen: Remove spurious newlines in `mplimits.c'.
Mark Wooding [Tue, 6 Aug 2013 17:47:50 +0000 (18:47 +0100)]
math/mpgen: Remove spurious newlines in `mplimits.c'.

10 years agoutils/naf.c: Non-adjacent form calculator, from math/mpreduce.c.
Mark Wooding [Mon, 5 Aug 2013 20:16:53 +0000 (21:16 +0100)]
utils/naf.c: Non-adjacent form calculator, from math/mpreduce.c.

Rescue the plain old state machine, in case it's interesting later.

10 years agomath/mpreduce.c: Remove ancient debugging code.
Mark Wooding [Mon, 5 Aug 2013 20:15:45 +0000 (21:15 +0100)]
math/mpreduce.c: Remove ancient debugging code.

10 years agomath/gfreduce.c: Fix misformatting in the commentary.
Mark Wooding [Mon, 5 Aug 2013 20:14:06 +0000 (21:14 +0100)]
math/gfreduce.c: Fix misformatting in the commentary.

10 years agomath/mpreduce.c: Add extensive commentary.
Mark Wooding [Mon, 5 Aug 2013 20:13:48 +0000 (21:13 +0100)]
math/mpreduce.c: Add extensive commentary.

The behaviour of this code must have been something of a mystery.  It's
not arbitrary, but it is a little subtle in places.  Add a full
explanation of the whole thing.

10 years agomath/mpreduce.h: Missing include files.
Mark Wooding [Mon, 5 Aug 2013 20:12:32 +0000 (21:12 +0100)]
math/mpreduce.h: Missing include files.

This all seems rather unfinished, really.

10 years agomath/mp-jacobi.c: Improve the presentation.
Mark Wooding [Mon, 5 Aug 2013 01:52:41 +0000 (02:52 +0100)]
math/mp-jacobi.c: Improve the presentation.

Make the commentary a bit more useful, and move the code about to fit
in.

10 years agomath/ec-prime.c: Fix commentary typo.
Mark Wooding [Mon, 5 Aug 2013 01:52:20 +0000 (02:52 +0100)]
math/ec-prime.c: Fix commentary typo.

10 years agomath/ec.c (ec_stdsub): Remove redundant `EC_FIX'.
Mark Wooding [Mon, 5 Aug 2013 01:41:12 +0000 (02:41 +0100)]
math/ec.c (ec_stdsub): Remove redundant `EC_FIX'.

This was left over from the old days, when the right input to `add'
was guaranteed to be in canonical form.  It's not been necessary since
391faf4...

10 years agomath/mp-modsqrt.c: Reformat and add commentary.
Mark Wooding [Sat, 3 Aug 2013 11:28:45 +0000 (12:28 +0100)]
math/mp-modsqrt.c: Reformat and add commentary.

10 years agomath/mp.h, math/mp-jacobi.c: Whitespace fix.
Mark Wooding [Sat, 3 Aug 2013 11:28:13 +0000 (12:28 +0100)]
math/mp.h, math/mp-jacobi.c: Whitespace fix.

10 years agovars.am: Remove extra prerequisite from the `.to.t' rule.
Mark Wooding [Sat, 3 Aug 2013 10:51:37 +0000 (11:51 +0100)]
vars.am: Remove extra prerequisite from the `.to.t' rule.

It doesn't do what one expects.

10 years agoprogs/catsign.1: Fix the warning about `verify' output.
Mark Wooding [Thu, 11 Jul 2013 09:09:14 +0000 (10:09 +0100)]
progs/catsign.1: Fix the warning about `verify' output.

Obviously copied from `catcrypt decrypt', which does only output
verified data because of its chunking; but `catsign' doesn't work like
this by default.

10 years agoprogs/catsign.c: Remove old debugging code.
Mark Wooding [Thu, 11 Jul 2013 09:05:59 +0000 (10:05 +0100)]
progs/catsign.c: Remove old debugging code.

Commented out, but still annoying.

10 years agoprogs/pixie.c: Use GNU capital-letter convention in HELP output.
Mark Wooding [Wed, 10 Jul 2013 23:09:05 +0000 (00:09 +0100)]
progs/pixie.c: Use GNU capital-letter convention in HELP output.

10 years agoprogs/pixie.[c1]: Don't replace the existing pixie by default.
Mark Wooding [Wed, 10 Jul 2013 23:07:43 +0000 (00:07 +0100)]
progs/pixie.[c1]: Don't replace the existing pixie by default.

It's too easy to screw things up by replacing the running pixie, by
calling the pixie with no arguments.  The old behaviour is available via
the shiny new `--replace' option.

10 years agoprogs/cookie.c: Constant-time MAC tag checking.
Mark Wooding [Sun, 30 Jun 2013 00:17:18 +0000 (01:17 +0100)]
progs/cookie.c: Constant-time MAC tag checking.

10 years agoRelease 2.1.5. 2.1.5
Mark Wooding [Fri, 28 Jun 2013 23:42:04 +0000 (00:42 +0100)]
Release 2.1.5.

10 years agoMollify various warnings which occur in 64-bit builds.
Mark Wooding [Fri, 28 Jun 2013 23:23:07 +0000 (00:23 +0100)]
Mollify various warnings which occur in 64-bit builds.

10 years agopixie.c: Use `socklen_t' rather than `size_t'.
Mark Wooding [Fri, 28 Jun 2013 23:22:28 +0000 (00:22 +0100)]
pixie.c: Use `socklen_t' rather than `size_t'.

10 years agokey/pixie-common.c, progs/pixie.c: Handle error returns better.
Mark Wooding [Sat, 22 Jun 2013 15:23:56 +0000 (16:23 +0100)]
key/pixie-common.c, progs/pixie.c: Handle error returns better.

This was rather bad, really.  It's still not perfect, by a long way.

10 years agoprogs/pixie.c: Fix format security bugs.
Mark Wooding [Sat, 22 Jun 2013 15:24:52 +0000 (16:24 +0100)]
progs/pixie.c: Fix format security bugs.

Really not very impressive.

10 years agoUse the shiny new `mLib' warning-control macros.
Mark Wooding [Sat, 22 Jun 2013 14:04:44 +0000 (15:04 +0100)]
Use the shiny new `mLib' warning-control macros.

10 years agoprogs: Fix a number of format-related errors.
Mark Wooding [Sat, 22 Jun 2013 14:03:33 +0000 (15:03 +0100)]
progs: Fix a number of format-related errors.

Picked up by the new `mLib' attribute machinery.

10 years agoMuffle GCC warnings in various ways.
Mark Wooding [Wed, 19 Jun 2013 02:09:46 +0000 (03:09 +0100)]
Muffle GCC warnings in various ways.

Some don't require much in the way of contortion to muffle without using
GCC-specific tricks.  Others are hard or impossible to avoid -- because
they're to do with macro definitions, or even actually GCC bugs (e.g.,
the array-bounds warning in `square.c') -- without just muffling the
warnings explicitly, by name.

10 years agoprogs/pixie.c: Rewrite list hacking to avoid strict-aliasing badness.
Mark Wooding [Wed, 19 Jun 2013 00:43:57 +0000 (01:43 +0100)]
progs/pixie.c: Rewrite list hacking to avoid strict-aliasing badness.

The circular list stuff was quite pretty but involved some really
unpleasant casting which modern GCC (quite properly) complains about
vociferously.

Replace it with more traditional doubly-linked-list hacking with
null-pointer sentinels, with the slightly nasty pointer swizzling tucked
away in useful macros.  Some of the uses of these macros (e.g.,
unlinking the first or last item in a list) could be made more efficient
by using special-case versions, but it doesn't seem worthwhile.

10 years agoprogs/pixie.c: Rename `log' function to `pxlog'.
Mark Wooding [Wed, 19 Jun 2013 00:39:03 +0000 (01:39 +0100)]
progs/pixie.c: Rename `log' function to `pxlog'.

Shuts up an annoying compiler warning.

10 years agodebian: Use Debhelper 8 rather than the awful custom script.
Mark Wooding [Fri, 14 Jun 2013 19:43:15 +0000 (20:43 +0100)]
debian: Use Debhelper 8 rather than the awful custom script.

10 years agodebian/control: Remove irrelevant blather about `xpixie'.
Mark Wooding [Fri, 14 Jun 2013 19:43:15 +0000 (20:43 +0100)]
debian/control: Remove irrelevant blather about `xpixie'.

The script was never shipped.

10 years agoOverhaul `math' representation machinery.
Mark Wooding [Wed, 5 Jun 2013 16:14:30 +0000 (17:14 +0100)]
Overhaul `math' representation machinery.

Collect type information from the C compiler at configuration
time (using a rather complicated hack so that it works with
cross-compilers).  Read this from a Python script `mpgen' which is now
responsible for knowing all of the `mp' representation details.

Since `mpgen' generates all of the constant tables directly, we no
longer have any need for the programs `genlimits' or `mpdump' -- or the
random collection of `awk' scripts for turning `mumbletab.in' files into
`mumbletab.c' files.  And this means that we can kill `libmpbase.la'.

With this change, Catacomb is finally safe for cross-compilation.

10 years agoGenerate precomputed tables as sources in `precomps/'.
Mark Wooding [Sun, 2 Jun 2013 20:37:47 +0000 (21:37 +0100)]
Generate precomputed tables as sources in `precomps/'.

Rather than header files in the build tree.  The precomputations are
distributed, and not built in cross builds.

10 years agoRearrange the file tree.
Mark Wooding [Sun, 2 Jun 2013 11:54:11 +0000 (12:54 +0100)]
Rearrange the file tree.

It's actually, like, a tree now.  Testing is a bit wobbly: you really do
have to make the library before the tests will build.  I don't like
this, but the pieces of the library are all rather intertwined.

One small piece of unintertwining: `strongprime.c' no longer includes
`rand.h', which detaches the mathematical code from the symmetric-crypto
build system disaster.

Test files have been moved into `t/' directories as is now established
practice.

Also take the opportunity to eradicate the CVS `$Id...$' droppings.

10 years agoconfigure.ac: Replace with a new version.
Mark Wooding [Sat, 1 Jun 2013 22:39:51 +0000 (23:39 +0100)]
configure.ac: Replace with a new version.

10 years agoblowfish-mktab.c: Remove the eye-candy progress meter.
Mark Wooding [Sat, 1 Jun 2013 19:35:54 +0000 (20:35 +0100)]
blowfish-mktab.c: Remove the eye-candy progress meter.

It really makes a mess of parallel builds.

10 years agoAbandon the `m4'-based build system. And there was great rejoicing.
Mark Wooding [Sat, 1 Jun 2013 19:28:26 +0000 (20:28 +0100)]
Abandon the `m4'-based build system.  And there was great rejoicing.

The makefile has been entirely rewritten using old-fashioned Automake.
I've used the undocumented `foo_OBJECTS' variables in a couple of places
to make parallel builds work, but those will disappear again in the
course of future rearrangements of the source tree.

A couple of the scungier programs for building boilerplate source files
have been replaced by the marvellous new template-substitution program
`multigen'.

The `qcc' script is a casualty of the rearrangements.  Supporting it is
easy, but probably pointless.  So it's gone.

Currently most of the generated code is left in the build tree (rather
than the source tree) and not distributed.  This wants to be fixed
later, but the exact machinery will be rather different.

This is only the start of a programme of overhauling Catacomb's ageing
and rather nasty build system.  The objective is to end up with modern-
looking build scripts, and a pleasant and sensible directory tree.  Not
much of the actual code will change during this, though lots of it will
move around.  In particular, the testing machinery is likely to be
overhauled quite a lot.

10 years ago.links: Drop obsolete `lib-config.in' file.
Mark Wooding [Sat, 1 Jun 2013 22:38:03 +0000 (23:38 +0100)]
.links: Drop obsolete `lib-config.in' file.

10 years agokey-flags.c, key-pack.c, key-pass.c: Don't use the `key.h' machinery.
Mark Wooding [Sat, 1 Jun 2013 19:34:48 +0000 (20:34 +0100)]
key-flags.c, key-pack.c, key-pass.c: Don't use the `key.h' machinery.

These are logically part of the `key-data.h' layer, and don't need
anything beyond that, so remove the header-file inclusion.

10 years agoRelease 2.1.4. 2.1.4
Mark Wooding [Mon, 27 May 2013 21:34:38 +0000 (22:34 +0100)]
Release 2.1.4.

10 years agooaep.c, pkcs1.c: Use official constant-time operations.
Mark Wooding [Mon, 27 May 2013 21:23:58 +0000 (22:23 +0100)]
oaep.c, pkcs1.c: Use official constant-time operations.

The logic is a bit more contorted in places, but the security is better.

10 years agoct.c, ct.h: New constant-time operations.
Mark Wooding [Mon, 27 May 2013 21:23:35 +0000 (22:23 +0100)]
ct.c, ct.h: New constant-time operations.

10 years agoRevert "group.h: Fix the struct tag for `group'."
Mark Wooding [Mon, 27 May 2013 22:05:44 +0000 (23:05 +0100)]
Revert "group.h: Fix the struct tag for `group'."

I'm a moron.  The trailing `_' was there to distinguish my groups from
`struct group' in <grp.h>.  Put it back.

This reverts commit c6c823084467cc7a60808cdee8015529115b8b91.