site: Check transform errors; factor out transform handling
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Jul 2013 17:30:52 +0000 (18:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Jul 2013 17:30:52 +0000 (18:30 +0100)
commit0afd257e3beecf259a24a315d370b6d43db9fb44
treeb6228d9faea927bd623565ae01c8af3ad6e13d30
parent09a385fbbb18ace5daedd473c91c5b584dab3b2a
site: Check transform errors; factor out transform handling

Make sure we always check the error return from transform->forwards
and ->backwards.  Otherwise logic errors in the site state machine
might result in us sending out packets with unencrypted insider
plaintext, or the like, due to the transform being unkeyed when we try
to use it.

Factor some repeated idioms for transform handling into a set of new
functions.  This will make the next patch much easier.

We arrange to pass dispose_transform a pointer to the actual state
variable where the transform is kept; this means that it can be
changed to update that pointer.

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