Skip to content
Closed
Prev Previous commit
Next Next commit
src: remove obsolete LogSecret function
Nothing was using it.
  • Loading branch information
jasnell committed Jan 2, 2025
commit 524e18805d158a1c68eaf120246a7dd80b406362
23 changes: 0 additions & 23 deletions src/crypto/crypto_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,6 @@ using v8::Undefined;
using v8::Value;

namespace crypto {
void LogSecret(
const SSLPointer& ssl,
const char* name,
const unsigned char* secret,
size_t secretlen) {
auto keylog_cb = SSL_CTX_get_keylog_callback(SSL_get_SSL_CTX(ssl.get()));
// All supported versions of TLS/SSL fix the client random to the same size.
constexpr size_t kTlsClientRandomSize = SSL3_RANDOM_SIZE;
unsigned char crandom[kTlsClientRandomSize];

if (keylog_cb == nullptr ||
SSL_get_client_random(ssl.get(), crandom, kTlsClientRandomSize) !=
kTlsClientRandomSize) {
return;
}

std::string line = name;
line += " " + nbytes::HexEncode(reinterpret_cast<const char*>(crandom),
kTlsClientRandomSize);
line +=
" " + nbytes::HexEncode(reinterpret_cast<const char*>(secret), secretlen);
keylog_cb(ssl.get(), line.c_str());
}

MaybeLocal<Value> GetSSLOCSPResponse(
Environment* env,
Expand Down
6 changes: 0 additions & 6 deletions src/crypto/crypto_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ struct StackOfX509Deleter {
};
using StackOfX509 = std::unique_ptr<STACK_OF(X509), StackOfX509Deleter>;

void LogSecret(
const SSLPointer& ssl,
const char* name,
const unsigned char* secret,
size_t secretlen);

v8::MaybeLocal<v8::Value> GetSSLOCSPResponse(
Environment* env,
SSL* ssl,
Expand Down