Mark Wooding [Mon, 1 May 2017 00:38:30 +0000 (01:38 +0100)]
catacomb/__init__.py: Abstract out common pretty-printing patterns.
Don't hardwire indentation levels from header lengths; don't hardwire
type names; hide away the ugly `type(me).__name__' rune.
Mark Wooding [Mon, 1 May 2017 00:38:30 +0000 (01:38 +0100)]
catacomb/__init__.py: Support IPython's pretty-printer.
Add `_repr_pretty_' methods to many types to improve presentation.
Also, sneakily add a bunch of printing methods to the key-management
classes.
Mark Wooding [Mon, 1 May 2017 00:38:30 +0000 (01:38 +0100)]
catacomb/__init__.py: Support `len' on `_groupmap' objects.
Mark Wooding [Mon, 1 May 2017 00:38:30 +0000 (01:38 +0100)]
catacomb/__init__.py: Use `%#x' rather than `hex' now.
The reason `%x' used not to work is the recently-fixed bug whereby
conversions to `int' raised exceptions rather than returning `long'.
Mark Wooding [Wed, 3 May 2017 12:02:54 +0000 (13:02 +0100)]
Merge branches 'mdw/latin-ietf' and 'mdw/curve25519'
* mdw/latin-ietf:
algorithms.py: Support the IETF versions of ChaCha etc. with 96-bit nonce.
* mdw/curve25519:
pubkey.c, catacomb/__init__.py: Add bindings for Hamburg's X448.
pubkey.c, ...: Support Bernstein's `
Ed25519' signature scheme.
pubkey.c, ...: Support Bernstein's `X25519' key-agreement algorithm.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
algorithms.py: Support the IETF versions of ChaCha etc. with 96-bit nonce.
Mark Wooding [Wed, 26 Apr 2017 10:53:05 +0000 (11:53 +0100)]
pubkey.c, catacomb/__init__.py: Add bindings for Hamburg's X448.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
pubkey.c, ...: Support Bernstein's `
Ed25519' signature scheme.
Mark Wooding [Wed, 12 Apr 2017 17:39:01 +0000 (18:39 +0100)]
pubkey.c, ...: Support Bernstein's `X25519' key-agreement algorithm.
Mark Wooding [Wed, 3 May 2017 11:48:27 +0000 (12:48 +0100)]
Return `long' objects when `int' is requested but the value won't fit.
Mostly, Python handles the error from the `int' conversion and falls
back to long, but there's something weird in iteration, where if you say
for i in ...:
print '%d' % x
then the loop finishes and /then/ you get an exception for the overflow
from the failed conversion of x to an `int'.
Follow Python's actual behaviour: have `mp_tolong_checked' take an extra
argument indicating whether to throw an exception, and modify most of
the call sites to fall back to a conversion based on `mp_topylong'.
Mark Wooding [Thu, 20 Apr 2017 00:58:05 +0000 (01:58 +0100)]
group.c: Track Catacomb group internals change.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
catacomb/__init__.py: Add a simple implementation of NaCl `secretbox'.
Mark Wooding [Sat, 15 Apr 2017 13:34:33 +0000 (14:34 +0100)]
algorithms.c: Add binding for `poly1305_flushzero'.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
algorithms.c: Fix Poly1305 `hashu...' and `hashbuf...' methods.
Hash the input number or length, not the size of the field.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
bytestring.c, catacomb/__init__.py: Compare for equality in constant time.
There's an explicit `ctstreq' function which just does what you wanted.
Also, `ByteString' objects now have a rich-compare method which always
compares for equality in constant time. Ordering comparisons are
variable time still.
There's a little chicanery to retain the hash function from `str'.
Also add a simple `check' method to `GHash' and `Poly1305Hash' which
compares a hsah or MAC tag in constant time and returns a boolean
result.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
bytestring.c: Check for cached hash more carefully.
The `CACHE_HASH' symbol has been missing for years because the feature
is always on nowadays. Amazingly, I never noticed.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
*.c: Declare `PY_SSIZE_T_CLEAN'.
Now we can process large strings on 64-bit targets. Err, win?
Mark Wooding [Fri, 7 Apr 2017 18:20:53 +0000 (19:20 +0100)]
algorithms.c: Add bindings for HSalsa20/r and HChaCha/r.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
algorithms.c: Add support for Poly1305.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
catacomb-python.h, util.c: Support for declaring types with weird metatypes.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
algorithms.c: Reorder the `ghash' definitions.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
algorithms.c: Fix docstring for `GCHash.hashsz'.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
algorithms.c: Set required size on GMAC objects.
The Python interpreter catches this in debug mode. Also, it's really
bad.
Mark Wooding [Mon, 12 Sep 2016 21:29:09 +0000 (22:29 +0100)]
rand.c, algorithms.py: Support random access protocol of Latin-dance PRFs.
Add a new superclass for random bit generators based on Latin-dance
PRFs (Salsa20, ChaCha, etc.) which exposes the `seek'/`tell' random
access protocol to Python.
Mark Wooding [Mon, 12 Sep 2016 21:27:23 +0000 (22:27 +0100)]
util.c: Add conversions between Python objects and `kludge64'.
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.
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.
Mark Wooding [Mon, 12 Sep 2016 21:23:58 +0000 (22:23 +0100)]
util.c: Zap spurious whitespace.
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.
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.
Mark Wooding [Sat, 4 Jun 2016 00:17:35 +0000 (01:17 +0100)]
Release 1.1.1.
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.
Mark Wooding [Fri, 19 Feb 2016 19:39:40 +0000 (19:39 +0000)]
Release 1.1.0.1.
Mark Wooding [Fri, 19 Feb 2016 09:00:49 +0000 (09:00 +0000)]
debian/control: Fix the Build-Depends.
Mark Wooding [Fri, 19 Feb 2016 08:58:06 +0000 (08:58 +0000)]
debian/source/format: Apparently we need one of these nowadays.
Mark Wooding [Mon, 20 Jul 2015 15:11:21 +0000 (16:11 +0100)]
Release 1.1.0.
Mark Wooding [Mon, 20 Jul 2015 13:44:43 +0000 (14:44 +0100)]
Require a shiny new library version.
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.
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.
Mark Wooding [Sun, 24 May 2015 18:33:21 +0000 (19:33 +0100)]
catacomb/pwsafe.py: Add a backend based on SQLite.
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.
Mark Wooding [Thu, 28 May 2015 10:09:26 +0000 (11:09 +0100)]
catacomb/pwsafe.py: New Git-friendly `DirectoryStorageBackend'.
Mark Wooding [Sun, 24 May 2015 18:33:50 +0000 (19:33 +0100)]
catacomb/pwsafe.py: New FlatFileStorageBackend class.
No external dependencies required.
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.
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.
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.
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.
Mark Wooding [Sun, 24 May 2015 17:06:54 +0000 (18:06 +0100)]
catacomb/pwsafe.py: Commentary fix.
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.
Mark Wooding [Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)]
catacomb.c, ec.c: Bindings for the new EC2OSP/OS2ECP functions.
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.
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.
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.
Mark Wooding [Sun, 24 May 2015 15:46:39 +0000 (16:46 +0100)]
pwsafe: Report password mismatch as an error, not an exception.
Mark Wooding [Sun, 24 May 2015 15:45:32 +0000 (16:45 +0100)]
pwsafe: Some simple reformatting.
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.
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.
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'.
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.
Mark Wooding [Tue, 26 May 2015 14:13:23 +0000 (15:13 +0100)]
algorithms.py, rand.c: Support `Latin dances' stream ciphers.
Mark Wooding [Tue, 26 May 2015 15:03:11 +0000 (16:03 +0100)]
catacomb/__init__.py: Trim `/' from identifiers names.
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'.
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.
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.
Mark Wooding [Tue, 26 May 2015 13:04:37 +0000 (14:04 +0100)]
algorithms.py: Fiddling with whitespace.
Both layout and quoted.
Mark Wooding [Tue, 26 May 2015 15:00:52 +0000 (16:00 +0100)]
catacomb-python.h: Formatting fix.
Mark Wooding [Sun, 24 May 2015 09:53:27 +0000 (10:53 +0100)]
pwsafe: Don't produce a backtrace on decryption failure.
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.
Mark Wooding [Fri, 10 Apr 2015 14:19:25 +0000 (15:19 +0100)]
catacomb.c: Handle Python's randomize hashing parameters properly.
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.
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.
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.
Mark Wooding [Fri, 27 Feb 2015 14:40:26 +0000 (14:40 +0000)]
mp.c: Binding for `mp_fibonacci'.
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.
Mark Wooding [Thu, 26 Feb 2015 19:32:54 +0000 (19:32 +0000)]
algorithms.c: Add bindings for the key-strength conversion functions.
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.
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.
Mark Wooding [Sat, 24 May 2014 13:00:03 +0000 (14:00 +0100)]
buffer.c: Fix docstring for WriteBuffer.zero.
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.
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.
Mark Wooding [Sat, 4 Jan 2014 01:38:40 +0000 (01:38 +0000)]
Release 1.0.6.
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.
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.
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.
Mark Wooding [Sun, 21 Jul 2013 14:57:34 +0000 (15:57 +0100)]
Release 1.0.5.
Mark Wooding [Sun, 21 Jul 2013 14:56:02 +0000 (15:56 +0100)]
buffer.c: Fix buffer resizing logic.
Mark Wooding [Sun, 23 Jun 2013 08:04:24 +0000 (09:04 +0100)]
Fix a few minor warnings.
Mark Wooding [Sat, 15 Jun 2013 15:13:46 +0000 (16:13 +0100)]
debian: Abandon CDBS for plain Debhelper.
Mark Wooding [Sat, 15 Jun 2013 23:12:54 +0000 (00:12 +0100)]
Overhaul build system using new `cfd' machinery.
Mark Wooding [Sun, 16 Jun 2013 14:22:38 +0000 (15:22 +0100)]
Overhaul formatting.
Expunge CVS droppings and use newer comment stylings.
Mark Wooding [Wed, 9 Jan 2013 02:57:37 +0000 (02:57 +0000)]
Build against Python 2.7. This is release 1.0.4.
Mark Wooding [Wed, 9 Jan 2013 04:05:42 +0000 (04:05 +0000)]
debian/control: Declare dependency on a new Catacomb.
Mark Wooding [Wed, 9 Jan 2013 04:05:19 +0000 (04:05 +0000)]
key.c (kdmeth_copy): Fix some stupid mistakes.
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.
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.
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.
Mark Wooding [Fri, 5 Nov 2010 15:12:48 +0000 (15:12 +0000)]
Version 1.0.3.
Mark Wooding [Fri, 5 Nov 2010 15:10:06 +0000 (15:10 +0000)]
debian: Remove python-catacomb-bin package.
Mark Wooding [Fri, 5 Nov 2010 15:09:02 +0000 (15:09 +0000)]
.links: Oops, didn't include link for `mdwsetup.py'.
Mark Wooding [Sun, 4 Oct 2009 13:18:01 +0000 (14:18 +0100)]
build: Use mdwsetup.py from new CFD. Announce 1.0.2.