diff --git a/implementations/caching/cache/Cache.h b/implementations/caching/cache/Cache.h index ea1c0815..1f0e3f0c 100644 --- a/implementations/caching/cache/Cache.h +++ b/implementations/caching/cache/Cache.h @@ -79,7 +79,6 @@ boost::optional Cache::pop(const Key &key) { template void Cache::push(const Key &key, Value value) { std::unique_lock lock(_mutex); - //std::cout << "Pushing " << key.ToString() << "\n"; ASSERT(_cachedBlocks.size() <= MAX_ENTRIES, "Cache too full"); _makeSpaceForEntry(&lock); _cachedBlocks.push(key, CacheEntry(std::move(value))); diff --git a/implementations/encrypted/EncryptedBlock.h b/implementations/encrypted/EncryptedBlock.h index 0e60ad3d..a678f9d8 100644 --- a/implementations/encrypted/EncryptedBlock.h +++ b/implementations/encrypted/EncryptedBlock.h @@ -13,6 +13,7 @@ #include "ciphers/Cipher.h" #include #include +#include namespace blockstore { namespace encrypted { @@ -79,14 +80,12 @@ boost::optional>> EncryptedBlock plaintextWithHeader = Cipher::decrypt((byte*)baseBlock->data(), baseBlock->size(), encKey); if(plaintextWithHeader == boost::none) { //Decryption failed (e.g. an authenticated cipher detected modifications to the ciphertext) - //TODO Think about logging - std::cerr << "Decrypting block " << baseBlock->key().ToString() << " failed. Was the block modified by an attacker?" << std::endl; + cpputils::logging::LOG(cpputils::logging::WARN) << "Decrypting block " << baseBlock->key().ToString() << " failed. Was the block modified by an attacker?"; return boost::none; } if(!_keyHeaderIsCorrect(baseBlock->key(), *plaintextWithHeader)) { //The stored key in the block data is incorrect - an attacker might have exchanged the contents with the encrypted data from a different block - //TODO Think about logging - std::cerr << "Decrypting block " << baseBlock->key().ToString() << " failed due to invalid block key. Was the block modified by an attacker?" << std::endl; + cpputils::logging::LOG(cpputils::logging::WARN) << "Decrypting block " << baseBlock->key().ToString() << " failed due to invalid block key. Was the block modified by an attacker?"; return boost::none; } return cpputils::make_unique_ref>(std::move(baseBlock), encKey, std::move(*plaintextWithHeader));