aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2016-02-05 15:03:42 +0100
committerIngela Anderton Andin <[email protected]>2016-02-05 15:03:42 +0100
commit0ec1cf3249f4f043525ee8ad3470023b36f6e7ec (patch)
tree13a8a7d124b12ff0d244e959da99ad96728ad965 /lib
parent6447ec18a82c30ea0e8b19631ae96dfaa1f092da (diff)
downloadotp-0ec1cf3249f4f043525ee8ad3470023b36f6e7ec.tar.gz
otp-0ec1cf3249f4f043525ee8ad3470023b36f6e7ec.tar.bz2
otp-0ec1cf3249f4f043525ee8ad3470023b36f6e7ec.zip
ssl: Big handshake messages needs to be fragmented on TLS record level
Diffstat (limited to 'lib')
-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{}}.