[RFC PATCH 4/4] usb: core: Add Kconfig option to compile usb authorization

From: nicolas . bouchinet
Date: Fri Jun 20 2025 - 10:28:08 EST


From: Nicolas Bouchinet <nicolas.bouchinet@xxxxxxxxxxx>

This enables the usb authentication protocol implementation.

Co-developed-by: Luc Bonnafoux <luc.bonnafoux@xxxxxxxxxxx>
Signed-off-by: Luc Bonnafoux <luc.bonnafoux@xxxxxxxxxxx>
Signed-off-by: Nicolas Bouchinet <nicolas.bouchinet@xxxxxxxxxxx>
---
drivers/usb/core/Kconfig | 8 ++++++++
drivers/usb/core/Makefile | 4 ++++
2 files changed, 12 insertions(+)

diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index 58e3ca7e479392112f656384c664efc36bb1151a..07ba67137b7fe16ecb1e993a51dbbfd4dd3ada88 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -143,3 +143,11 @@ config USB_DEFAULT_AUTHORIZATION_MODE
ACPI selecting value 2 is analogous to selecting value 0.

If unsure, keep the default value.
+
+config USB_AUTHENTICATION
+ bool "Enable USB authentication function"
+ default n
+ depends on USB
+ help
+ Enables the USB Authentication function. This activates the
+ hook points in the USB stack.
diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
index ac006abd13b3ad8362dc7baa115124c11eaafc84..7ba1a89cf3de7a398889eee1820f2bfbbc4280f5 100644
--- a/drivers/usb/core/Makefile
+++ b/drivers/usb/core/Makefile
@@ -8,6 +8,10 @@ usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o
usbcore-y += devio.o notify.o generic.o quirks.o devices.o
usbcore-y += phy.o port.o

+ifdef CONFIG_USB_AUTHENTICATION
+usbcore-y += authent.o authent_netlink.o
+endif
+
usbcore-$(CONFIG_OF) += of.o
usbcore-$(CONFIG_USB_PCI) += hcd-pci.o
usbcore-$(CONFIG_ACPI) += usb-acpi.o

--
2.50.0