chiark / gitweb /
catacomb-python
7 years agocatacomb-python.h: Don't inhibit 64-bit type detection any more.
Mark Wooding [Mon, 12 Sep 2016 21:26:53 +0000 (22:26 +0100)]
catacomb-python.h: Don't inhibit 64-bit type detection any more.

We'll be using `kludge64', and the definition must properly match up
with the library.

7 years agorand.c: Careful range checking on `block' and `mp'.
Mark Wooding [Mon, 12 Sep 2016 21:26:09 +0000 (22:26 +0100)]
rand.c: Careful range checking on `block' and `mp'.

  * For `mp', don't allow the `or' mask to be wider than the requested
    result.

  * For `range', insist that the limit is strictly positive, so that the
    output range is actually inhabited.

These parallel currently unreleased fixes to the underlying library,
which are required for things to work properly; so bump the dependency.

7 years agoutil.c: Zap spurious whitespace.
Mark Wooding [Mon, 12 Sep 2016 21:23:58 +0000 (22:23 +0100)]
util.c: Zap spurious whitespace.

7 years ago*.c: Fix docstrings for methods.
Mark Wooding [Mon, 12 Sep 2016 21:23:38 +0000 (22:23 +0100)]
*.c: Fix docstrings for methods.

Mostly fixing method names andarguments broken by bad copy-and-paste
editing.

7 years agoFurther fixing to use `Py_ssize_t' in place of int.
Mark Wooding [Sun, 11 Sep 2016 23:14:16 +0000 (00:14 +0100)]
Further fixing to use `Py_ssize_t' in place of int.

This addresses the remaining compiler warnings when building for 64-bit
targets.

7 years agoRelease 1.1.1. 1.1.1
Mark Wooding [Sat, 4 Jun 2016 00:17:35 +0000 (01:17 +0100)]
Release 1.1.1.

7 years agobytestring.c: Use `Py_ssize_t' for collecting buffer lengths.
Mark Wooding [Fri, 3 Jun 2016 20:27:36 +0000 (21:27 +0100)]
bytestring.c: Use `Py_ssize_t' for collecting buffer lengths.

On 64-bit platforms, this is a 64-bit long, so if we pass an int to
`PyObject_AsReadBuffer', it will clobber the next word too.

8 years agoRelease 1.1.0.1. 1.1.0.1
Mark Wooding [Fri, 19 Feb 2016 19:39:40 +0000 (19:39 +0000)]
Release 1.1.0.1.

8 years agodebian/control: Fix the Build-Depends.
Mark Wooding [Fri, 19 Feb 2016 09:00:49 +0000 (09:00 +0000)]
debian/control: Fix the Build-Depends.

8 years agodebian/source/format: Apparently we need one of these nowadays.
Mark Wooding [Fri, 19 Feb 2016 08:58:06 +0000 (08:58 +0000)]
debian/source/format: Apparently we need one of these nowadays.

8 years agoRelease 1.1.0. 1.1.0
Mark Wooding [Mon, 20 Jul 2015 15:11:21 +0000 (16:11 +0100)]
Release 1.1.0.

8 years agoRequire a shiny new library version.
Mark Wooding [Mon, 20 Jul 2015 13:44:43 +0000 (14:44 +0100)]
Require a shiny new library version.

8 years agoMerge branches 'mdw/pwsafe' and 'mdw/ec-ptcmpr'
Mark Wooding [Mon, 20 Jul 2015 13:40:18 +0000 (14:40 +0100)]
Merge branches 'mdw/pwsafe' and 'mdw/ec-ptcmpr'

