mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 20:00:53 +00:00
Implement server session ticket support with mbedtls
Closes https://github.com/espressif/esp-idf/pull/7048 Signed-off-by: Aditya Patwardhan <aditya.patwardhan@espressif.com>
This commit is contained in:

committed by
Aditya Patwardhan

parent
8f283421da
commit
7e886ca9ed
@@ -63,6 +63,9 @@ struct httpd_ssl_config {
|
||||
|
||||
/** Port used when transport mode is insecure (default 80) */
|
||||
uint16_t port_insecure;
|
||||
|
||||
/** Enable tls session tickets */
|
||||
bool session_tickets;
|
||||
};
|
||||
|
||||
typedef struct httpd_ssl_config httpd_ssl_config_t;
|
||||
@@ -109,6 +112,7 @@ typedef struct httpd_ssl_config httpd_ssl_config_t;
|
||||
.transport_mode = HTTPD_SSL_TRANSPORT_SECURE, \
|
||||
.port_secure = 443, \
|
||||
.port_insecure = 80, \
|
||||
.session_tickets = false, \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -145,6 +145,7 @@ static void free_secure_context(void *ctx)
|
||||
if (cfg->serverkey_buf) {
|
||||
free((void *)cfg->serverkey_buf);
|
||||
}
|
||||
esp_tls_cfg_server_session_tickets_free(cfg);
|
||||
free(cfg);
|
||||
free(ssl_ctx);
|
||||
}
|
||||
@@ -160,6 +161,16 @@ static httpd_ssl_ctx_t *create_secure_context(const struct httpd_ssl_config *con
|
||||
free(ssl_ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (config->session_tickets) {
|
||||
if ( esp_tls_cfg_server_session_tickets_init(cfg) != ESP_OK ) {
|
||||
ESP_LOGE(TAG, "Failed to init session ticket support");
|
||||
free(ssl_ctx);
|
||||
free(cfg);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ssl_ctx->tls_cfg = cfg;
|
||||
/* cacert = CA which signs client cert, or client cert itself , which is mapped to client_verify_cert_pem */
|
||||
if(config->client_verify_cert_pem != NULL) {
|
||||
|
Reference in New Issue
Block a user