Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8da4983

Browse filesBrowse files
davidbenevanlucas
authored andcommitted
crypto: use X509_STORE_CTX_new
In OpenSSL 1.1.0, X509_STORE_CTX is opaque and thus cannot be stack-allocated. This works in OpenSSL 1.1.0 and 1.0.2. Adapted from PR PR-URL: #16130 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent b42013c commit 8da4983
Copy full SHA for 8da4983

File tree

Expand file treeCollapse file tree

1 file changed

+5
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-12
lines changed
Open diff view settings
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+5-12Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -572,19 +572,12 @@ void SecureContext::SetKey(const FunctionCallbackInfo<Value>& args) {
572572

573573

574574
int SSL_CTX_get_issuer(SSL_CTX* ctx, X509* cert, X509** issuer) {
575-
int ret;
576-
577575
X509_STORE* store = SSL_CTX_get_cert_store(ctx);
578-
X509_STORE_CTX store_ctx;
579-
580-
ret = X509_STORE_CTX_init(&store_ctx, store, nullptr, nullptr);
581-
if (!ret)
582-
goto end;
583-
584-
ret = X509_STORE_CTX_get1_issuer(issuer, &store_ctx, cert);
585-
X509_STORE_CTX_cleanup(&store_ctx);
586-
587-
end:
576+
X509_STORE_CTX* store_ctx = X509_STORE_CTX_new();
577+
int ret = store_ctx != nullptr &&
578+
X509_STORE_CTX_init(store_ctx, store, nullptr, nullptr) == 1 &&
579+
X509_STORE_CTX_get1_issuer(issuer, store_ctx, cert) == 1;
580+
X509_STORE_CTX_free(store_ctx);
588581
return ret;
589582
}
590583

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.