refine OpenSSL code