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

Allows wolfclu to verify a cert chain of more than 2 certs. #159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anhu
Copy link
Member

@anhu anhu commented Dec 4, 2024

Fixes ZD18976

@anhu
Copy link
Member Author

anhu commented Dec 4, 2024

@JacobBarthelmeh , failing on CRL check. Does the CRL check need the store and/or lookup?

@anhu
Copy link
Member Author

anhu commented Dec 4, 2024

I'll answer my own question. Yes, the CA file contains a CRL as well. So the lookup is used to loop through the various things in the CA file. But somehow, this interferes with being able to load multiple certs when doing the verify.

Should we have CRL as a different file like in the example app ?

@JacobBarthelmeh
Copy link
Contributor

@anhu thanks for the code changes! Lets try not to make adjustments to the tests if possible (if having the CRL in a different file means adjusting the test), some of them are in place for regression tests on previous reports.

Could you add a test case here for the addition of support to handle a certificate chain in a single file?

@@ -168,8 +156,7 @@ int wolfCLU_x509Verify(int argc, char** argv)
}

if (ret == WOLFCLU_SUCCESS && caCert != NULL) {
if (wolfSSL_X509_LOOKUP_load_file(lookup, caCert, X509_FILETYPE_PEM)
!= WOLFSSL_SUCCESS) {
if (wolfSSL_CertManagerLoadCA(cm, caCert, NULL) != WOLFSSL_SUCCESS) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the biggest change right? Is calling wolfSSL_X509_LOOKUP_load_file incorrect i.e. does it behave different then X509_LOOKUP_load_file() would if called in the same manner?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Note that I have not root caused the problem. I just noticed that if there is no lookup, (only use certmanager directly) then for some reason, certmanager will go through all the certificates in the verifyCert file. I do not know why using the store makes a difference and IMHO I think it should not make a difference so maybe the root cause is somewhere else?

@anhu
Copy link
Member Author

anhu commented Dec 11, 2024

When it doesn't work, (ie 3 certs in the CA file and without this PR) ProcessChainBuffer() is NOT called. Basically, that's not called because wolfSSL_CertManagerLoadCA is never called so the CA file is never seen as a possible chain. I'm not sure what wolfSSL_X509_LOOKUP_load_file() is doing, but I feel like it should at some point call wolfSSL_CertManagerLoadCA.

@JacobBarthelmeh , care to comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants