Skip to content

Fix X509 load locations to handle PEM files with multiple certs#8850

Open
ColtonWilley wants to merge 1 commit intowolfSSL:masterfrom
ColtonWilley:x509_store_pem_multi
Open

Fix X509 load locations to handle PEM files with multiple certs#8850
ColtonWilley wants to merge 1 commit intowolfSSL:masterfrom
ColtonWilley:x509_store_pem_multi

Conversation

@ColtonWilley
Copy link
Copy Markdown
Contributor

Description

wolfSSL_X509_load_locations() previously did not handle PEM files with multiple certs in one file, only the first cert would be loaded. Modify wolfSSL_X509_load_locations() to fix this by using existing logic in x509.c to loop over the PEM headers and load each item, cert or CRL.

Fixes zd 19835

Checklist

  • added tests

@ColtonWilley
Copy link
Copy Markdown
Contributor Author

ColtonWilley commented Jun 6, 2025

Retest this please.

Found unhandled hudson.remoting.RequestAbortedException exception:
java.io.IOException: Unexpected EOF

Comment thread tests/api.c Outdated
Comment thread tests/api.c Outdated
Comment thread src/x509_str.c
Copy link
Copy Markdown
Member

@julek-wolfssl julek-wolfssl left a comment

Choose a reason for hiding this comment

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

Please move the new tests and check if the CRL functionality is tested somewhere.

dgarske
dgarske previously approved these changes Jul 3, 2025
SparkiDev
SparkiDev previously approved these changes Jul 7, 2025
julek-wolfssl
julek-wolfssl previously approved these changes Jul 7, 2025
@julek-wolfssl
Copy link
Copy Markdown
Member

@ColtonWilley please rebase to run all the latest tests.

Adds X509LoadPemFile to walk multi-cert PEM files when loading via
wolfSSL_X509_STORE_load_locations and X509_LOOKUP_load_file, replacing
the single-cert helpers X509StoreReadFile/X509StoreLoadFile which only
read the first cert from a file.

Rebased fresh onto current upstream master (was 2209 commits behind);
test additions deferred to a follow-up since the test file layout has
been reorganized in master.
@ColtonWilley ColtonWilley force-pushed the x509_store_pem_multi branch from 1c8e62f to e1373f0 Compare May 5, 2026 19:18
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

MemBrowse Memory Report

No memory changes detected for:

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.

5 participants