* mdw/pwsafe:
  pwsafe: New command `xfer' to transfer data to a new database backend.
  catacomb/pwsafe.py: Add a backend based on SQLite.
  catacomb/pwsafe.py, pwsafe: Make GDBM support conditional.
  catacomb/pwsafe.py: New Git-friendly `DirectoryStorageBackend'.
  catacomb/pwsafe.py: New FlatFileStorageBackend class.
  catacomb/pwsafe.py: Add a new ABRUPTP argument to `close' methods.
  catacomb/pwsafe.py, pwsafe: Dispatching for multiple backends.
  catacomb/pwsafe.py: Split out the GDBM-specifics from StorageBackend.
  catacomb/pwsafe.py: Factor database handling out into a StorageBackend.
  catacomb/pwsafe.py: Commentary fix.
  pwsafe: Abolish the `chomp' function, and only chomp when reading stdin.
  catacomb/pwsafe.py: Make `PW' be a context manager, and use it.
  pwsafe: Get the master passphrase before the new password.
  pwsafe: Report password mismatch as an error, not an exception.
  pwsafe: Some simple reformatting.
  catacomb/pwsafe.py, pwsafe: Replace `PW''s MODE parameter with WRITEP flag.
  catacomb/pwsafe.py: Abolish the `PWIter' class.
  pwsafe: Eliminate the `dump' subcommand.
  pwsafe: Present the list of commands in alphabetical order.
  pwsafe: Don't produce a backtrace on decryption failure.

* mdw/ec-ptcmpr:
  catacomb.c, ec.c: Bindings for the new EC2OSP/OS2ECP functions.

8 years agopwsafe: New command `xfer' to transfer data to a new database backend.
Mark Wooding [Thu, 28 May 2015 09:58:06 +0000 (10:58 +0100)]
pwsafe: New command `xfer' to transfer data to a new database backend.

This works at the StorageBackend level, and doesn't require any secrets
to do its thing.

8 years agocatacomb/pwsafe.py: Add a backend based on SQLite.
Mark Wooding [Sun, 24 May 2015 18:33:21 +0000 (19:33 +0100)]
catacomb/pwsafe.py: Add a backend based on SQLite.

8 years agocatacomb/pwsafe.py, pwsafe: Make GDBM support conditional.
Mark Wooding [Sun, 24 May 2015 18:32:37 +0000 (19:32 +0100)]
catacomb/pwsafe.py, pwsafe: Make GDBM support conditional.

Only offer the GDBM backend if the module is actually available.  Also,
make the new `flat file' backend be the default, since it's the only one
which is guaranteed to exist.

8 years agocatacomb/pwsafe.py: New Git-friendly `DirectoryStorageBackend'.
Mark Wooding [Thu, 28 May 2015 10:09:26 +0000 (11:09 +0100)]
catacomb/pwsafe.py: New Git-friendly `DirectoryStorageBackend'.

8 years agocatacomb/pwsafe.py: New FlatFileStorageBackend class.
Mark Wooding [Sun, 24 May 2015 18:33:50 +0000 (19:33 +0100)]
catacomb/pwsafe.py: New FlatFileStorageBackend class.

No external dependencies required.

8 years agocatacomb/pwsafe.py: Add a new ABRUPTP argument to `close' methods.
Mark Wooding [Sun, 24 May 2015 18:26:36 +0000 (19:26 +0100)]
catacomb/pwsafe.py: Add a new ABRUPTP argument to `close' methods.

New backends might want to commit changes at close time, and an abrupt
close shouldn't do that.

8 years agocatacomb/pwsafe.py, pwsafe: Dispatching for multiple backends.
Mark Wooding [Sun, 24 May 2015 18:22:29 +0000 (19:22 +0100)]
catacomb/pwsafe.py, pwsafe: Dispatching for multiple backends.

This commit introduces a number of tightly related changes.

  * Have concrete backends declare a `NAME' attribute.  This lets users
    name them, and lets us determine which classes are concrete.

  * Introduce a metaclass which registers concrete StorageClass
    subclasses.

  * Extend the `_open' protocol, so that it can raise the new
    StorageBackendRefusal exception to indicate that some other backend
    should try to open the given file.

  * Introduce a `StorageBackend.open' method which examines all
    registered backends and gives each of them an opportunity to open
    the file in some priority order.

  * Add a new method for looking up backends by name.

  * introduce a new DBCLS parameter to `PW.create', which is the backend
    class to use when creating a new database.

  * Introduce a new option to the `create' command to choose the
    database backend by name.

There's only one backend at the moment, though that will change soon.

8 years agocatacomb/pwsafe.py: Split out the GDBM-specifics from StorageBackend.
Mark Wooding [Sun, 24 May 2015 17:59:55 +0000 (18:59 +0100)]
catacomb/pwsafe.py: Split out the GDBM-specifics from StorageBackend.

For now, use the GDBM-based backend explicitly and unconditionally,
because there isn't another one anyway.

8 years agocatacomb/pwsafe.py: Factor database handling out into a StorageBackend.
Mark Wooding [Sun, 24 May 2015 17:49:44 +0000 (18:49 +0100)]
catacomb/pwsafe.py: Factor database handling out into a StorageBackend.

This doesn't (currently) affect the external interface.

8 years agocatacomb/pwsafe.py: Commentary fix.
Mark Wooding [Sun, 24 May 2015 17:06:54 +0000 (18:06 +0100)]
catacomb/pwsafe.py: Commentary fix.

8 years agopwsafe: Abolish the `chomp' function, and only chomp when reading stdin.
Mark Wooding [Sun, 24 May 2015 17:02:31 +0000 (18:02 +0100)]
pwsafe: Abolish the `chomp' function, and only chomp when reading stdin.

We have `S.rstrip()' instead.

8 years agocatacomb.c, ec.c: Bindings for the new EC2OSP/OS2ECP functions.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
catacomb.c, ec.c: Bindings for the new EC2OSP/OS2ECP functions.

8 years agoUse ValueError instead of SyntaxError throughout.
Mark Wooding [Fri, 29 May 2015 08:34:09 +0000 (09:34 +0100)]
Use ValueError instead of SyntaxError throughout.

SyntaxError has a much more specific meaning, and some software, such as
`ipython', expect it to carry lots of other detailed information.

So abolish the `SYNERR' macro, and use `VALERR' instead consistently.  I
wish I had an excuse for this blunder, but I don't.

8 years agocatacomb/pwsafe.py: Make `PW' be a context manager, and use it.
Mark Wooding [Sun, 24 May 2015 15:45:32 +0000 (16:45 +0100)]
catacomb/pwsafe.py: Make `PW' be a context manager, and use it.

8 years agopwsafe: Get the master passphrase before the new password.
Mark Wooding [Sun, 24 May 2015 15:49:40 +0000 (16:49 +0100)]
pwsafe: Get the master passphrase before the new password.

This saves lots of repeating the new password if the user is prone to
typing the master password wrongly.  Like I am.

8 years agopwsafe: Report password mismatch as an error, not an exception.
Mark Wooding [Sun, 24 May 2015 15:46:39 +0000 (16:46 +0100)]
pwsafe: Report password mismatch as an error, not an exception.

8 years agopwsafe: Some simple reformatting.
Mark Wooding [Sun, 24 May 2015 15:45:32 +0000 (16:45 +0100)]
pwsafe: Some simple reformatting.

8 years agocatacomb/pwsafe.py, pwsafe: Replace `PW''s MODE parameter with WRITEP flag.
Mark Wooding [Sun, 24 May 2015 15:38:11 +0000 (16:38 +0100)]
catacomb/pwsafe.py, pwsafe: Replace `PW''s MODE parameter with WRITEP flag.

This abstracts away from the GDBM interface slightly, and makes it a bit
more convenient for other implementations.

8 years agocatacomb/pwsafe.py: Abolish the `PWIter' class.
Mark Wooding [Sun, 24 May 2015 17:06:03 +0000 (18:06 +0100)]
catacomb/pwsafe.py: Abolish the `PWIter' class.

There's no identifiable advantage to writing all of that out longhand
over a simple generator.  So do that instead.

8 years agopwsafe: Eliminate the `dump' subcommand.
Mark Wooding [Sun, 24 May 2015 10:47:02 +0000 (11:47 +0100)]
pwsafe: Eliminate the `dump' subcommand.

Its functionality will be replaced later.

