aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/vtls/openssl.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index 5c4e34e91..35489f845 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -164,22 +164,40 @@ static unsigned long OpenSSL_version_num(void)
static const char *SSL_ERROR_to_str(int err)
{
- static const char * const str[] = {
- "SSL_ERROR_NONE", /* 0 */
- "SSL_ERROR_SSL", /* 1 */
- "SSL_ERROR_WANT_READ", /* 2 */
- "SSL_ERROR_WANT_WRITE", /* 3 */
- "SSL_ERROR_WANT_X509_LOOKUP", /* 4 */
- "SSL_ERROR_SYSCALL", /* 5 */
- "SSL_ERROR_ZERO_RETURN", /* 6 */
- "SSL_ERROR_WANT_CONNECT", /* 7 */
- "SSL_ERROR_WANT_ACCEPT", /* 8 */
- "SSL_ERROR_WANT_ASYNC", /* 9 */
- "SSL_ERROR_WANT_ASYNC_JOB", /* 10 */
- "SSL_ERROR_WANT_EARLY", /* 11 */
- };
- return ((err >= 0 && err < (int)(sizeof str / sizeof str[0])) ?
- str[err] : "SSL_ERROR unknown");
+ switch(err) {
+ case SSL_ERROR_NONE:
+ return "SSL_ERROR_NONE";
+ case SSL_ERROR_SSL:
+ return "SSL_ERROR_SSL";
+ case SSL_ERROR_WANT_READ:
+ return "SSL_ERROR_WANT_READ";
+ case SSL_ERROR_WANT_WRITE:
+ return "SSL_ERROR_WANT_WRITE";
+ case SSL_ERROR_WANT_X509_LOOKUP:
+ return "SSL_ERROR_WANT_X509_LOOKUP";
+ case SSL_ERROR_SYSCALL:
+ return "SSL_ERROR_SYSCALL";
+ case SSL_ERROR_ZERO_RETURN:
+ return "SSL_ERROR_ZERO_RETURN";
+ case SSL_ERROR_WANT_CONNECT:
+ return "SSL_ERROR_WANT_CONNECT";
+ case SSL_ERROR_WANT_ACCEPT:
+ return "SSL_ERROR_WANT_ACCEPT";
+#if defined(SSL_ERROR_WANT_ASYNC)
+ case SSL_ERROR_WANT_ASYNC:
+ return "SSL_ERROR_WANT_ASYNC";
+#endif
+#if defined(SSL_ERROR_WANT_ASYNC_JOB)
+ case SSL_ERROR_WANT_ASYNC_JOB:
+ return "SSL_ERROR_WANT_ASYNC_JOB";
+#endif
+#if defined(SSL_ERROR_WANT_EARLY)
+ case SSL_ERROR_WANT_EARLY:
+ return "SSL_ERROR_WANT_EARLY";
+#endif
+ default:
+ return "SSL_ERROR unknown";
+ }
}
static int passwd_callback(char *buf, int num, int encrypting,