Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence static analyser with additional checks #1123

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ssl/ssl_cert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ static int cert_set_chain_and_key(
}

// Update certificate slot index once all checks have passed.
// Certificate slot validity already checked in |check_leaf_cert_and_privkey|.
int idx = ssl_get_certificate_slot_index(privkey);
cert->cert_private_keys[idx].privatekey = UpRef(privkey);
cert->key_method = privkey_method;
Expand All @@ -357,9 +358,12 @@ bool ssl_set_cert(CERT *cert, UniquePtr<CRYPTO_BUFFER> buffer) {
return false;
}
int slot_index = ssl_get_certificate_slot_index(pubkey.get());
if (slot_index < 0) {
OPENSSL_PUT_ERROR(SSL, SSL_R_UNKNOWN_CERTIFICATE_TYPE);
return false;
}

CERT_PKEY &cert_pkey = cert->cert_private_keys[slot_index];

switch (do_leaf_cert_and_privkey_checks(&cert_cbs, pubkey.get(),
cert_pkey.privatekey.get())) {
case leaf_cert_and_privkey_error:
Expand Down