657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
|
# File 'lib/ruby-tls/ssl.rb', line 657
def decrypt(data)
return unless @ready
put_cipher_text data
if not SSL.SSL_is_init_finished(@ssl)
resp = @is_server ? SSL.SSL_accept(@ssl) : SSL.SSL_connect(@ssl)
if resp < 0
err_code = SSL.SSL_get_error(@ssl, resp)
if err_code != SSL_ERROR_WANT_READ
@transport.close_cb if err_code == SSL_ERROR_SSL
return
end
end
@handshake_completed = true
signal_handshake unless @handshake_signaled
end
while true do
size = get_plain_text(@read_buffer, READ_BUFFER)
if size > 0
@transport.dispatch_cb @read_buffer.read_string(size)
else
break
end
end
dispatch_cipher_text
end
|