def _init_libcrypto():
 libcrypto = _load_libcrypto()
 libcrypto.RSA_new.argtypes = ()
 libcrypto.RSA_new.restype = c_void_p
 libcrypto.RSA_free.argtypes = (c_void_p,)
 libcrypto.RSA_size.argtype = c_void_p
 libcrypto.BIO_new_mem_buf.argtypes = (c_char_p, c_int)
 libcrypto.BIO_new_mem_buf.restype = c_void_p
 libcrypto.BIO_free.argtypes = (c_void_p,)
 libcrypto.PEM_read_bio_RSAPrivateKey.argtypes = (c_void_p, c_void_p, c_void_p, c_void_p)
 libcrypto.PEM_read_bio_RSAPrivateKey.restype = c_void_p
 libcrypto.PEM_read_bio_RSA_PUBKEY.argtypes = (c_void_p, c_void_p, c_void_p, c_void_p)
 libcrypto.PEM_read_bio_RSA_PUBKEY.restype = c_void_p
 libcrypto.RSA_private_encrypt.argtypes = (c_int, c_char_p, c_char_p, c_void_p, c_int)
 libcrypto.RSA_public_decrypt.argtypes = (c_int, c_char_p, c_char_p, c_void_p, c_int)
 try:
  if (libcrypto.OPENSSL_init_crypto(((OPENSSL_INIT_NO_LOAD_CONFIG | OPENSSL_INIT_ADD_ALL_CIPHERS) | OPENSSL_INIT_ADD_ALL_DIGESTS), None) != 1):
   raise OSError('Failed to initialize OpenSSL library (OPENSSL_init_crypto failed)')
 except AttributeError:
  libcrypto.OPENSSL_no_config()
  libcrypto.OPENSSL_add_all_algorithms_noconf()
 return libcrypto

def _init_libcrypto ( ) : libcrypto = _load_libcrypto ( ) libcrypto . RSA_new . argtypes = ( ) libcrypto . RSA_new . restype = c_void_p libcrypto . RSA_free . argtypes = ( c_void_p , ) libcrypto . RSA_size . argtype = c_void_p libcrypto . BIO_new_mem_buf . argtypes = ( c_char_p , c_int ) libcrypto . BIO_new_mem_buf . restype = c_void_p libcrypto . BIO_free . argtypes = ( c_void_p , ) libcrypto . PEM_read_bio_RSAPrivateKey . argtypes = ( c_void_p , c_void_p , c_void_p , c_void_p ) libcrypto . PEM_read_bio_RSAPrivateKey . restype = c_void_p libcrypto . PEM_read_bio_RSA_PUBKEY . argtypes = ( c_void_p , c_void_p , c_void_p , c_void_p ) libcrypto . PEM_read_bio_RSA_PUBKEY . restype = c_void_p libcrypto . RSA_private_encrypt . argtypes = ( c_int , c_char_p , c_char_p , c_void_p , c_int ) libcrypto . RSA_public_decrypt . argtypes = ( c_int , c_char_p , c_char_p , c_void_p , c_int ) try : if ( libcrypto . OPENSSL_init_crypto ( ( ( OPENSSL_INIT_NO_LOAD_CONFIG | OPENSSL_INIT_ADD_ALL_CIPHERS ) | OPENSSL_INIT_ADD_ALL_DIGESTS ) , None ) != 1 ) : raise OSError ( 'Failed to initialize OpenSSL library (OPENSSL_init_crypto failed)' ) except AttributeError : libcrypto . OPENSSL_no_config ( ) libcrypto . OPENSSL_add_all_algorithms_noconf ( ) return libcrypto
set up libcrypto argtypes and initialize the library .