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

nicolas.bouchinet@oss.cyber.gouv.fr posted 4 patches 3 months, 2 weeks ago
There is a newer version of this series
[RFC PATCH 4/4] usb: core: Add Kconfig option to compile usb authorization
Posted by nicolas.bouchinet@oss.cyber.gouv.fr 3 months, 2 weeks ago
From: Nicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>

This enables the usb authentication protocol implementation.

Co-developed-by: Luc Bonnafoux <luc.bonnafoux@ssi.gouv.fr>
Signed-off-by: Luc Bonnafoux <luc.bonnafoux@ssi.gouv.fr>
Signed-off-by: Nicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>
---
 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
Re: [RFC PATCH 4/4] usb: core: Add Kconfig option to compile usb authorization
Posted by Greg Kroah-Hartman 3 months, 2 weeks ago
On Fri, Jun 20, 2025 at 04:27:19PM +0200, nicolas.bouchinet@oss.cyber.gouv.fr wrote:
> From: Nicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>
> 
> This enables the usb authentication protocol implementation.
> 
> Co-developed-by: Luc Bonnafoux <luc.bonnafoux@ssi.gouv.fr>
> Signed-off-by: Luc Bonnafoux <luc.bonnafoux@ssi.gouv.fr>
> Signed-off-by: Nicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>
> ---
>  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

Nit, "default n" is the default, no need to ever list it.

thanks,

greg k-h
Re: [RFC PATCH 4/4] usb: core: Add Kconfig option to compile usb authorization
Posted by Nicolas Bouchinet 3 months, 1 week ago
On 6/21/25 09:22, Greg Kroah-Hartman wrote:
> On Fri, Jun 20, 2025 at 04:27:19PM +0200, nicolas.bouchinet@oss.cyber.gouv.fr wrote:
>> From: Nicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>
>>
>> This enables the usb authentication protocol implementation.
>>
>> Co-developed-by: Luc Bonnafoux <luc.bonnafoux@ssi.gouv.fr>
>> Signed-off-by: Luc Bonnafoux <luc.bonnafoux@ssi.gouv.fr>
>> Signed-off-by: Nicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>
>> ---
>>   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
> Nit, "default n" is the default, no need to ever list it.

Done, fixes will be sent in the next patch version.

>
> thanks,
>
> greg k-h