diff options
Diffstat (limited to 'ext/openssl/ossl_x509.c')
-rw-r--r-- | ext/openssl/ossl_x509.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/openssl/ossl_x509.c b/ext/openssl/ossl_x509.c index cf62b53e28..14f794e8ee 100644 --- a/ext/openssl/ossl_x509.c +++ b/ext/openssl/ossl_x509.c @@ -15,6 +15,22 @@ VALUE mX509; #define DefX509Default(x,i) \ rb_define_const(mX509, "DEFAULT_" #x, rb_str_new2(X509_get_default_##i())) +ASN1_TIME * +ossl_x509_time_adjust(ASN1_TIME *s, VALUE time) +{ + time_t sec; + +#if defined(HAVE_ASN1_TIME_ADJ) + int off_days; + + ossl_time_split(time, &sec, &off_days); + return X509_time_adj_ex(s, off_days, 0, &sec); +#else + sec = time_to_time_t(time); + return X509_time_adj(s, 0, &sec); +#endif +} + void Init_ossl_x509(void) { |