Welcome! Log In Create A New Profile

Advanced

[PATCH 09 of 11] SSL: renamed session ticket key functions and data index

Maxim Dounin
August 25, 2022 11:14PM
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1661481955 -10800
# Fri Aug 26 05:45:55 2022 +0300
# Node ID 97158a99745be75aeea01d8d1b8cd8666faab2b2
# Parent 92c96bf72bc64b49bf8825a8c1d6159af4cb3d32
SSL: renamed session ticket key functions and data index.

Previously used names are way too long, renamed to simplify writing code.

diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -71,10 +71,10 @@ static void ngx_ssl_session_rbtree_inser
ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel);

#ifdef SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB
-static int ngx_ssl_session_ticket_key_callback(ngx_ssl_conn_t *ssl_conn,
+static int ngx_ssl_ticket_key_callback(ngx_ssl_conn_t *ssl_conn,
unsigned char *name, unsigned char *iv, EVP_CIPHER_CTX *ectx,
HMAC_CTX *hctx, int enc);
-static void ngx_ssl_session_ticket_keys_cleanup(void *data);
+static void ngx_ssl_ticket_keys_cleanup(void *data);
#endif

#ifndef X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT
@@ -131,7 +131,7 @@ ngx_module_t ngx_openssl_module = {
int ngx_ssl_connection_index;
int ngx_ssl_server_conf_index;
int ngx_ssl_session_cache_index;
-int ngx_ssl_session_ticket_keys_index;
+int ngx_ssl_ticket_keys_index;
int ngx_ssl_ocsp_index;
int ngx_ssl_certificate_index;
int ngx_ssl_next_certificate_index;
@@ -208,9 +208,9 @@ ngx_ssl_init(ngx_log_t *log)
return NGX_ERROR;
}

- ngx_ssl_session_ticket_keys_index = SSL_CTX_get_ex_new_index(0, NULL, NULL,
- NULL, NULL);
- if (ngx_ssl_session_ticket_keys_index == -1) {
+ ngx_ssl_ticket_keys_index = SSL_CTX_get_ex_new_index(0, NULL, NULL, NULL,
+ NULL);
+ if (ngx_ssl_ticket_keys_index == -1) {
ngx_ssl_error(NGX_LOG_ALERT, log, 0,
"SSL_CTX_get_ex_new_index() failed");
return NGX_ERROR;
@@ -4249,7 +4249,7 @@ ngx_ssl_session_ticket_keys(ngx_conf_t *
return NGX_ERROR;
}

- cln->handler = ngx_ssl_session_ticket_keys_cleanup;
+ cln->handler = ngx_ssl_ticket_keys_cleanup;
cln->data = keys;

path = paths->elts;
@@ -4327,16 +4327,13 @@ ngx_ssl_session_ticket_keys(ngx_conf_t *
ngx_explicit_memzero(&buf, 80);
}

- if (SSL_CTX_set_ex_data(ssl->ctx, ngx_ssl_session_ticket_keys_index, keys)
- == 0)
- {
+ if (SSL_CTX_set_ex_data(ssl->ctx, ngx_ssl_ticket_keys_index, keys) == 0) {
ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
"SSL_CTX_set_ex_data() failed");
return NGX_ERROR;
}

- if (SSL_CTX_set_tlsext_ticket_key_cb(ssl->ctx,
- ngx_ssl_session_ticket_key_callback)
+ if (SSL_CTX_set_tlsext_ticket_key_cb(ssl->ctx, ngx_ssl_ticket_key_callback)
== 0)
{
ngx_log_error(NGX_LOG_WARN, cf->log, 0,
@@ -4362,7 +4359,7 @@ failed:


static int
-ngx_ssl_session_ticket_key_callback(ngx_ssl_conn_t *ssl_conn,
+ngx_ssl_ticket_key_callback(ngx_ssl_conn_t *ssl_conn,
unsigned char *name, unsigned char *iv, EVP_CIPHER_CTX *ectx,
HMAC_CTX *hctx, int enc)
{
@@ -4384,7 +4381,7 @@ ngx_ssl_session_ticket_key_callback(ngx_
digest = EVP_sha256();
#endif

- keys = SSL_CTX_get_ex_data(ssl_ctx, ngx_ssl_session_ticket_keys_index);
+ keys = SSL_CTX_get_ex_data(ssl_ctx, ngx_ssl_ticket_keys_index);
if (keys == NULL) {
return -1;
}
@@ -4497,7 +4494,7 @@ ngx_ssl_session_ticket_key_callback(ngx_


static void
-ngx_ssl_session_ticket_keys_cleanup(void *data)
+ngx_ssl_ticket_keys_cleanup(void *data)
{
ngx_array_t *keys = data;

diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h
--- a/src/event/ngx_event_openssl.h
+++ b/src/event/ngx_event_openssl.h
@@ -317,7 +317,7 @@ void ngx_ssl_cleanup_ctx(void *data);
extern int ngx_ssl_connection_index;
extern int ngx_ssl_server_conf_index;
extern int ngx_ssl_session_cache_index;
-extern int ngx_ssl_session_ticket_keys_index;
+extern int ngx_ssl_ticket_keys_index;
extern int ngx_ssl_ocsp_index;
extern int ngx_ssl_certificate_index;
extern int ngx_ssl_next_certificate_index;

_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

[PATCH 09 of 11] SSL: renamed session ticket key functions and data index

Maxim Dounin 237 August 25, 2022 11:14PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 103
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready