Skip to content

Commit

Permalink
Merge pull request #1909 from oskirby/bionic-openssl-linker-fix
Browse files Browse the repository at this point in the history
Fix link errors for X509_get0_authority_xxx methods on Ubuntu/bionic
  • Loading branch information
sfackler committed Apr 26, 2023
2 parents 03abc17 + cd3803e commit b64d4f4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions openssl-sys/build/cfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<&
if openssl_version >= 0x1_01_01_03_0 {
cfgs.push("ossl111c");
}
if openssl_version >= 0x1_01_01_04_0 {
cfgs.push("ossl111d");
}
}

cfgs
Expand Down
8 changes: 6 additions & 2 deletions openssl-sys/src/handwritten/ssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,9 +905,13 @@ extern "C" {
#[cfg(ossl111)]
pub fn SSL_set_num_tickets(s: *mut SSL, num_tickets: size_t) -> c_int;

#[cfg(ossl111)]
#[cfg(ossl111b)]
pub fn SSL_CTX_get_num_tickets(ctx: *const SSL_CTX) -> size_t;
#[cfg(all(ossl111, not(ossl111b)))]
pub fn SSL_CTX_get_num_tickets(ctx: *mut SSL_CTX) -> size_t;

#[cfg(ossl111)]
#[cfg(ossl111b)]
pub fn SSL_get_num_tickets(s: *const SSL) -> size_t;
#[cfg(all(ossl111, not(ossl111b)))]
pub fn SSL_get_num_tickets(s: *mut SSL) -> size_t;
}
4 changes: 2 additions & 2 deletions openssl-sys/src/handwritten/x509v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ extern "C" {
pub fn X509_get0_subject_key_id(x: *mut X509) -> *const ASN1_OCTET_STRING;
#[cfg(ossl110)]
pub fn X509_get0_authority_key_id(x: *mut X509) -> *const ASN1_OCTET_STRING;
#[cfg(ossl111)]
#[cfg(ossl111d)]
pub fn X509_get0_authority_issuer(x: *mut X509) -> *const stack_st_GENERAL_NAME;
#[cfg(ossl111)]
#[cfg(ossl111d)]
pub fn X509_get0_authority_serial(x: *mut X509) -> *const ASN1_INTEGER;
}

Expand Down
4 changes: 2 additions & 2 deletions openssl/src/x509/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ impl X509Ref {

/// Returns this certificate's authority issuer name entries, if they exist.
#[corresponds(X509_get0_authority_issuer)]
#[cfg(ossl111)]
#[cfg(ossl111d)]
pub fn authority_issuer(&self) -> Option<&StackRef<GeneralName>> {
unsafe {
let stack = ffi::X509_get0_authority_issuer(self.as_ptr());
Expand All @@ -515,7 +515,7 @@ impl X509Ref {

/// Returns this certificate's authority serial number, if it exists.
#[corresponds(X509_get0_authority_serial)]
#[cfg(ossl111)]
#[cfg(ossl111d)]
pub fn authority_serial(&self) -> Option<&Asn1IntegerRef> {
unsafe {
let r = ffi::X509_get0_authority_serial(self.as_ptr());
Expand Down
2 changes: 1 addition & 1 deletion openssl/src/x509/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ fn test_authority_key_id() {
}

#[test]
#[cfg(ossl111)]
#[cfg(ossl111d)]
fn test_authority_issuer_and_serial() {
let cert = include_bytes!("../../test/authority_key_identifier.pem");
let cert = X509::from_pem(cert).unwrap();
Expand Down

0 comments on commit b64d4f4

Please sign in to comment.