refine openssl handshake