catacomb-python
18 years agogf: New methods for various modular operations.
Mark Wooding [Wed, 5 Apr 2006 23:07:56 +0000 (00:07 +0100)]
gf: New methods for various modular operations.

Modular square root and quadratic solution, and trace and halftrace.
Implemented in C for GFReduce, with thin Python glue for GF objects.

18 years agomp: Be more restrictive about implicit conversions.
Mark Wooding [Wed, 5 Apr 2006 11:20:57 +0000 (12:20 +0100)]
mp: Be more restrictive about implicit conversions.

Implicit conversions, e.g., for binary operators, used to be quite
promiscuous.  In particular, if P is a curve point and x is an MP, then
P * x was a point multiplication, but x * P converted P to an integer
(by discarding the y coordinate) and multiplied in integers.  This is
clearly insane.

The new code is pickier about converting things to MPs or GFs.  Explicit
conversions can still be given.  And there will still be great confusion
if you mix Catacomb types with other numeric types.  But things seem
more logical now, at least.

The actual implicit conversion rules are as follows:

  * An MP and any type with a `long' conversion /except/ for GF, FE,
    ECPt or GE may convert to MP.

  * A GF and any type with a `long' conversion /except/ for MP, FE, ECPt
    or GE may convert to GF.

  * Anything which can convert to `long' may convert to FE.  This will
    lead to confusion if you mix FEs and ECPts, but I think that's
    asking for trouble anyway.

  * There are no implicit conversions to ECPt or GE.  However, ECPt can
    be multiplied by anything with a `long' conversion.

I hope this is right.  If not, I'll fiddle some more.

18 years agofield: Correct conversions from integers.
Mark Wooding [Thu, 30 Mar 2006 23:25:22 +0000 (00:25 +0100)]
field: Correct conversions from integers.

The function tofe refused to convert integers to field elements.  I seem
to remember deciding that this was too weird for binary fields, but in
retrospect this seems a mistake, since there's nothing stopping a binary
field element converting to an mp (or gf).

Previously, binary operations between a field element and a Python
integer failed, but a binop with a fe and an mp would force the fe to
downgrade to an mp, which seems really bizarre.

Also, I think there was a possibility of a memory leak in the old code.

18 years agogetulong: Compare with LONG_MAX to decide what Python type to use.
Mark Wooding [Wed, 22 Mar 2006 12:58:45 +0000 (12:58 +0000)]
getulong: Compare with LONG_MAX to decide what Python type to use.

This may reduce the number of bignums created on 64-bit machines.

18 years agokey: Use convulong instead of PyLong_AsUnsignedLong.
Mark Wooding [Tue, 21 Mar 2006 01:20:29 +0000 (01:20 +0000)]
key: Use convulong instead of PyLong_AsUnsignedLong.

Python 2.4's implementation of PyLong_AsUnsignedLong handles integers
correctly; but 2.3 insists on having a real `long' object.  Our
`convulong' function handles these, and also stranger things like MPs.
Use it.

18 years agokey: Fixing of expiry and deletion time properties.
Mark Wooding [Tue, 7 Mar 2006 14:38:43 +0000 (14:38 +0000)]
key: Fixing of expiry and deletion time properties.

Allow them to be modified.  Return the correct value for keys which
never expire or are deleted.

18 years agoRemove the various `getuNN' functions and replace them with getulong().
Mark Wooding [Tue, 7 Mar 2006 14:25:03 +0000 (14:25 +0000)]
Remove the various `getuNN' functions and replace them with getulong().

They weren't doing any real good anyway, and the implementation was
randomly buggy.

18 years agoutil: Report ValuError (not TypeError) for failed integer conversions.
Mark Wooding [Tue, 7 Mar 2006 14:12:42 +0000 (14:12 +0000)]
util: Report ValuError (not TypeError) for failed integer conversions.

18 years agokey: Add read-only mapping methods to Keyfile.
Mark Wooding [Mon, 6 Mar 2006 16:56:59 +0000 (16:56 +0000)]
key: Add read-only mapping methods to Keyfile.

18 years agomappings: Separate mapping methods into read-only and read-write.
Mark Wooding [Mon, 6 Mar 2006 16:56:41 +0000 (16:56 +0000)]
mappings: Separate mapping methods into read-only and read-write.

18 years agogitignore: Ignore the COPYING file.
Mark Wooding [Mon, 6 Mar 2006 16:55:27 +0000 (16:55 +0000)]
gitignore: Ignore the COPYING file.

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 agogroup: Implement KCDSA group generation.
Mark Wooding [Sun, 12 Feb 2006 00:39:05 +0000 (00:39 +0000)]
group: Implement KCDSA group generation.

Requires the corresponding feature in Catacomb.  Also fix a memory
management snafu in field-group-info handling.

18 years agoinfra: Add a copy of the GPL.
Mark Wooding [Wed, 8 Feb 2006 18:43:10 +0000 (18:43 +0000)]
infra: Add a copy of the GPL.

18 years agogf: Make GF.fromstring consistent with MP.fromstring
Mark Wooding [Sat, 4 Feb 2006 17:53:52 +0000 (17:53 +0000)]
gf: Make GF.fromstring consistent with MP.fromstring

The latter raises an exception if given an empty string, and reports
`bad radix' if it is, rather than `out of range'.

18 years agomp: Forbid negative bit numbers in {set,clear,test}bit methods.
Mark Wooding [Sun, 29 Jan 2006 13:55:35 +0000 (13:55 +0000)]
mp: Forbid negative bit numbers in {set,clear,test}bit methods.

