X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/898a4e2555438ff8adb08b4d82690d08715e1048..b817bfc642225b8c3c0b6a7e42d1fb949b61a606:/sslprf.c diff --git a/sslprf.c b/sslprf.c index e9682e5..05f64d1 100644 --- a/sslprf.c +++ b/sslprf.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: sslprf.c,v 1.1 2001/04/06 22:05:10 mdw Exp $ + * $Id: sslprf.c,v 1.2 2004/04/08 01:36:15 mdw Exp $ * * The SSL pseudo-random function * @@ -27,14 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: sslprf.c,v $ - * Revision 1.1 2001/04/06 22:05:10 mdw - * Add support for SSL pseudo-random function. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -66,24 +58,24 @@ static void step(sslprf_ctx *c) ghash *h, *hh; octet *p; - h = c->ci->init(); + h = GH_INIT(c->ci); x = 'A' + c->i - 1; for (sz = c->i++; sz > 0; sz -= n) { n = sz; if (n > sizeof(buf)) n = sizeof(buf); memset(buf, x, n); - h->ops->hash(h, buf, n); + GH_HASH(h, buf, n); } - h->ops->hash(h, c->k, c->ksz); - h->ops->hash(h, c->sd, c->sdsz); - p = h->ops->done(h, 0); + GH_HASH(h, c->k, c->ksz); + GH_HASH(h, c->sd, c->sdsz); + p = GH_DONE(h, 0); - hh = c->co->init(); - hh->ops->hash(hh, c->k, c->ksz); - hh->ops->hash(hh, p, c->ihashsz); - c->p = hh->ops->done(hh, 0); - h->ops->destroy(h); + hh = GH_INIT(c->co); + GH_HASH(hh, c->k, c->ksz); + GH_HASH(hh, p, c->ihashsz); + c->p = GH_DONE(hh, 0); + GH_DESTROY(h); c->h = hh; c->sz = c->ohashsz; @@ -138,7 +130,7 @@ void sslprf_encrypt(sslprf_ctx *c, const void *src, void *dest, size_t sz) while (sz) { if (!c->sz) { - c->h->ops->destroy(c->h); + GH_DESTROY(c->h); step(c); } n = c->sz; @@ -170,7 +162,7 @@ void sslprf_encrypt(sslprf_ctx *c, const void *src, void *dest, size_t sz) void sslprf_free(sslprf_ctx *c) { - c->h->ops->destroy(c->h); + GH_DESTROY(c->h); } /* --- Generic random number generator --- */