From nobody Thu May 09 00:49:43 2024 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 4VZYLw2YCCz5K5dR; Thu, 09 May 2024 00:49:44 +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 4VZYLw0lK4z4mvr; Thu, 9 May 2024 00:49:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715215784; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E6E0Dla7vA6W9aopq3wMiibDzrb+b2ejXK2o0+HuTs0=; b=atPcUvoPcW7zDUTjxlpLoL3Tqxp7LCGu/640q0vpztmM2t+qgLTjnu0lM9fj+h0T5eidzc YYiRt88xB0KgmC7VjPPs8MoCku0TWn4DZQ4pWDXvTJvD51Nrcj2y6lytdZpkbd0sx5oay/ D4WL7r8plFBnqjcbfWyRMfmcb4dPy83Lxyv7EQ6l7MtJDoEdMcsTIEvhdi+Vr6dLwZxgo1 O1fRCT0MuDOXJHt2pQFmlzArCZBBbCUztMkUqA3dXMY5o2i1S4dY65iDM7TLMSCD0I/Gx/ 9symGeUpO9HDJH5l3Mvu970g9nk2OKYoobSoxNg+JFkyZFpr/04kqVuYbzyNlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715215784; a=rsa-sha256; cv=none; b=wv3OXcRGfjLljmomlKSUFQ9H44tD0G4VVnU7qn9IJavluv6vhFw7xhWPF+kN7EL0FXqcMF hfawB/PVBGV/zHuhr0QP3axV2PJqghSwh8iEHfpNEnwTkyTXUZ0ztiXdbYtAWECmN+m8kx qbxa/txlKYdZpkgpVa52aWkic/fBiohux8EvFYoebOJetgY2Un+qqUUw0IVEBZcAxQ2ow1 cOPTBb1tN1zlj2TsyOg+UgBF/VE3S6jJfMxmX8/eTjO/5vrreYkoXq23UqOaAEqdyAop5l 8PUCQ08IWoVQVRlnL8Ul0qold+/SwIRW6V9gDiYynZKkv9IgD+JqTsoQxqjbsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715215784; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E6E0Dla7vA6W9aopq3wMiibDzrb+b2ejXK2o0+HuTs0=; b=Qa+R7/zY9iEFxx2LZuz94HI95Si2VuLJhV8VYPYKqQ+vc51o+0ocsf+zCTBrM8gwgM4wjt Xasa0D0nfljL72t0Y9UeV1vt7pxkHtGICbbR/t7p4H4nMK8SF31DWt3PkPK5tsd4lxlWJo 20/5XLqgLrgguEVmPzfHSgkdlPVgTrGPK0IygODYRnQ/U/xC1fKWqIQE24mPox4lb3sawv go75FzcR5vSnzRZ+sB0lg9KirksXTeZqhR9fHv/Cezcg0f5LaxYB3ncHl1xPm6hTJrlrfQ o04IQq3AG4/dcTLPtyQ8JL5Tq22lltFMnL07YC6wRhQpd5EFmSw+KdTZuz+Xjg== 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 4VZYLw07FNznYm; Thu, 9 May 2024 00:49:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4490nhae063675; Thu, 9 May 2024 00:49:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4490nh6J063672; Thu, 9 May 2024 00:49:43 GMT (envelope-from git) Date: Thu, 9 May 2024 00:49:43 GMT Message-Id: <202405090049.4490nh6J063672@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: e9961ea16496 - main - net80211: add driver / crypto methods to set the hardware / software cipher suites 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9961ea164968bf2bdab210eab69201b4bf2cb37 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=e9961ea164968bf2bdab210eab69201b4bf2cb37 commit e9961ea164968bf2bdab210eab69201b4bf2cb37 Author: Adrian Chadd AuthorDate: 2024-04-18 01:47:07 +0000 Commit: Adrian Chadd CommitDate: 2024-05-09 00:49:12 +0000 net80211: add driver / crypto methods to set the hardware / software cipher suites Drivers currently announce hardware crypto cipher support by setting up ic_cryptocaps. This adds two public function calls: * ieee80211_set_software_ciphers() - set the software cipher set; * ieee80211_set_hardware_ciphers() - set the hardware cipher set. For now these just call into the newly crypto routines to set the ciphers. This then adds the two crypto routines, similarly named, to set the hardware/software cipher suite. This is a no-op right now - wep/tkip/ccmp are already set by default so drivers aren't required to call these routines for software encryption, and drivers already set ic_cryptocaps for hardware encryption. Differential Revision: https://reviews.freebsd.org/D44827 --- sys/net80211/ieee80211.c | 22 ++++++++++++++++++++++ sys/net80211/ieee80211_crypto.c | 21 +++++++++++++++++++++ sys/net80211/ieee80211_crypto.h | 4 ++++ sys/net80211/ieee80211_var.h | 4 ++++ 4 files changed, 51 insertions(+) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 15785a8f0966..1c82493274bb 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -434,6 +434,28 @@ ieee80211_ifdetach(struct ieee80211com *ic) IEEE80211_LOCK_DESTROY(ic); } +/* + * Called by drivers during attach to set the supported + * cipher set for software encryption. + */ +void +ieee80211_set_software_ciphers(struct ieee80211com *ic, + uint32_t cipher_suite) +{ + ieee80211_crypto_set_supported_software_ciphers(ic, cipher_suite); +} + +/* + * Called by drivers during attach to set the supported + * cipher set for hardware encryption. + */ +void +ieee80211_set_hardware_ciphers(struct ieee80211com *ic, + uint32_t cipher_suite) +{ + ieee80211_crypto_set_supported_hardware_ciphers(ic, cipher_suite); +} + struct ieee80211com * ieee80211_find_com(const char *name) { diff --git a/sys/net80211/ieee80211_crypto.c b/sys/net80211/ieee80211_crypto.c index ff78600e2f0e..e849fe06db65 100644 --- a/sys/net80211/ieee80211_crypto.c +++ b/sys/net80211/ieee80211_crypto.c @@ -164,6 +164,27 @@ ieee80211_crypto_detach(struct ieee80211com *ic) { } +/* + * Set the supported ciphers for software encryption. + */ +void +ieee80211_crypto_set_supported_software_ciphers(struct ieee80211com *ic, + uint32_t cipher_set) +{ + ic->ic_sw_cryptocaps = cipher_set; +} + +/* + * Set the supported ciphers for hardware encryption. + */ +void +ieee80211_crypto_set_supported_hardware_ciphers(struct ieee80211com *ic, + uint32_t cipher_set) +{ + ic->ic_cryptocaps = cipher_set; +} + + /* * Setup crypto support for a vap. */ diff --git a/sys/net80211/ieee80211_crypto.h b/sys/net80211/ieee80211_crypto.h index fc7c13cfdfb4..9637278701ff 100644 --- a/sys/net80211/ieee80211_crypto.h +++ b/sys/net80211/ieee80211_crypto.h @@ -162,6 +162,10 @@ MALLOC_DECLARE(M_80211_CRYPTO); void ieee80211_crypto_attach(struct ieee80211com *); void ieee80211_crypto_detach(struct ieee80211com *); +void ieee80211_crypto_set_supported_software_ciphers(struct ieee80211com *, + uint32_t cipher_set); +void ieee80211_crypto_set_supported_hardware_ciphers(struct ieee80211com *, + uint32_t cipher_set); void ieee80211_crypto_vattach(struct ieee80211vap *); void ieee80211_crypto_vdetach(struct ieee80211vap *); int ieee80211_crypto_newkey(struct ieee80211vap *, diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 2c13113b92a1..21fdff0b88a3 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -751,6 +751,10 @@ MALLOC_DECLARE(M_80211_VAP); int ic_printf(struct ieee80211com *, const char *, ...) __printflike(2, 3); void ieee80211_ifattach(struct ieee80211com *); void ieee80211_ifdetach(struct ieee80211com *); +void ieee80211_set_software_ciphers(struct ieee80211com *, + uint32_t cipher_suite); +void ieee80211_set_hardware_ciphers(struct ieee80211com *, + uint32_t cipher_suite); int ieee80211_vap_setup(struct ieee80211com *, struct ieee80211vap *, const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode, int flags,