Manual Pages for UNIX Darwin command on man SSL_write
MyWebUniversity

Manual Pages for UNIX Darwin command on man SSL_write

SSLwrite(3) OpenSSL SSLwrite(3)

NAME

SSLwrite - write bytes to a TLS/SSL connection.

SYNOPSIS

#include

int SSLwrite(SSL *ssl, const void *buf, int num);

DESCRIPTION

SSLwrite() writes nnuumm bytes from the buffer bbuuff into the specified ssssll connection. NNOOTTEESS If necessary, SSLwrite() will negotiate a TLS/SSL session, if not already explicitly performed by SSLconnect(3) or SSLaccept(3). If the

peer requests a re-negotiation, it will be performed transparently

during the SSLwrite() operation. The behaviour of SSLwrite() depends on the underlying BIO. For the transparent negotiation to succeed, the ssssll must have been initialized to client or server mode. This is being done by calling SSLsetconnectstate(3) or SSLsetacceptstate() before the first call to an SSLread(3) or SSLwrite() function. If the underlying BIO is bblloocckkiinngg, SSLwrite() will only return, once the write operation has been finished or an error occurred, except when

a renegotiation take place, in which case a SSLERRORWANTREAD may

occur. This behaviour can be controlled with the SSLMODEAUTORETRY flag of the SSLCTXsetmode(3) call.

If the underlying BIO is nnoonn-bblloocckkiinngg, SSLwrite() will also return,

when the underlying BIO could not satisfy the needs of SSLwrite() to continue the operation. In this case a call to SSLgeterror(3) with the return value of SSLwrite() will yield SSSSLLEERRRROORRWWAANNTTRREEAADD or

SSSSLLEERRRROORRWWAANNTTWWRRIITTEE. As at any time a re-negotiation is possible, a

call to SSLwrite() can also cause read operations! The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSLwrite(). 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. SSLwrite() will only return with success, when the complete contents of bbuuff of length nnuumm has been written. This default behaviour can be changed with the SSLMODEENABLEPARTIALWRITE option of SSLCTXsetmode(3). When this flag is set, SSLwrite() will also return with success, when a partial write has been successfully completed. In this case the SSLwrite() operation is considered completed. The bytes are sent and a new SSLwrite() operation with a new buffer (with the already sent bytes removed) must be started. A partial write is performed with the size of a message block, which is 16kB for SSLv3/TLSv1. WWAARRNNIINNGG When an SSLwrite() operation has to be repeated because of SSSSLLEERRRROORRWWAANNTTRREEAADD or SSSSLLEERRRROORRWWAANNTTWWRRIITTEE, it must be repeated with the same arguments. When calling SSLwrite() with num=0 bytes to be sent the behaviour is undefined.

RETURN VALUES

The following return values can occur: >0 The write operation was successful, the return value is the number of bytes actually written to the TLS/SSL connection. 0 The write operation was not successful. Probably the underlying connection was closed. Call SSLgeterror() with the return value rreett to find out, whether an error occurred or the connection was

shut down cleanly (SSLERRORZERORETURN).

SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only be detected, whether the underlying connection was closed. It cannot be checked, why the closure happened. <0 The write operation was not successful, because either an error occurred or action must be taken by the calling process. Call SSLgeterror() with the return value rreett to find out the reason.

SEE ALSO

SSLgeterror(3), SSLread(3), SSLCTXsetmode(3), SSLCTXnew(3), SSLconnect(3), SSLaccept(3) SSLsetconnectstate(3), ssl(3), bio(3)

0.9.7l 2002-07-19 SSLwrite(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™