Fixes for some async issues. Fixes an async issue with BuildMessage. Fixes for PKCS7 tests to not use async since it is not supported.

This commit is contained in:
David Garske 2018-06-20 17:30:56 -07:00
parent 71606dde45
commit 1cb5bbf8ea
2 changed files with 14 additions and 5 deletions

View File

@ -13370,11 +13370,11 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input,
{
/* catch mistaken sizeOnly parameter */
if (!sizeOnly && (output == NULL || input == NULL) ) {
return BAD_FUNC_ARG;
ERROR_OUT(BAD_FUNC_ARG, exit_buildmsg);
}
if (sizeOnly && (output || input) ) {
WOLFSSL_MSG("BuildMessage w/sizeOnly doesn't need input/output");
return BAD_FUNC_ARG;
ERROR_OUT(BAD_FUNC_ARG, exit_buildmsg);
}
ssl->options.buildMsgState = BUILD_MSG_SIZE;
@ -13564,6 +13564,9 @@ exit_buildmsg:
/* Final cleanup */
FreeBuildMsgArgs(ssl, args);
#ifdef WOLFSSL_ASYNC_CRYPT
ssl->async.freeArgs = NULL;
#endif
return ret;
#endif /* !WOLFSSL_NO_TLS12 */

View File

@ -9634,7 +9634,7 @@ static int rsa_certgen_test(RsaKey* key, RsaKey* keypub, WC_RNG* rng, byte* tmp)
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(myCert, der, FOURK_BUF, key, rng);
@ -17946,8 +17946,13 @@ static int pkcs7enveloped_run_vectors(byte* rsaCert, word32 rsaCertSz,
testSz = sizeof(testVectors) / sizeof(pkcs7EnvelopedVector);
for (i = 0; i < testSz; i++) {
ret = wc_PKCS7_Init(&pkcs7, HEAP_HINT, devId);
ret = wc_PKCS7_Init(&pkcs7, HEAP_HINT,
#ifdef WOLFSSL_ASYNC_CRYPT
INVALID_DEVID /* async PKCS7 is not supported */
#else
devId
#endif
);
if (ret != 0)
return -9214;
@ -18494,6 +18499,7 @@ static int pkcs7signed_run_vectors(byte* rsaCert, word32 rsaCertSz,
for (i = 0; i < testSz; i++) {
pkcs7.heap = HEAP_HINT;
pkcs7.devId = INVALID_DEVID;
ret = wc_PKCS7_InitWithCert(&pkcs7, testVectors[i].cert,
(word32)testVectors[i].certSz);