The peer certificate chain is not necessarily available after reusing a session, in which case a NULL pointer is returned.
The reference count of the STACKOF(X509) object is not incremented. If the corresponding session is freed, the pointer must not be used any longer.