X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/8dd8c294e9f330eb6b975c2b96cf9bbfcd087e5e..78614e02310dbe879d55f0a68e47349db074ff61:/seal.c diff --git a/seal.c b/seal.c index 92901b1..444a11c 100644 --- a/seal.c +++ b/seal.c @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: seal.c,v 1.1 2000/06/17 12:08:34 mdw Exp $ + * $Id: seal.c,v 1.2 2004/04/08 01:36:15 mdw Exp $ * * The SEAL pseudo-random function family * * (c) 2000 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,26 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: seal.c,v $ - * Revision 1.1 2000/06/17 12:08:34 mdw - * New cipher. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -147,7 +139,7 @@ static void gamma(uint32 *p, size_t sz, const void *k, unsigned i) if (sz) { *p++ = e; sz--; } skip = 0; } - } + } } /* --- @seal_initkey@ --- * @@ -210,7 +202,7 @@ static void seal_reset(seal_ctx *c) } A = n ^ c->r[0]; - B = ROR32(n, 8) ^ c->r[1]; + B = ROR32(n, 8) ^ c->r[1]; C = ROR32(n, 16) ^ c->r[2]; D = ROR32(n, 24) ^ c->r[3]; c->l += 4; @@ -317,7 +309,7 @@ void seal_encrypt(seal_ctx *c, const void *src, void *dest, size_t sz) if (j == 256) { seal_reset(c); - A = c->a, B = c->b, C = c->c, D = c->d; + A = c->a, B = c->b, C = c->c, D = c->d; n1 = c->n1, n2 = c->n2, n3 = c->n3, n4 = c->n4; j = 0; } @@ -332,7 +324,7 @@ void seal_encrypt(seal_ctx *c, const void *src, void *dest, size_t sz) Q = (Q + B) & 0x7fc; C += k->t[Q >> 2]; B = ROR32(B, 9); P = (P + C) & 0x7fc; D ^= k->t[P >> 2]; C = ROR32(C, 9); Q = (Q + D) & 0x7fc; A += k->t[Q >> 2]; D = ROR32(D, 9); - + /* --- Remember the output and set up the next round --- */ aa = B + k->s[j + 0];