aboutsummaryrefslogtreecommitdiff
path: root/openssl-sys/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2018-03-11 15:33:42 -0700
committerGitHub <[email protected]>2018-03-11 15:33:42 -0700
commit0bc7dd90343a44fdac52c03914fd71e5a8c4762e (patch)
tree5b4ce5cde1a896abb1b65e9020e689a054777694 /openssl-sys/src
parentMerge pull request #863 from rohit-lshift/master (diff)
parentMerge branch 'master' into custom-extensions (diff)
downloadrust-openssl-0bc7dd90343a44fdac52c03914fd71e5a8c4762e.tar.xz
rust-openssl-0bc7dd90343a44fdac52c03914fd71e5a8c4762e.zip
Merge pull request #860 from Ralith/custom-extensions
Custom extensions
Diffstat (limited to 'openssl-sys/src')
-rw-r--r--openssl-sys/src/lib.rs6
-rw-r--r--openssl-sys/src/ossl10x.rs3
-rw-r--r--openssl-sys/src/ossl110.rs2
-rw-r--r--openssl-sys/src/ossl111.rs54
4 files changed, 63 insertions, 2 deletions
diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs
index 2eef0741..5a09eae1 100644
--- a/openssl-sys/src/lib.rs
+++ b/openssl-sys/src/lib.rs
@@ -1219,6 +1219,12 @@ pub const RSA_PKCS1_PSS_PADDING: c_int = 6;
pub const SHA_LBLOCK: c_int = 16;
+pub const SSL3_AD_ILLEGAL_PARAMETER: c_int = 47;
+pub const SSL_AD_ILLEGAL_PARAMETER: c_int = SSL3_AD_ILLEGAL_PARAMETER;
+
+pub const TLS1_AD_DECODE_ERROR: c_int = 50;
+pub const SSL_AD_DECODE_ERROR: c_int = TLS1_AD_DECODE_ERROR;
+
pub const TLS1_AD_UNRECOGNIZED_NAME: c_int = 112;
pub const SSL_AD_UNRECOGNIZED_NAME: c_int = TLS1_AD_UNRECOGNIZED_NAME;
diff --git a/openssl-sys/src/ossl10x.rs b/openssl-sys/src/ossl10x.rs
index 09185160..9b79fb57 100644
--- a/openssl-sys/src/ossl10x.rs
+++ b/openssl-sys/src/ossl10x.rs
@@ -975,4 +975,7 @@ extern "C" {
pub fn SSLeay() -> c_ulong;
pub fn SSLeay_version(key: c_int) -> *const c_char;
+
+ #[cfg(ossl102)]
+ pub fn SSL_extension_supported(ext_type: c_uint) -> c_int;
}
diff --git a/openssl-sys/src/ossl110.rs b/openssl-sys/src/ossl110.rs
index 1902af75..580c3f72 100644
--- a/openssl-sys/src/ossl110.rs
+++ b/openssl-sys/src/ossl110.rs
@@ -364,7 +364,7 @@ extern "C" {
) -> *mut PKCS12;
pub fn X509_REQ_get_version(req: *const X509_REQ) -> c_long;
pub fn X509_REQ_get_subject_name(req: *const X509_REQ) -> *mut ::X509_NAME;
-
+ pub fn SSL_extension_supported(ext_type: c_uint) -> c_int;
pub fn ECDSA_SIG_get0(sig: *const ECDSA_SIG, pr: *mut *const BIGNUM, ps: *mut *const BIGNUM);
pub fn ECDSA_SIG_set0(sig: *mut ECDSA_SIG, pr: *mut BIGNUM, ps: *mut BIGNUM) -> c_int;
}
diff --git a/openssl-sys/src/ossl111.rs b/openssl-sys/src/ossl111.rs
index 27bc4b54..cca06fda 100644
--- a/openssl-sys/src/ossl111.rs
+++ b/openssl-sys/src/ossl111.rs
@@ -1,15 +1,67 @@
-use libc::{c_char, c_int, c_ulong};
+use libc::{c_char, c_uchar, c_int, c_uint, c_ulong, size_t, c_void};
pub type SSL_CTX_keylog_cb_func =
Option<unsafe extern "C" fn(ssl: *const ::SSL, line: *const c_char)>;
+pub type SSL_custom_ext_add_cb_ex =
+ Option<unsafe extern "C" fn(ssl: *mut ::SSL, ext_type: c_uint,
+ context: c_uint,
+ out: *mut *const c_uchar,
+ outlen: *mut size_t, x: *mut ::X509,
+ chainidx: size_t, al: *mut c_int,
+ add_arg: *mut c_void) -> c_int>;
+
+pub type SSL_custom_ext_free_cb_ex =
+ Option<unsafe extern "C" fn(ssl: *mut ::SSL, ext_type: c_uint,
+ context: c_uint,
+ out: *mut *const c_uchar,
+ add_arg: *mut c_void)>;
+
+pub type SSL_custom_ext_parse_cb_ex =
+ Option<unsafe extern "C" fn(ssl: *mut ::SSL, ext_type: c_uint,
+ context: c_uint,
+ input: *const c_uchar,
+ inlen: size_t, x: *mut ::X509,
+ chainidx: size_t, al: *mut c_int,
+ parse_arg: *mut c_void) -> c_int>;
+
pub const SSL_COOKIE_LENGTH: c_int = 255;
pub const SSL_OP_ENABLE_MIDDLEBOX_COMPAT: c_ulong = 0x00100000;
pub const TLS1_3_VERSION: c_int = 0x304;
+pub const SSL_EXT_TLS_ONLY: c_uint = 0x0001;
+/* This extension is only allowed in DTLS */
+pub const SSL_EXT_DTLS_ONLY: c_uint = 0x0002;
+/* Some extensions may be allowed in DTLS but we don't implement them for it */
+pub const SSL_EXT_TLS_IMPLEMENTATION_ONLY: c_uint = 0x0004;
+/* Most extensions are not defined for SSLv3 but EXT_TYPE_renegotiate is */
+pub const SSL_EXT_SSL3_ALLOWED: c_uint = 0x0008;
+/* Extension is only defined for TLS1.2 and below */
+pub const SSL_EXT_TLS1_2_AND_BELOW_ONLY: c_uint = 0x0010;
+/* Extension is only defined for TLS1.3 and above */
+pub const SSL_EXT_TLS1_3_ONLY: c_uint = 0x0020;
+/* Ignore this extension during parsing if we are resuming */
+pub const SSL_EXT_IGNORE_ON_RESUMPTION: c_uint = 0x0040;
+pub const SSL_EXT_CLIENT_HELLO: c_uint = 0x0080;
+/* Really means TLS1.2 or below */
+pub const SSL_EXT_TLS1_2_SERVER_HELLO: c_uint = 0x0100;
+pub const SSL_EXT_TLS1_3_SERVER_HELLO: c_uint = 0x0200;
+pub const SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS: c_uint = 0x0400;
+pub const SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST: c_uint = 0x0800;
+pub const SSL_EXT_TLS1_3_CERTIFICATE: c_uint = 0x1000;
+pub const SSL_EXT_TLS1_3_NEW_SESSION_TICKET: c_uint = 0x2000;
+pub const SSL_EXT_TLS1_3_CERTIFICATE_REQUEST: c_uint = 0x4000;
+
+
extern "C" {
pub fn SSL_CTX_set_keylog_callback(ctx: *mut ::SSL_CTX, cb: SSL_CTX_keylog_cb_func);
+ pub fn SSL_CTX_add_custom_ext(ctx: *mut ::SSL_CTX, ext_type: c_uint, context: c_uint,
+ add_cb: SSL_custom_ext_add_cb_ex,
+ free_cb: SSL_custom_ext_free_cb_ex,
+ add_arg: *mut c_void,
+ parse_cb: SSL_custom_ext_parse_cb_ex,
+ parse_arg: *mut c_void) -> c_int;
pub fn SSL_stateless(s: *mut ::SSL) -> c_int;
}