Commit 65e01dba authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Initial support for mbedTLS

PUBLISHED_FROM=edb1063d3fd64e3c732f16b8bf101c065cdacddd
parent 62276ce6
...@@ -8,12 +8,17 @@ ifeq ($(OS), Windows_NT) ...@@ -8,12 +8,17 @@ ifeq ($(OS), Windows_NT)
CFLAGS += -lws2_32 CFLAGS += -lws2_32
CC = gcc CC = gcc
else else
CFLAGS += -pthread
endif
ifeq ($(SSL_LIB),openssl) ifeq ($(SSL_LIB),openssl)
CFLAGS += -DMG_ENABLE_SSL -lssl -lcrypto CFLAGS += -DMG_ENABLE_SSL -lssl -lcrypto
else ifeq ($(SSL_LIB), krypton)
CFLAGS += -DMG_ENABLE_SSL -DMG_DISABLE_PFS ../../../krypton/krypton.c -I../../../krypton
endif endif
CFLAGS += -lpthread ifeq ($(SSL_LIB), krypton)
CFLAGS += -DMG_ENABLE_SSL ../../../krypton/krypton.c -I../../../krypton
endif
ifeq ($(SSL_LIB),mbedtls)
CFLAGS += -DMG_ENABLE_SSL -DMG_SSL_IF=MG_SSL_IF_MBEDTLS -DMG_SSL_MBED_DUMMY_RANDOM -lmbedcrypto -lmbedtls -lmbedx509
endif endif
ifeq ($(JS), yes) ifeq ($(JS), yes)
......
This diff is collapsed.
...@@ -97,6 +97,10 @@ ...@@ -97,6 +97,10 @@
#define MG_NET_IF_LWIP_LOW_LEVEL 3 #define MG_NET_IF_LWIP_LOW_LEVEL 3
#define MG_NET_IF_PIC32_HARMONY 4 #define MG_NET_IF_PIC32_HARMONY 4
#define MG_SSL_IF_OPENSSL 1
#define MG_SSL_IF_MBEDTLS 2
#define MG_SSL_IF_SIMPLELINK 3
/* Amalgamated: #include "common/platforms/platform_unix.h" */ /* Amalgamated: #include "common/platforms/platform_unix.h" */
/* Amalgamated: #include "common/platforms/platform_windows.h" */ /* Amalgamated: #include "common/platforms/platform_windows.h" */
/* Amalgamated: #include "common/platforms/platform_esp8266.h" */ /* Amalgamated: #include "common/platforms/platform_esp8266.h" */
...@@ -513,6 +517,7 @@ typedef struct stat cs_stat_t; ...@@ -513,6 +517,7 @@ typedef struct stat cs_stat_t;
#include <time.h> #include <time.h>
#define MG_NET_IF MG_NET_IF_SIMPLELINK #define MG_NET_IF MG_NET_IF_SIMPLELINK
#define MG_SSL_IF MG_SSL_IF_SIMPLELINK
/* /*
* CC3100 SDK and STM32 SDK include headers w/out path, just like * CC3100 SDK and STM32 SDK include headers w/out path, just like
...@@ -566,6 +571,7 @@ int inet_pton(int af, const char *src, void *dst); ...@@ -566,6 +571,7 @@ int inet_pton(int af, const char *src, void *dst);
#endif #endif
#define MG_NET_IF MG_NET_IF_SIMPLELINK #define MG_NET_IF MG_NET_IF_SIMPLELINK
#define MG_SSL_IF MG_SSL_IF_SIMPLELINK
/* Only SPIFFS supports directories, SLFS does not. */ /* Only SPIFFS supports directories, SLFS does not. */
#if defined(CC3200_FS_SPIFFS) && !defined(MG_ENABLE_DIRECTORY_LISTING) #if defined(CC3200_FS_SPIFFS) && !defined(MG_ENABLE_DIRECTORY_LISTING)
...@@ -700,6 +706,7 @@ struct dirent *readdir(DIR *dir); ...@@ -700,6 +706,7 @@ struct dirent *readdir(DIR *dir);
#endif #endif
#define MG_NET_IF MG_NET_IF_SIMPLELINK #define MG_NET_IF MG_NET_IF_SIMPLELINK
#define MG_SSL_IF MG_SSL_IF_SIMPLELINK
/* Amalgamated: #include "common/platforms/simplelink/cs_simplelink.h" */ /* Amalgamated: #include "common/platforms/simplelink/cs_simplelink.h" */
...@@ -2743,6 +2750,10 @@ struct { \ ...@@ -2743,6 +2750,10 @@ struct { \
#define MG_NET_IF MG_NET_IF_SOCKET #define MG_NET_IF MG_NET_IF_SOCKET
#endif #endif
#ifndef MG_SSL_IF
#define MG_SSL_IF MG_SSL_IF_OPENSSL
#endif
#ifndef MG_ENABLE_THREADS /* ifdef-ok */ #ifndef MG_ENABLE_THREADS /* ifdef-ok */
#ifdef _WIN32 #ifdef _WIN32
#define MG_ENABLE_THREADS 1 #define MG_ENABLE_THREADS 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment