mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/openssl: refacetor the SSL debug function
Add the "ssl_opt.h" file to make user able t add its platform interface
This commit is contained in:
parent
8d1f360ca6
commit
bc710e5b88
@ -38,10 +38,17 @@
|
||||
#define SSL_DEBUG_LOCATION_ENABLE 0
|
||||
#endif
|
||||
|
||||
#ifndef SSL_PRINT
|
||||
#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
|
||||
@ -56,11 +63,11 @@
|
||||
#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
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#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);
|
||||
@ -35,6 +36,8 @@ size_t ssl_strlen(const char *src);
|
||||
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
|
||||
|
@ -22,7 +22,7 @@
|
||||
/*********************************************************************************************/
|
||||
/********************************* SSL general interface *************************************/
|
||||
|
||||
void* ssl_zalloc(size_t size)
|
||||
void* ssl_mem_zalloc(size_t size)
|
||||
{
|
||||
void *p = malloc(size);
|
||||
|
||||
@ -32,12 +32,12 @@ void* ssl_zalloc(size_t 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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user