Skip to content

Commit 27edce9

Browse files
committed
Mark Openssl # deprecated functions
1 parent 64ba480 commit 27edce9

4 files changed

Lines changed: 15 additions & 1 deletion

File tree

openssl-sys/src/handwritten/aes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extern "C" {
1212
pub fn AES_set_encrypt_key(userKey: *const c_uchar, bits: c_int, key: *mut AES_KEY) -> c_int;
1313
pub fn AES_set_decrypt_key(userKey: *const c_uchar, bits: c_int, key: *mut AES_KEY) -> c_int;
1414

15+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
1516
pub fn AES_ige_encrypt(
1617
in_: *const c_uchar,
1718
out: *mut c_uchar,

openssl-sys/src/handwritten/bn.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ extern "C" {
77
pub fn BN_CTX_secure_new() -> *mut BN_CTX;
88
pub fn BN_CTX_free(ctx: *mut BN_CTX);
99
pub fn BN_rand(r: *mut BIGNUM, bits: c_int, top: c_int, bottom: c_int) -> c_int;
10+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
1011
pub fn BN_pseudo_rand(r: *mut BIGNUM, bits: c_int, top: c_int, bottom: c_int) -> c_int;
1112
pub fn BN_rand_range(r: *mut BIGNUM, range: *const BIGNUM) -> c_int;
13+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
1214
pub fn BN_pseudo_rand_range(r: *mut BIGNUM, range: *const BIGNUM) -> c_int;
1315
pub fn BN_new() -> *mut BIGNUM;
1416
#[cfg(ossl110)]
@@ -122,12 +124,14 @@ extern "C" {
122124
rem: *const BIGNUM,
123125
cb: *mut BN_GENCB,
124126
) -> c_int;
127+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
125128
pub fn BN_is_prime_ex(
126129
p: *const BIGNUM,
127130
checks: c_int,
128131
ctx: *mut BN_CTX,
129132
cb: *mut BN_GENCB,
130133
) -> c_int;
134+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
131135
pub fn BN_is_prime_fasttest_ex(
132136
p: *const BIGNUM,
133137
checks: c_int,

openssl/src/aes.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//! # Examples
2424
2525
#![cfg_attr(
26-
not(boringssl),
26+
all(not(boringssl), not(osslconf = "OPENSSL_NO_DEPRECATED_3_0")),
2727
doc = r#"\
2828
## AES IGE
2929
```rust
@@ -156,6 +156,7 @@ impl AesKey {
156156
/// Panics if `in_` is not the same length as `out`, if that length is not a multiple of 16, or if
157157
/// `iv` is not at least 32 bytes.
158158
#[cfg(not(boringssl))]
159+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
159160
#[corresponds(AES_ige_encrypt)]
160161
pub fn aes_ige(in_: &[u8], out: &mut [u8], key: &AesKey, iv: &mut [u8], mode: Mode) {
161162
unsafe {
@@ -268,6 +269,7 @@ mod test {
268269
// From https://www.mgp25.com/AESIGE/
269270
#[test]
270271
#[cfg(not(boringssl))]
272+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
271273
fn ige_vector_1() {
272274
let raw_key = "000102030405060708090A0B0C0D0E0F";
273275
let raw_iv = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F";

openssl/src/bn.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ impl BigNumRef {
217217
}
218218

219219
/// The cryptographically weak counterpart to `rand_in_range`.
220+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
220221
#[corresponds(BN_pseudo_rand_range)]
221222
pub fn pseudo_rand_range(&self, rnd: &mut BigNumRef) -> Result<(), ErrorStack> {
222223
unsafe { cvt(ffi::BN_pseudo_rand_range(rnd.as_ptr(), self.as_ptr())).map(|_| ()) }
@@ -385,6 +386,7 @@ impl BigNumRef {
385386
}
386387

387388
/// The cryptographically weak counterpart to `rand`. Not suitable for key generation.
389+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
388390
#[corresponds(BN_pseudo_rand)]
389391
#[allow(clippy::useless_conversion)]
390392
pub fn pseudo_rand(&mut self, bits: i32, msb: MsbOption, odd: bool) -> Result<(), ErrorStack> {
@@ -722,6 +724,7 @@ impl BigNumRef {
722724
/// # Return Value
723725
///
724726
/// Returns `true` if `self` is prime with an error probability of less than `0.25 ^ checks`.
727+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
725728
#[corresponds(BN_is_prime_ex)]
726729
#[allow(clippy::useless_conversion)]
727730
pub fn is_prime(&self, checks: i32, ctx: &mut BigNumContextRef) -> Result<bool, ErrorStack> {
@@ -745,6 +748,7 @@ impl BigNumRef {
745748
/// # Return Value
746749
///
747750
/// Returns `true` if `self` is prime with an error probability of less than `0.25 ^ checks`.
751+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
748752
#[corresponds(BN_is_prime_fasttest_ex)]
749753
#[allow(clippy::useless_conversion)]
750754
pub fn is_prime_fasttest(
@@ -1388,6 +1392,7 @@ mod tests {
13881392
assert_eq!(a, &(&a << 1) >> 1);
13891393
}
13901394

1395+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
13911396
#[test]
13921397
fn test_rand_range() {
13931398
let range = BigNum::from_u32(909_829_283).unwrap();
@@ -1396,6 +1401,7 @@ mod tests {
13961401
assert!(result >= BigNum::from_u32(0).unwrap() && result < range);
13971402
}
13981403

1404+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
13991405
#[test]
14001406
fn test_pseudo_rand_range() {
14011407
let range = BigNum::from_u32(909_829_283).unwrap();
@@ -1404,6 +1410,7 @@ mod tests {
14041410
assert!(result >= BigNum::from_u32(0).unwrap() && result < range);
14051411
}
14061412

1413+
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
14071414
#[test]
14081415
fn test_prime_numbers() {
14091416
let a = BigNum::from_u32(19_029_017).unwrap();

0 commit comments

Comments
 (0)