mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 21:34:02 +03:00
Remove frame pool for obfuscated2 frames
This commit is contained in:
@@ -18,7 +18,7 @@ func TestObfs2TelegramFrameDecrypt(t *testing.T) {
|
||||
decryptor := makeStreamCipher(frame.Key(), frame.IV())
|
||||
|
||||
decrypted := make(Frame, FrameLen)
|
||||
decryptor.XORKeyStream(decrypted, *frame)
|
||||
decryptor.XORKeyStream(decrypted, frame)
|
||||
|
||||
_, err := decrypted.ConnectionType()
|
||||
assert.Nil(t, err)
|
||||
@@ -53,8 +53,8 @@ func TestObfs2Full(t *testing.T) {
|
||||
|
||||
encryptor := makeStreamCipher(clientKey, clientFrame.IV())
|
||||
encrypted := make(Frame, FrameLen)
|
||||
encryptor.XORKeyStream(encrypted, *clientFrame)
|
||||
copy(encrypted[:56], (*clientFrame)[:56])
|
||||
encryptor.XORKeyStream(encrypted, clientFrame)
|
||||
copy(encrypted[:56], clientFrame[:56])
|
||||
|
||||
invertedClientFrame := clientFrame.Invert()
|
||||
clientHasher = sha256.New()
|
||||
@@ -63,7 +63,7 @@ func TestObfs2Full(t *testing.T) {
|
||||
invertedClientKey := clientHasher.Sum(nil)
|
||||
clientDecryptor := makeStreamCipher(invertedClientKey, invertedClientFrame.IV())
|
||||
|
||||
clientObfs, _, err := ParseObfuscated2ClientFrame(secret, &encrypted)
|
||||
clientObfs, _, err := ParseObfuscated2ClientFrame(secret, encrypted)
|
||||
assert.Nil(t, err)
|
||||
|
||||
connOpts := &mtproto.ConnectionOpts{
|
||||
@@ -73,7 +73,7 @@ func TestObfs2Full(t *testing.T) {
|
||||
tgObfs, tgFrame := MakeTelegramObfuscated2Frame(connOpts)
|
||||
tgDecryptor := makeStreamCipher(tgFrame.Key(), tgFrame.IV())
|
||||
decrypted := make(Frame, FrameLen)
|
||||
tgDecryptor.XORKeyStream(decrypted, *tgFrame)
|
||||
tgDecryptor.XORKeyStream(decrypted, tgFrame)
|
||||
_, err = decrypted.ConnectionType()
|
||||
assert.Nil(t, err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user