2021-05-31 08:06:09 -04:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2019-09-07 06:54:54 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "esp_tls.h"
|
2022-04-19 22:39:13 -04:00
|
|
|
#include "esp_tls_private.h"
|
2019-09-07 06:54:54 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal Callback for creating ssl handle for wolfssl
|
|
|
|
*/
|
2023-09-05 05:04:04 -04:00
|
|
|
int esp_create_wolfssl_handle(const char *hostname, size_t hostlen, const void *cfg, esp_tls_t *tls, void *server_params);
|
2019-09-07 06:54:54 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal Callback for wolfssl_handshake
|
|
|
|
*/
|
|
|
|
int esp_wolfssl_handshake(esp_tls_t *tls, const esp_tls_cfg_t *cfg);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal Callback API for wolfssl_ssl_read
|
|
|
|
*/
|
|
|
|
ssize_t esp_wolfssl_read(esp_tls_t *tls, char *data, size_t datalen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal callback API for wolfssl_ssl_write
|
|
|
|
*/
|
|
|
|
ssize_t esp_wolfssl_write(esp_tls_t *tls, const char *data, size_t datalen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal Callback for wolfssl_cleanup , frees up all the memory used by wolfssl
|
|
|
|
*/
|
|
|
|
void esp_wolfssl_cleanup(esp_tls_t *tls);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal Callback for Certificate verification for wolfssl
|
|
|
|
*/
|
|
|
|
void esp_wolfssl_verify_certificate(esp_tls_t *tls);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal Callback for deleting the wolfssl connection
|
|
|
|
*/
|
|
|
|
void esp_wolfssl_conn_delete(esp_tls_t *tls);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal Callback for wolfssl_get_bytes_avail
|
|
|
|
*/
|
|
|
|
ssize_t esp_wolfssl_get_bytes_avail(esp_tls_t *tls);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback function for setting global CA store data for TLS/SSL using wolfssl
|
|
|
|
*/
|
|
|
|
esp_err_t esp_wolfssl_set_global_ca_store(const unsigned char *cacert_pem_buf, const unsigned int cacert_pem_bytes);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback function for freeing global ca store for TLS/SSL using wolfssl
|
|
|
|
*/
|
|
|
|
void esp_wolfssl_free_global_ca_store(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Callback function for Initializing the global ca store for TLS?SSL using wolfssl
|
|
|
|
*/
|
|
|
|
esp_err_t esp_wolfssl_init_global_ca_store(void);
|
2020-01-17 04:27:08 -05:00
|
|
|
|
2022-04-20 02:00:56 -04:00
|
|
|
/**
|
|
|
|
* Return ssl context for wolfSSL stack
|
|
|
|
*/
|
|
|
|
void *esp_wolfssl_get_ssl_context(esp_tls_t *tls);
|
|
|
|
|
2021-02-10 07:25:09 -05:00
|
|
|
/**
|
|
|
|
* wolfSSL function for Initializing socket wrappers (no-operation for wolfSSL)
|
|
|
|
*/
|
|
|
|
static inline void esp_wolfssl_net_init(esp_tls_t *tls)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-01-17 04:27:08 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to Create ESP-TLS Server session with wolfssl Stack
|
|
|
|
*/
|
|
|
|
int esp_wolfssl_server_session_create(esp_tls_cfg_server_t *cfg, int sockfd, esp_tls_t *tls);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Delete Server Session
|
|
|
|
*/
|
|
|
|
void esp_wolfssl_server_session_delete(esp_tls_t *tls);
|