Skip to content

Commit d759114

Browse files
committed
mark supported OpenSSL version range
Signed-off-by: Markus Theil <[email protected]>
1 parent cc555a8 commit d759114

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

openssl/src/x509/sbgp.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
use std::mem::MaybeUninit;
22

3+
#[cfg(ossl110)]
34
use ffi::{
45
ASIdOrRange_id, ASIdOrRange_range, ASIdentifierChoice_asIdsOrRanges,
56
ASIdentifierChoice_inherit, IPAddressChoice_addressesOrRanges, X509v3_addr_get_afi,
67
X509v3_addr_get_range, ASN1_INTEGER, IANA_AFI_IPV4, IANA_AFI_IPV6,
78
};
9+
#[cfg(ossl110)]
810
use foreign_types::{ForeignType, ForeignTypeRef};
911

12+
#[cfg(ossl110)]
1013
use crate::{
1114
asn1::Asn1IntegerRef,
1215
stack::{Stack, StackRef, Stackable},
1316
util::{ForeignTypeExt, ForeignTypeRefExt},
1417
};
1518

19+
#[cfg(ossl110)]
1620
use super::X509;
1721

22+
#[cfg(ossl110)]
1823
foreign_type_and_impl_send_sync! {
1924
type CType = ffi::ASIdOrRange;
2025
fn drop = ffi::ASIdOrRange_free;
@@ -24,11 +29,12 @@ foreign_type_and_impl_send_sync! {
2429
/// Reference to `ASIdOrRange`.
2530
pub struct ASIdOrRangeRef;
2631
}
27-
32+
#[cfg(ossl110)]
2833
impl Stackable for ASIdOrRange {
2934
type StackType = ffi::stack_st_ASIdOrRange;
3035
}
3136

37+
#[cfg(ossl110)]
3238
foreign_type_and_impl_send_sync! {
3339
type CType = ffi::ASIdentifiers;
3440
fn drop = ffi::ASIdentifiers_free;
@@ -39,6 +45,7 @@ foreign_type_and_impl_send_sync! {
3945
pub struct ASIdentifiersRef;
4046
}
4147

48+
#[cfg(ossl110)]
4249
impl ASIdentifiers {
4350
pub fn inherited(&self) -> bool {
4451
unsafe {
@@ -109,16 +116,19 @@ foreign_type_and_impl_send_sync! {
109116
pub struct IPAddressFamilyRef;
110117
}
111118

119+
#[cfg(ossl110)]
112120
impl Stackable for IPAddressFamily {
113121
type StackType = ffi::stack_st_IPAddressFamily;
114122
}
115123

116124
#[derive(PartialEq, Eq, Debug)]
125+
#[cfg(ossl110)]
117126
pub enum IPVersion {
118127
V4,
119128
V6,
120129
}
121130

131+
#[cfg(ossl110)]
122132
impl IPAddressFamily {
123133
pub fn fam(&self) -> Option<IPVersion> {
124134
let ptr = self.0;
@@ -180,11 +190,13 @@ impl IPAddressFamily {
180190
}
181191
}
182192

193+
#[cfg(ossl110)]
183194
pub trait ExtractSBGPInfo {
184195
fn asn(&self) -> Option<ASIdentifiers>;
185196
fn ip_addresses(&self) -> Option<Stack<IPAddressFamily>>;
186197
}
187198

199+
#[cfg(ossl110)]
188200
impl ExtractSBGPInfo for X509 {
189201
fn asn(&self) -> Option<ASIdentifiers> {
190202
unsafe {

openssl/src/x509/tests.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::cmp::Ordering;
2+
#[cfg(ossl110)]
23
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
4+
#[cfg(ossl110)]
35
use std::str::FromStr;
46

57
use crate::asn1::{Asn1Object, Asn1OctetString, Asn1Time};
@@ -12,9 +14,14 @@ use crate::rsa::Rsa;
1214
use crate::ssl::SslFiletype;
1315
use crate::stack::Stack;
1416
use crate::x509::extension::{
15-
AuthorityKeyIdentifier, BasicConstraints, ExtendedKeyUsage, KeyUsage, SbgpAsIdentifier,
16-
SbgpIpAddressIdentifier, SubjectAlternativeName, SubjectKeyIdentifier,
17+
AuthorityKeyIdentifier, BasicConstraints, ExtendedKeyUsage, KeyUsage,
18+
SubjectAlternativeName, SubjectKeyIdentifier,
19+
};
20+
#[cfg(ossl110)]
21+
use crate::x509::extension::{
22+
SbgpAsIdentifier, SbgpIpAddressIdentifier,
1723
};
24+
#[cfg(ossl110)]
1825
use crate::x509::sbgp::ExtractSBGPInfo;
1926
#[cfg(not(boringssl))]
2027
use crate::x509::store::X509Lookup;
@@ -1182,6 +1189,7 @@ fn test_dist_point_null() {
11821189
}
11831190

11841191
#[test]
1192+
#[cfg(ossl110)]
11851193
fn test_sbgp_extensions_parsing() {
11861194
let cert = include_bytes!("../../test/rfc3779.pem");
11871195
let cert = X509::from_pem(cert).unwrap();
@@ -1210,6 +1218,7 @@ fn test_sbgp_extensions_parsing() {
12101218
}
12111219

12121220
#[test]
1221+
#[cfg(ossl110)]
12131222
fn test_sbgp_extensions_builder() {
12141223
let mut builder = X509Builder::new().unwrap();
12151224
let asn_ext = SbgpAsIdentifier::new()

0 commit comments

Comments
 (0)