aboutsummaryrefslogtreecommitdiff
path: root/src/session.cpp
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-05-16 11:13:54 +0100
committerRichard van der Hoff <richard@matrix.org>2016-05-16 11:13:54 +0100
commit3965320a9ce2a41a96b962e8f5bf396f328d1aad (patch)
tree642cb4c5e5ec0c7428b1801888cb11828dbc1a20 /src/session.cpp
parentb3db0e6ee14315d20ca91eff91e348e18dd119e6 (diff)
Remove logging functionality
Concerns have been raised that including logging functionality makes it harder to audit the implementation to ensure that no secret information is leaked. We are therefore removing it from the master branch.
Diffstat (limited to 'src/session.cpp')
-rw-r--r--src/session.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/session.cpp b/src/session.cpp
index 816dd26..86ba63b 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -16,7 +16,6 @@
#include "olm/cipher.hh"
#include "olm/crypto.hh"
#include "olm/account.hh"
-#include "olm/logging.h"
#include "olm/memory.hh"
#include "olm/message.hh"
#include "olm/pickle.hh"
@@ -25,8 +24,6 @@
namespace {
-static const char *LOG_CATEGORY = "olm::Session";
-
static const std::uint8_t PROTOCOL_VERSION = 0x3;
static const std::uint8_t ROOT_KDF_INFO[] = "OLM_ROOT";
@@ -68,21 +65,11 @@ std::size_t olm::Session::new_outbound_session(
return std::size_t(-1);
}
- olm_logf(OLM_LOG_DEBUG, LOG_CATEGORY,
- "Creating new outbound session to receiver identity IB %s, "
- "receiver ephemeral EB %s", identity_key.to_string().c_str(),
- one_time_key.to_string().c_str()
- );
-
olm::Curve25519KeyPair base_key;
olm::curve25519_generate_key(random, base_key);
- olm_logf(OLM_LOG_DEBUG, LOG_CATEGORY, "Created new ephemeral key EA %s",
- base_key.to_string().c_str());
olm::Curve25519KeyPair ratchet_key;
olm::curve25519_generate_key(random + olm::KEY_LENGTH, ratchet_key);
- olm_logf(OLM_LOG_DEBUG, LOG_CATEGORY, "Created new ratchet key T(0) %s",
- ratchet_key.to_string().c_str());
olm::Curve25519KeyPair const & alice_identity_key_pair = (
local_account.identity_keys.curve25519_key
@@ -108,7 +95,6 @@ std::size_t olm::Session::new_outbound_session(
olm::unset(ratchet_key);
olm::unset(secret);
- olm_logf(OLM_LOG_DEBUG, LOG_CATEGORY, "Initialised outbound session");
return std::size_t(0);
}
@@ -151,13 +137,6 @@ std::size_t olm::Session::new_inbound_session(
their_identity_key->public_key, reader.identity_key, olm::KEY_LENGTH
);
if (!same) {
- olm_logf(OLM_LOG_INFO, LOG_CATEGORY,
- "Identity key on received message is incorrect "
- "(expected %s, got %s)",
- their_identity_key->to_string().c_str(),
- olm::bytes_to_string(reader.identity_key,
- reader.identity_key + olm::KEY_LENGTH)
- .c_str());
last_error = olm::ErrorCode::BAD_MESSAGE_KEY_ID;
return std::size_t(-1);
}
@@ -167,13 +146,6 @@ std::size_t olm::Session::new_inbound_session(
olm::load_array(alice_base_key.public_key, reader.base_key);
olm::load_array(bob_one_time_key.public_key, reader.one_time_key);
- olm_logf(OLM_LOG_DEBUG, LOG_CATEGORY,
- "Creating new inbound session from sender identity IA %s, "
- "sender ephemeral EA %s, our ephemeral EB %s",
- alice_identity_key.to_string().c_str(),
- alice_base_key.to_string().c_str(),
- bob_one_time_key.to_string().c_str());
-
olm::MessageReader message_reader;
decode_message(
message_reader, reader.message, reader.message_length,
@@ -189,17 +161,11 @@ std::size_t olm::Session::new_inbound_session(
olm::Curve25519PublicKey ratchet_key;
olm::load_array(ratchet_key.public_key, message_reader.ratchet_key);
- olm_logf(OLM_LOG_DEBUG, LOG_CATEGORY,
- "Received ratchet key T(0) %s", ratchet_key.to_string().c_str());
-
olm::OneTimeKey const * our_one_time_key = local_account.lookup_key(
bob_one_time_key
);
if (!our_one_time_key) {
- olm_logf(OLM_LOG_INFO, LOG_CATEGORY,
- "Session uses unknown ephemeral key %s",
- bob_one_time_key.to_string().c_str());
last_error = olm::ErrorCode::BAD_MESSAGE_KEY_ID;
return std::size_t(-1);
}
@@ -221,7 +187,6 @@ std::size_t olm::Session::new_inbound_session(
olm::unset(secret);
- olm_logf(OLM_LOG_DEBUG, LOG_CATEGORY, "Initialised inbound session");
return std::size_t(0);
}
@@ -320,9 +285,6 @@ std::size_t olm::Session::encrypt(
std::uint8_t const * random, std::size_t random_length,
std::uint8_t * message, std::size_t message_length
) {
- olm_logf(OLM_LOG_DEBUG, LOG_CATEGORY, "Encrypting '%.*s'",
- (int)plaintext_length, plaintext);
-
if (message_length < encrypt_message_length(plaintext_length)) {
last_error = olm::ErrorCode::OUTPUT_BUFFER_TOO_SMALL;
return std::size_t(-1);
@@ -349,16 +311,6 @@ std::size_t olm::Session::encrypt(
olm::store_array(writer.identity_key, alice_identity_key.public_key);
olm::store_array(writer.base_key, alice_base_key.public_key);
message_body = writer.message;
-
-
- olm_logf(OLM_LOG_DEBUG, LOG_CATEGORY,
- "Encoded pre-key message ver=%i one_time_key[Eb]=%s "
- "base_key[Ea]=%s identity_key[Ia]=%s",
- PROTOCOL_VERSION,
- olm::bytes_to_string(writer.one_time_key, olm::KEY_LENGTH).c_str(),
- olm::bytes_to_string(writer.base_key, olm::KEY_LENGTH).c_str(),
- olm::bytes_to_string(writer.identity_key, olm::KEY_LENGTH).c_str()
- );
}
std::size_t result = ratchet.encrypt(
@@ -373,9 +325,6 @@ std::size_t olm::Session::encrypt(
return result;
}
- olm_logf(OLM_LOG_TRACE, LOG_CATEGORY, "Encrypted message %s",
- olm::bytes_to_string(message_body, result).c_str());
-
return result;
}
@@ -417,9 +366,6 @@ std::size_t olm::Session::decrypt(
std::uint8_t const * message, std::size_t message_length,
std::uint8_t * plaintext, std::size_t max_plaintext_length
) {
- olm_logf(OLM_LOG_TRACE, LOG_CATEGORY, "Decrypting %smessage",
- message_type == olm::MessageType::MESSAGE ? "" : "pre-key ");
-
std::uint8_t const * message_body;
std::size_t message_body_length;
if (message_type == olm::MessageType::MESSAGE) {
@@ -447,8 +393,6 @@ std::size_t olm::Session::decrypt(
}
received_message = true;
- olm_logf(OLM_LOG_DEBUG, LOG_CATEGORY, "Decrypted '%.*s'",
- (int)result, plaintext);
return result;
}