asio: Basic SSL/TLS support in asio port for ESP platform

This port employs IDF port of OpenSSL for most common features, others
are discouraged or not supported. The port also introduces several stubs
for OpenSSL functions which ASIO needs to get compiled and linked.

Upstream ASIO supports WolfSSL as SSL/TLS stack, as well, which is
another option for SSL support in ASIO on ESP platform.
This commit is contained in:
David Cermak
2020-06-05 16:17:01 +02:00
committed by bot
parent 085d2b8d25
commit 9459c0dd43
10 changed files with 292 additions and 11 deletions

View File

@@ -89,7 +89,7 @@ static void ssl_platform_debug(void *ctx, int level,
}
#endif
int mbedtls_ssl_send(void *ctx, const unsigned char *buf, size_t len )
static int mbedtls_bio_send(void *ctx, const unsigned char *buf, size_t len )
{
BIO *bio = ctx;
int written = BIO_write(bio, buf, len);
@@ -99,7 +99,7 @@ int mbedtls_ssl_send(void *ctx, const unsigned char *buf, size_t len )
return written;
}
static int mbedtls_ssl_recv(void *ctx, unsigned char *buf, size_t len )
static int mbedtls_bio_recv(void *ctx, unsigned char *buf, size_t len )
{
BIO *bio = ctx;
int read = BIO_read(bio, buf, len);
@@ -316,7 +316,7 @@ int ssl_pm_handshake(SSL *ssl)
struct ssl_pm *ssl_pm = (struct ssl_pm *)ssl->ssl_pm;
if (ssl->bio) {
mbedtls_ssl_set_bio(&ssl_pm->ssl, ssl->bio, mbedtls_ssl_send, mbedtls_ssl_recv, NULL);
mbedtls_ssl_set_bio(&ssl_pm->ssl, ssl->bio, mbedtls_bio_send, mbedtls_bio_recv, NULL);
}
ret = ssl_pm_reload_crt(ssl);