From 95ea74a91e2855eb12db1822ee2e5e2cdeaf6e7a Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 9 Dec 2016 16:07:19 -0700 Subject: [PATCH] sanity checks and one function return type for better compatibility --- src/ssl.c | 10 +++++++++- wolfssl/ssl.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index b9ef03a54..6b05c120c 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -13376,6 +13376,10 @@ char* wolfSSL_CIPHER_description(WOLFSSL_CIPHER* cipher, char* in, int len) WOLFSSL_SESSION* wolfSSL_get1_session(WOLFSSL* ssl) { + if (ssl == NULL) { + return NULL; + } + /* sessions are stored statically, no need for reference count */ return wolfSSL_get_session(ssl); } @@ -14601,8 +14605,12 @@ WOLFSSL_API long wolfSSL_set_tlsext_status_ocsp_resp(WOLFSSL *s, unsigned char * } -unsigned long wolfSSL_get_verify_result(const WOLFSSL *ssl) +long wolfSSL_get_verify_result(const WOLFSSL *ssl) { + if (ssl == NULL) { + return SSL_FAILURE; + } + return ssl->peerVerifyRet; } diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index adc682391..c3ea3bd5c 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -729,7 +729,7 @@ WOLFSSL_API long wolfSSL_set_tlsext_status_ocsp_resp(WOLFSSL *s, unsigned char * WOLFSSL_API void wolfSSL_CONF_modules_unload(int all); WOLFSSL_API long wolfSSL_get_tlsext_status_exts(WOLFSSL *s, void *arg); -WOLFSSL_API unsigned long wolfSSL_get_verify_result(const WOLFSSL *ssl); +WOLFSSL_API long wolfSSL_get_verify_result(const WOLFSSL *ssl); #define WOLFSSL_DEFAULT_CIPHER_LIST "" /* default all */ #define WOLFSSL_RSA_F4 0x10001L