#include <cafe.h>
#include <cafe/nssl/nsslclient.h>

NSSL_RVAL NSSLDoHandshake(NSSLConnectionHandle connection,
                          NSSLHandshakeError* pHsError,
                          NSSLCertValidationStatus *pPeerCertValidationStatus);


connection A handle to a SSL connection on which a handshake is to be performed.
pHsError A pointer to hold handshake error code.
pPeerCertValidationStatus A pointer to hold bitmask indicating peer certificate validation status.

Return Values

NSSL_RVAL_OK Handshake successfully completed.
NSSL_RVAL_WANT_READ/NSSL_RVAL_WANT_WRITE (Only applicable for non-blocking connections) The operation did not complete; the same NSSL I/O function should be called again later. If, by then, the underlying socket has data available for reading (if the result code is NSSL_RVAL_WANT_READ) or allows writing data (NSSL_RVAL_WANT_WRITE), then some TLS/SSL protocol progress will take place, i.e., at least part of a TLS/SSL record will be read or written. The retry may again lead to an NSSL_RVAL_WANT_READ or NSSL_RVAL_WANT_WRITE condition. There is no fixed upper limit for the number of iterations that may be necessary until progress becomes visible at application protocol level.
NSSL_RVAL_HANDSHAKE Handshake failed; check pHsError for more information.
NSSL_RVAL_IO_ERROR Some IO error occurred on the underlying socket.
NSSL_RVAL_NSSLLIB_ERROR A failure in the SSL library occurred.


Performs SSL handshake with the peer. When completed, the handshake error code is written into pHsError and the peer certificate validation status is written into pPeerCertValidationStatus.

Do Not Call From

Callbacks Do not call this function from any callback function.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.

Revision History

2012/08/16 Cleanup pass.
2012/04/06 Initial version.