chiark / gitweb /
secnet
4 years agoec-field-test.c: Make the field-element type use internal format. mdw/xdh
Mark Wooding [Fri, 27 Sep 2019 00:04:07 +0000 (01:04 +0100)]
ec-field-test.c: Make the field-element type use internal format.

And add a flag to distinguish the `bad' output from `..._quosqrt'.

4 years agocrypto-test.c: Don't print dead registers.
Mark Wooding [Fri, 27 Sep 2019 00:03:48 +0000 (01:03 +0100)]
crypto-test.c: Don't print dead registers.

4 years ago@@@ simplify makefile
Mark Wooding [Thu, 26 Sep 2019 09:01:38 +0000 (10:01 +0100)]
@@@ simplify makefile

4 years ago@@@ and ed448
Mark Wooding [Thu, 26 Sep 2019 08:13:22 +0000 (09:13 +0100)]
@@@ and ed448

4 years ago@@@ test keccak and sha3
Mark Wooding [Thu, 26 Sep 2019 03:46:03 +0000 (04:46 +0100)]
@@@ test keccak and sha3

4 years ago@@@ crypto-test strings
Mark Wooding [Thu, 26 Sep 2019 03:45:38 +0000 (04:45 +0100)]
@@@ crypto-test strings

4 years ago@@@ 64-bit kludging
Mark Wooding [Thu, 26 Sep 2019 03:45:18 +0000 (04:45 +0100)]
@@@ 64-bit kludging

4 years ago@@@ test copyright dates
Mark Wooding [Thu, 26 Sep 2019 03:45:01 +0000 (04:45 +0100)]
@@@ test copyright dates

4 years ago@@@ ed25519-test header
Mark Wooding [Thu, 26 Sep 2019 03:44:27 +0000 (04:44 +0100)]
@@@ ed25519-test header

4 years agoUpdate crypto code from Catacomb 2.5.0.
Mark Wooding [Thu, 26 Sep 2019 03:43:26 +0000 (04:43 +0100)]
Update crypto code from Catacomb 2.5.0.

This change committed automatically by `import-catacomb-crypto'.

  * Import updated `keccak1600.c' from upstream `symm/keccak1600.c'.
  * Import updated `sha3.c' from upstream `symm/sha3.c'.

Detailed list of changes:

  * no upstream changes: import-catacomb-crypto patch for keccak1600 and
    sha3

Upstream-Revision: ad7da99a043dab9addc7fce6b22b30f12c7676e6

4 years ago@@@ import-catacomb-crypto keccak/sha3
Mark Wooding [Thu, 26 Sep 2019 03:43:00 +0000 (04:43 +0100)]
@@@ import-catacomb-crypto keccak/sha3

4 years ago@@@ ed25519
Mark Wooding [Wed, 25 Sep 2019 20:13:09 +0000 (21:13 +0100)]
@@@ ed25519

4 years ago@@@ crypto-test
Mark Wooding [Wed, 25 Sep 2019 19:38:06 +0000 (20:38 +0100)]
@@@ crypto-test

4 years ago@@@ fake-mlib-bits
Mark Wooding [Wed, 25 Sep 2019 19:37:08 +0000 (20:37 +0100)]
@@@ fake-mlib-bits

4 years agoUpdate crypto code from Catacomb 2.5.0.
Mark Wooding [Wed, 25 Sep 2019 22:07:32 +0000 (23:07 +0100)]
Update crypto code from Catacomb 2.5.0.

This change committed automatically by `import-catacomb-crypto'.

  * Import new `ed25519-tests.in' from upstream `pub/t/ed25519.djb' and
    `pub/t/ed25519.local'.
  * Import new `ed25519.c' from upstream `pub/ed25519.c'.
  * Import new `ed25519.h' from upstream `pub/ed25519.h'.
  * Import new `ed448-tests.in' from upstream `pub/t/ed448'.
  * Import new `ed448.c' from upstream `pub/ed448.c'.
  * Import new `ed448.h' from upstream `pub/ed448.h'.
  * Import updated `f25519-tests.in' from upstream `math/t/f25519'.
  * Import updated `f25519.c' from upstream `math/f25519.c'.
  * Import updated `f25519.h' from upstream `math/f25519.h'.
  * Import updated `fgoldi-tests.in' from upstream `math/t/fgoldi'.
  * Import updated `fgoldi.c' from upstream `math/fgoldi.c'.
  * Import updated `fgoldi.h' from upstream `math/fgoldi.h'.
  * Import new `keccak1600-tests.in' from upstream `symm/t/keccak1600'.
  * Import new `keccak1600.c' from upstream `symm/keccak1600.c'.
  * Import new `keccak1600.h' from upstream `symm/keccak1600.h'.
  * Import new `scaf.c' from upstream `math/scaf.c'.
  * Import new `scaf.h' from upstream `math/scaf.h'.
  * Import new `scmul.h' from upstream `math/scmul.h'.
  * Import new `sha3-tests.in' from upstream
    `symm/t/SHA3_224LongMsg.rsp', `symm/t/SHA3_224Monte.rsp',
    `symm/t/SHA3_224ShortMsg.rsp', `symm/t/SHA3_256LongMsg.rsp',
    `symm/t/SHA3_256Monte.rsp', `symm/t/SHA3_256ShortMsg.rsp',
    `symm/t/SHA3_384LongMsg.rsp', `symm/t/SHA3_384Monte.rsp',
    `symm/t/SHA3_384ShortMsg.rsp', `symm/t/SHA3_512LongMsg.rsp',
    `symm/t/SHA3_512Monte.rsp', `symm/t/SHA3_512ShortMsg.rsp',
    `symm/t/SHAKE128LongMsg.rsp', `symm/t/SHAKE128ShortMsg.rsp',
    `symm/t/SHAKE128VariableOut.rsp', `symm/t/SHAKE256LongMsg.rsp',
    `symm/t/SHAKE256ShortMsg.rsp', `symm/t/SHAKE256VariableOut.rsp', and
    `symm/t/sha3.local'.
  * Import new `sha3.c' from upstream `symm/sha3.c'.
  * Import new `sha3.h' from upstream `symm/sha3.h'.
  * Import updated `x25519-tests.in' from upstream `pub/t/x25519'.
  * Import new `x25519.slow-tests.in' from upstream `pub/t/x25519.slow'.
  * Import updated `x448-tests.in' from upstream `pub/t/x448'.
  * Import updated `x448.h' from upstream `pub/x448.h'.
  * Import new `x448.slow-tests.in' from upstream `pub/t/x448.slow'.

