chiark / gitweb /
Ian Jackson [Sat, 23 Nov 2019 18:27:35 +0000 (18:27 +0000)]
site: Move defhash from setup to st variable
We tolerate it being missing when we actually look it up.
setup_sethash gains an explicit error check.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 27 Nov 2019 13:49:46 +0000 (13:49 +0000)]
README: Document new semantics for `hash'
Since
13b8fbf4548f3457b02afd36e9284d39839d6f85
sig: Move hashing into algorithm
new public key internal APIs use this rather differently.
So far the difference has been nugatory, because there's only rsa1.
But we should change the documentation.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 16 Nov 2019 21:18:47 +0000 (21:18 +0000)]
site: Remove a spurious \n in a message
Once again. I really oughtn't to have done this, but there is much
code in secnet which sets a bad example.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 16 Nov 2019 11:30:08 +0000 (11:30 +0000)]
site: Reserve <peer-keys>~tmp for make-secnet-sites
We don't use this yet, but make-secnet-sites will do so, later.
So reserve it now.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 31 Oct 2019 00:33:44 +0000 (00:33 +0000)]
site: key update soundness argument: deal with concurrency
This completes this argument.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 28 Nov 2019 13:26:03 +0000 (13:26 +0000)]
site: Write an argument for the soundness of key file update
This argument is not yet in its final form. There are two further
commits which come along in a moment.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Tue, 8 Oct 2019 23:04:54 +0000 (00:04 +0100)]
site: Update peer keys from ~update file
We use the pathprefix_template facility for our public key set files.
Right now we document this behaviour in a comment in site.c, which is
the wrong place really. We'll move it out later.
This commit introduces one spurious \n in a message, which will be
tidied up later.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 7 Dec 2019 18:21:11 +0000 (18:21 +0000)]
site: Read public peer keys from key file
Instead of a sigpubkey_if, we maintain a peer_keyset for the peer.
We try to get this from the new "peer-keys" configuration key which
specifies a file (to be parsed with the parser pubkeys.fl.pl).
Failing that we fall back to the old "key" (for key id
0000000000).
We actually keep up to two peer_keysets, because we don't want the set
to change during the middle of a key exchange. (In the future, peer
keysets might change during operation.) We make a "copy" (actually a
reference) at the start of key exchange.
We advertise the keyids we will accept in our MSG2/MSG3. We expect
the peer to state in their MSG3/MSG4 which key they have actually
signed the message with.
This commit has a bug: it never calls sethash. Our only algorithm
right now is rsa1 and needs sethash. So attempts to use this will
segfault.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 7 Dec 2019 18:17:05 +0000 (18:17 +0000)]
site: Be able to use multiple private keys
Replace the single permanent sigprivkey_if with a reference to a
private key cache, privcache_if. (We retain the old single privkey
variable as privkey_fixed, and set that if the cache is not
specified.)
When processing MSG1/MSG2, we hope the peer told us the keyids, of up
to MAX_SIG_KEYS, that it will accept.
When generating MSG3/MSG4, we feed those keyids to the cache to see if
we have any of them. If not we log a message with the wanted keyids.
We have to provide type_is_msg23 and keyid_zero.
(The corresponding other half of this protocol is in the next commit.)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 7 Dec 2019 18:20:54 +0000 (18:20 +0000)]
site: Introduce `pubkey' variable (twice)
No functional change, but this will make a forthcoming commit easier
to read.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 7 Dec 2019 18:15:42 +0000 (18:15 +0000)]
site: generate_msg: Introduce `privkey' variable
No functional change, but this will make a forthcoming commit easier
to read.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 29 Sep 2019 10:07:53 +0000 (11:07 +0100)]
NOTES: Add protocol elements for public key negotiation
There is no implementation of this yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Tue, 8 Oct 2019 18:44:41 +0000 (19:44 +0100)]
site: Move declaration/initialisation of `hash'
We are going to want this a bit sooner.
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 5 Oct 2019 10:15:22 +0000 (11:15 +0100)]
site: Introduce SETUP_SETHASH
This seems like overkill but this repetition will get worse later, so
eliminate it now.
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 29 Sep 2019 22:41:58 +0000 (23:41 +0100)]
site: New SIGKEYS log class, at level INFO, enabled by default
Nothing uses this yet, but we are going to log information about
which signing keys we are using (both as signer and relier).
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 4 Dec 2019 13:57:09 +0000 (13:57 +0000)]
privcache: Reorganise private key loading
Now that we only call one sigscheme's entry point, we should
restructure this so it doesn't look like we call scheme->loadpriv in a
loop.
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 4 Dec 2019 13:51:25 +0000 (13:51 +0000)]
rsa: Drop `unsup' parameter to load_err, verror, etc.
We do not tread `unsupported' differently, now.
All call sites pass 0. So delete this unused parameter.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 2 Dec 2019 13:08:35 +0000 (13:08 +0000)]
priv-cache etc.: private key algorithm is specified in key id
The idea that we would try various different algorithms to see who
could load a private key was a remnant of a previous design of key id
system. The actually implemnted arrangements identify the algorithm
in the key id, so there is no need for probing.
In this commit we fix the spec, and change the calling convention for
loadpriv. Now that we only call loadpriv once, it is allowed to
modify the buffer contents (although nothing makes use of this
relaxation right now).
We change loadpriv's one call site in privcache.c and its (currently
only) implementation, in rsa.c.
In privcache, the error message now definitely means that the algid
was unrecognised, so change it.
In rsa.c we make the log level M_ERR unconditionally (although in fact
verror_tryload now always gets unsup==0). We delete the now-unused
LDUNSUP from rsa.c, but there is some more intrusive refactoring to do
next to tidy up now-unused stuff.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 23:38:58 +0000 (23:38 +0000)]
rsa: Strip a couple of spurious newlines from pub key messages
Neither cfgfatal nor slilog want a trailing newline.
There are lots of this kind of problem in secnet. I'm just fixing two
I noticed here, in code I touched.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 17:21:00 +0000 (17:21 +0000)]
rsa: Provide rsa1_loadpub and therefore rsa1 sigscheme
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 17:16:19 +0000 (17:16 +0000)]
rsa: loadpriv: Use FREE
This is a tiny cleanup.
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 17:07:11 +0000 (17:07 +0000)]
rsa: LDPUBFATAL: Move & before lc into callers
We are going to want to add a new call site that passes 0.
And format it nicely.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 7 Dec 2019 11:33:45 +0000 (11:33 +0000)]
rsa: rsa_loadpub_core: Make it take a load_ctx and use load_err
Error handling goes via verror.
Now rsa_loadpub_core is ready to provide the non-fatal rsa1_loadpub
interface.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 14:11:59 +0000 (14:11 +0000)]
rsa: rsapub_dispose: Use RSAPUB_CLEAR_ST_BN
This is a small cleanup.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 14:11:37 +0000 (14:11 +0000)]
rsa: rsapub_dispose: Make passing 0 OK
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 14:05:32 +0000 (14:05 +0000)]
rsa: De-indirect a lot of `loc's
These were at some point intended to be possibly-null, but they aren't
now, so make them values not pointers. This way we know they're not
null, indeed.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 14:02:06 +0000 (14:02 +0000)]
rsa: Move load_err earlier
Code motion. We're going to want to use this for public keys.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 13:55:56 +0000 (13:55 +0000)]
rsa: Pass an additional maybe_loc to load_err
Use it instead of l->loc if it is non-0. But it isn't, yet, so no
functional change.
This will allow us to use load_err for handling errors in loadpub,
without regressing the error reporting: the individual bignums have
individual locs. (Perhaps retaining this is gold-plating, but it is
not particularly hard.)
Rename the function to keep the table within 80 columns.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 13:42:05 +0000 (13:42 +0000)]
rsa: Prepare rsa_loadpub_core for failure.
Now the whole of st is initialised, at least well enough for dispose.
We provide an error_out section which does so.
Nothing uses it yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 14:14:31 +0000 (14:14 +0000)]
rsa: Provide RSAPUB_INIT_ST_BN and _CLEAR_
We are going to use these soon.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 13:37:01 +0000 (13:37 +0000)]
rsa: Introduce LDPUBFATAL
Error handling, and thus the implementation, is going to change.
So move bring it into a common place.
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 13:25:01 +0000 (13:25 +0000)]
rsa: Break out rsa_loadpub_core
This involves some faff:
We provide macros for helping define and call loadpub_core.
We split RSAPUB_LOADCORE_DEFBN out of RSAPUB_APPLY_GETBN.
RSAPUB_APPLY_GETBN is reworked to do the missing parameter
check first, which lets us introduce e_loc and n_loc.
A side effect is that when we complain about "implausibly large" we
mention the specific rather than general loc.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 13:11:57 +0000 (13:11 +0000)]
rsa: Introduce RSAPUB_BNS and RSAPUB_APPLY_GETBN
No functional change except to messages, which now all use the same
words to describe the same thing (!)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 13:49:22 +0000 (13:49 +0000)]
rsa: Move FREE macro up
The public key half of this file is going to want this too.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 12:50:47 +0000 (12:50 +0000)]
rsa: sharing load_ctx: Introduce what
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 12:26:46 +0000 (12:26 +0000)]
privcache: Pass a cloc to loadpriv and use it
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 11:21:58 +0000 (11:21 +0000)]
rsa: sharing load_ctx: Move loc into common part
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 11:19:03 +0000 (11:19 +0000)]
rsa: sharing load_ctx: Rename load_ctx
Drop `rsapriv_'. `rsa' is implied by the file we are in and `priv' is
going to become false.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 11:16:06 +0000 (11:16 +0000)]
rsa: sharing load_ctx: Code motion
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 19 Oct 2019 22:23:18 +0000 (23:23 +0100)]
rsa: Do not do validity checks at runtime (in privcache load)
These will slow things down and you really ought not to have a broken
private key file.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 21:56:08 +0000 (22:56 +0100)]
rsa1: Provide rsa1_loadpriv function
We use the rsapriv_load_ctx infrastructure to provide a key loading
function suiting the scheme loadpriv interface.
I chose to use fmemopen because it is convenient. We have an
autoconf-based portability fixup for eg BSDs (i.e., an implementation
in terms of funopen).
This is going to go in the schemes table. It is not hooked in yet, so
won't be called.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 22:14:48 +0000 (23:14 +0100)]
rsa1: Drop filename from two error messages
The scheme loading interface doesn't provide the filename (and it will
handle logging it if need be). For the rsapriv_apply closure, the
config location will allow one to find the filename which seems
sufficient to me.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 22:08:01 +0000 (23:08 +0100)]
rsa1: Indirect postreadcheck via the context
Move this error check out of the keyfile_get_NN functions into the
KEYFILE_GET macro. The macro uses a helper function from the context,
which can now cause the function to return early.
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 21:59:51 +0000 (22:59 +0100)]
rsa1: Wrap calls to keyfile_get* in a macro
This will allow us to factor out the error handling into a common
place.
We rename the two functions to 16 and 32, so we will be able to
generate type names if we want.
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 20:42:10 +0000 (21:42 +0100)]
rsa1: rsa_loadpriv_core: Introduce rsapriv_load_ctx
Make the LD* macros call a new function load_error, and `goto
error_out'.
We must add a call to rsapriv_dispose on the error_out path so that
rsapriv_load_core now always frees everything at every LD* point - so
now this is OK from a memory management pov.
load_error calls a hook function verror. This is going to let us
parameterise the way rsapriv_load_core works.
No overall functional change yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 21:16:01 +0000 (22:16 +0100)]
rsa1: rsa_loadpriv_core: Always free b, and zero things we free
Make the FREE macro zero its argument. This makes it idempotent.
This means that at the end of the function, and at all points where
LD* is called, b is either from malloc and freeable, or null. It is
never a free'd pointer.
So we can free it. This is moving us towards always unconditionally
freeing everything on the exit path, to support non-fatal early
return.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 21:12:06 +0000 (22:12 +0100)]
rsa1: rsa_loadpriv_core: Make assume_valid do the frees
This regularises the exit path: now we always do these clears. This
makes the function easier to think about and easier to amend in the
way we're just about to.
There is no overall functional change since these variables are
initialised with mpz_init right at the top, even on the assume_valid
path.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 20:45:28 +0000 (21:45 +0100)]
rsa1: Move "rsa-private" closure string into LDFATAL etc. macros
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 20:35:10 +0000 (21:35 +0100)]
rsa1: Provide dispose functions
This eliminates two xxx's introduced earlier.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 20:27:36 +0000 (21:27 +0100)]
rsa1: Break rsa_loadpriv_core out of rsapriv_apply
Pure code motion.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 20:15:14 +0000 (21:15 +0100)]
rsa1: rsapriv_apply: Initialise st mpz's early
This will make it easier to support non-fatal early return.
No overall functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 20:13:31 +0000 (21:13 +0100)]
rsa1: rsapriv_apply: Initialise local mpz's early
This will make it easier to support non-fatal early return.
No overall functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 20:06:10 +0000 (21:06 +0100)]
rsa1: rsapriv_apply: Introduce macros for cfgfatal* and free
We now make a distinction in rsapriv_apply's body between errors which
mean the file is not an rsa private key file, from other errors.
We replace free with a macro too because we are going to change the
error handling so as to support non-fatal early return.
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 18:28:41 +0000 (18:28 +0000)]
pubkeys: Do not mind missing serial
That just means
00000000
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 17:46:39 +0000 (17:46 +0000)]
pubkeys: Better debug logging for syntax errors
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 17:28:11 +0000 (17:28 +0000)]
pubkeys: Improve debug message for expected ENOENT
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 10:51:53 +0000 (10:51 +0000)]
pubkeys: Pass a cloc to loadpub
This will be used for error reporting.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 11:28:56 +0000 (11:28 +0000)]
pubkeys: Move path and lno into a struct cloc
No functional change.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 16 Nov 2019 21:42:45 +0000 (21:42 +0000)]
pubkeys: Print file path in some log messages
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 2 Dec 2019 00:18:26 +0000 (00:18 +0000)]
pubkeys: Introduce `pkgf' fallback groups
This involves a new directive alias facility.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 6 Dec 2019 23:53:35 +0000 (23:53 +0000)]
pubkeys: Provide `fallback_skip' variable
Currently nothing sets this nonzero.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 6 Dec 2019 23:51:52 +0000 (23:51 +0000)]
pubkeys: Provide ability to add extra action to KEYWORD
Nothing uses this yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 29 Sep 2019 10:09:35 +0000 (11:09 +0100)]
pubkeys: Provide parser (and spec) for peer pubkeys files
Nothing uses this yet; also, we don't have code in make-secnet-sites
to generate these either.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Tue, 26 Nov 2019 22:16:22 +0000 (22:16 +0000)]
portability: Provide implementation of fmemopen
We are going to want one of these. I have tested it as follows:
1. In configure.ac just before AC_CHECK_FUNCS, add: LIBS+=-lbsd
2. In osdep.c, add: #include <bsd/stdio.h>
3. Change all fmemopen to Yfmemopen, with
git-ls-files | perl -lne 'print if lstat and -f _' | xargs perl -i~ -pe 's/fmemopen/Y$&/gi'
The result is that we do not find Yfmemopen. The tests still pass and
I have verified that my stunt implementation is called.
FTR, this rune undoes the Y:
git-ls-files | perl -lne 'print if lstat and -f _' | xargs perl -i~ -pe 's/Y(fmemopen)/$1/gi'
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Tue, 26 Nov 2019 22:14:23 +0000 (22:14 +0000)]
Provide osdep.[ch], currently empty
These will be used for compatibility implementations.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 8 Nov 2019 20:26:35 +0000 (20:26 +0000)]
base91: Python: make `import' work
We have subtree merged the base91 python module as base91-python.
We will want to be able to `import base91'. So make a symlink
`base91.py', and arrange to install it. ($(INSTALL) installs a copy
of the file, not the link, as we need it to.)
This is getting rather intimate with the file structure of the
upstream base91-python. If base91-python ever becomes more
complicated, and this breaks, it would surely be best to make it into
its own package.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 4 Dec 2019 23:22:58 +0000 (23:22 +0000)]
base91: CREDITS: Add information about Python library
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 16 Nov 2019 00:26:28 +0000 (00:26 +0000)]
BASE91 PYTHON DUMMY SYMLINK - WILL BE SUBTREE MERGE
I have ../base91-python containing
https://github.com/Fuyukai/base91-python
749aa78cf12496cca4b9bf3eafe045809fc0da10
This will become a git-subtree merge, but those are annoying to rebase.
Ian Jackson [Tue, 26 Nov 2019 23:37:51 +0000 (23:37 +0000)]
base91: Link it into secnet
This means that code in secnet can #include it and then call it.
Nothing does yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 17 Nov 2019 01:49:18 +0000 (01:49 +0000)]
base91: Patch the C version for our charset change
The base91.c.patch file was made by editing base91.c by hand and
running git diff. The change to enctab is the obvious one.
The change to dectab was simply done by hand based on inspection.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 17 Nov 2019 01:44:30 +0000 (01:44 +0000)]
base91: Build the C basE91 code with our own renaming
We want to use a variant character set. This will mean patching the
library. (That will happen in a moment.) It seems unwise, and
perhaps rude, to make a thing that has the same name as the official
basE91 but has a different and incompatible encoding.
So we change all the names: `basE91' and `base91' become base91s.
We don't change the leaf filenames because that's rather
inconvenient. We do put it all in a base91s subdirectory.
Rather than running the basE91 upstream makefile, or trying to sed it,
or something, we simply make our own makefile. It is simple enough.
The only complication is that the "source" files are all actually made
by this name substitution perl rune.
Overall, the chief result is that we build a base91s/base91s utility,
by default.
Right now it does not have our charset change, so it is not ready for
use yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 4 Dec 2019 23:54:29 +0000 (23:54 +0000)]
base91: CREDITS: Add information about C library
We introduced this in the previous commit, but it is a bit awkward to
combine this change with a subtree merge.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 17 Nov 2019 01:43:18 +0000 (01:43 +0000)]
B91 C DUMMY SYMLINK - WILL BE SUBTREE MERGE
I have ../Base91/base91-0.6.0 containing
a tarball download from
http://downloads.sourceforge.net/base91/base91-0.6.0.tar.gz
and the a few commits of my own; you can find it at
chiark:~ianmdlvl/public-git/base91.git
This will become a git-subtree merge, but those are annoying to rebase.
Ian Jackson [Sun, 1 Dec 2019 16:33:21 +0000 (16:33 +0000)]
README: Introduce spec for "base91s" encoding
We have no implementations of this yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 23:41:19 +0000 (23:41 +0000)]
privcache: Remove some spurious \n in messages
I really oughtn't to have done this, but there is much code in secnet
which sets a bad example.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 19:13:13 +0000 (19:13 +0000)]
privcache: Better debug
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Tue, 8 Oct 2019 16:22:49 +0000 (17:22 +0100)]
privcache: Use new pathprefix_template facility
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 29 Sep 2019 13:21:19 +0000 (14:21 +0100)]
privcache: New closure for signature key handling
This will be used by site.c, when it needs to load a key to make a
signature as demanded by the peer.
This commit introduces 5 spurious \n's in messages.
It also introduces a few ` = ' style errors.
These will be removed later.
No callers yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Tue, 8 Oct 2019 14:45:50 +0000 (15:45 +0100)]
util: pathprefix_template: New facility
We will use this for constructing public and private key filenames to
load.
No callers yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 29 Sep 2019 13:34:00 +0000 (14:34 +0100)]
sigscheme: Interface for signature schemes
There are no implementations yet. This is split out like this for
review of the api.
We use struct buffer_if to feed key data into the scheme, in both
cases. This will be convenient for implementations, The loadpub
caller will have the data from base91s, probably. The loadpriv caller
will have it from a file, but we read the file in the common code.
The API we are introducing now expects each private key buffer to be
fed to the sig schemes one by one until they it finds one that likes
it. This is in fact not necessary; it was needed in an earlier design
which does not otherwise survive in the published git history. This
rather suboptimal API will be changed later.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 29 Sep 2019 13:21:31 +0000 (14:21 +0100)]
sigpubkey/sigprivkey: Provide a dispose() method
This is needed allow the site code to load and unload keys
dynamically.
This is just the interface, with no implemntation and no callers,
split out like this for early review.
The two xxx's will be fixed rather later in
"rsa1: Provide dispose functions"
(but, obviously, before we add any callers).
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 29 Sep 2019 12:58:02 +0000 (13:58 +0100)]
sigpubkey/sigprivkey: Provide a hash_if
Sometimes, the caller is going to want to hash things for themselves.
(Notably, site.c will want to hash the advertisements of public key
set updates.)
The hash to be used should be the one used by the signature scheme, as
that has the same security properties.
In rsa.c this moves the hash_if from common to ops, and it is now
convenient to abolish rsa_hash which is a pointless veneer over
hash_hash.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Tue, 8 Oct 2019 14:51:41 +0000 (15:51 +0100)]
sigkey handling: Introduce serialt type
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 29 Sep 2019 19:28:46 +0000 (20:28 +0100)]
sigkey handling: define MAX_SIG_KEYS
This is going to control the number of different public keys we will
use from a keyset, and also the number we will look at when listed as
acceptable by a relying peer.
No users yet in this commit, though.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 29 Sep 2019 19:27:30 +0000 (20:27 +0100)]
sigkey handling: Introduce sigkeyid type
We provide helper macros for use with printf.
The reference to pubkeys.fl.pl comment is to code which doesn't exist
yet but comes later.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Thu, 28 Nov 2019 13:57:44 +0000 (13:57 +0000)]
pubkey handling: Document key sets, id, etc. plan
None of this is implemented yet.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Wed, 4 Dec 2019 21:55:15 +0000 (21:55 +0000)]
mtest/t-prefix: Drop redundant setting of seddery
This is in mtest/common.tcl already.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sat, 23 Nov 2019 19:52:43 +0000 (19:52 +0000)]
rsa: emsa_pkcs1: Fix a message
This function is called during verification too, so the message
shouldn't talk about signing.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 6 Oct 2019 22:34:33 +0000 (23:34 +0100)]
conffile: find_cl_if: fix fail_if_invalid==False
If the key was not found, this would segfault, so passing False didn't
work properly. Currently nothing does, so this bug is latent.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 8 Nov 2019 21:18:05 +0000 (21:18 +0000)]
make-secnet-sites: Tainted: Fix a lot of bad return values
This code had remnants of a previously intended calling convention,
where object return chaining would be used.
Unfortunately in the currently used calling style, we expect to get a
boolean back everywhere, where true meas `ok'. Returning `self' is
always treated as `ok' because it's trueish.
Luckily this doesn't cause actual security bugs because we always
return from all of the top-level entrypoints via ._rtn[val] which
checks the ._ok setting, which does properly track problems. So we
fail an assertion rather than printing a nice message. This is not
pretty but it is not a vulnerability.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Tue, 3 Dec 2019 22:10:08 +0000 (22:10 +0000)]
stest: Drop a redundant test
We were going to use this for key rollover tests etc. But in fact
we (much later in this series) will introduce new tests for the new
key loading arrangements. Actual key rollover will come *much* later
and there is little point having this placeholder in the meantime.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 6 Dec 2019 13:42:50 +0000 (13:42 +0000)]
autogen.sh: Write a comment about need for autoheader
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 6 Dec 2019 13:27:18 +0000 (13:27 +0000)]
configure.ac: Do not check for lack of standard headers
This makes configure rather faster.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 6 Dec 2019 13:37:23 +0000 (13:37 +0000)]
configure.ac: Drop AC_STDC_HEADERS
This is obsolete, as the docs say:
AC_STDC_HEADERS
Replaced by 'AC_HEADER_STDC'
AC_HEADER_STDC
This macro is obsolescent, as current systems have conforming
header files. New programs need not use this macro.
Unfortunately dropping it is not properly effective because it's
implied by some other stuff. We are going to deal with that in a
moment.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Fri, 6 Dec 2019 13:03:46 +0000 (13:03 +0000)]
configure.ac: Drop checks for systems lacking stdint.h
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Nov 2019 00:59:39 +0000 (00:59 +0000)]
stest: Check that received packet is as expected
It turns out that if secnet decides the link to the peer is too
broken, it loops outbound packets back to its host. Normally this is
not obvious, because the host naturally drops such packets.
But in stest we weren't actually looking at the incoming packets at
all, so we would treat this as success!
So, instead, match the start of the packet, including the source and
destination addresses and the icmp type. (This crude match will fail
if the reply contains any IP options, but the ping comes from the peer
secnet so it won't have.)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Nov 2019 00:59:31 +0000 (00:59 +0000)]
stest: Decode the slip packets that come via fake netlink
This will allow us to do something more sophisticated with the packet
contents.
The only functional change right now is to ignore empty `packets'.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 25 Nov 2019 00:01:34 +0000 (00:01 +0000)]
stest: If one of our secnets dies, call the test a failure
This involves use of TclX's `signal' facility. In my tests it was
easy to make Tcl deadlock by doing too much work in the signal
handler. In particular reaping children is a bad idea. Also signals
are not blocked during the signal handler so it would have to be
reentrant.
Instead, use `after idle'. That is quite soon enough for the reap to
run, and in my tests with TclX 8.4 it all works properly.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Sun, 24 Nov 2019 22:20:51 +0000 (22:20 +0000)]
stest: Use `finish' for success exits
vwait is a bit funny. This is better, and it also kills our child
secnets.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson [Mon, 25 Nov 2019 00:01:01 +0000 (00:01 +0000)]
stest: Kill our child secnets when we call finish
This stops them hanging around and, often, printing more stuff after
the test has actually failed.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>