Refactor async logic in bssl_shim slightly. Move the state to TestState rather than passing pointers to them everywhere. Also move SSL_read and SSL_write retry loops into helper functions so they aren't repeated everywhere. This also makes the SSL_write calls all consistently account for partial writes. Change-Id: I9bc083a03da6a77ab2fc03c29d4028435fc02620 Reviewed-on: https://boringssl-review.googlesource.com/4214 Reviewed-by: Adam Langley <agl@google.com>