1.0.2 to 1.1 migration problem with verify_callback()

Neptune pdrotter at us.ibm.com
Fri Aug 2 17:24:57 UTC 2019


I am in the process of migrating our code from the 1.0.2 library to 1.1 and
have run across a situation that I am struggling to reconcile:

The existing code utilizes the verify_callback() function in order to
perform validation measures against a peer certificate. This callback
performs validation such as checking the certificate against a CRL and doing
wildcard matching. The reason we need to define our own callback and
validation code is because, as I understand it, the built-in OpenSSL
wildcard matching will only process one wildcard field prefix (*.domain.com)
whereas our requirements allow for wildcard patterns beyond just a prefix
(FOO.*.domain.com, FOO.B*R.domain.com, etc.).

The problem arises when I attempt to access 'ssl->tlsext_hostname' which is
understood because this structure is now opaque. I believe the accessor
function for this is '__owur const char *SSL_SESSION_get0_hostname(const
SSL_SESSION *s);' in ssl.h. However, within the context of the callback
function I only have two arguments to work with:

int verify_callback(int ok, X509_STORE_CTX *ctx)

This does not provide me with a SSL_SESSION object to pass into the
SSL_SESSION_get0_hostname accessor function, so...

1. Is SSL_SESSION_get0_hostname() the right accessor for this data?
2. If so, how can I call SSL_SESSION_get0_hostname() within
verify_callback() without a SSL_SESSION object?
3. Has the validation code for the 1.1 (and future) branches been changed so
that I would no longer need to define my own validation code? (He asks
hopefully)

Thanks in advance for your help.



--
Sent from: http://openssl.6102.n7.nabble.com/OpenSSL-User-f3.html


More information about the openssl-users mailing list