8 years agomath/gfreduce.[ch]: Fix out-of-bounds memory access. master
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 in the
context structure which we can use for this purpose!

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

8 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.

Also add a bunch of commentary explaining the underlying theory.

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

8 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.

8 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).

8 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.

8 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.

8 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'.

8 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.

8 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.

8 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.

8 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.

8 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.

8 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

8 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.

8 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

8 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.

8 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.

8 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.

8 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.

8 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.

8 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.

8 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.

8 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.

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

8 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.

8 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'.

8 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.

8 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.

8 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.

8 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.

8 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.

8 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

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.

8 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.

8 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.

8 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.

8 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.

8 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.

8 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

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

8 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.

8 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.

8 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

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.

8 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.

8 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.

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

8 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.

8 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.

8 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.

8 years agoMerge branch 'master' of git.distorted.org.uk:~mdw/publish/public-git/catacomb
Mark Wooding [Mon, 27 May 2013 21:28:12 +0000 (22:28 +0100)]
Merge branch 'master' of git.distorted.org.uk:~mdw/publish/public-git/catacomb

* 'master' of git.distorted.org.uk:~mdw/publish/public-git/catacomb:
  mpmul.[ch]: Move internal `HWM' and `LWM' constants to implementation.
  group.h: Fix the struct tag for `group'.

8 years agompmul.[ch]: Move internal `HWM' and `LWM' constants to implementation.
Mark Wooding [Tue, 30 Apr 2013 22:00:34 +0000 (23:00 +0100)]
mpmul.[ch]: Move internal `HWM' and `LWM' constants to implementation.

No idea what I was thinking when I put them in the public header file.

8 years agoRelease 2.1.3.
Mark Wooding [Thu, 11 Apr 2013 10:37:10 +0000 (11:37 +0100)]
Release 2.1.3.

8 years agoThe pixie no longer needs to be setuid-root.
Mark Wooding [Thu, 11 Apr 2013 11:02:21 +0000 (12:02 +0100)]
The pixie no longer needs to be setuid-root.

So turn off the option by default, and downgrade the question.  Also
make the documentation more useful and up-to-date.

8 years agogroup.h: Fix the struct tag for `group'.
Mark Wooding [Wed, 10 Apr 2013 19:40:36 +0000 (20:40 +0100)]
group.h: Fix the struct tag for `group'.

Maybe I was going to give it a longer name once upon a time.  It's stuck
now, though.

8 years agomkphrase.c: Allow a range for phrase entropy.
Mark Wooding [Mon, 8 Apr 2013 16:10:50 +0000 (17:10 +0100)]
mkphrase.c: Allow a range for phrase entropy.

8 years agomkphrase.c: Better error checking on the length range parameter.
Mark Wooding [Mon, 8 Apr 2013 16:09:49 +0000 (17:09 +0100)]
mkphrase.c: Better error checking on the length range parameter.

8 years agoNew function and example program computes Fibonacci numbers fairly fast.
Mark Wooding [Sun, 7 Apr 2013 22:44:34 +0000 (23:44 +0100)]
New function and example program computes Fibonacci numbers fairly fast.

8 years agohashsum.c: Document `--progress' in the `--help' display.
Mark Wooding [Thu, 28 Feb 2013 16:55:41 +0000 (16:55 +0000)]
hashsum.c: Document `--progress' in the `--help' display.


8 years ago.gitignore: Ignore `auto-version' script.
Mark Wooding [Thu, 28 Feb 2013 17:36:22 +0000 (17:36 +0000)]
.gitignore: Ignore `auto-version' script.

8 years agoRelease 2.1.2.
Mark Wooding [Wed, 9 Jan 2013 03:26:52 +0000 (03:26 +0000)]
Release 2.1.2.

8 years agoCleanups.
Mark Wooding [Wed, 9 Jan 2013 03:29:48 +0000 (03:29 +0000)]

  * Remove bogus old `catacomb-config.in' file from the pre-pkgconfig

  * Fix library version in Makefile.

8 years agocc-hash.c (fhash): The FILE name may be null.
Mark Wooding [Wed, 9 Jan 2013 03:56:20 +0000 (03:56 +0000)]
cc-hash.c (fhash): The FILE name may be null.

So pass a dummy string on for the progress indicator.

8 years agoHash utilities: Check for and report on junk files.
Mark Wooding [Sat, 25 Feb 2012 23:35:18 +0000 (23:35 +0000)]
Hash utilities: Check for and report on junk files.

That is, when verifying a list of hashes, we optionally detect and
report files which are present in the filesystem, alongside files which
we're checking, but which aren't in our list.

Thanks to Patrick Gosling for the idea.

8 years agoHash utilities: maintain a hash state object, not a bundle of arguments.
Mark Wooding [Mon, 7 Jan 2013 23:27:08 +0000 (23:27 +0000)]
Hash utilities: maintain a hash state object, not a bundle of arguments.

This makes a number of things a bit cleaner, except that we (currently
pointlessly) remember to free up this state object when we're finished
with it.

9 years agoUse auto-version machinery for building.
Mark Wooding [Thu, 3 May 2012 12:48:59 +0000 (13:48 +0100)]
Use auto-version machinery for building.

9 years agoMakefile.m4: Remove mplimits.[ch] on clean.
Mark Wooding [Thu, 3 May 2012 12:35:47 +0000 (13:35 +0100)]
Makefile.m4: Remove mplimits.[ch] on clean.

9 years agoconfigure.in: Put the auxiliary scripts in a useful place.
Mark Wooding [Thu, 3 May 2012 12:28:24 +0000 (13:28 +0100)]
configure.in: Put the auxiliary scripts in a useful place.

For some reason, modern Autoconf finds the wrong copy otherwise and
all ell breaks loose.

9 years agompint.c (touint): Compare unsigned with unsigned, not unsigned long.
Mark Wooding [Thu, 3 May 2012 09:54:16 +0000 (10:54 +0100)]
mpint.c (touint): Compare unsigned with unsigned, not unsigned long.

Otherwise the tests fail on LP64 platforms.

9 years agotests/Makefile.m4: Distribute the converted AES test-vector files.
Mark Wooding [Thu, 3 May 2012 09:44:20 +0000 (10:44 +0100)]
tests/Makefile.m4: Distribute the converted AES test-vector files.

Otherwise later versions of distcheck fail.

9 years agoMakefile.m4: Don't build pgroups.kr: it introduces circular dependency.
Mark Wooding [Thu, 3 May 2012 09:35:19 +0000 (10:35 +0100)]
Makefile.m4: Don't build pgroups.kr: it introduces circular dependency.

9 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.

9 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.

9 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.

9 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.

9 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.

9 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

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

9 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.

9 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.

9 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'.

9 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.

9 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?

9 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.

9 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.

9 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

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

9 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.

9 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.

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

10 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.

10 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).

10 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.

10 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.

10 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.

10 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.

10 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.

12 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.

12 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.

12 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.

12 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.

13 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.

13 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.

13 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.