mirror of
https://github.com/seriyps/mtproto_proxy.git
synced 2026-08-04 15:19:47 +00:00
Limit TLS record size to 2^14
See rfc8446#section-5.1
This commit is contained in:
parent
7677fe1150
commit
237f9f1d25
3 changed files with 13 additions and 12 deletions
|
|
@ -167,9 +167,9 @@ prop_tls_big_stream() ->
|
|||
?FORALL({Key, Iv, Stream}, tls_big_stream_arg_set(), tls_obfuscated_secure_stream(Key, Iv, Stream)).
|
||||
|
||||
tls_big_stream_arg_set() ->
|
||||
%% Packets more than 64kb but less than 512kb
|
||||
Min = 64 * 1024 + 10,
|
||||
Max = 512 * 1024,
|
||||
%% Packets more than 2^14b but less than 128kb
|
||||
Min = 16 * 1024 + 10,
|
||||
Max = 128 * 1024,
|
||||
proper_types:tuple(
|
||||
[mtp_prop_gen:key(),
|
||||
mtp_prop_gen:iv(),
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ prop_codec_small(doc) ->
|
|||
"Tests that any binary below 65535 bytes can be encoded and decoded back as single frame".
|
||||
|
||||
prop_codec_small() ->
|
||||
?FORALL(Bin, mtp_prop_gen:binary(8, 65535), codec_small(Bin)).
|
||||
?FORALL(Bin, mtp_prop_gen:binary(8, 16 * 1024), codec_small(Bin)).
|
||||
|
||||
codec_small(Bin) ->
|
||||
%% fake_tls can split big packets to multiple TLS frames of 64kb
|
||||
%% fake_tls can split big packets to multiple TLS frames of 2^14b
|
||||
Codec = mtp_fake_tls:new(),
|
||||
{Data, Codec1} = mtp_fake_tls:encode_packet(Bin, Codec),
|
||||
{ok, Decoded, <<>>, _} = mtp_fake_tls:try_decode_packet(iolist_to_binary(Data), Codec1),
|
||||
|
|
@ -23,7 +23,7 @@ prop_codec_big(doc) ->
|
|||
"Tests that big binaries will be split to multiple chunks".
|
||||
|
||||
prop_codec_big() ->
|
||||
?FORALL(Bin, mtp_prop_gen:binary(65536, 75000), codec_big(Bin)).
|
||||
?FORALL(Bin, mtp_prop_gen:binary(16 * 1024, 65535), codec_big(Bin)).
|
||||
|
||||
codec_big(Bin) ->
|
||||
Codec = mtp_fake_tls:new(),
|
||||
|
|
@ -35,10 +35,10 @@ codec_big(Bin) ->
|
|||
|
||||
|
||||
prop_stream(doc) ->
|
||||
"Tests that set of packets of size below 65535b can be encoded and decoded back".
|
||||
"Tests that set of packets of size below 2^14b can be encoded and decoded back".
|
||||
|
||||
prop_stream() ->
|
||||
?FORALL(Stream, proper_types:list(mtp_prop_gen:binary(8, 20000)),
|
||||
?FORALL(Stream, proper_types:list(mtp_prop_gen:binary(8, 16000)),
|
||||
codec_stream(Stream)).
|
||||
|
||||
codec_stream(Stream) ->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue