| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ct/ct_sct.c | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | SCT *SCT_new(void) | - | ||||||||||||
| 6 | { | - | ||||||||||||
| 7 | SCT *sct = CRYPTO_zalloc(sizeof(*sct), __FILE__, 24); | - | ||||||||||||
| 8 | - | |||||||||||||
| 9 | if (sct == 
 | 0-14203 | ||||||||||||
| 10 | ((void *)0) 
 | 0-14203 | ||||||||||||
| 11 | ) { | - | ||||||||||||
| 12 | ERR_put_error(50,(100),((1|64)),__FILE__,27); | - | ||||||||||||
| 13 | return never executed:  return ((void *)0) ;never executed:  return ((void *)0) ; | 0 | ||||||||||||
| 14 | ((void *)0) never executed:  return ((void *)0) ; | 0 | ||||||||||||
| 15 | ; never executed:  return ((void *)0) ; | 0 | ||||||||||||
| 16 | } | - | ||||||||||||
| 17 | - | |||||||||||||
| 18 | sct->entry_type = CT_LOG_ENTRY_TYPE_NOT_SET; | - | ||||||||||||
| 19 | sct->version = SCT_VERSION_NOT_SET; | - | ||||||||||||
| 20 | return executed 14203 times by 1 test: sct; return sct;Executed by: 
 executed 14203 times by 1 test:  return sct;Executed by: 
 | 14203 | ||||||||||||
| 21 | } | - | ||||||||||||
| 22 | - | |||||||||||||
| 23 | void SCT_free(SCT *sct) | - | ||||||||||||
| 24 | { | - | ||||||||||||
| 25 | if (sct == 
 | 8-14203 | ||||||||||||
| 26 | ((void *)0) 
 | 8-14203 | ||||||||||||
| 27 | ) | - | ||||||||||||
| 28 | return; executed 8 times by 1 test:  return;Executed by: 
 | 8 | ||||||||||||
| 29 | - | |||||||||||||
| 30 | CRYPTO_free(sct->log_id, __FILE__, 41); | - | ||||||||||||
| 31 | CRYPTO_free(sct->ext, __FILE__, 42); | - | ||||||||||||
| 32 | CRYPTO_free(sct->sig, __FILE__, 43); | - | ||||||||||||
| 33 | CRYPTO_free(sct->sct, __FILE__, 44); | - | ||||||||||||
| 34 | CRYPTO_free(sct, __FILE__, 45); | - | ||||||||||||
| 35 | } executed 14203 times by 1 test:  end of blockExecuted by: 
 | 14203 | ||||||||||||
| 36 | - | |||||||||||||
| 37 | void SCT_LIST_free(struct stack_st_SCT *a) | - | ||||||||||||
| 38 | { | - | ||||||||||||
| 39 | sk_SCT_pop_free(a, SCT_free); | - | ||||||||||||
| 40 | } executed 12972 times by 1 test:  end of blockExecuted by: 
 | 12972 | ||||||||||||
