FreeBSD/sys/dev/glxsb/glxsb_hash.c
/*
 * Compute keyed-hash authenticator.
 */
Compute keyed-hash authenticator.
Compute keyed - hash authenticator .
static int
glxsb_authcompute(struct glxsb_session *ses, struct cryptodesc *crd,
    caddr_t buf, int flags)
{
	u_char hash[HASH_MAX_LEN];
	struct auth_hash *axf;
	union authctx ctx;
	int error;
	axf = ses->ses_axf;
	bcopy(ses->ses_ictx, &ctx, axf->ctxsize);
	error = crypto_apply(flags, buf, crd->crd_skip, crd->crd_len,
	    (int (*)(void *, void *, unsigned int))axf->Update, (caddr_t)&ctx);
	if (error != 0)
		return (error);
	axf->Final(hash, &ctx);
	bcopy(ses->ses_octx, &ctx, axf->ctxsize);
	axf->Update(&ctx, hash, axf->hashsize);
	axf->Final(hash, &ctx);
	crypto_copyback(flags, buf, crd->crd_inject,
	ses->ses_mlen == 0 ? axf->hashsize : ses->ses_mlen, hash);
	return (0);
}
static int glxsb_authcompute ( struct glxsb_session * ses , struct cryptodesc * crd , caddr_t buf , int flags ) { u_char hash [ HASH_MAX_LEN ] ; struct auth_hash * axf ; union authctx ctx ; int error ; axf = ses -> ses_axf ; bcopy ( ses -> ses_ictx , & ctx , axf -> ctxsize ) ; error = crypto_apply ( flags , buf , crd -> crd_skip , crd -> crd_len , ( int ( * ) ( void * , void * , unsigned int ) ) axf -> Update , ( caddr_t ) & ctx ) ; if ( error != 0 ) return ( error ) ; axf -> Final ( hash , & ctx ) ; bcopy ( ses -> ses_octx , & ctx , axf -> ctxsize ) ; axf -> Update ( & ctx , hash , axf -> hashsize ) ; axf -> Final ( hash , & ctx ) ; crypto_copyback ( flags , buf , crd -> crd_inject , ses -> ses_mlen == 0 ? axf -> hashsize : ses -> ses_mlen , hash ) ; return ( 0 ) ; }
Compute keyed-hash authenticator.
Compute keyed - hash authenticator .
/* Inject the authentication data */