📄 ssl_do_handshake.pod
字号:
=pod=head1 NAMESSL_do_handshake - perform a TLS/SSL handshake=head1 SYNOPSIS #include <openssl/ssl.h> int SSL_do_handshake(SSL *ssl);=head1 DESCRIPTIONSSL_do_handshake() will wait for a SSL/TLS handshake to take place. If theconnection is in client mode, the handshake will be started. The handshakeroutines may have to be explicitly set in advance using eitherL<SSL_set_connect_state(3)|SSL_set_connect_state(3)> orL<SSL_set_accept_state(3)|SSL_set_accept_state(3)>.=head1 NOTESThe behaviour of SSL_do_handshake() depends on the underlying BIO.If the underlying BIO is B<blocking>, SSL_do_handshake() will only returnonce the handshake has been finished or an error occurred, except for SGC(Server Gated Cryptography). For SGC, SSL_do_handshake() may return with -1,but SSL_get_error() will yield B<SSL_ERROR_WANT_READ/WRITE> andSSL_do_handshake() should be called again.If the underlying BIO is B<non-blocking>, SSL_do_handshake() will also returnwhen the underlying BIO could not satisfy the needs of SSL_do_handshake()to continue the handshake. In this case a call to SSL_get_error() with thereturn value of SSL_do_handshake() will yield B<SSL_ERROR_WANT_READ> orB<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call aftertaking appropriate action to satisfy the needs of SSL_do_handshake().The action depends on the underlying BIO. When using a non-blocking socket,nothing is to be done, but select() can be used to check for the requiredcondition. When using a buffering BIO, like a BIO pair, data must be writteninto or retrieved out of the BIO before being able to continue.=head1 RETURN VALUESThe following return values can occur:=over 4=item 1The TLS/SSL handshake was successfully completed, a TLS/SSL connection has beenestablished.=item 0The TLS/SSL handshake was not successful but was shut down controlled andby the specifications of the TLS/SSL protocol. Call SSL_get_error() with thereturn value B<ret> to find out the reason.=item E<lt>0The TLS/SSL handshake was not successful because a fatal error occurred eitherat the protocol level or a connection failure occurred. The shutdown wasnot clean. It can also occur of action is need to continue the operationfor non-blocking BIOs. Call SSL_get_error() with the return value B<ret>to find out the reason.=back=head1 SEE ALSOL<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>,L<SSL_accept(3)|SSL_accept(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>,L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>=cut
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -