net: http: Remove mbedtls heap setting from http library

The global mbedtls heap is set automatically now so no need to
set it individually in the http library.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-06-26 10:37:08 +03:00
commit 92fa7ac6ce
10 changed files with 10 additions and 45 deletions

View file

@ -27,6 +27,8 @@ CONFIG_HTTPS=y
CONFIG_MBEDTLS=y CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" 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_SETTINGS=y
CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1" CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1"

View file

@ -32,6 +32,8 @@ CONFIG_HTTPS=y
CONFIG_MBEDTLS=y CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" 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_SETTINGS=y
CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1" CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1"

View file

@ -30,6 +30,8 @@ CONFIG_HTTPS=y
CONFIG_MBEDTLS=y CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" 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_SETTINGS=y
CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1" CONFIG_NET_APP_MY_IPV6_ADDR="2001:db8::1"

View file

@ -27,6 +27,8 @@ CONFIG_HTTPS=y
CONFIG_MBEDTLS=y CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h"
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=12000
CONFIG_STDOUT_CONSOLE=y CONFIG_STDOUT_CONSOLE=y
CONFIG_NET_SHELL=y CONFIG_NET_SHELL=y

View file

@ -25,6 +25,8 @@ CONFIG_HTTPS=y
CONFIG_MBEDTLS=y CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_CFG_FILE="config-mini-tls1_2.h" 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_IPV6=y
CONFIG_NET_IPV4=y CONFIG_NET_IPV4=y

View file

@ -80,17 +80,6 @@ config HTTPS_STACK_SIZE
HTTPS thread stack size. The mbedtls routines will use this stack HTTPS thread stack size. The mbedtls routines will use this stack
thus it is by default very large. 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 config NET_DEBUG_HTTP
bool "Debug HTTP" bool "Debug HTTP"
default n default n

View file

@ -3,4 +3,3 @@ ccflags-$(CONFIG_HTTP_PARSER_STRICT) += -DHTTP_PARSER_STRICT
obj-$(CONFIG_HTTP_PARSER) := http_parser.o obj-$(CONFIG_HTTP_PARSER) := http_parser.o
obj-$(CONFIG_HTTP_CLIENT) += http_client.o obj-$(CONFIG_HTTP_CLIENT) += http_client.o
obj-$(CONFIG_HTTP_SERVER) += http_server.o obj-$(CONFIG_HTTP_SERVER) += http_server.o
obj-$(CONFIG_HTTP) += http.o

View file

@ -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 <stdbool.h>
#include <net/http.h>
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
#include <mbedtls/memory_buffer_alloc.h>
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 */

View file

@ -903,8 +903,6 @@ static int https_init(struct http_client_ctx *ctx)
mbedtls_platform_set_printf(printk); mbedtls_platform_set_printf(printk);
http_heap_init();
mbedtls_ssl_init(&ctx->https.mbedtls.ssl); mbedtls_ssl_init(&ctx->https.mbedtls.ssl);
mbedtls_ssl_config_init(&ctx->https.mbedtls.conf); mbedtls_ssl_config_init(&ctx->https.mbedtls.conf);
mbedtls_entropy_init(&ctx->https.mbedtls.entropy); mbedtls_entropy_init(&ctx->https.mbedtls.entropy);

View file

@ -1334,8 +1334,6 @@ static void https_handler(struct http_server_ctx *ctx)
mbedtls_platform_set_printf(printk); mbedtls_platform_set_printf(printk);
http_heap_init();
#if defined(MBEDTLS_X509_CRT_PARSE_C) #if defined(MBEDTLS_X509_CRT_PARSE_C)
mbedtls_x509_crt_init(&ctx->https.mbedtls.srvcert); mbedtls_x509_crt_init(&ctx->https.mbedtls.srvcert);
#endif #endif