Hi alex_b,
If you would like wolfSSL to hang on to the peer certificate after the SSL/TLS handshake, you can define KEEP_PEER_CERT when compiling wolfSSL.
With wolfSSL, by default the verify callback is only called upon verification failure. wolfSSL handles certificate verification internally, which is unlike OpenSSL that forces the user to do the verification. This means that on all failure cases, the preverify parameter will be zero.
Optionally, you can force wolfSSL to call the verify callback on every verification - regardless if it is successful or a failure - by defining WOLFSSL_ALWAYS_VERIFY_CB. In this case, if preverify is equal to "1", wolfSSL has already successfully verified the peer certificate. We provide this option for those users who wish to do custom inspection of certificate elements past normal certificate verification measures.
Does this help clear things up?
Best Regards,
Chris