     { ctx SSL_CTX* } ;
 TYPEDEF: ssl_st SSL
 
-FUNCTION: c-string SSL_get_version ( SSL* ssl )
+! Must be called before any other action takes place
+FUNCTION: int SSL_library_init (  )
 
 ! Maps OpenSSL errors to strings
 FUNCTION: void SSL_load_error_strings (  )
+
+! Sets the default SSL version
+FUNCTION: ssl-method SSLv2_client_method (  )
+FUNCTION: ssl-method SSLv23_client_method (  )
+FUNCTION: ssl-method SSLv23_server_method (  )
+FUNCTION: ssl-method SSLv23_method (  ) ! SSLv3 but can rollback to v2
+FUNCTION: ssl-method SSLv3_client_method (  )
+FUNCTION: ssl-method SSLv3_server_method (  )
+FUNCTION: ssl-method SSLv3_method (  )
+FUNCTION: ssl-method TLSv1_client_method (  )
+FUNCTION: ssl-method TLSv1_server_method (  )
+FUNCTION: ssl-method TLSv1_method (  )
+FUNCTION: ssl-method TLSv1_1_method (  )
+FUNCTION: ssl-method TLSv1_2_method (  )
+
+FUNCTION: void SSL_SESSION_free ( SSL_SESSION* ses )
+FUNCTION: void RAND_seed ( void* buf, int num )
+FUNCTION: void* BIO_f_ssl (  )
+
+! ------------------------------------------------------------------------------
+! SSL
+! ------------------------------------------------------------------------------
+FUNCTION: c-string SSL_get_version ( SSL* ssl )
+
 FUNCTION: c-string SSL_state_string ( SSL* ssl )
 FUNCTION: c-string SSL_rstate_string ( SSL* ssl )
 FUNCTION: c-string SSL_state_string_long ( SSL* ssl )
 FUNCTION: c-string SSL_rstate_string_long ( SSL* ssl )
 
-! Must be called before any other action takes place
-FUNCTION: int SSL_library_init (  )
-
-! Sets the default SSL version
-FUNCTION: ssl-method SSLv2_client_method (  )
-
-FUNCTION: ssl-method SSLv23_client_method (  )
-
-FUNCTION: ssl-method SSLv23_server_method (  )
-
-FUNCTION: ssl-method SSLv23_method (  ) ! SSLv3 but can rollback to v2
-
-FUNCTION: ssl-method SSLv3_client_method (  )
-
-FUNCTION: ssl-method SSLv3_server_method (  )
-
-FUNCTION: ssl-method SSLv3_method (  )
-
-FUNCTION: ssl-method TLSv1_client_method (  )
-
-FUNCTION: ssl-method TLSv1_server_method (  )
-
-FUNCTION: ssl-method TLSv1_method (  )
-
-FUNCTION: ssl-method TLSv1_1_method (  )
-
-FUNCTION: ssl-method TLSv1_2_method (  )
-
-! Creates the context
-FUNCTION: SSL_CTX* SSL_CTX_new ( ssl-method method )
-
-! Load the certificates and private keys into the SSL_CTX
-FUNCTION: int SSL_CTX_use_certificate_chain_file ( SSL_CTX* ctx,
-                                                   c-string file ) ! PEM type
-
-FUNCTION: int SSL_CTX_use_certificate ( SSL_CTX* ctx, X509* x )
-
-FUNCTION: SSL* SSL_new ( SSL_CTX* ctx )
-
 FUNCTION: int SSL_set_fd ( SSL* ssl, int fd )
 
 FUNCTION: void SSL_set_bio ( SSL* ssl, void* rbio, void* wbio )

! On Windows, some of the functions making up libressl
! are placed in libcrypto-37.dll
! ===============================================

<< os windows? [
    "libssl-windows"
    [ "libcrypto-37.dll" cdecl add-library ] [ current-library set ] bi
] when >>

! x509.h
FUNCTION: int X509_NAME_get_text_by_NID ( X509_NAME* name, int nid, void* buf, int len )
FUNCTION: int X509_get_ext_by_NID ( X509* a, int nid, int lastpos )
FUNCTION: void* X509_get_ext_d2i ( X509 *a, int nid, int* crit, int* idx )
FUNCTION: X509_NAME* X509_get_issuer_name ( X509* a )

FUNCTION: long SSL_ctrl ( SSL* ssl, int cmd, long larg, void* parg )

FUNCTION: int SSL_shutdown ( SSL* ssl )
FUNCTION: int SSL_get_shutdown ( SSL* ssl )

FUNCTION: int SSL_want ( SSL* ssl )
FUNCTION: long SSL_get_verify_result ( SSL* ssl )
FUNCTION: X509* SSL_get_peer_certificate ( SSL* s )

FUNCTION: int SSL_set_cipher_list ( SSL* ssl, c-string str )
FUNCTION: int SSL_use_RSAPrivateKey_file ( SSL* ssl, c-string str )
FUNCTION: int SSL_use_certificate_file ( SSL* ssl, c-string str, int type )

FUNCTION: SSL* SSL_load_client_CA_file ( c-string file )

! ------------------------------------------------------------------------------
! SSL_CTX
! ------------------------------------------------------------------------------
FUNCTION: SSL_CTX* SSL_CTX_new ( ssl-method method )
FUNCTION: void SSL_CTX_free ( SSL_CTX* ctx )

! Load the certificates and private keys into the SSL_CTX
FUNCTION: int SSL_CTX_use_certificate_chain_file ( SSL_CTX* ctx,
                                                   c-string file ) ! PEM type
FUNCTION: int SSL_CTX_use_certificate ( SSL_CTX* ctx, X509* x )

FUNCTION: SSL* SSL_new ( SSL_CTX* ctx )


FUNCTION: int SSL_CTX_set_default_verify_paths ( SSL_CTX* ctx )
FUNCTION: int SSL_CTX_set_session_id_context ( SSL_CTX* ctx,
                                               c-string sid_ctx,
                                               uint len )
FUNCTION: int SSL_CTX_use_RSAPrivateKey_file ( SSL_CTX* ctx, int type )
FUNCTION: int SSL_CTX_load_verify_locations ( SSL_CTX* ctx,
                                              c-string CAfile,
                                              c-string CApath )
FUNCTION: void SSL_CTX_set_verify ( SSL_CTX* ctx, int mode, void* callback )
FUNCTION: void SSL_CTX_set_client_CA_list ( SSL_CTX* ctx, SSL* list )

! Used to manipulate settings of the SSL_CTX and SSL objects.
! This function should never be called directly