Detailed list of changes:

    commit f521d4c7a97076db34681c598d7965c7d05713b0
    Author: Mark Wooding <mdw@distorted.org.uk>
    Date:   Wed, 10 May 2017 21:01:03 +0100

        math/f{25519,goldi}.[ch]: Export the piece type.

     math/f25519.c | 6 ++++--
     math/f25519.h | 7 +++++++
     math/fgoldi.c | 6 ++++--
     math/fgoldi.h | 7 +++++++
     4 files changed, 22 insertions(+), 4 deletions(-)

    commit e830bb692041c75eb29b8c511db21af81b3aae2d
    Author: Mark Wooding <mdw@distorted.org.uk>
    Date:   Mon, 1 May 2017 01:38:30 +0100

        math/f25519.c, utils/curve25519.sage: Slightly improve `quosqrt' algorithm.

        The algorithm from the Bernstein et al. paper was somewhat ugly.
        Replace it with a different one using the techniques I used in `fgoldi'
        for the main calculation, but with the same end structure.

     math/f25519.c | 102 ++++++++++++++++++++++++++++++----------------------------
     1 file changed, 53 insertions(+), 49 deletions(-)

    commit 1bc00e2a032fa3899ed734f6cfeab88e9000041d
    Author: Mark Wooding <mdw@distorted.org.uk>
    Date:   Mon, 1 May 2017 01:38:30 +0100

        math/fgoldi.[ch]: Implement the extra operations needed for Ed448.

     math/fgoldi.c | 289 ++++++++++++++++++++++++++++
     math/fgoldi.h |  77 ++++++++
     math/t/fgoldi | 607 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     3 files changed, 973 insertions(+)

    commit c578d5d85b11f004c151948684ca5753a5ac5962
    Author: Mark Wooding <mdw@distorted.org.uk>
    Date:   Wed, 10 May 2017 21:58:36 +0100

        pub/ed448.[ch], etc.: Add the Ed448 signature scheme from RFC8032.

     pub/x448.h | 3 ++-
     1 file changed, 2 insertions(+), 1 deletion(-)

    commit 1e4c26653e52aa4c4b06e345617135a6ff271ab5
    Author: Mark Wooding <mdw@distorted.org.uk>
    Date:   Thu, 19 Oct 2017 19:35:23 +0100

        pub/t/x*: Rearrange the Monte-Carlo tests.

          * Insert more intermediate values, specifically at every power of 10.

          * Rather than calculating the whole thing from scratch each time,
            tests other than the first one continue from the previous
            state (which I had to calculate the hard way and enter into the
            test-vector files).  The total iteration count and final results
            still match the RFC.

          * Split the very slow high-iteration-count tests into a separate file,
            where they can be run discretionally without having to edit source
            files.  Arrange to distribute these new files.

     pub/t/x25519 | 15 ++++++++-------
     pub/t/x448   | 15 ++++++++-------
     2 files changed, 16 insertions(+), 14 deletions(-)

    commit 89bd399d7d3fdeb58f7a442bcd139b707e08e8d0
    Author: Mark Wooding <mdw@distorted.org.uk>
    Date:   Fri, 1 Mar 2019 12:21:16 +0000

        math/f25519.c, math/fgoldi.c: Remove some unused constant definitions.

     math/f25519.c | 2 --
     math/fgoldi.c | 4 ----
     2 files changed, 6 deletions(-)

    commit 68012cc7915db546ea09027d41c1360e3a5921c0
    Author: Mark Wooding <mdw@distorted.org.uk>
    Date:   Fri, 1 Mar 2019 12:21:38 +0000

        math/f25519.c: Order 10-bit constants the same as 26-bit constants.

     math/f25519.c | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)

Upstream-Revision: ad7da99a043dab9addc7fce6b22b30f12c7676e6

4 years ago@@@ import-catacomb-crypto wip
Mark Wooding [Wed, 25 Sep 2019 11:07:17 +0000 (12:07 +0100)]
@@@ import-catacomb-crypto wip

