X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/0f00dc4c8eb47e67bc0f148c2dd109f73a451e0a..8c6991f6b0336f375a7b7d39f4c7f031b740838a:/symm/seal.c diff --git a/symm/seal.c b/symm/seal.c index df7cd1ba..0ba56c0e 100644 --- a/symm/seal.c +++ b/symm/seal.c @@ -58,7 +58,7 @@ const octet seal_keysz[] = { KSZ_ANY, SHA_HASHSZ }; * Use: Initializes a SEAL key table. */ -static void gamma(uint32 *p, size_t sz, const void *k, unsigned i) +static void sealgamma(uint32 *p, size_t sz, const void *k, unsigned i) { uint32 buf[80] = { 0 }; const octet *kk = k; @@ -168,9 +168,9 @@ void seal_initkey(seal_key *k, const void *buf, size_t sz) /* --- Expand the key to fit the various tables --- */ - gamma(k->t, 512, k->k, 0); - gamma(k->s, 256, k->k, 0x1000); - gamma(k->r, SEAL_R, k->k, 0x2000); + sealgamma(k->t, 512, k->k, 0); + sealgamma(k->s, 256, k->k, 0x1000); + sealgamma(k->r, SEAL_R, k->k, 0x2000); } /* --- @seal_reset@ --- * @@ -193,7 +193,7 @@ static void seal_reset(seal_ctx *c) /* --- Initialize the new chaining variables --- */ if (c->l >= SEAL_R) { - gamma(c->rbuf, SEAL_R, k->k, c->ri); + sealgamma(c->rbuf, SEAL_R, k->k, c->ri); c->ri += SEAL_R; c->l = 0; c->r = c->rbuf; @@ -413,8 +413,8 @@ static void gencrypt(gcipher *c, const void *s, void *t, size_t sz) static void gsetiv(gcipher *c, const void *iv) { gctx *g = (gctx *)c; - uint32 n = *(const uint32 *)iv; - seal_initctx(&g->cc, &g->k, n); + const octet *ivp = iv; + seal_initctx(&g->cc, &g->k, LOAD32(ivp)); } static void gdestroy(gcipher *c) @@ -430,7 +430,7 @@ static const gcipher_ops gops = { }; const gccipher seal = { - "seal", seal_keysz, 0, + "seal", seal_keysz, 4, ginit }; @@ -529,7 +529,7 @@ static const grand_ops grops = { "seal", GRAND_CRYPTO, 0, grmisc, grdestroy, - grword, grbyte, grword, grand_range, grfill + grword, grbyte, grword, grand_defaultrange, grfill }; /* --- @seal_rand@ --- *