From nobody Thu Oct 21 17:08:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9F6BE180A95F; Thu, 21 Oct 2021 17:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HZv8S1HQHz4jkC; Thu, 21 Oct 2021 17:08:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6EFD1F211; Thu, 21 Oct 2021 17:08:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19LH8thb081021; Thu, 21 Oct 2021 17:08:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19LH8t0R081020; Thu, 21 Oct 2021 17:08:55 GMT (envelope-from git) Date: Thu, 21 Oct 2021 17:08:55 GMT Message-Id: <202110211708.19LH8t0R081020@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b33ff94123a6 - main - ktls: Change struct ktls_session.cipher to an OCF-specific type. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b33ff94123a666d0f38541f97f1c64c512f90a56 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b33ff94123a666d0f38541f97f1c64c512f90a56 commit b33ff94123a666d0f38541f97f1c64c512f90a56 Author: John Baldwin AuthorDate: 2021-10-21 16:36:53 +0000 Commit: John Baldwin CommitDate: 2021-10-21 16:36:53 +0000 ktls: Change struct ktls_session.cipher to an OCF-specific type. As a followup to SW KTLS assuming an OCF backend, rename struct ocf_session to struct ktls_ocf_session and forward declare it in to use as the type of struct ktls_session.cipher. Reviewed by: gallatin, hselasky Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D32565 --- sys/opencrypto/ktls_ocf.c | 30 +++++++++++++++--------------- sys/sys/ktls.h | 3 ++- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index a3b9ab49e4f0..0753f4bafb1a 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include -struct ocf_session { +struct ktls_ocf_session { crypto_session_t sid; crypto_session_t mac_sid; struct mtx lock; @@ -64,7 +64,7 @@ struct ocf_session { }; struct ocf_operation { - struct ocf_session *os; + struct ktls_ocf_session *os; bool done; }; @@ -142,7 +142,7 @@ ktls_ocf_callback_async(struct cryptop *crp) } static int -ktls_ocf_dispatch(struct ocf_session *os, struct cryptop *crp) +ktls_ocf_dispatch(struct ktls_ocf_session *os, struct cryptop *crp) { struct ocf_operation oo; int error; @@ -228,7 +228,7 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_ocf_encrypt_state *state, struct uio *uio; struct tls_mac_data *ad; struct cryptop *crp; - struct ocf_session *os; + struct ktls_ocf_session *os; struct iovec iov[m->m_epg_npgs + 2]; u_int pgoff; int i, error; @@ -237,7 +237,7 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_ocf_encrypt_state *state, MPASS(outiovcnt + 1 <= nitems(iov)); - os = tls->cipher; + os = tls->ocf_session; hdr = (const struct tls_record_layer *)m->m_epg_hdr; crp = &state->crp; uio = &state->uio; @@ -376,11 +376,11 @@ ktls_ocf_tls12_aead_encrypt(struct ktls_ocf_encrypt_state *state, struct uio *uio; struct tls_aead_data *ad; struct cryptop *crp; - struct ocf_session *os; + struct ktls_ocf_session *os; int error; uint16_t tls_comp_len; - os = tls->cipher; + os = tls->ocf_session; hdr = (const struct tls_record_layer *)m->m_epg_hdr; crp = &state->crp; uio = &state->uio; @@ -457,12 +457,12 @@ ktls_ocf_tls12_aead_decrypt(struct ktls_session *tls, { struct tls_aead_data ad; struct cryptop crp; - struct ocf_session *os; + struct ktls_ocf_session *os; struct ocf_operation oo; int error; uint16_t tls_comp_len; - os = tls->cipher; + os = tls->ocf_session; oo.os = os; oo.done = false; @@ -526,11 +526,11 @@ ktls_ocf_tls13_aead_encrypt(struct ktls_ocf_encrypt_state *state, struct uio *uio; struct tls_aead_data_13 *ad; struct cryptop *crp; - struct ocf_session *os; + struct ktls_ocf_session *os; char nonce[12]; int error; - os = tls->cipher; + os = tls->ocf_session; hdr = (const struct tls_record_layer *)m->m_epg_hdr; crp = &state->crp; uio = &state->uio; @@ -598,9 +598,9 @@ ktls_ocf_tls13_aead_encrypt(struct ktls_ocf_encrypt_state *state, void ktls_ocf_free(struct ktls_session *tls) { - struct ocf_session *os; + struct ktls_ocf_session *os; - os = tls->cipher; + os = tls->ocf_session; crypto_freesession(os->sid); mtx_destroy(&os->lock); zfree(os, M_KTLS_OCF); @@ -610,7 +610,7 @@ int ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction) { struct crypto_session_params csp, mac_csp; - struct ocf_session *os; + struct ktls_ocf_session *os; int error, mac_len; memset(&csp, 0, sizeof(csp)); @@ -745,7 +745,7 @@ ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction) } mtx_init(&os->lock, "ktls_ocf", NULL, MTX_DEF); - tls->cipher = os; + tls->ocf_session = os; if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16 || tls->params.cipher_algorithm == CRYPTO_CHACHA20_POLY1305) { if (direction == KTLS_TX) { diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index 4258d2c342dc..aea13d2d8ce1 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -167,6 +167,7 @@ struct tls_session_params { #define KTLS_RX 2 struct iovec; +struct ktls_ocf_session; struct ktls_ocf_encrypt_state; struct ktls_session; struct m_snd_tag; @@ -184,7 +185,7 @@ struct ktls_session { uint64_t seqno, int *trailer_len); }; union { - void *cipher; + struct ktls_ocf_session *ocf_session; struct m_snd_tag *snd_tag; }; struct tls_session_params params;