4 years agoUpdate crypto code from Catacomb 2.3.0.1-45-g9c14.
Mark Wooding [Wed, 25 Sep 2019 10:44:59 +0000 (11:44 +0100)]
Update crypto code from Catacomb 2.3.0.1-45-g9c14.

  * Imported new `test-import/f25519-tests.in', from upstream
    `math/t/f25519'.
  * Imported new `test-import/f25519.c', from upstream `math/f25519.c'.
  * Imported new `test-import/f25519.h', from upstream `math/f25519.h'.
  * Imported new `test-import/fgoldi-tests.in', from upstream
    `math/t/fgoldi'.
  * Imported new `test-import/fgoldi.c', from upstream `math/fgoldi.c'.
  * Imported new `test-import/fgoldi.h', from upstream `math/fgoldi.h'.
  * Imported new `test-import/montladder.h', from upstream
    `math/montladder.h'.
  * Imported new `test-import/qfarith.h', from upstream `math/qfarith.h'.
  * Imported new `test-import/x25519-tests.in', from upstream
    `pub/t/x25519'.
  * Imported new `test-import/x25519.c', from upstream `pub/x25519.c'.
  * Imported new `test-import/x25519.h', from upstream `pub/x25519.h'.
  * Imported new `test-import/x448-tests.in', from upstream `pub/t/x448'.
  * Imported new `test-import/x448.c', from upstream `pub/x448.c'.
  * Imported new `test-import/x448.h', from upstream `pub/x448.h'.

Upstream-Revision: 9c1437f372e62f0b3b3a7162aabee73bdc96ce4b

4 years ago@@@ delete old catcomb import
Mark Wooding [Wed, 25 Sep 2019 19:16:24 +0000 (20:16 +0100)]
@@@ delete old catcomb import

4 years ago@@@ testing
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
@@@ testing

4 years agomake-secnet-sites: Make the `dh' property be listish, and add XDH groups.
Mark Wooding [Fri, 28 Apr 2017 21:51:36 +0000 (22:51 +0100)]
make-secnet-sites: Make the `dh' property be listish, and add XDH groups.

Also add these to `mdw-test/sites' to test the new functionality.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agomake-secnet-sites: Introduce a notion of listish types.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
make-secnet-sites: Introduce a notion of listish types.

A property of such a listish type can be assigned multiple times, and
the values accumulate, and get reported as a list in the output
configuration.

Currently none are defined, so you can't see what this does.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agomake-secnet-sites: Introduce a superclass for the config types.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
make-secnet-sites: Introduce a superclass for the config types.

Somewhere to put common behaviour.  Not that there is any yet, so
there's no functional change.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoxdh.c: New module defining elliptic curve Diffie--Hellman functions.
Mark Wooding [Fri, 28 Apr 2017 21:51:36 +0000 (22:51 +0100)]
xdh.c: New module defining elliptic curve Diffie--Hellman functions.

This provides X25519 and X448 as premade Diffie--Hellman closures.  They
should be used directly rather than applied to arguments.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoHack on the newly imported X25519 and X448 code.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
Hack on the newly imported X25519 and X448 code.

I've tried to touch the code as little as possible to integrate it with
the rest of Secnet.  I've limited myself to:

  * adding Secnet notices and GPL-mandated notices;

  * removing definitions which obviously won't work;

  * removing code which is unnecessary given Secnet's less ambitious
    portability objectives; and

  * providing substitutes for some of the support types and macros
    assumed by the original implementation, in particular a fake version
    of <mLib/bits.h>.

I've also written a new test driver for the field and curve arithmetic,
and reformatted the test vectors, though the data remains the same.

The code builds and passes the tests.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoImport implementations of X25519 and X448 from Catacomb.
Mark Wooding [Wed, 26 Apr 2017 10:53:05 +0000 (11:53 +0100)]
Import implementations of X25519 and X448 from Catacomb.

Taken from https://git.distorted.org.uk/~mdw/catacomb/, commit-id
9c1437f372e62f0b3b3a7162aabee73bdc96ce4b.

These are just the raw files from upstream.  Don't try to build them,
because they have all sorts of dependencies on the rest of the library.
But at least this way I can record the hacking I did to integrate them
into Secnet.

The test vector files were originally called things like
`math/t/f25519': I've renamed them here because otherwise they'd briefly
introduce directories or have very unhelpful names.  They'll need
radically reformatting anyway, because the test-vector parser didn't
come along for the ride.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agounaligned.h: Add macros for reading and writing little-endian 32-bit words.
Mark Wooding [Wed, 26 Apr 2017 10:53:05 +0000 (11:53 +0100)]
unaligned.h: Add macros for reading and writing little-endian 32-bit words.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoAdjust the DH closure protocol to handle public values as raw binary.
Mark Wooding [Fri, 28 Apr 2017 21:51:36 +0000 (22:51 +0100)]
Adjust the DH closure protocol to handle public values as raw binary.

Responsibility for hex-encoding the public value now lies with the
individual DH group implementation, rather than the common site-level
machinery.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoIntroduce negotiation for Diffie--Hellman groups.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
Introduce negotiation for Diffie--Hellman groups.

For the most part, this slots into the space previously prepared for
it.  However, there are a few subtleties.

The most significant one is that existing Secnets don't pay attention to
the high 16 cap bits.  To bring them into availability, we introduce a
signalling system.  If bit 15 is set, then

  * all of the bits are scanned for capabilities, and

  * it is expected that sender has advertised its DH groups explicitly.

If the bit is clear, then we have the old situation:

  * firstly, only the low 16 bits are scanned for transform cap bits,
    and

  * secondly, it is assumed that the sender only implements traditional
    integer Diffie--Hellman, cap 10, with some appropriately determined
    group.

We also set the explicit bit if one of the high capability bits is set.

