Skip to content

Commit

Permalink
fixed X509V3_asid_subset, no longer available in 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrichorIT committed Jan 31, 2024
1 parent 8f32bb9 commit 6cc634c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions openssl/src/x509/sbgp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ impl ASIdentifiers {

/// Determines whether the contents of the AS number extension are contained
/// in the parent AS number extension.
///
/// This function is only available as of version 1.1.1, since it
/// implementation in version 1.1.0 is faulty.
#[cfg(ossl111)]
#[corresponds(X509v3_asid_subset)]
pub fn subset_of(&self, parent: &ASIdentifiers) -> bool {
unsafe {
Expand Down
10 changes: 7 additions & 3 deletions openssl/src/x509/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1195,11 +1195,15 @@ fn test_sbgp_extensions_parsing() {
let parent_cert = X509::from_pem(parent_cert_bytes).unwrap();

let asn = cert.sbgp_asn().unwrap();
let pasn = parent_cert.sbgp_asn().unwrap();
assert!(!asn.inherited());
assert!(asn.is_canonical());
assert!(asn.subset_of(&pasn));
assert!(!pasn.subset_of(&asn));

#[cfg(ossl111)]
{
let pasn = parent_cert.sbgp_asn().unwrap();
assert!(asn.subset_of(&pasn));
assert!(!pasn.subset_of(&asn));
}

let asn_ranges = asn.ranges().unwrap();
assert_eq!(asn_ranges[0], (10, 18));
Expand Down

0 comments on commit 6cc634c

Please sign in to comment.