2020-07-12 15:21:40 +03:00
|
|
|
module openssl
|
|
|
|
|
2020-12-05 22:27:16 +03:00
|
|
|
// On Linux, prefer a localy built openssl, because it is
|
2020-07-12 15:21:40 +03:00
|
|
|
// much more likely for it to be newer, than the system
|
|
|
|
// openssl from libssl-dev. If there is no local openssl,
|
|
|
|
// the next flag is harmless, since it will still use the
|
|
|
|
// (older) system openssl.
|
|
|
|
#flag linux -I/usr/local/include/openssl -L/usr/local/lib
|
2020-08-22 01:50:38 +03:00
|
|
|
#flag windows -l libssl -l libcrypto
|
2020-07-12 15:21:40 +03:00
|
|
|
#flag -l ssl -l crypto
|
|
|
|
// MacPorts
|
|
|
|
#flag darwin -I/opt/local/include
|
|
|
|
#flag darwin -L/opt/local/lib
|
|
|
|
// Brew
|
|
|
|
#flag darwin -I/usr/local/opt/openssl/include
|
|
|
|
#flag darwin -L/usr/local/opt/openssl/lib
|
2020-12-05 22:27:16 +03:00
|
|
|
// Brew arm64
|
|
|
|
#flag -I /opt/homebrew/Cellar/openssl@1.1/1.1.1h/include
|
|
|
|
#flag -L /opt/homebrew/Cellar/openssl@1.1/1.1.1h/lib
|
|
|
|
//
|
2020-10-17 19:30:47 +03:00
|
|
|
#include <openssl/rand.h> # Please install OpenSSL development headers
|
2020-07-12 15:21:40 +03:00
|
|
|
#include <openssl/ssl.h>
|
|
|
|
#include <openssl/err.h>
|
2020-12-05 22:27:16 +03:00
|
|
|
pub struct C.SSL {
|
|
|
|
}
|
2020-07-12 15:21:40 +03:00
|
|
|
|
2020-12-05 22:27:16 +03:00
|
|
|
pub struct SSL_CTX {
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct SSL {
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct SSL_METHOD {
|
|
|
|
}
|
2020-07-12 15:21:40 +03:00
|
|
|
|
|
|
|
fn C.BIO_new_ssl_connect() voidptr
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.BIO_set_conn_hostname() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.BIO_get_ssl()
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.BIO_do_connect() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.BIO_do_handshake() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.BIO_puts()
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.BIO_read() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.BIO_free_all()
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_CTX_new() &C.SSL_CTX
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_CTX_set_options()
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_CTX_set_verify_depth()
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_CTX_load_verify_locations() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_CTX_free()
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_new() &C.SSL
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_set_fd() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_connect() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_set_cipher_list() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_get_peer_certificate() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-11-21 16:45:45 +03:00
|
|
|
fn C.ERR_clear_error()
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-08-22 01:50:38 +03:00
|
|
|
fn C.SSL_get_error() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_get_verify_result() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_set_tlsext_host_name() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-11-21 16:45:45 +03:00
|
|
|
fn C.SSL_shutdown() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_free()
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_write() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_read() int
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_load_error_strings()
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSL_library_init()
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.SSLv23_client_method() &C.SSL_METHOD
|
2020-12-05 22:27:16 +03:00
|
|
|
|
2020-12-11 03:04:12 +03:00
|
|
|
fn C.TLS_method() voidptr
|
|
|
|
|
2020-07-12 15:21:40 +03:00
|
|
|
fn C.TLSv1_2_method() voidptr
|
|
|
|
|
|
|
|
fn init() {
|
2020-08-22 01:50:38 +03:00
|
|
|
C.SSL_load_error_strings()
|
2020-07-12 15:21:40 +03:00
|
|
|
C.SSL_library_init()
|
|
|
|
}
|
|
|
|
|
|
|
|
pub const (
|
|
|
|
is_used = 1
|
|
|
|
)
|