Skip to content

Commit

Permalink
enable more x509 methods for boringssl
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq committed Dec 29, 2023
1 parent e114a6c commit 3350405
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions openssl/src/x509/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,15 @@ impl X509Ref {

/// Retrieves the path length extension from a certificate, if it exists.
#[corresponds(X509_get_pathlen)]
#[cfg(ossl110)]
#[cfg(any(ossl110, boringssl))]
pub fn pathlen(&self) -> Option<u32> {
let v = unsafe { ffi::X509_get_pathlen(self.as_ptr()) };
u32::try_from(v).ok()
}

/// Returns this certificate's subject key id, if it exists.
#[corresponds(X509_get0_subject_key_id)]
#[cfg(ossl110)]
#[cfg(any(ossl110, boringssl))]
pub fn subject_key_id(&self) -> Option<&Asn1OctetStringRef> {
unsafe {
let data = ffi::X509_get0_subject_key_id(self.as_ptr());
Expand All @@ -498,7 +498,7 @@ impl X509Ref {

/// Returns this certificate's authority key id, if it exists.
#[corresponds(X509_get0_authority_key_id)]
#[cfg(ossl110)]
#[cfg(any(ossl110, boringssl))]
pub fn authority_key_id(&self) -> Option<&Asn1OctetStringRef> {
unsafe {
let data = ffi::X509_get0_authority_key_id(self.as_ptr());
Expand Down
6 changes: 3 additions & 3 deletions openssl/src/x509/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ fn test_subject_alt_name() {
}

#[test]
#[cfg(ossl110)]
#[cfg(any(ossl110, boringssl))]
fn test_retrieve_pathlen() {
let cert = include_bytes!("../../test/root-ca.pem");
let cert = X509::from_pem(cert).unwrap();
Expand All @@ -188,7 +188,7 @@ fn test_retrieve_pathlen() {
}

#[test]
#[cfg(ossl110)]
#[cfg(any(ossl110, boringssl))]
fn test_subject_key_id() {
let cert = include_bytes!("../../test/certv3.pem");
let cert = X509::from_pem(cert).unwrap();
Expand All @@ -201,7 +201,7 @@ fn test_subject_key_id() {
}

#[test]
#[cfg(ossl110)]
#[cfg(any(ossl110, boringssl))]
fn test_authority_key_id() {
let cert = include_bytes!("../../test/certv3.pem");
let cert = X509::from_pem(cert).unwrap();
Expand Down

0 comments on commit 3350405

Please sign in to comment.