SSL_get_error
The SSL_get_error function returns information about why the previous Secure Sockets Layer (SSL) application programming interface (API) call resulted in an error return code.
Last updated
- Changed in 2019 (information only; no code change).
- Changed for PUT00.
Format
LIBS := CSSL
#include <openssl/ssl.h>
int SSL_get_error(SSL *ssl,int ret) - ssl
- A pointer to a token returned on the SSL_new call.
- ret
- The return code from the previous SSL API call.
Normal return
Returns one of the following
values:
- SSL_ERROR_NONE
- No error to report. This is set when the value of the ret parameter is greater than 0.
- SSL_ERROR_SSL
- An error occurred in the SSL library. The OpenSSL error queue contains more information about the error.
- SSL_ERROR_WANT_READ
- Processing was not completed successfully because there was no data available for reading, and the socket available for the SSL session is in nonblocking mode. Try the function again at a later time.
- SSL_ERROR_WANT_WRITE
- Processing was not completed successfully because the socket associated with the SSL session is blocked from sending data. Try the function again at a later time.
- SSL_ERROR_SYSCALL
- An I/O error occurred. The OpenSSL error queue might contain more information about the error. If the error queue is empty, the sock_errno function might provide more information about the error.
- SSL_ERROR_ZERO_RETURN
- The remote application shut down the SSL connection normally. Issue the SSL_shutdown function to shut down data flow for an SSL session.
- SSL_ERROR_WANT_CONNECT
- Processing was not completed successfully because the SSL session was in the process of starting the session, but it has not completed yet. Try the function again at a later time.
Error return
None.
Programming considerations
- To use this function, you must include the library that is specified in the prototype in your makefile.
- If an SSL API
call results in an error return code, issue the SSL_get_error function
for the following functions to obtain the reason for the error:
- SSL_accept
- SSL_connect
- SSL_read
- SSL_shutdown
- SSL_write.
- Do not use errno or the sock_errno function to determine the cause of an SSL API error. Instead, you must use the SSL_get_error function. However, if you received the SSL_ERROR_SYSCALL return code after issuing the SSL_get_error function, it is appropriate to use the sock_errno function.
Examples
For sample SSL applications, see SSL examples.