summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_time.c')
-rw-r--r--src/lib/libcrypto/asn1/a_time.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c
index 3461660b5f..13fd324517 100644
--- a/src/lib/libcrypto/asn1/a_time.c
+++ b/src/lib/libcrypto/asn1/a_time.c
@@ -95,13 +95,11 @@ ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
95 struct tm data; 95 struct tm data;
96 96
97 ts=OPENSSL_gmtime(&t,&data); 97 ts=OPENSSL_gmtime(&t,&data);
98 if (ts == NULL) 98 if (ts == NULL) {
99 {
100 ASN1err(ASN1_F_ASN1_TIME_ADJ, ASN1_R_ERROR_GETTING_TIME); 99 ASN1err(ASN1_F_ASN1_TIME_ADJ, ASN1_R_ERROR_GETTING_TIME);
101 return NULL; 100 return NULL;
102 } 101 }
103 if (offset_day || offset_sec) 102 if (offset_day || offset_sec) {
104 {
105 if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) 103 if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
106 return NULL; 104 return NULL;
107 } 105 }
@@ -128,8 +126,7 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE
128 126
129 if (!ASN1_TIME_check(t)) return NULL; 127 if (!ASN1_TIME_check(t)) return NULL;
130 128
131 if (!out || !*out) 129 if (!out || !*out) {
132 {
133 if (!(ret = ASN1_GENERALIZEDTIME_new ())) 130 if (!(ret = ASN1_GENERALIZEDTIME_new ()))
134 return NULL; 131 return NULL;
135 if (out) *out = ret; 132 if (out) *out = ret;
@@ -137,8 +134,7 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE
137 else ret = *out; 134 else ret = *out;
138 135
139 /* If already GeneralizedTime just copy across */ 136 /* If already GeneralizedTime just copy across */
140 if (t->type == V_ASN1_GENERALIZEDTIME) 137 if (t->type == V_ASN1_GENERALIZEDTIME) {
141 {
142 if(!ASN1_STRING_set(ret, t->data, t->length)) 138 if(!ASN1_STRING_set(ret, t->data, t->length))
143 return NULL; 139 return NULL;
144 return ret; 140 return ret;
@@ -169,8 +165,7 @@ int ASN1_TIME_set_string(ASN1_TIME *s, const char *str)
169 165
170 t.type = V_ASN1_UTCTIME; 166 t.type = V_ASN1_UTCTIME;
171 167
172 if (!ASN1_TIME_check(&t)) 168 if (!ASN1_TIME_check(&t)) {
173 {
174 t.type = V_ASN1_GENERALIZEDTIME; 169 t.type = V_ASN1_GENERALIZEDTIME;
175 if (!ASN1_TIME_check(&t)) 170 if (!ASN1_TIME_check(&t))
176 return 0; 171 return 0;