diff --git a/openssl-sys/src/asn1.rs b/openssl-sys/src/asn1.rs index e86528f6..042b3eca 100644 --- a/openssl-sys/src/asn1.rs +++ b/openssl-sys/src/asn1.rs @@ -49,6 +49,7 @@ extern "C" { pub fn ASN1_INTEGER_to_BN(ai: *const ASN1_INTEGER, bn: *mut BIGNUM) -> *mut BIGNUM; pub fn ASN1_TIME_set_string(s: *mut ASN1_TIME, str: *const c_char) -> c_int; + #[cfg(ossl111)] pub fn ASN1_TIME_set_string_X509(s: *mut ASN1_TIME, str: *const c_char) -> c_int; } diff --git a/openssl/src/asn1.rs b/openssl/src/asn1.rs index 5cbeeb0d..911f3462 100644 --- a/openssl/src/asn1.rs +++ b/openssl/src/asn1.rs @@ -149,7 +149,10 @@ impl Asn1Time { /// /// This corresponds to [`ASN1_TIME_set_string_X509`]. /// + /// Requires OpenSSL 1.1.1 or newer. + /// /// [`ASN1_TIME_set_string`]: https://www.openssl.org/docs/manmaster/man3/ASN1_TIME_set_string.html + #[cfg(ossl111)] pub fn from_str_x509(s: &str) -> Result { unsafe { let s = CString::new(s).unwrap(); @@ -385,6 +388,7 @@ mod tests { #[test] fn time_from_str() { Asn1Time::from_str("99991231235959Z").unwrap(); + #[cfg(ossl111)] Asn1Time::from_str_x509("99991231235959Z").unwrap(); } }