Store IV in output buffer in GCM software fallback when requested.

Properly honor the lack of the CRD_F_IV_PRESENT flag in the GCM
software fallback case for encryption requests.

Submitted by:	Harsh Jain @ Chelsio
Sponsored by:	Chelsio Communications
This commit is contained in:
John Baldwin 2018-01-24 20:16:48 +00:00
parent 2bc40b6ca9
commit c0154062c7

@ -1467,6 +1467,9 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *crp,
memcpy(iv, crde->crd_iv, 12);
else
arc4rand(iv, 12, 0);
if ((crde->crd_flags & CRD_F_IV_PRESENT) == 0)
crypto_copyback(crp->crp_flags, crp->crp_buf,
crde->crd_inject, 12, iv);
} else {
if (crde->crd_flags & CRD_F_IV_EXPLICIT)
memcpy(iv, crde->crd_iv, 12);