Also, remove some functions which existed only to support `dump'.

8 years agopwsafe: Present the list of commands in alphabetical order.
Mark Wooding [Thu, 28 May 2015 09:57:28 +0000 (10:57 +0100)]
pwsafe: Present the list of commands in alphabetical order.

Previously they were in whatever dictionary order.  Hopeless.

8 years agoalgorithms.py, rand.c: Support `Latin dances' stream ciphers.
Mark Wooding [Tue, 26 May 2015 14:13:23 +0000 (15:13 +0100)]
algorithms.py, rand.c: Support `Latin dances' stream ciphers.

8 years agocatacomb/__init__.py: Trim `/' from identifiers names.
Mark Wooding [Tue, 26 May 2015 15:03:11 +0000 (16:03 +0100)]
catacomb/__init__.py: Trim `/' from identifiers names.

8 years agoalgorithms.py, rand.c: Move constant definitions and so on to `rand.c'.
Mark Wooding [Tue, 26 May 2015 13:06:36 +0000 (14:06 +0100)]
algorithms.py, rand.c: Move constant definitions and so on to `rand.c'.

8 years agoFix the missing-module-names bug properly.
Mark Wooding [Tue, 26 May 2015 15:02:01 +0000 (16:02 +0100)]
Fix the missing-module-names bug properly.

Introduce a wrapper `typeready' around `PyType_Ready' which sets the
module name, and call it everywhere it's needed.

8 years agocatacomb-python.h: Promote `util' to the head of the list.
Mark Wooding [Tue, 26 May 2015 15:00:32 +0000 (16:00 +0100)]
catacomb-python.h: Promote `util' to the head of the list.

If anything needs to prepare for other modules, it's common utilities.

8 years agoalgorithms.py: Fiddling with whitespace.
Mark Wooding [Tue, 26 May 2015 13:04:37 +0000 (14:04 +0100)]
algorithms.py: Fiddling with whitespace.

Both layout and quoted.

8 years agocatacomb-python.h: Formatting fix.
Mark Wooding [Tue, 26 May 2015 15:00:52 +0000 (16:00 +0100)]
catacomb-python.h: Formatting fix.

8 years agopwsafe: Don't produce a backtrace on decryption failure.
Mark Wooding [Sun, 24 May 2015 09:53:27 +0000 (10:53 +0100)]
pwsafe: Don't produce a backtrace on decryption failure.

8 years agocatacomb/__init__.py: Generalize rationals to fields of fractions.
Mark Wooding [Wed, 13 May 2015 10:39:25 +0000 (11:39 +0100)]
catacomb/__init__.py: Generalize rationals to fields of fractions.

Now we can have ratios of binary polynomials too.

9 years agocatacomb.c: Handle Python's randomize hashing parameters properly.
Mark Wooding [Fri, 10 Apr 2015 14:19:25 +0000 (15:19 +0100)]
catacomb.c: Handle Python's randomize hashing parameters properly.

9 years agoProper hashing for comparable object types.
Mark Wooding [Fri, 10 Apr 2015 14:19:25 +0000 (15:19 +0100)]
Proper hashing for comparable object types.

Some of the existing object hash algorithms have changed, but I think
we'll live with that.

9 years agoStamp the module name onto types properly.
Mark Wooding [Fri, 10 Apr 2015 14:19:25 +0000 (15:19 +0100)]
Stamp the module name onto types properly.

Our types are `dynamic', because the Python code adds extra methods to
them.  Apparently the correct thing to do in such cases is to put the
raw type name in the `tp_name' slot, and stuff the module name into
`tp_dict' by hand.

9 years agocatacomb/__init__.py: Slightly cheesy rational arithmetic.
Mark Wooding [Fri, 27 Feb 2015 14:41:18 +0000 (14:41 +0000)]
catacomb/__init__.py: Slightly cheesy rational arithmetic.

Invoked from MP exact division.

9 years agomp.c: Binding for `mp_fibonacci'.
Mark Wooding [Fri, 27 Feb 2015 14:40:26 +0000 (14:40 +0000)]
mp.c: Binding for `mp_fibonacci'.

9 years agomp.c: Proper binding for `mp_factorial'.
Mark Wooding [Fri, 27 Feb 2015 14:40:01 +0000 (14:40 +0000)]
mp.c: Proper binding for `mp_factorial'.

Rather than using the cardboard one in Python.

9 years agoalgorithms.c: Add bindings for the key-strength conversion functions.
Mark Wooding [Thu, 26 Feb 2015 19:32:54 +0000 (19:32 +0000)]
algorithms.c: Add bindings for the key-strength conversion functions.

9 years agopubkey.c: Catch invalid arguments to `RSAPub' and `RSAPriv'.
Mark Wooding [Fri, 6 Feb 2015 11:06:14 +0000 (11:06 +0000)]
pubkey.c: Catch invalid arguments to `RSAPub' and `RSAPriv'.

If a modulus is even, `mpmont_create' will silently fail inside
`rsa_{pub,priv}create' and a later modexp will likely segfault.

9 years agocatacomb/pwsafe.py: Eliminate the Buffer class and struct module.
Mark Wooding [Sat, 24 May 2014 13:00:03 +0000 (14:00 +0100)]
catacomb/pwsafe.py: Eliminate the Buffer class and struct module.

All is done using Catacomb's ReadBuffer and WriteBuffer classes.

9 years agobuffer.c: Fix docstring for WriteBuffer.zero.
Mark Wooding [Sat, 24 May 2014 13:00:03 +0000 (14:00 +0100)]
buffer.c: Fix docstring for WriteBuffer.zero.

9 years agopwsafe, catacomb/pwsafe.py: Push database creation into module.
Mark Wooding [Sat, 24 May 2014 13:00:03 +0000 (14:00 +0100)]
pwsafe, catacomb/pwsafe.py: Push database creation into module.

It didn't even work where it was because `_wrapstr' wasn't available.
This code is now functional again.

9 years agopwsafe, catacomb/pwsafe.py: Documentation and cleanup.
Mark Wooding [Sat, 24 May 2014 13:00:03 +0000 (14:00 +0100)]
pwsafe, catacomb/pwsafe.py: Documentation and cleanup.

Nothing very major yet: some whitespace fettling, some comments added,
and some code reordered.  Also added copyright headers, and docstrings.
There's a lot more work to do on this: it's in a really sorry state.

10 years agoRelease 1.0.6. 1.0.6
Mark Wooding [Sat, 4 Jan 2014 01:38:40 +0000 (01:38 +0000)]
Release 1.0.6.

10 years agokey.c (keyexc_raise): Put the error text in the exception.
Mark Wooding [Wed, 1 Jan 2014 17:32:59 +0000 (17:32 +0000)]
key.c (keyexc_raise): Put the error text in the exception.

Makes it much easier for humans who are just given the raw exception
backtrace.

10 years agokey.c (key_pynew): Make `exptime' arg (a) optional, and (b) unsigned.
Mark Wooding [Wed, 1 Jan 2014 17:32:08 +0000 (17:32 +0000)]
key.c (key_pynew): Make `exptime' arg (a) optional, and (b) unsigned.

Otherwise (a) it was pointless trying to set a default, and (b) you get
an error when you try to set KEXP_FOREVER explicitly.  Effectively it
was impossible to make keys which never expire.

10 years agokey.c (key_pynew): Fix stupid error-checking sense bug.
Mark Wooding [Wed, 1 Jan 2014 17:31:02 +0000 (17:31 +0000)]
key.c (key_pynew): Fix stupid error-checking sense bug.

This code can never have worked.

10 years agoRelease 1.0.5. 1.0.5
Mark Wooding [Sun, 21 Jul 2013 14:57:34 +0000 (15:57 +0100)]
Release 1.0.5.

10 years agobuffer.c: Fix buffer resizing logic.
Mark Wooding [Sun, 21 Jul 2013 14:56:02 +0000 (15:56 +0100)]
buffer.c: Fix buffer resizing logic.

10 years agoFix a few minor warnings.
Mark Wooding [Sun, 23 Jun 2013 08:04:24 +0000 (09:04 +0100)]
Fix a few minor warnings.

