diff options
Diffstat (limited to 'src/tls/tls.erl')
-rw-r--r-- | src/tls/tls.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/tls/tls.erl b/src/tls/tls.erl index 72897cf08..7281fd475 100644 --- a/src/tls/tls.erl +++ b/src/tls/tls.erl @@ -59,6 +59,7 @@ -define(GET_DECRYPTED_INPUT, 6). -define(GET_PEER_CERTIFICATE, 7). -define(GET_VERIFY_RESULT, 8). +-define(VERIFY_NONE, 16#10000). -record(tlssock, {tcpsock, tlsport}). @@ -120,13 +121,20 @@ tcp_to_tls(TCPSocket, Options) -> {error, already_loaded} -> ok end, Port = open_port({spawn, tls_drv}, [binary]), + Flags = + case lists:member(verify_none, Options) of + true -> + ?VERIFY_NONE; + false -> + 0 + end, Command = case lists:member(connect, Options) of true -> ?SET_CERTIFICATE_FILE_CONNECT; false -> ?SET_CERTIFICATE_FILE_ACCEPT end, - case port_control(Port, Command, CertFile ++ [0]) of + case port_control(Port, Command bor Flags, CertFile ++ [0]) of <<0>> -> {ok, #tlssock{tcpsock = TCPSocket, tlsport = Port}}; <<1, Error/binary>> -> |