git: c3eec459b643 - stable/13 - cryptosoft: Support per-op keys for AES-GCM and AES-CCM.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 21 Oct 2021 17:06:53 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=c3eec459b643f08a9af479b28a0789b655207617

commit c3eec459b643f08a9af479b28a0789b655207617
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-02-18 17:24:35 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-10-21 15:51:23 +0000

    cryptosoft: Support per-op keys for AES-GCM and AES-CCM.
    
    Reviewed by:    cem
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D28752
    
    (cherry picked from commit a10020cfe2830e9626ac58ae97ecd12afb3553be)
---
 sys/opencrypto/cryptosoft.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c
index 6ac628b9c21f..a09f085a1eef 100644
--- a/sys/opencrypto/cryptosoft.c
+++ b/sys/opencrypto/cryptosoft.c
@@ -537,6 +537,9 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp)
 		}
 	}
 
+	if (crp->crp_cipher_key != NULL)
+		exf->setkey(swe->sw_kschedule, crp->crp_cipher_key,
+		    crypto_get_params(crp->crp_session)->csp_cipher_klen);
 	exf->reinit(swe->sw_kschedule, iv);
 
 	/* Do encryption with MAC */
@@ -755,6 +758,9 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp)
 	if (error)
 		return (error);
 
+	if (crp->crp_cipher_key != NULL)
+		exf->setkey(swe->sw_kschedule, crp->crp_cipher_key,
+		    crypto_get_params(crp->crp_session)->csp_cipher_klen);
 	exf->reinit(swe->sw_kschedule, iv);
 
 	/* Do encryption/decryption with MAC */