Skip to content

Commit

Permalink
Merge pull request sfackler#1807 from alex/edition-2018-sys
Browse files Browse the repository at this point in the history
Migrate the openssl-sys crate to the 2018 edition
  • Loading branch information
sfackler authored Feb 3, 2023
2 parents 11797d9 + dc976d7 commit 3acc5bb
Show file tree
Hide file tree
Showing 59 changed files with 250 additions and 255 deletions.
2 changes: 2 additions & 0 deletions openssl-macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]

use proc_macro::TokenStream;
use proc_macro2::Ident;
use quote::quote;
Expand Down
1 change: 1 addition & 0 deletions openssl-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ readme = "README.md"
categories = ["cryptography", "external-ffi-bindings"]
links = "openssl"
build = "build/main.rs"
edition = "2018"

[features]
vendored = ['openssl-src']
Expand Down
1 change: 0 additions & 1 deletion openssl-sys/build/find_normal.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use pkg_config;
use std::ffi::OsString;
use std::path::{Path, PathBuf};
use std::process::{self, Command};
Expand Down
6 changes: 5 additions & 1 deletion openssl-sys/build/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#![allow(clippy::inconsistent_digit_grouping, clippy::unusual_byte_groupings)]
#![allow(
clippy::inconsistent_digit_grouping,
clippy::uninlined_format_args,
clippy::unusual_byte_groupings
)]

extern crate autocfg;
#[cfg(feature = "bindgen")]
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/asn1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use libc::*;

use *;
use super::*;

// ASN.1 tag values
pub const V_ASN1_EOC: c_int = 0;
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/bio.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use libc::*;

use *;
use super::*;

pub const BIO_TYPE_NONE: c_int = 0;

Expand Down
2 changes: 0 additions & 2 deletions openssl-sys/src/bn.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use libc::*;

use *;

#[cfg(target_pointer_width = "64")]
pub type BN_ULONG = c_ulonglong;
#[cfg(target_pointer_width = "32")]
Expand Down
1 change: 0 additions & 1 deletion openssl-sys/src/cms.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use libc::*;
use *;

#[cfg(ossl101)]
pub const CMS_TEXT: c_uint = 0x1;
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/crypto.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::*;
use libc::*;
use *;

extern "C" {
#[deprecated(note = "use CRYPTO_set_locking_callback__fixed_rust instead")]
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/ec.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use libc::*;
use std::ptr;

use *;
use super::*;

pub const OPENSSL_EC_NAMED_CURVE: c_int = 1;

Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/evp.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::*;
use libc::*;
use *;

pub const EVP_MAX_MD_SIZE: c_uint = 64;

Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/aes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

#[repr(C)]
pub struct AES_KEY {
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/asn1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

#[repr(C)]
pub struct ASN1_ENCODING {
Expand Down
24 changes: 12 additions & 12 deletions openssl-sys/src/handwritten/bio.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

extern "C" {
pub fn BIO_set_flags(b: *mut BIO, flags: c_int);
Expand All @@ -17,14 +17,14 @@ cfg_if! {
pub struct BIO_METHOD {
pub type_: c_int,
pub name: *const c_char,
pub bwrite: Option<unsafe extern "C" fn(*mut ::BIO, *const c_char, c_int) -> c_int>,
pub bread: Option<unsafe extern "C" fn(*mut ::BIO, *mut c_char, c_int) -> c_int>,
pub bputs: Option<unsafe extern "C" fn(*mut ::BIO, *const c_char) -> c_int>,
pub bgets: Option<unsafe extern "C" fn(*mut ::BIO, *mut c_char, c_int) -> c_int>,
pub ctrl: Option<unsafe extern "C" fn(*mut ::BIO, c_int, c_long, *mut c_void) -> c_long>,
pub create: Option<unsafe extern "C" fn(*mut ::BIO) -> c_int>,
pub destroy: Option<unsafe extern "C" fn(*mut ::BIO) -> c_int>,
pub callback_ctrl: Option<unsafe extern "C" fn(*mut ::BIO, c_int, ::bio_info_cb) -> c_long>,
pub bwrite: Option<unsafe extern "C" fn(*mut BIO, *const c_char, c_int) -> c_int>,
pub bread: Option<unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int>,
pub bputs: Option<unsafe extern "C" fn(*mut BIO, *const c_char) -> c_int>,
pub bgets: Option<unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int>,
pub ctrl: Option<unsafe extern "C" fn(*mut BIO, c_int, c_long, *mut c_void) -> c_long>,
pub create: Option<unsafe extern "C" fn(*mut BIO) -> c_int>,
pub destroy: Option<unsafe extern "C" fn(*mut BIO) -> c_int>,
pub callback_ctrl: Option<unsafe extern "C" fn(*mut BIO, c_int, bio_info_cb) -> c_long>,
}
}
}
Expand All @@ -39,11 +39,11 @@ extern "C" {
#[cfg(not(osslconf = "OPENSSL_NO_STDIO"))]
pub fn BIO_new_fp(stream: *mut FILE, close_flag: c_int) -> *mut BIO;
#[cfg(any(ossl110, libressl273))]
pub fn BIO_set_data(a: *mut ::BIO, data: *mut c_void);
pub fn BIO_set_data(a: *mut BIO, data: *mut c_void);
#[cfg(any(ossl110, libressl273))]
pub fn BIO_get_data(a: *mut ::BIO) -> *mut c_void;
pub fn BIO_get_data(a: *mut BIO) -> *mut c_void;
#[cfg(any(ossl110, libressl273))]
pub fn BIO_set_init(a: *mut ::BIO, init: c_int);
pub fn BIO_set_init(a: *mut BIO, init: c_int);
pub fn BIO_write(b: *mut BIO, buf: *const c_void, len: c_int) -> c_int;
pub fn BIO_read(b: *mut BIO, buf: *mut c_void, len: c_int) -> c_int;
pub fn BIO_ctrl(b: *mut BIO, cmd: c_int, larg: c_long, parg: *mut c_void) -> c_long;
Expand Down
4 changes: 2 additions & 2 deletions openssl-sys/src/handwritten/bn.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

extern "C" {
pub fn BN_CTX_new() -> *mut BN_CTX;
Expand Down Expand Up @@ -31,7 +31,7 @@ extern "C" {
pub fn BN_sqr(r: *mut BIGNUM, a: *const BIGNUM, ctx: *mut BN_CTX) -> c_int;
pub fn BN_set_negative(bn: *mut BIGNUM, n: c_int);
#[cfg(any(ossl110, libressl350))]
pub fn BN_is_negative(b: *const ::BIGNUM) -> c_int;
pub fn BN_is_negative(b: *const BIGNUM) -> c_int;

pub fn BN_div(
dv: *mut BIGNUM,
Expand Down
34 changes: 17 additions & 17 deletions openssl-sys/src/handwritten/cms.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use super::super::*;
use libc::*;
use *;

pub enum CMS_ContentInfo {}

extern "C" {
#[cfg(ossl101)]
pub fn CMS_ContentInfo_free(cms: *mut ::CMS_ContentInfo);
pub fn CMS_ContentInfo_free(cms: *mut CMS_ContentInfo);
}

const_ptr_api! {
Expand All @@ -18,38 +18,38 @@ const_ptr_api! {
extern "C" {
#[cfg(ossl101)]
pub fn d2i_CMS_ContentInfo(
a: *mut *mut ::CMS_ContentInfo,
a: *mut *mut CMS_ContentInfo,
pp: *mut *const c_uchar,
length: c_long,
) -> *mut ::CMS_ContentInfo;
) -> *mut CMS_ContentInfo;

#[cfg(ossl101)]
pub fn SMIME_read_CMS(bio: *mut ::BIO, bcont: *mut *mut ::BIO) -> *mut ::CMS_ContentInfo;
pub fn SMIME_read_CMS(bio: *mut BIO, bcont: *mut *mut BIO) -> *mut CMS_ContentInfo;

#[cfg(ossl101)]
pub fn CMS_sign(
signcert: *mut ::X509,
pkey: *mut ::EVP_PKEY,
certs: *mut ::stack_st_X509,
data: *mut ::BIO,
signcert: *mut X509,
pkey: *mut EVP_PKEY,
certs: *mut stack_st_X509,
data: *mut BIO,
flags: c_uint,
) -> *mut ::CMS_ContentInfo;
) -> *mut CMS_ContentInfo;

#[cfg(ossl101)]
pub fn CMS_encrypt(
certs: *mut stack_st_X509,
data: *mut ::BIO,
data: *mut BIO,
cipher: *const EVP_CIPHER,
flags: c_uint,
) -> *mut ::CMS_ContentInfo;
) -> *mut CMS_ContentInfo;

#[cfg(ossl101)]
pub fn CMS_decrypt(
cms: *mut ::CMS_ContentInfo,
pkey: *mut ::EVP_PKEY,
cert: *mut ::X509,
dcont: *mut ::BIO,
out: *mut ::BIO,
cms: *mut CMS_ContentInfo,
pkey: *mut EVP_PKEY,
cert: *mut X509,
dcont: *mut BIO,
out: *mut BIO,
flags: c_uint,
) -> c_int;
}
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/conf.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use *;
use super::super::*;

extern "C" {
pub fn NCONF_new(meth: *mut CONF_METHOD) -> *mut CONF;
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/crypto.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

stack!(stack_st_void);

Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/dh.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use *;
use super::super::*;

extern "C" {
pub fn DH_new() -> *mut DH;
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/dsa.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use libc::*;

use *;
use super::super::*;

cfg_if! {
if #[cfg(any(ossl110, libressl280))] {
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/ec.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

#[repr(C)]
#[derive(Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/err.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

#[repr(C)]
pub struct ERR_STRING_DATA {
Expand Down
6 changes: 3 additions & 3 deletions openssl-sys/src/handwritten/evp.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

cfg_if! {
if #[cfg(ossl300)] {
Expand Down Expand Up @@ -344,9 +344,9 @@ extern "C" {
#[cfg(ossl110)]
pub fn EVP_aes_256_ocb() -> *const EVP_CIPHER;
#[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
pub fn EVP_chacha20() -> *const ::EVP_CIPHER;
pub fn EVP_chacha20() -> *const EVP_CIPHER;
#[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
pub fn EVP_chacha20_poly1305() -> *const ::EVP_CIPHER;
pub fn EVP_chacha20_poly1305() -> *const EVP_CIPHER;
#[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
pub fn EVP_seed_cbc() -> *const EVP_CIPHER;
#[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/hmac.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use libc::*;

use *;
use super::super::*;

cfg_if! {
if #[cfg(any(ossl110, libressl350))] {
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/kdf.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

cfg_if! {
if #[cfg(ossl300)] {
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/object.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use libc::*;

use *;
use super::super::*;

extern "C" {
pub fn OBJ_nid2ln(nid: c_int) -> *const c_char;
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/ocsp.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

pub enum OCSP_CERTID {}

Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/pem.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

pub type pem_password_cb = Option<
unsafe extern "C" fn(
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/pkcs12.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use libc::*;

use *;
use super::super::*;

pub enum PKCS12 {}

Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/pkcs7.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

pub enum PKCS7_SIGNED {}
pub enum PKCS7_ENVELOPE {}
Expand Down
2 changes: 1 addition & 1 deletion openssl-sys/src/handwritten/provider.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::super::*;
use libc::*;
use *;

extern "C" {
#[cfg(ossl300)]
Expand Down
Loading

0 comments on commit 3acc5bb

Please sign in to comment.