| 364 | } |
| 365 | |
| 366 | int |
| 367 | padlock_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 | |
| 393 | int |
| 394 | padlock_hash_process(struct padlock_session *ses, struct cryptop *crp, |
no test coverage detected