Partial revert of "Fix client verify mode to check SSL_VERIFY_PEER"
authorMatt Caswell <matt@openssl.org>
Thu, 27 Oct 2016 09:46:25 +0000 (10:46 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 7 Nov 2016 16:02:50 +0000 (16:02 +0000)
commitc8e2f98c97ff3327784843946c2d62761572e5d5
treef2f74d8c57afa454b4ade9dd5bfbd2022f5fa0c9
parentd836d71b2da026b4ed9a2233657b2289ab8e4be0
Partial revert of "Fix client verify mode to check SSL_VERIFY_PEER"

This partially reverts commit c636c1c47. It also tweaks the documentation
and comments in this area. On the client side the documented interface for
SSL_CTX_set_verify()/SSL_set_verify() is that setting the flag
SSL_VERIFY_PEER causes verfication of the server certificate to take place.
Previously what was implemented was that if *any* flag was set then
verification would take place. The above commit improved the semantics to
be as per the documented interface.

However, we have had a report of at least one application where an
application was incorrectly using the interface and used *only*
SSL_VERIFY_FAIL_IF_NO_PEER_CERT on the client side. In OpenSSL prior to
the above commit this still caused verification of the server certificate
to take place. After this commit the application silently failed to verify
the server certificate.

Ideally SSL_CTX_set_verify()/SSL_set_verify() could be modified to indicate
if invalid flags were being used. However these are void functions!

The simplest short term solution is to revert to the previous behaviour
which at least means we "fail closed" rather than "fail open".

Thanks to Cory Benfield for reporting this issue.

Reviewed-by: Richard Levitte <levitte@openssl.org>
doc/man3/SSL_CTX_set_verify.pod
ssl/statem/statem_clnt.c