return value from FailTestCallBack to prevent NetBSD noreturn warning

This commit is contained in:
Chris Conlon
2020-06-03 14:45:31 -06:00
parent 504b887851
commit 0b9d06e529

View File

@ -4869,16 +4869,21 @@ static void test_wolfSSL_PKCS12(void)
#if !defined(NO_FILESYSTEM) && !defined(NO_ASN) && defined(HAVE_PKCS8) \ #if !defined(NO_FILESYSTEM) && !defined(NO_ASN) && defined(HAVE_PKCS8) \
&& defined(HAVE_ECC) && defined(WOLFSSL_ENCRYPTED_KEYS) && defined(HAVE_ECC) && defined(WOLFSSL_ENCRYPTED_KEYS)
/* used to keep track if FailTestCallback was called */
static int failTestCallbackCalled = 0;
static WC_INLINE int FailTestCallBack(char* passwd, int sz, int rw, void* userdata) static WC_INLINE int FailTestCallBack(char* passwd, int sz, int rw, void* userdata)
{ {
(void)passwd; (void)passwd;
(void)sz; (void)sz;
(void)rw; (void)rw;
(void)userdata; (void)userdata;
Fail(("Password callback should not be called by default"),
("Password callback was called without attempting " /* mark called, test_wolfSSL_no_password_cb() will check and fail if set */
"to first decipher private key without password.")); failTestCallbackCalled = 1;
return 0;
return -1;
} }
#endif #endif
@ -4918,6 +4923,12 @@ static void test_wolfSSL_no_password_cb(void)
wolfSSL_CTX_free(ctx); wolfSSL_CTX_free(ctx);
if (failTestCallbackCalled != 0) {
Fail(("Password callback should not be called by default"),
("Password callback was called without attempting "
"to first decipher private key without password."));
}
printf(resultFmt, passed); printf(resultFmt, passed);
#endif #endif
} }