summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_utctm.c
diff options
context:
space:
mode:
authordjm <>2010-10-01 22:59:01 +0000
committerdjm <>2010-10-01 22:59:01 +0000
commitfe047d8b632246cb2db3234a0a4f32e5c318857b (patch)
tree939b752540947d33507b3acc48d76a8bfb7c3dc3 /src/lib/libcrypto/asn1/a_utctm.c
parent2ea67f4aa254b09ded62e6e14fc893bbe6381579 (diff)
downloadopenbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.gz
openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.tar.bz2
openbsd-fe047d8b632246cb2db3234a0a4f32e5c318857b.zip
resolve conflicts, fix local changes
Diffstat (limited to 'src/lib/libcrypto/asn1/a_utctm.c')
-rw-r--r--src/lib/libcrypto/asn1/a_utctm.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c
index d31c028193..072e236592 100644
--- a/src/lib/libcrypto/asn1/a_utctm.c
+++ b/src/lib/libcrypto/asn1/a_utctm.c
@@ -114,8 +114,8 @@ err:
114 114
115int ASN1_UTCTIME_check(ASN1_UTCTIME *d) 115int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
116 { 116 {
117 static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0}; 117 static const int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
118 static int max[8]={99,12,31,23,59,59,12,59}; 118 static const int max[8]={99,12,31,23,59,59,12,59};
119 char *a; 119 char *a;
120 int n,i,l,o; 120 int n,i,l,o;
121 121
@@ -186,6 +186,12 @@ int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str)
186 186
187ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) 187ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
188 { 188 {
189 return ASN1_UTCTIME_adj(s, t, 0, 0);
190 }
191
192ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
193 int offset_day, long offset_sec)
194 {
189 char *p; 195 char *p;
190 struct tm *ts; 196 struct tm *ts;
191 struct tm data; 197 struct tm data;
@@ -200,13 +206,22 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
200 if (ts == NULL) 206 if (ts == NULL)
201 return(NULL); 207 return(NULL);
202 208
209 if (offset_day || offset_sec)
210 {
211 if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
212 return NULL;
213 }
214
215 if((ts->tm_year < 50) || (ts->tm_year >= 150))
216 return NULL;
217
203 p=(char *)s->data; 218 p=(char *)s->data;
204 if ((p == NULL) || ((size_t)s->length < len)) 219 if ((p == NULL) || ((size_t)s->length < len))
205 { 220 {
206 p=OPENSSL_malloc(len); 221 p=OPENSSL_malloc(len);
207 if (p == NULL) 222 if (p == NULL)
208 { 223 {
209 ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE); 224 ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE);
210 return(NULL); 225 return(NULL);
211 } 226 }
212 if (s->data != NULL) 227 if (s->data != NULL)