Skip to content

Commit 8b68c56

Browse files
committed
pass cert stack by reference instead of address
1 parent 6f4b251 commit 8b68c56

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ssl/ssl_cert.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ static enum leaf_cert_and_privkey_result_t check_leaf_cert_and_privkey(
274274
}
275275

276276
static int cert_set_chain_and_key(
277-
CERT *cert, UniquePtr<STACK_OF(CRYPTO_BUFFER)> *certs, size_t num_certs,
277+
CERT *cert, UniquePtr<STACK_OF(CRYPTO_BUFFER)> &certs, size_t num_certs,
278278
EVP_PKEY *privkey, const SSL_PRIVATE_KEY_METHOD *privkey_method) {
279279
if (num_certs == 0 || (privkey == NULL && privkey_method == NULL)) {
280280
OPENSSL_PUT_ERROR(SSL, ERR_R_PASSED_NULL_PARAMETER);
@@ -286,7 +286,7 @@ static int cert_set_chain_and_key(
286286
return 0;
287287
}
288288

289-
switch (check_leaf_cert_and_privkey(sk_CRYPTO_BUFFER_value(certs->get(), 0), privkey)) {
289+
switch (check_leaf_cert_and_privkey(sk_CRYPTO_BUFFER_value(certs.get(), 0), privkey)) {
290290
case leaf_cert_and_privkey_error:
291291
return 0;
292292
case leaf_cert_and_privkey_mismatch:
@@ -314,7 +314,7 @@ static int cert_set_chain_and_key(
314314
if (cert_pkey->chain) {
315315
cert_pkey->chain.reset();
316316
}
317-
cert_pkey->chain = std::move(*certs);
317+
cert_pkey->chain = std::move(certs);
318318
cert->cert_private_key_idx = idx;
319319
return 1;
320320
}
@@ -971,7 +971,7 @@ int SSL_set_chain_and_key(SSL *ssl, CRYPTO_BUFFER *const *certs,
971971
if (!cert_array_to_stack(certs, &crypto_certs, num_certs)) {
972972
return 0;
973973
}
974-
return cert_set_chain_and_key(ssl->config->cert.get(), &crypto_certs, num_certs,
974+
return cert_set_chain_and_key(ssl->config->cert.get(), crypto_certs, num_certs,
975975
privkey, privkey_method);
976976
}
977977

@@ -982,7 +982,7 @@ int SSL_CTX_set_chain_and_key(SSL_CTX *ctx, CRYPTO_BUFFER *const *certs,
982982
if (!cert_array_to_stack(certs, &crypto_certs, num_certs)) {
983983
return 0;
984984
}
985-
return cert_set_chain_and_key(ctx->cert.get(), &crypto_certs, num_certs, privkey,
985+
return cert_set_chain_and_key(ctx->cert.get(), crypto_certs, num_certs, privkey,
986986
privkey_method);
987987
}
988988

@@ -1047,7 +1047,7 @@ int SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x509, EVP_PKEY *privatekey,
10471047
}
10481048

10491049
// Call SSL_CTX_set_chain_and_key to set the chain and key
1050-
if (!cert_set_chain_and_key(cert, &leaf_and_chain,
1050+
if (!cert_set_chain_and_key(cert, leaf_and_chain,
10511051
sk_CRYPTO_BUFFER_num(leaf_and_chain.get()),
10521052
privatekey, nullptr)) {
10531053
return 0;

0 commit comments

Comments
 (0)