diff --git a/samples/net/http_server/prj_bt.conf b/samples/net/http_server/prj_bt.conf index 713e4d85cee..15d7337b933 100644 --- a/samples/net/http_server/prj_bt.conf +++ b/samples/net/http_server/prj_bt.conf @@ -27,6 +27,8 @@ CONFIG_HTTPS=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=12000 CONFIG_NET_APP_SETTINGS=y CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1" diff --git a/samples/net/http_server/prj_frdm_k64f.conf b/samples/net/http_server/prj_frdm_k64f.conf index c6336a4d247..33814436588 100644 --- a/samples/net/http_server/prj_frdm_k64f.conf +++ b/samples/net/http_server/prj_frdm_k64f.conf @@ -32,6 +32,8 @@ CONFIG_HTTPS=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=12000 CONFIG_NET_APP_SETTINGS=y CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1" diff --git a/samples/net/http_server/prj_qemu_x86.conf b/samples/net/http_server/prj_qemu_x86.conf index 6cb2cde9edd..a265188cafd 100644 --- a/samples/net/http_server/prj_qemu_x86.conf +++ b/samples/net/http_server/prj_qemu_x86.conf @@ -30,6 +30,8 @@ CONFIG_HTTPS=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=12000 CONFIG_NET_APP_SETTINGS=y CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1" diff --git a/samples/net/https_client/prj_frdm_k64f.conf b/samples/net/https_client/prj_frdm_k64f.conf index dbd2d34467c..382fcafd4ad 100644 --- a/samples/net/https_client/prj_frdm_k64f.conf +++ b/samples/net/https_client/prj_frdm_k64f.conf @@ -27,6 +27,8 @@ CONFIG_HTTPS=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=12000 CONFIG_STDOUT_CONSOLE=y CONFIG_NET_SHELL=y diff --git a/samples/net/https_client/prj_qemu_x86.conf b/samples/net/https_client/prj_qemu_x86.conf index 7cb861c5c78..49d72040178 100644 --- a/samples/net/https_client/prj_qemu_x86.conf +++ b/samples/net/https_client/prj_qemu_x86.conf @@ -25,6 +25,8 @@ CONFIG_HTTPS=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=12000 CONFIG_NET_IPV6=y CONFIG_NET_IPV4=y diff --git a/subsys/net/lib/http/Kconfig b/subsys/net/lib/http/Kconfig index 7d6a1017bca..48832d1f5a0 100644 --- a/subsys/net/lib/http/Kconfig +++ b/subsys/net/lib/http/Kconfig @@ -80,17 +80,6 @@ config HTTPS_STACK_SIZE HTTPS thread stack size. The mbedtls routines will use this stack thus it is by default very large. -config HTTPS_HEAP_SIZE - int "HTTPS heap size for mbedtls" - default 12000 - depends on HTTPS - depends on MBEDTLS - help - HTTPS heap size. The mbedtls routines will use this heap if enabled. - See ext/lib/crypto/mbedtls/include/mbedtls/config.h and - MBEDTLS_MEMORY_BUFFER_ALLOC_C option for details. This option is not - enabled by default. - config NET_DEBUG_HTTP bool "Debug HTTP" default n diff --git a/subsys/net/lib/http/Makefile b/subsys/net/lib/http/Makefile index c47634c45fc..304f5cae149 100644 --- a/subsys/net/lib/http/Makefile +++ b/subsys/net/lib/http/Makefile @@ -3,4 +3,3 @@ ccflags-$(CONFIG_HTTP_PARSER_STRICT) += -DHTTP_PARSER_STRICT obj-$(CONFIG_HTTP_PARSER) := http_parser.o obj-$(CONFIG_HTTP_CLIENT) += http_client.o obj-$(CONFIG_HTTP_SERVER) += http_server.o -obj-$(CONFIG_HTTP) += http.o diff --git a/subsys/net/lib/http/http.c b/subsys/net/lib/http/http.c deleted file mode 100644 index fc9c37b8406..00000000000 --- a/subsys/net/lib/http/http.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2017 Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#if defined(CONFIG_NET_DEBUG_HTTP) -#define SYS_LOG_DOMAIN "http" -#define NET_LOG_ENABLED 1 -#endif - -#include - -#include - -#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) -#include -static unsigned char heap[CONFIG_HTTPS_HEAP_SIZE]; - -void http_heap_init(void) -{ - static bool heap_init; - - if (!heap_init) { - heap_init = true; - mbedtls_memory_buffer_alloc_init(heap, sizeof(heap)); - } -} -#endif /* MBEDTLS_MEMORY_BUFFER_ALLOC_C */ diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index 50a2768c7d8..a34223ef337 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -903,8 +903,6 @@ static int https_init(struct http_client_ctx *ctx) mbedtls_platform_set_printf(printk); - http_heap_init(); - mbedtls_ssl_init(&ctx->https.mbedtls.ssl); mbedtls_ssl_config_init(&ctx->https.mbedtls.conf); mbedtls_entropy_init(&ctx->https.mbedtls.entropy); diff --git a/subsys/net/lib/http/http_server.c b/subsys/net/lib/http/http_server.c index fe5cea1081d..5a3a3f54feb 100644 --- a/subsys/net/lib/http/http_server.c +++ b/subsys/net/lib/http/http_server.c @@ -1334,8 +1334,6 @@ static void https_handler(struct http_server_ctx *ctx) mbedtls_platform_set_printf(printk); - http_heap_init(); - #if defined(MBEDTLS_X509_CRT_PARSE_C) mbedtls_x509_crt_init(&ctx->https.mbedtls.srvcert); #endif