Commit f1e3312e authored by Neel Goyal's avatar Neel Goyal Committed by Facebook Github Bot

Clear errors when reading pems

Summary: Clear/read OpenSSL errors after certain ops.

Reviewed By: mingtaoy

Differential Revision: D8277088

fbshipit-source-id: aa436657c3bca3a081cd56858e09da57a03cda05
parent da72e6e9
......@@ -330,7 +330,7 @@ void SSLContext::loadTrustedCertificates(X509_STORE* store) {
void SSLContext::loadClientCAList(const char* path) {
auto clientCAs = SSL_load_client_CA_file(path);
if (clientCAs == nullptr) {
LOG(ERROR) << "Unable to load ca file: " << path;
LOG(ERROR) << "Unable to load ca file: " << path << " " << getErrors();
return;
}
SSL_CTX_set_client_CA_list(ctx_, clientCAs);
......
......@@ -209,6 +209,7 @@ std::vector<X509UniquePtr> OpenSSLCertUtils::readCertsFromBuffer(
while (true) {
X509UniquePtr x509(PEM_read_bio_X509(b.get(), nullptr, nullptr, nullptr));
if (!x509) {
ERR_clear_error();
break;
}
certs.push_back(std::move(x509));
......
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