summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_gentm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_gentm.c')
-rw-r--r--src/lib/libcrypto/asn1/a_gentm.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c
index c79c6f538c..def79062a5 100644
--- a/src/lib/libcrypto/asn1/a_gentm.c
+++ b/src/lib/libcrypto/asn1/a_gentm.c
@@ -117,8 +117,8 @@ err:
117 117
118int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) 118int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
119 { 119 {
120 static const int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0}; 120 static int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
121 static const int max[9]={99, 99,12,31,23,59,59,12,59}; 121 static int max[9]={99, 99,12,31,23,59,59,12,59};
122 char *a; 122 char *a;
123 int n,i,l,o; 123 int n,i,l,o;
124 124
@@ -176,11 +176,6 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
176 o++; 176 o++;
177 } 177 }
178 } 178 }
179 else
180 {
181 /* Missing time zone information. */
182 goto err;
183 }
184 return(o == l); 179 return(o == l);
185err: 180err:
186 return(0); 181 return(0);
@@ -211,12 +206,6 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str)
211ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, 206ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
212 time_t t) 207 time_t t)
213 { 208 {
214 return ASN1_GENERALIZEDTIME_adj(s, t, 0, 0);
215 }
216
217ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
218 time_t t, int offset_day, long offset_sec)
219 {
220 char *p; 209 char *p;
221 struct tm *ts; 210 struct tm *ts;
222 struct tm data; 211 struct tm data;
@@ -231,19 +220,13 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
231 if (ts == NULL) 220 if (ts == NULL)
232 return(NULL); 221 return(NULL);
233 222
234 if (offset_day || offset_sec)
235 {
236 if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
237 return NULL;
238 }
239
240 p=(char *)s->data; 223 p=(char *)s->data;
241 if ((p == NULL) || ((size_t)s->length < len)) 224 if ((p == NULL) || ((size_t)s->length < len))
242 { 225 {
243 p=OPENSSL_malloc(len); 226 p=OPENSSL_malloc(len);
244 if (p == NULL) 227 if (p == NULL)
245 { 228 {
246 ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ, 229 ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_SET,
247 ERR_R_MALLOC_FAILURE); 230 ERR_R_MALLOC_FAILURE);
248 return(NULL); 231 return(NULL);
249 } 232 }