aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_x509.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl/ossl_x509.c')
-rw-r--r--ext/openssl/ossl_x509.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/openssl/ossl_x509.c b/ext/openssl/ossl_x509.c
index cf62b53e28..e9a60b7f0a 100644
--- a/ext/openssl/ossl_x509.c
+++ b/ext/openssl/ossl_x509.c
@@ -15,6 +15,21 @@ 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_extract(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)
{