Simplify removing packet padding.
This commit is contained in:
parent
63fd974e35
commit
1554044a84
@ -227,11 +227,7 @@ Status Transport::read_crypto_impl(int X, MutableSlice message, const AuthKey &a
|
||||
auto *header = reinterpret_cast<HeaderT *>(message.begin());
|
||||
*header_ptr = header;
|
||||
auto to_decrypt = MutableSlice(header->encrypt_begin(), message.uend());
|
||||
to_decrypt.truncate(to_decrypt.size() & ~15);
|
||||
if (to_decrypt.size() % 16 != 0) {
|
||||
return Status::Error(PSLICE() << "Invalid mtproto message: size of encrypted part is not multiple of 16 [size = "
|
||||
<< to_decrypt.size() << "]");
|
||||
}
|
||||
to_decrypt.remove_suffix(to_decrypt.size() & 15);
|
||||
|
||||
if (header->auth_key_id != auth_key.id()) {
|
||||
return Status::Error(PSLICE() << "Invalid mtproto message: auth_key_id mismatch [found = "
|
||||
|
Loading…
Reference in New Issue
Block a user