Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
chbruyand committed Jul 3, 2024
1 parent 2e4e15d commit 3b66414
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions pdns/dnsdistdist/test-dnsdisttcp_cc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ GlobalStateHolder<servers_t> g_dstates;
QueryCount g_qcount;

const bool TCPIOHandler::s_disableConnectForUnitTests = true;
dnsdist_tickets_key_added_hook TLSCtx::s_ticketsKeyAddedHook{nullptr};

bool checkDNSCryptQuery(const ClientState& cs, PacketBuffer& query, std::unique_ptr<DNSCryptQuery>& dnsCryptQuery, time_t now, bool tcp)
{
Expand Down
2 changes: 2 additions & 0 deletions pdns/libssl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,11 @@ std::string OpenSSLTLSTicketKey::content() const
{
std::string result{};
result.reserve(TLS_TICKETS_KEY_NAME_SIZE + TLS_TICKETS_CIPHER_KEY_SIZE + TLS_TICKETS_MAC_KEY_SIZE);
// NOLINTBEGIN(cppcoreguidelines-pro-type-reinterpret-cast)
result.append(reinterpret_cast<const char*>(d_name), TLS_TICKETS_KEY_NAME_SIZE);
result.append(reinterpret_cast<const char*>(d_cipherKey), TLS_TICKETS_CIPHER_KEY_SIZE);
result.append(reinterpret_cast<const char*>(d_hmacKey), TLS_TICKETS_MAC_KEY_SIZE);
// NOLINTEND(cppcoreguidelines-pro-type-reinterpret-cast)

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion pdns/libssl.hh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public:
#if OPENSSL_VERSION_MAJOR >= 3
int encrypt(unsigned char keyName[TLS_TICKETS_KEY_NAME_SIZE], unsigned char* iv, EVP_CIPHER_CTX* ectx, EVP_MAC_CTX* hctx) const;
bool decrypt(const unsigned char* iv, EVP_CIPHER_CTX* ectx, EVP_MAC_CTX* hctx) const;
std::string content() const;
[[nodiscard]] std::string content() const;
#else
int encrypt(unsigned char keyName[TLS_TICKETS_KEY_NAME_SIZE], unsigned char* iv, EVP_CIPHER_CTX* ectx, HMAC_CTX* hctx) const;
bool decrypt(const unsigned char* iv, EVP_CIPHER_CTX* ectx, HMAC_CTX* hctx) const;
Expand Down
3 changes: 2 additions & 1 deletion pdns/tcpiohandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -988,10 +988,11 @@ class GnuTLSTicketsKey
throw;
}
}
std::string content() const
[[nodiscard]] std::string content() const
{
std::string result{};
if (d_key.data != nullptr && d_key.size > 0) {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
result.append(reinterpret_cast<const char*>(d_key.data), d_key.size);
}
return result;
Expand Down

0 comments on commit 3b66414

Please sign in to comment.