From 25f18f4522a8bf4f2311bd56508f9fa3ced11041 Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Sun, 4 Aug 2019 08:09:02 -0500 Subject: [PATCH 1/7] Add support for MesaLink as a TLS backend This adds support for compiling libcurl with MesaLink as the TLS backend on all platforms, disabled by default using a crate feature. --- .gitmodules | 3 +++ Cargo.toml | 5 +++- curl-sys/Cargo.toml | 7 ++++- curl-sys/build.rs | 63 ++++++++++++++++++++++++--------------------- curl-sys/mesalink | 1 + 5 files changed, 48 insertions(+), 31 deletions(-) create mode 160000 curl-sys/mesalink diff --git a/.gitmodules b/.gitmodules index b69d1a5865..9850958717 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "curl-sys/curl"] path = curl-sys/curl url = https://github.com/curl/curl +[submodule "curl-sys/mesalink"] + path = curl-sys/mesalink + url = https://github.com/mesalock-linux/mesalink.git diff --git a/Cargo.toml b/Cargo.toml index bf4937a010..f20607fa36 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,10 +37,13 @@ mio-extras = "2.0.3" [workspace] members = ["systest"] +exclude = ["curl-sys/mesalink"] [features] default = ["ssl"] -ssl = ["openssl-sys", "openssl-probe", "curl-sys/ssl"] +ssl = ["openssl"] # OpenSSL by default +openssl = ["openssl-sys", "openssl-probe", "curl-sys/openssl"] # OpenSSL TLS backend +mesalink = ["curl-sys/mesalink"] # MesaLink TLS backend http2 = ["curl-sys/http2"] static-curl = ["curl-sys/static-curl"] static-ssl = ["curl-sys/static-ssl"] diff --git a/curl-sys/Cargo.toml b/curl-sys/Cargo.toml index 6a5c625766..2d49b30888 100644 --- a/curl-sys/Cargo.toml +++ b/curl-sys/Cargo.toml @@ -23,6 +23,10 @@ libz-sys = "1.0.18" libc = "0.2.2" libnghttp2-sys = { optional = true, version = "0.1" } +[dependencies.mesalink] +path = "mesalink" +optional = true + [target.'cfg(all(unix, not(target_os = "macos")))'.dependencies] openssl-sys = { version = "0.9", optional = true } @@ -38,7 +42,8 @@ cc = "1.0" [features] default = ["ssl"] -ssl = ["openssl-sys"] +ssl = ["openssl"] # OpenSSL by default +openssl = ["openssl-sys"] # OpenSSL TLS backend http2 = ["libnghttp2-sys"] static-curl = [] static-ssl = ["openssl-sys/vendored"] diff --git a/curl-sys/build.rs b/curl-sys/build.rs index 57662e8294..254c35bd27 100644 --- a/curl-sys/build.rs +++ b/curl-sys/build.rs @@ -211,13 +211,15 @@ fn main() { .file("curl/lib/vauth/vauth.c"); } - if windows { - cfg.define("USE_THREADS_WIN32", None) - .define("HAVE_IOCTLSOCKET_FIONBIO", None) - .define("USE_WINSOCK", None) - .file("curl/lib/system_win32.c"); - - if cfg!(feature = "ssl") { + if cfg!(feature = "ssl") { + if cfg!(feature = "mesalink") { + cfg.define("USE_MESALINK", None) + .include("mesalink") + .file("curl/lib/vtls/mesalink.c"); + + println!("cargo:rustc-link-lib=static=mesalink"); + println!("cargo:rustc-link-search=native=mesalink/target/debug"); + } else if windows { cfg.define("USE_WINDOWS_SSPI", None) .define("USE_SCHANNEL", None) .file("curl/lib/x509asn1.c") @@ -225,7 +227,32 @@ fn main() { .file("curl/lib/socks_sspi.c") .file("curl/lib/vtls/schannel.c") .file("curl/lib/vtls/schannel_verify.c"); + } else if target.contains("-apple-") { + cfg.define("USE_SECTRANSP", None) + .file("curl/lib/vtls/sectransp.c"); + if xcode_major_version().map_or(true, |v| v >= 9) { + // On earlier Xcode versions (<9), defining HAVE_BUILTIN_AVAILABLE + // would cause __bultin_available() to fail to compile due to + // unrecognized platform names, so we try to check for Xcode + // version first (if unknown, assume it's recent, as in >= 9). + cfg.define("HAVE_BUILTIN_AVAILABLE", "1"); + } + } else { + cfg.define("USE_OPENSSL", None) + .file("curl/lib/vtls/openssl.c"); + + println!("cargo:rustc-cfg=link_openssl"); + if let Some(path) = env::var_os("DEP_OPENSSL_INCLUDE") { + cfg.include(path); + } } + } + + if windows { + cfg.define("USE_THREADS_WIN32", None) + .define("HAVE_IOCTLSOCKET_FIONBIO", None) + .define("USE_WINSOCK", None) + .file("curl/lib/system_win32.c"); if cfg!(feature = "spnego") { cfg.file("curl/lib/vauth/spnego_sspi.c"); @@ -265,28 +292,6 @@ fn main() { .define("SIZEOF_INT", "4") .define("SIZEOF_SHORT", "2"); - if cfg!(feature = "ssl") { - if target.contains("-apple-") { - cfg.define("USE_SECTRANSP", None) - .file("curl/lib/vtls/sectransp.c"); - if xcode_major_version().map_or(true, |v| v >= 9) { - // On earlier Xcode versions (<9), defining HAVE_BUILTIN_AVAILABLE - // would cause __bultin_available() to fail to compile due to - // unrecognized platform names, so we try to check for Xcode - // version first (if unknown, assume it's recent, as in >= 9). - cfg.define("HAVE_BUILTIN_AVAILABLE", "1"); - } - } else { - cfg.define("USE_OPENSSL", None) - .file("curl/lib/vtls/openssl.c"); - - println!("cargo:rustc-cfg=link_openssl"); - if let Some(path) = env::var_os("DEP_OPENSSL_INCLUDE") { - cfg.include(path); - } - } - } - if cfg!(feature = "spnego") { cfg.define("HAVE_GSSAPI", None) .file("curl/lib/curl_gssapi.c") diff --git a/curl-sys/mesalink b/curl-sys/mesalink new file mode 160000 index 0000000000..94b719b88d --- /dev/null +++ b/curl-sys/mesalink @@ -0,0 +1 @@ +Subproject commit 94b719b88d7434cce6a05471d1662049140a5270 From 6cb66813e62b223b7afa02b2f2a0a58173f055cf Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Thu, 8 Aug 2019 19:52:20 -0500 Subject: [PATCH 2/7] Reproducible demo build --- .gitmodules | 3 - Cargo.toml | 3 +- curl-sys/Cargo.toml | 6 +- curl-sys/build.rs | 15 +- curl-sys/include/mesalink/mesalink/bio.h | 61 +++++ curl-sys/include/mesalink/mesalink/err.h | 154 +++++++++++++ curl-sys/include/mesalink/mesalink/evp.h | 35 +++ .../include/mesalink/mesalink/openssl/bio.h | 55 +++++ .../include/mesalink/mesalink/openssl/err.h | 50 ++++ .../include/mesalink/mesalink/openssl/evp.h | 33 +++ .../include/mesalink/mesalink/openssl/pem.h | 34 +++ .../mesalink/mesalink/openssl/safestack.h | 29 +++ .../include/mesalink/mesalink/openssl/ssl.h | 173 ++++++++++++++ .../include/mesalink/mesalink/openssl/x509.h | 55 +++++ curl-sys/include/mesalink/mesalink/options.h | 53 +++++ curl-sys/include/mesalink/mesalink/pem.h | 48 ++++ curl-sys/include/mesalink/mesalink/ssl.h | 214 ++++++++++++++++++ curl-sys/include/mesalink/mesalink/version.h | 29 +++ .../include/mesalink/mesalink/visibility.h | 29 +++ curl-sys/include/mesalink/mesalink/x509.h | 70 ++++++ curl-sys/lib.rs | 2 + curl-sys/mesalink | 1 - 22 files changed, 1134 insertions(+), 18 deletions(-) create mode 100644 curl-sys/include/mesalink/mesalink/bio.h create mode 100644 curl-sys/include/mesalink/mesalink/err.h create mode 100644 curl-sys/include/mesalink/mesalink/evp.h create mode 100644 curl-sys/include/mesalink/mesalink/openssl/bio.h create mode 100644 curl-sys/include/mesalink/mesalink/openssl/err.h create mode 100644 curl-sys/include/mesalink/mesalink/openssl/evp.h create mode 100644 curl-sys/include/mesalink/mesalink/openssl/pem.h create mode 100644 curl-sys/include/mesalink/mesalink/openssl/safestack.h create mode 100644 curl-sys/include/mesalink/mesalink/openssl/ssl.h create mode 100644 curl-sys/include/mesalink/mesalink/openssl/x509.h create mode 100644 curl-sys/include/mesalink/mesalink/options.h create mode 100644 curl-sys/include/mesalink/mesalink/pem.h create mode 100644 curl-sys/include/mesalink/mesalink/ssl.h create mode 100644 curl-sys/include/mesalink/mesalink/version.h create mode 100644 curl-sys/include/mesalink/mesalink/visibility.h create mode 100644 curl-sys/include/mesalink/mesalink/x509.h delete mode 160000 curl-sys/mesalink diff --git a/.gitmodules b/.gitmodules index 9850958717..b69d1a5865 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "curl-sys/curl"] path = curl-sys/curl url = https://github.com/curl/curl -[submodule "curl-sys/mesalink"] - path = curl-sys/mesalink - url = https://github.com/mesalock-linux/mesalink.git diff --git a/Cargo.toml b/Cargo.toml index f20607fa36..3d34cc884f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,8 +41,7 @@ exclude = ["curl-sys/mesalink"] [features] default = ["ssl"] -ssl = ["openssl"] # OpenSSL by default -openssl = ["openssl-sys", "openssl-probe", "curl-sys/openssl"] # OpenSSL TLS backend +ssl = ["openssl-sys", "openssl-probe", "curl-sys/ssl"] # OpenSSL/system TLS backend mesalink = ["curl-sys/mesalink"] # MesaLink TLS backend http2 = ["curl-sys/http2"] static-curl = ["curl-sys/static-curl"] diff --git a/curl-sys/Cargo.toml b/curl-sys/Cargo.toml index 2d49b30888..9904b8df56 100644 --- a/curl-sys/Cargo.toml +++ b/curl-sys/Cargo.toml @@ -24,7 +24,8 @@ libc = "0.2.2" libnghttp2-sys = { optional = true, version = "0.1" } [dependencies.mesalink] -path = "mesalink" +git = "https://github.com/mesalock-linux/mesalink" +tag = "v1.0.0" optional = true [target.'cfg(all(unix, not(target_os = "macos")))'.dependencies] @@ -42,8 +43,7 @@ cc = "1.0" [features] default = ["ssl"] -ssl = ["openssl"] # OpenSSL by default -openssl = ["openssl-sys"] # OpenSSL TLS backend +ssl = ["openssl-sys"] http2 = ["libnghttp2-sys"] static-curl = [] static-ssl = ["openssl-sys/vendored"] diff --git a/curl-sys/build.rs b/curl-sys/build.rs index 254c35bd27..7169e7d5ba 100644 --- a/curl-sys/build.rs +++ b/curl-sys/build.rs @@ -211,15 +211,12 @@ fn main() { .file("curl/lib/vauth/vauth.c"); } - if cfg!(feature = "ssl") { - if cfg!(feature = "mesalink") { - cfg.define("USE_MESALINK", None) - .include("mesalink") - .file("curl/lib/vtls/mesalink.c"); - - println!("cargo:rustc-link-lib=static=mesalink"); - println!("cargo:rustc-link-search=native=mesalink/target/debug"); - } else if windows { + if cfg!(feature = "mesalink") { + cfg.define("USE_MESALINK", None) + .include("include/mesalink") + .file("curl/lib/vtls/mesalink.c"); + } else if cfg!(feature = "ssl") { + if windows { cfg.define("USE_WINDOWS_SSPI", None) .define("USE_SCHANNEL", None) .file("curl/lib/x509asn1.c") diff --git a/curl-sys/include/mesalink/mesalink/bio.h b/curl-sys/include/mesalink/mesalink/bio.h new file mode 100644 index 0000000000..9b38069892 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/bio.h @@ -0,0 +1,61 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2019, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_BIO_H +#define MESALINK_BIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +typedef struct MESALINK_BIO_METHOD MESALINK_BIO_METHOD; +typedef struct MESALINK_BIO MESALINK_BIO; + +#define BIO_NOCLOSE 0x00 +#define BIO_CLOSE 0x01 + +MESALINK_API MESALINK_BIO *mesalink_BIO_new(const MESALINK_BIO_METHOD *); +MESALINK_API void mesalink_BIO_free(MESALINK_BIO *); + +MESALINK_API int mesalink_BIO_read(MESALINK_BIO *, void *, int); +MESALINK_API int mesalink_BIO_gets(MESALINK_BIO *, char *, int); +MESALINK_API int mesalink_BIO_write(MESALINK_BIO *, const void *, int); +MESALINK_API int mesalink_BIO_puts(MESALINK_BIO *, const char *); + +MESALINK_API MESALINK_BIO_METHOD *mesalink_BIO_s_file(void); +MESALINK_API MESALINK_BIO *mesalink_BIO_new_fp(FILE *, int); +MESALINK_API void mesalink_BIO_set_fp(MESALINK_BIO *, FILE *, int); +MESALINK_API int mesalink_BIO_get_close(MESALINK_BIO *); +MESALINK_API int mesalink_BIO_set_close(MESALINK_BIO *, long); + +MESALINK_API MESALINK_BIO *mesalink_BIO_new_file(const char *, const char *); +MESALINK_API int mesalink_BIO_read_filename(MESALINK_BIO *, const char *); +MESALINK_API int mesalink_BIO_write_filename(MESALINK_BIO *, const char *); +MESALINK_API int mesalink_BIO_append_filename(MESALINK_BIO *, const char *); +MESALINK_API int mesalink_BIO_rw_filename(MESALINK_BIO *, const char *); + +MESALINK_API MESALINK_BIO_METHOD *mesalink_BIO_s_mem(void); +MESALINK_API MESALINK_BIO *mesalink_BIO_new_mem_buf(const void *, int); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_BIO_H */ diff --git a/curl-sys/include/mesalink/mesalink/err.h b/curl-sys/include/mesalink/mesalink/err.h new file mode 100644 index 0000000000..3dd7f61e27 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/err.h @@ -0,0 +1,154 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2018, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_ERR_H +#define MESALINK_ERR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +enum +{ + // OpenSSL error codes + MESALINK_ERROR_NONE = 0, + MESALINK_ERROR_ZERO_RETURN = 1, + MESALINK_ERROR_WANT_READ = 2, + MESALINK_ERROR_WANT_WRITE = 3, + MESALINK_ERROR_WANT_CONNECT = 7, + MESALINK_ERROR_WANT_ACCEPT = 8, + MESALINK_ERROR_SYSCALL = 5, + MESALINK_ERROR_SSL = 0x55, + MESALINK_ERROR_NULL_POINTER = 0xe0, + MESALINK_ERROR_MALFORMED_OBJECT = 0xe1, + MESALINK_ERROR_BAD_FUNC_ARG = 0xe2, + MESALINK_ERROR_PANIC = 0xe3, + MESALINK_ERROR_LOCK = 0xe4, + // Rust IO ErrorKind codes + IO_ERROR_NOT_FOUND = 0x02000001, + IO_ERROR_PERMISSION_DENIED = 0x02000002, + IO_ERROR_CONNECTION_REFUSED = 0x02000003, + IO_ERROR_CONNECTION_RESET = 0x02000004, + IO_ERROR_CONNECTION_ABORTED = 0x02000005, + IO_ERROR_NOT_CONNECTED = 0x02000006, + IO_ERROR_ADDR_IN_USE = 0x02000007, + IO_ERROR_ADDR_NOT_AVAILABLE = 0x02000008, + IO_ERROR_BROKEN_PIPE = 0x02000009, + IO_ERROR_ALREADY_EXISTS = 0x0200000a, + IO_ERROR_WOULD_BLOCK = 0x0200000b, + IO_ERROR_INVALID_INPUT = 0x0200000c, + IO_ERROR_INVALID_DATA = 0x0200000d, + IO_ERROR_TIMED_OUT = 0x0200000e, + IO_ERROR_WRITE_ZERO = 0x0200000f, + IO_ERROR_INTERRUPTED = 0x02000010, + IO_ERROR_OTHER = 0x02000011, + IO_ERROR_UNEXPECTED_EOF = 0x02000012, + // TLS error codes + TLS_ERROR_INAPPROPRIATE_MESSAGE = 0x03000100, + TLS_ERROR_INAPPROPRIATE_HANDSHAKE_MESSAGE = 0x03000200, + TLS_ERROR_CORRUPT_MESSAGE = 0x03000300, + TLS_ERROR_CORRUPT_MESSAGE_PAYLOAD = 0x03000400, + TLS_ERROR_CORRUPT_MESSAGE_PAYLOAD_ALERT = 0x03000401, + TLS_ERROR_CORRUPT_MESSAGE_PAYLOAD_CHANGE_CIPHER_SPEC = 0x03000402, + TLS_ERROR_CORRUPT_MESSAGE_PAYLOAD_HANDSHAKE = 0x03000403, + TLS_ERROR_NO_CERTIFICATES_PRESENTED = 0x03000500, + TLS_ERROR_DECRYPT_ERROR = 0x03000600, + TLS_ERROR_PEER_INCOMPATIBLE_ERROR = 0x03000700, + TLS_ERROR_PEER_MISBEHAVED_ERROR = 0x03000800, + TLS_ERROR_ALERT_RECEIVED_ERRORS = 0x03000900, + TLS_ERROR_ALERT_RECEIVED_CLOSE_NOTIFY = 0x03000901, + TLS_ERROR_ALERT_RECEIVED_UNEXPECTED_MESSAGE = 0x03000902, + TLS_ERROR_ALERT_RECEIVED_BAD_RECORD_MAC = 0x03000903, + TLS_ERROR_ALERT_RECEIVED_DECRYPTION_FAILED = 0x03000904, + TLS_ERROR_ALERT_RECEIVED_RECORD_OVERFLOW = 0x03000905, + TLS_ERROR_ALERT_RECEIVED_DECOMPRESSION_FAILURE = 0x03000906, + TLS_ERROR_ALERT_RECEIVED_HANDSHAKE_FAILURE = 0x03000907, + TLS_ERROR_ALERT_RECEIVED_NO_CERTIFICATE = 0x03000908, + TLS_ERROR_ALERT_RECEIVED_BAD_CERTIFICATE = 0x03000909, + TLS_ERROR_ALERT_RECEIVED_UNSUPPORTED_CERTIFICATE = 0x0300090a, + TLS_ERROR_ALERT_RECEIVED_CERTIFICATE_REVOKED = 0x0300090b, + TLS_ERROR_ALERT_RECEIVED_CERTIFICATE_EXPIRED = 0x0300090c, + TLS_ERROR_ALERT_RECEIVED_CERTIFICATE_UNKNOWN = 0x0300090d, + TLS_ERROR_ALERT_RECEIVED_ILLEGAL_PARAMETER = 0x0300090e, + TLS_ERROR_ALERT_RECEIVED_UNKNOWN_CA = 0x0300090f, + TLS_ERROR_ALERT_RECEIVED_ACCESS_DENIED = 0x03000910, + TLS_ERROR_ALERT_RECEIVED_DECODE_ERROR = 0x03000911, + TLS_ERROR_ALERT_RECEIVED_DECRYPT_ERROR = 0x03000912, + TLS_ERROR_ALERT_RECEIVED_EXPORT_RESTRICTION = 0x03000913, + TLS_ERROR_ALERT_RECEIVED_PROTOCOL_VERSION = 0x03000914, + TLS_ERROR_ALERT_RECEIVED_INSUFFICIENT_SECURITY = 0x03000915, + TLS_ERROR_ALERT_RECEIVED_INTERNAL_ERROR = 0x03000916, + TLS_ERROR_ALERT_RECEIVED_INAPPROPRIATE_FALLBACK = 0x03000917, + TLS_ERROR_ALERT_RECEIVED_USER_CANCELED = 0x03000918, + TLS_ERROR_ALERT_RECEIVED_NO_RENEGOTIATION = 0x03000919, + TLS_ERROR_ALERT_RECEIVED_MISSING_EXTENSION = 0x0300091a, + TLS_ERROR_ALERT_RECEIVED_UNSUPPORTED_EXTENSION = 0x0300091b, + TLS_ERROR_ALERT_RECEIVED_CERTIFICATE_UNOBTAINABLE = 0x0300091c, + TLS_ERROR_ALERT_RECEIVED_UNRECOGNISED_NAME = 0x0300091d, + TLS_ERROR_ALERT_RECEIVED_BAD_CERTIFICATE_STATUS_RESPONSE = 0x0300091e, + TLS_ERROR_ALERT_RECEIVED_BAD_CERTIFICATE_HASH_VALUE = 0x0300091f, + TLS_ERROR_ALERT_RECEIVED_UNKNOWN_PSK_IDENTITY = 0x03000920, + TLS_ERROR_ALERT_RECEIVED_CERTIFICATE_REQUIRED = 0x03000921, + TLS_ERROR_ALERT_RECEIVED_NO_APPLICATION_PROTOCOL = 0x03000922, + TLS_ERROR_ALERT_RECEIVED_UNKNOWN = 0x030009ff, + TLS_ERROR_WEBPKI_ERRORS = 0x03000a00, + TLS_ERROR_WEBPKI_BAD_DER = 0x03000a01, + TLS_ERROR_WEBPKI_BAD_DER_TIME = 0x03000a02, + TLS_ERROR_WEBPKI_CA_USED_AS_END_ENTITY = 0x03000a03, + TLS_ERROR_WEBPKI_CERT_EXPIRED = 0x03000a04, + TLS_ERROR_WEBPKI_CERT_NOT_VALID_FOR_NAME = 0x03000a05, + TLS_ERROR_WEBPKI_CERT_NOT_VALID_YET = 0x03000a06, + TLS_ERROR_WEBPKI_END_ENTITY_USED_AS_CA = 0x03000a07, + TLS_ERROR_WEBPKI_EXTENSION_VALUE_INVALID = 0x03000a08, + TLS_ERROR_WEBPKI_INVALID_CERT_VALIDITY = 0x03000a09, + TLS_ERROR_WEBPKI_INVALID_SIGNATURE_FOR_PUBLIC_KEY = 0x03000a0a, + TLS_ERROR_WEBPKI_NAME_CONSTRAINT_VIOLATION = 0x03000a0b, + TLS_ERROR_WEBPKI_PATH_LEN_CONSTRAINT_VIOLATED = 0x03000a0c, + TLS_ERROR_WEBPKI_SIGNATURE_ALGORITHM_MISMATCH = 0x03000a0d, + TLS_ERROR_WEBPKI_REQUIRED_EKU_NOT_FOUND = 0x03000a0e, + TLS_ERROR_WEBPKI_UNKNOWN_ISSUER = 0x03000a0f, + TLS_ERROR_WEBPKI_UNSUPPORTED_CERT_VERSION = 0x03000a10, + TLS_ERROR_WEBPKI_UNSUPPORTED_CRITICAL_EXTENSION = 0x03000a11, + TLS_ERROR_WEBPKI_UNSUPPORTED_SIGNATURE_ALGORITHM_FOR_PUBLIC_KEY = 0x03000a12, + TLS_ERROR_WEBPKI_UNSUPPORTED_SIGNATURE_ALGORITHM = 0x03000a13, + TLS_ERROR_INVALID_SCT = 0x03000b00, + TLS_ERROR_GENERAL = 0x03000c00, + TLS_ERROR_FAILED_TO_GET_CURRENT_TIME = 0x03000d00, + TLS_ERROR_INVALID_DNS_NAME = 0x03000e00, + TLS_ERROR_HANDSHAKE_NOT_COMPLETE = 0x03000f00, + TLS_ERROR_PEER_SENT_OVERSIZED_RECORD = 0x03001000, + UNDEFINED_ERROR = 0xeeeeeeee, +}; + +MESALINK_API const char *mesalink_ERR_error_string_n(unsigned long e, + char *buf, size_t len); +MESALINK_API const char *mesalink_ERR_reason_error_string(unsigned long e); + +MESALINK_API unsigned long mesalink_ERR_get_error(void); +MESALINK_API unsigned long mesalink_ERR_peek_last_error(void); +MESALINK_API void mesalink_ERR_clear_error(void); + +MESALINK_API void mesalink_ERR_print_errors_fp(const FILE *); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_ERR_H */ diff --git a/curl-sys/include/mesalink/mesalink/evp.h b/curl-sys/include/mesalink/mesalink/evp.h new file mode 100644 index 0000000000..e7c2498305 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/evp.h @@ -0,0 +1,35 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2019, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_EVP_H +#define MESALINK_EVP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +typedef struct MESALINK_EVP_PKEY MESALINK_EVP_PKEY; + +MESALINK_API void mesalink_EVP_PKEY_free(MESALINK_EVP_PKEY *); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_EVP_H */ \ No newline at end of file diff --git a/curl-sys/include/mesalink/mesalink/openssl/bio.h b/curl-sys/include/mesalink/mesalink/openssl/bio.h new file mode 100644 index 0000000000..5f041e59a6 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/openssl/bio.h @@ -0,0 +1,55 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2019, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_OPENSSL_BIO_H +#define MESALINK_OPENSSL_BIO_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define BIO_METHOD MESALINK_BIO_METHOD +#define BIO MESALINK_BIO + +#define BIO_new mesalink_BIO_new +#define BIO_free mesalink_BIO_free + +#define BIO_read mesalink_BIO_read +#define BIO_gets mesalink_BIO_gets +#define BIO_write mesalink_BIO_write +#define BIO_puts mesalink_BIO_puts + +#define BIO_s_file mesalink_BIO_s_file +#define BIO_new_fp mesalink_BIO_new_fp +#define BIO_set_fp mesalink_BIO_set_fp +#define BIO_get_close mesalink_BIO_get_close +#define BIO_set_close mesalink_BIO_set_close + +#define BIO_new_file mesalink_BIO_new_file +#define BIO_read_filename mesalink_BIO_read_filename +#define BIO_write_filename mesalink_BIO_write_filename +#define BIO_append_filename mesalink_BIO_append_filename +#define BIO_rw_filename mesalink_BIO_rw_filename + +#define BIO_s_mem mesalink_BIO_s_mem +#define BIO_new_mem_buf mesalink_BIO_new_mem_buf + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_OPENSSL_BIO_H */ \ No newline at end of file diff --git a/curl-sys/include/mesalink/mesalink/openssl/err.h b/curl-sys/include/mesalink/mesalink/openssl/err.h new file mode 100644 index 0000000000..9793517f5f --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/openssl/err.h @@ -0,0 +1,50 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2018, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_OPENSSL_ERR_H +#define MESALINK_OPENSSL_ERR_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SSL_ERROR_WANT_READ MESALINK_ERROR_WANT_READ +#define SSL_ERROR_WANT_WRITE MESALINK_ERROR_WANT_WRITE +#define SSL_ERROR_WANT_CONNECT MESALINK_ERROR_WANT_CONNECT +#define SSL_ERROR_WANT_ACCEPT MESALINK_ERROR_WANT_ACCEPT +#define SSL_ERROR_ZERO_RETURN MESALINK_ERROR_ZERO_RETURN +#define SSL_ERROR_SYSCALL MESALINK_ERROR_SYSCALL +#define SSL_ERROR_SSL MESALINK_ERROR_SSL + +#define ERR_load_crypto_strings mesalink_ERR_load_error_strings +#define ERR_free_strings mesalink_ERR_free_error_strings + +#define ERR_error_string_n mesalink_ERR_error_string_n +#define ERR_reason_error_string mesalink_ERR_reason_error_string + +#define ERR_get_error mesalink_ERR_get_error +#define ERR_peek_last_error mesalink_ERR_peek_last_error +#define ERR_clear_error mesalink_ERR_clear_error + +#define ERR_print_errors_fp mesalink_ERR_print_errors_fp + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_OPENSSL_ERR_H */ diff --git a/curl-sys/include/mesalink/mesalink/openssl/evp.h b/curl-sys/include/mesalink/mesalink/openssl/evp.h new file mode 100644 index 0000000000..a47b778667 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/openssl/evp.h @@ -0,0 +1,33 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2019, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_OPENSSL_EVP_H +#define MESALINK_OPENSSL_EVP_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define EVP_PKEY MESALINK_EVP_PKEY + +#define EVP_PKEY_free mesalink_EVP_PKEY_free + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_OPENSSL_EVP_H */ diff --git a/curl-sys/include/mesalink/mesalink/openssl/pem.h b/curl-sys/include/mesalink/mesalink/openssl/pem.h new file mode 100644 index 0000000000..4e1ff20d03 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/openssl/pem.h @@ -0,0 +1,34 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2019, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_OPENSSL_PEM_H +#define MESALINK_OPENSSL_PEM_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define PEM_read_bio_PrivateKey mesalink_PEM_read_bio_PrivateKey +#define PEM_read_PrivateKey mesalink_PEM_read_PrivateKey +#define PEM_read_bio_X509 mesalink_PEM_read_bio_X509 +#define PEM_read_X509 mesalink_PEM_read_X509 + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_OPENSSL_PEM_H */ \ No newline at end of file diff --git a/curl-sys/include/mesalink/mesalink/openssl/safestack.h b/curl-sys/include/mesalink/mesalink/openssl/safestack.h new file mode 100644 index 0000000000..54d1f1654a --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/openssl/safestack.h @@ -0,0 +1,29 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2018, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_OPENSSL_SAFESTACK_H +#define MESALINK_OPENSSL_SAFESTACK_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_OPENSSL_SAFESTACK_H */ diff --git a/curl-sys/include/mesalink/mesalink/openssl/ssl.h b/curl-sys/include/mesalink/mesalink/openssl/ssl.h new file mode 100644 index 0000000000..a9d67c4926 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/openssl/ssl.h @@ -0,0 +1,173 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2018, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +/* ssl.h defines the compatibility layer for OpenSSL */ + +#ifndef MESALINK_OPENSSL_SSL_H +#define MESALINK_OPENSSL_SSL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SSL_CTX MESALINK_CTX +#define SSL MESALINK_SSL +#define SSL_METHOD MESALINK_METHOD +#define CIPHER MESALINK_CIPHER + +#define SSL_VERIFY_NONE MESALINK_SSL_VERIFY_NONE +#define SSL_VERIFY_PEER MESALINK_SSL_VERIFY_PEER +#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT \ + MESALINK_SSL_VERIFY_FAIL_IF_NO_PEER_CERT + +#define SSL_ERROR_NONE MESALINK_ERROR_NONE +#define SSL_FAILURE MESALINK_FAILURE +#define SSL_FATAL_ERROR MESALINK_FATAL_ERROR +#define SSL_SUCCESS MESALINK_SUCCESS + +#define SSL_FILETYPE_PEM MESALINK_FILETYPE_PEM +#define SSL_FILETYPE_ASN1 MESALINK_FILETYPE_ASN1 +#define SSL_FILETYPE_DEFAULT MESALINK_FILETYPE_DEFAULT +#define SSL_FILETYPE_RAW MESALINK_FILETYPE_RAW + +#define SSL_SESS_CACHE_OFF MESALINK_SSL_SESS_CACHE_OFF +#define SSL_SESS_CACHE_CLIENT MESALINK_SSL_SESS_CACHE_CLIENT +#define SSL_SESS_CACHE_SERVER MESALINK_SSL_SESS_CACHE_SERVER +#define SSL_SESS_CACHE_BOTH MESALINK_SSL_SESS_CACHE_BOTH + +#define SSL_EARLY_DATA_NOT_SENT MESALINK_SSL_EARLY_DATA_NOT_SENT +#define SSL_EARLY_DATA_REJECTED MESALINK_SSL_EARLY_DATA_REJECTED +#define SSL_EARLY_DATA_ACCEPTED MESALINK_SSL_EARLY_DATA_ACCEPTED + +#define SSL_library_init mesalink_library_init +#define OpenSSL_add_ssl_algorithms mesalink_add_ssl_algorithms +#define SSL_load_error_strings mesalink_SSL_load_error_strings + +#define TLS_method mesalink_TLS_method +#ifdef HAVE_CLIENT +// Version-flexible methods +#define TLS_client_method mesalink_TLS_client_method +#define SSLv23_client_method mesalink_SSLv23_client_method + +// Not supported +#define SSLv3_client_method mesalink_SSLv3_client_method +#define TLSv1_client_method mesalink_TLSv1_client_method +#define TLSv1_1_client_method mesalink_TLSv1_1_client_method + +// Version-specific methods +#define TLSv1_2_client_method mesalink_TLSv1_2_client_method +#ifdef HAVE_TLS13 +#define TLSv1_3_client_method mesalink_TLSv1_3_client_method +#endif +#endif + +#ifdef HAVE_SERVER +// Version-flexible methods +#define TLS_server_method mesalink_TLS_server_method +#define SSLv23_server_method mesalink_SSLv23_server_method + +// Not supported +#define SSLv3_server_method mesalink_SSLv3_server_method +#define TLSv1_server_method mesalink_TLSv1_server_method +#define TLSv1_1_server_method mesalink_TLSv1_1_server_method + +// Version-specific methods +#define TLSv1_2_server_method mesalink_TLSv1_2_server_method +#ifdef HAVE_TLS13 +#define TLSv1_3_server_method mesalink_TLSv1_3_server_method +#endif + +#endif + +#define SSL_CTX_new mesalink_SSL_CTX_new +#define SSL_CTX_load_verify_locations mesalink_SSL_CTX_load_verify_locations +#define SSL_CTX_use_certificate mesalink_SSL_CTX_use_certificate +#define SSL_CTX_add_extra_chain_cert mesalink_SSL_CTX_add_extra_chain_cert +#define SSL_CTX_use_certificate_chain_file \ + mesalink_SSL_CTX_use_certificate_chain_file +#define SSL_CTX_use_certificate_ASN1 mesalink_SSL_CTX_use_certificate_ASN1 +#define SSL_use_certificate_ASN1 mesalink_SSL_use_certificate_ASN1 +#define SSL_CTX_use_PrivateKey mesalink_SSL_CTX_use_PrivateKey +#define SSL_CTX_use_PrivateKey_file mesalink_SSL_CTX_use_PrivateKey_file +#define SSL_CTX_use_PrivateKey_ASN1 mesalink_SSL_CTX_use_PrivateKey_ASN1 +#define SSL_use_PrivateKey_ASN1 mesalink_SSL_use_PrivateKey_ASN1 +#define SSL_CTX_check_private_key mesalink_SSL_CTX_check_private_key +#define SSL_check_private_key mesalink_SSL_check_private_key +#define SSL_CTX_set_verify mesalink_SSL_CTX_set_verify +#define SSL_CTX_set_session_cache_mode mesalink_SSL_CTX_set_session_cache_mode +#define SSL_CTX_get_session_cache_mode mesalink_SSL_CTX_get_session_cache_mode +#define SSL_CTX_sess_set_cache_size mesalink_SSL_CTX_sess_set_cache_size +#define SSL_CTX_sess_get_cache_size mesalink_SSL_CTX_sess_get_cache_size +#define SSL_CTX_free mesalink_SSL_CTX_free + +#define SSL_new mesalink_SSL_new +#define SSL_get_current_cipher mesalink_SSL_get_current_cipher +#define SSL_CIPHER_get_name mesalink_SSL_CIPHER_get_name +#define SSL_CIPHER_get_bits mesalink_SSL_CIPHER_get_bits +#define SSL_CIPHER_get_version mesalink_SSL_CIPHER_get_version +#define SSL_get_cipher_name mesalink_SSL_get_cipher_name +#define SSL_get_cipher_bits mesalink_SSL_get_cipher_bits +#define SSL_get_cipher_version mesalink_SSL_get_cipher_version +#define SSL_get_peer_certificate mesalink_SSL_get_peer_certificate +#define SSL_set_tlsext_host_name mesalink_SSL_set_tlsext_host_name +#define SSL_get_SSL_CTX mesalink_SSL_get_SSL_CTX +#define SSL_set_SSL_CTX mesalink_SSL_set_SSL_CTX + +#ifdef HAVE_WINDOWS +#define SSL_set_socket mesalink_SSL_set_socket +#define SSL_get_socket mesalink_SSL_get_socket +#else +#define SSL_set_fd mesalink_SSL_set_fd +#define SSL_get_fd mesalink_SSL_get_fd +#endif + +#define SSL_do_handshake mesalink_SSL_do_handshake + +#ifdef HAVE_CLIENT +#define SSL_connect mesalink_SSL_connect +#define SSL_connect0 mesalink_SSL_connect0 +#endif +#ifdef HAVE_SERVER +#define SSL_accept mesalink_SSL_accept +#endif + +#define SSL_write mesalink_SSL_write +#define SSL_read mesalink_SSL_read +#ifdef HAVE_TLS13 +#define SSL_write_early_data mesalink_SSL_write_early_data +#define SSL_get_early_data_status mesalink_SSL_get_early_data_status +#endif +#define SSL_flush mesalink_SSL_flush +#define SSL_shutdown mesalink_SSL_shutdown +#define SSL_get_version mesalink_SSL_get_version +#define SSL_free mesalink_SSL_free + +#define SSL_get_error mesalink_SSL_get_error + +#define SSL_set_connect_state mesalink_SSL_set_connect_state +#define SSL_set_accept_state mesalink_SSL_set_accept_state +#define SSL_is_server mesalink_SSL_is_server + +#ifdef HAVE_SGX +#define SSL_CTX_set_sgx_verify mesalink_SSL_CTX_set_sgx_verify +#endif + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_OPENSSL_SSL_H */ diff --git a/curl-sys/include/mesalink/mesalink/openssl/x509.h b/curl-sys/include/mesalink/mesalink/openssl/x509.h new file mode 100644 index 0000000000..b2728a18f4 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/openssl/x509.h @@ -0,0 +1,55 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2018, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +/* x509.h defines the compatibility layer for OpenSSL */ + +#ifndef MESALINK_OPENSSL_X509_H +#define MESALINK_OPENSSL_X509_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define X509 MESALINK_X509 +#define X509_NAME MESALINK_X509_NAME + +#define STACK_OF(NAME) MESALINK_STACK_OF(MESALINK_##NAME) + +#define X509_free mesalink_X509_free +#define X509_NAME_free mesalink_X509_NAME_free +#define X509_get_subject mesalink_X509_get_subject +#define X509_get_subject_name mesalink_X509_get_subject_name +#define X509_get_alt_subject_names mesalink_X509_get_alt_subject_names +#define X509_NAME_oneline mesalink_X509_NAME_oneline + +#define sk_X509_new_null mesalink_sk_X509_new_null +#define sk_X509_num mesalink_sk_X509_num +#define sk_X509_value mesalink_sk_X509_value +#define sk_X509_push mesalink_sk_X509_push +#define sk_X509_free mesalink_sk_X509_free + +#define sk_X509_NAME_new_null mesalink_sk_X509_NAME_new_null +#define sk_X509_NAME_num mesalink_sk_X509_NAME_num +#define sk_X509_NAME_value mesalink_sk_X509_NAME_value +#define sk_X509_NAME_push mesalink_sk_X509_NAME_push +#define sk_X509_NAME_free mesalink_sk_X509_NAME_free + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_OPENSSL_X509_H */ diff --git a/curl-sys/include/mesalink/mesalink/options.h b/curl-sys/include/mesalink/mesalink/options.h new file mode 100644 index 0000000000..4686cd183b --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/options.h @@ -0,0 +1,53 @@ +/* MesaLink options.h + * generated from configure options + * + * This file is part of MesaLink. + * + */ + +#ifndef MESALINK_OPTIONS_H +#define MESALINK_OPTIONS_H + + +#ifdef __cplusplus +extern "C" { +#endif + +#undef HAVE_CLIENT +#define HAVE_CLIENT + +#undef HAVE_SERVER +#define HAVE_SERVER + +#undef HAVE_ERROR_STRINGS +#define HAVE_ERROR_STRINGS + +#undef HAVE_AESGCM +#define HAVE_AESGCM + +#undef HAVE_CHACHAPOLY +#define HAVE_CHACHAPOLY + +#undef HAVE_TLS13 +#define HAVE_TLS13 + +#undef HAVE_X25519 +#define HAVE_X25519 + +#undef HAVE_ECDH +#define HAVE_ECDH + +#undef HAVE_ECDSA +#define HAVE_ECDSA + +#undef NO_SGX +#define NO_SGX + + +#ifdef __cplusplus +} +#endif + + +#endif /* MESALINK_OPTIONS_H */ + diff --git a/curl-sys/include/mesalink/mesalink/pem.h b/curl-sys/include/mesalink/mesalink/pem.h new file mode 100644 index 0000000000..e3b734d4e9 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/pem.h @@ -0,0 +1,48 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2019, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_PEM_H +#define MESALINK_PEM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include +#include + +typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); + +MESALINK_API MESALINK_EVP_PKEY *mesalink_PEM_read_bio_PrivateKey( + MESALINK_BIO *, MESALINK_EVP_PKEY **, pem_password_cb *cb, void *u); +MESALINK_API MESALINK_EVP_PKEY *mesalink_PEM_read_PrivateKey( + FILE *fp, MESALINK_EVP_PKEY **x, pem_password_cb *cb, void *u); +MESALINK_API MESALINK_X509 *mesalink_PEM_read_bio_X509(MESALINK_BIO *, + MESALINK_X509 **, + pem_password_cb *cb, + void *u); +MESALINK_API MESALINK_X509 *mesalink_PEM_read_X509(FILE *fp, MESALINK_X509 **x, + pem_password_cb *cb, + void *u); +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_PEM_H */ \ No newline at end of file diff --git a/curl-sys/include/mesalink/mesalink/ssl.h b/curl-sys/include/mesalink/mesalink/ssl.h new file mode 100644 index 0000000000..ddbe7a5e26 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/ssl.h @@ -0,0 +1,214 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2018, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_SSL_H +#define MESALINK_SSL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include + +typedef struct MESALINK_METHOD MESALINK_METHOD; +typedef struct MESALINK_CTX MESALINK_CTX; +typedef struct MESALINK_CIPHER MESALINK_CIPHER; +typedef struct MESALINK_SSL MESALINK_SSL; + +typedef enum mesalink_verify_mode_t +{ + MESALINK_SSL_VERIFY_NONE = 0, + MESALINK_SSL_VERIFY_PEER = 1, + MESALINK_SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 2, +} mesalink_verify_mode_t; + +typedef enum mesalink_constant_t +{ + MESALINK_FAILURE = 0, + MESALINK_ERROR = -1, + MESALINK_SUCCESS = 1, + + MESALINK_FILETYPE_PEM = 1, + MESALINK_FILETYPE_ASN1 = 2, + MESALINK_FILETYPE_DEFAULT = 2, + MESALINK_FILETYPE_RAW = 3, + + MESALINK_SSL_SESS_CACHE_OFF = 0x0, + MESALINK_SSL_SESS_CACHE_CLIENT = 0x1, + MESALINK_SSL_SESS_CACHE_SERVER = 0x2, + MESALINK_SSL_SESS_CACHE_BOTH = 0x3, + + MESALINK_SSL_EARLY_DATA_NOT_SENT = 0, + MESALINK_SSL_EARLY_DATA_REJECTED = 1, + MESALINK_SSL_EARLY_DATA_ACCEPTED = 2, +} mesalink_constant_t; + +MESALINK_API int mesalink_library_init(void); +MESALINK_API int mesalink_add_ssl_algorithms(void); +MESALINK_API void mesalink_SSL_load_error_strings(void); +MESALINK_API void mesalink_SSL_init_logger(void); +MESALINK_API void mesalink_ERR_load_error_strings(void); +MESALINK_API void mesalink_ERR_free_error_strings(void); + +typedef MESALINK_METHOD *(*mesalink_method_func)(void); +MESALINK_API MESALINK_METHOD *mesalink_TLS_method(void); +#ifdef HAVE_CLIENT +// Version-flexible methods +MESALINK_API MESALINK_METHOD *mesalink_TLS_client_method(void); +MESALINK_API MESALINK_METHOD *mesalink_SSLv23_client_method(void); + +// Not supported +MESALINK_API MESALINK_METHOD *mesalink_SSLv3_client_method(void); +MESALINK_API MESALINK_METHOD *mesalink_TLSv1_client_method(void); +MESALINK_API MESALINK_METHOD *mesalink_TLSv1_1_client_method(void); + +// Version-specific methods +MESALINK_API MESALINK_METHOD *mesalink_TLSv1_2_client_method(void); +#ifdef HAVE_TLS13 +MESALINK_API MESALINK_METHOD *mesalink_TLSv1_3_client_method(void); +#endif +MESALINK_API MESALINK_METHOD *mesalink_TLS_client_method(void); +#endif + +#ifdef HAVE_SERVER +// Version-flexible methods +MESALINK_API MESALINK_METHOD *mesalink_SSLv23_server_method(void); +MESALINK_API MESALINK_METHOD *mesalink_TLSv_server_method(void); + +// Not supported +MESALINK_API MESALINK_METHOD *mesalink_SSLv3_server_method(void); +MESALINK_API MESALINK_METHOD *mesalink_TLSv1_server_method(void); +MESALINK_API MESALINK_METHOD *mesalink_TLSv1_1_server_method(void); + +// Version-specific methods +MESALINK_API MESALINK_METHOD *mesalink_TLSv1_2_server_method(void); +#ifdef HAVE_TLS13 +MESALINK_API MESALINK_METHOD *mesalink_TLSv1_3_server_method(void); +#endif +#endif + +MESALINK_API MESALINK_CTX *mesalink_SSL_CTX_new(MESALINK_METHOD *); +MESALINK_API int mesalink_SSL_CTX_load_verify_locations(MESALINK_CTX *, + const char *, + const char *); + +MESALINK_API int mesalink_SSL_CTX_use_certificate(MESALINK_CTX *, + MESALINK_X509 *); +MESALINK_API int mesalink_SSL_CTX_add_extra_chain_cert(MESALINK_CTX *, + MESALINK_X509 *); +MESALINK_API int mesalink_SSL_CTX_use_certificate_chain_file(MESALINK_CTX *, + const char *, + int); +MESALINK_API int mesalink_SSL_CTX_use_certificate_ASN1(MESALINK_CTX *, int, + const unsigned char *); +MESALINK_API int mesalink_SSL_use_certificate_ASN1(MESALINK_SSL *, + const unsigned char *, int); +MESALINK_API int mesalink_SSL_CTX_use_PrivateKey(MESALINK_CTX *, + MESALINK_EVP_PKEY *); +MESALINK_API int mesalink_SSL_CTX_use_PrivateKey_file(MESALINK_CTX *, + const char *, int); +MESALINK_API int mesalink_SSL_CTX_check_private_key(const MESALINK_CTX *); +MESALINK_API int mesalink_SSL_CTX_use_PrivateKey_ASN1(int, MESALINK_CTX *, + const unsigned char *, + long); +MESALINK_API int mesalink_SSL_use_PrivateKey_ASN1(int, MESALINK_SSL *, + const unsigned char *, long); +MESALINK_API int mesalink_SSL_CTX_check_private_key(const MESALINK_CTX *); +MESALINK_API int mesalink_SSL_check_private_key(const MESALINK_SSL *ctx); + +MESALINK_API int mesalink_SSL_CTX_set_verify(MESALINK_CTX *, int, + int (*cb)(int, MESALINK_CTX *)); +MESALINK_API long mesalink_SSL_CTX_set_session_cache_mode(MESALINK_CTX *, + long); +MESALINK_API long mesalink_SSL_CTX_get_session_cache_mode(MESALINK_CTX *); +MESALINK_API long mesalink_SSL_CTX_sess_set_cache_size(MESALINK_CTX *, long); +MESALINK_API long mesalink_SSL_CTX_sess_get_cache_size(MESALINK_CTX *); +MESALINK_API void mesalink_SSL_CTX_free(MESALINK_CTX *); + +MESALINK_API MESALINK_SSL *mesalink_SSL_new(MESALINK_CTX *); +MESALINK_API MESALINK_CIPHER *mesalink_SSL_get_current_cipher(MESALINK_SSL *); +MESALINK_API const char *mesalink_SSL_CIPHER_get_name(const MESALINK_CIPHER *); +MESALINK_API int mesalink_SSL_CIPHER_get_bits(const MESALINK_CIPHER *, int *); +MESALINK_API const char *mesalink_SSL_CIPHER_get_version( + const MESALINK_CIPHER *); +MESALINK_API const char *mesalink_SSL_get_cipher_name(MESALINK_SSL *); +MESALINK_API int mesalink_SSL_get_cipher_bits(MESALINK_SSL *, int *); +MESALINK_API const char *mesalink_SSL_get_cipher_version(const MESALINK_SSL *); +MESALINK_API MESALINK_X509 *mesalink_SSL_get_peer_certificate( + const MESALINK_SSL *); +MESALINK_API int mesalink_SSL_set_tlsext_host_name(MESALINK_SSL *, + const char *); +MESALINK_API int mesalink_SSL_do_handshake(MESALINK_SSL *); + +#ifdef HAVE_WINDOWS +#include +MESALINK_API int mesalink_SSL_set_socket(MESALINK_SSL *, SOCKET); +MESALINK_API SOCKET mesalink_SSL_get_socket(const MESALINK_SSL *); +#else +MESALINK_API int mesalink_SSL_set_fd(MESALINK_SSL *, int); +MESALINK_API int mesalink_SSL_get_fd(const MESALINK_SSL *); +#endif + +#ifdef HAVE_CLIENT +MESALINK_API int mesalink_SSL_connect(MESALINK_SSL *); +MESALINK_API int mesalink_SSL_connect0(MESALINK_SSL *); +#endif + +#ifdef HAVE_SERVER +MESALINK_API int mesalink_SSL_accept(MESALINK_SSL *); +#endif + +MESALINK_API int mesalink_SSL_write(MESALINK_SSL *, const void *, int); +MESALINK_API int mesalink_SSL_read(MESALINK_SSL *, void *, int); +MESALINK_API int mesalink_SSL_flush(MESALINK_SSL *); +#ifdef HAVE_TLS13 +MESALINK_API int mesalink_SSL_write_early_data(MESALINK_SSL *, const void *, + int, size_t *); +MESALINK_API int mesalink_SSL_get_early_data_status(const MESALINK_SSL *); +#endif +MESALINK_API int mesalink_SSL_shutdown(MESALINK_SSL *); +MESALINK_API MESALINK_CTX *mesalink_SSL_get_SSL_CTX(const MESALINK_SSL *); +MESALINK_API MESALINK_CTX *mesalink_SSL_set_SSL_CTX(MESALINK_SSL *, + MESALINK_CTX *); +MESALINK_API const char *mesalink_SSL_get_version(const MESALINK_SSL *); +MESALINK_API void mesalink_SSL_free(MESALINK_SSL *); + +MESALINK_API int mesalink_SSL_get_error(const MESALINK_SSL *, int); + +MESALINK_API void mesalink_SSL_set_connect_state(MESALINK_SSL *); +MESALINK_API void mesalink_SSL_set_accept_state(MESALINK_SSL *); +MESALINK_API int mesalink_SSL_is_server(const MESALINK_SSL *); + +#ifdef HAVE_SGX +typedef enum mesalink_sgx_config_flag_t { + SGX_FLAGS_DEBUG = 1, + SGX_ALLOW_CONFIGURATION_NEEDED = 2, + SGX_ALLOW_GROUP_OUT_OF_DATE = 4, +} mesalink_sgx_config_flag_t; + +MESALINK_API int mesalink_SSL_CTX_set_sgx_verify(MESALINK_CTX *, const char *, + long); +#endif + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_SSL_H */ diff --git a/curl-sys/include/mesalink/mesalink/version.h b/curl-sys/include/mesalink/mesalink/version.h new file mode 100644 index 0000000000..29c50f471c --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/version.h @@ -0,0 +1,29 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2018, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_VERSION_H +#define MESALINK_VERSION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define MESALINK_VERSION_STRING "1.0.0" + +#ifdef __cplusplus +} +#endif + +#endif /* MESALINK_VERSION_H */ diff --git a/curl-sys/include/mesalink/mesalink/visibility.h b/curl-sys/include/mesalink/mesalink/visibility.h new file mode 100644 index 0000000000..dd66ce8bc7 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/visibility.h @@ -0,0 +1,29 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2018, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +/* Visibility control macros */ + +#ifndef MESALINK_VISIBILITY_H +#define MESALINK_VISIBILITY_H + +#ifdef HAVE_UNIX +#define MESALINK_API __attribute__((visibility("default"))) +#define MESALINK_LOCAL __attribute__((visiblity("hidden"))) +#else +#define MESALINK_API +#define MESALINK_LOCAL +#endif + +#endif /* MESALINK_VISIBILITY_H */ \ No newline at end of file diff --git a/curl-sys/include/mesalink/mesalink/x509.h b/curl-sys/include/mesalink/mesalink/x509.h new file mode 100644 index 0000000000..9b99704c16 --- /dev/null +++ b/curl-sys/include/mesalink/mesalink/x509.h @@ -0,0 +1,70 @@ +/* + * __ __ _ _ _ + * | \/ | ___ ___ __ _| | (_)_ __ | | __ + * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / + * | | | | __/\__ \ (_| | |___| | | | | < + * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ + * + * Copyright (c) 2017-2018, The MesaLink Authors. + * All rights reserved. + * + * This work is licensed under the terms of the BSD 3-Clause License. + * For a copy, see the LICENSE file. + * + */ + +#ifndef MESALINK_X509_H +#define MESALINK_X509_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +typedef struct MESALINK_X509 MESALINK_X509; +typedef struct MESALINK_X509_NAME MESALINK_X509_NAME; + +#define MESALINK_STACK_OF(NAME) MESALINK_STACK_##NAME +typedef struct MESALINK_STACK_OF(MESALINK_X509) + MESALINK_STACK_OF(MESALINK_X509); +typedef struct MESALINK_STACK_OF(MESALINK_X509_NAME) + MESALINK_STACK_OF(MESALINK_X509_NAME); + +MESALINK_API void mesalink_X509_free(const MESALINK_X509 *); +MESALINK_API void mesalink_X509_NAME_free(const MESALINK_X509_NAME *); + +MESALINK_API MESALINK_X509_NAME *mesalink_X509_get_subject( + const MESALINK_X509 *); +MESALINK_API MESALINK_X509_NAME *mesalink_X509_get_subject_name( + const MESALINK_X509 *); +MESALINK_API MESALINK_STACK_OF(MESALINK_X509_NAME) * + mesalink_X509_get_alt_subject_names(const MESALINK_X509 *); +MESALINK_API char *mesalink_X509_NAME_oneline(const MESALINK_X509_NAME *, + char *buf, int size); + +MESALINK_API MESALINK_STACK_OF(MESALINK_X509) * + mesalink_sk_X509_new_null(void); +MESALINK_API int mesalink_sk_X509_num(const MESALINK_STACK_MESALINK_X509 *); +MESALINK_API MESALINK_X509_NAME *mesalink_sk_X509_value( + const MESALINK_STACK_MESALINK_X509 *, int); +MESALINK_API int mesalink_sk_X509_push(MESALINK_STACK_MESALINK_X509 *, + const MESALINK_X509 *); +MESALINK_API void mesalink_sk_X509_free(const MESALINK_STACK_MESALINK_X509 *); + +MESALINK_API MESALINK_STACK_OF(MESALINK_X509_NAME) * + mesalink_sk_X509_NAME_new_null(void); +MESALINK_API int mesalink_sk_X509_NAME_num( + const MESALINK_STACK_MESALINK_X509_NAME *); +MESALINK_API MESALINK_X509_NAME *mesalink_sk_X509_NAME_value( + const MESALINK_STACK_MESALINK_X509_NAME *, int); +MESALINK_API void mesalink_sk_X509_NAME_free( + const MESALINK_STACK_MESALINK_X509_NAME *); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif /* MESALINK_X509_H */ diff --git a/curl-sys/lib.rs b/curl-sys/lib.rs index 1528899575..9eaca45091 100644 --- a/curl-sys/lib.rs +++ b/curl-sys/lib.rs @@ -6,6 +6,8 @@ extern crate libc; extern crate libnghttp2_sys; #[cfg(link_libz)] extern crate libz_sys; +#[cfg(feature = "mesalink")] +extern crate mesalink; // ensure lib is linked to #[cfg(link_openssl)] extern crate openssl_sys; #[cfg(windows)] diff --git a/curl-sys/mesalink b/curl-sys/mesalink deleted file mode 160000 index 94b719b88d..0000000000 --- a/curl-sys/mesalink +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 94b719b88d7434cce6a05471d1662049140a5270 From a1203039b6e5c093ea6a78708adc0298d6fa9ed6 Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Tue, 13 Aug 2019 23:04:33 -0500 Subject: [PATCH 3/7] Use MesaLink version published on Crates.io --- Cargo.toml | 1 - README.md | 9 ++++++++- curl-sys/Cargo.toml | 5 +++-- curl-sys/build.rs | 2 ++ curl-sys/include/README.md | 3 +++ curl-sys/include/mesalink/mesalink/options.h | 4 ++-- 6 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 curl-sys/include/README.md diff --git a/Cargo.toml b/Cargo.toml index 3d34cc884f..ddac5a0b26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,6 @@ mio-extras = "2.0.3" [workspace] members = ["systest"] -exclude = ["curl-sys/mesalink"] [features] default = ["ssl"] diff --git a/README.md b/README.md index 5507004f88..4c442e5104 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,8 @@ By default, this crate will attempt to dynamically link to the system-wide libcurl and the system-wide SSL library. Some of this behavior can be customized with various Cargo features: -- `ssl`: Enable SSL support. Enabled by default. +- `ssl`: Enable SSL/TLS support using the platform-default TLS backend. On Windows this is [Schannel], on macOS [Secure Transport], and [OpenSSL] (or equivalent) on all other platforms. Enabled by default. +- `mesalink`: Enable SSL/TLS support via [MesaLink], an alternative TLS backend written in Rust based on [Rustls]. MesaLink is always statically linked. Disabled by default. - `http2`: Enable HTTP/2 support via libnghttp2. Disabled by default. - `static-curl`: Use a bundled libcurl version and statically link to it. Disabled by default. - `static-ssl`: Use a bundled OpenSSL version and statically link to it. Only applies on platforms that use OpenSSL. Disabled by default. @@ -169,3 +170,9 @@ In order to avoid this failure you can either The `curl-rust` crate is licensed under the MIT license, see `LICENSE` for more details. + + +[OpenSSL]: https://www.openssl.org/ +[Rustls]: https://github.com/ctz/rustls +[Schannel]: https://docs.microsoft.com/en-us/windows/win32/com/schannel +[Secure Transport]: https://developer.apple.com/documentation/security/secure_transport diff --git a/curl-sys/Cargo.toml b/curl-sys/Cargo.toml index 9904b8df56..572fda4851 100644 --- a/curl-sys/Cargo.toml +++ b/curl-sys/Cargo.toml @@ -24,9 +24,10 @@ libc = "0.2.2" libnghttp2-sys = { optional = true, version = "0.1" } [dependencies.mesalink] -git = "https://github.com/mesalock-linux/mesalink" -tag = "v1.0.0" +version = "1.0.0-cratesio" optional = true +default-features = false +features = ["client_apis", "error_strings", "tls13", "aesgcm", "chachapoly", "x25519", "ecdh", "ecdsa", "verifier"] [target.'cfg(all(unix, not(target_os = "macos")))'.dependencies] openssl-sys = { version = "0.9", optional = true } diff --git a/curl-sys/build.rs b/curl-sys/build.rs index 7169e7d5ba..682d0798f6 100644 --- a/curl-sys/build.rs +++ b/curl-sys/build.rs @@ -211,6 +211,8 @@ fn main() { .file("curl/lib/vauth/vauth.c"); } + // Configure TLS backend. Since Cargo does not support mutually exclusive + // features, make sure we only compile one vtls. if cfg!(feature = "mesalink") { cfg.define("USE_MESALINK", None) .include("include/mesalink") diff --git a/curl-sys/include/README.md b/curl-sys/include/README.md new file mode 100644 index 0000000000..eb05ed8220 --- /dev/null +++ b/curl-sys/include/README.md @@ -0,0 +1,3 @@ +# include + +This directory contains pre-generated C header files for any static dependencies that might be used by `curl-sys` that we don't want to require users to provide during compilation. Currently this includes just [MesaLink](https://mesalink.io) headers. diff --git a/curl-sys/include/mesalink/mesalink/options.h b/curl-sys/include/mesalink/mesalink/options.h index 4686cd183b..428de05251 100644 --- a/curl-sys/include/mesalink/mesalink/options.h +++ b/curl-sys/include/mesalink/mesalink/options.h @@ -1,7 +1,7 @@ /* MesaLink options.h * generated from configure options * - * This file is part of MesaLink. + * This file is part of MesaLink. * */ @@ -17,7 +17,7 @@ extern "C" { #define HAVE_CLIENT #undef HAVE_SERVER -#define HAVE_SERVER +// #define HAVE_SERVER #undef HAVE_ERROR_STRINGS #define HAVE_ERROR_STRINGS From af4bd4e6fcd5079e6522b899d4ba39fd22467abb Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Tue, 13 Aug 2019 23:26:34 -0500 Subject: [PATCH 4/7] Fix MesaLink headers under Windows --- curl-sys/build.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/curl-sys/build.rs b/curl-sys/build.rs index 682d0798f6..769335c5cf 100644 --- a/curl-sys/build.rs +++ b/curl-sys/build.rs @@ -217,6 +217,10 @@ fn main() { cfg.define("USE_MESALINK", None) .include("include/mesalink") .file("curl/lib/vtls/mesalink.c"); + + if windows { + cfg.define("HAVE_WINDOWS", None); + } } else if cfg!(feature = "ssl") { if windows { cfg.define("USE_WINDOWS_SSPI", None) From 1ae2398c86bff88e8b72d5ef46cc3581eeb4038c Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Wed, 14 Aug 2019 20:08:47 -0500 Subject: [PATCH 5/7] Use MesaLink header files bundled with the crate Point to a MesaLink fork with the changes until they are published. --- curl-sys/Cargo.toml | 4 +- curl-sys/build.rs | 7 +- curl-sys/include/README.md | 3 - curl-sys/include/mesalink/mesalink/bio.h | 61 ----- curl-sys/include/mesalink/mesalink/err.h | 154 ------------- curl-sys/include/mesalink/mesalink/evp.h | 35 --- .../include/mesalink/mesalink/openssl/bio.h | 55 ----- .../include/mesalink/mesalink/openssl/err.h | 50 ---- .../include/mesalink/mesalink/openssl/evp.h | 33 --- .../include/mesalink/mesalink/openssl/pem.h | 34 --- .../mesalink/mesalink/openssl/safestack.h | 29 --- .../include/mesalink/mesalink/openssl/ssl.h | 173 -------------- .../include/mesalink/mesalink/openssl/x509.h | 55 ----- curl-sys/include/mesalink/mesalink/options.h | 53 ----- curl-sys/include/mesalink/mesalink/pem.h | 48 ---- curl-sys/include/mesalink/mesalink/ssl.h | 214 ------------------ curl-sys/include/mesalink/mesalink/version.h | 29 --- .../include/mesalink/mesalink/visibility.h | 29 --- curl-sys/include/mesalink/mesalink/x509.h | 70 ------ 19 files changed, 9 insertions(+), 1127 deletions(-) delete mode 100644 curl-sys/include/README.md delete mode 100644 curl-sys/include/mesalink/mesalink/bio.h delete mode 100644 curl-sys/include/mesalink/mesalink/err.h delete mode 100644 curl-sys/include/mesalink/mesalink/evp.h delete mode 100644 curl-sys/include/mesalink/mesalink/openssl/bio.h delete mode 100644 curl-sys/include/mesalink/mesalink/openssl/err.h delete mode 100644 curl-sys/include/mesalink/mesalink/openssl/evp.h delete mode 100644 curl-sys/include/mesalink/mesalink/openssl/pem.h delete mode 100644 curl-sys/include/mesalink/mesalink/openssl/safestack.h delete mode 100644 curl-sys/include/mesalink/mesalink/openssl/ssl.h delete mode 100644 curl-sys/include/mesalink/mesalink/openssl/x509.h delete mode 100644 curl-sys/include/mesalink/mesalink/options.h delete mode 100644 curl-sys/include/mesalink/mesalink/pem.h delete mode 100644 curl-sys/include/mesalink/mesalink/ssl.h delete mode 100644 curl-sys/include/mesalink/mesalink/version.h delete mode 100644 curl-sys/include/mesalink/mesalink/visibility.h delete mode 100644 curl-sys/include/mesalink/mesalink/x509.h diff --git a/curl-sys/Cargo.toml b/curl-sys/Cargo.toml index 572fda4851..8d353e4518 100644 --- a/curl-sys/Cargo.toml +++ b/curl-sys/Cargo.toml @@ -24,7 +24,9 @@ libc = "0.2.2" libnghttp2-sys = { optional = true, version = "0.1" } [dependencies.mesalink] -version = "1.0.0-cratesio" +version = "1.1.0-beta" +git = "https://github.com/sagebind/mesalink" +branch = "cargo-c-headers" optional = true default-features = false features = ["client_apis", "error_strings", "tls13", "aesgcm", "chachapoly", "x25519", "ecdh", "ecdsa", "verifier"] diff --git a/curl-sys/build.rs b/curl-sys/build.rs index 769335c5cf..59c23b0c09 100644 --- a/curl-sys/build.rs +++ b/curl-sys/build.rs @@ -215,11 +215,16 @@ fn main() { // features, make sure we only compile one vtls. if cfg!(feature = "mesalink") { cfg.define("USE_MESALINK", None) - .include("include/mesalink") .file("curl/lib/vtls/mesalink.c"); + if let Some(path) = env::var_os("DEP_MESALINK_INCLUDE") { + cfg.include(path); + } + if windows { cfg.define("HAVE_WINDOWS", None); + } else { + cfg.define("HAVE_UNIX", None); } } else if cfg!(feature = "ssl") { if windows { diff --git a/curl-sys/include/README.md b/curl-sys/include/README.md deleted file mode 100644 index eb05ed8220..0000000000 --- a/curl-sys/include/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# include - -This directory contains pre-generated C header files for any static dependencies that might be used by `curl-sys` that we don't want to require users to provide during compilation. Currently this includes just [MesaLink](https://mesalink.io) headers. diff --git a/curl-sys/include/mesalink/mesalink/bio.h b/curl-sys/include/mesalink/mesalink/bio.h deleted file mode 100644 index 9b38069892..0000000000 --- a/curl-sys/include/mesalink/mesalink/bio.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2019, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_BIO_H -#define MESALINK_BIO_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -typedef struct MESALINK_BIO_METHOD MESALINK_BIO_METHOD; -typedef struct MESALINK_BIO MESALINK_BIO; - -#define BIO_NOCLOSE 0x00 -#define BIO_CLOSE 0x01 - -MESALINK_API MESALINK_BIO *mesalink_BIO_new(const MESALINK_BIO_METHOD *); -MESALINK_API void mesalink_BIO_free(MESALINK_BIO *); - -MESALINK_API int mesalink_BIO_read(MESALINK_BIO *, void *, int); -MESALINK_API int mesalink_BIO_gets(MESALINK_BIO *, char *, int); -MESALINK_API int mesalink_BIO_write(MESALINK_BIO *, const void *, int); -MESALINK_API int mesalink_BIO_puts(MESALINK_BIO *, const char *); - -MESALINK_API MESALINK_BIO_METHOD *mesalink_BIO_s_file(void); -MESALINK_API MESALINK_BIO *mesalink_BIO_new_fp(FILE *, int); -MESALINK_API void mesalink_BIO_set_fp(MESALINK_BIO *, FILE *, int); -MESALINK_API int mesalink_BIO_get_close(MESALINK_BIO *); -MESALINK_API int mesalink_BIO_set_close(MESALINK_BIO *, long); - -MESALINK_API MESALINK_BIO *mesalink_BIO_new_file(const char *, const char *); -MESALINK_API int mesalink_BIO_read_filename(MESALINK_BIO *, const char *); -MESALINK_API int mesalink_BIO_write_filename(MESALINK_BIO *, const char *); -MESALINK_API int mesalink_BIO_append_filename(MESALINK_BIO *, const char *); -MESALINK_API int mesalink_BIO_rw_filename(MESALINK_BIO *, const char *); - -MESALINK_API MESALINK_BIO_METHOD *mesalink_BIO_s_mem(void); -MESALINK_API MESALINK_BIO *mesalink_BIO_new_mem_buf(const void *, int); - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_BIO_H */ diff --git a/curl-sys/include/mesalink/mesalink/err.h b/curl-sys/include/mesalink/mesalink/err.h deleted file mode 100644 index 3dd7f61e27..0000000000 --- a/curl-sys/include/mesalink/mesalink/err.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2018, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_ERR_H -#define MESALINK_ERR_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -enum -{ - // OpenSSL error codes - MESALINK_ERROR_NONE = 0, - MESALINK_ERROR_ZERO_RETURN = 1, - MESALINK_ERROR_WANT_READ = 2, - MESALINK_ERROR_WANT_WRITE = 3, - MESALINK_ERROR_WANT_CONNECT = 7, - MESALINK_ERROR_WANT_ACCEPT = 8, - MESALINK_ERROR_SYSCALL = 5, - MESALINK_ERROR_SSL = 0x55, - MESALINK_ERROR_NULL_POINTER = 0xe0, - MESALINK_ERROR_MALFORMED_OBJECT = 0xe1, - MESALINK_ERROR_BAD_FUNC_ARG = 0xe2, - MESALINK_ERROR_PANIC = 0xe3, - MESALINK_ERROR_LOCK = 0xe4, - // Rust IO ErrorKind codes - IO_ERROR_NOT_FOUND = 0x02000001, - IO_ERROR_PERMISSION_DENIED = 0x02000002, - IO_ERROR_CONNECTION_REFUSED = 0x02000003, - IO_ERROR_CONNECTION_RESET = 0x02000004, - IO_ERROR_CONNECTION_ABORTED = 0x02000005, - IO_ERROR_NOT_CONNECTED = 0x02000006, - IO_ERROR_ADDR_IN_USE = 0x02000007, - IO_ERROR_ADDR_NOT_AVAILABLE = 0x02000008, - IO_ERROR_BROKEN_PIPE = 0x02000009, - IO_ERROR_ALREADY_EXISTS = 0x0200000a, - IO_ERROR_WOULD_BLOCK = 0x0200000b, - IO_ERROR_INVALID_INPUT = 0x0200000c, - IO_ERROR_INVALID_DATA = 0x0200000d, - IO_ERROR_TIMED_OUT = 0x0200000e, - IO_ERROR_WRITE_ZERO = 0x0200000f, - IO_ERROR_INTERRUPTED = 0x02000010, - IO_ERROR_OTHER = 0x02000011, - IO_ERROR_UNEXPECTED_EOF = 0x02000012, - // TLS error codes - TLS_ERROR_INAPPROPRIATE_MESSAGE = 0x03000100, - TLS_ERROR_INAPPROPRIATE_HANDSHAKE_MESSAGE = 0x03000200, - TLS_ERROR_CORRUPT_MESSAGE = 0x03000300, - TLS_ERROR_CORRUPT_MESSAGE_PAYLOAD = 0x03000400, - TLS_ERROR_CORRUPT_MESSAGE_PAYLOAD_ALERT = 0x03000401, - TLS_ERROR_CORRUPT_MESSAGE_PAYLOAD_CHANGE_CIPHER_SPEC = 0x03000402, - TLS_ERROR_CORRUPT_MESSAGE_PAYLOAD_HANDSHAKE = 0x03000403, - TLS_ERROR_NO_CERTIFICATES_PRESENTED = 0x03000500, - TLS_ERROR_DECRYPT_ERROR = 0x03000600, - TLS_ERROR_PEER_INCOMPATIBLE_ERROR = 0x03000700, - TLS_ERROR_PEER_MISBEHAVED_ERROR = 0x03000800, - TLS_ERROR_ALERT_RECEIVED_ERRORS = 0x03000900, - TLS_ERROR_ALERT_RECEIVED_CLOSE_NOTIFY = 0x03000901, - TLS_ERROR_ALERT_RECEIVED_UNEXPECTED_MESSAGE = 0x03000902, - TLS_ERROR_ALERT_RECEIVED_BAD_RECORD_MAC = 0x03000903, - TLS_ERROR_ALERT_RECEIVED_DECRYPTION_FAILED = 0x03000904, - TLS_ERROR_ALERT_RECEIVED_RECORD_OVERFLOW = 0x03000905, - TLS_ERROR_ALERT_RECEIVED_DECOMPRESSION_FAILURE = 0x03000906, - TLS_ERROR_ALERT_RECEIVED_HANDSHAKE_FAILURE = 0x03000907, - TLS_ERROR_ALERT_RECEIVED_NO_CERTIFICATE = 0x03000908, - TLS_ERROR_ALERT_RECEIVED_BAD_CERTIFICATE = 0x03000909, - TLS_ERROR_ALERT_RECEIVED_UNSUPPORTED_CERTIFICATE = 0x0300090a, - TLS_ERROR_ALERT_RECEIVED_CERTIFICATE_REVOKED = 0x0300090b, - TLS_ERROR_ALERT_RECEIVED_CERTIFICATE_EXPIRED = 0x0300090c, - TLS_ERROR_ALERT_RECEIVED_CERTIFICATE_UNKNOWN = 0x0300090d, - TLS_ERROR_ALERT_RECEIVED_ILLEGAL_PARAMETER = 0x0300090e, - TLS_ERROR_ALERT_RECEIVED_UNKNOWN_CA = 0x0300090f, - TLS_ERROR_ALERT_RECEIVED_ACCESS_DENIED = 0x03000910, - TLS_ERROR_ALERT_RECEIVED_DECODE_ERROR = 0x03000911, - TLS_ERROR_ALERT_RECEIVED_DECRYPT_ERROR = 0x03000912, - TLS_ERROR_ALERT_RECEIVED_EXPORT_RESTRICTION = 0x03000913, - TLS_ERROR_ALERT_RECEIVED_PROTOCOL_VERSION = 0x03000914, - TLS_ERROR_ALERT_RECEIVED_INSUFFICIENT_SECURITY = 0x03000915, - TLS_ERROR_ALERT_RECEIVED_INTERNAL_ERROR = 0x03000916, - TLS_ERROR_ALERT_RECEIVED_INAPPROPRIATE_FALLBACK = 0x03000917, - TLS_ERROR_ALERT_RECEIVED_USER_CANCELED = 0x03000918, - TLS_ERROR_ALERT_RECEIVED_NO_RENEGOTIATION = 0x03000919, - TLS_ERROR_ALERT_RECEIVED_MISSING_EXTENSION = 0x0300091a, - TLS_ERROR_ALERT_RECEIVED_UNSUPPORTED_EXTENSION = 0x0300091b, - TLS_ERROR_ALERT_RECEIVED_CERTIFICATE_UNOBTAINABLE = 0x0300091c, - TLS_ERROR_ALERT_RECEIVED_UNRECOGNISED_NAME = 0x0300091d, - TLS_ERROR_ALERT_RECEIVED_BAD_CERTIFICATE_STATUS_RESPONSE = 0x0300091e, - TLS_ERROR_ALERT_RECEIVED_BAD_CERTIFICATE_HASH_VALUE = 0x0300091f, - TLS_ERROR_ALERT_RECEIVED_UNKNOWN_PSK_IDENTITY = 0x03000920, - TLS_ERROR_ALERT_RECEIVED_CERTIFICATE_REQUIRED = 0x03000921, - TLS_ERROR_ALERT_RECEIVED_NO_APPLICATION_PROTOCOL = 0x03000922, - TLS_ERROR_ALERT_RECEIVED_UNKNOWN = 0x030009ff, - TLS_ERROR_WEBPKI_ERRORS = 0x03000a00, - TLS_ERROR_WEBPKI_BAD_DER = 0x03000a01, - TLS_ERROR_WEBPKI_BAD_DER_TIME = 0x03000a02, - TLS_ERROR_WEBPKI_CA_USED_AS_END_ENTITY = 0x03000a03, - TLS_ERROR_WEBPKI_CERT_EXPIRED = 0x03000a04, - TLS_ERROR_WEBPKI_CERT_NOT_VALID_FOR_NAME = 0x03000a05, - TLS_ERROR_WEBPKI_CERT_NOT_VALID_YET = 0x03000a06, - TLS_ERROR_WEBPKI_END_ENTITY_USED_AS_CA = 0x03000a07, - TLS_ERROR_WEBPKI_EXTENSION_VALUE_INVALID = 0x03000a08, - TLS_ERROR_WEBPKI_INVALID_CERT_VALIDITY = 0x03000a09, - TLS_ERROR_WEBPKI_INVALID_SIGNATURE_FOR_PUBLIC_KEY = 0x03000a0a, - TLS_ERROR_WEBPKI_NAME_CONSTRAINT_VIOLATION = 0x03000a0b, - TLS_ERROR_WEBPKI_PATH_LEN_CONSTRAINT_VIOLATED = 0x03000a0c, - TLS_ERROR_WEBPKI_SIGNATURE_ALGORITHM_MISMATCH = 0x03000a0d, - TLS_ERROR_WEBPKI_REQUIRED_EKU_NOT_FOUND = 0x03000a0e, - TLS_ERROR_WEBPKI_UNKNOWN_ISSUER = 0x03000a0f, - TLS_ERROR_WEBPKI_UNSUPPORTED_CERT_VERSION = 0x03000a10, - TLS_ERROR_WEBPKI_UNSUPPORTED_CRITICAL_EXTENSION = 0x03000a11, - TLS_ERROR_WEBPKI_UNSUPPORTED_SIGNATURE_ALGORITHM_FOR_PUBLIC_KEY = 0x03000a12, - TLS_ERROR_WEBPKI_UNSUPPORTED_SIGNATURE_ALGORITHM = 0x03000a13, - TLS_ERROR_INVALID_SCT = 0x03000b00, - TLS_ERROR_GENERAL = 0x03000c00, - TLS_ERROR_FAILED_TO_GET_CURRENT_TIME = 0x03000d00, - TLS_ERROR_INVALID_DNS_NAME = 0x03000e00, - TLS_ERROR_HANDSHAKE_NOT_COMPLETE = 0x03000f00, - TLS_ERROR_PEER_SENT_OVERSIZED_RECORD = 0x03001000, - UNDEFINED_ERROR = 0xeeeeeeee, -}; - -MESALINK_API const char *mesalink_ERR_error_string_n(unsigned long e, - char *buf, size_t len); -MESALINK_API const char *mesalink_ERR_reason_error_string(unsigned long e); - -MESALINK_API unsigned long mesalink_ERR_get_error(void); -MESALINK_API unsigned long mesalink_ERR_peek_last_error(void); -MESALINK_API void mesalink_ERR_clear_error(void); - -MESALINK_API void mesalink_ERR_print_errors_fp(const FILE *); - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_ERR_H */ diff --git a/curl-sys/include/mesalink/mesalink/evp.h b/curl-sys/include/mesalink/mesalink/evp.h deleted file mode 100644 index e7c2498305..0000000000 --- a/curl-sys/include/mesalink/mesalink/evp.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2019, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_EVP_H -#define MESALINK_EVP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -typedef struct MESALINK_EVP_PKEY MESALINK_EVP_PKEY; - -MESALINK_API void mesalink_EVP_PKEY_free(MESALINK_EVP_PKEY *); - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_EVP_H */ \ No newline at end of file diff --git a/curl-sys/include/mesalink/mesalink/openssl/bio.h b/curl-sys/include/mesalink/mesalink/openssl/bio.h deleted file mode 100644 index 5f041e59a6..0000000000 --- a/curl-sys/include/mesalink/mesalink/openssl/bio.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2019, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_OPENSSL_BIO_H -#define MESALINK_OPENSSL_BIO_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define BIO_METHOD MESALINK_BIO_METHOD -#define BIO MESALINK_BIO - -#define BIO_new mesalink_BIO_new -#define BIO_free mesalink_BIO_free - -#define BIO_read mesalink_BIO_read -#define BIO_gets mesalink_BIO_gets -#define BIO_write mesalink_BIO_write -#define BIO_puts mesalink_BIO_puts - -#define BIO_s_file mesalink_BIO_s_file -#define BIO_new_fp mesalink_BIO_new_fp -#define BIO_set_fp mesalink_BIO_set_fp -#define BIO_get_close mesalink_BIO_get_close -#define BIO_set_close mesalink_BIO_set_close - -#define BIO_new_file mesalink_BIO_new_file -#define BIO_read_filename mesalink_BIO_read_filename -#define BIO_write_filename mesalink_BIO_write_filename -#define BIO_append_filename mesalink_BIO_append_filename -#define BIO_rw_filename mesalink_BIO_rw_filename - -#define BIO_s_mem mesalink_BIO_s_mem -#define BIO_new_mem_buf mesalink_BIO_new_mem_buf - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_OPENSSL_BIO_H */ \ No newline at end of file diff --git a/curl-sys/include/mesalink/mesalink/openssl/err.h b/curl-sys/include/mesalink/mesalink/openssl/err.h deleted file mode 100644 index 9793517f5f..0000000000 --- a/curl-sys/include/mesalink/mesalink/openssl/err.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2018, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_OPENSSL_ERR_H -#define MESALINK_OPENSSL_ERR_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define SSL_ERROR_WANT_READ MESALINK_ERROR_WANT_READ -#define SSL_ERROR_WANT_WRITE MESALINK_ERROR_WANT_WRITE -#define SSL_ERROR_WANT_CONNECT MESALINK_ERROR_WANT_CONNECT -#define SSL_ERROR_WANT_ACCEPT MESALINK_ERROR_WANT_ACCEPT -#define SSL_ERROR_ZERO_RETURN MESALINK_ERROR_ZERO_RETURN -#define SSL_ERROR_SYSCALL MESALINK_ERROR_SYSCALL -#define SSL_ERROR_SSL MESALINK_ERROR_SSL - -#define ERR_load_crypto_strings mesalink_ERR_load_error_strings -#define ERR_free_strings mesalink_ERR_free_error_strings - -#define ERR_error_string_n mesalink_ERR_error_string_n -#define ERR_reason_error_string mesalink_ERR_reason_error_string - -#define ERR_get_error mesalink_ERR_get_error -#define ERR_peek_last_error mesalink_ERR_peek_last_error -#define ERR_clear_error mesalink_ERR_clear_error - -#define ERR_print_errors_fp mesalink_ERR_print_errors_fp - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_OPENSSL_ERR_H */ diff --git a/curl-sys/include/mesalink/mesalink/openssl/evp.h b/curl-sys/include/mesalink/mesalink/openssl/evp.h deleted file mode 100644 index a47b778667..0000000000 --- a/curl-sys/include/mesalink/mesalink/openssl/evp.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2019, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_OPENSSL_EVP_H -#define MESALINK_OPENSSL_EVP_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define EVP_PKEY MESALINK_EVP_PKEY - -#define EVP_PKEY_free mesalink_EVP_PKEY_free - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_OPENSSL_EVP_H */ diff --git a/curl-sys/include/mesalink/mesalink/openssl/pem.h b/curl-sys/include/mesalink/mesalink/openssl/pem.h deleted file mode 100644 index 4e1ff20d03..0000000000 --- a/curl-sys/include/mesalink/mesalink/openssl/pem.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2019, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_OPENSSL_PEM_H -#define MESALINK_OPENSSL_PEM_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define PEM_read_bio_PrivateKey mesalink_PEM_read_bio_PrivateKey -#define PEM_read_PrivateKey mesalink_PEM_read_PrivateKey -#define PEM_read_bio_X509 mesalink_PEM_read_bio_X509 -#define PEM_read_X509 mesalink_PEM_read_X509 - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_OPENSSL_PEM_H */ \ No newline at end of file diff --git a/curl-sys/include/mesalink/mesalink/openssl/safestack.h b/curl-sys/include/mesalink/mesalink/openssl/safestack.h deleted file mode 100644 index 54d1f1654a..0000000000 --- a/curl-sys/include/mesalink/mesalink/openssl/safestack.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2018, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_OPENSSL_SAFESTACK_H -#define MESALINK_OPENSSL_SAFESTACK_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_OPENSSL_SAFESTACK_H */ diff --git a/curl-sys/include/mesalink/mesalink/openssl/ssl.h b/curl-sys/include/mesalink/mesalink/openssl/ssl.h deleted file mode 100644 index a9d67c4926..0000000000 --- a/curl-sys/include/mesalink/mesalink/openssl/ssl.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2018, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -/* ssl.h defines the compatibility layer for OpenSSL */ - -#ifndef MESALINK_OPENSSL_SSL_H -#define MESALINK_OPENSSL_SSL_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define SSL_CTX MESALINK_CTX -#define SSL MESALINK_SSL -#define SSL_METHOD MESALINK_METHOD -#define CIPHER MESALINK_CIPHER - -#define SSL_VERIFY_NONE MESALINK_SSL_VERIFY_NONE -#define SSL_VERIFY_PEER MESALINK_SSL_VERIFY_PEER -#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT \ - MESALINK_SSL_VERIFY_FAIL_IF_NO_PEER_CERT - -#define SSL_ERROR_NONE MESALINK_ERROR_NONE -#define SSL_FAILURE MESALINK_FAILURE -#define SSL_FATAL_ERROR MESALINK_FATAL_ERROR -#define SSL_SUCCESS MESALINK_SUCCESS - -#define SSL_FILETYPE_PEM MESALINK_FILETYPE_PEM -#define SSL_FILETYPE_ASN1 MESALINK_FILETYPE_ASN1 -#define SSL_FILETYPE_DEFAULT MESALINK_FILETYPE_DEFAULT -#define SSL_FILETYPE_RAW MESALINK_FILETYPE_RAW - -#define SSL_SESS_CACHE_OFF MESALINK_SSL_SESS_CACHE_OFF -#define SSL_SESS_CACHE_CLIENT MESALINK_SSL_SESS_CACHE_CLIENT -#define SSL_SESS_CACHE_SERVER MESALINK_SSL_SESS_CACHE_SERVER -#define SSL_SESS_CACHE_BOTH MESALINK_SSL_SESS_CACHE_BOTH - -#define SSL_EARLY_DATA_NOT_SENT MESALINK_SSL_EARLY_DATA_NOT_SENT -#define SSL_EARLY_DATA_REJECTED MESALINK_SSL_EARLY_DATA_REJECTED -#define SSL_EARLY_DATA_ACCEPTED MESALINK_SSL_EARLY_DATA_ACCEPTED - -#define SSL_library_init mesalink_library_init -#define OpenSSL_add_ssl_algorithms mesalink_add_ssl_algorithms -#define SSL_load_error_strings mesalink_SSL_load_error_strings - -#define TLS_method mesalink_TLS_method -#ifdef HAVE_CLIENT -// Version-flexible methods -#define TLS_client_method mesalink_TLS_client_method -#define SSLv23_client_method mesalink_SSLv23_client_method - -// Not supported -#define SSLv3_client_method mesalink_SSLv3_client_method -#define TLSv1_client_method mesalink_TLSv1_client_method -#define TLSv1_1_client_method mesalink_TLSv1_1_client_method - -// Version-specific methods -#define TLSv1_2_client_method mesalink_TLSv1_2_client_method -#ifdef HAVE_TLS13 -#define TLSv1_3_client_method mesalink_TLSv1_3_client_method -#endif -#endif - -#ifdef HAVE_SERVER -// Version-flexible methods -#define TLS_server_method mesalink_TLS_server_method -#define SSLv23_server_method mesalink_SSLv23_server_method - -// Not supported -#define SSLv3_server_method mesalink_SSLv3_server_method -#define TLSv1_server_method mesalink_TLSv1_server_method -#define TLSv1_1_server_method mesalink_TLSv1_1_server_method - -// Version-specific methods -#define TLSv1_2_server_method mesalink_TLSv1_2_server_method -#ifdef HAVE_TLS13 -#define TLSv1_3_server_method mesalink_TLSv1_3_server_method -#endif - -#endif - -#define SSL_CTX_new mesalink_SSL_CTX_new -#define SSL_CTX_load_verify_locations mesalink_SSL_CTX_load_verify_locations -#define SSL_CTX_use_certificate mesalink_SSL_CTX_use_certificate -#define SSL_CTX_add_extra_chain_cert mesalink_SSL_CTX_add_extra_chain_cert -#define SSL_CTX_use_certificate_chain_file \ - mesalink_SSL_CTX_use_certificate_chain_file -#define SSL_CTX_use_certificate_ASN1 mesalink_SSL_CTX_use_certificate_ASN1 -#define SSL_use_certificate_ASN1 mesalink_SSL_use_certificate_ASN1 -#define SSL_CTX_use_PrivateKey mesalink_SSL_CTX_use_PrivateKey -#define SSL_CTX_use_PrivateKey_file mesalink_SSL_CTX_use_PrivateKey_file -#define SSL_CTX_use_PrivateKey_ASN1 mesalink_SSL_CTX_use_PrivateKey_ASN1 -#define SSL_use_PrivateKey_ASN1 mesalink_SSL_use_PrivateKey_ASN1 -#define SSL_CTX_check_private_key mesalink_SSL_CTX_check_private_key -#define SSL_check_private_key mesalink_SSL_check_private_key -#define SSL_CTX_set_verify mesalink_SSL_CTX_set_verify -#define SSL_CTX_set_session_cache_mode mesalink_SSL_CTX_set_session_cache_mode -#define SSL_CTX_get_session_cache_mode mesalink_SSL_CTX_get_session_cache_mode -#define SSL_CTX_sess_set_cache_size mesalink_SSL_CTX_sess_set_cache_size -#define SSL_CTX_sess_get_cache_size mesalink_SSL_CTX_sess_get_cache_size -#define SSL_CTX_free mesalink_SSL_CTX_free - -#define SSL_new mesalink_SSL_new -#define SSL_get_current_cipher mesalink_SSL_get_current_cipher -#define SSL_CIPHER_get_name mesalink_SSL_CIPHER_get_name -#define SSL_CIPHER_get_bits mesalink_SSL_CIPHER_get_bits -#define SSL_CIPHER_get_version mesalink_SSL_CIPHER_get_version -#define SSL_get_cipher_name mesalink_SSL_get_cipher_name -#define SSL_get_cipher_bits mesalink_SSL_get_cipher_bits -#define SSL_get_cipher_version mesalink_SSL_get_cipher_version -#define SSL_get_peer_certificate mesalink_SSL_get_peer_certificate -#define SSL_set_tlsext_host_name mesalink_SSL_set_tlsext_host_name -#define SSL_get_SSL_CTX mesalink_SSL_get_SSL_CTX -#define SSL_set_SSL_CTX mesalink_SSL_set_SSL_CTX - -#ifdef HAVE_WINDOWS -#define SSL_set_socket mesalink_SSL_set_socket -#define SSL_get_socket mesalink_SSL_get_socket -#else -#define SSL_set_fd mesalink_SSL_set_fd -#define SSL_get_fd mesalink_SSL_get_fd -#endif - -#define SSL_do_handshake mesalink_SSL_do_handshake - -#ifdef HAVE_CLIENT -#define SSL_connect mesalink_SSL_connect -#define SSL_connect0 mesalink_SSL_connect0 -#endif -#ifdef HAVE_SERVER -#define SSL_accept mesalink_SSL_accept -#endif - -#define SSL_write mesalink_SSL_write -#define SSL_read mesalink_SSL_read -#ifdef HAVE_TLS13 -#define SSL_write_early_data mesalink_SSL_write_early_data -#define SSL_get_early_data_status mesalink_SSL_get_early_data_status -#endif -#define SSL_flush mesalink_SSL_flush -#define SSL_shutdown mesalink_SSL_shutdown -#define SSL_get_version mesalink_SSL_get_version -#define SSL_free mesalink_SSL_free - -#define SSL_get_error mesalink_SSL_get_error - -#define SSL_set_connect_state mesalink_SSL_set_connect_state -#define SSL_set_accept_state mesalink_SSL_set_accept_state -#define SSL_is_server mesalink_SSL_is_server - -#ifdef HAVE_SGX -#define SSL_CTX_set_sgx_verify mesalink_SSL_CTX_set_sgx_verify -#endif - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_OPENSSL_SSL_H */ diff --git a/curl-sys/include/mesalink/mesalink/openssl/x509.h b/curl-sys/include/mesalink/mesalink/openssl/x509.h deleted file mode 100644 index b2728a18f4..0000000000 --- a/curl-sys/include/mesalink/mesalink/openssl/x509.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2018, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -/* x509.h defines the compatibility layer for OpenSSL */ - -#ifndef MESALINK_OPENSSL_X509_H -#define MESALINK_OPENSSL_X509_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define X509 MESALINK_X509 -#define X509_NAME MESALINK_X509_NAME - -#define STACK_OF(NAME) MESALINK_STACK_OF(MESALINK_##NAME) - -#define X509_free mesalink_X509_free -#define X509_NAME_free mesalink_X509_NAME_free -#define X509_get_subject mesalink_X509_get_subject -#define X509_get_subject_name mesalink_X509_get_subject_name -#define X509_get_alt_subject_names mesalink_X509_get_alt_subject_names -#define X509_NAME_oneline mesalink_X509_NAME_oneline - -#define sk_X509_new_null mesalink_sk_X509_new_null -#define sk_X509_num mesalink_sk_X509_num -#define sk_X509_value mesalink_sk_X509_value -#define sk_X509_push mesalink_sk_X509_push -#define sk_X509_free mesalink_sk_X509_free - -#define sk_X509_NAME_new_null mesalink_sk_X509_NAME_new_null -#define sk_X509_NAME_num mesalink_sk_X509_NAME_num -#define sk_X509_NAME_value mesalink_sk_X509_NAME_value -#define sk_X509_NAME_push mesalink_sk_X509_NAME_push -#define sk_X509_NAME_free mesalink_sk_X509_NAME_free - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_OPENSSL_X509_H */ diff --git a/curl-sys/include/mesalink/mesalink/options.h b/curl-sys/include/mesalink/mesalink/options.h deleted file mode 100644 index 428de05251..0000000000 --- a/curl-sys/include/mesalink/mesalink/options.h +++ /dev/null @@ -1,53 +0,0 @@ -/* MesaLink options.h - * generated from configure options - * - * This file is part of MesaLink. - * - */ - -#ifndef MESALINK_OPTIONS_H -#define MESALINK_OPTIONS_H - - -#ifdef __cplusplus -extern "C" { -#endif - -#undef HAVE_CLIENT -#define HAVE_CLIENT - -#undef HAVE_SERVER -// #define HAVE_SERVER - -#undef HAVE_ERROR_STRINGS -#define HAVE_ERROR_STRINGS - -#undef HAVE_AESGCM -#define HAVE_AESGCM - -#undef HAVE_CHACHAPOLY -#define HAVE_CHACHAPOLY - -#undef HAVE_TLS13 -#define HAVE_TLS13 - -#undef HAVE_X25519 -#define HAVE_X25519 - -#undef HAVE_ECDH -#define HAVE_ECDH - -#undef HAVE_ECDSA -#define HAVE_ECDSA - -#undef NO_SGX -#define NO_SGX - - -#ifdef __cplusplus -} -#endif - - -#endif /* MESALINK_OPTIONS_H */ - diff --git a/curl-sys/include/mesalink/mesalink/pem.h b/curl-sys/include/mesalink/mesalink/pem.h deleted file mode 100644 index e3b734d4e9..0000000000 --- a/curl-sys/include/mesalink/mesalink/pem.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2019, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_PEM_H -#define MESALINK_PEM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include -#include - -typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); - -MESALINK_API MESALINK_EVP_PKEY *mesalink_PEM_read_bio_PrivateKey( - MESALINK_BIO *, MESALINK_EVP_PKEY **, pem_password_cb *cb, void *u); -MESALINK_API MESALINK_EVP_PKEY *mesalink_PEM_read_PrivateKey( - FILE *fp, MESALINK_EVP_PKEY **x, pem_password_cb *cb, void *u); -MESALINK_API MESALINK_X509 *mesalink_PEM_read_bio_X509(MESALINK_BIO *, - MESALINK_X509 **, - pem_password_cb *cb, - void *u); -MESALINK_API MESALINK_X509 *mesalink_PEM_read_X509(FILE *fp, MESALINK_X509 **x, - pem_password_cb *cb, - void *u); -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_PEM_H */ \ No newline at end of file diff --git a/curl-sys/include/mesalink/mesalink/ssl.h b/curl-sys/include/mesalink/mesalink/ssl.h deleted file mode 100644 index ddbe7a5e26..0000000000 --- a/curl-sys/include/mesalink/mesalink/ssl.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2018, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_SSL_H -#define MESALINK_SSL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include - -typedef struct MESALINK_METHOD MESALINK_METHOD; -typedef struct MESALINK_CTX MESALINK_CTX; -typedef struct MESALINK_CIPHER MESALINK_CIPHER; -typedef struct MESALINK_SSL MESALINK_SSL; - -typedef enum mesalink_verify_mode_t -{ - MESALINK_SSL_VERIFY_NONE = 0, - MESALINK_SSL_VERIFY_PEER = 1, - MESALINK_SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 2, -} mesalink_verify_mode_t; - -typedef enum mesalink_constant_t -{ - MESALINK_FAILURE = 0, - MESALINK_ERROR = -1, - MESALINK_SUCCESS = 1, - - MESALINK_FILETYPE_PEM = 1, - MESALINK_FILETYPE_ASN1 = 2, - MESALINK_FILETYPE_DEFAULT = 2, - MESALINK_FILETYPE_RAW = 3, - - MESALINK_SSL_SESS_CACHE_OFF = 0x0, - MESALINK_SSL_SESS_CACHE_CLIENT = 0x1, - MESALINK_SSL_SESS_CACHE_SERVER = 0x2, - MESALINK_SSL_SESS_CACHE_BOTH = 0x3, - - MESALINK_SSL_EARLY_DATA_NOT_SENT = 0, - MESALINK_SSL_EARLY_DATA_REJECTED = 1, - MESALINK_SSL_EARLY_DATA_ACCEPTED = 2, -} mesalink_constant_t; - -MESALINK_API int mesalink_library_init(void); -MESALINK_API int mesalink_add_ssl_algorithms(void); -MESALINK_API void mesalink_SSL_load_error_strings(void); -MESALINK_API void mesalink_SSL_init_logger(void); -MESALINK_API void mesalink_ERR_load_error_strings(void); -MESALINK_API void mesalink_ERR_free_error_strings(void); - -typedef MESALINK_METHOD *(*mesalink_method_func)(void); -MESALINK_API MESALINK_METHOD *mesalink_TLS_method(void); -#ifdef HAVE_CLIENT -// Version-flexible methods -MESALINK_API MESALINK_METHOD *mesalink_TLS_client_method(void); -MESALINK_API MESALINK_METHOD *mesalink_SSLv23_client_method(void); - -// Not supported -MESALINK_API MESALINK_METHOD *mesalink_SSLv3_client_method(void); -MESALINK_API MESALINK_METHOD *mesalink_TLSv1_client_method(void); -MESALINK_API MESALINK_METHOD *mesalink_TLSv1_1_client_method(void); - -// Version-specific methods -MESALINK_API MESALINK_METHOD *mesalink_TLSv1_2_client_method(void); -#ifdef HAVE_TLS13 -MESALINK_API MESALINK_METHOD *mesalink_TLSv1_3_client_method(void); -#endif -MESALINK_API MESALINK_METHOD *mesalink_TLS_client_method(void); -#endif - -#ifdef HAVE_SERVER -// Version-flexible methods -MESALINK_API MESALINK_METHOD *mesalink_SSLv23_server_method(void); -MESALINK_API MESALINK_METHOD *mesalink_TLSv_server_method(void); - -// Not supported -MESALINK_API MESALINK_METHOD *mesalink_SSLv3_server_method(void); -MESALINK_API MESALINK_METHOD *mesalink_TLSv1_server_method(void); -MESALINK_API MESALINK_METHOD *mesalink_TLSv1_1_server_method(void); - -// Version-specific methods -MESALINK_API MESALINK_METHOD *mesalink_TLSv1_2_server_method(void); -#ifdef HAVE_TLS13 -MESALINK_API MESALINK_METHOD *mesalink_TLSv1_3_server_method(void); -#endif -#endif - -MESALINK_API MESALINK_CTX *mesalink_SSL_CTX_new(MESALINK_METHOD *); -MESALINK_API int mesalink_SSL_CTX_load_verify_locations(MESALINK_CTX *, - const char *, - const char *); - -MESALINK_API int mesalink_SSL_CTX_use_certificate(MESALINK_CTX *, - MESALINK_X509 *); -MESALINK_API int mesalink_SSL_CTX_add_extra_chain_cert(MESALINK_CTX *, - MESALINK_X509 *); -MESALINK_API int mesalink_SSL_CTX_use_certificate_chain_file(MESALINK_CTX *, - const char *, - int); -MESALINK_API int mesalink_SSL_CTX_use_certificate_ASN1(MESALINK_CTX *, int, - const unsigned char *); -MESALINK_API int mesalink_SSL_use_certificate_ASN1(MESALINK_SSL *, - const unsigned char *, int); -MESALINK_API int mesalink_SSL_CTX_use_PrivateKey(MESALINK_CTX *, - MESALINK_EVP_PKEY *); -MESALINK_API int mesalink_SSL_CTX_use_PrivateKey_file(MESALINK_CTX *, - const char *, int); -MESALINK_API int mesalink_SSL_CTX_check_private_key(const MESALINK_CTX *); -MESALINK_API int mesalink_SSL_CTX_use_PrivateKey_ASN1(int, MESALINK_CTX *, - const unsigned char *, - long); -MESALINK_API int mesalink_SSL_use_PrivateKey_ASN1(int, MESALINK_SSL *, - const unsigned char *, long); -MESALINK_API int mesalink_SSL_CTX_check_private_key(const MESALINK_CTX *); -MESALINK_API int mesalink_SSL_check_private_key(const MESALINK_SSL *ctx); - -MESALINK_API int mesalink_SSL_CTX_set_verify(MESALINK_CTX *, int, - int (*cb)(int, MESALINK_CTX *)); -MESALINK_API long mesalink_SSL_CTX_set_session_cache_mode(MESALINK_CTX *, - long); -MESALINK_API long mesalink_SSL_CTX_get_session_cache_mode(MESALINK_CTX *); -MESALINK_API long mesalink_SSL_CTX_sess_set_cache_size(MESALINK_CTX *, long); -MESALINK_API long mesalink_SSL_CTX_sess_get_cache_size(MESALINK_CTX *); -MESALINK_API void mesalink_SSL_CTX_free(MESALINK_CTX *); - -MESALINK_API MESALINK_SSL *mesalink_SSL_new(MESALINK_CTX *); -MESALINK_API MESALINK_CIPHER *mesalink_SSL_get_current_cipher(MESALINK_SSL *); -MESALINK_API const char *mesalink_SSL_CIPHER_get_name(const MESALINK_CIPHER *); -MESALINK_API int mesalink_SSL_CIPHER_get_bits(const MESALINK_CIPHER *, int *); -MESALINK_API const char *mesalink_SSL_CIPHER_get_version( - const MESALINK_CIPHER *); -MESALINK_API const char *mesalink_SSL_get_cipher_name(MESALINK_SSL *); -MESALINK_API int mesalink_SSL_get_cipher_bits(MESALINK_SSL *, int *); -MESALINK_API const char *mesalink_SSL_get_cipher_version(const MESALINK_SSL *); -MESALINK_API MESALINK_X509 *mesalink_SSL_get_peer_certificate( - const MESALINK_SSL *); -MESALINK_API int mesalink_SSL_set_tlsext_host_name(MESALINK_SSL *, - const char *); -MESALINK_API int mesalink_SSL_do_handshake(MESALINK_SSL *); - -#ifdef HAVE_WINDOWS -#include -MESALINK_API int mesalink_SSL_set_socket(MESALINK_SSL *, SOCKET); -MESALINK_API SOCKET mesalink_SSL_get_socket(const MESALINK_SSL *); -#else -MESALINK_API int mesalink_SSL_set_fd(MESALINK_SSL *, int); -MESALINK_API int mesalink_SSL_get_fd(const MESALINK_SSL *); -#endif - -#ifdef HAVE_CLIENT -MESALINK_API int mesalink_SSL_connect(MESALINK_SSL *); -MESALINK_API int mesalink_SSL_connect0(MESALINK_SSL *); -#endif - -#ifdef HAVE_SERVER -MESALINK_API int mesalink_SSL_accept(MESALINK_SSL *); -#endif - -MESALINK_API int mesalink_SSL_write(MESALINK_SSL *, const void *, int); -MESALINK_API int mesalink_SSL_read(MESALINK_SSL *, void *, int); -MESALINK_API int mesalink_SSL_flush(MESALINK_SSL *); -#ifdef HAVE_TLS13 -MESALINK_API int mesalink_SSL_write_early_data(MESALINK_SSL *, const void *, - int, size_t *); -MESALINK_API int mesalink_SSL_get_early_data_status(const MESALINK_SSL *); -#endif -MESALINK_API int mesalink_SSL_shutdown(MESALINK_SSL *); -MESALINK_API MESALINK_CTX *mesalink_SSL_get_SSL_CTX(const MESALINK_SSL *); -MESALINK_API MESALINK_CTX *mesalink_SSL_set_SSL_CTX(MESALINK_SSL *, - MESALINK_CTX *); -MESALINK_API const char *mesalink_SSL_get_version(const MESALINK_SSL *); -MESALINK_API void mesalink_SSL_free(MESALINK_SSL *); - -MESALINK_API int mesalink_SSL_get_error(const MESALINK_SSL *, int); - -MESALINK_API void mesalink_SSL_set_connect_state(MESALINK_SSL *); -MESALINK_API void mesalink_SSL_set_accept_state(MESALINK_SSL *); -MESALINK_API int mesalink_SSL_is_server(const MESALINK_SSL *); - -#ifdef HAVE_SGX -typedef enum mesalink_sgx_config_flag_t { - SGX_FLAGS_DEBUG = 1, - SGX_ALLOW_CONFIGURATION_NEEDED = 2, - SGX_ALLOW_GROUP_OUT_OF_DATE = 4, -} mesalink_sgx_config_flag_t; - -MESALINK_API int mesalink_SSL_CTX_set_sgx_verify(MESALINK_CTX *, const char *, - long); -#endif - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_SSL_H */ diff --git a/curl-sys/include/mesalink/mesalink/version.h b/curl-sys/include/mesalink/mesalink/version.h deleted file mode 100644 index 29c50f471c..0000000000 --- a/curl-sys/include/mesalink/mesalink/version.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2018, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_VERSION_H -#define MESALINK_VERSION_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define MESALINK_VERSION_STRING "1.0.0" - -#ifdef __cplusplus -} -#endif - -#endif /* MESALINK_VERSION_H */ diff --git a/curl-sys/include/mesalink/mesalink/visibility.h b/curl-sys/include/mesalink/mesalink/visibility.h deleted file mode 100644 index dd66ce8bc7..0000000000 --- a/curl-sys/include/mesalink/mesalink/visibility.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2018, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -/* Visibility control macros */ - -#ifndef MESALINK_VISIBILITY_H -#define MESALINK_VISIBILITY_H - -#ifdef HAVE_UNIX -#define MESALINK_API __attribute__((visibility("default"))) -#define MESALINK_LOCAL __attribute__((visiblity("hidden"))) -#else -#define MESALINK_API -#define MESALINK_LOCAL -#endif - -#endif /* MESALINK_VISIBILITY_H */ \ No newline at end of file diff --git a/curl-sys/include/mesalink/mesalink/x509.h b/curl-sys/include/mesalink/mesalink/x509.h deleted file mode 100644 index 9b99704c16..0000000000 --- a/curl-sys/include/mesalink/mesalink/x509.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * __ __ _ _ _ - * | \/ | ___ ___ __ _| | (_)_ __ | | __ - * | |\/| |/ _ \/ __|/ _` | | | | '_ \| |/ / - * | | | | __/\__ \ (_| | |___| | | | | < - * |_| |_|\___||___/\__,_|_____|_|_| |_|_|\_\ - * - * Copyright (c) 2017-2018, The MesaLink Authors. - * All rights reserved. - * - * This work is licensed under the terms of the BSD 3-Clause License. - * For a copy, see the LICENSE file. - * - */ - -#ifndef MESALINK_X509_H -#define MESALINK_X509_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -typedef struct MESALINK_X509 MESALINK_X509; -typedef struct MESALINK_X509_NAME MESALINK_X509_NAME; - -#define MESALINK_STACK_OF(NAME) MESALINK_STACK_##NAME -typedef struct MESALINK_STACK_OF(MESALINK_X509) - MESALINK_STACK_OF(MESALINK_X509); -typedef struct MESALINK_STACK_OF(MESALINK_X509_NAME) - MESALINK_STACK_OF(MESALINK_X509_NAME); - -MESALINK_API void mesalink_X509_free(const MESALINK_X509 *); -MESALINK_API void mesalink_X509_NAME_free(const MESALINK_X509_NAME *); - -MESALINK_API MESALINK_X509_NAME *mesalink_X509_get_subject( - const MESALINK_X509 *); -MESALINK_API MESALINK_X509_NAME *mesalink_X509_get_subject_name( - const MESALINK_X509 *); -MESALINK_API MESALINK_STACK_OF(MESALINK_X509_NAME) * - mesalink_X509_get_alt_subject_names(const MESALINK_X509 *); -MESALINK_API char *mesalink_X509_NAME_oneline(const MESALINK_X509_NAME *, - char *buf, int size); - -MESALINK_API MESALINK_STACK_OF(MESALINK_X509) * - mesalink_sk_X509_new_null(void); -MESALINK_API int mesalink_sk_X509_num(const MESALINK_STACK_MESALINK_X509 *); -MESALINK_API MESALINK_X509_NAME *mesalink_sk_X509_value( - const MESALINK_STACK_MESALINK_X509 *, int); -MESALINK_API int mesalink_sk_X509_push(MESALINK_STACK_MESALINK_X509 *, - const MESALINK_X509 *); -MESALINK_API void mesalink_sk_X509_free(const MESALINK_STACK_MESALINK_X509 *); - -MESALINK_API MESALINK_STACK_OF(MESALINK_X509_NAME) * - mesalink_sk_X509_NAME_new_null(void); -MESALINK_API int mesalink_sk_X509_NAME_num( - const MESALINK_STACK_MESALINK_X509_NAME *); -MESALINK_API MESALINK_X509_NAME *mesalink_sk_X509_NAME_value( - const MESALINK_STACK_MESALINK_X509_NAME *, int); -MESALINK_API void mesalink_sk_X509_NAME_free( - const MESALINK_STACK_MESALINK_X509_NAME *); - -#ifdef __cplusplus -} /* extern C */ -#endif - -#endif /* MESALINK_X509_H */ From dc3e38915b9e16981b84cd14c9e9a0496098cca2 Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Thu, 15 Aug 2019 20:25:12 -0500 Subject: [PATCH 6/7] Upstream MesaLink branch --- curl-sys/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/curl-sys/Cargo.toml b/curl-sys/Cargo.toml index 8d353e4518..a5046eae0a 100644 --- a/curl-sys/Cargo.toml +++ b/curl-sys/Cargo.toml @@ -24,9 +24,9 @@ libc = "0.2.2" libnghttp2-sys = { optional = true, version = "0.1" } [dependencies.mesalink] -version = "1.1.0-beta" -git = "https://github.com/sagebind/mesalink" -branch = "cargo-c-headers" +version = "1.1.0-cratesio" +git = "https://github.com/mesalock-linux/mesalink" +branch = "crates_io" optional = true default-features = false features = ["client_apis", "error_strings", "tls13", "aesgcm", "chachapoly", "x25519", "ecdh", "ecdsa", "verifier"] From 13ddb2dd259e8846f58c0d38962fe159c5384bd6 Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Fri, 16 Aug 2019 18:42:58 -0500 Subject: [PATCH 7/7] Use published version of MesaLink --- curl-sys/Cargo.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/curl-sys/Cargo.toml b/curl-sys/Cargo.toml index a5046eae0a..3b8247ce54 100644 --- a/curl-sys/Cargo.toml +++ b/curl-sys/Cargo.toml @@ -25,8 +25,6 @@ libnghttp2-sys = { optional = true, version = "0.1" } [dependencies.mesalink] version = "1.1.0-cratesio" -git = "https://github.com/mesalock-linux/mesalink" -branch = "crates_io" optional = true default-features = false features = ["client_apis", "error_strings", "tls13", "aesgcm", "chachapoly", "x25519", "ecdh", "ecdsa", "verifier"]