#define SSL_DEBUG_LOCATION_ENABLE 0
#endif
-#ifndef SSL_PRINT
- #include "stdio.h"
- extern int printf(const char *fmt, ...);
- #define SSL_PRINT printf
+#if SSL_DEBUG_ENBALE
+ #ifndef SSL_PRINT
+ #include "stdio.h"
+ extern int printf(const char *fmt, ...);
+ #define SSL_PRINT printf
+ #endif
+#else
+ #ifdef SSL_PRINT
+ #undef SSL_PRINT
+ #define SSL_PRINT(...)
+ #endif
#endif
#if SSL_DEBUG_LOCATION_ENABLE
#define SSL_ASSERT(s)
#endif
-#define SSL_ERR(err, go, ...) { SSL_DEBUG_LOCATION(); SSL_PRINT(__VA_ARGS__); ret = err; goto go; }
+#define SSL_ERR(err, go, fmt, ...) { SSL_DEBUG_LOCATION(); SSL_PRINT(fmt, ##__VA_ARGS__); ret = err; goto go; }
-#define SSL_RET(go, ...) { SSL_DEBUG_LOCATION(); SSL_PRINT(__VA_ARGS__); goto go; }
+#define SSL_RET(go, fmt, ...) { SSL_DEBUG_LOCATION(); SSL_PRINT(fmt, ##__VA_ARGS__); goto go; }
-#define SSL_DEBUG(level, ...) { if (level > SSL_DEBUG_LEVEL) {SSL_PRINT(__VA_ARGS__);} }
+#define SSL_DEBUG(level, fmt, ...) { if (level > SSL_DEBUG_LEVEL) {SSL_PRINT(fmt, ##__VA_ARGS__);} }
#ifdef __cplusplus
}
#ifdef ESP32_IDF_PLATFORM
#include "esp_types.h"
+#include "esp_log.h"
void *ssl_mem_zalloc(size_t size);
void *ssl_mem_malloc(size_t size);
void ssl_speed_up_enter(void);
void ssl_speed_up_exit(void);
+#define SSL_PRINT(fmt, ...) ESP_LOGD("OpenSSL", fmt, ##__VA_ARGS__)
+
#elif defined(SSL_PLATFORM_USER_INCLUDE)
SSL_PLATFORM_USER_INCLUDE
/*********************************************************************************************/
/********************************* SSL general interface *************************************/
-void* ssl_zalloc(size_t size)
+void* ssl_mem_zalloc(size_t size)
{
void *p = malloc(size);
return p;
}
-void *ssl_malloc(size_t size)
+void *ssl_mem_malloc(size_t size)
{
return malloc(size);
}
-void ssl_free(void *p)
+void ssl_mem_free(void *p)
{
free(p);
}