As part of this, add a parameter to the `diffie-hellman' closure to
configure its advertised group cap.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosite.c: Allocate and free the Diffie--Hellman secret buffers each time.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
site.c: Allocate and free the Diffie--Hellman secret buffers each time.

This will allow us to maybe use a different Diffie--Hellman group, with
different size requirements, to communicate with the same peer at a
later time.  We can't do this yet, of course, but the negotiation
machinery is coming soon.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosite.c: Abstract out generation of the Diffie--Hellman private secret.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
site.c: Abstract out generation of the Diffie--Hellman private secret.

I want to make this more complicated, so it makes sense to have the
logic in one place.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agodh.c, secnet.8: Allow `diffie-hellman' to take a dictionary of arguments.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
dh.c, secnet.8: Allow `diffie-hellman' to take a dictionary of arguments.

I want to add more optional arguments to this, but it'll get rather
unwieldy.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosite.c: Prepare for adding more MSG3 variants.
Mark Wooding [Sun, 30 Apr 2017 23:11:25 +0000 (00:11 +0100)]
site.c: Prepare for adding more MSG3 variants.

  * Introduce a macro listing the known MSG3 variants.  Use this in
    `type_is_msg34' and `site_incoming', and in the `process_msg3'
    molly-guard.

  * Break out MSG3-ish label minor numbers and analyse them using the
    sensible ordering, in `generate_msg' and `unpick_msg'.

  * Have `check_msg' fall back to trusting `process_msg3' for all
    MSG3-ish messages.  (It already has a more vicious molly-guard
    anyway.)

  * Reformat the decision tree in `generate_msg3' so that adding more
    branches is cleaner.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosite.c: Pass the length of the actual shared secret to the transform.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
site.c: Pass the length of the actual shared secret to the transform.

The `set_new_transform' function used to grow its `sharedsecret' buffer
to accommodate the chosen transform's desired key length, and then tells
the transform that this is the size of its secret.

Unfortunately this is pretty much a lie.  In particular, the traditional
DH closure doesn't actually do anything to fill the rest of the buffer
with random stuff.  Probably there ought to be a KDF here, but:

  * we can't introduce a KDF globally without breaking compatibility
    with old clients; and

  * the new EAX-based transform has its own cheap-and-cheerful (but
    effective) SHA512-based KDF baked into it.

Anyway, the result is that, if the DH group produces short shared
secrets, and the transform has an explicit key size it wants, then
everything will seem to work right up until the transform tries to use
uninitialized memory as key material.  Then the good news is that the
two sites likely end up using different keys and can't talk to each
other.  The /bad/ news is that their keys don't have enough entropy, and
an adversary may be able to impersonate them to each other.

We're probably not in this situation yet.  We have two transforms and
one DH group type.  One transform has its own KDF, so is unaffected by
this.  The other, the old `serpent256-cbc (or is it `serpent-cbc256'?)
transform, wants 608 bits (76 bytes) of key.  It gets these directly
from the big-endian base-256 encoded DH shared secret, so we OK unless
the DH field is smaller than 608 bits.  But if it is then you have other
problems.

Surprisingly, the fix is for the site code to ignore the transform's
reported key size entirely.  It tells the transform the size of the
shared secret, and if the transform is unhappy then it can fail or apply
a KDF by itself.

Of course, now we're doing this, there's no need for the transform to
advertise a desired key length, so remove this.  Also, this means that
the shared secret buffer isn't going to change size any more, so we can
remove all of the machinery for that, too.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoChange our view of the Diffie--Hellman closure protocol.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
Change our view of the Diffie--Hellman closure protocol.

Rename `len' to `secret_len' and `ceil_len' to `shared_len', and label
these as the required private secret length and generated shared-secret
length respectively.  There's no functional change: that's what these
variables were being used for anyway.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosite.c, dh.c, secnet.h: Allow the dh `makeshared' method to fail.
Mark Wooding [Wed, 26 Apr 2017 10:53:05 +0000 (11:53 +0100)]
site.c, dh.c, secnet.h: Allow the dh `makeshared' method to fail.

The only current implementation still can't, and won't, but change the
interface to acknowledge the possibility, and fix callers to propagate
failures.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosha512.c, etc.: Provide `sha512' as a hash function for signing.
Mark Wooding [Fri, 28 Apr 2017 21:51:44 +0000 (22:51 +0100)]
sha512.c, etc.: Provide `sha512' as a hash function for signing.

SHA-1 is really creaky these days, though to be fair its use in Secnet
does not depend on collision resistance.

Modify `mdw-test/sites' to allow selection of SHA512.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosha512.[ch]: Remove a bunch of unused code.
Mark Wooding [Fri, 28 Apr 2017 21:51:36 +0000 (22:51 +0100)]
sha512.[ch]: Remove a bunch of unused code.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agomdw-test/: Include some random utilities I've found handy for testing.
Mark Wooding [Fri, 28 Apr 2017 21:51:36 +0000 (22:51 +0100)]
mdw-test/: Include some random utilities I've found handy for testing.

