Fixes for asynchronous support in v4.1:

* Fixes PK callback null dereference.
* Fixes `DoCertificateVerify` verify handling.
* Fixes build issue with API tests.
This commit is contained in:
David Garske 2019-07-16 11:56:02 -07:00
parent b4765a5c9e
commit 7b021d68c3
2 changed files with 19 additions and 9 deletions

View File

@ -3366,9 +3366,11 @@ int RsaSign(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out,
#ifdef WOLFSSL_ASYNC_CRYPT
/* initialize event */
ret = wolfSSL_AsyncInit(ssl, &key->asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
if (ret != 0)
return ret;
if (key) {
ret = wolfSSL_AsyncInit(ssl, &key->asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
if (ret != 0)
return ret;
}
#endif
#if defined(WC_RSA_PSS)
@ -3408,7 +3410,7 @@ int RsaSign(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out,
/* Handle async pending response */
#ifdef WOLFSSL_ASYNC_CRYPT
if (ret == WC_PENDING_E) {
if (key && ret == WC_PENDING_E) {
ret = wolfSSL_AsyncPush(ssl, &key->asyncDev);
}
#endif /* WOLFSSL_ASYNC_CRYPT */
@ -3759,9 +3761,11 @@ int EccSign(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out,
#ifdef WOLFSSL_ASYNC_CRYPT
/* initialize event */
ret = wolfSSL_AsyncInit(ssl, &key->asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
if (ret != 0)
return ret;
if (key) {
ret = wolfSSL_AsyncInit(ssl, &key->asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
if (ret != 0)
return ret;
}
#endif
#if defined(HAVE_PK_CALLBACKS)
@ -3778,7 +3782,7 @@ int EccSign(WOLFSSL* ssl, const byte* in, word32 inSz, byte* out,
/* Handle async pending response */
#ifdef WOLFSSL_ASYNC_CRYPT
if (ret == WC_PENDING_E) {
if (key && ret == WC_PENDING_E) {
ret = wolfSSL_AsyncPush(ssl, &key->asyncDev);
}
#endif /* WOLFSSL_ASYNC_CRYPT */
@ -24707,6 +24711,12 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
}
#endif /* HAVE_ED25519 && !NO_ED25519_CLIENT_AUTH */
#ifdef WOLFSSL_ASYNC_CRYPT
/* handle async pending */
if (ret == WC_PENDING_E)
goto exit_dcv;
#endif
/* Check for error */
if (ret != 0) {
ret = SIG_VERIFY_E;

View File

@ -22542,7 +22542,7 @@ static void test_wolfSSL_DC_cert(void)
ret = 0;
do {
#if defined(WOLFSSL_ASYNC_CRYPT)
ret = wc_AsyncWait(ret, &key->asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
ret = wc_AsyncWait(ret, &key.asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
#endif
if (ret >= 0) {
ret = wc_MakeSelfCert(&cert, der, FOURK_BUF, &key, &rng);