
|
My Project
|
Functions | |
| WOLFSSL_API long | wolfSSL_get_verify_depth (WOLFSSL *ssl) |
| This function returns the maximum chain depth allowed, which is 9 by default, for a valid session i.e. there is a non-null session object (ssl). | |
| WOLFSSL_API char * | wolfSSL_get_cipher_list (int priority) |
| Get the name of cipher at priority level passed in. | |
| WOLFSSL_API int | wolfSSL_get_ciphers (char *, int) |
| This function gets the ciphers enabled in wolfSSL. | |
| WOLFSSL_API const char * | wolfSSL_get_cipher_name (WOLFSSL *ssl) |
| This function gets the cipher name in the format DHE-RSA by passing through argument to wolfSSL_get_cipher_name_internal. | |
| WOLFSSL_API int | wolfSSL_get_fd (const WOLFSSL *) |
| This function returns the file descriptor (fd) used as the input/output facility for the SSL connection. Typically this will be a socket file descriptor. | |
| WOLFSSL_API int | wolfSSL_get_using_nonblock (WOLFSSL *) |
| This function allows the application to determine if wolfSSL is using non-blocking I/O. If wolfSSL is using non-blocking I/O, this function will return 1, otherwise 0. After an application creates a WOLFSSL object, if it will be used with a non-blocking socket, call wolfSSL_set_using_nonblock() on it. This lets the WOLFSSL object know that receiving EWOULDBLOCK means that the recvfrom call would block rather than that it timed out. | |
| WOLFSSL_API int | wolfSSL_write (WOLFSSL *, const void *, int) |
| This function writes sz bytes from the buffer, data, to the SSL connection, ssl. If necessary, wolfSSL_write() will negotiate an SSL/TLS session if the handshake has not already been performed yet by wolfSSL_connect() or wolfSSL_accept(). wolfSSL_write() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_write() will return when the underlying I/O could not satisfy the needs of wolfSSL_write() to continue. In this case, a call to wolfSSL_get_error() will yield either SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process must then repeat the call to wolfSSL_write() when the underlying I/O is ready. If the underlying I/O is blocking, wolfSSL_write() will only return once the buffer data of size sz has been completely written or an error occurred. | |
| WOLFSSL_API int | wolfSSL_read (WOLFSSL *, void *, int) |
| This function reads sz bytes from the SSL session (ssl) internal read buffer into the buffer data. The bytes read are removed from the internal receive buffer. If necessary wolfSSL_read() will negotiate an SSL/TLS session if the handshake has not already been performed yet by wolfSSL_connect() or wolfSSL_accept(). The SSL/TLS protocol uses SSL records which have a maximum size of 16kB (the max record size can be controlled by the MAX_RECORD_SIZE define in <wolfssl_root>/wolfssl/internal.h). As such, wolfSSL needs to read an entire SSL record internally before it is able to process and decrypt the record. Because of this, a call to wolfSSL_read() will only be able to return the maximum buffer size which has been decrypted at the time of calling. There may be additional not-yet-decrypted data waiting in the internal wolfSSL receive buffer which will be retrieved and decrypted with the next call to wolfSSL_read(). If sz is larger than the number of bytes in the internal read buffer, SSL_read() will return the bytes available in the internal read buffer. If no bytes are buffered in the internal read buffer yet, a call to wolfSSL_read() will trigger processing of the next record. | |
| WOLFSSL_API int | wolfSSL_peek (WOLFSSL *, void *, int) |
| This function copies sz bytes from the SSL session (ssl) internal read buffer into the buffer data. This function is identical to wolfSSL_read() except that the data in the internal SSL session receive buffer is not removed or modified. If necessary, like wolfSSL_read(), wolfSSL_peek() will negotiate an SSL/TLS session if the handshake has not already been performed yet by wolfSSL_connect() or wolfSSL_accept(). The SSL/TLS protocol uses SSL records which have a maximum size of 16kB (the max record size can be controlled by the MAX_RECORD_SIZE define in <wolfssl_root>/wolfssl/internal.h). As such, wolfSSL needs to read an entire SSL record internally before it is able to process and decrypt the record. Because of this, a call to wolfSSL_peek() will only be able to return the maximum buffer size which has been decrypted at the time of calling. There may be additional not-yet-decrypted data waiting in the internal wolfSSL receive buffer which will be retrieved and decrypted with the next call to wolfSSL_peek() / wolfSSL_read(). If sz is larger than the number of bytes in the internal read buffer, SSL_peek() will return the bytes available in the internal read buffer. If no bytes are buffered in the internal read buffer yet, a call to wolfSSL_peek() will trigger processing of the next record. | |
| WOLFSSL_API int | wolfSSL_accept (WOLFSSL *) |
| This function is called on the server side and waits for an SSL client to initiate the SSL/TLS handshake. When this function is called, the underlying communication channel has already been set up. wolfSSL_accept() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_accept() will return when the underlying I/O could not satisfy the needs of wolfSSL_accept to continue the handshake. In this case, a call to wolfSSL_get_error() will yield either SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process must then repeat the call to wolfSSL_accept when data is available to read and wolfSSL will pick up where it left off. When using a non-blocking socket, nothing needs to be done, but select() can be used to check for the required condition. If the underlying I/O is blocking, wolfSSL_accept() will only return once the handshake has been finished or an error occurred. | |
| WOLFSSL_API int | wolfSSL_send (WOLFSSL *, const void *, int sz, int flags) |
| This function writes sz bytes from the buffer, data, to the SSL connection, ssl, using the specified flags for the underlying write operation. If necessary wolfSSL_send() will negotiate an SSL/TLS session if the handshake has not already been performed yet by wolfSSL_connect() or wolfSSL_accept(). wolfSSL_send() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_send() will return when the underlying I/O could not satisfy the needs of wolfSSL_send to continue. In this case, a call to wolfSSL_get_error() will yield either SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process must then repeat the call to wolfSSL_send() when the underlying I/O is ready. If the underlying I/O is blocking, wolfSSL_send() will only return once the buffer data of size sz has been completely written or an error occurred. | |
| WOLFSSL_API int | wolfSSL_recv (WOLFSSL *, void *, int sz, int flags) |
| This function reads sz bytes from the SSL session (ssl) internal read buffer into the buffer data using the specified flags for the underlying recv operation. The bytes read are removed from the internal receive buffer. This function is identical to wolfSSL_read() except that it allows the application to set the recv flags for the underlying read operation. If necessary wolfSSL_recv() will negotiate an SSL/TLS session if the handshake has not already been performed yet by wolfSSL_connect() or wolfSSL_accept(). The SSL/TLS protocol uses SSL records which have a maximum size of 16kB (the max record size can be controlled by the MAX_RECORD_SIZE define in <wolfssl_root>/wolfssl/internal.h). As such, wolfSSL needs to read an entire SSL record internally before it is able to process and decrypt the record. Because of this, a call to wolfSSL_recv() will only be able to return the maximum buffer size which has been decrypted at the time of calling. There may be additional not-yet-decrypted data waiting in the internal wolfSSL receive buffer which will be retrieved and decrypted with the next call to wolfSSL_recv(). If sz is larger than the number of bytes in the internal read buffer, SSL_recv() will return the bytes available in the internal read buffer. If no bytes are buffered in the internal read buffer yet, a call to wolfSSL_recv() will trigger processing of the next record. | |
| WOLFSSL_API int | wolfSSL_get_alert_history (WOLFSSL *, WOLFSSL_ALERT_HISTORY *) |
| This function gets the alert history. | |
| WOLFSSL_API WOLFSSL_SESSION * | wolfSSL_get_session (WOLFSSL *) |
| This function returns a pointer to the current session (WOLFSSL_SESSION) used in ssl. The WOLFSSL_SESSION pointed to contains all the necessary information required to perform a session resumption and reestablish the connection without a new handshake. For session resumption, before calling wolfSSL_shutdown() with your session object, an application should save the session ID from the object with a call to wolfSSL_get_session(), which returns a pointer to the session. Later, the application should create a new WOLFSSL object and assign the saved session with wolfSSL_set_session(). At this point, the application may call wolfSSL_connect() and wolfSSL will try to resume the session. The wolfSSL server code allows session resumption by default. | |
| WOLFSSL_API void | wolfSSL_flush_sessions (WOLFSSL_CTX *, long) |
| This function flushes session from the session cache which have expired. The time, tm, is used for the time comparison. Note that wolfSSL currently uses a static table for sessions, so no flushing is needed. As such, this function is currently just a stub. This function provides OpenSSL compatibility (SSL_flush_sessions) when wolfSSL is compiled with the OpenSSL compatibility layer. | |
| WOLFSSL_API int | wolfSSL_GetSessionIndex (WOLFSSL *ssl) |
| This function gets the session index of the WOLFSSL structure. | |
| WOLFSSL_API int | wolfSSL_GetSessionAtIndex (int index, WOLFSSL_SESSION *session) |
| This function gets the session at specified index of the session cache and copies it into memory. The WOLFSSL_SESSION structure holds the session information. | |
| WOLFSSL_API WOLFSSL_X509_CHAIN * | wolfSSL_SESSION_get_peer_chain (WOLFSSL_SESSION *session) |
| Returns the peer certificate chain from the WOLFSSL_SESSION struct. | |
| WOLFSSL_API int | wolfSSL_pending (WOLFSSL *) |
| This function returns the number of bytes which are buffered and available in the SSL object to be read by wolfSSL_read(). | |
| WOLFSSL_API int | wolfSSL_save_session_cache (const char *) |
| This function persists the session cache to file. It doesn’t use memsave because of additional memory use. | |
| WOLFSSL_API int | wolfSSL_restore_session_cache (const char *) |
| This function restores the persistent session cache from file. It does not use memstore because of additional memory use. | |
| WOLFSSL_API int | wolfSSL_memsave_session_cache (void *, int) |
| This function persists session cache to memory. | |
| WOLFSSL_API int | wolfSSL_memrestore_session_cache (const void *, int) |
| This function restores the persistent session cache from memory. | |
| WOLFSSL_API int | wolfSSL_get_session_cache_memsize (void) |
| This function returns how large the session cache save buffer should be. | |
| WOLFSSL_API int | wolfSSL_session_reused (WOLFSSL *) |
| This function returns the resuming member of the options struct. The flag indicates whether or not to reuse a session. If not, a new session must be established. | |
| WOLFSSL_API const char * | wolfSSL_get_version (WOLFSSL *) |
| Returns the SSL version being used as a string. | |
| WOLFSSL_API int | wolfSSL_get_current_cipher_suite (WOLFSSL *ssl) |
| Returns the current cipher suit an ssl session is using. | |
| WOLFSSL_API WOLFSSL_CIPHER * | wolfSSL_get_current_cipher (WOLFSSL *) |
| This function returns a pointer to the current cipher in the ssl session. | |
| WOLFSSL_API const char * | wolfSSL_CIPHER_get_name (const WOLFSSL_CIPHER *cipher) |
| This function matches the cipher suite in the SSL object with the available suites and returns the string representation. | |
| WOLFSSL_API const char * | wolfSSL_get_cipher (WOLFSSL *) |
| This function matches the cipher suite in the SSL object with the available suites. | |
| WOLFSSL_API int | wolfSSL_BIO_get_mem_data (WOLFSSL_BIO *bio, void *p) |
| This is used to set a byte pointer to the start of the internal memory buffer. | |
| WOLFSSL_API long | wolfSSL_BIO_set_fd (WOLFSSL_BIO *b, int fd, int flag) |
| Sets the file descriptor for bio to use. | |
| WOLFSSL_API int | wolfSSL_BIO_set_close (WOLFSSL_BIO *b, long flag) |
| Sets the close flag, used to indicate that the i/o stream should be closed when the BIO is freed. | |
| WOLFSSL_API WOLFSSL_BIO_METHOD * | wolfSSL_BIO_s_socket (void) |
| This is used to get a BIO_SOCKET type WOLFSSL_BIO_METHOD. | |
| WOLFSSL_API int | wolfSSL_BIO_set_write_buf_size (WOLFSSL_BIO *b, long size) |
| This is used to set the size of write buffer for a WOLFSSL_BIO. If write buffer has been previously set this function will free it when resetting the size. It is similar to wolfSSL_BIO_reset in that it resets read and write indexes to 0. | |
| WOLFSSL_API int | wolfSSL_BIO_make_bio_pair (WOLFSSL_BIO *b1, WOLFSSL_BIO *b2) |
| This is used to pair two bios together. A pair of bios acts similar to a two way pipe writing to one can be read by the other and vice versa. It is expected that both bios be in the same thread, this function is not thread safe. Freeing one of the two bios removes both from being paired. If a write buffer size was not previously set for either of the bios it is set to a default size of 17000 (WOLFSSL_BIO_SIZE) before being paired. | |
| WOLFSSL_API int | wolfSSL_BIO_ctrl_reset_read_request (WOLFSSL_BIO *b) |
| This is used to set the read request flag back to 0. | |
| WOLFSSL_API int | wolfSSL_BIO_nread0 (WOLFSSL_BIO *bio, char **buf) |
| This is used to get a buffer pointer for reading from. Unlike wolfSSL_BIO_nread the internal read index is not advanced by the number returned from the function call. Reading past the value returned can result in reading out of array bounds. | |
| WOLFSSL_API int | wolfSSL_BIO_nread (WOLFSSL_BIO *bio, char **buf, int num) |
| This is used to get a buffer pointer for reading from. The internal read index is advanced by the number returned from the function call with buf being pointed to the beginning of the buffer to read from. In the case that less bytes are in the read buffer than the value requested with num the lesser value is returned. Reading past the value returned can result in reading out of array bounds. | |
| WOLFSSL_API int | wolfSSL_BIO_nwrite (WOLFSSL_BIO *bio, char **buf, int num) |
| Gets a pointer to the buffer for writing as many bytes as returned by the function. Writing more bytes to the pointer returned then the value returned can result in writing out of bounds. | |
| WOLFSSL_API int | wolfSSL_BIO_reset (WOLFSSL_BIO *bio) |
| Resets bio to an initial state. As an example for type BIO_BIO this resets the read and write index. | |
| WOLFSSL_API int | wolfSSL_BIO_seek (WOLFSSL_BIO *bio, int ofs) |
| This function adjusts the file pointer to the offset given. This is the offset from the head of the file. | |
| WOLFSSL_API int | wolfSSL_BIO_write_filename (WOLFSSL_BIO *bio, char *name) |
| This is used to set and write to a file. WIll overwrite any data currently in the file and is set to close the file when the bio is freed. | |
| WOLFSSL_API long | wolfSSL_BIO_set_mem_eof_return (WOLFSSL_BIO *bio, int v) |
| This is used to set the end of file value. Common value is -1 so as not to get confused with expected positive values. | |
| WOLFSSL_API long | wolfSSL_BIO_get_mem_ptr (WOLFSSL_BIO *bio, WOLFSSL_BUF_MEM **m) |
| This is a getter function for WOLFSSL_BIO memory pointer. | |
| WOLFSSL_API const char * | wolfSSL_lib_version (void) |
| This function returns the current library version. | |
| WOLFSSL_API word32 | wolfSSL_lib_version_hex (void) |
| This function returns the current library version in hexadecimal notation. | |
| WOLFSSL_API int | wolfSSL_negotiate (WOLFSSL *ssl) |
| Performs the actual connect or accept based on the side of the SSL method. If called from the client side then an wolfSSL_connect() is done while a wolfSSL_accept() is performed if called from the server side. | |
| WOLFSSL_API int | wolfSSL_connect_cert (WOLFSSL *ssl) |
| This function is called on the client side and initiates an SSL/TLS handshake with a server only long enough to get the peer’s certificate chain. When this function is called, the underlying communication channel has already been set up. wolfSSL_connect_cert() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_connect_cert() will return when the underlying I/O could not satisfy the needs of wolfSSL_connect_cert() to continue the handshake. In this case, a call to wolfSSL_get_error() will yield either SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process must then repeat the call to wolfSSL_connect_cert() when the underlying I/O is ready and wolfSSL will pick up where it left off. When using a non-blocking socket, nothing needs to be done, but select() can be used to check for the required condition. If the underlying I/O is blocking, wolfSSL_connect_cert() will only return once the peer’s certificate chain has been received. | |
| WOLFSSL_API int | wolfSSL_writev (WOLFSSL *ssl, const struct iovec *iov, int iovcnt) |
| Simulates writev semantics but doesn’t actually do block at a time because of SSL_write() behavior and because front adds may be small. Makes porting into software that uses writev easier. | |
| WOLFSSL_API unsigned char | wolfSSL_SNI_Status (WOLFSSL *ssl, unsigned char type) |
| This function gets the status of an SNI object. | |
| WOLFSSL_API int | wolfSSL_UseSecureRenegotiation (WOLFSSL *ssl) |
| This function forces secure renegotiation for the supplied WOLFSSL structure. This is not recommended. | |
| WOLFSSL_API int | wolfSSL_Rehandshake (WOLFSSL *ssl) |
| This function executes a secure renegotiation handshake; this is user forced as wolfSSL discourages this functionality. | |
| WOLFSSL_API int | wolfSSL_UseSessionTicket (WOLFSSL *ssl) |
| Force provided WOLFSSL structure to use session ticket. The constant HAVE_SESSION_TICKET should be defined and the constant NO_WOLFSSL_CLIENT should not be defined to use this function. | |
| WOLFSSL_API int | wolfSSL_get_SessionTicket (WOLFSSL *, unsigned char *, word32 *) |
| This function copies the ticket member of the Session structure to the buffer. | |
| WOLFSSL_API int | wolfSSL_set_SessionTicket (WOLFSSL *, const unsigned char *, word32) |
| This function sets the ticket member of the WOLFSSL_SESSION structure within the WOLFSSL struct. The buffer passed into the function is copied to memory. | |
| WOLFSSL_API int | wolfSSL_isQSH (WOLFSSL *ssl) |
| Checks if QSH is used in the supplied SSL session. | |
| WOLFSSL_API int | wolfSSL_PrintSessionStats (void) |
| This function prints the statistics from the session. | |
| WOLFSSL_API int | wolfSSL_get_session_stats (unsigned int *active, unsigned int *total, unsigned int *peak, unsigned int *maxSessions) |
| This function gets the statistics for the session. | |
| WOLFSSL_API long | wolfSSL_BIO_set_fp (WOLFSSL_BIO *bio, XFILE fp, int c) |
| This is used to set the internal file pointer for a BIO. | |
| WOLFSSL_API long | wolfSSL_BIO_get_fp (WOLFSSL_BIO *bio, XFILE *fp) |
| This is used to get the internal file pointer for a BIO. | |
| WOLFSSL_API size_t | wolfSSL_BIO_ctrl_pending (WOLFSSL_BIO *b) |
| Gets the number of pending bytes to read. If BIO type is BIO_BIO then is the number to read from pair. If BIO contains an SSL object then is pending data from SSL object (wolfSSL_pending(ssl)). If is BIO_MEMORY type then returns the size of memory buffer. | |
| WOLFSSL_API int | wolfSSL_set_jobject (WOLFSSL *ssl, void *objPtr) |
| This function sets the jObjectRef member of the WOLFSSL structure. | |
| WOLFSSL_API void * | wolfSSL_get_jobject (WOLFSSL *ssl) |
| This function returns the jObjectRef member of the WOLFSSL structure. | |
| WOLFSSL_API void * | wolfSSL_GetIOReadCtx (WOLFSSL *ssl) |
| This function returns the IOCB_ReadCtx member of the WOLFSSL struct. | |
| WOLFSSL_API void * | wolfSSL_GetIOWriteCtx (WOLFSSL *ssl) |
| This function returns the IOCB_WriteCtx member of the WOLFSSL structure. | |
| WOLFSSL_API void | wolfSSL_SetIO_NetX (WOLFSSL *ssl, NX_TCP_SOCKET *nxsocket, ULONG waitoption) |
| This function sets the nxSocket and nxWait members of the nxCtx struct within the WOLFSSL structure. | |
| WOLFSSL_API int wolfSSL_accept | ( | WOLFSSL * | ssl | ) |
This function is called on the server side and waits for an SSL client to initiate the SSL/TLS handshake. When this function is called, the underlying communication channel has already been set up. wolfSSL_accept() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_accept() will return when the underlying I/O could not satisfy the needs of wolfSSL_accept to continue the handshake. In this case, a call to wolfSSL_get_error() will yield either SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process must then repeat the call to wolfSSL_accept when data is available to read and wolfSSL will pick up where it left off. When using a non-blocking socket, nothing needs to be done, but select() can be used to check for the required condition. If the underlying I/O is blocking, wolfSSL_accept() will only return once the handshake has been finished or an error occurred.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API size_t wolfSSL_BIO_ctrl_pending | ( | WOLFSSL_BIO * | b | ) |
Gets the number of pending bytes to read. If BIO type is BIO_BIO then is the number to read from pair. If BIO contains an SSL object then is pending data from SSL object (wolfSSL_pending(ssl)). If is BIO_MEMORY type then returns the size of memory buffer.
| bio | pointer to the WOLFSSL_BIO structure that has already been created. |
Example
| WOLFSSL_API int wolfSSL_BIO_ctrl_reset_read_request | ( | WOLFSSL_BIO * | b | ) |
This is used to set the read request flag back to 0.
| bio | WOLFSSL_BIO structure to set read request flag. |
Example
| WOLFSSL_API long wolfSSL_BIO_get_fp | ( | WOLFSSL_BIO * | bio, |
| XFILE * | fp ) |
This is used to get the internal file pointer for a BIO.
| bio | WOLFSSL_BIO structure to set pair. |
| fp | file pointer to set in bio. |
Example
| WOLFSSL_API int wolfSSL_BIO_get_mem_data | ( | WOLFSSL_BIO * | bio, |
| void * | p ) |
This is used to set a byte pointer to the start of the internal memory buffer.
| bio | WOLFSSL_BIO structure to get memory buffer of. |
| p | byte pointer to set to memory buffer. |
Example
| WOLFSSL_API long wolfSSL_BIO_get_mem_ptr | ( | WOLFSSL_BIO * | bio, |
| WOLFSSL_BUF_MEM ** | m ) |
This is a getter function for WOLFSSL_BIO memory pointer.
| bio | pointer to the WOLFSSL_BIO structure for getting memory pointer. |
| ptr | structure that is currently a char*. Is set to point to bio’s memory. |
Example
| WOLFSSL_API int wolfSSL_BIO_make_bio_pair | ( | WOLFSSL_BIO * | b1, |
| WOLFSSL_BIO * | b2 ) |
This is used to pair two bios together. A pair of bios acts similar to a two way pipe writing to one can be read by the other and vice versa. It is expected that both bios be in the same thread, this function is not thread safe. Freeing one of the two bios removes both from being paired. If a write buffer size was not previously set for either of the bios it is set to a default size of 17000 (WOLFSSL_BIO_SIZE) before being paired.
| b1 | WOLFSSL_BIO structure to set pair. |
| b2 | second WOLFSSL_BIO structure to complete pair. |
Example
| WOLFSSL_API int wolfSSL_BIO_nread | ( | WOLFSSL_BIO * | bio, |
| char ** | buf, | ||
| int | num ) |
This is used to get a buffer pointer for reading from. The internal read index is advanced by the number returned from the function call with buf being pointed to the beginning of the buffer to read from. In the case that less bytes are in the read buffer than the value requested with num the lesser value is returned. Reading past the value returned can result in reading out of array bounds.
| bio | WOLFSSL_BIO structure to read from. |
| buf | pointer to set at beginning of read array. |
| num | number of bytes to try and read. |
Example
| WOLFSSL_API int wolfSSL_BIO_nread0 | ( | WOLFSSL_BIO * | bio, |
| char ** | buf ) |
This is used to get a buffer pointer for reading from. Unlike wolfSSL_BIO_nread the internal read index is not advanced by the number returned from the function call. Reading past the value returned can result in reading out of array bounds.
| bio | WOLFSSL_BIO structure to read from. |
| buf | pointer to set at beginning of read array. |
Example
| WOLFSSL_API int wolfSSL_BIO_nwrite | ( | WOLFSSL_BIO * | bio, |
| char ** | buf, | ||
| int | num ) |
Gets a pointer to the buffer for writing as many bytes as returned by the function. Writing more bytes to the pointer returned then the value returned can result in writing out of bounds.
| bio | WOLFSSL_BIO structure to write to. |
| buf | pointer to buffer to write to. |
| num | number of bytes desired to be written. |
Example
| WOLFSSL_API int wolfSSL_BIO_reset | ( | WOLFSSL_BIO * | bio | ) |
Resets bio to an initial state. As an example for type BIO_BIO this resets the read and write index.
| bio | WOLFSSL_BIO structure to reset. |
Example
| WOLFSSL_API WOLFSSL_BIO_METHOD * wolfSSL_BIO_s_socket | ( | void | ) |
This is used to get a BIO_SOCKET type WOLFSSL_BIO_METHOD.
| none | No parameters. |
Example
| WOLFSSL_API int wolfSSL_BIO_seek | ( | WOLFSSL_BIO * | bio, |
| int | ofs ) |
This function adjusts the file pointer to the offset given. This is the offset from the head of the file.
| bio | WOLFSSL_BIO structure to set. |
| ofs | offset into file. |
Example
| WOLFSSL_API int wolfSSL_BIO_set_close | ( | WOLFSSL_BIO * | b, |
| long | flag ) |
Sets the close flag, used to indicate that the i/o stream should be closed when the BIO is freed.
| bio | WOLFSSL_BIO structure. |
| flag | flag for behavior when closing i/o stream. |
Example
| WOLFSSL_API long wolfSSL_BIO_set_fd | ( | WOLFSSL_BIO * | b, |
| int | fd, | ||
| int | flag ) |
Sets the file descriptor for bio to use.
| bio | WOLFSSL_BIO structure to set fd. |
| fd | file descriptor to use. |
| closeF | flag for behavior when closing fd. |
Example
| WOLFSSL_API long wolfSSL_BIO_set_fp | ( | WOLFSSL_BIO * | bio, |
| XFILE | fp, | ||
| int | c ) |
This is used to set the internal file pointer for a BIO.
| bio | WOLFSSL_BIO structure to set pair. |
| fp | file pointer to set in bio. |
| c | close file behavior flag. |
Example
| WOLFSSL_API long wolfSSL_BIO_set_mem_eof_return | ( | WOLFSSL_BIO * | bio, |
| int | v ) |
This is used to set the end of file value. Common value is -1 so as not to get confused with expected positive values.
| bio | WOLFSSL_BIO structure to set end of file value. |
| v | value to set in bio. |
Example
| WOLFSSL_API int wolfSSL_BIO_set_write_buf_size | ( | WOLFSSL_BIO * | b, |
| long | size ) |
This is used to set the size of write buffer for a WOLFSSL_BIO. If write buffer has been previously set this function will free it when resetting the size. It is similar to wolfSSL_BIO_reset in that it resets read and write indexes to 0.
| bio | WOLFSSL_BIO structure to set fd. |
| size | size of buffer to allocate. |
Example
| WOLFSSL_API int wolfSSL_BIO_write_filename | ( | WOLFSSL_BIO * | bio, |
| char * | name ) |
This is used to set and write to a file. WIll overwrite any data currently in the file and is set to close the file when the bio is freed.
| bio | WOLFSSL_BIO structure to set file. |
| name | name of file to write to. |
Example
| WOLFSSL_API const char * wolfSSL_CIPHER_get_name | ( | const WOLFSSL_CIPHER * | cipher | ) |
This function matches the cipher suite in the SSL object with the available suites and returns the string representation.
| cipher | a constant pointer to a WOLFSSL_CIPHER structure. |
Example
| WOLFSSL_API int wolfSSL_connect_cert | ( | WOLFSSL * | ssl | ) |
This function is called on the client side and initiates an SSL/TLS handshake with a server only long enough to get the peer’s certificate chain. When this function is called, the underlying communication channel has already been set up. wolfSSL_connect_cert() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_connect_cert() will return when the underlying I/O could not satisfy the needs of wolfSSL_connect_cert() to continue the handshake. In this case, a call to wolfSSL_get_error() will yield either SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process must then repeat the call to wolfSSL_connect_cert() when the underlying I/O is ready and wolfSSL will pick up where it left off. When using a non-blocking socket, nothing needs to be done, but select() can be used to check for the required condition. If the underlying I/O is blocking, wolfSSL_connect_cert() will only return once the peer’s certificate chain has been received.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API void wolfSSL_flush_sessions | ( | WOLFSSL_CTX * | ctx, |
| long | tm ) |
This function flushes session from the session cache which have expired. The time, tm, is used for the time comparison. Note that wolfSSL currently uses a static table for sessions, so no flushing is needed. As such, this function is currently just a stub. This function provides OpenSSL compatibility (SSL_flush_sessions) when wolfSSL is compiled with the OpenSSL compatibility layer.
| ctx | a pointer to a WOLFSSL_CTX structure, created using wolfSSL_CTX_new(). |
| tm | time used in session expiration comparison. |
Example
| WOLFSSL_API int wolfSSL_get_alert_history | ( | WOLFSSL * | ssl, |
| WOLFSSL_ALERT_HISTORY * | h ) |
This function gets the alert history.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
| h | a pointer to a WOLFSSL_ALERT_HISTORY structure that will hold the WOLFSSL struct’s alert_history member’s value. |
Example
| WOLFSSL_API const char * wolfSSL_get_cipher | ( | WOLFSSL * | ssl | ) |
This function matches the cipher suite in the SSL object with the available suites.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API char * wolfSSL_get_cipher_list | ( | int | priority | ) |
Get the name of cipher at priority level passed in.
| priority | Integer representing the priority level of a cipher. |
Example
Get the name of cipher at priority level passed in.
| WOLFSSL_API const char * wolfSSL_get_cipher_name | ( | WOLFSSL * | ssl | ) |
This function gets the cipher name in the format DHE-RSA by passing through argument to wolfSSL_get_cipher_name_internal.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_get_ciphers | ( | char * | buf, |
| int | len ) |
This function gets the ciphers enabled in wolfSSL.
| buf | a char pointer representing the buffer. |
| len | the length of the buffer. |
Example
| WOLFSSL_API WOLFSSL_CIPHER * wolfSSL_get_current_cipher | ( | WOLFSSL * | ssl | ) |
This function returns a pointer to the current cipher in the ssl session.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_get_current_cipher_suite | ( | WOLFSSL * | ssl | ) |
Returns the current cipher suit an ssl session is using.
| ssl | The SSL session to check. |
Example
| WOLFSSL_API int wolfSSL_get_fd | ( | const WOLFSSL * | ssl | ) |
This function returns the file descriptor (fd) used as the input/output facility for the SSL connection. Typically this will be a socket file descriptor.
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
Example
| WOLFSSL_API void * wolfSSL_get_jobject | ( | WOLFSSL * | ssl | ) |
This function returns the jObjectRef member of the WOLFSSL structure.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API WOLFSSL_SESSION * wolfSSL_get_session | ( | WOLFSSL * | ssl | ) |
This function returns a pointer to the current session (WOLFSSL_SESSION) used in ssl. The WOLFSSL_SESSION pointed to contains all the necessary information required to perform a session resumption and reestablish the connection without a new handshake. For session resumption, before calling wolfSSL_shutdown() with your session object, an application should save the session ID from the object with a call to wolfSSL_get_session(), which returns a pointer to the session. Later, the application should create a new WOLFSSL object and assign the saved session with wolfSSL_set_session(). At this point, the application may call wolfSSL_connect() and wolfSSL will try to resume the session. The wolfSSL server code allows session resumption by default.
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_get_session_cache_memsize | ( | void | ) |
This function returns how large the session cache save buffer should be.
| none | No parameters. |
Example
| WOLFSSL_API int wolfSSL_get_session_stats | ( | unsigned int * | active, |
| unsigned int * | total, | ||
| unsigned int * | peak, | ||
| unsigned int * | maxSessions ) |
This function gets the statistics for the session.
| active | a word32 pointer representing the total current sessions. |
| total | a word32 pointer representing the total sessions. |
| peak | a word32 pointer representing the peak sessions. |
| maxSessions | a word32 pointer representing the maximum sessions. |
Example
| WOLFSSL_API int wolfSSL_get_SessionTicket | ( | WOLFSSL * | ssl, |
| unsigned char * | buf, | ||
| word32 * | bufSz ) |
This function copies the ticket member of the Session structure to the buffer.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
| buf | a byte pointer representing the memory buffer. |
| bufSz | a word32 pointer representing the buffer size. |
Example
| WOLFSSL_API int wolfSSL_get_using_nonblock | ( | WOLFSSL * | ) |
This function allows the application to determine if wolfSSL is using non-blocking I/O. If wolfSSL is using non-blocking I/O, this function will return 1, otherwise 0. After an application creates a WOLFSSL object, if it will be used with a non-blocking socket, call wolfSSL_set_using_nonblock() on it. This lets the WOLFSSL object know that receiving EWOULDBLOCK means that the recvfrom call would block rather than that it timed out.
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
Example
| WOLFSSL_API long wolfSSL_get_verify_depth | ( | WOLFSSL * | ssl | ) |
This function returns the maximum chain depth allowed, which is 9 by default, for a valid session i.e. there is a non-null session object (ssl).
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API const char * wolfSSL_get_version | ( | WOLFSSL * | ssl | ) |
Returns the SSL version being used as a string.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API void * wolfSSL_GetIOReadCtx | ( | WOLFSSL * | ssl | ) |
This function returns the IOCB_ReadCtx member of the WOLFSSL struct.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API void * wolfSSL_GetIOWriteCtx | ( | WOLFSSL * | ssl | ) |
This function returns the IOCB_WriteCtx member of the WOLFSSL structure.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_GetSessionAtIndex | ( | int | index, |
| WOLFSSL_SESSION * | session ) |
This function gets the session at specified index of the session cache and copies it into memory. The WOLFSSL_SESSION structure holds the session information.
| idx | an int type representing the session index. |
| session | a pointer to the WOLFSSL_SESSION structure. |
Example
| WOLFSSL_API int wolfSSL_GetSessionIndex | ( | WOLFSSL * | ssl | ) |
This function gets the session index of the WOLFSSL structure.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_isQSH | ( | WOLFSSL * | ssl | ) |
Checks if QSH is used in the supplied SSL session.
| ssl | Pointer to the SSL session to check. |
Example
| WOLFSSL_API const char * wolfSSL_lib_version | ( | void | ) |
This function returns the current library version.
| none | No parameters. |
Example
| WOLFSSL_API word32 wolfSSL_lib_version_hex | ( | void | ) |
This function returns the current library version in hexadecimal notation.
| none | No parameters. |
Example
| WOLFSSL_API int wolfSSL_memrestore_session_cache | ( | const void * | mem, |
| int | sz ) |
This function restores the persistent session cache from memory.
| mem | a constant void pointer containing the source of the restoration. |
| sz | an integer representing the size of the memory buffer. |
Example
| WOLFSSL_API int wolfSSL_memsave_session_cache | ( | void * | mem, |
| int | sz ) |
This function persists session cache to memory.
| mem | a void pointer representing the destination for the memory copy, XMEMCPY(). |
| sz | an int type representing the size of mem. |
Example
| WOLFSSL_API int wolfSSL_negotiate | ( | WOLFSSL * | ssl | ) |
Performs the actual connect or accept based on the side of the SSL method. If called from the client side then an wolfSSL_connect() is done while a wolfSSL_accept() is performed if called from the server side.
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_peek | ( | WOLFSSL * | ssl, |
| void * | data, | ||
| int | sz ) |
This function copies sz bytes from the SSL session (ssl) internal read buffer into the buffer data. This function is identical to wolfSSL_read() except that the data in the internal SSL session receive buffer is not removed or modified. If necessary, like wolfSSL_read(), wolfSSL_peek() will negotiate an SSL/TLS session if the handshake has not already been performed yet by wolfSSL_connect() or wolfSSL_accept(). The SSL/TLS protocol uses SSL records which have a maximum size of 16kB (the max record size can be controlled by the MAX_RECORD_SIZE define in <wolfssl_root>/wolfssl/internal.h). As such, wolfSSL needs to read an entire SSL record internally before it is able to process and decrypt the record. Because of this, a call to wolfSSL_peek() will only be able to return the maximum buffer size which has been decrypted at the time of calling. There may be additional not-yet-decrypted data waiting in the internal wolfSSL receive buffer which will be retrieved and decrypted with the next call to wolfSSL_peek() / wolfSSL_read(). If sz is larger than the number of bytes in the internal read buffer, SSL_peek() will return the bytes available in the internal read buffer. If no bytes are buffered in the internal read buffer yet, a call to wolfSSL_peek() will trigger processing of the next record.
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
| data | buffer where wolfSSL_peek() will place data read. |
| sz | number of bytes to read into data. |
Example
| WOLFSSL_API int wolfSSL_pending | ( | WOLFSSL * | ssl | ) |
This function returns the number of bytes which are buffered and available in the SSL object to be read by wolfSSL_read().
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_PrintSessionStats | ( | void | ) |
This function prints the statistics from the session.
| none | No parameters. |
Example
| WOLFSSL_API int wolfSSL_read | ( | WOLFSSL * | ssl, |
| void * | data, | ||
| int | sz ) |
This function reads sz bytes from the SSL session (ssl) internal read buffer into the buffer data. The bytes read are removed from the internal receive buffer. If necessary wolfSSL_read() will negotiate an SSL/TLS session if the handshake has not already been performed yet by wolfSSL_connect() or wolfSSL_accept(). The SSL/TLS protocol uses SSL records which have a maximum size of 16kB (the max record size can be controlled by the MAX_RECORD_SIZE define in <wolfssl_root>/wolfssl/internal.h). As such, wolfSSL needs to read an entire SSL record internally before it is able to process and decrypt the record. Because of this, a call to wolfSSL_read() will only be able to return the maximum buffer size which has been decrypted at the time of calling. There may be additional not-yet-decrypted data waiting in the internal wolfSSL receive buffer which will be retrieved and decrypted with the next call to wolfSSL_read(). If sz is larger than the number of bytes in the internal read buffer, SSL_read() will return the bytes available in the internal read buffer. If no bytes are buffered in the internal read buffer yet, a call to wolfSSL_read() will trigger processing of the next record.
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
| data | buffer where wolfSSL_read() will place data read. |
| sz | number of bytes to read into data. |
Example
| WOLFSSL_API int wolfSSL_recv | ( | WOLFSSL * | ssl, |
| void * | data, | ||
| int | sz, | ||
| int | flags ) |
This function reads sz bytes from the SSL session (ssl) internal read buffer into the buffer data using the specified flags for the underlying recv operation. The bytes read are removed from the internal receive buffer. This function is identical to wolfSSL_read() except that it allows the application to set the recv flags for the underlying read operation. If necessary wolfSSL_recv() will negotiate an SSL/TLS session if the handshake has not already been performed yet by wolfSSL_connect() or wolfSSL_accept(). The SSL/TLS protocol uses SSL records which have a maximum size of 16kB (the max record size can be controlled by the MAX_RECORD_SIZE define in <wolfssl_root>/wolfssl/internal.h). As such, wolfSSL needs to read an entire SSL record internally before it is able to process and decrypt the record. Because of this, a call to wolfSSL_recv() will only be able to return the maximum buffer size which has been decrypted at the time of calling. There may be additional not-yet-decrypted data waiting in the internal wolfSSL receive buffer which will be retrieved and decrypted with the next call to wolfSSL_recv(). If sz is larger than the number of bytes in the internal read buffer, SSL_recv() will return the bytes available in the internal read buffer. If no bytes are buffered in the internal read buffer yet, a call to wolfSSL_recv() will trigger processing of the next record.
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
| data | buffer where wolfSSL_recv() will place data read. |
| sz | number of bytes to read into data. |
| flags | the recv flags to use for the underlying recv operation. |
Example
| WOLFSSL_API int wolfSSL_Rehandshake | ( | WOLFSSL * | ssl | ) |
This function executes a secure renegotiation handshake; this is user forced as wolfSSL discourages this functionality.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_restore_session_cache | ( | const char * | fname | ) |
This function restores the persistent session cache from file. It does not use memstore because of additional memory use.
| fname | a constant char pointer file input that will be read. |
Example
| WOLFSSL_API int wolfSSL_save_session_cache | ( | const char * | fname | ) |
This function persists the session cache to file. It doesn’t use memsave because of additional memory use.
| name | is a constant char pointer that points to a file for writing. |
Example
| WOLFSSL_API int wolfSSL_send | ( | WOLFSSL * | ssl, |
| const void * | data, | ||
| int | sz, | ||
| int | flags ) |
This function writes sz bytes from the buffer, data, to the SSL connection, ssl, using the specified flags for the underlying write operation. If necessary wolfSSL_send() will negotiate an SSL/TLS session if the handshake has not already been performed yet by wolfSSL_connect() or wolfSSL_accept(). wolfSSL_send() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_send() will return when the underlying I/O could not satisfy the needs of wolfSSL_send to continue. In this case, a call to wolfSSL_get_error() will yield either SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process must then repeat the call to wolfSSL_send() when the underlying I/O is ready. If the underlying I/O is blocking, wolfSSL_send() will only return once the buffer data of size sz has been completely written or an error occurred.
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
| data | data buffer to send to peer. |
| sz | size, in bytes, of data to be sent to peer. |
| flags | the send flags to use for the underlying send operation. |
Example
| WOLFSSL_API WOLFSSL_X509_CHAIN * wolfSSL_SESSION_get_peer_chain | ( | WOLFSSL_SESSION * | session | ) |
Returns the peer certificate chain from the WOLFSSL_SESSION struct.
| session | a pointer to a WOLFSSL_SESSION structure. |
Example
| WOLFSSL_API int wolfSSL_session_reused | ( | WOLFSSL * | ssl | ) |
This function returns the resuming member of the options struct. The flag indicates whether or not to reuse a session. If not, a new session must be established.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_set_jobject | ( | WOLFSSL * | ssl, |
| void * | objPtr ) |
This function sets the jObjectRef member of the WOLFSSL structure.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
| objPtr | a void pointer that will be set to jObjectRef. |
Example
| WOLFSSL_API int wolfSSL_set_SessionTicket | ( | WOLFSSL * | ssl, |
| const unsigned char * | buf, | ||
| word32 | bufSz ) |
This function sets the ticket member of the WOLFSSL_SESSION structure within the WOLFSSL struct. The buffer passed into the function is copied to memory.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
| buf | a byte pointer that gets loaded into the ticket member of the session structure. |
| bufSz | a word32 type that represents the size of the buffer. |
Example
| WOLFSSL_API void wolfSSL_SetIO_NetX | ( | WOLFSSL * | ssl, |
| NX_TCP_SOCKET * | nxsocket, | ||
| ULONG | waitoption ) |
This function sets the nxSocket and nxWait members of the nxCtx struct within the WOLFSSL structure.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
| nxSocket | a pointer to type NX_TCP_SOCKET that is set to the nxSocket member of the nxCTX structure. |
| waitOption | a ULONG type that is set to the nxWait member of the nxCtx structure. |
Example
| WOLFSSL_API unsigned char wolfSSL_SNI_Status | ( | WOLFSSL * | ssl, |
| unsigned char | type ) |
This function gets the status of an SNI object.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
| type | the SNI type. |
Example
| WOLFSSL_API int wolfSSL_UseSecureRenegotiation | ( | WOLFSSL * | ssl | ) |
This function forces secure renegotiation for the supplied WOLFSSL structure. This is not recommended.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_UseSessionTicket | ( | WOLFSSL * | ssl | ) |
Force provided WOLFSSL structure to use session ticket. The constant HAVE_SESSION_TICKET should be defined and the constant NO_WOLFSSL_CLIENT should not be defined to use this function.
| ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
| WOLFSSL_API int wolfSSL_write | ( | WOLFSSL * | ssl, |
| const void * | data, | ||
| int | sz ) |
This function writes sz bytes from the buffer, data, to the SSL connection, ssl. If necessary, wolfSSL_write() will negotiate an SSL/TLS session if the handshake has not already been performed yet by wolfSSL_connect() or wolfSSL_accept(). wolfSSL_write() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_write() will return when the underlying I/O could not satisfy the needs of wolfSSL_write() to continue. In this case, a call to wolfSSL_get_error() will yield either SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process must then repeat the call to wolfSSL_write() when the underlying I/O is ready. If the underlying I/O is blocking, wolfSSL_write() will only return once the buffer data of size sz has been completely written or an error occurred.
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
| data | data buffer which will be sent to peer. |
| sz | size, in bytes, of data to send to the peer (data). |
Example
| WOLFSSL_API int wolfSSL_writev | ( | WOLFSSL * | ssl, |
| const struct iovec * | iov, | ||
| int | iovcnt ) |
Simulates writev semantics but doesn’t actually do block at a time because of SSL_write() behavior and because front adds may be small. Makes porting into software that uses writev easier.
| ssl | pointer to the SSL session, created with wolfSSL_new(). |
| iov | array of I/O vectors to write |
| iovcnt | number of vectors in iov array. |
Example