Commit 34755f8a authored by Steven Fackler's avatar Steven Fackler
Browse files

ASN1_TIME_from_string_x509 was added in 1.1.1

parent 691ce7ca
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
}

+4 −0
Original line number Diff line number Diff line
@@ -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<Asn1Time, ErrorStack> {
        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();
    }
}