move pers to h, add return code int
This commit is contained in:
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#include "WiFiSSLClient.h"
|
#include "WiFiSSLClient.h"
|
||||||
|
|
||||||
const char *pers = "esp32-tls";
|
|
||||||
|
|
||||||
class __Guard {
|
class __Guard {
|
||||||
public:
|
public:
|
||||||
__Guard(SemaphoreHandle_t handle) {
|
__Guard(SemaphoreHandle_t handle) {
|
||||||
@@ -56,6 +54,7 @@ WiFiSSLClient::WiFiSSLClient() :
|
|||||||
|
|
||||||
int WiFiSSLClient::connect(const char* host, uint16_t port)
|
int WiFiSSLClient::connect(const char* host, uint16_t port)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
synchronized {
|
synchronized {
|
||||||
_netContext.fd = -1;
|
_netContext.fd = -1;
|
||||||
_connected = false;
|
_connected = false;
|
||||||
@@ -75,8 +74,10 @@ int WiFiSSLClient::connect(const char* host, uint16_t port)
|
|||||||
ets_printf("*** connect drbgseed\n");
|
ets_printf("*** connect drbgseed\n");
|
||||||
mbedtls_entropy_init(&_entropyContext);
|
mbedtls_entropy_init(&_entropyContext);
|
||||||
// Seeds and sets up CTR_DRBG for future reseeds, pers is device personalization (esp)
|
// Seeds and sets up CTR_DRBG for future reseeds, pers is device personalization (esp)
|
||||||
if (mbedtls_ctr_drbg_seed(&_ctrDrbgContext, mbedtls_entropy_func,
|
ret = mbedtls_ctr_drbg_seed(&_ctrDrbgContext, mbedtls_entropy_func,
|
||||||
&_entropyContext, (const unsigned char *) pers, strlen(pers)) != 0) {
|
&_entropyContext, (const unsigned char *) pers, strlen(pers));
|
||||||
|
if (ret < 0) {
|
||||||
|
ets_printf("Unable to set up mbedtls_entropy.\n");
|
||||||
stop();
|
stop();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public:
|
|||||||
|
|
||||||
virtual /*IPAddress*/uint32_t remoteIP();
|
virtual /*IPAddress*/uint32_t remoteIP();
|
||||||
virtual uint16_t remotePort();
|
virtual uint16_t remotePort();
|
||||||
|
const char *pers = "esp32-tls";
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const char* ROOT_CAs;
|
static const char* ROOT_CAs;
|
||||||
|
|||||||
Reference in New Issue
Block a user