[openssl-users] X509_verify_cert cannot be called twice
Szilárd Pfeiffer
szilard.pfeiffer at balasys.hu
Thu Mar 24 20:21:41 UTC 2016
On 2016-03-24 19:12, Viktor Dukhovni wrote:
>> On Mar 24, 2016, at 2:02 PM, DEXTER <mydexterid at gmail.com> wrote:
>>
>> So let me get this straight.
>> If someone had a software where they called X509_verify_cert from
>> SSL_CTX_set_cert_verify_callback callback twice (to verify first with
>> crls, and maybe verify again without crls) and it worked as expected,
>> after this patch their software is broken.
>
> If they re-used the same X509_STORE_CTX, yes their software depended
> on undefined and likely insecure behaviour. "Worked as expected" is
> likely more along the lines of "did not appear to fail". Verification
> is not only expected to succeed for valid chains, but is also expected
> to reliably fail for invalid chains.
>
You are absolutely right in your last sentence, but an application which
should have expected (before the patch) that it does not get the error
code ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED, as it was permitted (according
to the documentation) to call the X509_verify_cert more than once. IMHO
an API compatible fix (1.0.1p was a security update) should consider
this, otherwise the undefined behavior shifted from the library to the
application.
The problem what I try to explain is not just a theory. Consider the
situation when a function in an application tries to verify a
certificate by calling X509_verify_cert twice with different parameters
(it is a questionable, but a permitted way) during the handshake. It
works very well before the patch. After the patch the second call
returns error, so the function also returns error and the SSL handshake
fails. So a security update contains the patch breaks the application.
Szilárd
More information about the openssl-users
mailing list