Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into openssl-300
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Oct 26, 2020
2 parents bd7d8dc + f958176 commit 2dc1290
Show file tree
Hide file tree
Showing 25 changed files with 885 additions and 466 deletions.
6 changes: 2 additions & 4 deletions .circleci/config.yml
Expand Up @@ -177,13 +177,11 @@ jobs:
type: string
default: 1.33.0
macos:
xcode: "9.0"
xcode: "12.2.0"
environment:
RUST_BACKTRACE: 1
steps:
- checkout
- run: sudo mkdir /opt
- run: sudo chown -R $USER /usr/local/ /opt
- run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain << parameters.image >>
- run: sudo ln -s ~/.cargo/bin/* /usr/local/bin
- run: cargo generate-lockfile
Expand Down Expand Up @@ -212,7 +210,7 @@ openssl_300: &openssl_300
version: 3.0.0-alpha6
openssl_111: &openssl_111
library: openssl
version: 1.1.1g
version: 1.1.1h
openssl_110: &openssl_110
library: openssl
version: 1.1.0l
Expand Down
1 change: 1 addition & 0 deletions openssl-sys/build/main.rs
Expand Up @@ -276,6 +276,7 @@ due to this version mismatch.

// parses a string that looks like "0x100020cfL"
#[allow(deprecated)] // trim_right_matches is now trim_end_matches
#[allow(clippy::match_like_matches_macro)] // matches macro requires rust 1.42.0
fn parse_version(version: &str) -> u64 {
// cut off the 0x prefix
assert!(version.starts_with("0x"));
Expand Down
12 changes: 3 additions & 9 deletions openssl-sys/src/asn1.rs
Expand Up @@ -61,14 +61,8 @@ extern "C" {
pub fn ASN1_TIME_set_string_X509(s: *mut ASN1_TIME, str: *const c_char) -> c_int;
}

cfg_if! {
if #[cfg(any(ossl110, libressl280))] {
extern "C" {
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: *const ASN1_STRING) -> c_int;
}
} else {
extern "C" {
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: *mut ASN1_STRING) -> c_int;
}
const_ptr_api! {
extern "C" {
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: #[const_ptr_if(any(ossl110, libressl280))] ASN1_STRING) -> c_int;
}
}
39 changes: 8 additions & 31 deletions openssl-sys/src/bio.rs
Expand Up @@ -60,17 +60,10 @@ pub unsafe fn BIO_get_mem_data(b: *mut BIO, pp: *mut *mut c_char) -> c_long {
BIO_ctrl(b, BIO_CTRL_INFO, 0, pp as *mut c_void)
}

cfg_if! {
if #[cfg(any(ossl110, libressl280))] {
extern "C" {
pub fn BIO_s_file() -> *const BIO_METHOD;
pub fn BIO_new(type_: *const BIO_METHOD) -> *mut BIO;
}
} else {
extern "C" {
pub fn BIO_s_file() -> *mut BIO_METHOD;
pub fn BIO_new(type_: *mut BIO_METHOD) -> *mut BIO;
}
const_ptr_api! {
extern "C" {
pub fn BIO_s_file() -> #[const_ptr_if(any(ossl110, libressl280))] BIO_METHOD;
pub fn BIO_new(type_: #[const_ptr_if(any(ossl110, libressl280))] BIO_METHOD) -> *mut BIO;
}
}
extern "C" {
Expand All @@ -88,26 +81,10 @@ extern "C" {
pub fn BIO_free_all(b: *mut BIO);
}

cfg_if! {
if #[cfg(any(ossl110, libressl280))] {
extern "C" {
pub fn BIO_s_mem() -> *const BIO_METHOD;
}
} else {
extern "C" {
pub fn BIO_s_mem() -> *mut BIO_METHOD;
}
}
}
cfg_if! {
if #[cfg(any(ossl102, libressl280))] {
extern "C" {
pub fn BIO_new_mem_buf(buf: *const c_void, len: c_int) -> *mut BIO;
}
} else {
extern "C" {
pub fn BIO_new_mem_buf(buf: *mut c_void, len: c_int) -> *mut BIO;
}
const_ptr_api! {
extern "C" {
pub fn BIO_s_mem() -> #[const_ptr_if(any(ossl110, libressl280))] BIO_METHOD;
pub fn BIO_new_mem_buf(buf: #[const_ptr_if(any(ossl102, libressl280))] c_void, len: c_int) -> *mut BIO;
}
}

Expand Down
4 changes: 2 additions & 2 deletions openssl-sys/src/err.rs
Expand Up @@ -13,8 +13,8 @@ cfg_if! {

pub const ERR_LIB_OFFSET: c_ulong = 23;
pub const ERR_LIB_MASK: c_ulong = 0xff;
pub const ERR_RFLAGS_OFFSET: c_ulong = 19;
pub const ERR_RFLAGS_MASK: c_ulong = 0xf;
pub const ERR_RFLAGS_OFFSET: c_ulong = 18;
pub const ERR_RFLAGS_MASK: c_ulong = 0x1f;
pub const ERR_REASON_MASK: c_ulong = 0x7FFFFF;

pub const ERR_RFLAG_FATAL: c_ulong = 0x1 << ERR_RFLAGS_OFFSET;
Expand Down
64 changes: 20 additions & 44 deletions openssl-sys/src/evp.rs
Expand Up @@ -11,8 +11,12 @@ pub const EVP_PKEY_DSA: c_int = NID_dsa;
pub const EVP_PKEY_DH: c_int = NID_dhKeyAgreement;
pub const EVP_PKEY_EC: c_int = NID_X9_62_id_ecPublicKey;
#[cfg(ossl111)]
pub const EVP_PKEY_X25519: c_int = NID_X25519;
#[cfg(ossl111)]
pub const EVP_PKEY_ED25519: c_int = NID_ED25519;
#[cfg(ossl111)]
pub const EVP_PKEY_X448: c_int = NID_X448;
#[cfg(ossl111)]
pub const EVP_PKEY_ED448: c_int = NID_ED448;
pub const EVP_PKEY_HMAC: c_int = NID_hmac;
pub const EVP_PKEY_CMAC: c_int = NID_cmac;
Expand Down Expand Up @@ -170,15 +174,9 @@ extern "C" {
outl: *mut c_int,
) -> c_int;
}
cfg_if! {
if #[cfg(any(ossl111b, libressl280))] {
extern "C" {
pub fn EVP_PKEY_size(pkey: *const EVP_PKEY) -> c_int;
}
} else {
extern "C" {
pub fn EVP_PKEY_size(pkey: *mut EVP_PKEY) -> c_int;
}
const_ptr_api! {
extern "C" {
pub fn EVP_PKEY_size(pkey: #[const_ptr_if(any(ossl111b, libressl280))] EVP_PKEY) -> c_int;
}
}
cfg_if! {
Expand All @@ -202,23 +200,13 @@ cfg_if! {
}
}
}
cfg_if! {
if #[cfg(any(ossl102, libressl280))] {
extern "C" {
pub fn EVP_DigestVerifyFinal(
ctx: *mut EVP_MD_CTX,
sigret: *const c_uchar,
siglen: size_t,
) -> c_int;
}
} else {
extern "C" {
pub fn EVP_DigestVerifyFinal(
ctx: *mut EVP_MD_CTX,
sigret: *mut c_uchar,
siglen: size_t,
) -> c_int;
}
const_ptr_api! {
extern "C" {
pub fn EVP_DigestVerifyFinal(
ctx: *mut EVP_MD_CTX,
sigret: #[const_ptr_if(any(ossl102, libressl280))] c_uchar,
siglen: size_t,
) -> c_int;
}
}

Expand Down Expand Up @@ -313,15 +301,9 @@ extern "C" {

pub fn EVP_PKEY_id(pkey: *const EVP_PKEY) -> c_int;
}
cfg_if! {
if #[cfg(any(ossl110, libressl280))] {
extern "C" {
pub fn EVP_PKEY_bits(key: *const EVP_PKEY) -> c_int;
}
} else {
extern "C" {
pub fn EVP_PKEY_bits(key: *mut EVP_PKEY) -> c_int;
}
const_ptr_api! {
extern "C" {
pub fn EVP_PKEY_bits(key: #[const_ptr_if(any(ossl110, libressl280))] EVP_PKEY) -> c_int;
}
}
extern "C" {
Expand Down Expand Up @@ -464,15 +446,9 @@ extern "C" {
) -> c_int;
}

cfg_if! {
if #[cfg(any(ossl110, libressl280))] {
extern "C" {
pub fn EVP_PKCS82PKEY(p8: *const PKCS8_PRIV_KEY_INFO) -> *mut EVP_PKEY;
}
} else {
extern "C" {
pub fn EVP_PKCS82PKEY(p8: *mut PKCS8_PRIV_KEY_INFO) -> *mut EVP_PKEY;
}
const_ptr_api! {
extern "C" {
pub fn EVP_PKCS82PKEY(p8: #[const_ptr_if(any(ossl110, libressl280))] PKCS8_PRIV_KEY_INFO) -> *mut EVP_PKEY;
}
}

Expand Down
1 change: 1 addition & 0 deletions openssl-sys/src/lib.rs
Expand Up @@ -9,6 +9,7 @@
unused_imports
)]
#![doc(html_root_url = "https://docs.rs/openssl-sys/0.9")]
#![recursion_limit = "128"] // configure fixed limit across all rust versions

extern crate libc;

Expand Down

0 comments on commit 2dc1290

Please sign in to comment.