aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2016-02-08 09:40:33 +0100
committerIngela Anderton Andin <[email protected]>2016-02-08 09:40:33 +0100
commitb62cd7fd5a922cfdff05bfba9512ce36ce100116 (patch)
treefd1e128e9bd27ebe2937ecf16c027b46e01b6f06
parent11c2df7d7adc404a1b3a4c8948b4890e0af2c760 (diff)
parent0ec1cf3249f4f043525ee8ad3470023b36f6e7ec (diff)
downloadotp-b62cd7fd5a922cfdff05bfba9512ce36ce100116.tar.gz
otp-b62cd7fd5a922cfdff05bfba9512ce36ce100116.tar.bz2
otp-b62cd7fd5a922cfdff05bfba9512ce36ce100116.zip
Merge branch 'ia/ssl/handshake-fragmentation/OTP-13306' into maint
* ia/ssl/handshake-fragmentation/OTP-13306: ssl: Big handshake messages needs to be fragmented on TLS record level
-rw-r--r--lib/ssl/src/ssl_record.erl16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/ssl/src/ssl_record.erl b/lib/ssl/src/ssl_record.erl
index 75cfecdf5e..ce6b8fb84f 100644
--- a/lib/ssl/src/ssl_record.erl
+++ b/lib/ssl/src/ssl_record.erl
@@ -311,9 +311,19 @@ set_pending_cipher_state(#connection_states{pending_read = Read,
%%
%% Description: Encodes a handshake message to send on the ssl-socket.
%%--------------------------------------------------------------------
-encode_handshake(Frag, Version, ConnectionStates) ->
- encode_plain_text(?HANDSHAKE, Version, Frag, ConnectionStates).
-
+encode_handshake(Frag, Version,
+ #connection_states{current_write =
+ #connection_state{
+ security_parameters =
+ #security_parameters{bulk_cipher_algorithm = BCA}}} =
+ ConnectionStates) ->
+ case iolist_size(Frag) of
+ N when N > ?MAX_PLAIN_TEXT_LENGTH ->
+ Data = split_bin(iolist_to_binary(Frag), ?MAX_PLAIN_TEXT_LENGTH, Version, BCA),
+ encode_iolist(?HANDSHAKE, Data, Version, ConnectionStates);
+ _ ->
+ encode_plain_text(?HANDSHAKE, Version, Frag, ConnectionStates)
+ end.
%%--------------------------------------------------------------------
-spec encode_alert_record(#alert{}, ssl_version(), #connection_states{}) ->
{iolist(), #connection_states{}}.