| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/ssl_cert.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx, | - | ||||||||||||||||||
| 7 | int op, int bits, int nid, void *other, | - | ||||||||||||||||||
| 8 | void *ex); | - | ||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | static CRYPTO_ONCE ssl_x509_store_ctx_once = | - | ||||||||||||||||||
| 11 | 0 | - | ||||||||||||||||||
| 12 | ; | - | ||||||||||||||||||
| 13 | static volatile int ssl_x509_store_ctx_idx = -1; | - | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | static int ssl_x509_store_ctx_init(void); static int ssl_x509_store_ctx_init_ossl_ret_ = 0; static void ssl_x509_store_ctx_init_ossl_(void) { ssl_x509_store_ctx_init_ossl_ret_ = ssl_x509_store_ctx_init(); } executed 539 times by 2 tests: static int ssl_x509_store_ctx_init(void)end of blockExecuted by:
| 539 | ||||||||||||||||||
| 16 | { | - | ||||||||||||||||||
| 17 | ssl_x509_store_ctx_idx = CRYPTO_get_ex_new_index(5, 0, "SSL for verify callback", | - | ||||||||||||||||||
| 18 | ((void *)0) | - | ||||||||||||||||||
| 19 | , | - | ||||||||||||||||||
| 20 | ((void *)0) | - | ||||||||||||||||||
| 21 | , | - | ||||||||||||||||||
| 22 | ((void *)0) | - | ||||||||||||||||||
| 23 | ) | - | ||||||||||||||||||
| 24 | - | |||||||||||||||||||
| 25 | ; | - | ||||||||||||||||||
| 26 | return executed 539 times by 2 tests: ssl_x509_store_ctx_idx >= 0;return ssl_x509_store_ctx_idx >= 0;Executed by:
executed 539 times by 2 tests: return ssl_x509_store_ctx_idx >= 0;Executed by:
| 539 | ||||||||||||||||||
| 27 | } | - | ||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | int SSL_get_ex_data_X509_STORE_CTX_idx(void) | - | ||||||||||||||||||
| 30 | { | - | ||||||||||||||||||
| 31 | - | |||||||||||||||||||
| 32 | if (!(CRYPTO_THREAD_run_once(&ssl_x509_store_ctx_once, ssl_x509_store_ctx_init_ossl_)
| 0-10679 | ||||||||||||||||||
| 33 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||
| 34 | return executed 10679 times by 2 tests: ssl_x509_store_ctx_idx;return ssl_x509_store_ctx_idx;Executed by:
executed 10679 times by 2 tests: return ssl_x509_store_ctx_idx;Executed by:
| 10679 | ||||||||||||||||||
| 35 | } | - | ||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | CERT *ssl_cert_new(void) | - | ||||||||||||||||||
| 38 | { | - | ||||||||||||||||||
| 39 | CERT *ret = CRYPTO_zalloc(sizeof(*ret), __FILE__, 52); | - | ||||||||||||||||||
| 40 | - | |||||||||||||||||||
| 41 | if (ret ==
| 0-8017 | ||||||||||||||||||
| 42 | ((void *)0)
| 0-8017 | ||||||||||||||||||
| 43 | ) { | - | ||||||||||||||||||
| 44 | ERR_put_error(20,(162),((1|64)),__FILE__,55); | - | ||||||||||||||||||
| 45 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 46 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 47 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 48 | } | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | ret->key = &(ret->pkeys[0]); | - | ||||||||||||||||||
| 51 | ret->references = 1; | - | ||||||||||||||||||
| 52 | ret->sec_cb = ssl_security_default_callback; | - | ||||||||||||||||||
| 53 | ret->sec_level = 1; | - | ||||||||||||||||||
| 54 | ret->sec_ex = | - | ||||||||||||||||||
| 55 | ((void *)0) | - | ||||||||||||||||||
| 56 | ; | - | ||||||||||||||||||
| 57 | ret->lock = CRYPTO_THREAD_lock_new(); | - | ||||||||||||||||||
| 58 | if (ret->lock ==
| 0-8017 | ||||||||||||||||||
| 59 | ((void *)0)
| 0-8017 | ||||||||||||||||||
| 60 | ) { | - | ||||||||||||||||||
| 61 | ERR_put_error(20,(162),((1|64)),__FILE__,66); | - | ||||||||||||||||||
| 62 | CRYPTO_free(ret, __FILE__, 67); | - | ||||||||||||||||||
| 63 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 64 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 65 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 66 | } | - | ||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | return executed 8017 times by 2 tests: ret;return ret;Executed by:
executed 8017 times by 2 tests: return ret;Executed by:
| 8017 | ||||||||||||||||||
| 69 | } | - | ||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | CERT *ssl_cert_dup(CERT *cert) | - | ||||||||||||||||||
| 72 | { | - | ||||||||||||||||||
| 73 | CERT *ret = CRYPTO_zalloc(sizeof(*ret), __FILE__, 76); | - | ||||||||||||||||||
| 74 | int i; | - | ||||||||||||||||||
| 75 | - | |||||||||||||||||||
| 76 | if (ret ==
| 0-8278 | ||||||||||||||||||
| 77 | ((void *)0)
| 0-8278 | ||||||||||||||||||
| 78 | ) { | - | ||||||||||||||||||
| 79 | ERR_put_error(20,(221),((1|64)),__FILE__,80); | - | ||||||||||||||||||
| 80 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 81 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 82 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 83 | } | - | ||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | ret->references = 1; | - | ||||||||||||||||||
| 86 | ret->key = &ret->pkeys[cert->key - cert->pkeys]; | - | ||||||||||||||||||
| 87 | ret->lock = CRYPTO_THREAD_lock_new(); | - | ||||||||||||||||||
| 88 | if (ret->lock ==
| 0-8278 | ||||||||||||||||||
| 89 | ((void *)0)
| 0-8278 | ||||||||||||||||||
| 90 | ) { | - | ||||||||||||||||||
| 91 | ERR_put_error(20,(221),((1|64)),__FILE__,88); | - | ||||||||||||||||||
| 92 | CRYPTO_free(ret, __FILE__, 89); | - | ||||||||||||||||||
| 93 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 94 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 95 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 96 | } | - | ||||||||||||||||||
| 97 | - | |||||||||||||||||||
| 98 | if (cert->dh_tmp !=
| 116-8162 | ||||||||||||||||||
| 99 | ((void *)0)
| 116-8162 | ||||||||||||||||||
| 100 | ) { | - | ||||||||||||||||||
| 101 | ret->dh_tmp = cert->dh_tmp; | - | ||||||||||||||||||
| 102 | EVP_PKEY_up_ref(ret->dh_tmp); | - | ||||||||||||||||||
| 103 | } executed 116 times by 1 test: end of blockExecuted by:
| 116 | ||||||||||||||||||
| 104 | ret->dh_tmp_cb = cert->dh_tmp_cb; | - | ||||||||||||||||||
| 105 | ret->dh_tmp_auto = cert->dh_tmp_auto; | - | ||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | for (i = 0; i < 9
| 8278-74502 | ||||||||||||||||||
| 109 | CERT_PKEY *cpk = cert->pkeys + i; | - | ||||||||||||||||||
| 110 | CERT_PKEY *rpk = ret->pkeys + i; | - | ||||||||||||||||||
| 111 | if (cpk->x509 !=
| 7858-66644 | ||||||||||||||||||
| 112 | ((void *)0)
| 7858-66644 | ||||||||||||||||||
| 113 | ) { | - | ||||||||||||||||||
| 114 | rpk->x509 = cpk->x509; | - | ||||||||||||||||||
| 115 | X509_up_ref(rpk->x509); | - | ||||||||||||||||||
| 116 | } executed 7858 times by 1 test: end of blockExecuted by:
| 7858 | ||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | if (cpk->privatekey !=
| 7858-66644 | ||||||||||||||||||
| 119 | ((void *)0)
| 7858-66644 | ||||||||||||||||||
| 120 | ) { | - | ||||||||||||||||||
| 121 | rpk->privatekey = cpk->privatekey; | - | ||||||||||||||||||
| 122 | EVP_PKEY_up_ref(cpk->privatekey); | - | ||||||||||||||||||
| 123 | } executed 7858 times by 1 test: end of blockExecuted by:
| 7858 | ||||||||||||||||||
| 124 | - | |||||||||||||||||||
| 125 | if (cpk->chain
| 36-74466 | ||||||||||||||||||
| 126 | rpk->chain = X509_chain_up_ref(cpk->chain); | - | ||||||||||||||||||
| 127 | if (!rpk->chain
| 0-36 | ||||||||||||||||||
| 128 | ERR_put_error(20,(221),((1|64)),__FILE__,117); | - | ||||||||||||||||||
| 129 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 130 | } | - | ||||||||||||||||||
| 131 | } executed 36 times by 1 test: end of blockExecuted by:
| 36 | ||||||||||||||||||
| 132 | if (cert->pkeys[i].serverinfo !=
| 7-74495 | ||||||||||||||||||
| 133 | ((void *)0)
| 7-74495 | ||||||||||||||||||
| 134 | ) { | - | ||||||||||||||||||
| 135 | - | |||||||||||||||||||
| 136 | ret->pkeys[i].serverinfo = | - | ||||||||||||||||||
| 137 | CRYPTO_malloc(cert->pkeys[i].serverinfo_length, __FILE__, 124); | - | ||||||||||||||||||
| 138 | if (ret->pkeys[i].serverinfo ==
| 0-7 | ||||||||||||||||||
| 139 | ((void *)0)
| 0-7 | ||||||||||||||||||
| 140 | ) { | - | ||||||||||||||||||
| 141 | ERR_put_error(20,(221),((1|64)),__FILE__,126); | - | ||||||||||||||||||
| 142 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 143 | } | - | ||||||||||||||||||
| 144 | ret->pkeys[i].serverinfo_length = cert->pkeys[i].serverinfo_length; | - | ||||||||||||||||||
| 145 | memcpy(ret->pkeys[i].serverinfo, | - | ||||||||||||||||||
| 146 | cert->pkeys[i].serverinfo, cert->pkeys[i].serverinfo_length); | - | ||||||||||||||||||
| 147 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||
| 148 | } executed 74502 times by 2 tests: end of blockExecuted by:
| 74502 | ||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | if (cert->conf_sigalgs
| 41-8237 | ||||||||||||||||||
| 152 | ret->conf_sigalgs = CRYPTO_malloc(cert->conf_sigalgslen * sizeof(*cert->conf_sigalgs), | - | ||||||||||||||||||
| 153 | __FILE__ | - | ||||||||||||||||||
| 154 | , | - | ||||||||||||||||||
| 155 | 138 | - | ||||||||||||||||||
| 156 | ) | - | ||||||||||||||||||
| 157 | ; | - | ||||||||||||||||||
| 158 | if (ret->conf_sigalgs ==
| 0-41 | ||||||||||||||||||
| 159 | ((void *)0)
| 0-41 | ||||||||||||||||||
| 160 | ) | - | ||||||||||||||||||
| 161 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 162 | memcpy(ret->conf_sigalgs, cert->conf_sigalgs, | - | ||||||||||||||||||
| 163 | cert->conf_sigalgslen * sizeof(*cert->conf_sigalgs)); | - | ||||||||||||||||||
| 164 | ret->conf_sigalgslen = cert->conf_sigalgslen; | - | ||||||||||||||||||
| 165 | } executed 41 times by 1 test: elseend of blockExecuted by:
| 41 | ||||||||||||||||||
| 166 | ret->conf_sigalgs = executed 8237 times by 2 tests: ret->conf_sigalgs = ((void *)0) ;Executed by:
| 8237 | ||||||||||||||||||
| 167 | ((void *)0) executed 8237 times by 2 tests: ret->conf_sigalgs = ((void *)0) ;Executed by:
| 8237 | ||||||||||||||||||
| 168 | ; executed 8237 times by 2 tests: ret->conf_sigalgs = ((void *)0) ;Executed by:
| 8237 | ||||||||||||||||||
| 169 | - | |||||||||||||||||||
| 170 | if (cert->client_sigalgs
| 11-8267 | ||||||||||||||||||
| 171 | ret->client_sigalgs = CRYPTO_malloc(cert->client_sigalgslen * sizeof(*cert->client_sigalgs), | - | ||||||||||||||||||
| 172 | __FILE__ | - | ||||||||||||||||||
| 173 | , | - | ||||||||||||||||||
| 174 | 149 | - | ||||||||||||||||||
| 175 | ) | - | ||||||||||||||||||
| 176 | ; | - | ||||||||||||||||||
| 177 | if (ret->client_sigalgs ==
| 0-11 | ||||||||||||||||||
| 178 | ((void *)0)
| 0-11 | ||||||||||||||||||
| 179 | ) | - | ||||||||||||||||||
| 180 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 181 | memcpy(ret->client_sigalgs, cert->client_sigalgs, | - | ||||||||||||||||||
| 182 | cert->client_sigalgslen * sizeof(*cert->client_sigalgs)); | - | ||||||||||||||||||
| 183 | ret->client_sigalgslen = cert->client_sigalgslen; | - | ||||||||||||||||||
| 184 | } executed 11 times by 1 test: elseend of blockExecuted by:
| 11 | ||||||||||||||||||
| 185 | ret->client_sigalgs = executed 8267 times by 2 tests: ret->client_sigalgs = ((void *)0) ;Executed by:
| 8267 | ||||||||||||||||||
| 186 | ((void *)0) executed 8267 times by 2 tests: ret->client_sigalgs = ((void *)0) ;Executed by:
| 8267 | ||||||||||||||||||
| 187 | ; executed 8267 times by 2 tests: ret->client_sigalgs = ((void *)0) ;Executed by:
| 8267 | ||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | ret->shared_sigalgs = | - | ||||||||||||||||||
| 190 | ((void *)0) | - | ||||||||||||||||||
| 191 | ; | - | ||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | if (cert->ctype
| 0-8278 | ||||||||||||||||||
| 194 | ret->ctype = CRYPTO_memdup((cert->ctype), cert->ctype_len, __FILE__, 161); | - | ||||||||||||||||||
| 195 | if (ret->ctype ==
| 0 | ||||||||||||||||||
| 196 | ((void *)0)
| 0 | ||||||||||||||||||
| 197 | ) | - | ||||||||||||||||||
| 198 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 199 | ret->ctype_len = cert->ctype_len; | - | ||||||||||||||||||
| 200 | } never executed: end of block | 0 | ||||||||||||||||||
| 201 | - | |||||||||||||||||||
| 202 | ret->cert_flags = cert->cert_flags; | - | ||||||||||||||||||
| 203 | - | |||||||||||||||||||
| 204 | ret->cert_cb = cert->cert_cb; | - | ||||||||||||||||||
| 205 | ret->cert_cb_arg = cert->cert_cb_arg; | - | ||||||||||||||||||
| 206 | - | |||||||||||||||||||
| 207 | if (cert->verify_store
| 1239-7039 | ||||||||||||||||||
| 208 | X509_STORE_up_ref(cert->verify_store); | - | ||||||||||||||||||
| 209 | ret->verify_store = cert->verify_store; | - | ||||||||||||||||||
| 210 | } executed 1239 times by 1 test: end of blockExecuted by:
| 1239 | ||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | if (cert->chain_store
| 0-8278 | ||||||||||||||||||
| 213 | X509_STORE_up_ref(cert->chain_store); | - | ||||||||||||||||||
| 214 | ret->chain_store = cert->chain_store; | - | ||||||||||||||||||
| 215 | } never executed: end of block | 0 | ||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | ret->sec_cb = cert->sec_cb; | - | ||||||||||||||||||
| 218 | ret->sec_level = cert->sec_level; | - | ||||||||||||||||||
| 219 | ret->sec_ex = cert->sec_ex; | - | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | if (!custom_exts_copy(&ret->custext, &cert->custext)
| 0-8278 | ||||||||||||||||||
| 222 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 223 | - | |||||||||||||||||||
| 224 | if (cert->psk_identity_hint
| 2-8276 | ||||||||||||||||||
| 225 | ret->psk_identity_hint = CRYPTO_strdup(cert->psk_identity_hint, __FILE__, 190); | - | ||||||||||||||||||
| 226 | if (ret->psk_identity_hint ==
| 0-2 | ||||||||||||||||||
| 227 | ((void *)0)
| 0-2 | ||||||||||||||||||
| 228 | ) | - | ||||||||||||||||||
| 229 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 230 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 231 | - | |||||||||||||||||||
| 232 | return executed 8278 times by 2 tests: ret;return ret;Executed by:
executed 8278 times by 2 tests: return ret;Executed by:
| 8278 | ||||||||||||||||||
| 233 | - | |||||||||||||||||||
| 234 | err: | - | ||||||||||||||||||
| 235 | ssl_cert_free(ret); | - | ||||||||||||||||||
| 236 | - | |||||||||||||||||||
| 237 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 238 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 239 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 240 | } | - | ||||||||||||||||||
| 241 | - | |||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | void ssl_cert_clear_certs(CERT *c) | - | ||||||||||||||||||
| 245 | { | - | ||||||||||||||||||
| 246 | int i; | - | ||||||||||||||||||
| 247 | if (c ==
| 0-16295 | ||||||||||||||||||
| 248 | ((void *)0)
| 0-16295 | ||||||||||||||||||
| 249 | ) | - | ||||||||||||||||||
| 250 | return; never executed: return; | 0 | ||||||||||||||||||
| 251 | for (i = 0; i < 9
| 16295-146655 | ||||||||||||||||||
| 252 | CERT_PKEY *cpk = c->pkeys + i; | - | ||||||||||||||||||
| 253 | X509_free(cpk->x509); | - | ||||||||||||||||||
| 254 | cpk->x509 = | - | ||||||||||||||||||
| 255 | ((void *)0) | - | ||||||||||||||||||
| 256 | ; | - | ||||||||||||||||||
| 257 | EVP_PKEY_free(cpk->privatekey); | - | ||||||||||||||||||
| 258 | cpk->privatekey = | - | ||||||||||||||||||
| 259 | ((void *)0) | - | ||||||||||||||||||
| 260 | ; | - | ||||||||||||||||||
| 261 | sk_X509_pop_free(cpk->chain, X509_free); | - | ||||||||||||||||||
| 262 | cpk->chain = | - | ||||||||||||||||||
| 263 | ((void *)0) | - | ||||||||||||||||||
| 264 | ; | - | ||||||||||||||||||
| 265 | CRYPTO_free(cpk->serverinfo, __FILE__, 218); | - | ||||||||||||||||||
| 266 | cpk->serverinfo = | - | ||||||||||||||||||
| 267 | ((void *)0) | - | ||||||||||||||||||
| 268 | ; | - | ||||||||||||||||||
| 269 | cpk->serverinfo_length = 0; | - | ||||||||||||||||||
| 270 | } executed 146655 times by 2 tests: end of blockExecuted by:
| 146655 | ||||||||||||||||||
| 271 | } executed 16295 times by 2 tests: end of blockExecuted by:
| 16295 | ||||||||||||||||||
| 272 | - | |||||||||||||||||||
| 273 | void ssl_cert_free(CERT *c) | - | ||||||||||||||||||
| 274 | { | - | ||||||||||||||||||
| 275 | int i; | - | ||||||||||||||||||
| 276 | - | |||||||||||||||||||
| 277 | if (c ==
| 0-16295 | ||||||||||||||||||
| 278 | ((void *)0)
| 0-16295 | ||||||||||||||||||
| 279 | ) | - | ||||||||||||||||||
| 280 | return; never executed: return; | 0 | ||||||||||||||||||
| 281 | CRYPTO_DOWN_REF(&c->references, &i, c->lock); | - | ||||||||||||||||||
| 282 | ; | - | ||||||||||||||||||
| 283 | if (i > 0
| 0-16295 | ||||||||||||||||||
| 284 | return; never executed: return; | 0 | ||||||||||||||||||
| 285 | ; | - | ||||||||||||||||||
| 286 | - | |||||||||||||||||||
| 287 | - | |||||||||||||||||||
| 288 | EVP_PKEY_free(c->dh_tmp); | - | ||||||||||||||||||
| 289 | - | |||||||||||||||||||
| 290 | - | |||||||||||||||||||
| 291 | ssl_cert_clear_certs(c); | - | ||||||||||||||||||
| 292 | CRYPTO_free(c->conf_sigalgs, __FILE__, 241); | - | ||||||||||||||||||
| 293 | CRYPTO_free(c->client_sigalgs, __FILE__, 242); | - | ||||||||||||||||||
| 294 | CRYPTO_free(c->shared_sigalgs, __FILE__, 243); | - | ||||||||||||||||||
| 295 | CRYPTO_free(c->ctype, __FILE__, 244); | - | ||||||||||||||||||
| 296 | X509_STORE_free(c->verify_store); | - | ||||||||||||||||||
| 297 | X509_STORE_free(c->chain_store); | - | ||||||||||||||||||
| 298 | custom_exts_free(&c->custext); | - | ||||||||||||||||||
| 299 | - | |||||||||||||||||||
| 300 | CRYPTO_free(c->psk_identity_hint, __FILE__, 249); | - | ||||||||||||||||||
| 301 | - | |||||||||||||||||||
| 302 | CRYPTO_THREAD_lock_free(c->lock); | - | ||||||||||||||||||
| 303 | CRYPTO_free(c, __FILE__, 252); | - | ||||||||||||||||||
| 304 | } executed 16295 times by 2 tests: end of blockExecuted by:
| 16295 | ||||||||||||||||||
| 305 | - | |||||||||||||||||||
| 306 | int ssl_cert_set0_chain(SSL *s, SSL_CTX *ctx, struct stack_st_X509 *chain) | - | ||||||||||||||||||
| 307 | { | - | ||||||||||||||||||
| 308 | int i, r; | - | ||||||||||||||||||
| 309 | CERT_PKEY *cpk = s
| 0-2111 | ||||||||||||||||||
| 310 | if (!cpk
| 0-2111 | ||||||||||||||||||
| 311 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 312 | for (i = 0; i < sk_X509_num(chain)
| 0-2111 | ||||||||||||||||||
| 313 | r = ssl_security_cert(s, ctx, sk_X509_value(chain, i), 0, 0); | - | ||||||||||||||||||
| 314 | if (r != 1
| 0 | ||||||||||||||||||
| 315 | ERR_put_error(20,(340),(r),__FILE__,264); | - | ||||||||||||||||||
| 316 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 317 | } | - | ||||||||||||||||||
| 318 | } never executed: end of block | 0 | ||||||||||||||||||
| 319 | sk_X509_pop_free(cpk->chain, X509_free); | - | ||||||||||||||||||
| 320 | cpk->chain = chain; | - | ||||||||||||||||||
| 321 | return executed 2111 times by 1 test: 1;return 1;Executed by:
executed 2111 times by 1 test: return 1;Executed by:
| 2111 | ||||||||||||||||||
| 322 | } | - | ||||||||||||||||||
| 323 | - | |||||||||||||||||||
| 324 | int ssl_cert_set1_chain(SSL *s, SSL_CTX *ctx, struct stack_st_X509 *chain) | - | ||||||||||||||||||
| 325 | { | - | ||||||||||||||||||
| 326 | struct stack_st_X509 *dchain; | - | ||||||||||||||||||
| 327 | if (!chain
| 0 | ||||||||||||||||||
| 328 | return never executed: ssl_cert_set0_chain(s, ctx, return ssl_cert_set0_chain(s, ctx, ((void *)0) );never executed: return ssl_cert_set0_chain(s, ctx, ((void *)0) ); | 0 | ||||||||||||||||||
| 329 | ((void *)0) never executed: return ssl_cert_set0_chain(s, ctx, ((void *)0) ); | 0 | ||||||||||||||||||
| 330 | ); never executed: return ssl_cert_set0_chain(s, ctx, ((void *)0) ); | 0 | ||||||||||||||||||
| 331 | dchain = X509_chain_up_ref(chain); | - | ||||||||||||||||||
| 332 | if (!dchain
| 0 | ||||||||||||||||||
| 333 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 334 | if (!ssl_cert_set0_chain(s, ctx, dchain)
| 0 | ||||||||||||||||||
| 335 | sk_X509_pop_free(dchain, X509_free); | - | ||||||||||||||||||
| 336 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 337 | } | - | ||||||||||||||||||
| 338 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 339 | } | - | ||||||||||||||||||
| 340 | - | |||||||||||||||||||
| 341 | int ssl_cert_add0_chain_cert(SSL *s, SSL_CTX *ctx, X509 *x) | - | ||||||||||||||||||
| 342 | { | - | ||||||||||||||||||
| 343 | int r; | - | ||||||||||||||||||
| 344 | CERT_PKEY *cpk = s
| 0-36 | ||||||||||||||||||
| 345 | if (!cpk
| 0-36 | ||||||||||||||||||
| 346 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 347 | r = ssl_security_cert(s, ctx, x, 0, 0); | - | ||||||||||||||||||
| 348 | if (r != 1
| 0-36 | ||||||||||||||||||
| 349 | ERR_put_error(20,(346),(r),__FILE__,296); | - | ||||||||||||||||||
| 350 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 351 | } | - | ||||||||||||||||||
| 352 | if (!cpk->chain
| 0-36 | ||||||||||||||||||
| 353 | cpk->chain = sk_X509_new_null(); executed 36 times by 1 test: cpk->chain = sk_X509_new_null();Executed by:
| 36 | ||||||||||||||||||
| 354 | if (!cpk->chain
| 0-36 | ||||||||||||||||||
| 355 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 356 | return executed 36 times by 1 test: 1;return 1;Executed by:
executed 36 times by 1 test: return 1;Executed by:
| 36 | ||||||||||||||||||
| 357 | } | - | ||||||||||||||||||
| 358 | - | |||||||||||||||||||
| 359 | int ssl_cert_add1_chain_cert(SSL *s, SSL_CTX *ctx, X509 *x) | - | ||||||||||||||||||
| 360 | { | - | ||||||||||||||||||
| 361 | if (!ssl_cert_add0_chain_cert(s, ctx, x)
| 0 | ||||||||||||||||||
| 362 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 363 | X509_up_ref(x); | - | ||||||||||||||||||
| 364 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 365 | } | - | ||||||||||||||||||
| 366 | - | |||||||||||||||||||
| 367 | int ssl_cert_select_current(CERT *c, X509 *x) | - | ||||||||||||||||||
| 368 | { | - | ||||||||||||||||||
| 369 | int i; | - | ||||||||||||||||||
| 370 | if (x ==
| 0 | ||||||||||||||||||
| 371 | ((void *)0)
| 0 | ||||||||||||||||||
| 372 | ) | - | ||||||||||||||||||
| 373 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 374 | for (i = 0; i < 9
| 0 | ||||||||||||||||||
| 375 | CERT_PKEY *cpk = c->pkeys + i; | - | ||||||||||||||||||
| 376 | if (cpk->x509 == x
| 0 | ||||||||||||||||||
| 377 | c->key = cpk; | - | ||||||||||||||||||
| 378 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 379 | } | - | ||||||||||||||||||
| 380 | } never executed: end of block | 0 | ||||||||||||||||||
| 381 | - | |||||||||||||||||||
| 382 | for (i = 0; i < 9
| 0 | ||||||||||||||||||
| 383 | CERT_PKEY *cpk = c->pkeys + i; | - | ||||||||||||||||||
| 384 | if (cpk->privatekey
| 0 | ||||||||||||||||||
| 385 | c->key = cpk; | - | ||||||||||||||||||
| 386 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 387 | } | - | ||||||||||||||||||
| 388 | } never executed: end of block | 0 | ||||||||||||||||||
| 389 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 390 | } | - | ||||||||||||||||||
| 391 | - | |||||||||||||||||||
| 392 | int ssl_cert_set_current(CERT *c, long op) | - | ||||||||||||||||||
| 393 | { | - | ||||||||||||||||||
| 394 | int i, idx; | - | ||||||||||||||||||
| 395 | if (!c
| 0 | ||||||||||||||||||
| 396 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 397 | if (op == 1
| 0 | ||||||||||||||||||
| 398 | idx = 0; never executed: idx = 0; | 0 | ||||||||||||||||||
| 399 | else if (op == 2
| 0 | ||||||||||||||||||
| 400 | idx = (int)(c->key - c->pkeys + 1); | - | ||||||||||||||||||
| 401 | if (idx >= 9
| 0 | ||||||||||||||||||
| 402 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 403 | } never executed: elseend of block | 0 | ||||||||||||||||||
| 404 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 405 | for (i = idx; i < 9
| 0 | ||||||||||||||||||
| 406 | CERT_PKEY *cpk = c->pkeys + i; | - | ||||||||||||||||||
| 407 | if (cpk->x509
| 0 | ||||||||||||||||||
| 408 | c->key = cpk; | - | ||||||||||||||||||
| 409 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 410 | } | - | ||||||||||||||||||
| 411 | } never executed: end of block | 0 | ||||||||||||||||||
| 412 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 413 | } | - | ||||||||||||||||||
| 414 | - | |||||||||||||||||||
| 415 | void ssl_cert_set_cert_cb(CERT *c, int (*cb) (SSL *ssl, void *arg), void *arg) | - | ||||||||||||||||||
| 416 | { | - | ||||||||||||||||||
| 417 | c->cert_cb = cb; | - | ||||||||||||||||||
| 418 | c->cert_cb_arg = arg; | - | ||||||||||||||||||
| 419 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||
| 420 | - | |||||||||||||||||||
| 421 | int ssl_verify_cert_chain(SSL *s, struct stack_st_X509 *sk) | - | ||||||||||||||||||
| 422 | { | - | ||||||||||||||||||
| 423 | X509 *x; | - | ||||||||||||||||||
| 424 | int i = 0; | - | ||||||||||||||||||
| 425 | X509_STORE *verify_store; | - | ||||||||||||||||||
| 426 | X509_STORE_CTX *ctx = | - | ||||||||||||||||||
| 427 | ((void *)0) | - | ||||||||||||||||||
| 428 | ; | - | ||||||||||||||||||
| 429 | X509_VERIFY_PARAM *param; | - | ||||||||||||||||||
| 430 | - | |||||||||||||||||||
| 431 | if ((
| 0-2611 | ||||||||||||||||||
| 432 | ((void *)0)
| 0-2611 | ||||||||||||||||||
| 433 | )
| 0-2611 | ||||||||||||||||||
| 434 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 435 | - | |||||||||||||||||||
| 436 | if (s->cert->verify_store
| 963-1648 | ||||||||||||||||||
| 437 | verify_store = s->cert->verify_store; executed 963 times by 1 test: verify_store = s->cert->verify_store;Executed by:
| 963 | ||||||||||||||||||
| 438 | else | - | ||||||||||||||||||
| 439 | verify_store = s->ctx->cert_store; executed 1648 times by 1 test: verify_store = s->ctx->cert_store;Executed by:
| 1648 | ||||||||||||||||||
| 440 | - | |||||||||||||||||||
| 441 | ctx = X509_STORE_CTX_new(); | - | ||||||||||||||||||
| 442 | if (ctx ==
| 0-2611 | ||||||||||||||||||
| 443 | ((void *)0)
| 0-2611 | ||||||||||||||||||
| 444 | ) { | - | ||||||||||||||||||
| 445 | ERR_put_error(20,(207),((1|64)),__FILE__,384); | - | ||||||||||||||||||
| 446 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 447 | } | - | ||||||||||||||||||
| 448 | - | |||||||||||||||||||
| 449 | x = sk_X509_value(sk, 0); | - | ||||||||||||||||||
| 450 | if (!X509_STORE_CTX_init(ctx, verify_store, x, sk)
| 0-2611 | ||||||||||||||||||
| 451 | ERR_put_error(20,(207),(11),__FILE__,390); | - | ||||||||||||||||||
| 452 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||
| 453 | } | - | ||||||||||||||||||
| 454 | param = X509_STORE_CTX_get0_param(ctx); | - | ||||||||||||||||||
| 455 | - | |||||||||||||||||||
| 456 | - | |||||||||||||||||||
| 457 | - | |||||||||||||||||||
| 458 | - | |||||||||||||||||||
| 459 | - | |||||||||||||||||||
| 460 | X509_VERIFY_PARAM_set_auth_level(param, SSL_get_security_level(s)); | - | ||||||||||||||||||
| 461 | - | |||||||||||||||||||
| 462 | - | |||||||||||||||||||
| 463 | X509_STORE_CTX_set_flags(ctx, (s->cert->cert_flags & 0x30000)); | - | ||||||||||||||||||
| 464 | if (!X509_STORE_CTX_set_ex_data
| 0-2611 | ||||||||||||||||||
| 465 | (ctx, SSL_get_ex_data_X509_STORE_CTX_idx(), s)
| 0-2611 | ||||||||||||||||||
| 466 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||||||||
| 467 | } | - | ||||||||||||||||||
| 468 | - | |||||||||||||||||||
| 469 | - | |||||||||||||||||||
| 470 | if (((
| 0-2611 | ||||||||||||||||||
| 471 | ((void *)0)
| 0-2611 | ||||||||||||||||||
| 472 | && sk_danetls_record_num((&s->dane)->trecs) > 0
| 0-2611 | ||||||||||||||||||
| 473 | X509_STORE_CTX_set0_dane(ctx, &s->dane); never executed: X509_STORE_CTX_set0_dane(ctx, &s->dane); | 0 | ||||||||||||||||||
| 474 | - | |||||||||||||||||||
| 475 | - | |||||||||||||||||||
| 476 | - | |||||||||||||||||||
| 477 | - | |||||||||||||||||||
| 478 | - | |||||||||||||||||||
| 479 | - | |||||||||||||||||||
| 480 | - | |||||||||||||||||||
| 481 | X509_STORE_CTX_set_default(ctx, s->server ? "ssl_client" : "ssl_server"); | - | ||||||||||||||||||
| 482 | - | |||||||||||||||||||
| 483 | - | |||||||||||||||||||
| 484 | - | |||||||||||||||||||
| 485 | X509_VERIFY_PARAM_set1(param, s->param); | - | ||||||||||||||||||
| 486 | - | |||||||||||||||||||
| 487 | if (s->verify_callback
| 127-2484 | ||||||||||||||||||
| 488 | X509_STORE_CTX_set_verify_cb(ctx, s->verify_callback); executed 127 times by 1 test: X509_STORE_CTX_set_verify_cb(ctx, s->verify_callback);Executed by:
| 127 | ||||||||||||||||||
| 489 | - | |||||||||||||||||||
| 490 | if (s->ctx->app_verify_callback !=
| 12-2599 | ||||||||||||||||||
| 491 | ((void *)0)
| 12-2599 | ||||||||||||||||||
| 492 | ) | - | ||||||||||||||||||
| 493 | i = s->ctx->app_verify_callback(ctx, s->ctx->app_verify_arg); executed 12 times by 1 test: i = s->ctx->app_verify_callback(ctx, s->ctx->app_verify_arg);Executed by:
| 12 | ||||||||||||||||||
| 494 | else | - | ||||||||||||||||||
| 495 | i = X509_verify_cert(ctx); executed 2599 times by 1 test: i = X509_verify_cert(ctx);Executed by:
| 2599 | ||||||||||||||||||
| 496 | - | |||||||||||||||||||
| 497 | s->verify_result = X509_STORE_CTX_get_error(ctx); | - | ||||||||||||||||||
| 498 | sk_X509_pop_free(s->verified_chain, X509_free); | - | ||||||||||||||||||
| 499 | s->verified_chain = | - | ||||||||||||||||||
| 500 | ((void *)0) | - | ||||||||||||||||||
| 501 | ; | - | ||||||||||||||||||
| 502 | if (X509_STORE_CTX_get0_chain(ctx) !=
| 8-2603 | ||||||||||||||||||
| 503 | ((void *)0)
| 8-2603 | ||||||||||||||||||
| 504 | ) { | - | ||||||||||||||||||
| 505 | s->verified_chain = X509_STORE_CTX_get1_chain(ctx); | - | ||||||||||||||||||
| 506 | if (s->verified_chain ==
| 0-2603 | ||||||||||||||||||
| 507 | ((void *)0)
| 0-2603 | ||||||||||||||||||
| 508 | ) { | - | ||||||||||||||||||
| 509 | ERR_put_error(20,(207),((1|64)),__FILE__,438); | - | ||||||||||||||||||
| 510 | i = 0; | - | ||||||||||||||||||
| 511 | } never executed: end of block | 0 | ||||||||||||||||||
| 512 | } executed 2603 times by 1 test: end of blockExecuted by:
| 2603 | ||||||||||||||||||
| 513 | - | |||||||||||||||||||
| 514 | - | |||||||||||||||||||
| 515 | X509_VERIFY_PARAM_move_peername(s->param, param); | - | ||||||||||||||||||
| 516 | - | |||||||||||||||||||
| 517 | end: code before this statement executed 2611 times by 1 test: end:Executed by:
| 2611 | ||||||||||||||||||
| 518 | X509_STORE_CTX_free(ctx); | - | ||||||||||||||||||
| 519 | return executed 2611 times by 1 test: i;return i;Executed by:
executed 2611 times by 1 test: return i;Executed by:
| 2611 | ||||||||||||||||||
| 520 | } | - | ||||||||||||||||||
| 521 | - | |||||||||||||||||||
| 522 | static void set0_CA_list(struct stack_st_X509_NAME **ca_list, | - | ||||||||||||||||||
| 523 | struct stack_st_X509_NAME *name_list) | - | ||||||||||||||||||
| 524 | { | - | ||||||||||||||||||
| 525 | sk_X509_NAME_pop_free(*ca_list, X509_NAME_free); | - | ||||||||||||||||||
| 526 | *ca_list = name_list; | - | ||||||||||||||||||
| 527 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | struct stack_st_X509_NAME *SSL_dup_CA_list(const struct stack_st_X509_NAME *sk) | - | ||||||||||||||||||
| 530 | { | - | ||||||||||||||||||
| 531 | int i; | - | ||||||||||||||||||
| 532 | const int num = sk_X509_NAME_num(sk); | - | ||||||||||||||||||
| 533 | struct stack_st_X509_NAME *ret; | - | ||||||||||||||||||
| 534 | X509_NAME *name; | - | ||||||||||||||||||
| 535 | - | |||||||||||||||||||
| 536 | ret = sk_X509_NAME_new_reserve( | - | ||||||||||||||||||
| 537 | ((void *)0) | - | ||||||||||||||||||
| 538 | , num); | - | ||||||||||||||||||
| 539 | if (ret ==
| 0-36 | ||||||||||||||||||
| 540 | ((void *)0)
| 0-36 | ||||||||||||||||||
| 541 | ) { | - | ||||||||||||||||||
| 542 | ERR_put_error(20,(408),((1|64)),__FILE__,467); | - | ||||||||||||||||||
| 543 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 544 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 545 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 546 | } | - | ||||||||||||||||||
| 547 | for (i = 0; i < num
| 10-36 | ||||||||||||||||||
| 548 | name = X509_NAME_dup(sk_X509_NAME_value(sk, i)); | - | ||||||||||||||||||
| 549 | if (name ==
| 0-10 | ||||||||||||||||||
| 550 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 551 | ) { | - | ||||||||||||||||||
| 552 | ERR_put_error(20,(408),((1|64)),__FILE__,473); | - | ||||||||||||||||||
| 553 | sk_X509_NAME_pop_free(ret, X509_NAME_free); | - | ||||||||||||||||||
| 554 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 555 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 556 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 557 | } | - | ||||||||||||||||||
| 558 | sk_X509_NAME_push(ret, name); | - | ||||||||||||||||||
| 559 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 560 | return executed 36 times by 1 test: ret;return ret;Executed by:
executed 36 times by 1 test: return ret;Executed by:
| 36 | ||||||||||||||||||
| 561 | } | - | ||||||||||||||||||
| 562 | - | |||||||||||||||||||
| 563 | void SSL_set0_CA_list(SSL *s, struct stack_st_X509_NAME *name_list) | - | ||||||||||||||||||
| 564 | { | - | ||||||||||||||||||
| 565 | set0_CA_list(&s->ca_names, name_list); | - | ||||||||||||||||||
| 566 | } never executed: end of block | 0 | ||||||||||||||||||
| 567 | - | |||||||||||||||||||
| 568 | void SSL_CTX_set0_CA_list(SSL_CTX *ctx, struct stack_st_X509_NAME *name_list) | - | ||||||||||||||||||
| 569 | { | - | ||||||||||||||||||
| 570 | set0_CA_list(&ctx->ca_names, name_list); | - | ||||||||||||||||||
| 571 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||
| 572 | - | |||||||||||||||||||
| 573 | const struct stack_st_X509_NAME *SSL_CTX_get0_CA_list(const SSL_CTX *ctx) | - | ||||||||||||||||||
| 574 | { | - | ||||||||||||||||||
| 575 | return never executed: ctx->ca_names;return ctx->ca_names;never executed: return ctx->ca_names; | 0 | ||||||||||||||||||
| 576 | } | - | ||||||||||||||||||
| 577 | - | |||||||||||||||||||
| 578 | const struct stack_st_X509_NAME *SSL_get0_CA_list(const SSL *s) | - | ||||||||||||||||||
| 579 | { | - | ||||||||||||||||||
| 580 | return executed 4000 times by 1 test: s->ca_names != return s->ca_names != ((void *)0) ? s->ca_names : s->ctx->ca_names;Executed by:
executed 4000 times by 1 test: return s->ca_names != ((void *)0) ? s->ca_names : s->ctx->ca_names;Executed by:
| 0-4000 | ||||||||||||||||||
| 581 | ((void *)0)
executed 4000 times by 1 test: return s->ca_names != ((void *)0) ? s->ca_names : s->ctx->ca_names;Executed by:
| 0-4000 | ||||||||||||||||||
| 582 | ? s->ca_names : s->ctx->ca_names; executed 4000 times by 1 test: return s->ca_names != ((void *)0) ? s->ca_names : s->ctx->ca_names;Executed by:
| 4000 | ||||||||||||||||||
| 583 | } | - | ||||||||||||||||||
| 584 | - | |||||||||||||||||||
| 585 | void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, struct stack_st_X509_NAME *name_list) | - | ||||||||||||||||||
| 586 | { | - | ||||||||||||||||||
| 587 | SSL_CTX_set0_CA_list(ctx, name_list); | - | ||||||||||||||||||
| 588 | } never executed: end of block | 0 | ||||||||||||||||||
| 589 | - | |||||||||||||||||||
| 590 | struct stack_st_X509_NAME *SSL_CTX_get_client_CA_list(const SSL_CTX *ctx) | - | ||||||||||||||||||
| 591 | { | - | ||||||||||||||||||
| 592 | return never executed: ctx->ca_names;return ctx->ca_names;never executed: return ctx->ca_names; | 0 | ||||||||||||||||||
| 593 | } | - | ||||||||||||||||||
| 594 | - | |||||||||||||||||||
| 595 | void SSL_set_client_CA_list(SSL *s, struct stack_st_X509_NAME *name_list) | - | ||||||||||||||||||
| 596 | { | - | ||||||||||||||||||
| 597 | SSL_set0_CA_list(s, name_list); | - | ||||||||||||||||||
| 598 | } never executed: end of block | 0 | ||||||||||||||||||
| 599 | - | |||||||||||||||||||
| 600 | const struct stack_st_X509_NAME *SSL_get0_peer_CA_list(const SSL *s) | - | ||||||||||||||||||
| 601 | { | - | ||||||||||||||||||
| 602 | return executed 2611 times by 1 test: s->s3 != return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ;Executed by:
executed 2611 times by 1 test: return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ;Executed by:
| 0-2611 | ||||||||||||||||||
| 603 | ((void *)0)
executed 2611 times by 1 test: return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ;Executed by:
| 0-2611 | ||||||||||||||||||
| 604 | ? s->s3->tmp.peer_ca_names : executed 2611 times by 1 test: return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ;Executed by:
| 2611 | ||||||||||||||||||
| 605 | ((void *)0) executed 2611 times by 1 test: return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ;Executed by:
| 2611 | ||||||||||||||||||
| 606 | ; executed 2611 times by 1 test: return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ;Executed by:
| 2611 | ||||||||||||||||||
| 607 | } | - | ||||||||||||||||||
| 608 | - | |||||||||||||||||||
| 609 | struct stack_st_X509_NAME *SSL_get_client_CA_list(const SSL *s) | - | ||||||||||||||||||
| 610 | { | - | ||||||||||||||||||
| 611 | if (!s->server
| 0 | ||||||||||||||||||
| 612 | return never executed: s->s3 != return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ;
never executed: return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ; | 0 | ||||||||||||||||||
| 613 | ((void *)0)
never executed: return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ; | 0 | ||||||||||||||||||
| 614 | ? s->s3->tmp.peer_ca_names : never executed: return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ; | 0 | ||||||||||||||||||
| 615 | ((void *)0) never executed: return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ; | 0 | ||||||||||||||||||
| 616 | ; never executed: return s->s3 != ((void *)0) ? s->s3->tmp.peer_ca_names : ((void *)0) ; | 0 | ||||||||||||||||||
| 617 | return never executed: s->ca_names != return s->ca_names != ((void *)0) ? s->ca_names : s->ctx->ca_names;
never executed: return s->ca_names != ((void *)0) ? s->ca_names : s->ctx->ca_names; | 0 | ||||||||||||||||||
| 618 | ((void *)0)
never executed: return s->ca_names != ((void *)0) ? s->ca_names : s->ctx->ca_names; | 0 | ||||||||||||||||||
| 619 | ? s->ca_names : s->ctx->ca_names; never executed: return s->ca_names != ((void *)0) ? s->ca_names : s->ctx->ca_names; | 0 | ||||||||||||||||||
| 620 | } | - | ||||||||||||||||||
| 621 | - | |||||||||||||||||||
| 622 | static int add_ca_name(struct stack_st_X509_NAME **sk, const X509 *x) | - | ||||||||||||||||||
| 623 | { | - | ||||||||||||||||||
| 624 | X509_NAME *name; | - | ||||||||||||||||||
| 625 | - | |||||||||||||||||||
| 626 | if (x ==
| 0 | ||||||||||||||||||
| 627 | ((void *)0)
| 0 | ||||||||||||||||||
| 628 | ) | - | ||||||||||||||||||
| 629 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 630 | if (*
| 0 | ||||||||||||||||||
| 631 | ((void *)0)
| 0 | ||||||||||||||||||
| 632 | && ((*
| 0 | ||||||||||||||||||
| 633 | ((void *)0)
| 0 | ||||||||||||||||||
| 634 | )
| 0 | ||||||||||||||||||
| 635 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 636 | - | |||||||||||||||||||
| 637 | if ((
| 0 | ||||||||||||||||||
| 638 | ((void *)0)
| 0 | ||||||||||||||||||
| 639 | ) | - | ||||||||||||||||||
| 640 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 641 | - | |||||||||||||||||||
| 642 | if (!sk_X509_NAME_push(*sk, name)
| 0 | ||||||||||||||||||
| 643 | X509_NAME_free(name); | - | ||||||||||||||||||
| 644 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 645 | } | - | ||||||||||||||||||
| 646 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 647 | } | - | ||||||||||||||||||
| 648 | - | |||||||||||||||||||
| 649 | int SSL_add1_to_CA_list(SSL *ssl, const X509 *x) | - | ||||||||||||||||||
| 650 | { | - | ||||||||||||||||||
| 651 | return never executed: add_ca_name(&ssl->ca_names, x);return add_ca_name(&ssl->ca_names, x);never executed: return add_ca_name(&ssl->ca_names, x); | 0 | ||||||||||||||||||
| 652 | } | - | ||||||||||||||||||
| 653 | - | |||||||||||||||||||
| 654 | int SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x) | - | ||||||||||||||||||
| 655 | { | - | ||||||||||||||||||
| 656 | return never executed: add_ca_name(&ctx->ca_names, x);return add_ca_name(&ctx->ca_names, x);never executed: return add_ca_name(&ctx->ca_names, x); | 0 | ||||||||||||||||||
| 657 | } | - | ||||||||||||||||||
| 658 | - | |||||||||||||||||||
| 659 | - | |||||||||||||||||||
| 660 | - | |||||||||||||||||||
| 661 | - | |||||||||||||||||||
| 662 | - | |||||||||||||||||||
| 663 | int SSL_add_client_CA(SSL *ssl, X509 *x) | - | ||||||||||||||||||
| 664 | { | - | ||||||||||||||||||
| 665 | return never executed: add_ca_name(&ssl->ca_names, x);return add_ca_name(&ssl->ca_names, x);never executed: return add_ca_name(&ssl->ca_names, x); | 0 | ||||||||||||||||||
| 666 | } | - | ||||||||||||||||||
| 667 | - | |||||||||||||||||||
| 668 | int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x) | - | ||||||||||||||||||
| 669 | { | - | ||||||||||||||||||
| 670 | return never executed: add_ca_name(&ctx->ca_names, x);return add_ca_name(&ctx->ca_names, x);never executed: return add_ca_name(&ctx->ca_names, x); | 0 | ||||||||||||||||||
| 671 | } | - | ||||||||||||||||||
| 672 | - | |||||||||||||||||||
| 673 | static int xname_cmp(const X509_NAME *a, const X509_NAME *b) | - | ||||||||||||||||||
| 674 | { | - | ||||||||||||||||||
| 675 | unsigned char *abuf = | - | ||||||||||||||||||
| 676 | ((void *)0) | - | ||||||||||||||||||
| 677 | , *bbuf = | - | ||||||||||||||||||
| 678 | ((void *)0) | - | ||||||||||||||||||
| 679 | ; | - | ||||||||||||||||||
| 680 | int alen, blen, ret; | - | ||||||||||||||||||
| 681 | - | |||||||||||||||||||
| 682 | - | |||||||||||||||||||
| 683 | - | |||||||||||||||||||
| 684 | - | |||||||||||||||||||
| 685 | alen = i2d_X509_NAME((X509_NAME *)a, &abuf); | - | ||||||||||||||||||
| 686 | blen = i2d_X509_NAME((X509_NAME *)b, &bbuf); | - | ||||||||||||||||||
| 687 | - | |||||||||||||||||||
| 688 | if (alen < 0
| 0 | ||||||||||||||||||
| 689 | ret = -2; never executed: ret = -2; | 0 | ||||||||||||||||||
| 690 | else if (alen != blen
| 0 | ||||||||||||||||||
| 691 | ret = alen - blen; never executed: ret = alen - blen; | 0 | ||||||||||||||||||
| 692 | else | - | ||||||||||||||||||
| 693 | ret = memcmp(abuf, bbuf, alen); never executed: ret = memcmp(abuf, bbuf, alen); | 0 | ||||||||||||||||||
| 694 | - | |||||||||||||||||||
| 695 | CRYPTO_free(abuf, __FILE__, 590); | - | ||||||||||||||||||
| 696 | CRYPTO_free(bbuf, __FILE__, 591); | - | ||||||||||||||||||
| 697 | - | |||||||||||||||||||
| 698 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 699 | } | - | ||||||||||||||||||
| 700 | - | |||||||||||||||||||
| 701 | static int xname_sk_cmp(const X509_NAME *const *a, const X509_NAME *const *b) | - | ||||||||||||||||||
| 702 | { | - | ||||||||||||||||||
| 703 | return never executed: xname_cmp(*a, *b);return xname_cmp(*a, *b);never executed: return xname_cmp(*a, *b); | 0 | ||||||||||||||||||
| 704 | } | - | ||||||||||||||||||
| 705 | - | |||||||||||||||||||
| 706 | static unsigned long xname_hash(const X509_NAME *a) | - | ||||||||||||||||||
| 707 | { | - | ||||||||||||||||||
| 708 | return executed 20 times by 1 test: X509_NAME_hash((X509_NAME *)a);return X509_NAME_hash((X509_NAME *)a);Executed by:
executed 20 times by 1 test: return X509_NAME_hash((X509_NAME *)a);Executed by:
| 20 | ||||||||||||||||||
| 709 | } | - | ||||||||||||||||||
| 710 | struct stack_st_X509_NAME *SSL_load_client_CA_file(const char *file) | - | ||||||||||||||||||
| 711 | { | - | ||||||||||||||||||
| 712 | BIO *in = BIO_new(BIO_s_file()); | - | ||||||||||||||||||
| 713 | X509 *x = | - | ||||||||||||||||||
| 714 | ((void *)0) | - | ||||||||||||||||||
| 715 | ; | - | ||||||||||||||||||
| 716 | X509_NAME *xn = | - | ||||||||||||||||||
| 717 | ((void *)0) | - | ||||||||||||||||||
| 718 | ; | - | ||||||||||||||||||
| 719 | struct stack_st_X509_NAME *ret = | - | ||||||||||||||||||
| 720 | ((void *)0) | - | ||||||||||||||||||
| 721 | ; | - | ||||||||||||||||||
| 722 | struct lhash_st_X509_NAME *name_hash = lh_X509_NAME_new(xname_hash, xname_cmp); | - | ||||||||||||||||||
| 723 | - | |||||||||||||||||||
| 724 | if ((
| 0-10 | ||||||||||||||||||
| 725 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 726 | )
| 0-10 | ||||||||||||||||||
| 727 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 728 | )
| 0-10 | ||||||||||||||||||
| 729 | ERR_put_error(20,(185),((1|64)),__FILE__,623); | - | ||||||||||||||||||
| 730 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 731 | } | - | ||||||||||||||||||
| 732 | - | |||||||||||||||||||
| 733 | if (!(int)BIO_ctrl(in,108, 0x01|0x02,(char *)(file))
| 0-10 | ||||||||||||||||||
| 734 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 735 | - | |||||||||||||||||||
| 736 | for (;;) { | - | ||||||||||||||||||
| 737 | if (PEM_read_bio_X509(in, &x,
| 10 | ||||||||||||||||||
| 738 | ((void *)0)
| 10 | ||||||||||||||||||
| 739 | ,
| 10 | ||||||||||||||||||
| 740 | ((void *)0)
| 10 | ||||||||||||||||||
| 741 | ) ==
| 10 | ||||||||||||||||||
| 742 | ((void *)0)
| 10 | ||||||||||||||||||
| 743 | ) | - | ||||||||||||||||||
| 744 | break; executed 10 times by 1 test: break;Executed by:
| 10 | ||||||||||||||||||
| 745 | if (ret ==
| 0-10 | ||||||||||||||||||
| 746 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 747 | ) { | - | ||||||||||||||||||
| 748 | ret = sk_X509_NAME_new_null(); | - | ||||||||||||||||||
| 749 | if (ret ==
| 0-10 | ||||||||||||||||||
| 750 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 751 | ) { | - | ||||||||||||||||||
| 752 | ERR_put_error(20,(185),((1|64)),__FILE__,636); | - | ||||||||||||||||||
| 753 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 754 | } | - | ||||||||||||||||||
| 755 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 756 | if ((
| 0-10 | ||||||||||||||||||
| 757 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 758 | ) | - | ||||||||||||||||||
| 759 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 760 | - | |||||||||||||||||||
| 761 | xn = X509_NAME_dup(xn); | - | ||||||||||||||||||
| 762 | if (xn ==
| 0-10 | ||||||||||||||||||
| 763 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 764 | ) | - | ||||||||||||||||||
| 765 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 766 | if (lh_X509_NAME_retrieve(name_hash, xn) !=
| 0-10 | ||||||||||||||||||
| 767 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 768 | ) { | - | ||||||||||||||||||
| 769 | - | |||||||||||||||||||
| 770 | X509_NAME_free(xn); | - | ||||||||||||||||||
| 771 | xn = | - | ||||||||||||||||||
| 772 | ((void *)0) | - | ||||||||||||||||||
| 773 | ; | - | ||||||||||||||||||
| 774 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 775 | lh_X509_NAME_insert(name_hash, xn); | - | ||||||||||||||||||
| 776 | if (!sk_X509_NAME_push(ret, xn)
| 0-10 | ||||||||||||||||||
| 777 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 778 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 779 | } | - | ||||||||||||||||||
| 780 | goto executed 10 times by 1 test: done;goto done;Executed by:
executed 10 times by 1 test: goto done;Executed by:
| 10 | ||||||||||||||||||
| 781 | - | |||||||||||||||||||
| 782 | err: | - | ||||||||||||||||||
| 783 | X509_NAME_free(xn); | - | ||||||||||||||||||
| 784 | sk_X509_NAME_pop_free(ret, X509_NAME_free); | - | ||||||||||||||||||
| 785 | ret = | - | ||||||||||||||||||
| 786 | ((void *)0) | - | ||||||||||||||||||
| 787 | ; | - | ||||||||||||||||||
| 788 | done: code before this statement never executed: done: | 0 | ||||||||||||||||||
| 789 | BIO_free(in); | - | ||||||||||||||||||
| 790 | X509_free(x); | - | ||||||||||||||||||
| 791 | lh_X509_NAME_free(name_hash); | - | ||||||||||||||||||
| 792 | if (ret !=
| 0-10 | ||||||||||||||||||
| 793 | ((void *)0)
| 0-10 | ||||||||||||||||||
| 794 | ) | - | ||||||||||||||||||
| 795 | ERR_clear_error(); executed 10 times by 1 test: ERR_clear_error();Executed by:
| 10 | ||||||||||||||||||
| 796 | return executed 10 times by 1 test: ret;return ret;Executed by:
executed 10 times by 1 test: return ret;Executed by:
| 10 | ||||||||||||||||||
| 797 | } | - | ||||||||||||||||||
| 798 | int SSL_add_file_cert_subjects_to_stack(struct stack_st_X509_NAME *stack, | - | ||||||||||||||||||
| 799 | const char *file) | - | ||||||||||||||||||
| 800 | { | - | ||||||||||||||||||
| 801 | BIO *in; | - | ||||||||||||||||||
| 802 | X509 *x = | - | ||||||||||||||||||
| 803 | ((void *)0) | - | ||||||||||||||||||
| 804 | ; | - | ||||||||||||||||||
| 805 | X509_NAME *xn = | - | ||||||||||||||||||
| 806 | ((void *)0) | - | ||||||||||||||||||
| 807 | ; | - | ||||||||||||||||||
| 808 | int ret = 1; | - | ||||||||||||||||||
| 809 | int (*oldcmp) (const X509_NAME *const *a, const X509_NAME *const *b); | - | ||||||||||||||||||
| 810 | - | |||||||||||||||||||
| 811 | oldcmp = sk_X509_NAME_set_cmp_func(stack, xname_sk_cmp); | - | ||||||||||||||||||
| 812 | - | |||||||||||||||||||
| 813 | in = BIO_new(BIO_s_file()); | - | ||||||||||||||||||
| 814 | - | |||||||||||||||||||
| 815 | if (in ==
| 0-15 | ||||||||||||||||||
| 816 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 817 | ) { | - | ||||||||||||||||||
| 818 | ERR_put_error(20,(216),((1|64)),__FILE__,694); | - | ||||||||||||||||||
| 819 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 820 | } | - | ||||||||||||||||||
| 821 | - | |||||||||||||||||||
| 822 | if (!(int)BIO_ctrl(in,108, 0x01|0x02,(char *)(file))
| 0-15 | ||||||||||||||||||
| 823 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 824 | - | |||||||||||||||||||
| 825 | for (;;) { | - | ||||||||||||||||||
| 826 | if (PEM_read_bio_X509(in, &x,
| 15 | ||||||||||||||||||
| 827 | ((void *)0)
| 15 | ||||||||||||||||||
| 828 | ,
| 15 | ||||||||||||||||||
| 829 | ((void *)0)
| 15 | ||||||||||||||||||
| 830 | ) ==
| 15 | ||||||||||||||||||
| 831 | ((void *)0)
| 15 | ||||||||||||||||||
| 832 | ) | - | ||||||||||||||||||
| 833 | break; executed 15 times by 1 test: break;Executed by:
| 15 | ||||||||||||||||||
| 834 | if ((
| 0-15 | ||||||||||||||||||
| 835 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 836 | ) | - | ||||||||||||||||||
| 837 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 838 | xn = X509_NAME_dup(xn); | - | ||||||||||||||||||
| 839 | if (xn ==
| 0-15 | ||||||||||||||||||
| 840 | ((void *)0)
| 0-15 | ||||||||||||||||||
| 841 | ) | - | ||||||||||||||||||
| 842 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 843 | if (sk_X509_NAME_find(stack, xn) >= 0
| 0-15 | ||||||||||||||||||
| 844 | - | |||||||||||||||||||
| 845 | X509_NAME_free(xn); | - | ||||||||||||||||||
| 846 | } never executed: else if (!sk_X509_NAME_push(stack, xn)end of block
| 0-15 | ||||||||||||||||||
| 847 | X509_NAME_free(xn); | - | ||||||||||||||||||
| 848 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 849 | } | - | ||||||||||||||||||
| 850 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||
| 851 | - | |||||||||||||||||||
| 852 | ERR_clear_error(); | - | ||||||||||||||||||
| 853 | goto executed 15 times by 1 test: done;goto done;Executed by:
executed 15 times by 1 test: goto done;Executed by:
| 15 | ||||||||||||||||||
| 854 | - | |||||||||||||||||||
| 855 | err: | - | ||||||||||||||||||
| 856 | ret = 0; | - | ||||||||||||||||||
| 857 | done: code before this statement never executed: done: | 0 | ||||||||||||||||||
| 858 | BIO_free(in); | - | ||||||||||||||||||
| 859 | X509_free(x); | - | ||||||||||||||||||
| 860 | (void)sk_X509_NAME_set_cmp_func(stack, oldcmp); | - | ||||||||||||||||||
| 861 | return executed 15 times by 1 test: ret;return ret;Executed by:
executed 15 times by 1 test: return ret;Executed by:
| 15 | ||||||||||||||||||
| 862 | } | - | ||||||||||||||||||
| 863 | int SSL_add_dir_cert_subjects_to_stack(struct stack_st_X509_NAME *stack, | - | ||||||||||||||||||
| 864 | const char *dir) | - | ||||||||||||||||||
| 865 | { | - | ||||||||||||||||||
| 866 | OPENSSL_DIR_CTX *d = | - | ||||||||||||||||||
| 867 | ((void *)0) | - | ||||||||||||||||||
| 868 | ; | - | ||||||||||||||||||
| 869 | const char *filename; | - | ||||||||||||||||||
| 870 | int ret = 0; | - | ||||||||||||||||||
| 871 | - | |||||||||||||||||||
| 872 | - | |||||||||||||||||||
| 873 | - | |||||||||||||||||||
| 874 | while ((
| 0 | ||||||||||||||||||
| 875 | char buf[1024]; | - | ||||||||||||||||||
| 876 | int r; | - | ||||||||||||||||||
| 877 | - | |||||||||||||||||||
| 878 | if (strlen(dir) + strlen(filename) + 2 > sizeof(buf)
| 0 | ||||||||||||||||||
| 879 | ERR_put_error(20,(215),(270),__FILE__,756) | - | ||||||||||||||||||
| 880 | ; | - | ||||||||||||||||||
| 881 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 882 | } | - | ||||||||||||||||||
| 883 | - | |||||||||||||||||||
| 884 | - | |||||||||||||||||||
| 885 | - | |||||||||||||||||||
| 886 | r = BIO_snprintf(buf, sizeof(buf), "%s/%s", dir, filename); | - | ||||||||||||||||||
| 887 | - | |||||||||||||||||||
| 888 | if (r <= 0
| 0 | ||||||||||||||||||
| 889 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 890 | if (!SSL_add_file_cert_subjects_to_stack(stack, buf)
| 0 | ||||||||||||||||||
| 891 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 892 | } never executed: end of block | 0 | ||||||||||||||||||
| 893 | - | |||||||||||||||||||
| 894 | if ( | - | ||||||||||||||||||
| 895 | (*
| 0 | ||||||||||||||||||
| 896 | ) { | - | ||||||||||||||||||
| 897 | ERR_put_error(2,(10),( | - | ||||||||||||||||||
| 898 | (*__errno_location ()) | - | ||||||||||||||||||
| 899 | ),__FILE__,771); | - | ||||||||||||||||||
| 900 | ERR_add_error_data(3, "OPENSSL_DIR_read(&ctx, '", dir, "')"); | - | ||||||||||||||||||
| 901 | ERR_put_error(20,(215),(2),__FILE__,773); | - | ||||||||||||||||||
| 902 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 903 | } | - | ||||||||||||||||||
| 904 | - | |||||||||||||||||||
| 905 | ret = 1; | - | ||||||||||||||||||
| 906 | - | |||||||||||||||||||
| 907 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||
| 908 | if (d
| 0 | ||||||||||||||||||
| 909 | OPENSSL_DIR_end(&d); never executed: OPENSSL_DIR_end(&d); | 0 | ||||||||||||||||||
| 910 | - | |||||||||||||||||||
| 911 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 912 | } | - | ||||||||||||||||||
| 913 | - | |||||||||||||||||||
| 914 | - | |||||||||||||||||||
| 915 | int ssl_build_cert_chain(SSL *s, SSL_CTX *ctx, int flags) | - | ||||||||||||||||||
| 916 | { | - | ||||||||||||||||||
| 917 | CERT *c = s
| 0 | ||||||||||||||||||
| 918 | CERT_PKEY *cpk = c->key; | - | ||||||||||||||||||
| 919 | X509_STORE *chain_store = | - | ||||||||||||||||||
| 920 | ((void *)0) | - | ||||||||||||||||||
| 921 | ; | - | ||||||||||||||||||
| 922 | X509_STORE_CTX *xs_ctx = | - | ||||||||||||||||||
| 923 | ((void *)0) | - | ||||||||||||||||||
| 924 | ; | - | ||||||||||||||||||
| 925 | struct stack_st_X509 *chain = | - | ||||||||||||||||||
| 926 | ((void *)0) | - | ||||||||||||||||||
| 927 | , *untrusted = | - | ||||||||||||||||||
| 928 | ((void *)0) | - | ||||||||||||||||||
| 929 | ; | - | ||||||||||||||||||
| 930 | X509 *x; | - | ||||||||||||||||||
| 931 | int i, rv = 0; | - | ||||||||||||||||||
| 932 | - | |||||||||||||||||||
| 933 | if (!cpk->x509
| 0 | ||||||||||||||||||
| 934 | ERR_put_error(20,(332),(179),__FILE__,798); | - | ||||||||||||||||||
| 935 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 936 | } | - | ||||||||||||||||||
| 937 | - | |||||||||||||||||||
| 938 | if (flags & 0x4
| 0 | ||||||||||||||||||
| 939 | chain_store = X509_STORE_new(); | - | ||||||||||||||||||
| 940 | if (chain_store ==
| 0 | ||||||||||||||||||
| 941 | ((void *)0)
| 0 | ||||||||||||||||||
| 942 | ) | - | ||||||||||||||||||
| 943 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 944 | for (i = 0; i < sk_X509_num(cpk->chain)
| 0 | ||||||||||||||||||
| 945 | x = sk_X509_value(cpk->chain, i); | - | ||||||||||||||||||
| 946 | if (!X509_STORE_add_cert(chain_store, x)
| 0 | ||||||||||||||||||
| 947 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 948 | } never executed: end of block | 0 | ||||||||||||||||||
| 949 | - | |||||||||||||||||||
| 950 | if (!X509_STORE_add_cert(chain_store, cpk->x509)
| 0 | ||||||||||||||||||
| 951 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 952 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 953 | if (c->chain_store
| 0 | ||||||||||||||||||
| 954 | chain_store = c->chain_store; never executed: chain_store = c->chain_store; | 0 | ||||||||||||||||||
| 955 | else if (s
| 0 | ||||||||||||||||||
| 956 | chain_store = s->ctx->cert_store; never executed: chain_store = s->ctx->cert_store; | 0 | ||||||||||||||||||
| 957 | else | - | ||||||||||||||||||
| 958 | chain_store = ctx->cert_store; never executed: chain_store = ctx->cert_store; | 0 | ||||||||||||||||||
| 959 | - | |||||||||||||||||||
| 960 | if (flags & 0x1
| 0 | ||||||||||||||||||
| 961 | untrusted = cpk->chain; never executed: untrusted = cpk->chain; | 0 | ||||||||||||||||||
| 962 | } never executed: end of block | 0 | ||||||||||||||||||
| 963 | - | |||||||||||||||||||
| 964 | xs_ctx = X509_STORE_CTX_new(); | - | ||||||||||||||||||
| 965 | if (xs_ctx ==
| 0 | ||||||||||||||||||
| 966 | ((void *)0)
| 0 | ||||||||||||||||||
| 967 | ) { | - | ||||||||||||||||||
| 968 | ERR_put_error(20,(332),((1|64)),__FILE__,828); | - | ||||||||||||||||||
| 969 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 970 | } | - | ||||||||||||||||||
| 971 | if (!X509_STORE_CTX_init(xs_ctx, chain_store, cpk->x509, untrusted)
| 0 | ||||||||||||||||||
| 972 | ERR_put_error(20,(332),(11),__FILE__,832); | - | ||||||||||||||||||
| 973 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 974 | } | - | ||||||||||||||||||
| 975 | - | |||||||||||||||||||
| 976 | X509_STORE_CTX_set_flags(xs_ctx, | - | ||||||||||||||||||
| 977 | c->cert_flags & 0x30000); | - | ||||||||||||||||||
| 978 | - | |||||||||||||||||||
| 979 | i = X509_verify_cert(xs_ctx); | - | ||||||||||||||||||
| 980 | if (i <= 0
| 0 | ||||||||||||||||||
| 981 | if (flags & 0x10
| 0 | ||||||||||||||||||
| 982 | ERR_clear_error(); never executed: ERR_clear_error(); | 0 | ||||||||||||||||||
| 983 | i = 1; | - | ||||||||||||||||||
| 984 | rv = 2; | - | ||||||||||||||||||
| 985 | } never executed: end of block | 0 | ||||||||||||||||||
| 986 | if (i > 0
| 0 | ||||||||||||||||||
| 987 | chain = X509_STORE_CTX_get1_chain(xs_ctx); never executed: chain = X509_STORE_CTX_get1_chain(xs_ctx); | 0 | ||||||||||||||||||
| 988 | if (i <= 0
| 0 | ||||||||||||||||||
| 989 | ERR_put_error(20,(332),(134),__FILE__,849); | - | ||||||||||||||||||
| 990 | i = X509_STORE_CTX_get_error(xs_ctx); | - | ||||||||||||||||||
| 991 | ERR_add_error_data(2, "Verify error:", | - | ||||||||||||||||||
| 992 | X509_verify_cert_error_string(i)); | - | ||||||||||||||||||
| 993 | - | |||||||||||||||||||
| 994 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 995 | } | - | ||||||||||||||||||
| 996 | - | |||||||||||||||||||
| 997 | x = sk_X509_shift(chain); | - | ||||||||||||||||||
| 998 | X509_free(x); | - | ||||||||||||||||||
| 999 | if (flags & 0x2
| 0 | ||||||||||||||||||
| 1000 | if (sk_X509_num(chain) > 0
| 0 | ||||||||||||||||||
| 1001 | - | |||||||||||||||||||
| 1002 | x = sk_X509_value(chain, sk_X509_num(chain) - 1); | - | ||||||||||||||||||
| 1003 | if (X509_get_extension_flags(x) & 0x2000
| 0 | ||||||||||||||||||
| 1004 | x = sk_X509_pop(chain); | - | ||||||||||||||||||
| 1005 | X509_free(x); | - | ||||||||||||||||||
| 1006 | } never executed: end of block | 0 | ||||||||||||||||||
| 1007 | } never executed: end of block | 0 | ||||||||||||||||||
| 1008 | } never executed: end of block | 0 | ||||||||||||||||||
| 1009 | - | |||||||||||||||||||
| 1010 | - | |||||||||||||||||||
| 1011 | - | |||||||||||||||||||
| 1012 | - | |||||||||||||||||||
| 1013 | for (i = 0; i < sk_X509_num(chain)
| 0 | ||||||||||||||||||
| 1014 | x = sk_X509_value(chain, i); | - | ||||||||||||||||||
| 1015 | rv = ssl_security_cert(s, ctx, x, 0, 0); | - | ||||||||||||||||||
| 1016 | if (rv != 1
| 0 | ||||||||||||||||||
| 1017 | ERR_put_error(20,(332),(rv),__FILE__,877); | - | ||||||||||||||||||
| 1018 | sk_X509_pop_free(chain, X509_free); | - | ||||||||||||||||||
| 1019 | rv = 0; | - | ||||||||||||||||||
| 1020 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 1021 | } | - | ||||||||||||||||||
| 1022 | } never executed: end of block | 0 | ||||||||||||||||||
| 1023 | sk_X509_pop_free(cpk->chain, X509_free); | - | ||||||||||||||||||
| 1024 | cpk->chain = chain; | - | ||||||||||||||||||
| 1025 | if (rv == 0
| 0 | ||||||||||||||||||
| 1026 | rv = 1; never executed: rv = 1; | 0 | ||||||||||||||||||
| 1027 | err: code before this statement never executed: err: | 0 | ||||||||||||||||||
| 1028 | if (flags & 0x4
| 0 | ||||||||||||||||||
| 1029 | X509_STORE_free(chain_store); never executed: X509_STORE_free(chain_store); | 0 | ||||||||||||||||||
| 1030 | X509_STORE_CTX_free(xs_ctx); | - | ||||||||||||||||||
| 1031 | - | |||||||||||||||||||
| 1032 | return never executed: rv;return rv;never executed: return rv; | 0 | ||||||||||||||||||
| 1033 | } | - | ||||||||||||||||||
| 1034 | - | |||||||||||||||||||
| 1035 | int ssl_cert_set_cert_store(CERT *c, X509_STORE *store, int chain, int ref) | - | ||||||||||||||||||
| 1036 | { | - | ||||||||||||||||||
| 1037 | X509_STORE **pstore; | - | ||||||||||||||||||
| 1038 | if (chain
| 0 | ||||||||||||||||||
| 1039 | pstore = &c->chain_store; never executed: pstore = &c->chain_store; | 0 | ||||||||||||||||||
| 1040 | else | - | ||||||||||||||||||
| 1041 | pstore = &c->verify_store; never executed: pstore = &c->verify_store; | 0 | ||||||||||||||||||
| 1042 | X509_STORE_free(*pstore); | - | ||||||||||||||||||
| 1043 | *pstore = store; | - | ||||||||||||||||||
| 1044 | if (ref
| 0 | ||||||||||||||||||
| 1045 | X509_STORE_up_ref(store); never executed: X509_STORE_up_ref(store); | 0 | ||||||||||||||||||
| 1046 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 1047 | } | - | ||||||||||||||||||
| 1048 | - | |||||||||||||||||||
| 1049 | static int ssl_security_default_callback(const SSL *s, const SSL_CTX *ctx, | - | ||||||||||||||||||
| 1050 | int op, int bits, int nid, void *other, | - | ||||||||||||||||||
| 1051 | void *ex) | - | ||||||||||||||||||
| 1052 | { | - | ||||||||||||||||||
| 1053 | int level, minbits; | - | ||||||||||||||||||
| 1054 | static const int minbits_table[5] = { 80, 112, 128, 192, 256 }; | - | ||||||||||||||||||
| 1055 | if (ctx
| 16365-672459 | ||||||||||||||||||
| 1056 | level = SSL_CTX_get_security_level(ctx); executed 16365 times by 1 test: level = SSL_CTX_get_security_level(ctx);Executed by:
| 16365 | ||||||||||||||||||
| 1057 | else | - | ||||||||||||||||||
| 1058 | level = SSL_get_security_level(s); executed 672459 times by 1 test: level = SSL_get_security_level(s);Executed by:
| 672459 | ||||||||||||||||||
| 1059 | - | |||||||||||||||||||
| 1060 | if (level <= 0
| 189294-499530 | ||||||||||||||||||
| 1061 | - | |||||||||||||||||||
| 1062 | - | |||||||||||||||||||
| 1063 | - | |||||||||||||||||||
| 1064 | - | |||||||||||||||||||
| 1065 | if (op == (7 | (4 << 16))
| 4-498877 | ||||||||||||||||||
| 1066 | return executed 4 times by 1 test: 0;return 0;Executed by:
executed 4 times by 1 test: return 0;Executed by:
| 4 | ||||||||||||||||||
| 1067 | return executed 499526 times by 1 test: 1;return 1;Executed by:
executed 499526 times by 1 test: return 1;Executed by:
| 499526 | ||||||||||||||||||
| 1068 | } | - | ||||||||||||||||||
| 1069 | if (level > 5
| 0-189294 | ||||||||||||||||||
| 1070 | level = 5; never executed: level = 5; | 0 | ||||||||||||||||||
| 1071 | minbits = minbits_table[level - 1]; | - | ||||||||||||||||||
| 1072 | switch (op) { | - | ||||||||||||||||||
| 1073 | case executed 41520 times by 1 test: (1 | (1 << 16)):case (1 | (1 << 16)):Executed by:
executed 41520 times by 1 test: case (1 | (1 << 16)):Executed by:
| 41520 | ||||||||||||||||||
| 1074 | case executed 1538 times by 1 test: (2 | (1 << 16)):case (2 | (1 << 16)):Executed by:
executed 1538 times by 1 test: case (2 | (1 << 16)):Executed by:
| 1538 | ||||||||||||||||||
| 1075 | case executed 1533 times by 1 test: (3 | (1 << 16)):case (3 | (1 << 16)):Executed by:
executed 1533 times by 1 test: case (3 | (1 << 16)):Executed by:
| 1533 | ||||||||||||||||||
| 1076 | { | - | ||||||||||||||||||
| 1077 | const SSL_CIPHER *c = other; | - | ||||||||||||||||||
| 1078 | - | |||||||||||||||||||
| 1079 | if (bits < minbits
| 86-44505 | ||||||||||||||||||
| 1080 | return executed 86 times by 1 test: 0;return 0;Executed by:
executed 86 times by 1 test: return 0;Executed by:
| 86 | ||||||||||||||||||
| 1081 | - | |||||||||||||||||||
| 1082 | if (c->algorithm_auth & 0x00000004U
| 46-44459 | ||||||||||||||||||
| 1083 | return executed 46 times by 1 test: 0;return 0;Executed by:
executed 46 times by 1 test: return 0;Executed by:
| 46 | ||||||||||||||||||
| 1084 | - | |||||||||||||||||||
| 1085 | if (c->algorithm_mac & 0x00000001U
| 0-44459 | ||||||||||||||||||
| 1086 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1087 | - | |||||||||||||||||||
| 1088 | if (minbits > 160
| 0-44459 | ||||||||||||||||||
| 1089 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1090 | - | |||||||||||||||||||
| 1091 | if (level >= 2
| 0-44459 | ||||||||||||||||||
| 1092 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1093 | - | |||||||||||||||||||
| 1094 | if (level >= 3
| 0-44459 | ||||||||||||||||||
| 1095 | !(c->algorithm_mkey & (0x00000002U | 0x00000004U))
| 0 | ||||||||||||||||||
| 1096 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1097 | break; executed 44459 times by 1 test: break;Executed by:
| 44459 | ||||||||||||||||||
| 1098 | } | - | ||||||||||||||||||
| 1099 | case executed 43696 times by 1 test: (9 | 0):case (9 | 0):Executed by:
executed 43696 times by 1 test: case (9 | 0):Executed by:
| 43696 | ||||||||||||||||||
| 1100 | if (!(s->method->ssl3_enc->enc_flags & 0x8)
| 2241-41455 | ||||||||||||||||||
| 1101 | - | |||||||||||||||||||
| 1102 | if (nid <= 0x0300
| 0-41455 | ||||||||||||||||||
| 1103 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1104 | - | |||||||||||||||||||
| 1105 | if (nid <= 0x0301
| 0-33766 | ||||||||||||||||||
| 1106 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1107 | - | |||||||||||||||||||
| 1108 | if (nid <= 0x0302
| 0-25282 | ||||||||||||||||||
| 1109 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1110 | } executed 41455 times by 1 test: else {end of blockExecuted by:
| 41455 | ||||||||||||||||||
| 1111 | - | |||||||||||||||||||
| 1112 | if (((((
| 0-1939 | ||||||||||||||||||
| 1113 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1114 | } executed 2241 times by 1 test: end of blockExecuted by:
| 2241 | ||||||||||||||||||
| 1115 | break; executed 43696 times by 1 test: break;Executed by:
| 43696 | ||||||||||||||||||
| 1116 | - | |||||||||||||||||||
| 1117 | case never executed: (15 | 0):case (15 | 0):never executed: case (15 | 0): | 0 | ||||||||||||||||||
| 1118 | if (level >= 2
| 0 | ||||||||||||||||||
| 1119 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1120 | break; never executed: break; | 0 | ||||||||||||||||||
| 1121 | case executed 4205 times by 1 test: (10 | 0):case (10 | 0):Executed by:
executed 4205 times by 1 test: case (10 | 0):Executed by:
| 4205 | ||||||||||||||||||
| 1122 | if (level >= 3
| 0-4205 | ||||||||||||||||||
| 1123 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1124 | break; executed 4205 times by 1 test: break;Executed by:
| 4205 | ||||||||||||||||||
| 1125 | default executed 96802 times by 1 test: :default:Executed by:
executed 96802 times by 1 test: default:Executed by:
| 96802 | ||||||||||||||||||
| 1126 | if (bits < minbits
| 0-96802 | ||||||||||||||||||
| 1127 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1128 | } executed 96802 times by 1 test: end of blockExecuted by:
| 96802 | ||||||||||||||||||
| 1129 | return executed 189162 times by 1 test: 1;return 1;Executed by:
executed 189162 times by 1 test: return 1;Executed by:
| 189162 | ||||||||||||||||||
| 1130 | } | - | ||||||||||||||||||
| 1131 | - | |||||||||||||||||||
| 1132 | int ssl_security(const SSL *s, int op, int bits, int nid, void *other) | - | ||||||||||||||||||
| 1133 | { | - | ||||||||||||||||||
| 1134 | return executed 672459 times by 1 test: s->cert->sec_cb(s, return s->cert->sec_cb(s, ((void *)0) , op, bits, nid, other, s->cert->sec_ex);Executed by:
executed 672459 times by 1 test: return s->cert->sec_cb(s, ((void *)0) , op, bits, nid, other, s->cert->sec_ex);Executed by:
| 672459 | ||||||||||||||||||
| 1135 | ((void *)0) executed 672459 times by 1 test: return s->cert->sec_cb(s, ((void *)0) , op, bits, nid, other, s->cert->sec_ex);Executed by:
| 672459 | ||||||||||||||||||
| 1136 | , op, bits, nid, other, s->cert->sec_ex); executed 672459 times by 1 test: return s->cert->sec_cb(s, ((void *)0) , op, bits, nid, other, s->cert->sec_ex);Executed by:
| 672459 | ||||||||||||||||||
| 1137 | } | - | ||||||||||||||||||
| 1138 | - | |||||||||||||||||||
| 1139 | int ssl_ctx_security(const SSL_CTX *ctx, int op, int bits, int nid, void *other) | - | ||||||||||||||||||
| 1140 | { | - | ||||||||||||||||||
| 1141 | return executed 16365 times by 1 test: ctx->cert->sec_cb(return ctx->cert->sec_cb( ((void *)0) , ctx, op, bits, nid, other, ctx->cert->sec_ex);Executed by:
executed 16365 times by 1 test: return ctx->cert->sec_cb( ((void *)0) , ctx, op, bits, nid, other, ctx->cert->sec_ex);Executed by:
| 16365 | ||||||||||||||||||
| 1142 | ((void *)0) executed 16365 times by 1 test: return ctx->cert->sec_cb( ((void *)0) , ctx, op, bits, nid, other, ctx->cert->sec_ex);Executed by:
| 16365 | ||||||||||||||||||
| 1143 | , ctx, op, bits, nid, other, executed 16365 times by 1 test: return ctx->cert->sec_cb( ((void *)0) , ctx, op, bits, nid, other, ctx->cert->sec_ex);Executed by:
| 16365 | ||||||||||||||||||
| 1144 | ctx->cert->sec_ex); executed 16365 times by 1 test: return ctx->cert->sec_cb( ((void *)0) , ctx, op, bits, nid, other, ctx->cert->sec_ex);Executed by:
| 16365 | ||||||||||||||||||
| 1145 | } | - | ||||||||||||||||||
| 1146 | - | |||||||||||||||||||
| 1147 | int ssl_cert_lookup_by_nid(int nid, size_t *pidx) | - | ||||||||||||||||||
| 1148 | { | - | ||||||||||||||||||
| 1149 | size_t i; | - | ||||||||||||||||||
| 1150 | - | |||||||||||||||||||
| 1151 | for (i = 0; i < (sizeof(ssl_cert_info)/sizeof((ssl_cert_info)[0]))
| 3-45652 | ||||||||||||||||||
| 1152 | if (ssl_cert_info[i].nid == nid
| 22006-23646 | ||||||||||||||||||
| 1153 | *pidx = i; | - | ||||||||||||||||||
| 1154 | return executed 22006 times by 1 test: 1;return 1;Executed by:
executed 22006 times by 1 test: return 1;Executed by:
| 22006 | ||||||||||||||||||
| 1155 | } | - | ||||||||||||||||||
| 1156 | } executed 23646 times by 1 test: end of blockExecuted by:
| 23646 | ||||||||||||||||||
| 1157 | - | |||||||||||||||||||
| 1158 | return executed 3 times by 1 test: 0;return 0;Executed by:
executed 3 times by 1 test: return 0;Executed by:
| 3 | ||||||||||||||||||
| 1159 | } | - | ||||||||||||||||||
| 1160 | - | |||||||||||||||||||
| 1161 | const SSL_CERT_LOOKUP *ssl_cert_lookup_by_pkey(const EVP_PKEY *pk, size_t *pidx) | - | ||||||||||||||||||
| 1162 | { | - | ||||||||||||||||||
| 1163 | int nid = EVP_PKEY_id(pk); | - | ||||||||||||||||||
| 1164 | size_t tmpidx; | - | ||||||||||||||||||
| 1165 | - | |||||||||||||||||||
| 1166 | if (nid == 0
| 0-20624 | ||||||||||||||||||
| 1167 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1168 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1169 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1170 | - | |||||||||||||||||||
| 1171 | if (!ssl_cert_lookup_by_nid(nid, &tmpidx)
| 3-20621 | ||||||||||||||||||
| 1172 | return executed 3 times by 1 test: return ((void *)0) ;Executed by:
executed 3 times by 1 test: return ((void *)0) ;Executed by:
| 3 | ||||||||||||||||||
| 1173 | ((void *)0) executed 3 times by 1 test: return ((void *)0) ;Executed by:
| 3 | ||||||||||||||||||
| 1174 | ; executed 3 times by 1 test: return ((void *)0) ;Executed by:
| 3 | ||||||||||||||||||
| 1175 | - | |||||||||||||||||||
| 1176 | if (pidx !=
| 509-20112 | ||||||||||||||||||
| 1177 | ((void *)0)
| 509-20112 | ||||||||||||||||||
| 1178 | ) | - | ||||||||||||||||||
| 1179 | * executed 20112 times by 1 test: pidx = tmpidx;*pidx = tmpidx;Executed by:
executed 20112 times by 1 test: *pidx = tmpidx;Executed by:
| 20112 | ||||||||||||||||||
| 1180 | - | |||||||||||||||||||
| 1181 | return executed 20621 times by 1 test: &ssl_cert_info[tmpidx];return &ssl_cert_info[tmpidx];Executed by:
executed 20621 times by 1 test: return &ssl_cert_info[tmpidx];Executed by:
| 20621 | ||||||||||||||||||
| 1182 | } | - | ||||||||||||||||||
| 1183 | - | |||||||||||||||||||
| 1184 | const SSL_CERT_LOOKUP *ssl_cert_lookup_by_idx(size_t idx) | - | ||||||||||||||||||
| 1185 | { | - | ||||||||||||||||||
| 1186 | if (idx >= (sizeof(ssl_cert_info)/sizeof((ssl_cert_info)[0]))
| 0-327134 | ||||||||||||||||||
| 1187 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1188 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1189 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 1190 | return executed 327134 times by 1 test: &ssl_cert_info[idx];return &ssl_cert_info[idx];Executed by:
executed 327134 times by 1 test: return &ssl_cert_info[idx];Executed by:
| 327134 | ||||||||||||||||||
| 1191 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |