wolfssl icon indicating copy to clipboard operation
wolfssl copied to clipboard

Handle WC_PENDING_E from ticketEncCb in DoClientTicket properly.

Open haydenroche5 opened this issue 3 years ago • 0 comments

Description

ticketEncCb can return WC_PENDING_E. If it does in DoClientTicket, we need to propagate this up to the calling function (e.g. DoPreSharedKeys), rather than treating it as a failure.

Fixes ZD #14420.

Testing

I tested this with config

./configure --enable-all --enable-asynccrypt CFLAGS="-DWOLFSSL_NO_DEF_TICKET_ENC_CB"

and by running the following experiment

./examples/server/server -v 4 -r &
./examples/client/client -v 4 -r

and adding the following async simulation code to wc_ChaCha20Poly1305_Decrypt:

#ifdef WOLFSSL_ASYNC_CRYPT
    static int testAsync = 0;
    if ((testAsync++ % 2) == 0) {
        return WC_PENDING_E;
    }
#endif

Prior to these changes, you can see that the WC_PENDING_E will not be handled properly in DoClientTicket (using gdb). A full TLS handshake proceeds from there. With this commit, running the same experiment shows the pending error being handled properly.

Checklist

  • [ ] added tests
  • [ ] updated/added doxygen
  • [ ] updated appropriate READMEs
  • [ ] Updated manual and documentation

haydenroche5 avatar Sep 15 '22 18:09 haydenroche5