Commit 167e2483 authored by Anirudh Ramachandran's avatar Anirudh Ramachandran Committed by facebook-github-bot-0

ECDSA async/offloading support for proxygen

Summary: Minor changes to AsyncSSLSocket for async crypto

Reviewed By: siyengar

Differential Revision: D2516765

fb-gh-sync-id: 354baeb94e6f63e8d5cdf8455ff5ca49a6aa479c
shipit-source-id: 354baeb94e6f63e8d5cdf8455ff5ca49a6aa479c
parent 7488256f
......@@ -614,7 +614,7 @@ void AsyncSSLSocket::setServerName(std::string serverName) noexcept {
void AsyncSSLSocket::timeoutExpired() noexcept {
if (state_ == StateEnum::ESTABLISHED &&
(sslState_ == STATE_CACHE_LOOKUP ||
sslState_ == STATE_RSA_ASYNC_PENDING)) {
sslState_ == STATE_ASYNC_PENDING)) {
sslState_ = STATE_ERROR;
// We are expecting a callback in restartSSLAccept. The cache lookup
// and rsa-call necessarily have pointers to this ssl socket, so delay
......@@ -919,12 +919,18 @@ bool AsyncSSLSocket::willBlock(int ret, int *errorOut) noexcept {
// The timeout (if set) keeps running here
return true;
#endif
} else if (0
#ifdef SSL_ERROR_WANT_RSA_ASYNC_PENDING
} else if (error == SSL_ERROR_WANT_RSA_ASYNC_PENDING) {
|| error == SSL_ERROR_WANT_RSA_ASYNC_PENDING
#endif
#ifdef SSL_ERROR_WANT_ECDSA_ASYNC_PENDING
|| error == SSL_ERROR_WANT_ECDSA_ASYNC_PENDING
#endif
) {
// Our custom openssl function has kicked off an async request to do
// modular exponentiation. When that call returns, a callback will
// rsa/ecdsa private key operation. When that call returns, a callback will
// be invoked that will re-call handleAccept.
sslState_ = STATE_RSA_ASYNC_PENDING;
sslState_ = STATE_ASYNC_PENDING;
// Unregister for all events while blocked here
updateEventRegistration(
......@@ -934,7 +940,6 @@ bool AsyncSSLSocket::willBlock(int ret, int *errorOut) noexcept {
// The timeout (if set) keeps running here
return true;
#endif
} else {
// SSL_ERROR_ZERO_RETURN is processed here so we can get some detail
// in the log
......@@ -983,7 +988,7 @@ AsyncSSLSocket::restartSSLAccept()
DestructorGuard dg(this);
assert(
sslState_ == STATE_CACHE_LOOKUP ||
sslState_ == STATE_RSA_ASYNC_PENDING ||
sslState_ == STATE_ASYNC_PENDING ||
sslState_ == STATE_ERROR ||
sslState_ == STATE_CLOSED
);
......
......@@ -347,7 +347,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
STATE_UNENCRYPTED,
STATE_ACCEPTING,
STATE_CACHE_LOOKUP,
STATE_RSA_ASYNC_PENDING,
STATE_ASYNC_PENDING,
STATE_CONNECTING,
STATE_ESTABLISHED,
STATE_REMOTE_CLOSED, /// remote end closed; we can still write
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment