Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mtproto_proxy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mtproto_proxy
Commits
9b11341f
Unverified
Commit
9b11341f
authored
Oct 03, 2018
by
Сергей Прохоров
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify obfuscated handshake parsing
parent
5fd3987e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
mtp_obfuscated.erl
src/mtp_obfuscated.erl
+8
-10
No files found.
src/mtp_obfuscated.erl
View file @
9b11341f
...
...
@@ -66,17 +66,15 @@ from_header(Header, Secret) when byte_size(Header) == 64 ->
{
DecKey
,
DecIV
}
=
init_up_decrypt
(
Header
,
Secret
),
St
=
new
(
EncKey
,
EncIV
,
DecKey
,
DecIV
),
{
<<
_:
56
/
binary
,
Bin1
:
8
/
binary
,
_
/
binary
>>
,
St1
}
=
decrypt
(
Header
,
St
),
<<
HeaderPart
:
56
/
binary
,
_
/
binary
>>
=
Header
,
NewHeader
=
<<
HeaderPart
/
binary
,
Bin1
/
binary
>>
,
case
NewHeader
of
<<
_:
56
/
binary
,
16#ef
,
16#ef
,
16#ef
,
16#ef
,
_
/
binary
>>
->
DcId
=
get_dc
(
NewHeader
),
case
Bin1
of
<<
16#ef
,
16#ef
,
16#ef
,
16#ef
,
_
/
binary
>>
->
DcId
=
get_dc
(
Bin1
),
{
ok
,
DcId
,
mtp_abridged
,
St1
};
<<
_:
56
/
binary
,
16#ee
,
16#ee
,
16#ee
,
16#ee
,
_
/
binary
>>
->
DcId
=
get_dc
(
NewHeader
),
<<
16#ee
,
16#ee
,
16#ee
,
16#ee
,
_
/
binary
>>
->
DcId
=
get_dc
(
Bin1
),
{
ok
,
DcId
,
mtp_intermediate
,
St1
};
<<
_:
56
/
binary
,
16#dd
,
16#dd
,
16#dd
,
16#dd
,
_
/
binary
>>
->
DcId
=
get_dc
(
NewHeader
),
<<
16#dd
,
16#dd
,
16#dd
,
16#dd
,
_
/
binary
>>
->
DcId
=
get_dc
(
Bin1
),
{
ok
,
DcId
,
mtp_secure
,
St1
};
_
->
metric
:
count_inc
([
?
APP
,
protocol_error
,
total
],
1
,
#
{
labels
=>
[
unknown
]}),
...
...
@@ -96,7 +94,7 @@ init_up_decrypt(Bin, Secret) ->
KeyHash
=
crypto
:
hash
(
'sha256'
,
<<
Key
/
binary
,
Secret
/
binary
>>
),
{
KeyHash
,
IV
}.
get_dc
(
<<
_:
60
/
binary
,
DcId
:
16
/
signed
-
little
-
integer
,
_
/
binary
>>
)
->
get_dc
(
<<
_:
4
/
binary
,
DcId
:
16
/
signed
-
little
-
integer
,
_
/
binary
>>
)
->
DcId
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment