add initial symbols to config and checks to check_config to allow use of macros to define standard functions
diff --git a/include/polarssl/check_config.h b/include/polarssl/check_config.h
index 51745c9..eb2fecd 100644
--- a/include/polarssl/check_config.h
+++ b/include/polarssl/check_config.h
@@ -198,14 +198,65 @@
#error "POLARSSL_PKCS11_C defined, but not all prerequisites"
#endif
+#if defined(POLARSSL_PLATFORM_ENABLE_FUNCTION_MACROS) &&\
+ !defined(POLARSSL_PLATFORM_C)
+#error "POLARSSL_PLATFORM_ENABLE_FUNCTION_MACROS defined, but not prerequisites"
+#endif
+
#if defined(POLARSSL_PLATFORM_EXIT_ALT) && !defined(POLARSSL_PLATFORM_C)
#error "POLARSSL_PLATFORM_EXIT_ALT defined, but not all prerequisites"
#endif
+#if defined(POLARSSL_PLATFORM_EXIT_MACRO) &&\
+ ( !defined(POLARSSL_PLATFORM_C) ||\
+ !defined(POLARSSL_PLATFORM_ENABLE_FUNCTION_MACROS) )
+#error "POLARSSL_PLATFORM_EXIT_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(POLARSSL_PLATFORM_EXIT_MACRO) &&\
+ ( defined(POLARSSL_PLATFORM_STD_EXIT) ||\
+ defined(POLARSSL_PLATFORM_EXIT_ALT) )
+#error "POLARSSL_PLATFORM_EXIT_MACRO and POLARSSL_PLATFORM_STD_EXIT/POLARSSL_PLATFORM_EXIT_ALT cannot be defined simultaneously"
+#endif
+
#if defined(POLARSSL_PLATFORM_FPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
#error "POLARSSL_PLATFORM_FPRINTF_ALT defined, but not all prerequisites"
#endif
+#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) &&\
+ ( !defined(POLARSSL_PLATFORM_C) ||\
+ !defined(POLARSSL_PLATFORM_ENABLE_FUNCTION_MACROS) )
+#error "POLARSSL_PLATFORM_FPRINTF_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(POLARSSL_PLATFORM_FPRINTF_MACRO) &&\
+ ( defined(POLARSSL_PLATFORM_STD_FPRINTF) ||\
+ defined(POLARSSL_PLATFORM_FPRINTF_ALT) )
+#error "POLARSSL_PLATFORM_FPRINTF_MACRO and POLARSSL_PLATFORM_STD_FPRINTF/POLARSSL_PLATFORM_FPRINTF_ALT cannot be defined simultaneously"
+#endif
+
+#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
+ ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) ||\
+ !defined(POLARSSL_PLATFORM_ENABLE_FUNCTION_MACROS) )
+#error "POLARSSL_PLATFORM_FREE_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(POLARSSL_PLATFORM_FREE_MACRO) &&\
+ defined(POLARSSL_PLATFORM_STD_FREE)
+#error "POLARSSL_PLATFORM_FREE_MACRO and POLARSSL_PLATFORM_STD_FREE cannot be defined simultaneously"
+#endif
+
+#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
+ ( !defined(POLARSSL_PLATFORM_C) || !defined(POLARSSL_PLATFORM_MEMORY) ||\
+ !defined(POLARSSL_PLATFORM_ENABLE_FUNCTION_MACROS) )
+#error "POLARSSL_PLATFORM_MALLOC_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(POLARSSL_PLATFORM_MALLOC_MACRO) &&\
+ defined(POLARSSL_PLATFORM_STD_MALLOC)
+#error "POLARSSL_PLATFORM_MALLOC_MACRO and POLARSSL_PLATFORM_STD_MALLOC cannot be defined simultaneously"
+#endif
+
#if defined(POLARSSL_PLATFORM_MEMORY) && !defined(POLARSSL_PLATFORM_C)
#error "POLARSSL_PLATFORM_MEMORY defined, but not all prerequisites"
#endif
@@ -214,6 +265,18 @@
#error "POLARSSL_PLATFORM_PRINTF_ALT defined, but not all prerequisites"
#endif
+#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) &&\
+ ( !defined(POLARSSL_PLATFORM_C) ||\
+ !defined(POLARSSL_PLATFORM_ENABLE_FUNCTION_MACROS) )
+#error "POLARSSL_PLATFORM_PRINTF_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(POLARSSL_PLATFORM_PRINTF_MACRO) &&\
+ ( defined(POLARSSL_PLATFORM_STD_PRINTF) ||\
+ defined(POLARSSL_PLATFORM_PRINTF_ALT) )
+#error "POLARSSL_PLATFORM_PRINTF_MACRO and POLARSSL_PLATFORM_STD_PRINTF/POLARSSL_PLATFORM_PRINTF_ALT cannot be defined simultaneously"
+#endif
+
#if defined(POLARSSL_PLATFORM_SNPRINTF_ALT) && !defined(POLARSSL_PLATFORM_C)
#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined, but not all prerequisites"
#endif
@@ -223,6 +286,18 @@
#error "POLARSSL_PLATFORM_SNPRINTF_ALT defined but not available on Windows"
#endif
+#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) &&\
+ ( !defined(POLARSSL_PLATFORM_C) ||\
+ !defined(POLARSSL_PLATFORM_ENABLE_FUNCTION_MACROS) )
+#error "POLARSSL_PLATFORM_SNPRINTF_MACRO defined, but not all prerequisites"
+#endif
+
+#if defined(POLARSSL_PLATFORM_SNPRINTF_MACRO) &&\
+ ( defined(POLARSSL_PLATFORM_STD_SNPRINTF) ||\
+ defined(POLARSSL_PLATFORM_SNPRINTF_ALT) )
+#error "POLARSSL_PLATFORM_SNPRINTF_MACRO and POLARSSL_PLATFORM_STD_SNPRINTF/POLARSSL_PLATFORM_SNPRINTF_ALT cannot be defined simultaneously"
+#endif
+
#if defined(POLARSSL_PLATFORM_STD_MEM_HDR) &&\
!defined(POLARSSL_PLATFORM_NO_STD_FUNCTIONS)
#error "POLARSSL_PLATFORM_STD_MEM_HDR defined, but not all prerequisites"
diff --git a/include/polarssl/config.h b/include/polarssl/config.h
index 7db377e..6f13440 100644
--- a/include/polarssl/config.h
+++ b/include/polarssl/config.h
@@ -148,6 +148,16 @@
//#define POLARSSL_PLATFORM_NO_STD_FUNCTIONS
/**
+ * \def POLARSSL_PLATFORM_ENABLE_FUNCTION_MACROS
+ *
+ * TO-DO: ADD DESCRIPTION & ANY WARNINGS ETC
+ *
+ * Requires: POLARSSL_PLATFORM_C
+ *
+ */
+//#define POLARSSL_PLATFORM_ENABLE_FUNCTION_MACROS
+
+/**
* \def POLARSSL_PLATFORM_XXX_ALT
*
* Uncomment a macro to let mbed TLS support the function in the platform
@@ -2248,6 +2258,13 @@
//#define POLARSSL_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */
//#define POLARSSL_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
+//#define POLARSSL_PLATFORM_MALLOC_MACRO malloc /**< Default allocator macro to use, can be undefined */
+//#define POLARSSL_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined */
+//#define POLARSSL_PLATFORM_EXIT_MACRO exit /**< Default exit macro to use, can be undefined */
+//#define POLARSSL_PLATFORM_FPRINTF_MACRO fprintf /**< Default fprintf macro to use, can be undefined */
+//#define POLARSSL_PLATFORM_PRINTF_MACRO printf /**< Default printf macro to use, can be undefined */
+//#define POLARSSL_PLATFORM_SNPRINTF_MACRO snprintf /**< Default snprintf macro to use, can be undefined */
+
/* SSL Cache options */
//#define SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */
//#define SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /**< Maximum entries in cache */