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
d63666ea
Unverified
Commit
d63666ea
authored
Jun 06, 2020
by
Sergey Prokhorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: Add dummy ChangeCipherSpec after ClientHello
parent
d43152e9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
mtp_fake_tls.erl
src/mtp_fake_tls.erl
+8
-0
mtp_test_client.erl
test/mtp_test_client.erl
+1
-0
No files found.
src/mtp_fake_tls.erl
View file @
d63666ea
...
...
@@ -21,6 +21,7 @@
-
ifdef
(
TEST
).
-
export
([
make_client_hello
/
2
,
make_client_hello
/
4
,
make_dummy_change_cipher
/
0
,
parse_server_hello
/
1
]).
-
endif
.
...
...
@@ -295,6 +296,13 @@ add_padding_ext(RealExtensions, ExtLen) ->
(
binary
:
copy
(
<<
0
>>
,
PadSize
))
/
binary
>>
,
<<
RealExtensions
/
binary
,
PaddingExt
/
binary
>>
.
%% https://tools.ietf.org/html/rfc8446#appendix-D.4
make_dummy_change_cipher
()
->
<<?
TLS_REC_CHANGE_CIPHER
,
?
TLS_12_VERSION
,
1
:
?
u16
,
1
>>
.
%% Parses "ServerHello" (the one produced by from_client_hello/2). Used for tests only.
parse_server_hello
(
<<?
TLS_REC_HANDSHAKE
,
?
TLS_12_VERSION
,
HSLen
:
?
u16
,
Handshake
:
HSLen
/
binary
,
?
TLS_REC_CHANGE_CIPHER
,
?
TLS_12_VERSION
,
CCLen
:
?
u16
,
ChangeCipher
:
CCLen
/
binary
,
...
...
test/mtp_test_client.erl
View file @
d63666ea
...
...
@@ -49,6 +49,7 @@ connect(Host, Port, Seed, Secret, DcId, Protocol0) ->
ok
=
gen_tcp
:
send
(
Sock
,
ClientHello
),
%% Let's hope whole server hello will arrive in a single chunk
Tail_
=
recv_server_hello
(
Sock
,
Timeout
,
<<>>
),
ok
=
gen_tcp
:
send
(
Sock
,
mtp_fake_tls
:
make_dummy_change_cipher
()),
{
mtp_secure
,
true
,
mtp_fake_tls
:
new
(),
Tail_
};
_
->
{
Protocol0
,
false
,
undefined
,
<<>>
}
end
,
...
...
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