This allows setting up of a network of multiple Secnets on a single
machine, by an unprivileged user.  See `mdw-test/README' for more
information.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosite.c, magic.h, NOTES: Make early capabilities be dynamic.
Mark Wooding [Sun, 30 Apr 2017 23:18:39 +0000 (00:18 +0100)]
site.c, magic.h, NOTES: Make early capabilities be dynamic.

Replace the `CAPAB_EARLY' macro by a site member variable
`st->early_capabilities'.  The variable is always zero for now, like the
old macro, so there's no functional change.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosecnet.8: Describe capability negotiation in its own section.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
secnet.8: Describe capability negotiation in its own section.

The notion is a little complicated, and we can give it the space it
deserves.  Also, this saves on a lot of repeated text, especially if we
add more things which require assignment of capability bits.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosite.c: Abstract out the various parts of capability handling.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
site.c: Abstract out the various parts of capability handling.

Introduce macros for: setting the local capability flags from
crypto-algorithm closures; selecting a crypto algorithm based on the
capabilities reported by a peer site; and finding the local closure
based on the peer's algorithm decision.

This will make introducing new kinds of negotiation much less painful.
No functional change.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agomagic.h: Present message labels as an encoding of major and minor numbers.
Mark Wooding [Sun, 30 Apr 2017 23:03:08 +0000 (00:03 +0100)]
magic.h: Present message labels as an encoding of major and minor numbers.

The encoding is strange for historical reasons, but represents all pairs
of 16-bit major and minor codes.

I've exhaustively verified that the encoding is invertable, and that it
reproduces the old manually assigned labels; this program is
`msgcode-test.c', which I've added to the standard test run, though it's
rather slow to run.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agomagic.h: Put the CAPAB_... definitions together, under the big comment.
Mark Wooding [Sun, 30 Apr 2017 22:59:03 +0000 (23:59 +0100)]
magic.h: Put the CAPAB_... definitions together, under the big comment.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosite.c: Rename `remote_transforms' in `process_msg2'.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
site.c: Rename `remote_transforms' in `process_msg2'.

As part of the drive to eliminate the idea of specific `transform
capabilities'.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosecnet.8, magic.h: Rephrase documentation of `capab-num' settings.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
secnet.8, magic.h: Rephrase documentation of `capab-num' settings.

In particular, I've abolished the idea of a specific class of `transform
capabilities'.  They're all just capabilities, and they need to mean the
same thing at both ends.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agomagic.h, etc.: Rename the transform capability bits.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
magic.h, etc.: Rename the transform capability bits.

Mostly mechanical, with the following rune:

git grep -zil TRANSFORMNUM | xargs -0r sed -i '
s/TRANSFORMNUM/BIT/g
s/transformnum/bit/g
s/BIT_ANCIENT/&TRANSFORM/g'

But I renamed the `capab_transformnum' member of `struct msg' back by
hand, because it's referring specifically to a selected
transform.  (This will make sense later.)

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosecnet-wireshark.lua: Add a Wireshark dissector.
Mark Wooding [Thu, 13 Jul 2017 11:30:57 +0000 (12:30 +0100)]
secnet-wireshark.lua: Add a Wireshark dissector.

(Some parts are a little strange, because it's been sent from the
future: it's structured to cope with protocol changes which haven't
happened yet.)

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoutil.[ch]: Factor out hex encoding and decoding utilities.
Mark Wooding [Wed, 26 Apr 2017 10:53:05 +0000 (11:53 +0100)]
util.[ch]: Factor out hex encoding and decoding utilities.

Also improve the decoder's error handling.  The interface is a bit odd,
but it will fit with the uses I have in mind.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agopolypath.c: Fix missing include of <limits.h>.
Mark Wooding [Fri, 28 Apr 2017 18:41:30 +0000 (19:41 +0100)]
polypath.c: Fix missing include of <limits.h>.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoconfigure.in, conffile.fl: Remove dependency on `libfl.a'.
Mark Wooding [Sat, 21 Sep 2019 13:35:44 +0000 (14:35 +0100)]
configure.in, conffile.fl: Remove dependency on `libfl.a'.

The `libfl' library contains two functions:

  * `main', which basically just calls `yylex' a lot, as an easy way to
    write simple programs in lex(1); and

  * `yywap', which lets a lex(1)-generated lexer know what to do when it
    encounters end-of-file.  Specifically, it can return nonzero to say
    `that's it, we're done', or zero to say `there's more: I've set up
    ``yyin'' so that you can read more stuff'.

The library doesn't do anything very sensible for `yywrap': it just
always returns 1.  (If you wanted to do something more complicated, you
should just write `yywrap' yourself.)

Secnet has its own `main' function which is fine.  It wants `yywrap',
though.  This causes trouble with upstream `flex', which nowadays builds
a shared `libfl.so' library.  This contains /both/ `yywrap' /and/
`main', which breaks the `configure' test: what happens is that the test
program requires `yywrap', which brings in `libfl.so', which brings in
its `main', which refers to an undefined symbol `yylex' that's not
defined in the test program.  This doesn't go wrong in Debian, because
Debian replaces the shared-library `libfl.so' with a linker script which
says `oh, no, you don't want this: you want that ``libfl_pic.a'' over
there'.  The latter is a traditional archive, and ld(1) can pick
`yywrap' out of it without pulling in the bogus `main' and its
dependency on `yylex'.

Anyway, this is all more trouble than it's worth.  Define our own
`yywrap' in `conffile.fl', and delete the `configure' machinery.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoNOTES: Fix text, now than an early bit exists.
Mark Wooding [Sat, 21 Sep 2019 13:00:30 +0000 (14:00 +0100)]
NOTES: Fix text, now than an early bit exists.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoMakefile.in: Drop dist target master
Ian Jackson [Sat, 21 Sep 2019 11:42:29 +0000 (12:42 +0100)]
Makefile.in: Drop dist target

It is much easier to do this with dgit sbuild, like the release
checklist now suggests.  People who don't want to use dgit or sbuild
could use git-archive.  dist targets are IMO obsolete.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoMakefile.in: Completely overhaul release checklist
Ian Jackson [Sat, 21 Sep 2019 11:43:35 +0000 (12:43 +0100)]
Makefile.in: Completely overhaul release checklist

This is roughly what I did for 0.4.4 and exactly what I did for 0.4.5.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoMakefile.in: VERSION: Use =, not :=
Ian Jackson [Sat, 21 Sep 2019 11:42:59 +0000 (12:42 +0100)]
Makefile.in: VERSION: Use =, not :=

This has no effect on make since this variable doesn't contain other
variable references.  But it makes the line directly c&p-able into a
shell.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agochangelog: start 0.4.6
Ian Jackson [Sat, 21 Sep 2019 11:36:20 +0000 (12:36 +0100)]
changelog: start 0.4.6

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoFinalise 0.4.5 v0.4.5
Ian Jackson [Sat, 21 Sep 2019 11:04:53 +0000 (12:04 +0100)]
Finalise 0.4.5

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agochangelog: Changes since 0.4.4
Ian Jackson [Sat, 21 Sep 2019 11:02:47 +0000 (12:02 +0100)]
changelog: Changes since 0.4.4

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoINSTALL: Mention that rsa key generation might need ssh-keygen1
Ian Jackson [Tue, 26 Apr 2016 13:23:07 +0000 (14:23 +0100)]
INSTALL: Mention that rsa key generation might need ssh-keygen1

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoudp.c: Add a comment about the salen cast
Ian Jackson [Sat, 21 Sep 2019 10:05:21 +0000 (11:05 +0100)]
udp.c: Add a comment about the salen cast

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoudp.c: Add explicit cast to muffle bogus Clang warning.
Mark Wooding [Thu, 19 Sep 2019 20:01:24 +0000 (20:01 +0000)]
udp.c: Add explicit cast to muffle bogus Clang warning.

Clang is complaining (`-Wsign-compare') about the comparison between
`salen' (`socklen_t', i.e., an `int' with a false moustache) and
`size_t' (`unsigned int' in this case).  I can see that some warnings of
this kind are useful, but not this one.  The usual arithmetic
conversions apply, so `salen' is converted to `size_t'.  If it was
negative before, it's now very positive, which will trip the the
comparison and call `FAIL' -- which seems like a plausible outcome.

Muffle the warning by adding an explicit cast.  This is ugly and
pointless, though: other suggestions are welcome.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agolog.c: Spray extra `FORMAT(...)' attributes to muffle Clang warnings.
Mark Wooding [Thu, 19 Sep 2019 20:01:22 +0000 (20:01 +0000)]
log.c: Spray extra `FORMAT(...)' attributes to muffle Clang warnings.

Clang gets really upset about non-literal format strings, unless it can
check from the function attributes that you're playing by the rules.

I've taken the liberty of simplifying the annotations on static
functions: rather than duplicating the entire argument list, it suffices
to attach the attribute to the start of the function definition.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite.c (we_have_priority): Fix unintended `&&'.
Mark Wooding [Thu, 19 Sep 2019 20:01:23 +0000 (20:01 +0000)]
site.c (we_have_priority): Fix unintended `&&'.

`CAPAB_PRIORITY_MOBILE' is 0x80000000, which is nonzero, so that doesn't
change the outcome.  So the code is only checking whether the local and
remote capabilities overlap at all, which seems unhelpful.

Instead, check that both advertise `CAPAB_PRIORITY_MOBILE' here.

Spotted by Clang.

The effect is that a new secnet would always think the peer had
advertised CAPAB_PRIORITY_MOBILE.  This might (with roughly 50%
probability) mess up resolution of crossed key setup attempts
involving a mobile end and mixed secnet versions.

The consequences would be mitigated by 19074a85692b
  site: Randomise key setup retry time
so the key setup would very likely eventually succeed.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoFix bizarre `if (!consttime_memeq(X, Y, N)!=0)' idioms.
Mark Wooding [Thu, 19 Sep 2019 20:01:22 +0000 (20:01 +0000)]
Fix bizarre `if (!consttime_memeq(X, Y, N)!=0)' idioms.

Clang thinks the `!' is in the wrong place.  I think the `!=0' isn't
doing any work, so I've deleted it.

