Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/a_time_tm.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | int | - | ||||||||||||||||||||||||
9 | ASN1_time_tm_cmp(struct tm *tm1, struct tm *tm2) | - | ||||||||||||||||||||||||
10 | { | - | ||||||||||||||||||||||||
11 | if (tm1->tm_year < tm2->tm_year
| 195-219 | ||||||||||||||||||||||||
12 | return executed 195 times by 2 tests: (-1);return (-1); Executed by:
executed 195 times by 2 tests: return (-1); Executed by:
| 195 | ||||||||||||||||||||||||
13 | if (tm1->tm_year > tm2->tm_year
| 21-198 | ||||||||||||||||||||||||
14 | return executed 198 times by 3 tests: (1);return (1); Executed by:
executed 198 times by 3 tests: return (1); Executed by:
| 198 | ||||||||||||||||||||||||
15 | if (tm1->tm_mon < tm2->tm_mon
| 0-21 | ||||||||||||||||||||||||
16 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
17 | if (tm1->tm_mon > tm2->tm_mon
| 0-21 | ||||||||||||||||||||||||
18 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
19 | if (tm1->tm_mday < tm2->tm_mday
| 0-21 | ||||||||||||||||||||||||
20 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
21 | if (tm1->tm_mday > tm2->tm_mday
| 0-21 | ||||||||||||||||||||||||
22 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
23 | if (tm1->tm_hour < tm2->tm_hour
| 0-21 | ||||||||||||||||||||||||
24 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
25 | if (tm1->tm_hour > tm2->tm_hour
| 0-21 | ||||||||||||||||||||||||
26 | return never executed: (1);return (1); never executed: return (1); | 0 | ||||||||||||||||||||||||
27 | if (tm1->tm_min < tm2->tm_min
| 0-21 | ||||||||||||||||||||||||
28 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
29 | if (tm1->tm_min > tm2->tm_min
| 3-18 | ||||||||||||||||||||||||
30 | return executed 3 times by 1 test: (1);return (1); Executed by:
executed 3 times by 1 test: return (1); Executed by:
| 3 | ||||||||||||||||||||||||
31 | if (tm1->tm_sec < tm2->tm_sec
| 0-18 | ||||||||||||||||||||||||
32 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
33 | if (tm1->tm_sec > tm2->tm_sec
| 6-12 | ||||||||||||||||||||||||
34 | return executed 6 times by 1 test: (1);return (1); Executed by:
executed 6 times by 1 test: return (1); Executed by:
| 6 | ||||||||||||||||||||||||
35 | return executed 12 times by 1 test: 0;return 0; Executed by:
executed 12 times by 1 test: return 0; Executed by:
| 12 | ||||||||||||||||||||||||
36 | } | - | ||||||||||||||||||||||||
37 | - | |||||||||||||||||||||||||
38 | int | - | ||||||||||||||||||||||||
39 | ASN1_time_tm_clamp_notafter(struct tm *tm) | - | ||||||||||||||||||||||||
40 | { | - | ||||||||||||||||||||||||
41 | return executed 199 times by 2 tests: 1;return 1; Executed by:
executed 199 times by 2 tests: return 1; Executed by:
| 199 | ||||||||||||||||||||||||
42 | } | - | ||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||
45 | char * | - | ||||||||||||||||||||||||
46 | gentime_string_from_tm(struct tm *tm) | - | ||||||||||||||||||||||||
47 | { | - | ||||||||||||||||||||||||
48 | char *ret = | - | ||||||||||||||||||||||||
49 | ((void *)0) | - | ||||||||||||||||||||||||
50 | ; | - | ||||||||||||||||||||||||
51 | int year; | - | ||||||||||||||||||||||||
52 | - | |||||||||||||||||||||||||
53 | year = tm->tm_year + 1900; | - | ||||||||||||||||||||||||
54 | if (year < 0
| 0-5 | ||||||||||||||||||||||||
55 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
56 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
57 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
58 | - | |||||||||||||||||||||||||
59 | if (asprintf(&ret, "%04u%02u%02u%02u%02u%02uZ", year,
| 0-5 | ||||||||||||||||||||||||
60 | tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min,
| 0-5 | ||||||||||||||||||||||||
61 | tm->tm_sec) == -1
| 0-5 | ||||||||||||||||||||||||
62 | ret = never executed: ret = ((void *)0) ; | 0 | ||||||||||||||||||||||||
63 | ((void *)0) never executed: ret = ((void *)0) ; | 0 | ||||||||||||||||||||||||
64 | ; never executed: ret = ((void *)0) ; | 0 | ||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||
66 | return executed 5 times by 2 tests: (ret);return (ret); Executed by:
executed 5 times by 2 tests: return (ret); Executed by:
| 5 | ||||||||||||||||||||||||
67 | } | - | ||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||
69 | - | |||||||||||||||||||||||||
70 | char * | - | ||||||||||||||||||||||||
71 | utctime_string_from_tm(struct tm *tm) | - | ||||||||||||||||||||||||
72 | { | - | ||||||||||||||||||||||||
73 | char *ret = | - | ||||||||||||||||||||||||
74 | ((void *)0) | - | ||||||||||||||||||||||||
75 | ; | - | ||||||||||||||||||||||||
76 | - | |||||||||||||||||||||||||
77 | if (tm->tm_year >= 150
| 0-19 | ||||||||||||||||||||||||
78 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
79 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
80 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||
82 | if (asprintf(&ret, "%02u%02u%02u%02u%02u%02uZ",
| 0-19 | ||||||||||||||||||||||||
83 | tm->tm_year % 100, tm->tm_mon + 1, tm->tm_mday,
| 0-19 | ||||||||||||||||||||||||
84 | tm->tm_hour, tm->tm_min, tm->tm_sec) == -1
| 0-19 | ||||||||||||||||||||||||
85 | ret = never executed: ret = ((void *)0) ; | 0 | ||||||||||||||||||||||||
86 | ((void *)0) never executed: ret = ((void *)0) ; | 0 | ||||||||||||||||||||||||
87 | ; never executed: ret = ((void *)0) ; | 0 | ||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||
89 | return executed 19 times by 4 tests: (ret);return (ret); Executed by:
executed 19 times by 4 tests: return (ret); Executed by:
| 19 | ||||||||||||||||||||||||
90 | } | - | ||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||
93 | char * | - | ||||||||||||||||||||||||
94 | rfc5280_string_from_tm(struct tm *tm) | - | ||||||||||||||||||||||||
95 | { | - | ||||||||||||||||||||||||
96 | char *ret = | - | ||||||||||||||||||||||||
97 | ((void *)0) | - | ||||||||||||||||||||||||
98 | ; | - | ||||||||||||||||||||||||
99 | int year; | - | ||||||||||||||||||||||||
100 | - | |||||||||||||||||||||||||
101 | year = tm->tm_year + 1900; | - | ||||||||||||||||||||||||
102 | if (year < 1950
| 0-6 | ||||||||||||||||||||||||
103 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
104 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
105 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
106 | - | |||||||||||||||||||||||||
107 | if (year < 2050
| 0-6 | ||||||||||||||||||||||||
108 | ret = utctime_string_from_tm(tm); executed 6 times by 2 tests: ret = utctime_string_from_tm(tm); Executed by:
| 6 | ||||||||||||||||||||||||
109 | else | - | ||||||||||||||||||||||||
110 | ret = gentime_string_from_tm(tm); never executed: ret = gentime_string_from_tm(tm); | 0 | ||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||
112 | return executed 6 times by 2 tests: (ret);return (ret); Executed by:
executed 6 times by 2 tests: return (ret); Executed by:
| 6 | ||||||||||||||||||||||||
113 | } | - | ||||||||||||||||||||||||
114 | int | - | ||||||||||||||||||||||||
115 | ASN1_time_parse(const char *bytes, size_t len, struct tm *tm, int mode) | - | ||||||||||||||||||||||||
116 | { | - | ||||||||||||||||||||||||
117 | size_t i; | - | ||||||||||||||||||||||||
118 | int type = 0; | - | ||||||||||||||||||||||||
119 | struct tm ltm; | - | ||||||||||||||||||||||||
120 | struct tm *lt; | - | ||||||||||||||||||||||||
121 | const char *p; | - | ||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||
123 | if (bytes ==
| 0-564 | ||||||||||||||||||||||||
124 | ((void *)0)
| 0-564 | ||||||||||||||||||||||||
125 | ) | - | ||||||||||||||||||||||||
126 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
127 | - | |||||||||||||||||||||||||
128 | - | |||||||||||||||||||||||||
129 | if (len != 13
| 48-444 | ||||||||||||||||||||||||
130 | return executed 72 times by 2 tests: (-1);return (-1); Executed by:
executed 72 times by 2 tests: return (-1); Executed by:
| 72 | ||||||||||||||||||||||||
131 | - | |||||||||||||||||||||||||
132 | lt = tm; | - | ||||||||||||||||||||||||
133 | if (lt ==
| 60-432 | ||||||||||||||||||||||||
134 | ((void *)0)
| 60-432 | ||||||||||||||||||||||||
135 | ) { | - | ||||||||||||||||||||||||
136 | memset(<m, 0, sizeof(ltm)); | - | ||||||||||||||||||||||||
137 | lt = <m; | - | ||||||||||||||||||||||||
138 | } executed 60 times by 2 tests: end of block Executed by:
| 60 | ||||||||||||||||||||||||
139 | - | |||||||||||||||||||||||||
140 | - | |||||||||||||||||||||||||
141 | if (bytes[len - 1] != 'Z'
| 0-492 | ||||||||||||||||||||||||
142 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||
144 | - | |||||||||||||||||||||||||
145 | for (i = 0; i < len - 1
| 486-5922 | ||||||||||||||||||||||||
146 | if ( | - | ||||||||||||||||||||||||
147 | ((*
| 6-5916 | ||||||||||||||||||||||||
148 | (unsigned char)bytes[i]
| 6-5916 | ||||||||||||||||||||||||
149 | ))] & (unsigned short int) _ISdigit)
| 6-5916 | ||||||||||||||||||||||||
150 | ) | - | ||||||||||||||||||||||||
151 | continue; executed 5916 times by 4 tests: continue; Executed by:
| 5916 | ||||||||||||||||||||||||
152 | return executed 6 times by 2 tests: (-1);return (-1); Executed by:
executed 6 times by 2 tests: return (-1); Executed by:
| 6 | ||||||||||||||||||||||||
153 | } | - | ||||||||||||||||||||||||
154 | - | |||||||||||||||||||||||||
155 | - | |||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||
157 | - | |||||||||||||||||||||||||
158 | p = bytes; | - | ||||||||||||||||||||||||
159 | switch (len) { | - | ||||||||||||||||||||||||
160 | case executed 42 times by 2 tests: 15:case 15: Executed by:
executed 42 times by 2 tests: case 15: Executed by:
| 42 | ||||||||||||||||||||||||
161 | if (mode == 23
| 5-37 | ||||||||||||||||||||||||
162 | return executed 5 times by 1 test: (-1);return (-1); Executed by:
executed 5 times by 1 test: return (-1); Executed by:
| 5 | ||||||||||||||||||||||||
163 | lt->tm_year = (((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0')) * 100) - 1900; | - | ||||||||||||||||||||||||
164 | type = 24; | - | ||||||||||||||||||||||||
165 | - | |||||||||||||||||||||||||
166 | case executed 444 times by 4 tests: 13:case 13: Executed by:
executed 444 times by 4 tests: case 13: Executed by:
code before this statement executed 37 times by 2 tests: case 13: Executed by:
| 37-444 | ||||||||||||||||||||||||
167 | if (type == 0
| 37-444 | ||||||||||||||||||||||||
168 | if (mode == 24
| 1-443 | ||||||||||||||||||||||||
169 | return executed 1 time by 1 test: (-1);return (-1); Executed by:
executed 1 time by 1 test: return (-1); Executed by:
| 1 | ||||||||||||||||||||||||
170 | type = 23; | - | ||||||||||||||||||||||||
171 | } executed 443 times by 4 tests: end of block Executed by:
| 443 | ||||||||||||||||||||||||
172 | lt->tm_year += ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0')); | - | ||||||||||||||||||||||||
173 | if (type == 23
| 37-443 | ||||||||||||||||||||||||
174 | if (lt->tm_year < 50
| 13-430 | ||||||||||||||||||||||||
175 | lt->tm_year += 100; executed 430 times by 4 tests: lt->tm_year += 100; Executed by:
| 430 | ||||||||||||||||||||||||
176 | } executed 443 times by 4 tests: end of block Executed by:
| 443 | ||||||||||||||||||||||||
177 | lt->tm_mon = ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0')) - 1; | - | ||||||||||||||||||||||||
178 | if (lt->tm_mon < 0
| 0-480 | ||||||||||||||||||||||||
179 | return executed 2 times by 1 test: (-1);return (-1); Executed by:
executed 2 times by 1 test: return (-1); Executed by:
| 2 | ||||||||||||||||||||||||
180 | lt->tm_mday = ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0')); | - | ||||||||||||||||||||||||
181 | if (lt->tm_mday < 1
| 0-478 | ||||||||||||||||||||||||
182 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
183 | lt->tm_hour = ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0')); | - | ||||||||||||||||||||||||
184 | if (lt->tm_hour < 0
| 0-478 | ||||||||||||||||||||||||
185 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
186 | lt->tm_min = ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0')); | - | ||||||||||||||||||||||||
187 | if (lt->tm_min < 0
| 0-478 | ||||||||||||||||||||||||
188 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
189 | lt->tm_sec = ((p) += 2, ((p)[-2] - '0') * 10 + ((p)[-1] - '0')); | - | ||||||||||||||||||||||||
190 | - | |||||||||||||||||||||||||
191 | if (lt->tm_sec < 0
| 0-478 | ||||||||||||||||||||||||
192 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
193 | break; executed 478 times by 4 tests: break; Executed by:
| 478 | ||||||||||||||||||||||||
194 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
195 | return never executed: (-1);return (-1); never executed: return (-1); | 0 | ||||||||||||||||||||||||
196 | } | - | ||||||||||||||||||||||||
197 | - | |||||||||||||||||||||||||
198 | return executed 478 times by 4 tests: (type);return (type); Executed by:
executed 478 times by 4 tests: return (type); Executed by:
| 478 | ||||||||||||||||||||||||
199 | } | - | ||||||||||||||||||||||||
200 | - | |||||||||||||||||||||||||
201 | - | |||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||
204 | - | |||||||||||||||||||||||||
205 | static int | - | ||||||||||||||||||||||||
206 | ASN1_TIME_set_string_internal(ASN1_TIME *s, const char *str, int mode) | - | ||||||||||||||||||||||||
207 | { | - | ||||||||||||||||||||||||
208 | int type; | - | ||||||||||||||||||||||||
209 | char *tmp; | - | ||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||
211 | if ((
| 46-86 | ||||||||||||||||||||||||
212 | ((void *)0)
| 46-86 | ||||||||||||||||||||||||
213 | , mode)) == -1
| 46-86 | ||||||||||||||||||||||||
214 | return executed 86 times by 2 tests: (0);return (0); Executed by:
executed 86 times by 2 tests: return (0); Executed by:
| 86 | ||||||||||||||||||||||||
215 | if (mode != 0
| 0-29 | ||||||||||||||||||||||||
216 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
217 | - | |||||||||||||||||||||||||
218 | if (s ==
| 12-34 | ||||||||||||||||||||||||
219 | ((void *)0)
| 12-34 | ||||||||||||||||||||||||
220 | ) | - | ||||||||||||||||||||||||
221 | return executed 12 times by 1 test: (1);return (1); Executed by:
executed 12 times by 1 test: return (1); Executed by:
| 12 | ||||||||||||||||||||||||
222 | - | |||||||||||||||||||||||||
223 | if ((
| 0-34 | ||||||||||||||||||||||||
224 | (__extension__ (__builtin_constant_p (
| 0-34 | ||||||||||||||||||||||||
225 | str
| 0-34 | ||||||||||||||||||||||||
226 | )
| 0-34 | ||||||||||||||||||||||||
227 | str
| 0-34 | ||||||||||||||||||||||||
228 | ) + 1) - (size_t)(const void *)(
| 0-34 | ||||||||||||||||||||||||
229 | str
| 0-34 | ||||||||||||||||||||||||
230 | ) == 1)
| 0-34 | ||||||||||||||||||||||||
231 | str
| 0-34 | ||||||||||||||||||||||||
232 | ))[0] == '\0'
| 0-34 | ||||||||||||||||||||||||
233 | str
| 0-34 | ||||||||||||||||||||||||
234 | ) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)
never executed: __retval = (char *) memcpy (__retval, str , __len);
| 0-34 | ||||||||||||||||||||||||
235 | str
never executed: __retval = (char *) memcpy (__retval, str , __len); | 0-34 | ||||||||||||||||||||||||
236 | , __len);
never executed: __retval; })) : __strdup (__retval = (char *) memcpy (__retval, str , __len);
| 0-34 | ||||||||||||||||||||||||
237 | str
| 0-34 | ||||||||||||||||||||||||
238 | )))
| 0-34 | ||||||||||||||||||||||||
239 | ) ==
| 0-34 | ||||||||||||||||||||||||
240 | ((void *)0)
| 0-34 | ||||||||||||||||||||||||
241 | ) | - | ||||||||||||||||||||||||
242 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
243 | free(s->data); | - | ||||||||||||||||||||||||
244 | s->data = tmp; | - | ||||||||||||||||||||||||
245 | s->length = strlen(tmp); | - | ||||||||||||||||||||||||
246 | s->type = type; | - | ||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||
248 | return executed 34 times by 2 tests: (1);return (1); Executed by:
executed 34 times by 2 tests: return (1); Executed by:
| 34 | ||||||||||||||||||||||||
249 | } | - | ||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||
251 | static ASN1_TIME * | - | ||||||||||||||||||||||||
252 | ASN1_TIME_adj_internal(ASN1_TIME *s, time_t t, int offset_day, long offset_sec, | - | ||||||||||||||||||||||||
253 | int mode) | - | ||||||||||||||||||||||||
254 | { | - | ||||||||||||||||||||||||
255 | int allocated = 0; | - | ||||||||||||||||||||||||
256 | struct tm tm; | - | ||||||||||||||||||||||||
257 | size_t len; | - | ||||||||||||||||||||||||
258 | char * p; | - | ||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||
260 | if (gmtime_r(&t, &tm) ==
| 0-24 | ||||||||||||||||||||||||
261 | ((void *)0)
| 0-24 | ||||||||||||||||||||||||
262 | ) | - | ||||||||||||||||||||||||
263 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
264 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
265 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | if (offset_day
| 0-22 | ||||||||||||||||||||||||
268 | if (!OPENSSL_gmtime_adj(&tm, offset_day, offset_sec)
| 0-2 | ||||||||||||||||||||||||
269 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
270 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
271 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
272 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
273 | - | |||||||||||||||||||||||||
274 | switch (mode) { | - | ||||||||||||||||||||||||
275 | case executed 13 times by 2 tests: 23:case 23: Executed by:
executed 13 times by 2 tests: case 23: Executed by:
| 13 | ||||||||||||||||||||||||
276 | p = utctime_string_from_tm(&tm); | - | ||||||||||||||||||||||||
277 | break; executed 13 times by 2 tests: break; Executed by:
| 13 | ||||||||||||||||||||||||
278 | case executed 5 times by 2 tests: 24:case 24: Executed by:
executed 5 times by 2 tests: case 24: Executed by:
| 5 | ||||||||||||||||||||||||
279 | p = gentime_string_from_tm(&tm); | - | ||||||||||||||||||||||||
280 | break; executed 5 times by 2 tests: break; Executed by:
| 5 | ||||||||||||||||||||||||
281 | case executed 6 times by 2 tests: 0:case 0: Executed by:
executed 6 times by 2 tests: case 0: Executed by:
| 6 | ||||||||||||||||||||||||
282 | p = rfc5280_string_from_tm(&tm); | - | ||||||||||||||||||||||||
283 | break; executed 6 times by 2 tests: break; Executed by:
| 6 | ||||||||||||||||||||||||
284 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
285 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
286 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
287 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
288 | } | - | ||||||||||||||||||||||||
289 | if (p ==
| 0-24 | ||||||||||||||||||||||||
290 | ((void *)0)
| 0-24 | ||||||||||||||||||||||||
291 | ) { | - | ||||||||||||||||||||||||
292 | ERR_put_error(13,(0xfff),(184),__FILE__,287); | - | ||||||||||||||||||||||||
293 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
294 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
295 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
296 | } | - | ||||||||||||||||||||||||
297 | - | |||||||||||||||||||||||||
298 | if (s ==
| 4-20 | ||||||||||||||||||||||||
299 | ((void *)0)
| 4-20 | ||||||||||||||||||||||||
300 | ) { | - | ||||||||||||||||||||||||
301 | if ((
| 0-20 | ||||||||||||||||||||||||
302 | ((void *)0)
| 0-20 | ||||||||||||||||||||||||
303 | ) | - | ||||||||||||||||||||||||
304 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
305 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
306 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
307 | allocated = 1; | - | ||||||||||||||||||||||||
308 | } executed 20 times by 3 tests: end of block Executed by:
| 20 | ||||||||||||||||||||||||
309 | - | |||||||||||||||||||||||||
310 | len = strlen(p); | - | ||||||||||||||||||||||||
311 | switch (len) { | - | ||||||||||||||||||||||||
312 | case executed 5 times by 2 tests: 15:case 15: Executed by:
executed 5 times by 2 tests: case 15: Executed by:
| 5 | ||||||||||||||||||||||||
313 | s->type = 24; | - | ||||||||||||||||||||||||
314 | break; executed 5 times by 2 tests: break; Executed by:
| 5 | ||||||||||||||||||||||||
315 | case executed 19 times by 4 tests: 13:case 13: Executed by:
executed 19 times by 4 tests: case 13: Executed by:
| 19 | ||||||||||||||||||||||||
316 | s->type = 23; | - | ||||||||||||||||||||||||
317 | break; executed 19 times by 4 tests: break; Executed by:
| 19 | ||||||||||||||||||||||||
318 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
319 | if (allocated
| 0 | ||||||||||||||||||||||||
320 | ASN1_TIME_free(s); never executed: ASN1_TIME_free(s); | 0 | ||||||||||||||||||||||||
321 | free(p); | - | ||||||||||||||||||||||||
322 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
323 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
324 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
325 | } | - | ||||||||||||||||||||||||
326 | free(s->data); | - | ||||||||||||||||||||||||
327 | s->data = p; | - | ||||||||||||||||||||||||
328 | s->length = len; | - | ||||||||||||||||||||||||
329 | return executed 24 times by 4 tests: (s);return (s); Executed by:
executed 24 times by 4 tests: return (s); Executed by:
| 24 | ||||||||||||||||||||||||
330 | } | - | ||||||||||||||||||||||||
331 | - | |||||||||||||||||||||||||
332 | ASN1_TIME * | - | ||||||||||||||||||||||||
333 | ASN1_TIME_set(ASN1_TIME *s, time_t t) | - | ||||||||||||||||||||||||
334 | { | - | ||||||||||||||||||||||||
335 | return never executed: (ASN1_TIME_adj(s, t, 0, 0));return (ASN1_TIME_adj(s, t, 0, 0)); never executed: return (ASN1_TIME_adj(s, t, 0, 0)); | 0 | ||||||||||||||||||||||||
336 | } | - | ||||||||||||||||||||||||
337 | - | |||||||||||||||||||||||||
338 | ASN1_TIME * | - | ||||||||||||||||||||||||
339 | ASN1_TIME_set_tm(ASN1_TIME *s, struct tm *tm) | - | ||||||||||||||||||||||||
340 | { | - | ||||||||||||||||||||||||
341 | time_t t; | - | ||||||||||||||||||||||||
342 | - | |||||||||||||||||||||||||
343 | if ((
| 0 | ||||||||||||||||||||||||
344 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
345 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
346 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
347 | return never executed: (ASN1_TIME_adj(s, t, 0, 0));return (ASN1_TIME_adj(s, t, 0, 0)); never executed: return (ASN1_TIME_adj(s, t, 0, 0)); | 0 | ||||||||||||||||||||||||
348 | } | - | ||||||||||||||||||||||||
349 | - | |||||||||||||||||||||||||
350 | ASN1_TIME * | - | ||||||||||||||||||||||||
351 | ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day, long offset_sec) | - | ||||||||||||||||||||||||
352 | { | - | ||||||||||||||||||||||||
353 | return executed 6 times by 2 tests: (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, 0));return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, 0)); Executed by:
executed 6 times by 2 tests: return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, 0)); Executed by:
| 6 | ||||||||||||||||||||||||
354 | } | - | ||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||
356 | int | - | ||||||||||||||||||||||||
357 | ASN1_TIME_check(const ASN1_TIME *t) | - | ||||||||||||||||||||||||
358 | { | - | ||||||||||||||||||||||||
359 | if (t->type != 24
| 0 | ||||||||||||||||||||||||
360 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
361 | return never executed: (t->type == ASN1_time_parse(t->data, t->length, return (t->type == ASN1_time_parse(t->data, t->length, ((void *)0) , t->type)); never executed: return (t->type == ASN1_time_parse(t->data, t->length, ((void *)0) , t->type)); | 0 | ||||||||||||||||||||||||
362 | ((void *)0) never executed: return (t->type == ASN1_time_parse(t->data, t->length, ((void *)0) , t->type)); | 0 | ||||||||||||||||||||||||
363 | , t->type)); never executed: return (t->type == ASN1_time_parse(t->data, t->length, ((void *)0) , t->type)); | 0 | ||||||||||||||||||||||||
364 | } | - | ||||||||||||||||||||||||
365 | - | |||||||||||||||||||||||||
366 | ASN1_GENERALIZEDTIME * | - | ||||||||||||||||||||||||
367 | ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, ASN1_GENERALIZEDTIME **out) | - | ||||||||||||||||||||||||
368 | { | - | ||||||||||||||||||||||||
369 | ASN1_GENERALIZEDTIME *tmp = | - | ||||||||||||||||||||||||
370 | ((void *)0) | - | ||||||||||||||||||||||||
371 | ; | - | ||||||||||||||||||||||||
372 | struct tm tm; | - | ||||||||||||||||||||||||
373 | char *str; | - | ||||||||||||||||||||||||
374 | - | |||||||||||||||||||||||||
375 | if (t->type != 24
| 0 | ||||||||||||||||||||||||
376 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
377 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
378 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
379 | - | |||||||||||||||||||||||||
380 | memset(&tm, 0, sizeof(tm)); | - | ||||||||||||||||||||||||
381 | if (t->type != ASN1_time_parse(t->data, t->length, &tm, t->type)
| 0 | ||||||||||||||||||||||||
382 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
383 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
384 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
385 | if ((
| 0 | ||||||||||||||||||||||||
386 | ((void *)0)
| 0 | ||||||||||||||||||||||||
387 | ) | - | ||||||||||||||||||||||||
388 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
389 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
390 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
391 | - | |||||||||||||||||||||||||
392 | if (out !=
| 0 | ||||||||||||||||||||||||
393 | ((void *)0)
| 0 | ||||||||||||||||||||||||
394 | ) | - | ||||||||||||||||||||||||
395 | tmp = *out; never executed: tmp = *out; | 0 | ||||||||||||||||||||||||
396 | if (tmp ==
| 0 | ||||||||||||||||||||||||
397 | ((void *)0)
| 0 | ||||||||||||||||||||||||
398 | && (
| 0 | ||||||||||||||||||||||||
399 | ((void *)0)
| 0 | ||||||||||||||||||||||||
400 | ) { | - | ||||||||||||||||||||||||
401 | free(str); | - | ||||||||||||||||||||||||
402 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
403 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
404 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||
405 | } | - | ||||||||||||||||||||||||
406 | if (out !=
| 0 | ||||||||||||||||||||||||
407 | ((void *)0)
| 0 | ||||||||||||||||||||||||
408 | ) | - | ||||||||||||||||||||||||
409 | * never executed: out = tmp;*out = tmp; never executed: *out = tmp; | 0 | ||||||||||||||||||||||||
410 | - | |||||||||||||||||||||||||
411 | free(tmp->data); | - | ||||||||||||||||||||||||
412 | tmp->data = str; | - | ||||||||||||||||||||||||
413 | tmp->length = strlen(str); | - | ||||||||||||||||||||||||
414 | return never executed: (tmp);return (tmp); never executed: return (tmp); | 0 | ||||||||||||||||||||||||
415 | } | - | ||||||||||||||||||||||||
416 | - | |||||||||||||||||||||||||
417 | int | - | ||||||||||||||||||||||||
418 | ASN1_TIME_set_string(ASN1_TIME *s, const char *str) | - | ||||||||||||||||||||||||
419 | { | - | ||||||||||||||||||||||||
420 | return executed 44 times by 2 tests: (ASN1_TIME_set_string_internal(s, str, 0));return (ASN1_TIME_set_string_internal(s, str, 0)); Executed by:
executed 44 times by 2 tests: return (ASN1_TIME_set_string_internal(s, str, 0)); Executed by:
| 44 | ||||||||||||||||||||||||
421 | } | - | ||||||||||||||||||||||||
422 | - | |||||||||||||||||||||||||
423 | - | |||||||||||||||||||||||||
424 | - | |||||||||||||||||||||||||
425 | - | |||||||||||||||||||||||||
426 | - | |||||||||||||||||||||||||
427 | int | - | ||||||||||||||||||||||||
428 | ASN1_UTCTIME_check(const ASN1_UTCTIME *d) | - | ||||||||||||||||||||||||
429 | { | - | ||||||||||||||||||||||||
430 | if (d->type != 23
| 0 | ||||||||||||||||||||||||
431 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
432 | return never executed: (d->type == ASN1_time_parse(d->data, d->length, return (d->type == ASN1_time_parse(d->data, d->length, ((void *)0) , d->type)); never executed: return (d->type == ASN1_time_parse(d->data, d->length, ((void *)0) , d->type)); | 0 | ||||||||||||||||||||||||
433 | ((void *)0) never executed: return (d->type == ASN1_time_parse(d->data, d->length, ((void *)0) , d->type)); | 0 | ||||||||||||||||||||||||
434 | , d->type)); never executed: return (d->type == ASN1_time_parse(d->data, d->length, ((void *)0) , d->type)); | 0 | ||||||||||||||||||||||||
435 | } | - | ||||||||||||||||||||||||
436 | - | |||||||||||||||||||||||||
437 | int | - | ||||||||||||||||||||||||
438 | ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str) | - | ||||||||||||||||||||||||
439 | { | - | ||||||||||||||||||||||||
440 | if (s !=
| 4-45 | ||||||||||||||||||||||||
441 | ((void *)0)
| 4-45 | ||||||||||||||||||||||||
442 | && s->type != 23
| 0-45 | ||||||||||||||||||||||||
443 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
444 | return executed 49 times by 2 tests: (ASN1_TIME_set_string_internal(s, str, 23));return (ASN1_TIME_set_string_internal(s, str, 23)); Executed by:
executed 49 times by 2 tests: return (ASN1_TIME_set_string_internal(s, str, 23)); Executed by:
| 49 | ||||||||||||||||||||||||
445 | } | - | ||||||||||||||||||||||||
446 | - | |||||||||||||||||||||||||
447 | ASN1_UTCTIME * | - | ||||||||||||||||||||||||
448 | ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) | - | ||||||||||||||||||||||||
449 | { | - | ||||||||||||||||||||||||
450 | return executed 13 times by 2 tests: (ASN1_UTCTIME_adj(s, t, 0, 0));return (ASN1_UTCTIME_adj(s, t, 0, 0)); Executed by:
executed 13 times by 2 tests: return (ASN1_UTCTIME_adj(s, t, 0, 0)); Executed by:
| 13 | ||||||||||||||||||||||||
451 | } | - | ||||||||||||||||||||||||
452 | - | |||||||||||||||||||||||||
453 | ASN1_UTCTIME * | - | ||||||||||||||||||||||||
454 | ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, int offset_day, long offset_sec) | - | ||||||||||||||||||||||||
455 | { | - | ||||||||||||||||||||||||
456 | return executed 13 times by 2 tests: (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec,return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, 23)); Executed by:
executed 13 times by 2 tests: return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, 23)); Executed by:
| 13 | ||||||||||||||||||||||||
457 | 23)); executed 13 times by 2 tests: return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, 23)); Executed by:
| 13 | ||||||||||||||||||||||||
458 | } | - | ||||||||||||||||||||||||
459 | - | |||||||||||||||||||||||||
460 | int | - | ||||||||||||||||||||||||
461 | ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t2) | - | ||||||||||||||||||||||||
462 | { | - | ||||||||||||||||||||||||
463 | struct tm tm1, tm2; | - | ||||||||||||||||||||||||
464 | if (ASN1_time_parse(s->data, s->length, &tm1, 23) == -1
| 0 | ||||||||||||||||||||||||
465 | return never executed: (-2);return (-2); never executed: return (-2); | 0 | ||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||
467 | if (gmtime_r(&t2, &tm2) ==
| 0 | ||||||||||||||||||||||||
468 | ((void *)0)
| 0 | ||||||||||||||||||||||||
469 | ) | - | ||||||||||||||||||||||||
470 | return never executed: (-2);return (-2); never executed: return (-2); | 0 | ||||||||||||||||||||||||
471 | - | |||||||||||||||||||||||||
472 | return never executed: ASN1_time_tm_cmp(&tm1, &tm2);return ASN1_time_tm_cmp(&tm1, &tm2); never executed: return ASN1_time_tm_cmp(&tm1, &tm2); | 0 | ||||||||||||||||||||||||
473 | } | - | ||||||||||||||||||||||||
474 | - | |||||||||||||||||||||||||
475 | - | |||||||||||||||||||||||||
476 | - | |||||||||||||||||||||||||
477 | - | |||||||||||||||||||||||||
478 | - | |||||||||||||||||||||||||
479 | int | - | ||||||||||||||||||||||||
480 | ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *d) | - | ||||||||||||||||||||||||
481 | { | - | ||||||||||||||||||||||||
482 | if (d->type != 24
| 0 | ||||||||||||||||||||||||
483 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
484 | return never executed: (d->type == ASN1_time_parse(d->data, d->length, return (d->type == ASN1_time_parse(d->data, d->length, ((void *)0) , d->type)); never executed: return (d->type == ASN1_time_parse(d->data, d->length, ((void *)0) , d->type)); | 0 | ||||||||||||||||||||||||
485 | ((void *)0) never executed: return (d->type == ASN1_time_parse(d->data, d->length, ((void *)0) , d->type)); | 0 | ||||||||||||||||||||||||
486 | , d->type)); never executed: return (d->type == ASN1_time_parse(d->data, d->length, ((void *)0) , d->type)); | 0 | ||||||||||||||||||||||||
487 | } | - | ||||||||||||||||||||||||
488 | - | |||||||||||||||||||||||||
489 | int | - | ||||||||||||||||||||||||
490 | ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) | - | ||||||||||||||||||||||||
491 | { | - | ||||||||||||||||||||||||
492 | if (s !=
| 2-37 | ||||||||||||||||||||||||
493 | ((void *)0)
| 2-37 | ||||||||||||||||||||||||
494 | && s->type != 24
| 0-37 | ||||||||||||||||||||||||
495 | return never executed: (0);return (0); never executed: return (0); | 0 | ||||||||||||||||||||||||
496 | return executed 39 times by 2 tests: (ASN1_TIME_set_string_internal(s, str, 24));return (ASN1_TIME_set_string_internal(s, str, 24)); Executed by:
executed 39 times by 2 tests: return (ASN1_TIME_set_string_internal(s, str, 24)); Executed by:
| 39 | ||||||||||||||||||||||||
497 | } | - | ||||||||||||||||||||||||
498 | - | |||||||||||||||||||||||||
499 | ASN1_GENERALIZEDTIME * | - | ||||||||||||||||||||||||
500 | ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, time_t t) | - | ||||||||||||||||||||||||
501 | { | - | ||||||||||||||||||||||||
502 | return executed 5 times by 2 tests: (ASN1_GENERALIZEDTIME_adj(s, t, 0, 0));return (ASN1_GENERALIZEDTIME_adj(s, t, 0, 0)); Executed by:
executed 5 times by 2 tests: return (ASN1_GENERALIZEDTIME_adj(s, t, 0, 0)); Executed by:
| 5 | ||||||||||||||||||||||||
503 | } | - | ||||||||||||||||||||||||
504 | - | |||||||||||||||||||||||||
505 | ASN1_GENERALIZEDTIME * | - | ||||||||||||||||||||||||
506 | ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, time_t t, int offset_day, | - | ||||||||||||||||||||||||
507 | long offset_sec) | - | ||||||||||||||||||||||||
508 | { | - | ||||||||||||||||||||||||
509 | return executed 5 times by 2 tests: (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec,return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, 24)); Executed by:
executed 5 times by 2 tests: return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, 24)); Executed by:
| 5 | ||||||||||||||||||||||||
510 | 24)); executed 5 times by 2 tests: return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, 24)); Executed by:
| 5 | ||||||||||||||||||||||||
511 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |