diff mbox series

net: Kconfig: depend on DM_RNG for WGET_HTTPS

Message ID 20250204154707.3054802-1-jerome.forissier@linaro.org
State Superseded
Headers show
Series net: Kconfig: depend on DM_RNG for WGET_HTTPS | expand

Commit Message

Jerome Forissier Feb. 4, 2025, 3:47 p.m. UTC
net/lwip/wget.c/mbedtls_hardware_poll() is calling dm_rng_read() but
dependency is not recorded anywhere that's why depend on DM_RNG
when WGET_HTTPS is used.

Suggested-by: Michal Simek <michal.simek@amd.com>
Co-developed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
---
 cmd/Kconfig     |  1 +
 net/lwip/wget.c | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

Comments

Ilias Apalodimas Feb. 4, 2025, 3:57 p.m. UTC | #1
Hi Jerome,

Thanks for taking care of this

On Tue, 4 Feb 2025 at 17:48, Jerome Forissier
<jerome.forissier@linaro.org> wrote:
>
> net/lwip/wget.c/mbedtls_hardware_poll() is calling dm_rng_read() but
> dependency is not recorded anywhere that's why depend on DM_RNG
> when WGET_HTTPS is used.
>
> Suggested-by: Michal Simek <michal.simek@amd.com>
> Co-developed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> ---
>  cmd/Kconfig     |  1 +
>  net/lwip/wget.c | 10 +++++++---
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index e62817bd977..e3fbb7538ee 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -2154,6 +2154,7 @@ config WGET_HTTPS
>         depends on CMD_WGET
>         depends on PROT_TCP_LWIP
>         depends on MBEDTLS_LIB
> +       depends on DM_RNG
>         select SHA256
>         select RSA
>         select ASYMMETRIC_KEY_TYPE
> diff --git a/net/lwip/wget.c b/net/lwip/wget.c
> index b76f6c0f1d9..d9b639ce60e 100644
> --- a/net/lwip/wget.c
> +++ b/net/lwip/wget.c
> @@ -433,10 +433,14 @@ bool wget_validate_uri(char *uri)
>
>         if (!strncmp(uri, "http://", strlen("http://"))) {
>                 prefix_len = strlen("http://");
> -       } else if (!strncmp(uri, "https://", strlen("https://"))) {
> -               prefix_len = strlen("https://");
> +       } else if (CONFIG_IS_ENABLED(WGET_HTTPS)) {
> +               if (!strncmp(uri, "https://", strlen("https://"))) {
> +                       prefix_len = strlen("https://");
> +               } else {
> +                       log_err("only http(s):// is supported\n");

return false; here as well

> +               }
>         } else {
> -               log_err("only http(s):// is supported\n");
> +               log_err("only http:// is supported\n");
>                 return false;
>         }
>
> --
> 2.43.0
>
Other than that, this is exactly what I had in mind
Thanks
/Ilias
diff mbox series

Patch

diff --git a/cmd/Kconfig b/cmd/Kconfig
index e62817bd977..e3fbb7538ee 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -2154,6 +2154,7 @@  config WGET_HTTPS
 	depends on CMD_WGET
 	depends on PROT_TCP_LWIP
 	depends on MBEDTLS_LIB
+	depends on DM_RNG
 	select SHA256
 	select RSA
 	select ASYMMETRIC_KEY_TYPE
diff --git a/net/lwip/wget.c b/net/lwip/wget.c
index b76f6c0f1d9..d9b639ce60e 100644
--- a/net/lwip/wget.c
+++ b/net/lwip/wget.c
@@ -433,10 +433,14 @@  bool wget_validate_uri(char *uri)
 
 	if (!strncmp(uri, "http://", strlen("http://"))) {
 		prefix_len = strlen("http://");
-	} else if (!strncmp(uri, "https://", strlen("https://"))) {
-		prefix_len = strlen("https://");
+	} else if (CONFIG_IS_ENABLED(WGET_HTTPS)) {
+		if (!strncmp(uri, "https://", strlen("https://"))) {
+			prefix_len = strlen("https://");
+		} else {
+			log_err("only http(s):// is supported\n");
+		}
 	} else {
-		log_err("only http(s):// is supported\n");
+		log_err("only http:// is supported\n");
 		return false;
 	}