Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ jobs:
library:
name: libressl
version: 4.1.0
- target: x86_64-unknown-linux-gnu
bindgen: false
library:
name: openssl-no-deprecated
version: 3.5.0
name: ${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }}-${{ matrix.bindgen }}
runs-on: ubuntu-22.04
env:
Expand Down Expand Up @@ -273,7 +278,7 @@ jobs:
- name: Build OpenSSL
run: |
case "${{ matrix.library.name }}" in
"openssl")
"openssl"*)
if [[ "${{ matrix.library.old }}" == "true" ]]; then
url="https://www.openssl.org/source${{ matrix.library.dl-path }}/openssl-${{ matrix.library.version }}.tar.gz"
else
Expand Down Expand Up @@ -327,6 +332,11 @@ jobs:
make
make install_sw
;;
"openssl-no-deprecated")
./Configure --prefix=$OPENSSL_DIR --libdir=lib $OS_COMPILER -fPIC -g $OS_FLAGS --api=3.0 no-deprecated no-shared
make
make install_sw
;;
"libressl")
./configure --prefix=$OPENSSL_DIR --disable-shared --with-pic
make
Expand Down Expand Up @@ -401,6 +411,7 @@ jobs:
cargo run --manifest-path=systest/Cargo.toml --target ${{ matrix.target }} $features
if: ${{ !(matrix.library.name == 'boringssl' || matrix.library.name == 'aws-lc') }}
- name: Test openssl
if: ${{ ! endsWith(matrix.library.name, 'no-deprecated') }}
run: |
if [[ "${{ matrix.library.name }}" == "boringssl" && "${{ matrix.bindgen }}" != "true" ]]; then
features="--features unstable_boringssl"
Expand All @@ -426,4 +437,4 @@ jobs:
features="$features --features openssl-sys/bindgen"
fi
cargo test --manifest-path=openssl-errors/Cargo.toml --target ${{ matrix.target }} $features
if: ${{ !(matrix.library.name == 'boringssl' || matrix.library.name == 'aws-lc') }}
if: ${{ !(matrix.library.name == 'boringssl' || matrix.library.name == 'aws-lc' || endsWith(matrix.library.name, 'no-deprecated')) }}
3 changes: 3 additions & 0 deletions openssl-sys/src/aes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use libc::*;

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
pub const AES_ENCRYPT: c_int = 1;
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
pub const AES_DECRYPT: c_int = 0;

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
pub const AES_MAXNR: c_int = 14;
pub const AES_BLOCK_SIZE: c_int = 16;
1 change: 1 addition & 0 deletions openssl-sys/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ cfg_if! {
}
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
pub const CRYPTO_LOCK: c_int = 1;
4 changes: 2 additions & 2 deletions openssl-sys/src/dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cfg_if! {
ptr::null_mut(),
)
}

pub const EVP_PKEY_CTRL_DSA_PARAMGEN_BITS: c_int = EVP_PKEY_ALG_CTRL + 1;
}
}

pub const EVP_PKEY_CTRL_DSA_PARAMGEN_BITS: c_int = EVP_PKEY_ALG_CTRL + 1;
4 changes: 4 additions & 0 deletions openssl-sys/src/evp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,18 +335,22 @@ pub unsafe fn EVP_PKEY_CTX_set_signature_md(cxt: *mut EVP_PKEY_CTX, md: *mut EVP
)
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
pub unsafe fn EVP_PKEY_assign_RSA(pkey: *mut EVP_PKEY, rsa: *mut RSA) -> c_int {
EVP_PKEY_assign(pkey, EVP_PKEY_RSA, rsa as *mut c_void)
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
pub unsafe fn EVP_PKEY_assign_DSA(pkey: *mut EVP_PKEY, dsa: *mut DSA) -> c_int {
EVP_PKEY_assign(pkey, EVP_PKEY_DSA, dsa as *mut c_void)
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
pub unsafe fn EVP_PKEY_assign_DH(pkey: *mut EVP_PKEY, dh: *mut DH) -> c_int {
EVP_PKEY_assign(pkey, EVP_PKEY_DH, dh as *mut c_void)
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
pub unsafe fn EVP_PKEY_assign_EC_KEY(pkey: *mut EVP_PKEY, ec_key: *mut EC_KEY) -> c_int {
EVP_PKEY_assign(pkey, EVP_PKEY_EC, ec_key as *mut c_void)
}
2 changes: 2 additions & 0 deletions openssl-sys/src/handwritten/aes.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use super::super::*;
use libc::*;

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
#[repr(C)]
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,
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
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;
Expand Down
1 change: 1 addition & 0 deletions openssl-sys/src/handwritten/cmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use libc::*;

use super::super::*;

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
extern "C" {
pub fn CMAC_CTX_new() -> *mut CMAC_CTX;
pub fn CMAC_CTX_free(ctx: *mut CMAC_CTX);
Expand Down
1 change: 1 addition & 0 deletions openssl-sys/src/handwritten/dh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extern "C" {
pub fn EVP_PKEY_CTX_set_dh_paramgen_generator(ctx: *mut EVP_PKEY_CTX, gen: c_int) -> c_int;
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
extern "C" {
pub fn DH_new() -> *mut DH;
pub fn DH_free(dh: *mut DH);
Expand Down
4 changes: 4 additions & 0 deletions openssl-sys/src/handwritten/dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cfg_if! {
}
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
extern "C" {
pub fn DSA_new() -> *mut DSA;
pub fn DSA_free(dsa: *mut DSA);
Expand Down Expand Up @@ -72,6 +73,9 @@ extern "C" {
pub fn DSA_get0_key(d: *const DSA, pub_key: *mut *const BIGNUM, priv_key: *mut *const BIGNUM);
#[cfg(any(ossl110, libressl273))]
pub fn DSA_set0_key(d: *mut DSA, pub_key: *mut BIGNUM, priv_key: *mut BIGNUM) -> c_int;
}

extern "C" {
pub fn d2i_DSA_SIG(
sig: *mut *mut DSA_SIG,
pp: *mut *const c_uchar,
Expand Down
116 changes: 61 additions & 55 deletions openssl-sys/src/handwritten/ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ pub enum point_conversion_form_t {
POINT_CONVERSION_HYBRID = 6,
}

#[cfg(not(libressl410))]
#[cfg(not(any(libressl410, osslconf = "OPENSSL_NO_DEPRECATED_3_0")))]
pub enum EC_METHOD {}
pub enum EC_GROUP {}
pub enum EC_POINT {}

extern "C" {
#[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
pub fn EC_GF2m_simple_method() -> *const EC_METHOD;

#[cfg(not(libressl410))]
#[cfg(not(any(libressl410, osslconf = "OPENSSL_NO_DEPRECATED_3_0")))]
pub fn EC_GROUP_new(meth: *const EC_METHOD) -> *mut EC_GROUP;

pub fn EC_GROUP_dup(group: *const EC_GROUP) -> *mut EC_GROUP;
Expand Down Expand Up @@ -57,23 +54,6 @@ extern "C" {

pub fn EC_GROUP_get_asn1_flag(group: *const EC_GROUP) -> c_int;

pub fn EC_GROUP_get_curve_GFp(
group: *const EC_GROUP,
p: *mut BIGNUM,
a: *mut BIGNUM,
b: *mut BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;

#[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
pub fn EC_GROUP_get_curve_GF2m(
group: *const EC_GROUP,
p: *mut BIGNUM,
a: *mut BIGNUM,
b: *mut BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;

pub fn EC_GROUP_get_degree(group: *const EC_GROUP) -> c_int;

#[cfg(ossl110)]
Expand Down Expand Up @@ -127,31 +107,6 @@ extern "C" {
ctx: *mut BN_CTX,
) -> c_int;

pub fn EC_POINT_get_affine_coordinates_GFp(
group: *const EC_GROUP,
p: *const EC_POINT,
x: *mut BIGNUM,
y: *mut BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;

pub fn EC_POINT_set_affine_coordinates_GFp(
group: *const EC_GROUP,
p: *mut EC_POINT,
x: *const BIGNUM,
y: *const BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;

#[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
pub fn EC_POINT_get_affine_coordinates_GF2m(
group: *const EC_GROUP,
p: *const EC_POINT,
x: *mut BIGNUM,
y: *mut BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;

pub fn EC_POINT_point2oct(
group: *const EC_GROUP,
p: *const EC_POINT,
Expand Down Expand Up @@ -208,6 +163,54 @@ extern "C" {
m: *const BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
extern "C" {
#[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
pub fn EC_GF2m_simple_method() -> *const EC_METHOD;

pub fn EC_GROUP_get_curve_GFp(
group: *const EC_GROUP,
p: *mut BIGNUM,
a: *mut BIGNUM,
b: *mut BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;

#[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
pub fn EC_GROUP_get_curve_GF2m(
group: *const EC_GROUP,
p: *mut BIGNUM,
a: *mut BIGNUM,
b: *mut BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;

pub fn EC_POINT_get_affine_coordinates_GFp(
group: *const EC_GROUP,
p: *const EC_POINT,
x: *mut BIGNUM,
y: *mut BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;

pub fn EC_POINT_set_affine_coordinates_GFp(
group: *const EC_GROUP,
p: *mut EC_POINT,
x: *const BIGNUM,
y: *const BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;

#[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
pub fn EC_POINT_get_affine_coordinates_GF2m(
group: *const EC_GROUP,
p: *const EC_POINT,
x: *mut BIGNUM,
y: *mut BIGNUM,
ctx: *mut BN_CTX,
) -> c_int;

pub fn EC_KEY_new() -> *mut EC_KEY;

Expand Down Expand Up @@ -265,6 +268,17 @@ extern "C" {
#[cfg(any(ossl110, libressl273))]
pub fn ECDSA_SIG_set0(sig: *mut ECDSA_SIG, pr: *mut BIGNUM, ps: *mut BIGNUM) -> c_int;

pub fn d2i_ECDSA_SIG(
sig: *mut *mut ECDSA_SIG,
inp: *mut *const c_uchar,
length: c_long,
) -> *mut ECDSA_SIG;

pub fn i2d_ECDSA_SIG(sig: *const ECDSA_SIG, out: *mut *mut c_uchar) -> c_int;
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
extern "C" {
pub fn ECDSA_do_sign(
dgst: *const c_uchar,
dgst_len: c_int,
Expand All @@ -277,12 +291,4 @@ extern "C" {
sig: *const ECDSA_SIG,
eckey: *mut EC_KEY,
) -> c_int;

pub fn d2i_ECDSA_SIG(
sig: *mut *mut ECDSA_SIG,
inp: *mut *const c_uchar,
length: c_long,
) -> *mut ECDSA_SIG;

pub fn i2d_ECDSA_SIG(sig: *const ECDSA_SIG, out: *mut *mut c_uchar) -> c_int;
}
18 changes: 11 additions & 7 deletions openssl-sys/src/handwritten/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,9 @@ extern "C" {
data: *mut *const c_char,
flags: *mut c_int,
) -> c_ulong;
pub fn ERR_get_error_line_data(
file: *mut *const c_char,
line: *mut c_int,
data: *mut *const c_char,
flags: *mut c_int,
) -> c_ulong;
pub fn ERR_peek_last_error() -> c_ulong;
pub fn ERR_clear_error();
pub fn ERR_lib_error_string(err: c_ulong) -> *const c_char;
pub fn ERR_func_error_string(err: c_ulong) -> *const c_char;
pub fn ERR_reason_error_string(err: c_ulong) -> *const c_char;
#[cfg(ossl110)]
pub fn ERR_load_strings(lib: c_int, str: *mut ERR_STRING_DATA) -> c_int;
Expand All @@ -53,3 +46,14 @@ extern "C" {

pub fn ERR_get_next_error_library() -> c_int;
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
extern "C" {
pub fn ERR_get_error_line_data(
file: *mut *const c_char,
line: *mut c_int,
data: *mut *const c_char,
flags: *mut c_int,
) -> c_ulong;
pub fn ERR_func_error_string(err: c_ulong) -> *const c_char;
}
8 changes: 6 additions & 2 deletions openssl-sys/src/handwritten/evp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ cfg_if! {
}
}
}
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
const_ptr_api! {
extern "C" {
pub fn EVP_PKEY_get1_RSA(k: #[const_ptr_if(libressl420)] EVP_PKEY) -> *mut RSA;
Expand All @@ -480,6 +481,7 @@ const_ptr_api! {
pub fn EVP_PKEY_get1_EC_KEY(k: #[const_ptr_if(libressl420)] EVP_PKEY) -> *mut EC_KEY;
}
}
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
extern "C" {
pub fn EVP_PKEY_assign(pkey: *mut EVP_PKEY, typ: c_int, key: *mut c_void) -> c_int;

Expand All @@ -488,6 +490,10 @@ extern "C" {
pub fn EVP_PKEY_set1_DH(k: *mut EVP_PKEY, k: *mut DH) -> c_int;
pub fn EVP_PKEY_set1_EC_KEY(k: *mut EVP_PKEY, k: *mut EC_KEY) -> c_int;

pub fn EVP_PKEY_cmp(a: *const EVP_PKEY, b: *const EVP_PKEY) -> c_int;
}

extern "C" {
pub fn EVP_PKEY_new() -> *mut EVP_PKEY;
pub fn EVP_PKEY_free(k: *mut EVP_PKEY);
#[cfg(any(ossl110, libressl270))]
Expand Down Expand Up @@ -520,8 +526,6 @@ extern "C" {
length: c_long,
) -> *mut EVP_PKEY;

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
pub fn EVP_PKEY_cmp(a: *const EVP_PKEY, b: *const EVP_PKEY) -> c_int;
#[cfg(ossl300)]
pub fn EVP_PKEY_eq(a: *const EVP_PKEY, b: *const EVP_PKEY) -> c_int;
#[cfg(ossl300)]
Expand Down
2 changes: 2 additions & 0 deletions openssl-sys/src/handwritten/hmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use libc::*;

use super::super::*;

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
cfg_if! {
if #[cfg(any(ossl110, libressl350))] {
extern "C" {
Expand All @@ -16,6 +17,7 @@ cfg_if! {
}
}

#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
extern "C" {
pub fn HMAC_Init_ex(
ctx: *mut HMAC_CTX,
Expand Down
Loading