diff --git a/src/protocol/PacketDecoder.cpp b/src/protocol/PacketDecoder.cpp index d5b31a6..d4e8d7a 100644 --- a/src/protocol/PacketDecoder.cpp +++ b/src/protocol/PacketDecoder.cpp @@ -197,14 +197,13 @@ PacketProcessResult PacketDecoder::decrypt_incoming_packet(std::string& error, P return PacketProcessResult::SUCCESS; } -bool PacketDecoder::verify_encryption_client_packet(const pipes::buffer_view &buffer) { - ClientPacketParser packet_parser{buffer}; - if(!packet_parser.valid() || !packet_parser.is_encrypted()) { +bool PacketDecoder::verify_encryption_client_packet(const protocol::ClientPacketParser& packet_parser) { + if(!packet_parser.is_encrypted()) { return false; } assert(packet_parser.type() >= 0 && packet_parser.type() < this->incoming_generation_estimators.size()); - return this->crypt_handler_->verify_encryption(buffer, packet_parser.packet_id(), this->incoming_generation_estimators[packet_parser.type()].generation()); + return this->crypt_handler_->verify_encryption(packet_parser.buffer(), packet_parser.packet_id(), this->incoming_generation_estimators[packet_parser.type()].generation()); } void PacketDecoder::register_initiv_packet() { diff --git a/src/protocol/PacketDecoder.h b/src/protocol/PacketDecoder.h index 96870be..41e6f9b 100644 --- a/src/protocol/PacketDecoder.h +++ b/src/protocol/PacketDecoder.h @@ -62,7 +62,7 @@ namespace ts::protocol { void reset(); - bool verify_encryption_client_packet(const pipes::buffer_view& /* full packet */); + bool verify_encryption_client_packet(const protocol::ClientPacketParser& /* packet */); /* true if commands might be pending */ PacketProcessResult process_incoming_data(protocol::PacketParser &/* packet */, std::string& /* error detail */);