Repository navigation
Prerequisite for tracing chain building: refactor find_issuer() etc. in x509_lu.c and x509_vfy.c - #18762
Prerequisite for tracing chain building: refactor find_issuer() etc. in x509_lu.c and x509_vfy.c#18762DDvO wants to merge 2 commits into
find_issuer() etc. in x509_lu.c and x509_vfy.c#18762Conversation
x590_lu.c and x509_vfy.c: refactor find_issuer() and friendsx590_lu.c and x509_vfy.c: refactor find_issuer() and friends
327ed1b to
208987b
Compare
6da4668 to
28ded08
Compare
28ded08 to
594542b
Compare
|
@vdukhovni can you please review this? |
kaduk
left a comment
There was a problem hiding this comment.
A couple thoughts noticed while skimming to assess if I can do a "real" review in the time allotted (answer: no).
|
Ping for reviews. I wonder if anyone (except @kaduk, who cannot take the time) already plans or has started doing a review? |
|
Would it help if I split this into two PRs:
? |
Not necessarily separate PRs but separate commits would probably help. |
x590_lu.c and x509_vfy.c: refactor find_issuer() and friendsx509_lu.c and x509_vfy.c: refactor find_issuer() and friends
103d5c9 to
2041299
Compare
Done. |
ea955cf to
4e76701
Compare
|
I've just re-ordered the new fixup commit among the existing ones. |
|
The codingstyle changes LGTM now. However the refactoring will need more time to review which I do not have right now. |
Thank you for letting me know. Then I suppose it is best now if I copy the codingstyle commit(s) to a different PR, which you could approve right away, and after this is merged (likely soon), I'll rebase this PR and this PR will become simpler to review. |
|
OK |
d24ef3b to
1ebcc6c
Compare
x509_lu.c and x509_vfy.c: refactor find_issuer() and friendsfind_issuer() etc. in x509_lu.c and x509_vfy.c
|
Rebased again to fix merge conflict. Ping @openssl/committers for 2nd review |
|
This pull request is ready to merge |
| i = ossl_x509_store_ctx_get_by_subject(ctx, X509_LU_X509, nm, xobj); | ||
| if (i <= 0) { | ||
| X509_OBJECT_free(xobj); | ||
| i = ossl_x509_store_ctx_get_by_subject(ctx, X509_LU_X509, nm, NULL); |
There was a problem hiding this comment.
Some day, it might be good to not assume that cached data is always complete and correct. Trust anchors can become untrusted, and new ones can come along. Certainly with CApath, it makes some sense to periodically ignore the cached data, and do a fresh lookup, perhaps a new control can set the refresh interval. Nothing needs to be done in this PR, but something to keep in mind...
There was a problem hiding this comment.
Good point.
I suggest opening an issue to help keeping this in mind.
…TX_get1_issuer(), etc.
|
This pull request is ready to merge |
|
Merged to the master branch. Thank you for your contribution. |
…_issuer(), etc. Reviewed-by: Hugo Landau <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from #18762)
This is a prerequisite for #18761. When preparing the new trace feature for cert chain building, I found again that there is an ugly overlap between
STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx, const X509_NAME *nm)X509_STORE_CTX_get1_issuer()inx509_lu.cused to search for suitable trusted certsfind_issuer()inx509_vfy.cused to search for both untrusted and trusted certs.Among others, this means that any changes (such as the addition of trace output) would need to be done consistently in their function bodies.
Moreover, most of
X509_STORE_CTX_get1_issuer()does not really belong tox509_lu.cbut tox509_vfy.c,but not all of its implementation can be moved because it includes collecting certs via the internal X509/CRL object lookup mechanism.
When adding the tracing for chain building, I also noticed that the function checks the first cert found twice, which of course is needless and should be avoided.
This PR fixes all this, while not changing the documented/commented semantics of these functions,
by letting
X509_STORE_CTX_get1_issuer()make use ofX509_STORE_CTX_get1_certs()by factoring out fromX509_STORE_CTX_get1_certs()andX509_STORE_CTX_get1_issuer()a new functionand moving the rest to
x509_vfy.c.These functions are now implemented using a more general internal function
which will be extended by #18761 to provide tracing.
This PR also renames the local function
get_issuer_sk()toget1_best_issuer_other_sk()inx509_vfy.c.