diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2008-10-08 00:55:27 +0200 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2008-10-08 00:55:27 +0200 |
commit | 87d3a0cd9006f67fed0d3335d8b1c5ab94a26f8f (patch) | |
tree | 1e3f5000326191e669df486f0a0a471aed765df6 /crypto/asn1/a_gentm.c | |
parent | Fix incorrect command for assember file generation on IA64 (diff) | |
download | openssl-87d3a0cd9006f67fed0d3335d8b1c5ab94a26f8f.tar.xz openssl-87d3a0cd9006f67fed0d3335d8b1c5ab94a26f8f.zip |
Experimental new date handling routines. These fix issues with X509_time_adj()
and should avoid any OS date limitations such as the year 2038 bug.
Diffstat (limited to 'crypto/asn1/a_gentm.c')
-rw-r--r-- | crypto/asn1/a_gentm.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c index 9a9caafe8f..c732733045 100644 --- a/crypto/asn1/a_gentm.c +++ b/crypto/asn1/a_gentm.c @@ -211,6 +211,12 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, time_t t) { + return ASN1_GENERALIZEDTIME_adj(s, t, 0, 0); + } + +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, + time_t t, int offset_day, long offset_sec) + { char *p; struct tm *ts; struct tm data; @@ -225,6 +231,12 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, if (ts == NULL) return(NULL); + if (offset_day || offset_sec) + { + if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) + return NULL; + } + p=(char *)s->data; if ((p == NULL) || ((size_t)s->length < len)) { |