Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR improves the documentation for X509_VERIFY_PARAM_set_flags.pod with three main enhancements:
- Adds guidance on using
X509_VERIFY_PARAM_set1_host()withSSL_set_tlsext_host_name()for TLS clients - Clarifies NULL parameter behavior for email, IP address, and hostname validation functions
- Removes outdated information about
X509_V_FLAG_NO_ALT_CHAINSfrom pre-OpenSSL 1.1.0
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3758245 to
b1e5982
Compare
| The B<X509_V_FLAG_NO_ALT_CHAINS> flag could have been used before OpenSSL 1.1.0 | ||
| to suppress checking for alternative chains. | ||
| By default, unless B<X509_V_FLAG_TRUSTED_FIRST> is set, when building a | ||
| certificate chain, if the first certificate chain found is not trusted, then | ||
| OpenSSL will attempt to replace untrusted certificates supplied by the peer | ||
| with certificates from the trust store to see if an alternative chain can be | ||
| found that is trusted. | ||
| As of OpenSSL 1.1.0, with B<X509_V_FLAG_TRUSTED_FIRST> always set, this option | ||
| has no effect. |
There was a problem hiding this comment.
I would move this to a history section, so it's still possible to figure out what the code written against ancient OpenSSL version was trying to do.
There was a problem hiding this comment.
Good point, done.
And restored the original doc line for X509_V_FLAG_NO_ALT_CHAINS, which I had changed in a wrong way due to a misunderstanding when doing commit ade0873.
| X509_VERIFY_PARAM_set1_email() sets the expected RFC822 email address to | ||
| I<email>. If I<email> is NUL-terminated, I<emaillen> may be zero, otherwise | ||
| I<email>. | ||
| If I<email> is NULL or the empty string, email checking is disabled. |
There was a problem hiding this comment.
It doesn't seem to me that the current code sets the email field to NULL if an empty string is passed, and I don't see where a check is skipped against an empty e-mail, are you sure about this statement?
There was a problem hiding this comment.
Oh, right, email checking is disabled (by int_x509_param_set1() in crypto/x509/x509_vpn.c) only if email is NULL.
On this occasion, found and fixed a bug in the doc of the emaillen parameter
and for the namelen parameter of X509_VERIFY_PARAM_set1_host() .
|
|
||
| X509_VERIFY_PARAM_set1_ip() sets the expected IP address to I<ip>. | ||
| The I<ip> argument is in binary format, in network byte-order and | ||
| If I<ip> is NULL or the empty string, IP address checking is disabled. Otherwise, |
There was a problem hiding this comment.
Yep, did the same fixes as above.
| X509_VERIFY_PARAM_set1_ip_asc() sets the expected IP address to | ||
| I<ipasc>. The I<ipasc> argument is a NUL-terminal ASCII string: | ||
| X509_VERIFY_PARAM_set1_ip_asc() sets the expected IP address to I<ipasc>. | ||
| If I<ipasc> is NULL or the empty string, IP address checking is disabled. |
There was a problem hiding this comment.
Ditto here; moreover, it is impossible to specify an incorrectly-formatted IP-address here (which, in accordance with ossl_a2i_ipadd(), empty string is).
There was a problem hiding this comment.
Very true - here ipasc must not be NULL nor the empty string. Sorry for my mistakes.
Removed again the new sentence.
|
@esyr thank you for your helpful review. |
| Until OpenSSL 1.1.0, by default (unless B<X509_V_FLAG_TRUSTED_FIRST> is set), when building a | ||
| certificate chain, if the first certificate chain found is not trusted, then | ||
| OpenSSL will attempt to replace untrusted certificates supplied by the peer | ||
| with certificates from the trust store to see if an alternative chain can be | ||
| found that is trusted. | ||
| As of OpenSSL 1.1.0, with B<X509_V_FLAG_TRUSTED_FIRST> always set, this option | ||
| has no effect. |
There was a problem hiding this comment.
The X509_V_FLAG_TRUSTED_FIRST can be still cleared, cannot it?
| Until OpenSSL 1.1.0, by default (unless B<X509_V_FLAG_TRUSTED_FIRST> is set), when building a | |
| certificate chain, if the first certificate chain found is not trusted, then | |
| OpenSSL will attempt to replace untrusted certificates supplied by the peer | |
| with certificates from the trust store to see if an alternative chain can be | |
| found that is trusted. | |
| As of OpenSSL 1.1.0, with B<X509_V_FLAG_TRUSTED_FIRST> always set, this option | |
| has no effect. | |
| Until OpenSSL 1.1.0, by default (unless B<X509_V_FLAG_TRUSTED_FIRST> was set), when building a | |
| certificate chain, if the first certificate chain found was not trusted, | |
| OpenSSL would attempt to replace untrusted certificates supplied by the peer | |
| with certificates from the trust store to see if an alternative chain can be | |
| found that is trusted. | |
| Since OpenSSL 1.1.0 version, the B<X509_V_FLAG_TRUSTED_FIRST> is set by default. |
There was a problem hiding this comment.
Good point - here I did not question the contents of the existing doc but just aimed at handling outdated version references, moving text to the history section where appropriate.
Yet I just had a look at the commit history:
Since commit 0daccd4, X509_V_FLAG_TRUSTED_FIRST is on by default, and it was documented that it cannot be disabled, but in commit f517911 this latter part was removed. I also see no reason why it should be impossible to clear it.
So changed this part as you suggested, and also did a similar change further up,
from
When B<X509_V_FLAG_TRUSTED_FIRST> is set, which is always the case
to
When B<X509_V_FLAG_TRUSTED_FIRST> is set, which is the default
…_PARAM_set1_host() and SSL_set_tlsext_host_name()
…9_V_FLAG_NO_ALT_CHAINS; other small fixes
… on X509_V_FLAG_NO_ALT_CHAINS; other small fixes
…d texts on X509_V_FLAG_NO_ALT_CHAINS; other small fixes
…_PARAM_set1_email() and X509_VERIFY_PARAM_set1{,_ip}()
…_VERIFY_PARAM_set1_email() and X509_VERIFY_PARAM_set1{,_ip}()
7288aec to
5b32bc1
Compare
|
Rebased on latest |
…to X509_VERIFY_PARAM_set1_email() and X509_VERIFY_PARAM_set1{,_ip}()
|
This pull request is ready to merge |
…_PARAM_set1_host() and SSL_set_tlsext_host_name() Reviewed-by: Eugene Syromiatnikov <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jan 8 09:56:12 2026 (Merged from #29150)
…9_V_FLAG_NO_ALT_CHAINS; other small fixes Reviewed-by: Eugene Syromiatnikov <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jan 8 09:56:14 2026 (Merged from #29150)
…_PARAM_set1_email() and X509_VERIFY_PARAM_set1{,_ip}()
Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Thu Jan 8 09:56:15 2026
(Merged from #29150)
|
Merged to the master branch. Thank you for your contribution. |
…_PARAM_set1_host() and SSL_set_tlsext_host_name() Reviewed-by: Eugene Syromiatnikov <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jan 8 09:56:12 2026 (Merged from openssl#29150)
…9_V_FLAG_NO_ALT_CHAINS; other small fixes Reviewed-by: Eugene Syromiatnikov <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Thu Jan 8 09:56:14 2026 (Merged from openssl#29150)
…_PARAM_set1_email() and X509_VERIFY_PARAM_set1{,_ip}()
Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Thu Jan 8 09:56:15 2026
(Merged from openssl#29150)
Three doc-only commits carved out from #27357.
SSL_set_tlsext_host_name()for SNIand that this should be done jointly with using
{SSL,X509_VERIFY_PARAM}_{set1,add1}_host().X509_VERIFY_PARAM_set1_email()andX509_VERIFY_PARAM_set1{,_ip}()X509_V_FLAG_NO_ALT_CHAINS; other small fixes