MCPcopy Create free account
hub / github.com/F-Stack/f-stack / padlock_hash_setup

Function padlock_hash_setup

freebsd/crypto/via/padlock_hash.c:366–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366int
367padlock_hash_setup(struct padlock_session *ses,
368 const struct crypto_session_params *csp)
369{
370
371 ses->ses_axf = padlock_hash_lookup(csp->csp_auth_alg);
372 if (csp->csp_auth_mlen == 0)
373 ses->ses_mlen = ses->ses_axf->hashsize;
374 else
375 ses->ses_mlen = csp->csp_auth_mlen;
376
377 /* Allocate memory for HMAC inner and outer contexts. */
378 ses->ses_ictx = malloc(ses->ses_axf->ctxsize, M_PADLOCK,
379 M_ZERO | M_NOWAIT);
380 ses->ses_octx = malloc(ses->ses_axf->ctxsize, M_PADLOCK,
381 M_ZERO | M_NOWAIT);
382 if (ses->ses_ictx == NULL || ses->ses_octx == NULL)
383 return (ENOMEM);
384
385 /* Setup key if given. */
386 if (csp->csp_auth_key != NULL) {
387 padlock_hash_key_setup(ses, csp->csp_auth_key,
388 csp->csp_auth_klen);
389 }
390 return (0);
391}
392
393int
394padlock_hash_process(struct padlock_session *ses, struct cryptop *crp,

Callers 1

padlock_newsessionFunction · 0.85

Calls 3

padlock_hash_lookupFunction · 0.85
mallocFunction · 0.85
padlock_hash_key_setupFunction · 0.85

Tested by

no test coverage detected