Browse Source

update headers, docs, remove unused length argument from fixed-length read

cl-refactor
subtly 10 years ago
parent
commit
fada98b8d9
  1. 10
      libdevcrypto/Common.h
  2. 10
      libdevcrypto/CryptoPP.h
  3. 4
      libp2p/RLPxHandshake.cpp
  4. 1
      libp2p/RLPxHandshake.h
  5. 3
      libp2p/Session.h

10
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.

10
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.

4
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);

1
libp2p/RLPxHandshake.h

@ -25,7 +25,6 @@
#include <memory>
#include <libdevcrypto/Common.h>
#include <libdevcrypto/ECDHE.h>
#include <libdevcrypto/CryptoPP.h>
#include "RLPxFrameIO.h"
#include "Common.h"
namespace ba = boost::asio;

3
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);

Loading…
Cancel
Save