This stems from 5ad34db2ccbb "memcmp: Introduce and use
consttime_memeq",

  -    if (memcmp(m->nR,st->remoteN,NONCELEN)!=0) {
  +    if (!consttime_memeq(m->nR,st->remoteN,NONCELEN)!=0) {

at which time the !=0 was already redundant and became more confusing.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoMakefile.in: Support installation from a `VPATH' build.
Mark Wooding [Thu, 19 Sep 2019 20:01:24 +0000 (20:01 +0000)]
Makefile.in: Support installation from a `VPATH' build.

I was pleasantly surprised that Secnet cross-compiles without
significant trouble, but then tripped over this at the very end.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agochangelog: start 0.4.5~
Ian Jackson [Sun, 8 Sep 2019 22:06:06 +0000 (23:06 +0100)]
changelog: start 0.4.5~

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agofinalise 0.4.4 v0.4.4
Ian Jackson [Sun, 8 Sep 2019 21:53:19 +0000 (22:53 +0100)]
finalise 0.4.4

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agochangelog: Document protocol incompatibility
Ian Jackson [Sun, 8 Sep 2019 21:51:14 +0000 (22:51 +0100)]
changelog: Document protocol incompatibility

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agochangelog: Document changes
Ian Jackson [Sun, 8 Sep 2019 21:43:36 +0000 (22:43 +0100)]
changelog: Document changes

... since "Administrivia: Fix erroneous GPL3+ licence notices".

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite: in "entering state RUN", say whether key is set up
Ian Jackson [Sat, 18 May 2019 01:25:34 +0000 (02:25 +0100)]
site: in "entering state RUN", say whether key is set up

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2: New patch

4 years agosite: Randomise key setup retry time
Ian Jackson [Sat, 18 May 2019 00:49:14 +0000 (01:49 +0100)]
site: Randomise key setup retry time

This reduces the chance that retries (at both ends of a link, or
within a single secnet) end up synchronised.  Such synchronisation is
not supposed to matter but in practice there have been some bugs where
it does, and it is undesirable anyway.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2: New patch

4 years agorandom: Admit that we will never add error checking everywhere
Ian Jackson [Sat, 18 May 2019 00:42:55 +0000 (01:42 +0100)]
random: Admit that we will never add error checking everywhere

Literally no-one checks this return value.  Abolish it.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2: New patch

4 years agosite: Replace wait_timeout variable with function
Ian Jackson [Sat, 18 May 2019 00:32:45 +0000 (01:32 +0100)]
site: Replace wait_timeout variable with function

We are going to wait for stochastic amounts.  For now, rname the
variable and change all the users to call this function instead.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2: New patch

4 years agopolypath asymmetric routing: Handle MSG2-4 late dupes
Ian Jackson [Wed, 15 May 2019 20:59:18 +0000 (21:59 +0100)]
polypath asymmetric routing: Handle MSG2-4 late dupes

If we get a MSG2-4 and it seems too late for the protocol stage, and
it had the same nonces, it was probably an old packet via a different
route.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agopolypath asymmetric routing: Handle MSG1 late dupes
Ian Jackson [Wed, 15 May 2019 20:55:55 +0000 (21:55 +0100)]
polypath asymmetric routing: Handle MSG1 late dupes

If we get a MSG1 and it seems too late for the protocol stage, and it
had the same peer nonce, it was probably an old packet via a different
route.

In theory it might seem like we should do this in SENTMSG3 and 5 too
because we might have had concurrent setup, and higher priority, so the
peer also sent us MSG2 or 4.  But mobile peers have priority.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agopolypath asymmetric routing: Handle data packet dupes
Ian Jackson [Wed, 15 May 2019 20:40:40 +0000 (21:40 +0100)]
polypath asymmetric routing: Handle data packet dupes

If polypath has asymmetric routing, where path A upload is faster than
path B, but path A download is completely broken, then we need to
retain both paths A and B in our list of transport peers.

Stepping back, we need to treat dupes of recent packets as evidence
that the peer is at that address, even though we do not pass the
packets to the netlink.

We don't want to do this for arbitrarily old data packets.  The
heuristic we use here is rather crude: packets which are more than
32 (by default) out of order are treated as too old.  This will be too
short if path A is a high-bandwidth link and path B is quite slow, and
it will be too long if the link is very idle.  Hopefully this will not
matter in practice.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoIntroduce transform_apply_seqdupe
Ian Jackson [Tue, 14 May 2019 23:42:16 +0000 (00:42 +0100)]
Introduce transform_apply_seqdupe

This distinguishes the two cases.  Right now they are still handled
the same everywhere.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoIntroduce transform_apply_return_badseq
Ian Jackson [Tue, 14 May 2019 23:39:42 +0000 (00:39 +0100)]
Introduce transform_apply_return_badseq

This abstraction will allow us to distinguish two problems in a
moment.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite: Change return value of decrypt_msg0
Ian Jackson [Tue, 14 May 2019 23:29:24 +0000 (00:29 +0100)]
site: Change return value of decrypt_msg0

The caller is going to want to do something more subtle.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite: Make return value of transforms be an enum
Ian Jackson [Tue, 14 May 2019 23:23:47 +0000 (00:23 +0100)]
site: Make return value of transforms be an enum

We are going to need to distinguish more cases.  It was always bad to
have these hardcoded values.

transform_apply_seqrange is, right now, returned even when the problem
is that the packet is recent but is a duplicate.  This is wrong.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agopolypath asymmetric routing: Priority to mobile sites
Ian Jackson [Wed, 15 May 2019 21:42:10 +0000 (22:42 +0100)]
polypath asymmetric routing: Priority to mobile sites

It is better for the mobile peer to win the key setup priority
battle.  That makes handling the transport address implications,
particularly those of the MSG1, easier.

Since both ends must agree on who has priority, this must be
negotiated.  We use a capability bit for this.  Since the decision is
taken when we have only seen each other's MSG1, it must be an early
capability.  For compatibility with ancient (and security-buggy)
secnets, we can avoid advertising it if neither end is mobile.

In practice, in my tests, this change avoids a spurious key setup
failure when my laptop's secnet is restarted: the new secnet gets a
new NATted address, but the server has priority and insists on talking
to the old address.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2: Document in NOTES following rebase over
    "NOTES: Describe the current allocation of capability bits."

4 years agosite: Break out we_have_priority
Ian Jackson [Wed, 15 May 2019 21:26:54 +0000 (22:26 +0100)]
site: Break out we_have_priority

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite: Rename setup_priority to our_name_later
Ian Jackson [Wed, 15 May 2019 21:23:49 +0000 (22:23 +0100)]
site: Rename setup_priority to our_name_later

This is also used for setting the transform direction - ie,
distinguishing us and them.  We are going to make the priority system
more subtle, and don't want to mess with that bit while changing the
priority rules.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2: Fix conflict due to rebase on top of bugfix
     "site.c: Cope with failure of transform `setkey' method."

4 years agosite: Log about crossed MSG1 with a higher priority
Ian Jackson [Fri, 17 May 2019 22:38:47 +0000 (23:38 +0100)]
site: Log about crossed MSG1 with a higher priority

This means that we normally get these messages.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2: New patch

4 years agosite: Log about crossed MSG1 ignored only once
Ian Jackson [Sat, 18 May 2019 00:28:02 +0000 (01:28 +0100)]
site: Log about crossed MSG1 ignored only once

If for some reason our peer isn't getting our MSG1s, they will
retransmit and we will ignore each retransmission.  Log this only
once.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2: New patch

4 years agosite: transport peers update: avoid nearly-trivial debug
Ian Jackson [Fri, 17 May 2019 22:10:03 +0000 (23:10 +0100)]
site: transport peers update: avoid nearly-trivial debug

When the order of peers changes, but not the total set, we probably
don't want to log it.  Actually comparing the before and after lists
setwise is rather too hard.  But we can do it fairly easily when
there's only one peer being recorded.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2: New patch

4 years agoconfigure: rerun autogen.sh with autoconf 2.69-10
Ian Jackson [Tue, 14 May 2019 23:32:08 +0000 (00:32 +0100)]
configure: rerun autogen.sh with autoconf 2.69-10

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agoNOTES: tiny fix
Ian Jackson [Wed, 15 May 2019 21:02:10 +0000 (22:02 +0100)]
NOTES: tiny fix

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
4 years agosite.c: Cope with failure of transform `setkey' method.
Mark Wooding [Wed, 26 Apr 2017 10:53:05 +0000 (11:53 +0100)]
site.c: Cope with failure of transform `setkey' method.

The `setkey' method can fail, and indicates this by returning False.
Indeed, the `serpent-cbc256' transform will fail if the shared secret
it's given is too short.

Change `set_new_transform' and its callers to propagate failures
properly.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoREADME: Note that I've hacked on the code.
Mark Wooding [Wed, 26 Apr 2017 10:53:05 +0000 (11:53 +0100)]
README: Note that I've hacked on the code.

I shall be hacking on it further.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosite.c: Don't overwrite `st->sharedsecret' if it's null.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
site.c: Don't overwrite `st->sharedsecret' if it's null.

In this case, `st->sharesecretlen' is zero, but this is still undefined
behaviour.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosite.c: Make sure there's enough buffer space for the signature terminator.
Mark Wooding [Fri, 28 Apr 2017 21:51:36 +0000 (22:51 +0100)]
site.c: Make sure there's enough buffer space for the signature terminator.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agorsa.c transform-cbcmac.c: Fix configuration error messages.
Mark Wooding [Fri, 28 Apr 2017 21:51:20 +0000 (22:51 +0100)]
rsa.c transform-cbcmac.c: Fix configuration error messages.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoNOTES: Describe the current allocation of capability bits.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
NOTES: Describe the current allocation of capability bits.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agomake-secnet-sites: Don't allow setting new VPN-level props when restricted.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
make-secnet-sites: Don't allow setting new VPN-level props when restricted.

Currently, one can say something like

vpn thing
renegotiate-time 1

location evil
## ...

and if the VPN admin failed to set a value for `renegotiate-time' then
everyone will spin their CPUs doing key exchange.

Fix this lacuna.  Now user input can only modify location and site
properties.  If the administrator didn't set a location-level
`restrict-nets', then a user can do this, but obviously that can't make
anything worse.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agomake-secnet-sites: Remove duplicate `address' entry in sitelevel.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
make-secnet-sites: Remove duplicate `address' entry in sitelevel.

It was already there, with a functionally equivalent presentation
function.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agosecnet.8: Fix wrong information.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
secnet.8: Fix wrong information.

No, sites don't all have to use the same DH group.  It's true that sites
have to agree pairwise to use the same group when talking to each other.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoREADME.make-secnet-sites: Provide some documentation for this tool.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
README.make-secnet-sites: Provide some documentation for this tool.

Constructed by reverse-engineering.  I may well have misunderstood
things.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years ago.dir-locals.el: Settings for Python code.
Mark Wooding [Sat, 29 Apr 2017 12:55:40 +0000 (13:55 +0100)]
.dir-locals.el: Settings for Python code.

This project has very weird Python style.  Even by my standards.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
4 years agoutil.c: Don't byte-swap IPv4 addresses, even if we don't have IPv6.
Mark Wooding [Fri, 28 Apr 2017 21:51:36 +0000 (22:51 +0100)]
util.c: Don't byte-swap IPv4 addresses, even if we don't have IPv6.

The `string_item_to_ipaddr' function returns addresses as a single
integer in host byte order.  But this isn't what's wanted for setting up
`struct sockaddr_in', for example.  The function `adns_text2addr' does
the right thing.

I think this has always been wrong for setting up UDP sockets: before
the introduction of `string_item_to_iaddr', `udp_apply' would call
`string_item_to_ipaddr' directly, and neglected to swap the bytes.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
6 years agoAdministrivia: Fix erroneous GPL3+ licence notices "version d or later" (!)
Ian Jackson [Sat, 25 Nov 2017 16:14:00 +0000 (16:14 +0000)]
Administrivia: Fix erroneous GPL3+ licence notices "version d or later" (!)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>