| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/a_utctm.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | int asn1_utctime_to_tm(struct tm *tm, const ASN1_UTCTIME *d) | - | ||||||||||||
| 4 | { | - | ||||||||||||
| 5 | - | |||||||||||||
| 6 | if (d->type != 23
| 0-144 | ||||||||||||
| 7 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 8 | return executed 144 times by 1 test: asn1_time_to_tm(tm, d);return asn1_time_to_tm(tm, d);Executed by:
executed 144 times by 1 test: return asn1_time_to_tm(tm, d);Executed by:
| 144 | ||||||||||||
| 9 | } | - | ||||||||||||
| 10 | - | |||||||||||||
| 11 | int ASN1_UTCTIME_check(const ASN1_UTCTIME *d) | - | ||||||||||||
| 12 | { | - | ||||||||||||
| 13 | return executed 144 times by 1 test: asn1_utctime_to_tm(return asn1_utctime_to_tm( ((void *)0) , d);Executed by:
executed 144 times by 1 test: return asn1_utctime_to_tm( ((void *)0) , d);Executed by:
| 144 | ||||||||||||
| 14 | ((void *)0) executed 144 times by 1 test: return asn1_utctime_to_tm( ((void *)0) , d);Executed by:
| 144 | ||||||||||||
| 15 | , d); executed 144 times by 1 test: return asn1_utctime_to_tm( ((void *)0) , d);Executed by:
| 144 | ||||||||||||
| 16 | } | - | ||||||||||||
| 17 | - | |||||||||||||
| 18 | - | |||||||||||||
| 19 | int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str) | - | ||||||||||||
| 20 | { | - | ||||||||||||
| 21 | ASN1_UTCTIME t; | - | ||||||||||||
| 22 | - | |||||||||||||
| 23 | t.type = 23; | - | ||||||||||||
| 24 | t.length = strlen(str); | - | ||||||||||||
| 25 | t.data = (unsigned char *)str; | - | ||||||||||||
| 26 | t.flags = 0; | - | ||||||||||||
| 27 | - | |||||||||||||
| 28 | if (!ASN1_UTCTIME_check(&t)
| 25-83 | ||||||||||||
| 29 | return executed 83 times by 1 test: 0;return 0;Executed by:
executed 83 times by 1 test: return 0;Executed by:
| 83 | ||||||||||||
| 30 | - | |||||||||||||
| 31 | if (s !=
| 1-24 | ||||||||||||
| 32 | ((void *)0)
| 1-24 | ||||||||||||
| 33 | && !ASN1_STRING_copy(s, &t)
| 0-24 | ||||||||||||
| 34 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 35 | - | |||||||||||||
| 36 | return executed 25 times by 1 test: 1;return 1;Executed by:
executed 25 times by 1 test: return 1;Executed by:
| 25 | ||||||||||||
| 37 | } | - | ||||||||||||
| 38 | - | |||||||||||||
| 39 | ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) | - | ||||||||||||
| 40 | { | - | ||||||||||||
| 41 | return never executed: ASN1_UTCTIME_adj(s, t, 0, 0);return ASN1_UTCTIME_adj(s, t, 0, 0);never executed: return ASN1_UTCTIME_adj(s, t, 0, 0); | 0 | ||||||||||||
| 42 | } | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, | - | ||||||||||||
| 45 | int offset_day, long offset_sec) | - | ||||||||||||
| 46 | { | - | ||||||||||||
| 47 | struct tm *ts; | - | ||||||||||||
| 48 | struct tm data; | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 | ts = OPENSSL_gmtime(&t, &data); | - | ||||||||||||
| 51 | if (ts ==
| 0 | ||||||||||||
| 52 | ((void *)0)
| 0 | ||||||||||||
| 53 | ) | - | ||||||||||||
| 54 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 55 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 56 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 57 | - | |||||||||||||
| 58 | if (offset_day
| 0 | ||||||||||||
| 59 | if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)
| 0 | ||||||||||||
| 60 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 61 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 62 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 63 | } never executed: end of block | 0 | ||||||||||||
| 64 | - | |||||||||||||
| 65 | return never executed: asn1_time_from_tm(s, ts, 23);return asn1_time_from_tm(s, ts, 23);never executed: return asn1_time_from_tm(s, ts, 23); | 0 | ||||||||||||
| 66 | } | - | ||||||||||||
| 67 | - | |||||||||||||
| 68 | int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t) | - | ||||||||||||
| 69 | { | - | ||||||||||||
| 70 | struct tm stm, ttm; | - | ||||||||||||
| 71 | int day, sec; | - | ||||||||||||
| 72 | - | |||||||||||||
| 73 | if (!asn1_utctime_to_tm(&stm, s)
| 0 | ||||||||||||
| 74 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||
| 75 | - | |||||||||||||
| 76 | if (OPENSSL_gmtime(&t, &ttm) ==
| 0 | ||||||||||||
| 77 | ((void *)0)
| 0 | ||||||||||||
| 78 | ) | - | ||||||||||||
| 79 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||
| 80 | - | |||||||||||||
| 81 | if (!OPENSSL_gmtime_diff(&day, &sec, &ttm, &stm)
| 0 | ||||||||||||
| 82 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||
| 83 | - | |||||||||||||
| 84 | if (day > 0
| 0 | ||||||||||||
| 85 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 86 | if (day < 0
| 0 | ||||||||||||
| 87 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 88 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 89 | } | - | ||||||||||||
| 90 | - | |||||||||||||
| 91 | int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm) | - | ||||||||||||
| 92 | { | - | ||||||||||||
| 93 | if (tm->type != 23
| 0-1949 | ||||||||||||
| 94 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 95 | return executed 1949 times by 1 test: ASN1_TIME_print(bp, tm);return ASN1_TIME_print(bp, tm);Executed by:
executed 1949 times by 1 test: return ASN1_TIME_print(bp, tm);Executed by:
| 1949 | ||||||||||||
| 96 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |