/* -*-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
*
* 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 <mLib/alloc.h>
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;
while (sz) {
if (!c->sz) {
- c->h->ops->destroy(c->h);
+ GH_DESTROY(c->h);
step(c);
}
n = c->sz;
void sslprf_free(sslprf_ctx *c)
{
- c->h->ops->destroy(c->h);
+ GH_DESTROY(c->h);
}
/* --- Generic random number generator --- */