Skip to content

Commit

Permalink
src: remove unneeded variables in node_crypto.cc
Browse files Browse the repository at this point in the history
PR-URL: #23297
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
cjihrig authored and targos committed Oct 10, 2018
1 parent 902ba0e commit 36c4307
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -573,17 +573,13 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
if (ret) {
// If we could set up our certificate, now proceed to
// the CA certificates.
int r;

SSL_CTX_clear_extra_chain_certs(ctx);

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

// NOTE: Increments reference count on `ca`
r = SSL_CTX_add1_chain_cert(ctx, ca);

if (!r) {
if (!SSL_CTX_add1_chain_cert(ctx, ca)) {
ret = 0;
issuer = nullptr;
break;
Expand Down Expand Up @@ -1576,15 +1572,11 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
if (index < 0)
continue;

X509_EXTENSION* ext;
int rv;

ext = X509_get_ext(cert, index);
X509_EXTENSION* ext = X509_get_ext(cert, index);
CHECK_NOT_NULL(ext);

if (!SafeX509ExtPrint(bio.get(), ext)) {
rv = X509V3_EXT_print(bio.get(), ext, 0, 0);
CHECK_EQ(rv, 1);
CHECK_EQ(1, X509V3_EXT_print(bio.get(), ext, 0, 0));
}

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

Expand All @@ -3770,11 +3761,11 @@ SignBase::Error Verify::VerifyFinal(const char* key_pem,
ApplyRSAOptions(pkey, pkctx.get(), padding, saltlen) &&
EVP_PKEY_CTX_set_signature_md(pkctx.get(),
EVP_MD_CTX_md(mdctx.get())) > 0) {
r = EVP_PKEY_verify(pkctx.get(),
reinterpret_cast<const unsigned char*>(sig),
siglen,
m,
m_len);
const int r = EVP_PKEY_verify(pkctx.get(),
reinterpret_cast<const unsigned char*>(sig),
siglen,
m,
m_len);
*verify_result = r == 1;
}

Expand Down

0 comments on commit 36c4307

Please sign in to comment.