From 11f272143d4bb7797823a09e78b7dc5894dbadc7 Mon Sep 17 00:00:00 2001 From: Markus Theil Date: Thu, 12 Oct 2023 16:57:23 +0200 Subject: [PATCH] more type fiddling Signed-off-by: Markus Theil --- openssl/src/x509/sbgp.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/openssl/src/x509/sbgp.rs b/openssl/src/x509/sbgp.rs index ff0cedce1f..3c9615e79b 100644 --- a/openssl/src/x509/sbgp.rs +++ b/openssl/src/x509/sbgp.rs @@ -63,7 +63,11 @@ impl ASIdentifiers { if (*asnum).type_ != ASIdentifierChoice_asIdsOrRanges { return None; } - if let Some(s) = StackRef::::from_const_ptr_opt((*asnum).u.asIdsOrRanges) { + #[cfg(ossl320)] + let asRange = StackRef::::from_const_ptr_opt((*asnum).u.asIdsOrRanges); + #[cfg(not(ossl320))] + let as_range = StackRef::::from_const_ptr_opt((*asnum).asIdsOrRanges); + if let Some(s) = as_range { for a_ptr in s { let a = a_ptr.as_ptr(); if (*a).type_ == ASIdOrRange_id { @@ -133,7 +137,7 @@ impl IPAddressFamily { pub fn fam(&self) -> Option { let ptr = self.0; unsafe { - match X509v3_addr_get_afi(ptr) { + match X509v3_addr_get_afi(ptr) as libc::c_int { IANA_AFI_IPV4 => Some(IPVersion::V4), IANA_AFI_IPV6 => Some(IPVersion::V6), _ => None, @@ -149,8 +153,12 @@ impl IPAddressFamily { if (*choice).type_ != IPAddressChoice_addressesOrRanges { return None; } + #[cfg(ossl320)] let stack = StackRef::::from_const_ptr_opt((*choice).u.addressesOrRanges)?; + #[cfg(not(ossl320))] + let stack = + StackRef::::from_const_ptr_opt((*choice).addressesOrRanges)?; for e in stack { let mut min = MaybeUninit::<[u8; 16]>::uninit(); let mut max = MaybeUninit::<[u8; 16]>::uninit();