My Project
|
Functions | |
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). More... | |
char * | wolfSSL_get_cipher_list (int priority) |
Get the name of cipher at priority level passed in. More... | |
int | wolfSSL_get_ciphers (char *buf, int len) |
This function gets the ciphers enabled in wolfSSL. More... | |
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. More... | |
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. More... | |
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. More... | |
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(). When using (D)TLSv1.3 and early data feature is compiled in, this function progresses the handshake only up to the point when it is possible to send data. Next invocations of wolfSSL_Connect()/wolfSSL_Accept()/wolfSSL_read() will complete the handshake. 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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int | wolfSSL_get_alert_history (WOLFSSL *ssl, WOLFSSL_ALERT_HISTORY *h) |
This function gets the alert history. More... | |
WOLFSSL_SESSION * | wolfSSL_get_session (WOLFSSL *ssl) |
When NO_SESSION_CACHE_REF is defined this function returns a pointer to the current session (WOLFSSL_SESSION) used in ssl. This function returns a non-persistent pointer to the WOLFSSL_SESSION object. The pointer returned will be freed when wolfSSL_free is called. This call should only be used to inspect or modify the current session. For session resumption it is recommended to use wolfSSL_get1_session(). For backwards compatibility when NO_SESSION_CACHE_REF is not defined this function returns a persistent session object pointer that is stored in the local cache. The cache size is finite and there is a risk that the session object will be overwritten by another ssl connection by the time the application calls wolfSSL_set_session() on it. It is recommended to define NO_SESSION_CACHE_REF in your application and to use wolfSSL_get1_session() for session resumption. More... | |
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. More... | |
int | wolfSSL_GetSessionIndex (WOLFSSL *ssl) |
This function gets the session index of the WOLFSSL structure. More... | |
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. More... | |
WOLFSSL_X509_CHAIN * | wolfSSL_SESSION_get_peer_chain (WOLFSSL_SESSION *session) |
Returns the peer certificate chain from the WOLFSSL_SESSION struct. More... | |
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(). More... | |
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. More... | |
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. More... | |
int | wolfSSL_memsave_session_cache (void *mem, int sz) |
This function persists session cache to memory. More... | |
int | wolfSSL_memrestore_session_cache (const void *mem, int sz) |
This function restores the persistent session cache from memory. More... | |
int | wolfSSL_get_session_cache_memsize (void) |
This function returns how large the session cache save buffer should be. More... | |
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. More... | |
const char * | wolfSSL_get_version (WOLFSSL *ssl) |
Returns the SSL version being used as a string. More... | |
int | wolfSSL_get_current_cipher_suite (WOLFSSL *ssl) |
Returns the current cipher suit an ssl session is using. More... | |
WOLFSSL_CIPHER * | wolfSSL_get_current_cipher (WOLFSSL *ssl) |
This function returns a pointer to the current cipher in the ssl session. More... | |
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. More... | |
const char * | wolfSSL_get_cipher (WOLFSSL *) |
This function matches the cipher suite in the SSL object with the available suites. More... | |
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. More... | |
long | wolfSSL_BIO_set_fd (WOLFSSL_BIO *b, int fd, int flag) |
Sets the file descriptor for bio to use. More... | |
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. More... | |
WOLFSSL_BIO_METHOD * | wolfSSL_BIO_s_socket (void) |
This is used to get a BIO_SOCKET type WOLFSSL_BIO_METHOD. More... | |
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. More... | |
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. More... | |
int | wolfSSL_BIO_ctrl_reset_read_request (WOLFSSL_BIO *bio) |
This is used to set the read request flag back to 0. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
long | wolfSSL_BIO_get_mem_ptr (WOLFSSL_BIO *bio, WOLFSSL_BUF_MEM **m) |
This is a getter function for WOLFSSL_BIO memory pointer. More... | |
const char * | wolfSSL_lib_version (void) |
This function returns the current library version. More... | |
word32 | wolfSSL_lib_version_hex (void) |
This function returns the current library version in hexadecimal notation. More... | |
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. More... | |
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. More... | |
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. More... | |
unsigned char | wolfSSL_SNI_Status (WOLFSSL *ssl, unsigned char type) |
This function gets the status of an SNI object. More... | |
int | wolfSSL_UseSecureRenegotiation (WOLFSSL *ssl) |
This function forces secure renegotiation for the supplied WOLFSSL structure. This is not recommended. More... | |
int | wolfSSL_Rehandshake (WOLFSSL *ssl) |
This function executes a secure renegotiation handshake; this is user forced as wolfSSL discourages this functionality. More... | |
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. More... | |
int | wolfSSL_get_SessionTicket (WOLFSSL *ssl, unsigned char *buf, word32 *bufSz) |
This function copies the ticket member of the Session structure to the buffer. More... | |
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. More... | |
int | wolfSSL_PrintSessionStats (void) |
This function prints the statistics from the session. More... | |
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. More... | |
long | wolfSSL_BIO_set_fp (WOLFSSL_BIO *bio, XFILE fp, int c) |
This is used to set the internal file pointer for a BIO. More... | |
long | wolfSSL_BIO_get_fp (WOLFSSL_BIO *bio, XFILE *fp) |
This is used to get the internal file pointer for a BIO. More... | |
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. More... | |
int | wolfSSL_set_jobject (WOLFSSL *ssl, void *objPtr) |
This function sets the jObjectRef member of the WOLFSSL structure. More... | |
void * | wolfSSL_get_jobject (WOLFSSL *ssl) |
This function returns the jObjectRef member of the WOLFSSL structure. More... | |
int | wolfSSL_connect (WOLFSSL *ssl) |
This function is called on the client side and initiates an SSL/TLS handshake with a server. When this function is called, the underlying communication channel has already been set up. wolfSSL_connect() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_connect() will return when the underlying I/O could not satisfy the needs of wolfSSL_connect 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() 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() will only return once the handshake has been finished or an error occurred. wolfSSL takes a different approach to certificate verification than OpenSSL does. The default policy for the client is to verify the server, this means that if you don't load CAs to verify the server you'll get a connect error, unable to verify (-155). It you want to mimic OpenSSL behavior of having SSL_connect succeed even if verifying the server fails and reducing security you can do this by calling: SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); before calling SSL_new(); Though it's not recommended. More... | |
int | wolfSSL_update_keys (WOLFSSL *ssl) |
This function is called on a TLS v1.3 client or server wolfSSL to force the rollover of keys. A KeyUpdate message is sent to the peer and new keys are calculated for encryption. The peer will send back a KeyUpdate message and the new decryption keys will then be calculated. This function can only be called after a handshake has been completed. More... | |
int | wolfSSL_key_update_response (WOLFSSL *ssl, int *required) |
This function is called on a TLS v1.3 client or server wolfSSL to determine whether a rollover of keys is in progress. When wolfSSL_update_keys() is called, a KeyUpdate message is sent and the encryption key is updated. The decryption key is updated when the response is received. More... | |
int | wolfSSL_request_certificate (WOLFSSL *ssl) |
This function requests a client certificate from the TLS v1.3 client. This is useful when a web server is serving some pages that require client authentication and others that don't. A maximum of 256 requests can be sent on a connection. More... | |
int | wolfSSL_connect_TLSv13 (WOLFSSL *) |
This function is called on the client side and initiates a TLS v1.3 handshake with a server. When this function is called, the underlying communication channel has already been set up. wolfSSL_connect() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_connect() will return when the underlying I/O could not satisfy the needs of wolfSSL_connect 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() 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() will only return once the handshake has been finished or an error occurred. wolfSSL takes a different approach to certificate verification than OpenSSL does. The default policy for the client is to verify the server, this means that if you don't load CAs to verify the server you'll get a connect error, unable to verify (-155). It you want to mimic OpenSSL behavior of having SSL_connect succeed even if verifying the server fails and reducing security you can do this by calling: SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); before calling SSL_new(); Though it's not recommended. More... | |
wolfSSL_accept_TLSv13 (WOLFSSL *ssl) | |
This function is called on the server side and waits for a SSL/TLS 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. Call this function when expecting a TLS v1.3 connection though older version ClientHello messages are supported. More... | |
int | wolfSSL_write_early_data (WOLFSSL *ssl, const void *data, int sz, int *outSz) |
This function writes early data to the server on resumption. Call this function instead of wolfSSL_connect() or wolfSSL_connect_TLSv13() to connect to the server and send the data in the handshake. This function is only used with clients. More... | |
int | wolfSSL_read_early_data (WOLFSSL *ssl, void *data, int sz, int *outSz) |
This function reads any early data from a client on resumption. Call this function instead of wolfSSL_accept() or wolfSSL_accept_TLSv13() to accept a client and read any early data in the handshake. The function should be invoked until wolfSSL_is_init_finished() returns true. Early data may be sent by the client in multiple messages. If there is no early data then the handshake will be processed as normal. This function is only used with servers. More... | |
void * | wolfSSL_GetIOReadCtx (WOLFSSL *ssl) |
This function returns the IOCB_ReadCtx member of the WOLFSSL struct. More... | |
void * | wolfSSL_GetIOWriteCtx (WOLFSSL *ssl) |
This function returns the IOCB_WriteCtx member of the WOLFSSL structure. More... | |
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. More... | |
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.
ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
wolfSSL_accept_TLSv13 | ( | WOLFSSL * | ssl | ) |
This function is called on the server side and waits for a SSL/TLS 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. Call this function when expecting a TLS v1.3 connection though older version ClientHello messages are supported.
ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
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
int wolfSSL_BIO_ctrl_reset_read_request | ( | WOLFSSL_BIO * | bio | ) |
This is used to set the read request flag back to 0.
bio | WOLFSSL_BIO structure to set read request flag. |
Example
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
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
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
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
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
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
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
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_BIO_METHOD* wolfSSL_BIO_s_socket | ( | void | ) |
This is used to get a BIO_SOCKET type WOLFSSL_BIO_METHOD.
none | No parameters. |
Example
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
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
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
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
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
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
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
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
int wolfSSL_connect | ( | WOLFSSL * | ssl | ) |
This function is called on the client side and initiates an SSL/TLS handshake with a server. When this function is called, the underlying communication channel has already been set up. wolfSSL_connect() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_connect() will return when the underlying I/O could not satisfy the needs of wolfSSL_connect 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() 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() will only return once the handshake has been finished or an error occurred. wolfSSL takes a different approach to certificate verification than OpenSSL does. The default policy for the client is to verify the server, this means that if you don't load CAs to verify the server you'll get a connect error, unable to verify (-155). It you want to mimic OpenSSL behavior of having SSL_connect succeed even if verifying the server fails and reducing security you can do this by calling: SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); before calling SSL_new(); Though it's not recommended.
ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
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
int wolfSSL_connect_TLSv13 | ( | WOLFSSL * | ) |
This function is called on the client side and initiates a TLS v1.3 handshake with a server. When this function is called, the underlying communication channel has already been set up. wolfSSL_connect() works with both blocking and non-blocking I/O. When the underlying I/O is non-blocking, wolfSSL_connect() will return when the underlying I/O could not satisfy the needs of wolfSSL_connect 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() 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() will only return once the handshake has been finished or an error occurred. wolfSSL takes a different approach to certificate verification than OpenSSL does. The default policy for the client is to verify the server, this means that if you don't load CAs to verify the server you'll get a connect error, unable to verify (-155). It you want to mimic OpenSSL behavior of having SSL_connect succeed even if verifying the server fails and reducing security you can do this by calling: SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); before calling SSL_new(); Though it's not recommended.
ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
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
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
const char* wolfSSL_get_cipher | ( | WOLFSSL * | ) |
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
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
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
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_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
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
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.
ssl | pointer to the SSL session, created with wolfSSL_new(). |
Example
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_SESSION* wolfSSL_get_session | ( | WOLFSSL * | ssl | ) |
When NO_SESSION_CACHE_REF is defined this function returns a pointer to the current session (WOLFSSL_SESSION) used in ssl. This function returns a non-persistent pointer to the WOLFSSL_SESSION object. The pointer returned will be freed when wolfSSL_free is called. This call should only be used to inspect or modify the current session. For session resumption it is recommended to use wolfSSL_get1_session(). For backwards compatibility when NO_SESSION_CACHE_REF is not defined this function returns a persistent session object pointer that is stored in the local cache. The cache size is finite and there is a risk that the session object will be overwritten by another ssl connection by the time the application calls wolfSSL_set_session() on it. It is recommended to define NO_SESSION_CACHE_REF in your application and to use wolfSSL_get1_session() for session resumption.
ssl | pointer to the SSL session, created with wolfSSL_new(). |
Example
int wolfSSL_get_session_cache_memsize | ( | void | ) |
This function returns how large the session cache save buffer should be.
none | No parameters. |
Example
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
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
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
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
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
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
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
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
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
int wolfSSL_key_update_response | ( | WOLFSSL * | ssl, |
int * | required | ||
) |
This function is called on a TLS v1.3 client or server wolfSSL to determine whether a rollover of keys is in progress. When wolfSSL_update_keys() is called, a KeyUpdate message is sent and the encryption key is updated. The decryption key is updated when the response is received.
[in] | ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
[out] | required | 0 when no key update response required. 1 when no key update response required. |
Example
const char* wolfSSL_lib_version | ( | void | ) |
This function returns the current library version.
none | No parameters. |
Example
word32 wolfSSL_lib_version_hex | ( | void | ) |
This function returns the current library version in hexadecimal notation.
none | No parameters. |
Example
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
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
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
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
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().
ssl | pointer to the SSL session, created with wolfSSL_new(). |
Example
int wolfSSL_PrintSessionStats | ( | void | ) |
This function prints the statistics from the session.
none | No parameters. |
Example
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
int wolfSSL_read_early_data | ( | WOLFSSL * | ssl, |
void * | data, | ||
int | sz, | ||
int * | outSz | ||
) |
This function reads any early data from a client on resumption. Call this function instead of wolfSSL_accept() or wolfSSL_accept_TLSv13() to accept a client and read any early data in the handshake. The function should be invoked until wolfSSL_is_init_finished() returns true. Early data may be sent by the client in multiple messages. If there is no early data then the handshake will be processed as normal. This function is only used with servers.
[in,out] | ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
[out] | data | a buffer to hold the early data read from client. |
[in] | sz | size of the buffer in bytes. |
[out] | outSz | number of bytes of early data read. |
Example
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
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
int wolfSSL_request_certificate | ( | WOLFSSL * | ssl | ) |
This function requests a client certificate from the TLS v1.3 client. This is useful when a web server is serving some pages that require client authentication and others that don't. A maximum of 256 requests can be sent on a connection.
[in,out] | ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
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
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.
fname | is a constant char pointer that points to a file for writing. |
Example
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_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
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
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
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
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
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
int wolfSSL_update_keys | ( | WOLFSSL * | ssl | ) |
This function is called on a TLS v1.3 client or server wolfSSL to force the rollover of keys. A KeyUpdate message is sent to the peer and new keys are calculated for encryption. The peer will send back a KeyUpdate message and the new decryption keys will then be calculated. This function can only be called after a handshake has been completed.
[in,out] | ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
Example
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
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
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(). When using (D)TLSv1.3 and early data feature is compiled in, this function progresses the handshake only up to the point when it is possible to send data. Next invocations of wolfSSL_Connect()/wolfSSL_Accept()/wolfSSL_read() will complete the handshake. 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
int wolfSSL_write_early_data | ( | WOLFSSL * | ssl, |
const void * | data, | ||
int | sz, | ||
int * | outSz | ||
) |
This function writes early data to the server on resumption. Call this function instead of wolfSSL_connect() or wolfSSL_connect_TLSv13() to connect to the server and send the data in the handshake. This function is only used with clients.
[in,out] | ssl | a pointer to a WOLFSSL structure, created using wolfSSL_new(). |
[in] | data | the buffer holding the early data to write to server. |
[in] | sz | the amount of early data to write in bytes. |
[out] | outSz | the amount of early data written in bytes. |
Example
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