| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ct/ct_prn.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | static void SCT_signature_algorithms_print(const SCT *sct, BIO *out) | - | ||||||
| 5 | { | - | ||||||
| 6 | int nid = SCT_get_signature_nid(sct); | - | ||||||
| 7 | - | |||||||
| 8 | if (nid == 0
| 0-2338 | ||||||
| 9 | BIO_printf(out, "%02X%02X", sct->hash_alg, sct->sig_alg); never executed: BIO_printf(out, "%02X%02X", sct->hash_alg, sct->sig_alg); | 0 | ||||||
| 10 | else | - | ||||||
| 11 | BIO_printf(out, "%s", OBJ_nid2ln(nid)); executed 2338 times by 1 test: BIO_printf(out, "%s", OBJ_nid2ln(nid));Executed by:
| 2338 | ||||||
| 12 | } | - | ||||||
| 13 | - | |||||||
| 14 | static void timestamp_print(uint64_t timestamp, BIO *out) | - | ||||||
| 15 | { | - | ||||||
| 16 | ASN1_GENERALIZEDTIME *gen = ASN1_GENERALIZEDTIME_new(); | - | ||||||
| 17 | char genstr[20]; | - | ||||||
| 18 | - | |||||||
| 19 | if (gen ==
| 0-2338 | ||||||
| 20 | ((void *)0)
| 0-2338 | ||||||
| 21 | ) | - | ||||||
| 22 | return; never executed: return; | 0 | ||||||
| 23 | ASN1_GENERALIZEDTIME_adj(gen, (time_t)0, | - | ||||||
| 24 | (int)(timestamp / 86400000), | - | ||||||
| 25 | (timestamp % 86400000) / 1000); | - | ||||||
| 26 | - | |||||||
| 27 | - | |||||||
| 28 | - | |||||||
| 29 | - | |||||||
| 30 | BIO_snprintf(genstr, sizeof(genstr), "%.14s.%03dZ", | - | ||||||
| 31 | ASN1_STRING_get0_data(gen), (unsigned int)(timestamp % 1000)); | - | ||||||
| 32 | if (ASN1_GENERALIZEDTIME_set_string(gen, genstr)
| 534-1804 | ||||||
| 33 | ASN1_GENERALIZEDTIME_print(out, gen); executed 1804 times by 1 test: ASN1_GENERALIZEDTIME_print(out, gen);Executed by:
| 1804 | ||||||
| 34 | ASN1_GENERALIZEDTIME_free(gen); | - | ||||||
| 35 | } executed 2338 times by 1 test: end of blockExecuted by:
| 2338 | ||||||
| 36 | - | |||||||
| 37 | const char *SCT_validation_status_string(const SCT *sct) | - | ||||||
| 38 | { | - | ||||||
| 39 | - | |||||||
| 40 | switch (SCT_get_validation_status(sct)) { | - | ||||||
| 41 | case executed 2 times by 1 test: SCT_VALIDATION_STATUS_NOT_SET:case SCT_VALIDATION_STATUS_NOT_SET:Executed by:
executed 2 times by 1 test: case SCT_VALIDATION_STATUS_NOT_SET:Executed by:
| 2 | ||||||
| 42 | return executed 2 times by 1 test: "not set";return "not set";Executed by:
executed 2 times by 1 test: return "not set";Executed by:
| 2 | ||||||
| 43 | case never executed: SCT_VALIDATION_STATUS_UNKNOWN_VERSION:case SCT_VALIDATION_STATUS_UNKNOWN_VERSION:never executed: case SCT_VALIDATION_STATUS_UNKNOWN_VERSION: | 0 | ||||||
| 44 | return never executed: "unknown version";return "unknown version";never executed: return "unknown version"; | 0 | ||||||
| 45 | case never executed: SCT_VALIDATION_STATUS_UNKNOWN_LOG:case SCT_VALIDATION_STATUS_UNKNOWN_LOG:never executed: case SCT_VALIDATION_STATUS_UNKNOWN_LOG: | 0 | ||||||
| 46 | return never executed: "unknown log";return "unknown log";never executed: return "unknown log"; | 0 | ||||||
| 47 | case never executed: SCT_VALIDATION_STATUS_UNVERIFIED:case SCT_VALIDATION_STATUS_UNVERIFIED:never executed: case SCT_VALIDATION_STATUS_UNVERIFIED: | 0 | ||||||
| 48 | return never executed: "unverified";return "unverified";never executed: return "unverified"; | 0 | ||||||
| 49 | case never executed: SCT_VALIDATION_STATUS_INVALID:case SCT_VALIDATION_STATUS_INVALID:never executed: case SCT_VALIDATION_STATUS_INVALID: | 0 | ||||||
| 50 | return never executed: "invalid";return "invalid";never executed: return "invalid"; | 0 | ||||||
| 51 | case never executed: SCT_VALIDATION_STATUS_VALID:case SCT_VALIDATION_STATUS_VALID:never executed: case SCT_VALIDATION_STATUS_VALID: | 0 | ||||||
| 52 | return never executed: "valid";return "valid";never executed: return "valid"; | 0 | ||||||
| 53 | } | - | ||||||
| 54 | return never executed: "unknown status";return "unknown status";never executed: return "unknown status"; | 0 | ||||||
| 55 | } | - | ||||||
| 56 | - | |||||||
| 57 | void SCT_print(const SCT *sct, BIO *out, int indent, | - | ||||||
| 58 | const CTLOG_STORE *log_store) | - | ||||||
| 59 | { | - | ||||||
| 60 | const CTLOG *log = | - | ||||||
| 61 | ((void *)0) | - | ||||||
| 62 | ; | - | ||||||
| 63 | - | |||||||
| 64 | if (log_store !=
| 2-10671 | ||||||
| 65 | ((void *)0)
| 2-10671 | ||||||
| 66 | ) { | - | ||||||
| 67 | log = CTLOG_STORE_get0_log_by_id(log_store, sct->log_id, | - | ||||||
| 68 | sct->log_id_len); | - | ||||||
| 69 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||
| 70 | - | |||||||
| 71 | BIO_printf(out, "%*sSigned Certificate Timestamp:", indent, ""); | - | ||||||
| 72 | BIO_printf(out, "\n%*sVersion : ", indent + 4, ""); | - | ||||||
| 73 | - | |||||||
| 74 | if (sct->version != SCT_VERSION_V1
| 2338-8335 | ||||||
| 75 | BIO_printf(out, "unknown\n%*s", indent + 16, ""); | - | ||||||
| 76 | BIO_hex_string(out, indent + 16, 16, sct->sct, sct->sct_len); | - | ||||||
| 77 | return; executed 8335 times by 1 test: return;Executed by:
| 8335 | ||||||
| 78 | } | - | ||||||
| 79 | - | |||||||
| 80 | BIO_printf(out, "v1 (0x0)"); | - | ||||||
| 81 | - | |||||||
| 82 | if (log !=
| 2-2336 | ||||||
| 83 | ((void *)0)
| 2-2336 | ||||||
| 84 | ) { | - | ||||||
| 85 | BIO_printf(out, "\n%*sLog : %s", indent + 4, "", | - | ||||||
| 86 | CTLOG_get0_name(log)); | - | ||||||
| 87 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||
| 88 | - | |||||||
| 89 | BIO_printf(out, "\n%*sLog ID : ", indent + 4, ""); | - | ||||||
| 90 | BIO_hex_string(out, indent + 16, 16, sct->log_id, sct->log_id_len); | - | ||||||
| 91 | - | |||||||
| 92 | BIO_printf(out, "\n%*sTimestamp : ", indent + 4, ""); | - | ||||||
| 93 | timestamp_print(sct->timestamp, out); | - | ||||||
| 94 | - | |||||||
| 95 | BIO_printf(out, "\n%*sExtensions: ", indent + 4, ""); | - | ||||||
| 96 | if (sct->ext_len == 0
| 118-2220 | ||||||
| 97 | BIO_printf(out, "none"); executed 2220 times by 1 test: BIO_printf(out, "none");Executed by:
| 2220 | ||||||
| 98 | else | - | ||||||
| 99 | BIO_hex_string(out, indent + 16, 16, sct->ext, sct->ext_len); executed 118 times by 1 test: BIO_hex_string(out, indent + 16, 16, sct->ext, sct->ext_len);Executed by:
| 118 | ||||||
| 100 | - | |||||||
| 101 | BIO_printf(out, "\n%*sSignature : ", indent + 4, ""); | - | ||||||
| 102 | SCT_signature_algorithms_print(sct, out); | - | ||||||
| 103 | BIO_printf(out, "\n%*s ", indent + 4, ""); | - | ||||||
| 104 | BIO_hex_string(out, indent + 16, 16, sct->sig, sct->sig_len); | - | ||||||
| 105 | } executed 2338 times by 1 test: end of blockExecuted by:
| 2338 | ||||||
| 106 | - | |||||||
| 107 | void SCT_LIST_print(const struct stack_st_SCT *sct_list, BIO *out, int indent, | - | ||||||
| 108 | const char *separator, const CTLOG_STORE *log_store) | - | ||||||
| 109 | { | - | ||||||
| 110 | int sct_count = sk_SCT_num(sct_list); | - | ||||||
| 111 | int i; | - | ||||||
| 112 | - | |||||||
| 113 | for (i = 0; i < sct_count
| 2731-10671 | ||||||
| 114 | SCT *sct = sk_SCT_value(sct_list, i); | - | ||||||
| 115 | - | |||||||
| 116 | SCT_print(sct, out, indent, log_store); | - | ||||||
| 117 | if (i < sk_SCT_num(sct_list) - 1
| 2266-8405 | ||||||
| 118 | BIO_printf(out, "%s", separator); executed 8405 times by 1 test: BIO_printf(out, "%s", separator);Executed by:
| 8405 | ||||||
| 119 | } executed 10671 times by 1 test: end of blockExecuted by:
| 10671 | ||||||
| 120 | } executed 2731 times by 1 test: end of blockExecuted by:
| 2731 | ||||||
| Switch to Source code | Preprocessed file |