Cleanup to use WANT_READ instead of async WC_PENDING_E for non-blocking OCSP and CRL.

This commit is contained in:
David Garske 2017-06-02 10:35:26 -07:00
parent b3a85bc2c7
commit c55575665f
3 changed files with 11 additions and 9 deletions

View File

@ -350,7 +350,7 @@ int CheckCertCRL(WOLFSSL_CRL* crl, DecodedCert* cert)
ret = crl->crlIOCb(crl, (const char*)cert->extCrlInfo,
cert->extCrlInfoSz);
if (ret == WOLFSSL_CBIO_ERR_WANT_READ) {
ret = WC_PENDING_E;
ret = WANT_READ;
}
else if (ret >= 0) {
/* try again */

View File

@ -7693,8 +7693,8 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx, word32 totalSz
ret = CheckCertOCSP(ssl->ctx->cm->ocsp, args->dCert,
NULL);
#ifdef WOLFSSL_ASYNC_CRYPT
/* Handle WC_PENDING_E */
if (ret == WC_PENDING_E) {
/* non-blocking socket re-entry requires async */
if (ret == WANT_READ) {
goto exit_ppc;
}
#endif
@ -7713,7 +7713,8 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx, word32 totalSz
WOLFSSL_MSG("Doing Non Leaf CRL check");
ret = CheckCertCRL(ssl->ctx->cm->crl, args->dCert);
#ifdef WOLFSSL_ASYNC_CRYPT
if (ret == WC_PENDING_E) {
/* non-blocking socket re-entry requires async */
if (ret == WANT_READ) {
goto exit_ppc;
}
#endif
@ -7859,7 +7860,8 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx, word32 totalSz
ret = CheckCertOCSP(ssl->ctx->cm->ocsp, args->dCert,
NULL);
#ifdef WOLFSSL_ASYNC_CRYPT
if (ret == WC_PENDING_E) {
/* non-blocking socket re-entry requires async */
if (ret == WANT_READ) {
goto exit_ppc;
}
#endif
@ -7879,7 +7881,8 @@ int ProcessPeerCerts(WOLFSSL* ssl, byte* input, word32* inOutIdx, word32 totalSz
WOLFSSL_MSG("Doing Leaf CRL check");
ret = CheckCertCRL(ssl->ctx->cm->crl, args->dCert);
#ifdef WOLFSSL_ASYNC_CRYPT
if (ret == WC_PENDING_E) {
/* non-blocking socket re-entry requires async */
if (ret == WANT_READ) {
goto exit_ppc;
}
#endif
@ -8289,8 +8292,7 @@ exit_ppc:
WOLFSSL_LEAVE("ProcessPeerCerts", ret);
#ifdef WOLFSSL_ASYNC_CRYPT
/* Handle WC_PENDING_E */
if (ret == WC_PENDING_E) {
if (ret == WC_PENDING_E || ret == WANT_READ) {
/* Mark message as not recevied so it can process again */
ssl->msgsReceived.got_certificate = 0;

View File

@ -446,7 +446,7 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
request, requestSz, &response);
}
if (responseSz == WOLFSSL_CBIO_ERR_WANT_READ) {
ret = WC_PENDING_E;
ret = WANT_READ;
}
XFREE(request, ocsp->cm->heap, DYNAMIC_TYPE_OCSP);