// The timeout (if set) keeps running here
return true;
#endif
- } else if (0
+ } else if ((0
#ifdef 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
// rsa/ecdsa private key operation. When that call returns, a callback will
// be invoked that will re-call handleAccept.
}
void OpenSSLUtils::setSSLInitialCtx(SSL* ssl, SSL_CTX* ctx) {
+ (void)ssl;
+ (void)ctx;
#if !FOLLY_OPENSSL_IS_110 && !defined(OPENSSL_NO_TLSEXT)
if (ssl) {
ssl->initial_ctx = ctx;
}
SSL_CTX* OpenSSLUtils::getSSLInitialCtx(SSL* ssl) {
+ (void)ssl;
#if !FOLLY_OPENSSL_IS_110 && !defined(OPENSSL_NO_TLSEXT)
if (ssl) {
return ssl->initial_ctx;
#include <array>
#include <folly/io/async/AsyncSocketException.h>
+#include <folly/io/async/SSLContext.h>
#include <folly/io/async/ssl/SSLErrors.h>
#include <folly/portability/GTest.h>
TEST(AsyncSocketException, SSLExceptionType) {
{
+ // Initiailzes OpenSSL everything. Else some of the calls will block
+ folly::SSLContext::initializeOpenSSL();
SSLException eof(SSL_ERROR_ZERO_RETURN, 0, 0, 0);
EXPECT_EQ(eof.getType(), AsyncSocketException::END_OF_FILE);
return ASN1_STRING_data((ASN1_STRING*)x);
}
-EVP_MD_CTX* EVP_MD_CTX_new(void) {
- EVP_MD_CTX* ctx = (EVP_MD_CTX*)OPENSSL_malloc(sizeof(EVP_MD_CTX));
- if (!ctx) {
- throw std::runtime_error("Cannot allocate EVP_MD_CTX");
- }
- EVP_MD_CTX_init(ctx);
- return ctx;
-}
-
-void EVP_MD_CTX_free(EVP_MD_CTX* ctx) {
- EVP_MD_CTX_destroy(ctx);
-}
-
-HMAC_CTX* HMAC_CTX_new() {
- HMAC_CTX* ctx = (HMAC_CTX*)OPENSSL_malloc(sizeof(HMAC_CTX));
- if (!ctx) {
- throw std::runtime_error("Cannot allocate HMAC_CTX");
- }
- HMAC_CTX_init(ctx);
- return ctx;
-}
-
-void HMAC_CTX_free(HMAC_CTX* ctx) {
- if (ctx) {
- HMAC_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
- }
-}
-
int SSL_SESSION_has_ticket(const SSL_SESSION* s) {
return (s->tlsext_ticklen > 0) ? 1 : 0;
}
return 1;
}
+
+X509* X509_STORE_CTX_get0_cert(X509_STORE_CTX* ctx) {
+ return ctx->cert;
+}
+
+STACK_OF(X509) * X509_STORE_CTX_get0_chain(X509_STORE_CTX* ctx) {
+ return X509_STORE_CTX_get_chain(ctx);
+}
+
+STACK_OF(X509) * X509_STORE_CTX_get0_untrusted(X509_STORE_CTX* ctx) {
+ return ctx->untrusted;
+}
+
+EVP_MD_CTX* EVP_MD_CTX_new() {
+ EVP_MD_CTX* ctx = (EVP_MD_CTX*)OPENSSL_malloc(sizeof(EVP_MD_CTX));
+ if (!ctx) {
+ throw std::runtime_error("Cannot allocate EVP_MD_CTX");
+ }
+ EVP_MD_CTX_init(ctx);
+ return ctx;
+}
+
+void EVP_MD_CTX_free(EVP_MD_CTX* ctx) {
+ if (ctx) {
+ EVP_MD_CTX_cleanup(ctx);
+ OPENSSL_free(ctx);
+ }
+}
+
+HMAC_CTX* HMAC_CTX_new() {
+ HMAC_CTX* ctx = (HMAC_CTX*)OPENSSL_malloc(sizeof(HMAC_CTX));
+ if (!ctx) {
+ throw std::runtime_error("Cannot allocate HMAC_CTX");
+ }
+ HMAC_CTX_init(ctx);
+ return ctx;
+}
+
+void HMAC_CTX_free(HMAC_CTX* ctx) {
+ if (ctx) {
+ HMAC_CTX_cleanup(ctx);
+ OPENSSL_free(ctx);
+ }
+}
+
#endif
}
unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION* s);
int SSL_SESSION_has_ticket(const SSL_SESSION* s);
int DH_set0_pqg(DH* dh, BIGNUM* p, BIGNUM* q, BIGNUM* g);
+
+X509* X509_STORE_CTX_get0_cert(X509_STORE_CTX* ctx);
+STACK_OF(X509) * X509_STORE_CTX_get0_chain(X509_STORE_CTX* ctx);
+STACK_OF(X509) * X509_STORE_CTX_get0_untrusted(X509_STORE_CTX* ctx);
+#endif
+
+#if FOLLY_OPENSSL_IS_110
+// Note: this was a type and has been fixed upstream, so the next 1.1.0
+// minor version upgrade will need to remove this
+#define OPENSSL_lh_new OPENSSL_LH_new
#endif
}