NAME
SSLdohandshake - perform a TLS/SSL handshake
SYNOPSIS
#include
int SSLdohandshake(SSL *ssl);DESCRIPTION
SSLdohandshake() will wait for a SSL/TLS handshake to take place. If the connection is in client mode, the handshake will be started. The handshake routines may have to be explicitly set in advance using either SSLsetconnectstate(3) or SSLsetacceptstate(3). NNOOTTEESS The behaviour of SSLdohandshake() depends on the underlying BIO. If the underlying BIO is bblloocckkiinngg, SSLdohandshake() will only return once the handshake has been finished or an error occurred, except for SGC (Server Gated Cryptography). For SGC, SSLdohandshake() may returnwith -1, but SSLgeterror() will yield SSSSLLEERRRROORRWWAANNTTRREEAADD//WWRRIITTEE and
SSLdohandshake() should be called again.If the underlying BIO is nnoonn-bblloocckkiinngg, SSLdohandshake() will also
return when the underlying BIO could not satisfy the needs of SSLdohandshake() to continue the handshake. In this case a call to SSLgeterror() with the return value of SSLdohandshake() will yield SSSSLLEERRRROORRWWAANNTTRREEAADD or SSSSLLEERRRROORRWWAANNTTWWRRIITTEE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSLdohandshake(). 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 required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.RETURN VALUES
The following return values can occur: 1. The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established. 2. The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSLgeterror() with the return value rreett to find out the reason. 3. <0 The TLS/SSL handshake was not successful because a fatal error occurred either at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur of actionis need to continue the operation for non-blocking BIOs. Call
SSLgeterror() with the return value rreett to find out the reason.SEE ALSO
SSLgeterror(3), SSLconnect(3), SSLaccept(3), ssl(3), bio(3), SSLsetconnectstate(3) PPOODD EERRRROORRSS e! The above document had some coding errors, which are explained bbeellooww:: Around line 53: You have '=item 0' instead of the expected '=item 2' Around line 59: Expected '=item 3'0.9.7l 2002-07-19 SSLdohandshake(3)