mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-22 01:27:11 +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/semphr.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_SSL_USING_MBEDTLS
|
||||||
#include "openssl/ssl.h"
|
#include "openssl/ssl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct Timer {
|
typedef struct Timer {
|
||||||
portTickType xTicksToWait;
|
portTickType xTicksToWait;
|
||||||
@ -37,8 +39,10 @@ struct Network {
|
|||||||
void (*disconnect)(Network*);
|
void (*disconnect)(Network*);
|
||||||
|
|
||||||
int read_count;
|
int read_count;
|
||||||
|
#ifdef CONFIG_SSL_USING_MBEDTLS
|
||||||
SSL_CTX* ctx;
|
SSL_CTX* ctx;
|
||||||
SSL* ssl;
|
SSL* ssl;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void TimerInit(Timer*);
|
void TimerInit(Timer*);
|
||||||
@ -90,6 +94,7 @@ typedef struct ssl_ca_crt_key {
|
|||||||
unsigned int key_len;
|
unsigned int key_len;
|
||||||
} ssl_ca_crt_key_t;
|
} ssl_ca_crt_key_t;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SSL_USING_MBEDTLS
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the network structure for SSL connection
|
* @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);*/
|
/*int NetworkConnectTLS(Network*, char*, int, SlSockSecureFiles_t*, unsigned char, unsigned int, char);*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "lwip/netdb.h"
|
#include "lwip/netdb.h"
|
||||||
#include "openssl/ssl.h"
|
|
||||||
#include "MQTTFreeRTOS.h"
|
#include "MQTTFreeRTOS.h"
|
||||||
|
|
||||||
int ThreadStart(Thread* thread, void (*fn)(void*), void* arg)
|
int ThreadStart(Thread* thread, void (*fn)(void*), void* arg)
|
||||||
@ -207,7 +206,7 @@ exit:
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SSL_USING_MBEDTLS
|
||||||
static int esp_ssl_read(Network* n, unsigned char* buffer, unsigned int len, unsigned int timeout_ms)
|
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 */
|
portTickType xTicksToWait = timeout_ms / portTICK_RATE_MS; /* convert milliseconds to ticks */
|
||||||
@ -444,3 +443,4 @@ exit1:
|
|||||||
exit:
|
exit:
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Component Makefile
|
# Component Makefile
|
||||||
#
|
#
|
||||||
|
|
||||||
|
ifdef CONFIG_SSL_USING_MBEDTLS
|
||||||
COMPONENT_ADD_INCLUDEDIRS += include/nopoll
|
COMPONENT_ADD_INCLUDEDIRS += include/nopoll
|
||||||
|
|
||||||
COMPONENT_SRCDIRS := library
|
COMPONENT_SRCDIRS := library
|
||||||
|
endif
|
Reference in New Issue
Block a user