+++ /dev/null
-
-#############################################################
-# Required variables for each makefile
-# Discard this section from all parent makefiles
-# Expected variables (with automatic defaults):
-# CSRCS (all "C" files in the dir)
-# SUBDIRS (all subdirs with a Makefile)
-# GEN_LIBS - list of libs to be generated ()
-# GEN_IMAGES - list of images to be generated ()
-# COMPONENTS_xxx - a list of libs/objs in the form
-# subdir/lib to be extracted and rolled up into
-# a generated lib/image xxx.a ()
-#
-ifndef PDIR
-
-UP_EXTRACT_DIR = ..
-GEN_LIBS = libopenssl.a
-COMPONENTS_libopenssl = library/liblibrary.a platform/libplatform.a
-
-endif
-
-
-#############################################################
-# Configuration i.e. compile options etc.
-# Target specific stuff (defines etc.) goes in here!
-# Generally values applying to a tree are captured in the
-# makefile at its root level - these are then overridden
-# for a subtree within the makefile rooted therein
-#
-#DEFINES +=
-
-#############################################################
-# Recursion Magic - Don't touch this!!
-#
-# Each subtree potentially has an include directory
-# corresponding to the common APIs applicable to modules
-# rooted at that subtree. Accordingly, the INCLUDE PATH
-# of a module can only contain the include directories up
-# its parent path, and not its siblings
-#
-# Required for each makefile to inherit from the parent
-#
-
-INCLUDES := $(INCLUDES) -I $(PDIR)include -I $(PDIR)include/platform -I $(PDIR)include/internal
-INCLUDES += -I ./inlcude
-INCLUDES += -I $(SDK_PATH)/include/openssl/internal
-INCLUDES += -I ./
-PDIR := ../$(PDIR)
-sinclude $(PDIR)Makefile
-
--- /dev/null
+# Anyone compiling mbedTLS code needs the name of the
+# alternative config file
+CFLAGS += -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"'
+
--- /dev/null
+#
+# Component Makefile
+#
+
+COMPONENT_ADD_INCLUDEDIRS := include include/internal include/platform include/oepnssl
+
+COMPONENT_SRCDIRS := library platform
+
+include $(IDF_PATH)/make/component_common.mk
#include "ssl_types.h"
-#define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING)
-#define SSL_want_read(s) (SSL_want(s) == SSL_READING)
-#define SSL_want_write(s) (SSL_want(s) == SSL_WRITING)
-#define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_WRITING)
-
#endif
const unsigned char **pp,
long length);
+void EVP_PKEY_free(EVP_PKEY *x);
+
#endif
#define _SSL_PM_H_
#include "ssl_types.h"
-#include "esp_common.h"
+#include "esp_types.h"
+#include "esp_system.h"
void* ssl_zalloc(size_t size);
void *ssl_malloc(size_t size);
+++ /dev/null
-
-#############################################################
-# Required variables for each makefile
-# Discard this section from all parent makefiles
-# Expected variables (with automatic defaults):
-# CSRCS (all "C" files in the dir)
-# SUBDIRS (all subdirs with a Makefile)
-# GEN_LIBS - list of libs to be generated ()
-# GEN_IMAGES - list of images to be generated ()
-# COMPONENTS_xxx - a list of libs/objs in the form
-# subdir/lib to be extracted and rolled up into
-# a generated lib/image xxx.a ()
-#
-ifndef PDIR
-
-GEN_LIBS = liblibrary.a
-
-endif
-
-
-#############################################################
-# Configuration i.e. compile options etc.
-# Target specific stuff (defines etc.) goes in here!
-# Generally values applying to a tree are captured in the
-# makefile at its root level - these are then overridden
-# for a subtree within the makefile rooted therein
-#
-#DEFINES +=
-
-#############################################################
-# Recursion Magic - Don't touch this!!
-#
-# Each subtree potentially has an include directory
-# corresponding to the common APIs applicable to modules
-# rooted at that subtree. Accordingly, the INCLUDE PATH
-# of a module can only contain the include directories up
-# its parent path, and not its siblings
-#
-# Required for each makefile to inherit from the parent
-#
-
-INCLUDES := $(INCLUDES) -I $(PDIR)include
-INCLUDES += -I ./
-PDIR := ../$(PDIR)
-sinclude $(PDIR)Makefile
-
#include "ssl_cert.h"
+#include "ssl_dbg.h"
#include "ssl_pm.h"
CERT *ssl_cert_new(void)
#define SSL_SEND_DATA_MAX_LENGTH 1460
-static int ossl_statem_in_error(const SSL *ssl)
+int ossl_statem_in_error(const SSL *ssl)
{
if (ssl->statem.state == MSG_FLOW_ERROR)
return 1;
return 0;
}
+/*
+ * SSL_want - get the SSL specifical statement
+ *
+ * @param ssl - SSL point
+ *
+ * @return specifical statement
+ */
+int SSL_want(const SSL *ssl)
+{
+ return 0;
+}
+
+/*
+ * SSL_want_nothing - check if SSL want nothing
+ *
+ * @param ssl - SSL point
+ *
+ * @return
+ * 1 : yes
+ * 0 : no
+ */
+int SSL_want_nothing(const SSL *ssl)
+{
+ return (SSL_want(ssl) == SSL_NOTHING);
+}
+
+/*
+ * SSL_want_read - check if SSL want to read
+ *
+ * @param ssl - SSL point
+ *
+ * @return
+ * 1 : yes
+ * 0 : no
+ */
+int SSL_want_read(const SSL *ssl)
+{
+ return (SSL_want(ssl) == SSL_READING);
+}
+
+/*
+ * SSL_want_read - check if SSL want to write
+ *
+ * @param ssl - SSL point
+ *
+ * @return
+ * 1 : yes
+ * 0 : no
+ */
+int SSL_want_write(const SSL *ssl)
+{
+ return (SSL_want(ssl) == SSL_WRITING);
+}
+
+/*
+ * SSL_want_read - check if SSL want to lookup X509 certification
+ *
+ * @param ssl - SSL point
+ *
+ * @return
+ * 1 : yes
+ * 0 : no
+ */
+int SSL_want_x509_lookup(const SSL *ssl)
+{
+ return (SSL_want(ssl) == SSL_WRITING);
+}
+
/*
* SSL_get_error - get SSL error code
*
SSL_ASSERT(ssl);
- if (ossl_state_in_error(ssl))
+ if (ossl_statem_in_error(ssl))
str = "SSLERR";
else
{
+++ /dev/null
-
-#############################################################
-# Required variables for each makefile
-# Discard this section from all parent makefiles
-# Expected variables (with automatic defaults):
-# CSRCS (all "C" files in the dir)
-# SUBDIRS (all subdirs with a Makefile)
-# GEN_LIBS - list of libs to be generated ()
-# GEN_IMAGES - list of images to be generated ()
-# COMPONENTS_xxx - a list of libs/objs in the form
-# subdir/lib to be extracted and rolled up into
-# a generated lib/image xxx.a ()
-#
-ifndef PDIR
-
-GEN_LIBS = libplatform.a
-
-endif
-
-
-#############################################################
-# Configuration i.e. compile options etc.
-# Target specific stuff (defines etc.) goes in here!
-# Generally values applying to a tree are captured in the
-# makefile at its root level - these are then overridden
-# for a subtree within the makefile rooted therein
-#
-#DEFINES +=
-
-#############################################################
-# Recursion Magic - Don't touch this!!
-#
-# Each subtree potentially has an include directory
-# corresponding to the common APIs applicable to modules
-# rooted at that subtree. Accordingly, the INCLUDE PATH
-# of a module can only contain the include directories up
-# its parent path, and not its siblings
-#
-# Required for each makefile to inherit from the parent
-#
-
-INCLUDES := $(INCLUDES) -I $(PDIR)include
-INCLUDES += -I ./
-PDIR := ../$(PDIR)
-sinclude $(PDIR)Makefile
-
#include "ssl_pm.h"
#include "ssl_dbg.h"
+#include <string.h>
+
/* mbedtls include */
#include "mbedtls/platform.h"
#include "mbedtls/net.h"
void *ssl_malloc(size_t size)
{
- return zalloc(size);
+ return ssl_zalloc(size);
}
void ssl_free(void *p)
ret = mbedtls_ssl_conf_own_cert(&ssl_pm->conf, &x509_pm->x509_crt, &pkey_pm->pkey);
if (ret)
- SSL_ERR(ret, failed4, "mbedtls_ssl_conf_own_cert:[%d]\n", ret);
+ SSL_ERR(ret, failed3, "mbedtls_ssl_conf_own_cert:[%d]\n", ret);
}
ret = mbedtls_ssl_setup(&ssl_pm->ssl, &ssl_pm->conf);