GeezerVison is showing github.com — crypto: use X509_STORE_CTX_new · nodejs/node@8da4983
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/node_crypto.cc +5-12Lines changed: 5 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -572,19 +572,12 @@ void SecureContext::SetKey(const FunctionCallbackInfo<Value>& args) { |
572 | 572 |
|
573 | 573 |
|
574 | 574 | int SSL_CTX_get_issuer(SSL_CTX* ctx, X509* cert, X509** issuer) { |
575 | | - int ret; |
576 | | - |
577 | 575 | 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); |
588 | 581 | return ret; |
589 | 582 | } |
590 | 583 |
|
|