Skip to content

Commit 36c4307

Browse files
cjihrigtargos
authored andcommitted
src: remove unneeded variables in node_crypto.cc
PR-URL: #23297 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 902ba0e commit 36c4307

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/node_crypto.cc

+8-17
Original file line numberDiff line numberDiff line change
@@ -573,17 +573,13 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
573573
if (ret) {
574574
// If we could set up our certificate, now proceed to
575575
// the CA certificates.
576-
int r;
577-
578576
SSL_CTX_clear_extra_chain_certs(ctx);
579577

580578
for (int i = 0; i < sk_X509_num(extra_certs); i++) {
581579
X509* ca = sk_X509_value(extra_certs, i);
582580

583581
// NOTE: Increments reference count on `ca`
584-
r = SSL_CTX_add1_chain_cert(ctx, ca);
585-
586-
if (!r) {
582+
if (!SSL_CTX_add1_chain_cert(ctx, ca)) {
587583
ret = 0;
588584
issuer = nullptr;
589585
break;
@@ -1576,15 +1572,11 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
15761572
if (index < 0)
15771573
continue;
15781574

1579-
X509_EXTENSION* ext;
1580-
int rv;
1581-
1582-
ext = X509_get_ext(cert, index);
1575+
X509_EXTENSION* ext = X509_get_ext(cert, index);
15831576
CHECK_NOT_NULL(ext);
15841577

15851578
if (!SafeX509ExtPrint(bio.get(), ext)) {
1586-
rv = X509V3_EXT_print(bio.get(), ext, 0, 0);
1587-
CHECK_EQ(rv, 1);
1579+
CHECK_EQ(1, X509V3_EXT_print(bio.get(), ext, 0, 0));
15881580
}
15891581

15901582
BIO_get_mem_ptr(bio.get(), &mem);
@@ -3754,7 +3746,6 @@ SignBase::Error Verify::VerifyFinal(const char* key_pem,
37543746
EVPKeyPointer pkey;
37553747
unsigned char m[EVP_MAX_MD_SIZE];
37563748
unsigned int m_len;
3757-
int r = 0;
37583749
*verify_result = false;
37593750
EVPMDPointer mdctx = std::move(mdctx_);
37603751

@@ -3770,11 +3761,11 @@ SignBase::Error Verify::VerifyFinal(const char* key_pem,
37703761
ApplyRSAOptions(pkey, pkctx.get(), padding, saltlen) &&
37713762
EVP_PKEY_CTX_set_signature_md(pkctx.get(),
37723763
EVP_MD_CTX_md(mdctx.get())) > 0) {
3773-
r = EVP_PKEY_verify(pkctx.get(),
3774-
reinterpret_cast<const unsigned char*>(sig),
3775-
siglen,
3776-
m,
3777-
m_len);
3764+
const int r = EVP_PKEY_verify(pkctx.get(),
3765+
reinterpret_cast<const unsigned char*>(sig),
3766+
siglen,
3767+
m,
3768+
m_len);
37783769
*verify_result = r == 1;
37793770
}
37803771

0 commit comments

Comments
 (0)