1module openssl 2 3// On linux, prefer a localy build openssl, because it is 4// much more likely for it to be newer, than the system 5// openssl from libssl-dev. If there is no local openssl, 6// the next flag is harmless, since it will still use the 7// (older) system openssl. 8#flag linux -I/usr/local/include/openssl -L/usr/local/lib 9#flag -l ssl -l crypto 10// MacPorts 11#flag darwin -I/opt/local/include 12#flag darwin -L/opt/local/lib 13// Brew 14#flag darwin -I/usr/local/opt/openssl/include 15#flag darwin -L/usr/local/opt/openssl/lib 16#include <openssl/rand.h> 17#include <openssl/ssl.h> 18#include <openssl/err.h> 19 20pub struct C.SSL {} 21pub struct SSL_CTX {} 22pub struct SSL {} 23pub struct SSL_METHOD {} 24 25fn C.BIO_new_ssl_connect() voidptr 26fn C.BIO_set_conn_hostname() int 27fn C.BIO_get_ssl() 28fn C.BIO_do_connect() int 29fn C.BIO_do_handshake() int 30fn C.BIO_puts() 31fn C.BIO_read() int 32fn C.BIO_free_all() 33fn C.SSL_CTX_new() &C.SSL_CTX 34fn C.SSL_CTX_set_options() 35fn C.SSL_CTX_set_verify_depth() 36fn C.SSL_CTX_load_verify_locations() int 37fn C.SSL_CTX_free() 38fn C.SSL_new() &C.SSL 39fn C.SSL_set_fd() int 40fn C.SSL_connect() int 41fn C.SSL_set_cipher_list() int 42fn C.SSL_get_peer_certificate() int 43fn C.SSL_get_verify_result() int 44fn C.SSL_set_tlsext_host_name() int 45fn C.SSL_shutdown() 46fn C.SSL_free() 47fn C.SSL_write() int 48fn C.SSL_read() int 49fn C.SSL_load_error_strings() 50fn C.SSL_library_init() 51fn C.SSLv23_client_method() &C.SSL_METHOD 52fn C.TLSv1_2_method() voidptr 53 54fn init() { 55 C.SSL_library_init() 56} 57 58pub const ( 59 is_used = 1 60) 61