Skip to content

Commit

Permalink
some improvements
Browse files Browse the repository at this point in the history
fixed build of test of sslkeylogfile
updated some function description
reverted default value of Policy::allow_ssl_key_log_file to false
  • Loading branch information
Alexey Volokitin committed May 23, 2024
1 parent c284815 commit 87589eb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/examples/tls_ssl_key_log_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ class BotanTLSCallbacksProxy : public Botan::TLS::Callbacks {
void tls_alert(Botan::TLS::Alert alert) override { BOTAN_UNUSED(alert); }

void tls_ssl_key_log_data(std::string_view label,
const std::span<const uint8_t>& client_random,
const std::span<const uint8_t>& secret) const override {
std::span<const uint8_t> client_random,
std::span<const uint8_t> secret) const override {
parent.tls_ssl_key_log_data(label, client_random, secret);
}

Expand Down Expand Up @@ -182,8 +182,8 @@ class DtlsConnection : public Botan::TLS::Callbacks {
}

void tls_ssl_key_log_data(std::string_view label,
const std::span<const uint8_t>& client_random,
const std::span<const uint8_t>& secret) const override {
std::span<const uint8_t> client_random,
std::span<const uint8_t> secret) const override {
std::ofstream stream;
stream.open("test.skl", std::ofstream::out | std::ofstream::app);
stream << label << " " << Botan::hex_encode(client_random.data(), client_random.size()) << " "
Expand Down
2 changes: 2 additions & 0 deletions src/lib/tls/tls_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ class BOTAN_PUBLIC_API(2, 0) Callbacks {
*
* Useful to implement the SSLKEYLOGFILE for connection debugging as
* specified in ietf.org/archive/id/draft-thomson-tls-keylogfile-00.html
*
* Invoked if Policy::allow_ssl_key_log_file returns true.
*
* Default implementation simply ignores the inputs.
*
Expand Down
3 changes: 1 addition & 2 deletions src/lib/tls/tls_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
namespace Botan::TLS {

bool Policy::allow_ssl_key_log_file() const {
std::string data;
return Botan::OS::read_env_variable(data, "SSLKEYLOGFILE");
return false;
}

std::vector<Signature_Scheme> Policy::allowed_signature_schemes() const {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/tls/tls_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class BOTAN_PUBLIC_API(2, 0) Policy {
public:
/**
* Allow ssl key log file
* @note If function returns true, then Callbacks::tls_ssl_key_log_data
* will be invoked containing secret information for logging purposes
*/
virtual bool allow_ssl_key_log_file() const;

Expand Down

0 comments on commit 87589eb

Please sign in to comment.