18 years agoec, group: Bug squashing.
Mark Wooding [Sat, 28 Jan 2006 19:31:46 +0000 (19:31 +0000)]
ec, group: Bug squashing.

  * eccurve_pynew had a bad argument format string, which caused a
    segfault.

  * fginfo_pynew also had bogus argument parsing, found in sweep for
    similar bugs.

  * ECCurve.pt hadn't been fixed since curves became types.  Now done.

18 years ago__init__.py: Spruce up a lot.
Mark Wooding [Sat, 28 Jan 2006 19:12:38 +0000 (19:12 +0000)]
__init__.py: Spruce up a lot.

  * Divide into sections and add commentary.

  * Add static methods for BBSPriv class (ooops).

18 years agorand: Generators based on symmetric algorithms; fixing
Mark Wooding [Sat, 28 Jan 2006 19:09:57 +0000 (19:09 +0000)]
rand: Generators based on symmetric algorithms; fixing

  * Include support for the various generators based on symmetric
    algorithms: i.e., counter and OFB modes for block ciphers, and SEAL
    and RC4.

  * Recognise, and return correct subclass instance for, TLS and SSL
    generators, and the symmetric crypto-based generators.

18 years agomp: Replace MP.product() by an MPMul class. Much more useful.
Mark Wooding [Sat, 28 Jan 2006 19:07:27 +0000 (19:07 +0000)]
mp: Replace MP.product() by an MPMul class.  Much more useful.

18 years agoBug squashing.
Mark Wooding [Sat, 28 Jan 2006 19:03:25 +0000 (19:03 +0000)]
Bug squashing.

  * Fix setting functions to check for null value (interpreted as property
    deletion) and raise an exception or do something else useful.

  * Fix conversion of read buffer to string so it returns the remainder
    rather than the whole thing.

  * Make conversions between MP and Python long work on PyObjects rather
    than PyLongObjects, to eliminate pointless type casts.

  * Fix primefield constructor argument parsing so that it doesn't crash!

  * Fix radix checking in MP conversions to exclude +/-1, and 0 for output.
    This turns into a little function now.

  * Do argument checking on Jacobi function.

18 years agoReorganization: split out utilities; mapping methods
Mark Wooding [Sat, 28 Jan 2006 18:46:07 +0000 (18:46 +0000)]
Reorganization: split out utilities; mapping methods

  * Move non-project-specific Python utilities into a separate file.  They
    might conceivably find their way into a new project some day.

  * Implement the standard mapping methods generically (i.e., in terms of
    basic Python mapping operations).

  * Use the mapping methods for the various key-object-related mappings.

  * Start fixing setter functions for null values.

18 years agoalgorithms: Add PRPs as objects in their own right.
Mark Wooding [Sat, 28 Jan 2006 18:07:53 +0000 (18:07 +0000)]
algorithms: Add PRPs as objects in their own right.

18 years agodebian: various fixes.
Mark Wooding [Sat, 28 Jan 2006 14:41:08 +0000 (14:41 +0000)]
debian: various fixes.

  * Adopt Debian standard package naming.
  * Improve package descriptions.
  * Set up dependencies according to policy.

18 years agopassim: fix typo
Mark Wooding [Sat, 28 Jan 2006 14:26:52 +0000 (14:26 +0000)]
passim: fix typo

`tp_iternexr' instead of `tp_iternext'.

18 years agogf.c: remove stub file
Mark Wooding [Sat, 28 Jan 2006 14:04:24 +0000 (14:04 +0000)]
gf.c: remove stub file

This file never really got off the ground; the stuff that was meant
to go in it ended up in mp.c ages ago.

18 years agoExtract Subversion ignore data.
Mark Wooding [Sat, 28 Jan 2006 13:55:26 +0000 (13:55 +0000)]
Extract Subversion ignore data.

18 years agokey_qtag fixing.
mdw [Tue, 27 Sep 2005 11:27:14 +0000 (11:27 +0000)]
key_qtag fixing.

18 years agoBuffer sharing and subbuffers.
mdw [Tue, 27 Sep 2005 11:27:03 +0000 (11:27 +0000)]
Buffer sharing and subbuffers.

18 years agoCheckin, Debianized and more or less complete.
mdw [Mon, 26 Sep 2005 12:58:11 +0000 (12:58 +0000)]
Checkin, Debianized and more or less complete.

18 years agoFix for Cygwin.
mdw [Thu, 15 Sep 2005 11:58:36 +0000 (11:58 +0000)]
Fix for Cygwin.

18 years agoVarious other little bits.
mdw [Tue, 21 Jun 2005 07:15:39 +0000 (07:15 +0000)]
Various other little bits.

18 years agoModularize the password safe.
mdw [Tue, 21 Jun 2005 07:11:00 +0000 (07:11 +0000)]
Modularize the password safe.

19 years agoMore fixing for modern Pythons. No longer works with 2.2. Sorry.
mdw [Fri, 29 Apr 2005 13:11:19 +0000 (13:11 +0000)]
More fixing for modern Pythons.  No longer works with 2.2.  Sorry.

19 years agoUse default python to build.
mdw [Thu, 28 Apr 2005 09:41:54 +0000 (09:41 +0000)]
Use default python to build.

19 years agoFixing for Python 2.3 and later.
mdw [Wed, 27 Apr 2005 23:40:07 +0000 (23:40 +0000)]
Fixing for Python 2.3 and later.

19 years agoVarious minor fixings.
mdw [Sun, 10 Apr 2005 23:38:11 +0000 (23:38 +0000)]
Various minor fixings.

19 years agoInitial check-in of catacomb-python.
mdw [Sun, 10 Apr 2005 18:03:11 +0000 (18:03 +0000)]
Initial check-in of catacomb-python.

19 years agoImport catacomb-python.
mdw [Sun, 10 Apr 2005 17:59:47 +0000 (17:59 +0000)]
Import catacomb-python.