projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PR: 1996
[openssl.git]
/
crypto
/
asn1
/
a_utctm.c
diff --git
a/crypto/asn1/a_utctm.c
b/crypto/asn1/a_utctm.c
index 2d15ff3c14e0d78e82b794ff8395360398e17c77..072e23659233479ce32b756276276638d95466a6 100644
(file)
--- a/
crypto/asn1/a_utctm.c
+++ b/
crypto/asn1/a_utctm.c
@@
-186,6
+186,12
@@
int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str)
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
{
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
{
+ return ASN1_UTCTIME_adj(s, t, 0, 0);
+ }
+
+ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
+ int offset_day, long offset_sec)
+ {
char *p;
struct tm *ts;
struct tm data;
char *p;
struct tm *ts;
struct tm data;
@@
-200,13
+206,22
@@
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
if (ts == NULL)
return(NULL);
if (ts == NULL)
return(NULL);
+ if (offset_day || offset_sec)
+ {
+ if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
+ return NULL;
+ }
+
+ if((ts->tm_year < 50) || (ts->tm_year >= 150))
+ return NULL;
+
p=(char *)s->data;
if ((p == NULL) || ((size_t)s->length < len))
{
p=OPENSSL_malloc(len);
if (p == NULL)
{
p=(char *)s->data;
if ((p == NULL) || ((size_t)s->length < len))
{
p=OPENSSL_malloc(len);
if (p == NULL)
{
- ASN1err(ASN1_F_ASN1_UTCTIME_
SET
,ERR_R_MALLOC_FAILURE);
+ ASN1err(ASN1_F_ASN1_UTCTIME_
ADJ
,ERR_R_MALLOC_FAILURE);
return(NULL);
}
if (s->data != NULL)
return(NULL);
}
if (s->data != NULL)