From fada98b8d967d0739b7f39709ff6440ce5eb9d8c Mon Sep 17 00:00:00 2001 From: subtly Date: Sat, 7 Mar 2015 22:40:15 +0100 Subject: [PATCH] update headers, docs, remove unused length argument from fixed-length read --- libdevcrypto/Common.h | 10 +++++----- libdevcrypto/CryptoPP.h | 10 +++++----- libp2p/RLPxHandshake.cpp | 4 ++-- libp2p/RLPxHandshake.h | 1 - libp2p/Session.h | 3 +-- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/libdevcrypto/Common.h b/libdevcrypto/Common.h index 1bc16fa93..38e5649fb 100644 --- a/libdevcrypto/Common.h +++ b/libdevcrypto/Common.h @@ -96,19 +96,19 @@ void encryptSym(Secret const& _k, bytesConstRef _plain, bytes& o_cipher); /// Symmetric decryption. bool decryptSym(Secret const& _k, bytesConstRef _cipher, bytes& o_plaintext); -/// Encrypt payload using ECIES standard with AES-CTR. TODO: move into class. +/// Encrypt payload using ECIES standard with AES128-CTR. void encryptECIES(Public const& _k, bytesConstRef _plain, bytes& o_cipher); -/// Decrypt payload using ECIES standard with AES-CTR. TODO: move into class. +/// Decrypt payload using ECIES standard with AES128-CTR. bool decryptECIES(Secret const& _k, bytesConstRef _cipher, bytes& o_plaintext); -/// Encrypts payload with random IV using AES-CTR. TODO: prefix IV. +/// Encrypts payload with random IV/ctr using AES128-CTR. h128 encryptSymNoAuth(Secret const& _k, bytesConstRef _plain, bytes& o_cipher); -/// Encrypts payload with specified IV using AES-CTR TODO: prefix IV. +/// Encrypts payload with specified IV/ctr using AES128-CTR. h128 encryptSymNoAuth(Secret const& _k, bytesConstRef _plain, bytes& o_cipher, h128 const& _iv); -/// Decrypts payload with specified IV TODO: prefix IV. +/// Decrypts payload with specified IV/ctr. bool decryptSymNoAuth(Secret const& _k, h128 const& _iv, bytesConstRef _cipher, bytes& o_plaintext); /// Recovers Public key from signed message hash. diff --git a/libdevcrypto/CryptoPP.h b/libdevcrypto/CryptoPP.h index e0f5f16ba..b673c44a6 100644 --- a/libdevcrypto/CryptoPP.h +++ b/libdevcrypto/CryptoPP.h @@ -76,19 +76,19 @@ public: void toPublic(Secret const& _s, Public& o_public) { exponentToPublic(Integer(_s.data(), sizeof(_s)), o_public); } - /// Encrypts text (replace input). + /// Encrypts text (replace input). (ECIES w/XOR) void encrypt(Public const& _k, bytes& io_cipher); - /// Decrypts text (replace input). + /// Decrypts text (replace input). (ECIES w/XOR) void decrypt(Secret const& _k, bytes& io_text); - /// Temporary; to replace encrypt once interop w/go is passing. + /// Encrypts text (replace input). (ECIES w/AES128-CTR) void encryptECIES(Public const& _k, bytes& io_cipher); - /// Temporary; to replace decrypt once interop w/go is passing. + /// Decrypts text (replace input). (ECIES w/AES128-CTR) bool decryptECIES(Secret const& _k, bytes& io_text); - /// Key derivation function used by ECIES. + /// Key derivation function used by encryptECIES and decryptECIES. bytes eciesKDF(Secret _z, bytes _s1, unsigned kdBitLen = 256); /// @returns siganture of message. diff --git a/libp2p/RLPxHandshake.cpp b/libp2p/RLPxHandshake.cpp index 801848107..fa346ec09 100644 --- a/libp2p/RLPxHandshake.cpp +++ b/libp2p/RLPxHandshake.cpp @@ -195,7 +195,7 @@ void RLPXHandshake::transition(boost::system::error_code _ech) // read frame header m_handshakeInBuffer.resize(h256::size); - ba::async_read(m_socket->ref(), boost::asio::buffer(m_handshakeInBuffer, h256::size), [this, self](boost::system::error_code ec, std::size_t length) + ba::async_read(m_socket->ref(), boost::asio::buffer(m_handshakeInBuffer, h256::size), [this, self](boost::system::error_code ec, std::size_t) { if (ec) transition(ec); @@ -229,7 +229,7 @@ void RLPXHandshake::transition(boost::system::error_code _ech) /// read padded frame and mac m_handshakeInBuffer.resize(frameSize + ((16 - (frameSize % 16)) % 16) + h128::size); - ba::async_read(m_socket->ref(), boost::asio::buffer(m_handshakeInBuffer, m_handshakeInBuffer.size()), [this, self, headerRLP](boost::system::error_code ec, std::size_t length) + ba::async_read(m_socket->ref(), boost::asio::buffer(m_handshakeInBuffer, m_handshakeInBuffer.size()), [this, self, headerRLP](boost::system::error_code ec, std::size_t) { if (ec) transition(ec); diff --git a/libp2p/RLPxHandshake.h b/libp2p/RLPxHandshake.h index 7ea95173f..8459de053 100644 --- a/libp2p/RLPxHandshake.h +++ b/libp2p/RLPxHandshake.h @@ -25,7 +25,6 @@ #include #include #include -#include #include "RLPxFrameIO.h" #include "Common.h" namespace ba = boost::asio; diff --git a/libp2p/Session.h b/libp2p/Session.h index 77b7de7bb..51db5adc3 100644 --- a/libp2p/Session.h +++ b/libp2p/Session.h @@ -85,8 +85,7 @@ public: private: void send(bytes&& _msg); -// void send(bytesConstRef _msg); - + /// Drop the connection for the reason @a _r. void drop(DisconnectReason _r);