10 years agodebian: Abandon CDBS for plain Debhelper.
Mark Wooding [Sat, 15 Jun 2013 15:13:46 +0000 (16:13 +0100)]
debian: Abandon CDBS for plain Debhelper.

10 years agoOverhaul build system using new `cfd' machinery.
Mark Wooding [Sat, 15 Jun 2013 23:12:54 +0000 (00:12 +0100)]
Overhaul build system using new `cfd' machinery.

10 years agoOverhaul formatting.
Mark Wooding [Sun, 16 Jun 2013 14:22:38 +0000 (15:22 +0100)]
Overhaul formatting.

Expunge CVS droppings and use newer comment stylings.

11 years agoBuild against Python 2.7. This is release 1.0.4. 1.0.4
Mark Wooding [Wed, 9 Jan 2013 02:57:37 +0000 (02:57 +0000)]
Build against Python 2.7.  This is release 1.0.4.

11 years agodebian/control: Declare dependency on a new Catacomb.
Mark Wooding [Wed, 9 Jan 2013 04:05:42 +0000 (04:05 +0000)]
debian/control: Declare dependency on a new Catacomb.

11 years agokey.c (kdmeth_copy): Fix some stupid mistakes.
Mark Wooding [Wed, 9 Jan 2013 04:05:19 +0000 (04:05 +0000)]
key.c (kdmeth_copy): Fix some stupid mistakes.

11 years agokey.c: New KeyData method `copy'.
Mark Wooding [Mon, 23 Jan 2012 03:09:00 +0000 (03:09 +0000)]
key.c: New KeyData method `copy'.

Requires a shiny new version of Catacomb.

11 years agokey.c (convflags): Fix error message.
Mark Wooding [Mon, 23 Jan 2012 03:08:06 +0000 (03:08 +0000)]
key.c (convflags): Fix error message.

There's only one integer expected really.

11 years agokey.c: Split before storing a subkey.
Mark Wooding [Mon, 23 Jan 2012 03:06:49 +0000 (03:06 +0000)]
key.c: Split before storing a subkey.

Otherwise we might corrupt logically separate key data objects.  There's
an assertion to prevent this now.

I think the split method is now redundant.

13 years agoVersion 1.0.3. 1.0.3
Mark Wooding [Fri, 5 Nov 2010 15:12:48 +0000 (15:12 +0000)]
Version 1.0.3.

13 years agodebian: Remove python-catacomb-bin package.
Mark Wooding [Fri, 5 Nov 2010 15:10:06 +0000 (15:10 +0000)]
debian: Remove python-catacomb-bin package.

13 years ago.links: Oops, didn't include link for `mdwsetup.py'.
Mark Wooding [Fri, 5 Nov 2010 15:09:02 +0000 (15:09 +0000)]
.links: Oops, didn't include link for `mdwsetup.py'.

14 years agobuild: Use mdwsetup.py from new CFD. Announce 1.0.2. 1.0.2
Mark Wooding [Sun, 4 Oct 2009 13:18:01 +0000 (14:18 +0100)]
build: Use mdwsetup.py from new CFD.  Announce 1.0.2.

14 years agodebian/control: Fix package description (oops).
Mark Wooding [Sun, 4 Oct 2009 13:29:54 +0000 (14:29 +0100)]
debian/control: Fix package description (oops).

14 years agodebian: Switch to CDBS and build for Python 2.6. 1.0.1
Mark Wooding [Sat, 3 Oct 2009 22:25:07 +0000 (23:25 +0100)]
debian: Switch to CDBS and build for Python 2.6.

Still seems to work.  Somewhat surprising, really.

15 years agocatacomb/__init__.py: Add iterfoo methods to _groupmap.
Mark Wooding [Mon, 17 Nov 2008 23:53:05 +0000 (23:53 +0000)]
catacomb/__init__.py: Add iterfoo methods to _groupmap.

This makes them look more like dictionaries, which is nice.

15 years agopwsafe: Stop using sre to shut up pissy warning.
Mark Wooding [Mon, 17 Nov 2008 23:52:26 +0000 (23:52 +0000)]
pwsafe: Stop using sre to shut up pissy warning.

