Remove salt assertion
This commit is contained in:
parent
d1d789bf20
commit
39b66b51d6
@ -40,14 +40,13 @@ class MTProto:
|
||||
return auth_key_id + msg_key + AES.ige256_encrypt(data + padding, aes_key, aes_iv)
|
||||
|
||||
@staticmethod
|
||||
def unpack(b: BytesIO, salt: int, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -> Message:
|
||||
def unpack(b: BytesIO, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -> Message:
|
||||
assert b.read(8) == auth_key_id, b.getvalue()
|
||||
|
||||
msg_key = b.read(16)
|
||||
aes_key, aes_iv = KDF(auth_key, msg_key, False)
|
||||
data = BytesIO(AES.ige256_decrypt(b.read(), aes_key, aes_iv))
|
||||
|
||||
assert data.read(8) == Long(salt) or Long(salt) == Long(MTProto.INITIAL_SALT)
|
||||
data.read(8)
|
||||
|
||||
# https://core.telegram.org/mtproto/security_guidelines#checking-session-id
|
||||
assert data.read(8) == session_id
|
||||
|
@ -219,7 +219,6 @@ class Session:
|
||||
try:
|
||||
data = MTProto.unpack(
|
||||
BytesIO(packet),
|
||||
self.current_salt.salt,
|
||||
self.session_id,
|
||||
self.auth_key,
|
||||
self.auth_key_id
|
||||
|
Loading…
Reference in New Issue
Block a user