-
Notifications
You must be signed in to change notification settings - Fork 132
Resolve SSL_PRIVATE_METHOD and certificate slots functionality #2429
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,7 @@ static bool ssl_set_pkey(CERT *cert, EVP_PKEY *pkey) { | |
|
||
// Update certificate slot index once all checks have passed. | ||
cert->cert_private_keys[idx].privatekey = UpRef(pkey); | ||
cert->key_method = nullptr; // key_method should be cleared since we've set a private key | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess same question here as above, what is the reason behind key_method being set to Null if a privkey has been set? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can't use both features at the same time, and if a slot private key is set, then that will be used if not NULL, otherwise it will use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahhh okay got it, so they do get used exclusively but for whatever reason our code didn't set them exclusively previously? Thanks! |
||
cert->cert_private_key_idx = idx; | ||
return true; | ||
} | ||
|
samuel40791765 marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just confused about the logic here. If privkey is null, then we should set privkey_method. But if it's not null, then reset it and don't set the privkey_method?
It looks like before, regardless of whether cert_pkey-> privatekey was null, it would be set to privkey. And privkey_method would also be assigned. Why this distinction now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this got answered for you in the other comment, but the two are mutually exclusive and only one of them can be passed to this function. So this just ensures that state is kept and reflected correctly to avoid confusion or future bugs around the state of the CERT type instance.