| 41 | - | |||||||||||||
| 42 | int SCT_set_version(SCT *sct, sct_version_t version) | - | ||||||||||||
| 43 | { | - | ||||||||||||
| 44 | if (version != SCT_VERSION_V1 
 | 0-1 | ||||||||||||
| 45 | ERR_put_error(50,(104),(103),__FILE__,56); | - | ||||||||||||
| 46 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 47 | } | - | ||||||||||||
| 48 | sct->version = version; | - | ||||||||||||
| 49 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 50 | return executed 1 time by 1 test: 1; return 1;Executed by: 
 executed 1 time by 1 test:  return 1;Executed by: 
 | 1 | ||||||||||||
| 51 | } | - | ||||||||||||
| 52 | - | |||||||||||||
| 53 | int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type) | - | ||||||||||||
| 54 | { | - | ||||||||||||
| 55 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | switch (entry_type) { | - | ||||||||||||
| 58 | case executed 2721 times by 1 test: CT_LOG_ENTRY_TYPE_X509: case CT_LOG_ENTRY_TYPE_X509:Executed by: 
 executed 2721 times by 1 test:  case CT_LOG_ENTRY_TYPE_X509:Executed by: 
 | 2721 | ||||||||||||
| 59 | case executed 656 times by 1 test: CT_LOG_ENTRY_TYPE_PRECERT: case CT_LOG_ENTRY_TYPE_PRECERT:Executed by: 
 executed 656 times by 1 test:  case CT_LOG_ENTRY_TYPE_PRECERT:Executed by: 
 | 656 | ||||||||||||
| 60 | sct->entry_type = entry_type; | - | ||||||||||||
| 61 | return executed 3377 times by 1 test: 1; return 1;Executed by: 
 executed 3377 times by 1 test:  return 1;Executed by: 
 | 3377 | ||||||||||||
| 62 | case never executed: CT_LOG_ENTRY_TYPE_NOT_SET: case CT_LOG_ENTRY_TYPE_NOT_SET:never executed:  case CT_LOG_ENTRY_TYPE_NOT_SET: | 0 | ||||||||||||
| 63 | break; never executed:  break; | 0 | ||||||||||||
| 64 | } | - | ||||||||||||
| 65 | ERR_put_error(50,(102),(102),__FILE__,76); | - | ||||||||||||
| 66 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 67 | } | - | ||||||||||||
| 68 | - | |||||||||||||
| 69 | int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len) | - | ||||||||||||
| 70 | { | - | ||||||||||||
| 71 | if (sct->version == SCT_VERSION_V1 
 
 | 0-1 | ||||||||||||
| 72 | ERR_put_error(50,(101),(100),__FILE__,83); | - | ||||||||||||
| 73 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 74 | } | - | ||||||||||||
| 75 | - | |||||||||||||
| 76 | CRYPTO_free(sct->log_id, __FILE__, 87); | - | ||||||||||||
| 77 | sct->log_id = log_id; | - | ||||||||||||
| 78 | sct->log_id_len = log_id_len; | - | ||||||||||||
| 79 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 80 | return executed 1 time by 1 test: 1; return 1;Executed by: 
 executed 1 time by 1 test:  return 1;Executed by: 
 | 1 | ||||||||||||
| 81 | } | - | ||||||||||||
| 82 | - | |||||||||||||
| 83 | int SCT_set1_log_id(SCT *sct, const unsigned char *log_id, size_t log_id_len) | - | ||||||||||||
| 84 | { | - | ||||||||||||
| 85 | if (sct->version == SCT_VERSION_V1 
 
 | 0 | ||||||||||||
| 86 | ERR_put_error(50,(115),(100),__FILE__,97); | - | ||||||||||||
| 87 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 88 | } | - | ||||||||||||
| 89 | - | |||||||||||||
| 90 | CRYPTO_free(sct->log_id, __FILE__, 101); | - | ||||||||||||
| 91 | sct->log_id = | - | ||||||||||||
| 92 | ((void *)0) | - | ||||||||||||
| 93 | ; | - | ||||||||||||
| 94 | sct->log_id_len = 0; | - | ||||||||||||
| 95 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 96 | - | |||||||||||||
| 97 | if (log_id != 
 | 0 | ||||||||||||
| 98 | ((void *)0) 
 | 0 | ||||||||||||
| 99 | && log_id_len > 0 
 | 0 | ||||||||||||
| 100 | sct->log_id = CRYPTO_memdup((log_id), log_id_len, __FILE__, 107); | - | ||||||||||||
| 101 | if (sct->log_id == 
 | 0 | ||||||||||||
| 102 | ((void *)0) 
 | 0 | ||||||||||||
| 103 | ) { | - | ||||||||||||
| 104 | ERR_put_error(50,(115),((1|64)),__FILE__,109); | - | ||||||||||||
| 105 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 106 | } | - | ||||||||||||
| 107 | sct->log_id_len = log_id_len; | - | ||||||||||||
| 108 | } never executed:  end of block | 0 | ||||||||||||
| 109 | return never executed: 1; return 1;never executed:  return 1; | 0 | ||||||||||||
| 110 | } | - | ||||||||||||
| 111 | - | |||||||||||||
| 112 | - | |||||||||||||
| 113 | void SCT_set_timestamp(SCT *sct, uint64_t timestamp) | - | ||||||||||||
| 114 | { | - | ||||||||||||
| 115 | sct->timestamp = timestamp; | - | ||||||||||||
| 116 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 117 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||
| 118 | - | |||||||||||||
| 119 | int SCT_set_signature_nid(SCT *sct, int nid) | - | ||||||||||||
| 120 | { | - | ||||||||||||
| 121 | switch (nid) { | - | ||||||||||||
| 122 | case never executed: 668: case 668:never executed:  case 668: | 0 | ||||||||||||
| 123 | sct->hash_alg = 4; | - | ||||||||||||
| 124 | sct->sig_alg = 1; | - | ||||||||||||
| 125 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 126 | return never executed: 1; return 1;never executed:  return 1; | 0 | ||||||||||||
| 127 | case never executed: 794: case 794:never executed:  case 794: | 0 | ||||||||||||
| 128 | sct->hash_alg = 4; | - | ||||||||||||
| 129 | sct->sig_alg = 3; | - | ||||||||||||
| 130 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 131 | return never executed: 1; return 1;never executed:  return 1; | 0 | ||||||||||||
| 132 | default never executed: : default:never executed:  default: | 0 | ||||||||||||
| 133 | ERR_put_error(50,(103),(101),__FILE__,138); | - | ||||||||||||
| 134 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 135 | } | - | ||||||||||||
| 136 | } | - | ||||||||||||
| 137 | - | |||||||||||||
| 138 | void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len) | - | ||||||||||||
| 139 | { | - | ||||||||||||
| 140 | CRYPTO_free(sct->ext, __FILE__, 145); | - | ||||||||||||
| 141 | sct->ext = ext; | - | ||||||||||||
| 142 | sct->ext_len = ext_len; | - | ||||||||||||
| 143 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 144 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||
| 145 | - | |||||||||||||
| 146 | int SCT_set1_extensions(SCT *sct, const unsigned char *ext, size_t ext_len) | - | ||||||||||||
| 147 | { | - | ||||||||||||
| 148 | CRYPTO_free(sct->ext, __FILE__, 153); | - | ||||||||||||
| 149 | sct->ext = | - | ||||||||||||
| 150 | ((void *)0) | - | ||||||||||||
| 151 | ; | - | ||||||||||||
| 152 | sct->ext_len = 0; | - | ||||||||||||
| 153 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 154 | - | |||||||||||||
| 155 | if (ext != 
 | 0 | ||||||||||||
| 156 | ((void *)0) 
 | 0 | ||||||||||||
| 157 | && ext_len > 0 
 | 0 | ||||||||||||
| 158 | sct->ext = CRYPTO_memdup((ext), ext_len, __FILE__, 159); | - | ||||||||||||
| 159 | if (sct->ext == 
 | 0 | ||||||||||||
| 160 | ((void *)0) 
 | 0 | ||||||||||||
| 161 | ) { | - | ||||||||||||
| 162 | ERR_put_error(50,(114),((1|64)),__FILE__,161); | - | ||||||||||||
| 163 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 164 | } | - | ||||||||||||
| 165 | sct->ext_len = ext_len; | - | ||||||||||||
| 166 | } never executed:  end of block | 0 | ||||||||||||
| 167 | return never executed: 1; return 1;never executed:  return 1; | 0 | ||||||||||||
| 168 | } | - | ||||||||||||
| 169 | - | |||||||||||||
| 170 | void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len) | - | ||||||||||||
| 171 | { | - | ||||||||||||
| 172 | CRYPTO_free(sct->sig, __FILE__, 171); | - | ||||||||||||
| 173 | sct->sig = sig; | - | ||||||||||||
| 174 | sct->sig_len = sig_len; | - | ||||||||||||
| 175 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 176 | } never executed:  end of block | 0 | ||||||||||||
| 177 | - | |||||||||||||
| 178 | int SCT_set1_signature(SCT *sct, const unsigned char *sig, size_t sig_len) | - | ||||||||||||
| 179 | { | - | ||||||||||||
| 180 | CRYPTO_free(sct->sig, __FILE__, 179); | - | ||||||||||||
| 181 | sct->sig = | - | ||||||||||||
| 182 | ((void *)0) | - | ||||||||||||
| 183 | ; | - | ||||||||||||
| 184 | sct->sig_len = 0; | - | ||||||||||||
| 185 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 186 | - | |||||||||||||
| 187 | if (sig != 
 | 0-2362 | ||||||||||||
| 188 | ((void *)0) 
 | 0-2362 | ||||||||||||
| 189 | && sig_len > 0 
 | 761-1601 | ||||||||||||
| 190 | sct->sig = CRYPTO_memdup((sig), sig_len, __FILE__, 185); | - | ||||||||||||
| 191 | if (sct->sig == 
 | 0-761 | ||||||||||||
| 192 | ((void *)0) 
 | 0-761 | ||||||||||||
| 193 | ) { | - | ||||||||||||
| 194 | ERR_put_error(50,(116),((1|64)),__FILE__,187); | - | ||||||||||||
| 195 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 196 | } | - | ||||||||||||
| 197 | sct->sig_len = sig_len; | - | ||||||||||||
| 198 | } executed 761 times by 1 test:  end of blockExecuted by: 
 | 761 | ||||||||||||
| 199 | return executed 2362 times by 1 test: 1; return 1;Executed by: 
 executed 2362 times by 1 test:  return 1;Executed by: 
 | 2362 | ||||||||||||
| 200 | } | - | ||||||||||||
| 201 | - | |||||||||||||
| 202 | sct_version_t SCT_get_version(const SCT *sct) | - | ||||||||||||
| 203 | { | - | ||||||||||||
| 204 | return never executed: sct->version; return sct->version;never executed:  return sct->version; | 0 | ||||||||||||
| 205 | } | - | ||||||||||||
| 206 | - | |||||||||||||
| 207 | ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct) | - | ||||||||||||
| 208 | { | - | ||||||||||||
| 209 | return executed 9 times by 1 test: sct->entry_type; return sct->entry_type;Executed by: 
 executed 9 times by 1 test:  return sct->entry_type;Executed by: 
 | 9 | ||||||||||||
| 210 | } | - | ||||||||||||
| 211 | - | |||||||||||||
| 212 | size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id) | - | ||||||||||||
| 213 | { | - | ||||||||||||
| 214 | *log_id = sct->log_id; | - | ||||||||||||
| 215 | return never executed: sct->log_id_len; return sct->log_id_len;never executed:  return sct->log_id_len; | 0 | ||||||||||||
| 216 | } | - | ||||||||||||
| 217 | - | |||||||||||||
| 218 | uint64_t SCT_get_timestamp(const SCT *sct) | - | ||||||||||||
| 219 | { | - | ||||||||||||
| 220 | return never executed: sct->timestamp; return sct->timestamp;never executed:  return sct->timestamp; | 0 | ||||||||||||
| 221 | } | - | ||||||||||||
| 222 | - | |||||||||||||
| 223 | int SCT_get_signature_nid(const SCT *sct) | - | ||||||||||||
| 224 | { | - | ||||||||||||
| 225 | if (sct->version == SCT_VERSION_V1 
 | 0-6573 | ||||||||||||
| 226 | if (sct->hash_alg == 4 
 | 68-6505 | ||||||||||||
| 227 | switch (sct->sig_alg) { | - | ||||||||||||
| 228 | case executed 3152 times by 1 test: 3: case 3:Executed by: 
 executed 3152 times by 1 test:  case 3:Executed by: 
 | 3152 | ||||||||||||
| 229 | return executed 3152 times by 1 test: 794; return 794;Executed by: 
 executed 3152 times by 1 test:  return 794;Executed by: 
 | 3152 | ||||||||||||
| 230 | case executed 3324 times by 1 test: 1: case 1:Executed by: 
 executed 3324 times by 1 test:  case 1:Executed by: 
 | 3324 | ||||||||||||
| 231 | return executed 3324 times by 1 test: 668; return 668;Executed by: 
 executed 3324 times by 1 test:  return 668;Executed by: 
 | 3324 | ||||||||||||
| 232 | default executed 29 times by 1 test: : default:Executed by: 
 executed 29 times by 1 test:  default:Executed by: 
 | 29 | ||||||||||||
| 233 | return executed 29 times by 1 test: 0; return 0;Executed by: 
 executed 29 times by 1 test:  return 0;Executed by: 
 | 29 | ||||||||||||
| 234 | } | - | ||||||||||||
| 235 | } | - | ||||||||||||
| 236 | } executed 68 times by 1 test:  end of blockExecuted by: 
 | 68 | ||||||||||||
| 237 | return executed 68 times by 1 test: 0; return 0;Executed by: 
 executed 68 times by 1 test:  return 0;Executed by: 
 | 68 | ||||||||||||
| 238 | } | - | ||||||||||||
| 239 | - | |||||||||||||
| 240 | size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext) | - | ||||||||||||
| 241 | { | - | ||||||||||||
| 242 | *ext = sct->ext; | - | ||||||||||||
| 243 | return never executed: sct->ext_len; return sct->ext_len;never executed:  return sct->ext_len; | 0 | ||||||||||||
| 244 | } | - | ||||||||||||
| 245 | - | |||||||||||||
| 246 | size_t SCT_get0_signature(const SCT *sct, unsigned char **sig) | - | ||||||||||||
| 247 | { | - | ||||||||||||
| 248 | *sig = sct->sig; | - | ||||||||||||
| 249 | return never executed: sct->sig_len; return sct->sig_len;never executed:  return sct->sig_len; | 0 | ||||||||||||
| 250 | } | - | ||||||||||||
| 251 | - | |||||||||||||
| 252 | int SCT_is_complete(const SCT *sct) | - | ||||||||||||
| 253 | { | - | ||||||||||||
| 254 | switch (sct->version) { | - | ||||||||||||
| 255 | case never executed: SCT_VERSION_NOT_SET: case SCT_VERSION_NOT_SET:never executed:  case SCT_VERSION_NOT_SET: | 0 | ||||||||||||
| 256 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 257 | case executed 1154 times by 1 test: SCT_VERSION_V1: case SCT_VERSION_V1:Executed by: 
 executed 1154 times by 1 test:  case SCT_VERSION_V1:Executed by: 
 | 1154 | ||||||||||||
| 258 | return executed 1154 times by 1 test: sct->log_id != return sct->log_id != ((void *)0) && SCT_signature_is_complete(sct);Executed by: 
 
 executed 1154 times by 1 test:  return sct->log_id != ((void *)0) && SCT_signature_is_complete(sct);Executed by: 
 | 0-1154 | ||||||||||||
| 259 | ((void *)0) 
 executed 1154 times by 1 test:  return sct->log_id != ((void *)0) && SCT_signature_is_complete(sct);Executed by: 
 | 0-1154 | ||||||||||||
| 260 | && SCT_signature_is_complete(sct) 
 executed 1154 times by 1 test:  return sct->log_id != ((void *)0) && SCT_signature_is_complete(sct);Executed by: 
 | 20-1154 | ||||||||||||
| 261 | default executed 8860 times by 1 test: : default:Executed by: 
 executed 8860 times by 1 test:  default:Executed by: 
 | 8860 | ||||||||||||
| 262 | return executed 8860 times by 1 test: sct->sct != return sct->sct != ((void *)0) ;Executed by: 
 executed 8860 times by 1 test:  return sct->sct != ((void *)0) ;Executed by: 
 | 8860 | ||||||||||||
| 263 | ((void *)0) executed 8860 times by 1 test:  return sct->sct != ((void *)0) ;Executed by: 
 | 8860 | ||||||||||||
| 264 | ; executed 8860 times by 1 test:  return sct->sct != ((void *)0) ;Executed by: 
 | 8860 | ||||||||||||
| 265 | } | - | ||||||||||||
| 266 | } | - | ||||||||||||
| 267 | - | |||||||||||||
| 268 | int SCT_signature_is_complete(const SCT *sct) | - | ||||||||||||
| 269 | { | - | ||||||||||||
| 270 | return executed 1703 times by 1 test: SCT_get_signature_nid(sct) != 0 return SCT_get_signature_nid(sct) != 0 && sct->sig != ((void *)0) && sct->sig_len > 0;Executed by: 
 
 executed 1703 times by 1 test:  return SCT_get_signature_nid(sct) != 0 && sct->sig != ((void *)0) && sct->sig_len > 0;Executed by: 
 | 0-1703 | ||||||||||||
| 271 | sct->sig != 
 executed 1703 times by 1 test:  return SCT_get_signature_nid(sct) != 0 && sct->sig != ((void *)0) && sct->sig_len > 0;Executed by: 
 | 20-1703 | ||||||||||||
| 272 | ((void *)0) 
 executed 1703 times by 1 test:  return SCT_get_signature_nid(sct) != 0 && sct->sig != ((void *)0) && sct->sig_len > 0;Executed by: 
 | 20-1703 | ||||||||||||
| 273 | && sct->sig_len > 0 
 executed 1703 times by 1 test:  return SCT_get_signature_nid(sct) != 0 && sct->sig != ((void *)0) && sct->sig_len > 0;Executed by: 
 | 0-1703 | ||||||||||||
| 274 | } | - | ||||||||||||
| 275 | - | |||||||||||||
| 276 | sct_source_t SCT_get_source(const SCT *sct) | - | ||||||||||||
| 277 | { | - | ||||||||||||
| 278 | return executed 9 times by 1 test: sct->source; return sct->source;Executed by: 
 executed 9 times by 1 test:  return sct->source;Executed by: 
 | 9 | ||||||||||||
| 279 | } | - | ||||||||||||
| 280 | - | |||||||||||||
| 281 | int SCT_set_source(SCT *sct, sct_source_t source) | - | ||||||||||||
| 282 | { | - | ||||||||||||
| 283 | sct->source = source; | - | ||||||||||||
| 284 | sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; | - | ||||||||||||
| 285 | switch (source) { | - | ||||||||||||
| 286 | case executed 2 times by 1 test: SCT_SOURCE_TLS_EXTENSION: case SCT_SOURCE_TLS_EXTENSION:Executed by: 
 executed 2 times by 1 test:  case SCT_SOURCE_TLS_EXTENSION:Executed by: 
 | 2 | ||||||||||||
| 287 | case executed 2718 times by 1 test: SCT_SOURCE_OCSP_STAPLED_RESPONSE: case SCT_SOURCE_OCSP_STAPLED_RESPONSE:Executed by: 
 executed 2718 times by 1 test:  case SCT_SOURCE_OCSP_STAPLED_RESPONSE:Executed by: 
 | 2718 | ||||||||||||
| 288 | return executed 2720 times by 1 test: SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_X509); return SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_X509);Executed by: 
 executed 2720 times by 1 test:  return SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_X509);Executed by: 
 | 2720 | ||||||||||||
