From: Fred Morcos Date: Mon, 9 Jan 2023 11:33:34 +0000 (+0100) Subject: libssl: Cleanup TLS-related code X-Git-Tag: dnsdist-1.8.0-rc1~116^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3d5d20542ab3cbd73528209dda6d600bc2df2d8;p=thirdparty%2Fpdns.git libssl: Cleanup TLS-related code --- diff --git a/pdns/libssl.cc b/pdns/libssl.cc index 98ce9f2331..3b9e80ba0e 100644 --- a/pdns/libssl.cc +++ b/pdns/libssl.cc @@ -216,7 +216,7 @@ void libssl_set_ticket_key_callback_data(SSL_CTX* ctx, void* data) int libssl_ticket_key_callback(SSL* s, OpenSSLTLSTicketKeysRing& keyring, unsigned char keyName[TLS_TICKETS_KEY_NAME_SIZE], unsigned char* iv, EVP_CIPHER_CTX* ectx, HMAC_CTX* hctx, int enc) { - if (enc) { + if (enc != 0) { const auto key = keyring.getEncryptionKey(); if (key == nullptr) { return -1; @@ -233,7 +233,7 @@ int libssl_ticket_key_callback(SSL* s, OpenSSLTLSTicketKeysRing& keyring, unsign return 0; } - if (key->decrypt(iv, ectx, hctx) == false) { + if (!key->decrypt(iv, ectx, hctx)) { return -1; } diff --git a/pdns/tcpiohandler.cc b/pdns/tcpiohandler.cc index 5a80df911d..aaa25ab5f4 100644 --- a/pdns/tcpiohandler.cc +++ b/pdns/tcpiohandler.cc @@ -706,7 +706,7 @@ public: static int ticketKeyCb(SSL* s, unsigned char keyName[TLS_TICKETS_KEY_NAME_SIZE], unsigned char* iv, EVP_CIPHER_CTX* ectx, HMAC_CTX* hctx, int enc) { - OpenSSLFrontendContext* ctx = reinterpret_cast(libssl_get_ticket_key_callback_data(s)); + auto* ctx = reinterpret_cast(libssl_get_ticket_key_callback_data(s)); if (ctx == nullptr) { return -1; } @@ -714,8 +714,8 @@ public: int ret = libssl_ticket_key_callback(s, ctx->d_ticketKeys, keyName, iv, ectx, hctx, enc); if (enc == 0) { if (ret == 0 || ret == 2) { - OpenSSLTLSConnection* conn = reinterpret_cast(SSL_get_ex_data(s, OpenSSLTLSConnection::s_tlsConnIndex)); - if (conn) { + auto* conn = reinterpret_cast(SSL_get_ex_data(s, OpenSSLTLSConnection::s_tlsConnIndex)); + if (conn != nullptr) { if (ret == 0) { conn->setUnknownTicketKey(); }