Commit 5d354418 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Fix crash in SSL_CTX_set_tlsext_ticket_key_cb

It seems that returning 0 when enc == 0 crashes OpenSSL.
parent 5dce9501
...@@ -465,7 +465,6 @@ void renew_ticket_key_cb(struct ev_loop *loop, ev_timer *w, int revents) { ...@@ -465,7 +465,6 @@ void renew_ticket_key_cb(struct ev_loop *loop, ev_timer *w, int revents) {
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {
LOG(INFO) << "failed to renew ticket key"; LOG(INFO) << "failed to renew ticket key";
} }
mod_config()->ticket_keys.reset();
return; return;
} }
......
...@@ -160,8 +160,8 @@ int ticket_key_cb(SSL *ssl, unsigned char *key_name, unsigned char *iv, ...@@ -160,8 +160,8 @@ int ticket_key_cb(SSL *ssl, unsigned char *key_name, unsigned char *iv,
#endif // NOTHREADS #endif // NOTHREADS
if (!ticket_keys) { if (!ticket_keys) {
/* No ticket keys available. Perform full handshake */ // No ticket keys available.
return 0; return -1;
} }
auto &keys = ticket_keys->keys; auto &keys = ticket_keys->keys;
...@@ -172,7 +172,7 @@ int ticket_key_cb(SSL *ssl, unsigned char *key_name, unsigned char *iv, ...@@ -172,7 +172,7 @@ int ticket_key_cb(SSL *ssl, unsigned char *key_name, unsigned char *iv,
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {
CLOG(INFO, handler) << "session ticket key: RAND_bytes failed"; CLOG(INFO, handler) << "session ticket key: RAND_bytes failed";
} }
return 0; return -1;
} }
auto &key = keys[0]; auto &key = keys[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment