mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-21 00:56:38 +08:00
fix(ssl): Only enable MQTT(SSL) and nopoll when using mbedtls
This commit is contained in:
@ -21,7 +21,9 @@
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#ifdef CONFIG_SSL_USING_MBEDTLS
|
||||
#include "openssl/ssl.h"
|
||||
#endif
|
||||
|
||||
typedef struct Timer {
|
||||
portTickType xTicksToWait;
|
||||
@ -37,8 +39,10 @@ struct Network {
|
||||
void (*disconnect)(Network*);
|
||||
|
||||
int read_count;
|
||||
#ifdef CONFIG_SSL_USING_MBEDTLS
|
||||
SSL_CTX* ctx;
|
||||
SSL* ssl;
|
||||
#endif
|
||||
};
|
||||
|
||||
void TimerInit(Timer*);
|
||||
@ -90,6 +94,7 @@ typedef struct ssl_ca_crt_key {
|
||||
unsigned int key_len;
|
||||
} ssl_ca_crt_key_t;
|
||||
|
||||
#ifdef CONFIG_SSL_USING_MBEDTLS
|
||||
/**
|
||||
* @brief Initialize the network structure for SSL connection
|
||||
*
|
||||
@ -117,3 +122,5 @@ int NetworkConnectSSL(Network* n, char* addr, int port, ssl_ca_crt_key_t* ssl_cc
|
||||
/*int NetworkConnectTLS(Network*, char*, int, SlSockSecureFiles_t*, unsigned char, unsigned int, char);*/
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -16,7 +16,6 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include "lwip/netdb.h"
|
||||
#include "openssl/ssl.h"
|
||||
#include "MQTTFreeRTOS.h"
|
||||
|
||||
int ThreadStart(Thread* thread, void (*fn)(void*), void* arg)
|
||||
@ -207,7 +206,7 @@ exit:
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_SSL_USING_MBEDTLS
|
||||
static int esp_ssl_read(Network* n, unsigned char* buffer, unsigned int len, unsigned int timeout_ms)
|
||||
{
|
||||
portTickType xTicksToWait = timeout_ms / portTICK_RATE_MS; /* convert milliseconds to ticks */
|
||||
@ -444,3 +443,4 @@ exit1:
|
||||
exit:
|
||||
return retVal;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,6 +1,9 @@
|
||||
#
|
||||
# Component Makefile
|
||||
#
|
||||
|
||||
ifdef CONFIG_SSL_USING_MBEDTLS
|
||||
COMPONENT_ADD_INCLUDEDIRS += include/nopoll
|
||||
|
||||
COMPONENT_SRCDIRS := library
|
||||
endif
|
Reference in New Issue
Block a user