| 289 | case executed 656 times by 1 test: SCT_SOURCE_X509V3_EXTENSION: case SCT_SOURCE_X509V3_EXTENSION:Executed by: 
 executed 656 times by 1 test:  case SCT_SOURCE_X509V3_EXTENSION:Executed by: 
 | 656 | ||||||||||||
| 290 | return executed 656 times by 1 test: SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_PRECERT); return SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_PRECERT);Executed by: 
 executed 656 times by 1 test:  return SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_PRECERT);Executed by: 
 | 656 | ||||||||||||
| 291 | case never executed: SCT_SOURCE_UNKNOWN: case SCT_SOURCE_UNKNOWN:never executed:  case SCT_SOURCE_UNKNOWN: | 0 | ||||||||||||
| 292 | break; never executed:  break; | 0 | ||||||||||||
| 293 | } | - | ||||||||||||
| 294 | - | |||||||||||||
| 295 | return never executed: 1; return 1;never executed:  return 1; | 0 | ||||||||||||
| 296 | } | - | ||||||||||||
| 297 | - | |||||||||||||
| 298 | sct_validation_status_t SCT_get_validation_status(const SCT *sct) | - | ||||||||||||
| 299 | { | - | ||||||||||||
| 300 | return executed 9 times by 1 test: sct->validation_status; return sct->validation_status;Executed by: 
 executed 9 times by 1 test:  return sct->validation_status;Executed by: 
 | 9 | ||||||||||||
| 301 | } | - | ||||||||||||
| 302 | - | |||||||||||||
| 303 | int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx) | - | ||||||||||||
| 304 | { | - | ||||||||||||
| 305 | int is_sct_valid = -1; | - | ||||||||||||
| 306 | SCT_CTX *sctx = | - | ||||||||||||
| 307 | ((void *)0) | - | ||||||||||||
| 308 | ; | - | ||||||||||||
| 309 | X509_PUBKEY *pub = | - | ||||||||||||
| 310 | ((void *)0) | - | ||||||||||||
| 311 | , *log_pkey = | - | ||||||||||||
| 312 | ((void *)0) | - | ||||||||||||
| 313 | ; | - | ||||||||||||
| 314 | const CTLOG *log; | - | ||||||||||||
| 315 | - | |||||||||||||
| 316 | - | |||||||||||||
| 317 | - | |||||||||||||
| 318 | - | |||||||||||||
| 319 | - | |||||||||||||
| 320 | if (sct->version != SCT_VERSION_V1 
 | 0-9 | ||||||||||||
| 321 | sct->validation_status = SCT_VALIDATION_STATUS_UNKNOWN_VERSION; | - | ||||||||||||
| 322 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 323 | } | - | ||||||||||||
| 324 | - | |||||||||||||
| 325 | log = CTLOG_STORE_get0_log_by_id(ctx->log_store, | - | ||||||||||||
| 326 | sct->log_id, sct->log_id_len); | - | ||||||||||||
| 327 | - | |||||||||||||
| 328 | - | |||||||||||||
| 329 | if (log == 
 | 0-9 | ||||||||||||
| 330 | ((void *)0) 
 | 0-9 | ||||||||||||
| 331 | ) { | - | ||||||||||||
| 332 | sct->validation_status = SCT_VALIDATION_STATUS_UNKNOWN_LOG; | - | ||||||||||||
| 333 | return never executed: 0; return 0;never executed:  return 0; | 0 | ||||||||||||
| 334 | } | - | ||||||||||||
| 335 | - | |||||||||||||
| 336 | sctx = SCT_CTX_new(); | - | ||||||||||||
| 337 | if (sctx == 
 | 0-9 | ||||||||||||
| 338 | ((void *)0) 
 | 0-9 | ||||||||||||
| 339 | ) | - | ||||||||||||
| 340 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||
| 341 | - | |||||||||||||
| 342 | if (X509_PUBKEY_set(&log_pkey, CTLOG_get0_public_key(log)) != 1 
 | 0-9 | ||||||||||||
| 343 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||
| 344 | if (SCT_CTX_set1_pubkey(sctx, log_pkey) != 1 
 | 0-9 | ||||||||||||
| 345 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||
| 346 | - | |||||||||||||
| 347 | if (SCT_get_log_entry_type(sct) == CT_LOG_ENTRY_TYPE_PRECERT 
 | 0-9 | ||||||||||||
| 348 | EVP_PKEY *issuer_pkey; | - | ||||||||||||
| 349 | - | |||||||||||||
| 350 | if (ctx->issuer == 
 | 0-9 | ||||||||||||
| 351 | ((void *)0) 
 | 0-9 | ||||||||||||
| 352 | ) { | - | ||||||||||||
| 353 | sct->validation_status = SCT_VALIDATION_STATUS_UNVERIFIED; | - | ||||||||||||
| 354 | goto never executed: end; goto end;never executed:  goto end; | 0 | ||||||||||||
| 355 | } | - | ||||||||||||
| 356 | - | |||||||||||||
| 357 | issuer_pkey = X509_get0_pubkey(ctx->issuer); | - | ||||||||||||
| 358 | - | |||||||||||||
| 359 | if (X509_PUBKEY_set(&pub, issuer_pkey) != 1 
 | 0-9 | ||||||||||||
| 360 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||
| 361 | if (SCT_CTX_set1_issuer_pubkey(sctx, pub) != 1 
 | 0-9 | ||||||||||||
| 362 | goto never executed: err; goto err;never executed:  goto err; | 0 | ||||||||||||
| 363 | } executed 9 times by 1 test:  end of blockExecuted by: 
 | 9 | ||||||||||||
| 364 | - | |||||||||||||
| 365 | SCT_CTX_set_time(sctx, ctx->epoch_time_in_ms); | - | ||||||||||||
| 366 | if (SCT_CTX_set1_cert(sctx, ctx->cert, 
 | 0-9 | ||||||||||||
| 367 | ((void *)0) 
 | 0-9 | ||||||||||||
| 368 | ) != 1 
 | 0-9 | ||||||||||||
| 369 | sct->validation_status = SCT_VALIDATION_STATUS_UNVERIFIED; never executed:  sct->validation_status = SCT_VALIDATION_STATUS_UNVERIFIED; | 0 | ||||||||||||
| 370 | else | - | ||||||||||||
| 371 | sct->validation_status = SCT_CTX_verify(sctx, sct) == 1 
 executed 9 times by 1 test:  sct->validation_status = SCT_CTX_verify(sctx, sct) == 1 ? SCT_VALIDATION_STATUS_VALID : SCT_VALIDATION_STATUS_INVALID;Executed by: 
 | 1-9 | ||||||||||||
| 372 | SCT_VALIDATION_STATUS_VALID : SCT_VALIDATION_STATUS_INVALID; executed 9 times by 1 test:  sct->validation_status = SCT_CTX_verify(sctx, sct) == 1 ? SCT_VALIDATION_STATUS_VALID : SCT_VALIDATION_STATUS_INVALID;Executed by: 
 | 9 | ||||||||||||
| 373 | - | |||||||||||||
| 374 | end: code before this statement executed 9 times by 1 test:  end:Executed by: 
 | 9 | ||||||||||||
| 375 | is_sct_valid = sct->validation_status == SCT_VALIDATION_STATUS_VALID; | - | ||||||||||||
| 376 | err: code before this statement executed 9 times by 1 test:  err:Executed by: 
 | 9 | ||||||||||||
| 377 | X509_PUBKEY_free(pub); | - | ||||||||||||
| 378 | X509_PUBKEY_free(log_pkey); | - | ||||||||||||
| 379 | SCT_CTX_free(sctx); | - | ||||||||||||
| 380 | - | |||||||||||||
| 381 | return executed 9 times by 1 test: is_sct_valid; return is_sct_valid;Executed by: 
 executed 9 times by 1 test:  return is_sct_valid;Executed by: 
 | 9 | ||||||||||||
| 382 | } | - | ||||||||||||
| 383 | - | |||||||||||||
| 384 | int SCT_LIST_validate(const struct stack_st_SCT *scts, CT_POLICY_EVAL_CTX *ctx) | - | ||||||||||||
| 385 | { | - | ||||||||||||
| 386 | int are_scts_valid = 1; | - | ||||||||||||
| 387 | int sct_count = scts != 
 | 0-9 | ||||||||||||
| 388 | ((void *)0) 
 | 0-9 | ||||||||||||
| 389 | ? sk_SCT_num(scts) : 0; | - | ||||||||||||
| 390 | int i; | - | ||||||||||||
| 391 | - | |||||||||||||
| 392 | for (i = 0; i < sct_count 
 | 9 | ||||||||||||
| 393 | int is_sct_valid = -1; | - | ||||||||||||
| 394 | SCT *sct = sk_SCT_value(scts, i); | - | ||||||||||||
| 395 | - | |||||||||||||
| 396 | if (sct == 
 | 0-9 | ||||||||||||
| 397 | ((void *)0) 
 | 0-9 | ||||||||||||
| 398 | ) | - | ||||||||||||
| 399 | continue; never executed:  continue; | 0 | ||||||||||||
| 400 | - | |||||||||||||
| 401 | is_sct_valid = SCT_validate(sct, ctx); | - | ||||||||||||
| 402 | if (is_sct_valid < 0 
 | 0-9 | ||||||||||||
| 403 | return never executed: is_sct_valid; return is_sct_valid;never executed:  return is_sct_valid; | 0 | ||||||||||||
| 404 | are_scts_valid &= is_sct_valid; | - | ||||||||||||
| 405 | } executed 9 times by 1 test:  end of blockExecuted by: 
 | 9 | ||||||||||||
| 406 | - | |||||||||||||
| 407 | return executed 9 times by 1 test: are_scts_valid; return are_scts_valid;Executed by: 
 executed 9 times by 1 test:  return are_scts_valid;Executed by: 
 | 9 | ||||||||||||
| 408 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |