Skip to content

Commit

Permalink
use const api macro
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq committed Jan 3, 2024
1 parent e06799b commit b5ac7ae
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions openssl-sys/src/handwritten/x509.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,34 +469,18 @@ extern "C" {
penclen: c_int,
) -> c_int;
}
cfg_if! {
if #[cfg(ossl300)] {
extern "C" {
pub fn i2d_X509_PUBKEY(a: *const X509_PUBKEY, out: *mut *mut c_uchar) -> c_int;
pub fn X509_PUBKEY_get0_param(
ppkalg: *mut *mut ASN1_OBJECT,
pk: *mut *const c_uchar,
ppklen: *mut c_int,
pa: *mut *mut X509_ALGOR,
pub_: *const X509_PUBKEY,
) -> c_int;
pub fn X509_PUBKEY_get(key: *const X509_PUBKEY) -> *mut EVP_PKEY;
pub fn X509_PUBKEY_get0(key: *const X509_PUBKEY) -> *mut EVP_PKEY;
}
} else {
extern "C" {
pub fn i2d_X509_PUBKEY(a: *mut X509_PUBKEY, out: *mut *mut c_uchar) -> c_int;
pub fn X509_PUBKEY_get0_param(
ppkalg: *mut *mut ASN1_OBJECT,
pk: *mut *const c_uchar,
ppklen: *mut c_int,
pa: *mut *mut X509_ALGOR,
pub_: *mut X509_PUBKEY,
) -> c_int;
pub fn X509_PUBKEY_get(key: *mut X509_PUBKEY) -> *mut EVP_PKEY;
#[cfg(ossl110)]
pub fn X509_PUBKEY_get0(key: *mut X509_PUBKEY) -> *mut EVP_PKEY;
}
const_ptr_api! {
extern "C" {
pub fn i2d_X509_PUBKEY(a: #[const_ptr_if(ossl300)] X509_PUBKEY, out: *mut *mut c_uchar) -> c_int;
pub fn X509_PUBKEY_get0_param(
ppkalg: *mut *mut ASN1_OBJECT,
pk: *mut *const c_uchar,
ppklen: *mut c_int,
pa: *mut *mut X509_ALGOR,
pub_: #[const_ptr_if(ossl300)] X509_PUBKEY,
) -> c_int;
pub fn X509_PUBKEY_get(key: #[const_ptr_if(ossl300)] X509_PUBKEY) -> *mut EVP_PKEY;
pub fn X509_PUBKEY_get0(key: #[const_ptr_if(ossl300)] X509_PUBKEY) -> *mut EVP_PKEY;
}
}

Expand Down

0 comments on commit b5ac7ae

Please sign in to comment.