-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make esp_mbedtls_server_session_create async compatible (IDFGH-13606) #14493
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -73,6 +73,8 @@ static const char *TAG = "esp-tls"; | |||||||||
#define _esp_tls_free_client_session esp_mbedtls_free_client_session | ||||||||||
#define _esp_tls_get_ssl_context esp_mbedtls_get_ssl_context | ||||||||||
#define _esp_tls_server_session_create esp_mbedtls_server_session_create | ||||||||||
#define _esp_tls_server_session_init esp_mbedtls_server_session_init | ||||||||||
#define _esp_tls_server_session_continue_async esp_mbedtls_server_session_continue_async | ||||||||||
#define _esp_tls_server_session_delete esp_mbedtls_server_session_delete | ||||||||||
#define _esp_tls_server_session_ticket_ctx_init esp_mbedtls_server_session_ticket_ctx_init | ||||||||||
#define _esp_tls_server_session_ticket_ctx_free esp_mbedtls_server_session_ticket_ctx_free | ||||||||||
|
@@ -90,6 +92,8 @@ static const char *TAG = "esp-tls"; | |||||||||
#define _esp_tls_conn_delete esp_wolfssl_conn_delete | ||||||||||
#define _esp_tls_net_init esp_wolfssl_net_init | ||||||||||
#define _esp_tls_server_session_create esp_wolfssl_server_session_create | ||||||||||
#define _esp_tls_server_session_init esp_wolfssl_server_session_init | ||||||||||
#define _esp_tls_server_session_continue_async esp_wolfssl_server_session_continue_async | ||||||||||
#define _esp_tls_server_session_delete esp_wolfssl_server_session_delete | ||||||||||
#define _esp_tls_get_bytes_avail esp_wolfssl_get_bytes_avail | ||||||||||
#define _esp_tls_init_global_ca_store esp_wolfssl_init_global_ca_store | ||||||||||
|
@@ -703,6 +707,22 @@ int esp_tls_server_session_create(esp_tls_cfg_server_t *cfg, int sockfd, esp_tls | |||||||||
{ | ||||||||||
return _esp_tls_server_session_create(cfg, sockfd, tls); | ||||||||||
} | ||||||||||
/** | ||||||||||
* @brief Initialization part of esp_tls_server_session_create | ||||||||||
*/ | ||||||||||
int esp_tls_server_session_init(esp_tls_cfg_server_t *cfg, int sockfd, esp_tls_t *tls) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding the new API. |
||||||||||
{ | ||||||||||
return _esp_tls_server_session_init(cfg, sockfd, tls); | ||||||||||
} | ||||||||||
/** | ||||||||||
* @brief Asynchronous continue of esp_tls_server_session_create, to be | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
* called in a loop by the user until it returns 0, | ||||||||||
* ESP_TLS_ERR_SSL_WANT_READ or ESP_TLS_ERR_SSL_WANT_WRITE | ||||||||||
*/ | ||||||||||
int esp_tls_server_session_continue_async(esp_tls_t *tls) | ||||||||||
{ | ||||||||||
return _esp_tls_server_session_continue_async(tls); | ||||||||||
} | ||||||||||
/** | ||||||||||
* @brief Close the server side TLS/SSL connection and free any allocated resources. | ||||||||||
*/ | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can keep them as
NULL
and then handle itesp_tls_server_session_init
down below by returning failure in the API that is calling this function when it isNULL
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the misunderstanding, but can you please clarify what your suggestion here is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant that the support for wolfSSL need not be added. Since I am not sure if you have tested the wolfSSL support yourself and we dont require wolfSSL support to be added so we can just mark the
_esp_tls_server_session_create
asNULL
.and in the
esp_tls_server_session_create
API where you use_esp_tls_server_session_create
you can just handle this case by doing something like