Skip to content

Commit

Permalink
Remove decrepit and unavaliable API and fix signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
inikulin committed Nov 10, 2020
1 parent df0b31b commit a6f5bee
Show file tree
Hide file tree
Showing 63 changed files with 715 additions and 3,288 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
members = [
"openssl",
"openssl-sys",
"systest"
]
23 changes: 7 additions & 16 deletions openssl-sys/src/aes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,26 @@ pub const AES_BLOCK_SIZE: c_int = 16;
pub struct AES_KEY {
// There is some business with AES_LONG which is there to ensure the values here are 32 bits
rd_key: [u32; 4 * (AES_MAXNR as usize + 1)],
rounds: c_int,
rounds: c_uint,
}

extern "C" {
pub fn AES_set_encrypt_key(userKey: *const c_uchar, bits: c_int, key: *mut AES_KEY) -> c_int;
pub fn AES_set_decrypt_key(userKey: *const c_uchar, bits: c_int, key: *mut AES_KEY) -> c_int;

pub fn AES_ige_encrypt(
in_: *const c_uchar,
out: *mut c_uchar,
length: size_t,
key: *const AES_KEY,
ivec: *mut c_uchar,
enc: c_int,
);
pub fn AES_set_encrypt_key(userKey: *const c_uchar, bits: c_uint, key: *mut AES_KEY) -> c_int;
pub fn AES_set_decrypt_key(userKey: *const c_uchar, bits: c_uint, key: *mut AES_KEY) -> c_int;

pub fn AES_wrap_key(
key: *mut AES_KEY,
key: *const AES_KEY,
iv: *const c_uchar,
out: *mut c_uchar,
in_: *const c_uchar,
inlen: c_uint,
inlen: size_t,
) -> c_int;

pub fn AES_unwrap_key(
key: *mut AES_KEY,
key: *const AES_KEY,
iv: *const c_uchar,
out: *mut c_uchar,
in_: *const c_uchar,
inlen: c_uint,
inlen: size_t,
) -> c_int;
}
12 changes: 2 additions & 10 deletions openssl-sys/src/asn1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ 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;
}
}
extern "C" {
pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: *mut ASN1_STRING) -> c_int;
}
32 changes: 3 additions & 29 deletions openssl-sys/src/bn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ extern "C" {
pub fn BN_rand_range(r: *mut BIGNUM, range: *const BIGNUM) -> c_int;
pub fn BN_pseudo_rand_range(r: *mut BIGNUM, range: *const BIGNUM) -> c_int;
pub fn BN_new() -> *mut BIGNUM;
pub fn BN_num_bits(bn: *const BIGNUM) -> c_int;
pub fn BN_num_bits(bn: *const BIGNUM) -> c_uint;
pub fn BN_clear_free(bn: *mut BIGNUM);
pub fn BN_bin2bn(s: *const u8, size: c_int, ret: *mut BIGNUM) -> *mut BIGNUM;
pub fn BN_bn2bin(a: *const BIGNUM, to: *mut u8) -> c_int;
pub fn BN_bin2bn(s: *const u8, size: size_t, ret: *mut BIGNUM) -> *mut BIGNUM;
pub fn BN_bn2bin(a: *const BIGNUM, to: *mut u8) -> size_t;
pub fn BN_sub(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM) -> c_int;
pub fn BN_add(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM) -> c_int;
pub fn BN_mul(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, ctx: *mut BN_CTX) -> c_int;
Expand Down Expand Up @@ -132,29 +132,3 @@ extern "C" {
cb: *mut BN_GENCB,
) -> c_int;
}

cfg_if! {
if #[cfg(ossl110)] {
extern "C" {
pub fn BN_get_rfc2409_prime_768(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn BN_get_rfc2409_prime_1024(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn BN_get_rfc3526_prime_1536(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn BN_get_rfc3526_prime_2048(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn BN_get_rfc3526_prime_3072(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn BN_get_rfc3526_prime_4096(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn BN_get_rfc3526_prime_6144(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn BN_get_rfc3526_prime_8192(bn: *mut BIGNUM) -> *mut BIGNUM;
}
} else {
extern "C" {
pub fn get_rfc2409_prime_768(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn get_rfc2409_prime_1024(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn get_rfc3526_prime_1536(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn get_rfc3526_prime_2048(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn get_rfc3526_prime_3072(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn get_rfc3526_prime_4096(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn get_rfc3526_prime_6144(bn: *mut BIGNUM) -> *mut BIGNUM;
pub fn get_rfc3526_prime_8192(bn: *mut BIGNUM) -> *mut BIGNUM;
}
}
}
95 changes: 0 additions & 95 deletions openssl-sys/src/cms.rs

This file was deleted.

3 changes: 1 addition & 2 deletions openssl-sys/src/conf.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use *;

extern "C" {
pub fn NCONF_new(meth: *mut CONF_METHOD) -> *mut CONF;
pub fn NCONF_default() -> *mut CONF_METHOD;
pub fn NCONF_new(meth: *mut c_void) -> *mut CONF;
pub fn NCONF_free(conf: *mut CONF);
}
35 changes: 3 additions & 32 deletions openssl-sys/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ pub const CRYPTO_LOCK_SSL_SESSION: c_int = 14;

stack!(stack_st_void);

cfg_if! {
if #[cfg(ossl110)] {
pub const CRYPTO_EX_INDEX_SSL: c_int = 0;
pub const CRYPTO_EX_INDEX_SSL_CTX: c_int = 1;
} else if #[cfg(libressl)] {
pub const CRYPTO_EX_INDEX_SSL: c_int = 1;
pub const CRYPTO_EX_INDEX_SSL_CTX: c_int = 2;
}
}
cfg_if! {
if #[cfg(any(ossl110, libressl271))] {
extern "C" {
Expand Down Expand Up @@ -71,17 +62,6 @@ pub type CRYPTO_EX_free = unsafe extern "C" fn(
argl: c_long,
argp: *mut c_void,
);
extern "C" {
#[cfg(any(ossl110, libressl))]
pub fn CRYPTO_get_ex_new_index(
class_index: c_int,
argl: c_long,
argp: *mut c_void,
new_func: Option<CRYPTO_EX_new>,
dup_func: Option<CRYPTO_EX_dup>,
free_func: Option<CRYPTO_EX_free>,
) -> c_int;
}

pub const CRYPTO_LOCK: c_int = 1;

Expand All @@ -106,18 +86,9 @@ extern "C" {
) -> c_int;
}

cfg_if! {
if #[cfg(ossl110)] {
extern "C" {
pub fn CRYPTO_malloc(num: size_t, file: *const c_char, line: c_int) -> *mut c_void;
pub fn CRYPTO_free(buf: *mut c_void, file: *const c_char, line: c_int);
}
} else {
extern "C" {
pub fn CRYPTO_malloc(num: c_int, file: *const c_char, line: c_int) -> *mut c_void;
pub fn CRYPTO_free(buf: *mut c_void);
}
}
extern "C" {
pub fn OPENSSL_malloc(num: size_t) -> *mut c_void;
pub fn OPENSSL_free(buf: *mut c_void);
}

extern "C" {
Expand Down
7 changes: 0 additions & 7 deletions openssl-sys/src/dh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ extern "C" {
pub fn d2i_DHparams(k: *mut *mut DH, pp: *mut *const c_uchar, length: c_long) -> *mut DH;
pub fn i2d_DHparams(dh: *const DH, pp: *mut *mut c_uchar) -> c_int;

#[cfg(ossl102)]
pub fn DH_get_1024_160() -> *mut DH;
#[cfg(ossl102)]
pub fn DH_get_2048_224() -> *mut DH;
#[cfg(ossl102)]
pub fn DH_get_2048_256() -> *mut DH;

#[cfg(any(ossl110, libressl273))]
pub fn DH_set0_pqg(dh: *mut DH, p: *mut BIGNUM, q: *mut BIGNUM, g: *mut BIGNUM) -> c_int;
}
16 changes: 9 additions & 7 deletions openssl-sys/src/dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,31 @@ extern "C" {
pub fn DSA_sign(
dummy: c_int,
dgst: *const c_uchar,
len: c_int,
len: size_t,
sigret: *mut c_uchar,
siglen: *mut c_uint,
dsa: *mut DSA,
dsa: *const DSA,
) -> c_int;
pub fn DSA_verify(
dummy: c_int,
dgst: *const c_uchar,
len: c_int,
len: size_t,
sigbuf: *const c_uchar,
siglen: c_int,
dsa: *mut DSA,
siglen: size_t,
dsa: *const DSA,
) -> c_int;

pub fn d2i_DSAPublicKey(a: *mut *mut DSA, pp: *mut *const c_uchar, length: c_long) -> *mut DSA;
pub fn d2i_DSAPrivateKey(a: *mut *mut DSA, pp: *mut *const c_uchar, length: c_long)
-> *mut DSA;

// int (struct dsa_st *, unsigned int, const unsigned char *, unsigned long, int *, unsigned long *, struct bn_gencb_st *)
// int (struct dsa_st *, int, const unsigned char *, int, int *, unsigned long *, struct bn_gencb_st *)
pub fn DSA_generate_parameters_ex(
dsa: *mut DSA,
bits: c_int,
bits: c_uint,
seed: *const c_uchar,
seed_len: c_int,
seed_len: size_t,
counter_ref: *mut c_int,
h_ret: *mut c_ulong,
cb: *mut BN_GENCB,
Expand Down
3 changes: 0 additions & 3 deletions openssl-sys/src/dtls1.rs

This file was deleted.

Loading

0 comments on commit a6f5bee

Please sign in to comment.