15 years agoshare.c: Fix crappy typo in argument parsing.
Mark Wooding [Mon, 17 Nov 2008 23:52:05 +0000 (23:52 +0000)]
share.c: Fix crappy typo in argument parsing.

15 years agoalgorithms.h: Don't version-control generated files.
Mark Wooding [Mon, 23 Jun 2008 15:50:01 +0000 (16:50 +0100)]
algorithms.h: Don't version-control generated files.

15 years agoec (ecmeth_mmul): Fix point conversion.
Mark Wooding [Mon, 23 Jun 2008 14:07:58 +0000 (15:07 +0100)]
ec (ecmeth_mmul): Fix point conversion.

Really quite broken.

  * Firstly, the code tried to copy a point to an uninitialized
    destination point, which just isn't a good idea.

  * And secondly, after tediously doing the correct conversion, it just
    tried to copy the raw point over the top of the correct converted
    point.

Not good, really.

16 years agodebian: Drop support for Python 2.3.
Mark Wooding [Fri, 4 Apr 2008 23:56:24 +0000 (00:56 +0100)]
debian: Drop support for Python 2.3.

This is all very crufty and needs an overhaul anyway.

16 years agosetup: Use pkg-config to find out about libraries.
Mark Wooding [Fri, 4 Apr 2008 23:55:59 +0000 (00:55 +0100)]
setup: Use pkg-config to find out about libraries.

16 years agoutil: Actually initialize the utilities properly.
Mark Wooding [Fri, 4 Apr 2008 23:55:18 +0000 (00:55 +0100)]
util: Actually initialize the utilities properly.

Failure to do this cases segfaults when we actually come to do things
like iteration.

16 years agoec: Fix oncurvep.
Mark Wooding [Fri, 4 Apr 2008 23:54:42 +0000 (00:54 +0100)]
ec: Fix oncurvep.

The previous version didn't take into account the fact that we had
internal-format points.

17 years agomp: Remove checking from jacobi.
Mark Wooding [Sat, 17 Feb 2007 12:19:29 +0000 (12:19 +0000)]
mp: Remove checking from jacobi.

Now Catacomb uses the Kronecker symbol, which is defined for all pairs
of integers.  We no longer need to check that the arguments here are
correct.

17 years agoRename the class `check' method to `checkgroup'.
Mark Wooding [Sat, 17 Feb 2007 12:18:40 +0000 (12:18 +0000)]
Rename the class `check' method to `checkgroup'.

Otherwise it interferes with the element `check' method, which gets used
by preference.

17 years agoGeneral: Fix lots of whitespace issues.
Mark Wooding [Sat, 17 Feb 2007 12:18:00 +0000 (12:18 +0000)]
General: Fix lots of whitespace issues.

17 years agopubkey: Various stupid DSA bugs fixed.
Mark Wooding [Mon, 20 Nov 2006 17:45:44 +0000 (17:45 +0000)]
pubkey: Various stupid DSA bugs fixed.

I don't see how this ever worked.  Grumble.

17 years agokey: Make KeyFiles iterate over their keyids, not their keys.
Mark Wooding [Tue, 16 Jan 2007 22:27:24 +0000 (22:27 +0000)]
key: Make KeyFiles iterate over their keyids, not their keys.

This makes the various mapping methods like keys and values work
properly.

17 years agoec: Convert generator to external form in ECInfo constructor.
Mark Wooding [Thu, 16 Nov 2006 00:13:06 +0000 (00:13 +0000)]
ec: Convert generator to external form in ECInfo constructor.

This fixes a stupid bug.

17 years agoGeneral: Update for Python 2.5.
Mark Wooding [Wed, 25 Oct 2006 18:36:19 +0000 (19:36 +0100)]
General: Update for Python 2.5.

  * This renamed the members of heap types. so there's a compatibility
    macro now.

  * Debian has moved on to Python 2.4 as its standard version, so track
    that.

  * Also provide Python 2.5 packages now that we can.

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.