| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/ssl/ssl_rsa.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | static int ssl_set_cert(CERT *c, X509 *x509); | - | ||||||||||||
| 10 | static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey); | - | ||||||||||||
| 11 | static int ssl_ctx_use_certificate_chain_bio(SSL_CTX *, BIO *); | - | ||||||||||||
| 12 | - | |||||||||||||
| 13 | int | - | ||||||||||||
| 14 | SSL_use_certificate(SSL *ssl, X509 *x) | - | ||||||||||||
| 15 | { | - | ||||||||||||
| 16 | if (x ==
| 0 | ||||||||||||
| 17 | ((void *)0)
| 0 | ||||||||||||
| 18 | ) { | - | ||||||||||||
| 19 | SSL_error_internal(ssl, (3|64), __FILE__, 77); | - | ||||||||||||
| 20 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 21 | } | - | ||||||||||||
| 22 | if (!ssl_cert_inst(&ssl->cert)
| 0 | ||||||||||||
| 23 | SSL_error_internal(ssl, (1|64), __FILE__, 81); | - | ||||||||||||
| 24 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 25 | } | - | ||||||||||||
| 26 | return never executed: (ssl_set_cert(ssl->cert, x));return (ssl_set_cert(ssl->cert, x));never executed: return (ssl_set_cert(ssl->cert, x)); | 0 | ||||||||||||
| 27 | } | - | ||||||||||||
| 28 | - | |||||||||||||
| 29 | int | - | ||||||||||||
| 30 | SSL_use_certificate_file(SSL *ssl, const char *file, int type) | - | ||||||||||||
| 31 | { | - | ||||||||||||
| 32 | int j; | - | ||||||||||||
| 33 | BIO *in; | - | ||||||||||||
| 34 | int ret = 0; | - | ||||||||||||
| 35 | X509 *x = | - | ||||||||||||
| 36 | ((void *)0) | - | ||||||||||||
| 37 | ; | - | ||||||||||||
| 38 | - | |||||||||||||
| 39 | in = BIO_new(BIO_s_file()); | - | ||||||||||||
| 40 | if (in ==
| 0 | ||||||||||||
| 41 | ((void *)0)
| 0 | ||||||||||||
| 42 | ) { | - | ||||||||||||
| 43 | SSL_error_internal(ssl, 7, __FILE__, 97); | - | ||||||||||||
| 44 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 45 | } | - | ||||||||||||
| 46 | - | |||||||||||||
| 47 | if (BIO_ctrl(in,108, 0x01|0x02,(char *)file) <= 0
| 0 | ||||||||||||
| 48 | SSL_error_internal(ssl, 2, __FILE__, 102); | - | ||||||||||||
| 49 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 50 | } | - | ||||||||||||
| 51 | if (type == 2
| 0 | ||||||||||||
| 52 | j = 13; | - | ||||||||||||
| 53 | x = d2i_X509_bio(in, | - | ||||||||||||
| 54 | ((void *)0) | - | ||||||||||||
| 55 | ); | - | ||||||||||||
| 56 | } never executed: else if (type == 1end of block
| 0 | ||||||||||||
| 57 | j = 9; | - | ||||||||||||
| 58 | x = PEM_read_bio_X509(in, | - | ||||||||||||
| 59 | ((void *)0) | - | ||||||||||||
| 60 | , | - | ||||||||||||
| 61 | ssl->ctx->default_passwd_callback, | - | ||||||||||||
| 62 | ssl->ctx->default_passwd_callback_userdata); | - | ||||||||||||
| 63 | } never executed: else {end of block | 0 | ||||||||||||
| 64 | SSL_error_internal(ssl, 124, __FILE__, 114); | - | ||||||||||||
| 65 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 66 | } | - | ||||||||||||
| 67 | - | |||||||||||||
| 68 | if (x ==
| 0 | ||||||||||||
| 69 | ((void *)0)
| 0 | ||||||||||||
| 70 | ) { | - | ||||||||||||
| 71 | SSL_error_internal(ssl, j, __FILE__, 119); | - | ||||||||||||
| 72 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 73 | } | - | ||||||||||||
| 74 | - | |||||||||||||
| 75 | ret = SSL_use_certificate(ssl, x); | - | ||||||||||||
| 76 | end: code before this statement never executed: end: | 0 | ||||||||||||
| 77 | X509_free(x); | - | ||||||||||||
| 78 | BIO_free(in); | - | ||||||||||||
| 79 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 80 | } | - | ||||||||||||
| 81 | - | |||||||||||||
| 82 | int | - | ||||||||||||
| 83 | SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len) | - | ||||||||||||
| 84 | { | - | ||||||||||||
| 85 | X509 *x; | - | ||||||||||||
| 86 | int ret; | - | ||||||||||||
| 87 | - | |||||||||||||
| 88 | x = d2i_X509( | - | ||||||||||||
| 89 | ((void *)0) | - | ||||||||||||
| 90 | , &d, (long)len); | - | ||||||||||||
| 91 | if (x ==
| 0 | ||||||||||||
| 92 | ((void *)0)
| 0 | ||||||||||||
| 93 | ) { | - | ||||||||||||
| 94 | SSL_error_internal(ssl, 13, __FILE__, 138); | - | ||||||||||||
| 95 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 96 | } | - | ||||||||||||
| 97 | - | |||||||||||||
| 98 | ret = SSL_use_certificate(ssl, x); | - | ||||||||||||
| 99 | X509_free(x); | - | ||||||||||||
| 100 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 101 | } | - | ||||||||||||
| 102 | - | |||||||||||||
| 103 | int | - | ||||||||||||
| 104 | SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa) | - | ||||||||||||
| 105 | { | - | ||||||||||||
| 106 | EVP_PKEY *pkey; | - | ||||||||||||
| 107 | int ret; | - | ||||||||||||
| 108 | - | |||||||||||||
| 109 | if (rsa ==
| 0 | ||||||||||||
| 110 | ((void *)0)
| 0 | ||||||||||||
| 111 | ) { | - | ||||||||||||
| 112 | SSL_error_internal(ssl, (3|64), __FILE__, 154); | - | ||||||||||||
| 113 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 114 | } | - | ||||||||||||
| 115 | if (!ssl_cert_inst(&ssl->cert)
| 0 | ||||||||||||
| 116 | SSL_error_internal(ssl, (1|64), __FILE__, 158); | - | ||||||||||||
| 117 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 118 | } | - | ||||||||||||
| 119 | if ((
| 0 | ||||||||||||
| 120 | ((void *)0)
| 0 | ||||||||||||
| 121 | ) { | - | ||||||||||||
| 122 | SSL_error_internal(ssl, 6, __FILE__, 162); | - | ||||||||||||
| 123 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 124 | } | - | ||||||||||||
| 125 | - | |||||||||||||
| 126 | RSA_up_ref(rsa); | - | ||||||||||||
| 127 | EVP_PKEY_assign((pkey),6, (char *)(rsa)); | - | ||||||||||||
| 128 | - | |||||||||||||
| 129 | ret = ssl_set_pkey(ssl->cert, pkey); | - | ||||||||||||
| 130 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 131 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 132 | } | - | ||||||||||||
| 133 | - | |||||||||||||
| 134 | static int | - | ||||||||||||
| 135 | ssl_set_pkey(CERT *c, EVP_PKEY *pkey) | - | ||||||||||||
| 136 | { | - | ||||||||||||
| 137 | int i; | - | ||||||||||||
| 138 | - | |||||||||||||
| 139 | i = ssl_cert_type( | - | ||||||||||||
| 140 | ((void *)0) | - | ||||||||||||
| 141 | , pkey); | - | ||||||||||||
| 142 | if (i < 0
| 0-63 | ||||||||||||
| 143 | ERR_put_error(20,(0xfff),(247),__FILE__,181); | - | ||||||||||||
| 144 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 145 | } | - | ||||||||||||
| 146 | - | |||||||||||||
| 147 | if (c->pkeys[i].x509 !=
| 0-63 | ||||||||||||
| 148 | ((void *)0)
| 0-63 | ||||||||||||
| 149 | ) { | - | ||||||||||||
| 150 | EVP_PKEY *pktmp; | - | ||||||||||||
| 151 | pktmp = X509_get_pubkey(c->pkeys[i].x509); | - | ||||||||||||
| 152 | EVP_PKEY_copy_parameters(pktmp, pkey); | - | ||||||||||||
| 153 | EVP_PKEY_free(pktmp); | - | ||||||||||||
| 154 | ERR_clear_error(); | - | ||||||||||||
| 155 | - | |||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | - | |||||||||||||
| 159 | - | |||||||||||||
| 160 | if ((
| 0-63 | ||||||||||||
| 161 | (
| 0-63 | ||||||||||||
| 162 | ; never executed: ; | 0 | ||||||||||||
| 163 | else | - | ||||||||||||
| 164 | if (!X509_check_private_key(c->pkeys[i].x509, pkey)
| 0-63 | ||||||||||||
| 165 | X509_free(c->pkeys[i].x509); | - | ||||||||||||
| 166 | c->pkeys[i].x509 = | - | ||||||||||||
| 167 | ((void *)0) | - | ||||||||||||
| 168 | ; | - | ||||||||||||
| 169 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 170 | } | - | ||||||||||||
| 171 | } executed 63 times by 3 tests: end of blockExecuted by:
| 63 | ||||||||||||
| 172 | - | |||||||||||||
| 173 | EVP_PKEY_free(c->pkeys[i].privatekey); | - | ||||||||||||
| 174 | CRYPTO_add_lock(&pkey->references,1,10,__FILE__,208); | - | ||||||||||||
| 175 | c->pkeys[i].privatekey = pkey; | - | ||||||||||||
| 176 | c->key = &(c->pkeys[i]); | - | ||||||||||||
| 177 | - | |||||||||||||
| 178 | c->valid = 0; | - | ||||||||||||
| 179 | return executed 63 times by 3 tests: (1);return (1);Executed by:
executed 63 times by 3 tests: return (1);Executed by:
| 63 | ||||||||||||
| 180 | } | - | ||||||||||||
| 181 | - | |||||||||||||
| 182 | int | - | ||||||||||||
| 183 | SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type) | - | ||||||||||||
| 184 | { | - | ||||||||||||
| 185 | int j, ret = 0; | - | ||||||||||||
| 186 | BIO *in; | - | ||||||||||||
| 187 | RSA *rsa = | - | ||||||||||||
| 188 | ((void *)0) | - | ||||||||||||
| 189 | ; | - | ||||||||||||
| 190 | - | |||||||||||||
| 191 | in = BIO_new(BIO_s_file()); | - | ||||||||||||
| 192 | if (in ==
| 0 | ||||||||||||
| 193 | ((void *)0)
| 0 | ||||||||||||
| 194 | ) { | - | ||||||||||||
| 195 | SSL_error_internal(ssl, 7, __FILE__, 225); | - | ||||||||||||
| 196 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 197 | } | - | ||||||||||||
| 198 | - | |||||||||||||
| 199 | if (BIO_ctrl(in,108, 0x01|0x02,(char *)file) <= 0
| 0 | ||||||||||||
| 200 | SSL_error_internal(ssl, 2, __FILE__, 230); | - | ||||||||||||
| 201 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 202 | } | - | ||||||||||||
| 203 | if (type == 2
| 0 | ||||||||||||
| 204 | j = 13; | - | ||||||||||||
| 205 | rsa = d2i_RSAPrivateKey_bio(in, | - | ||||||||||||
| 206 | ((void *)0) | - | ||||||||||||
| 207 | ); | - | ||||||||||||
| 208 | } never executed: else if (type == 1end of block
| 0 | ||||||||||||
| 209 | j = 9; | - | ||||||||||||
| 210 | rsa = PEM_read_bio_RSAPrivateKey(in, | - | ||||||||||||
| 211 | ((void *)0) | - | ||||||||||||
| 212 | , | - | ||||||||||||
| 213 | ssl->ctx->default_passwd_callback, | - | ||||||||||||
| 214 | ssl->ctx->default_passwd_callback_userdata); | - | ||||||||||||
| 215 | } never executed: else {end of block | 0 | ||||||||||||
| 216 | SSL_error_internal(ssl, 124, __FILE__, 242); | - | ||||||||||||
| 217 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 218 | } | - | ||||||||||||
| 219 | if (rsa ==
| 0 | ||||||||||||
| 220 | ((void *)0)
| 0 | ||||||||||||
| 221 | ) { | - | ||||||||||||
| 222 | SSL_error_internal(ssl, j, __FILE__, 246); | - | ||||||||||||
| 223 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 224 | } | - | ||||||||||||
| 225 | ret = SSL_use_RSAPrivateKey(ssl, rsa); | - | ||||||||||||
| 226 | RSA_free(rsa); | - | ||||||||||||
| 227 | end: code before this statement never executed: end: | 0 | ||||||||||||
| 228 | BIO_free(in); | - | ||||||||||||
| 229 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 230 | } | - | ||||||||||||
| 231 | - | |||||||||||||
| 232 | int | - | ||||||||||||
| 233 | SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, long len) | - | ||||||||||||
| 234 | { | - | ||||||||||||
| 235 | int ret; | - | ||||||||||||
| 236 | RSA *rsa; | - | ||||||||||||
| 237 | - | |||||||||||||
| 238 | if ((
| 0 | ||||||||||||
| 239 | ((void *)0)
| 0 | ||||||||||||
| 240 | , &d, (long)len)) ==
| 0 | ||||||||||||
| 241 | ((void *)0)
| 0 | ||||||||||||
| 242 | ) { | - | ||||||||||||
| 243 | SSL_error_internal(ssl, 13, __FILE__, 263); | - | ||||||||||||
| 244 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 245 | } | - | ||||||||||||
| 246 | - | |||||||||||||
| 247 | ret = SSL_use_RSAPrivateKey(ssl, rsa); | - | ||||||||||||
| 248 | RSA_free(rsa); | - | ||||||||||||
| 249 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 250 | } | - | ||||||||||||
| 251 | - | |||||||||||||
| 252 | int | - | ||||||||||||
| 253 | SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey) | - | ||||||||||||
| 254 | { | - | ||||||||||||
| 255 | int ret; | - | ||||||||||||
| 256 | - | |||||||||||||
| 257 | if (pkey ==
| 0 | ||||||||||||
| 258 | ((void *)0)
| 0 | ||||||||||||
| 259 | ) { | - | ||||||||||||
| 260 | SSL_error_internal(ssl, (3|64), __FILE__, 278); | - | ||||||||||||
| 261 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 262 | } | - | ||||||||||||
| 263 | if (!ssl_cert_inst(&ssl->cert)
| 0 | ||||||||||||
| 264 | SSL_error_internal(ssl, (1|64), __FILE__, 282); | - | ||||||||||||
| 265 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 266 | } | - | ||||||||||||
| 267 | ret = ssl_set_pkey(ssl->cert, pkey); | - | ||||||||||||
| 268 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 269 | } | - | ||||||||||||
| 270 | - | |||||||||||||
| 271 | int | - | ||||||||||||
| 272 | SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type) | - | ||||||||||||
| 273 | { | - | ||||||||||||
| 274 | int j, ret = 0; | - | ||||||||||||
| 275 | BIO *in; | - | ||||||||||||
| 276 | EVP_PKEY *pkey = | - | ||||||||||||
| 277 | ((void *)0) | - | ||||||||||||
| 278 | ; | - | ||||||||||||
| 279 | - | |||||||||||||
| 280 | in = BIO_new(BIO_s_file()); | - | ||||||||||||
| 281 | if (in ==
| 0 | ||||||||||||
| 282 | ((void *)0)
| 0 | ||||||||||||
| 283 | ) { | - | ||||||||||||
| 284 | SSL_error_internal(ssl, 7, __FILE__, 298); | - | ||||||||||||
| 285 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 286 | } | - | ||||||||||||
| 287 | - | |||||||||||||
| 288 | if (BIO_ctrl(in,108, 0x01|0x02,(char *)file) <= 0
| 0 | ||||||||||||
| 289 | SSL_error_internal(ssl, 2, __FILE__, 303); | - | ||||||||||||
| 290 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 291 | } | - | ||||||||||||
| 292 | if (type == 1
| 0 | ||||||||||||
| 293 | j = 9; | - | ||||||||||||
| 294 | pkey = PEM_read_bio_PrivateKey(in, | - | ||||||||||||
| 295 | ((void *)0) | - | ||||||||||||
| 296 | , | - | ||||||||||||
| 297 | ssl->ctx->default_passwd_callback, | - | ||||||||||||
| 298 | ssl->ctx->default_passwd_callback_userdata); | - | ||||||||||||
| 299 | } never executed: else if (type == 2end of block
| 0 | ||||||||||||
| 300 | j = 13; | - | ||||||||||||
| 301 | pkey = d2i_PrivateKey_bio(in, | - | ||||||||||||
| 302 | ((void *)0) | - | ||||||||||||
| 303 | ); | - | ||||||||||||
| 304 | } never executed: else {end of block | 0 | ||||||||||||
| 305 | SSL_error_internal(ssl, 124, __FILE__, 315); | - | ||||||||||||
| 306 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 307 | } | - | ||||||||||||
| 308 | if (pkey ==
| 0 | ||||||||||||
| 309 | ((void *)0)
| 0 | ||||||||||||
| 310 | ) { | - | ||||||||||||
| 311 | SSL_error_internal(ssl, j, __FILE__, 319); | - | ||||||||||||
| 312 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 313 | } | - | ||||||||||||
| 314 | ret = SSL_use_PrivateKey(ssl, pkey); | - | ||||||||||||
| 315 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 316 | end: code before this statement never executed: end: | 0 | ||||||||||||
| 317 | BIO_free(in); | - | ||||||||||||
| 318 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 319 | } | - | ||||||||||||
| 320 | - | |||||||||||||
| 321 | int | - | ||||||||||||
| 322 | SSL_use_PrivateKey_ASN1(int type, SSL *ssl, const unsigned char *d, long len) | - | ||||||||||||
| 323 | { | - | ||||||||||||
| 324 | int ret; | - | ||||||||||||
| 325 | EVP_PKEY *pkey; | - | ||||||||||||
| 326 | - | |||||||||||||
| 327 | if ((
| 0 | ||||||||||||
| 328 | ((void *)0)
| 0 | ||||||||||||
| 329 | , &d, (long)len)) ==
| 0 | ||||||||||||
| 330 | ((void *)0)
| 0 | ||||||||||||
| 331 | ) { | - | ||||||||||||
| 332 | SSL_error_internal(ssl, 13, __FILE__, 336); | - | ||||||||||||
| 333 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 334 | } | - | ||||||||||||
| 335 | - | |||||||||||||
| 336 | ret = SSL_use_PrivateKey(ssl, pkey); | - | ||||||||||||
| 337 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 338 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 339 | } | - | ||||||||||||
| 340 | - | |||||||||||||
| 341 | int | - | ||||||||||||
| 342 | SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) | - | ||||||||||||
| 343 | { | - | ||||||||||||
| 344 | if (x ==
| 0-63 | ||||||||||||
| 345 | ((void *)0)
| 0-63 | ||||||||||||
| 346 | ) { | - | ||||||||||||
| 347 | ERR_put_error(20,(0xfff),((3|64)),__FILE__,349); | - | ||||||||||||
| 348 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 349 | } | - | ||||||||||||
| 350 | if (!ssl_cert_inst(&ctx->internal->cert)
| 0-63 | ||||||||||||
| 351 | ERR_put_error(20,(0xfff),((1|64)),__FILE__,353); | - | ||||||||||||
| 352 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 353 | } | - | ||||||||||||
| 354 | return executed 63 times by 3 tests: (ssl_set_cert(ctx->internal->cert, x));return (ssl_set_cert(ctx->internal->cert, x));Executed by:
executed 63 times by 3 tests: return (ssl_set_cert(ctx->internal->cert, x));Executed by:
| 63 | ||||||||||||
| 355 | } | - | ||||||||||||
| 356 | - | |||||||||||||
| 357 | static int | - | ||||||||||||
| 358 | ssl_set_cert(CERT *c, X509 *x) | - | ||||||||||||
| 359 | { | - | ||||||||||||
| 360 | EVP_PKEY *pkey; | - | ||||||||||||
| 361 | int i; | - | ||||||||||||
| 362 | - | |||||||||||||
| 363 | pkey = X509_get_pubkey(x); | - | ||||||||||||
| 364 | if (pkey ==
| 0-63 | ||||||||||||
| 365 | ((void *)0)
| 0-63 | ||||||||||||
| 366 | ) { | - | ||||||||||||
| 367 | ERR_put_error(20,(0xfff),(268),__FILE__,367); | - | ||||||||||||
| 368 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 369 | } | - | ||||||||||||
| 370 | - | |||||||||||||
| 371 | i = ssl_cert_type(x, pkey); | - | ||||||||||||
| 372 | if (i < 0
| 0-63 | ||||||||||||
| 373 | ERR_put_error(20,(0xfff),(247),__FILE__,373); | - | ||||||||||||
| 374 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 375 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 376 | } | - | ||||||||||||
| 377 | - | |||||||||||||
| 378 | if (c->pkeys[i].privatekey !=
| 0-63 | ||||||||||||
| 379 | ((void *)0)
| 0-63 | ||||||||||||
| 380 | ) { | - | ||||||||||||
| 381 | EVP_PKEY_copy_parameters(pkey, c->pkeys[i].privatekey); | - | ||||||||||||
| 382 | ERR_clear_error(); | - | ||||||||||||
| 383 | - | |||||||||||||
| 384 | - | |||||||||||||
| 385 | - | |||||||||||||
| 386 | - | |||||||||||||
| 387 | - | |||||||||||||
| 388 | if ((
| 0 | ||||||||||||
| 389 | (
| 0 | ||||||||||||
| 390 | 0x0001)
| 0 | ||||||||||||
| 391 | ; never executed: ; | 0 | ||||||||||||
| 392 | else | - | ||||||||||||
| 393 | if (!X509_check_private_key(x, c->pkeys[i].privatekey)
| 0 | ||||||||||||
| 394 | - | |||||||||||||
| 395 | - | |||||||||||||
| 396 | - | |||||||||||||
| 397 | - | |||||||||||||
| 398 | - | |||||||||||||
| 399 | - | |||||||||||||
| 400 | EVP_PKEY_free(c->pkeys[i].privatekey); | - | ||||||||||||
| 401 | c->pkeys[i].privatekey = | - | ||||||||||||
| 402 | ((void *)0) | - | ||||||||||||
| 403 | ; | - | ||||||||||||
| 404 | - | |||||||||||||
| 405 | ERR_clear_error(); | - | ||||||||||||
| 406 | } never executed: end of block | 0 | ||||||||||||
| 407 | } never executed: end of block | 0 | ||||||||||||
| 408 | - | |||||||||||||
| 409 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 410 | - | |||||||||||||
| 411 | X509_free(c->pkeys[i].x509); | - | ||||||||||||
| 412 | CRYPTO_add_lock(&x->references,1,3,__FILE__,408); | - | ||||||||||||
| 413 | c->pkeys[i].x509 = x; | - | ||||||||||||
| 414 | c->key = &(c->pkeys[i]); | - | ||||||||||||
| 415 | - | |||||||||||||
| 416 | c->valid = 0; | - | ||||||||||||
| 417 | return executed 63 times by 3 tests: (1);return (1);Executed by:
executed 63 times by 3 tests: return (1);Executed by:
| 63 | ||||||||||||
| 418 | } | - | ||||||||||||
| 419 | - | |||||||||||||
| 420 | int | - | ||||||||||||
| 421 | SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type) | - | ||||||||||||
| 422 | { | - | ||||||||||||
| 423 | int j; | - | ||||||||||||
| 424 | BIO *in; | - | ||||||||||||
| 425 | int ret = 0; | - | ||||||||||||
| 426 | X509 *x = | - | ||||||||||||
| 427 | ((void *)0) | - | ||||||||||||
| 428 | ; | - | ||||||||||||
| 429 | - | |||||||||||||
| 430 | in = BIO_new(BIO_s_file()); | - | ||||||||||||
| 431 | if (in ==
| 0-59 | ||||||||||||
| 432 | ((void *)0)
| 0-59 | ||||||||||||
| 433 | ) { | - | ||||||||||||
| 434 | ERR_put_error(20,(0xfff),(7),__FILE__,426); | - | ||||||||||||
| 435 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 436 | } | - | ||||||||||||
| 437 | - | |||||||||||||
| 438 | if (BIO_ctrl(in,108, 0x01|0x02,(char *)file) <= 0
| 0-59 | ||||||||||||
| 439 | ERR_put_error(20,(0xfff),(2),__FILE__,431); | - | ||||||||||||
| 440 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 441 | } | - | ||||||||||||
| 442 | if (type == 2
| 0-59 | ||||||||||||
| 443 | j = 13; | - | ||||||||||||
| 444 | x = d2i_X509_bio(in, | - | ||||||||||||
| 445 | ((void *)0) | - | ||||||||||||
| 446 | ); | - | ||||||||||||
| 447 | } never executed: else if (type == 1end of block
| 0-59 | ||||||||||||
| 448 | j = 9; | - | ||||||||||||
| 449 | x = PEM_read_bio_X509(in, | - | ||||||||||||
| 450 | ((void *)0) | - | ||||||||||||
| 451 | , ctx->default_passwd_callback, | - | ||||||||||||
| 452 | ctx->default_passwd_callback_userdata); | - | ||||||||||||
| 453 | } executed 59 times by 2 tests: else {end of blockExecuted by:
| 59 | ||||||||||||
| 454 | ERR_put_error(20,(0xfff),(124),__FILE__,442); | - | ||||||||||||
| 455 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 456 | } | - | ||||||||||||
| 457 | - | |||||||||||||
| 458 | if (x ==
| 0-59 | ||||||||||||
| 459 | ((void *)0)
| 0-59 | ||||||||||||
| 460 | ) { | - | ||||||||||||
| 461 | ERR_put_error(20,(0xfff),(j),__FILE__,447); | - | ||||||||||||
| 462 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 463 | } | - | ||||||||||||
| 464 | - | |||||||||||||
| 465 | ret = SSL_CTX_use_certificate(ctx, x); | - | ||||||||||||
| 466 | end: code before this statement executed 59 times by 2 tests: end:Executed by:
| 59 | ||||||||||||
| 467 | X509_free(x); | - | ||||||||||||
| 468 | BIO_free(in); | - | ||||||||||||
| 469 | return executed 59 times by 2 tests: (ret);return (ret);Executed by:
executed 59 times by 2 tests: return (ret);Executed by:
| 59 | ||||||||||||
| 470 | } | - | ||||||||||||
| 471 | - | |||||||||||||
| 472 | int | - | ||||||||||||
| 473 | SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d) | - | ||||||||||||
| 474 | { | - | ||||||||||||
| 475 | X509 *x; | - | ||||||||||||
| 476 | int ret; | - | ||||||||||||
| 477 | - | |||||||||||||
| 478 | x = d2i_X509( | - | ||||||||||||
| 479 | ((void *)0) | - | ||||||||||||
| 480 | , &d, (long)len); | - | ||||||||||||
| 481 | if (x ==
| 0 | ||||||||||||
| 482 | ((void *)0)
| 0 | ||||||||||||
| 483 | ) { | - | ||||||||||||
| 484 | ERR_put_error(20,(0xfff),(13),__FILE__,466); | - | ||||||||||||
| 485 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 486 | } | - | ||||||||||||
| 487 | - | |||||||||||||
| 488 | ret = SSL_CTX_use_certificate(ctx, x); | - | ||||||||||||
| 489 | X509_free(x); | - | ||||||||||||
| 490 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 491 | } | - | ||||||||||||
| 492 | - | |||||||||||||
| 493 | int | - | ||||||||||||
| 494 | SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa) | - | ||||||||||||
| 495 | { | - | ||||||||||||
| 496 | int ret; | - | ||||||||||||
| 497 | EVP_PKEY *pkey; | - | ||||||||||||
| 498 | - | |||||||||||||
| 499 | if (rsa ==
| 0 | ||||||||||||
| 500 | ((void *)0)
| 0 | ||||||||||||
| 501 | ) { | - | ||||||||||||
| 502 | ERR_put_error(20,(0xfff),((3|64)),__FILE__,482); | - | ||||||||||||
| 503 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 504 | } | - | ||||||||||||
| 505 | if (!ssl_cert_inst(&ctx->internal->cert)
| 0 | ||||||||||||
| 506 | ERR_put_error(20,(0xfff),((1|64)),__FILE__,486); | - | ||||||||||||
| 507 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 508 | } | - | ||||||||||||
| 509 | if ((
| 0 | ||||||||||||
| 510 | ((void *)0)
| 0 | ||||||||||||
| 511 | ) { | - | ||||||||||||
| 512 | ERR_put_error(20,(0xfff),(6),__FILE__,490); | - | ||||||||||||
| 513 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 514 | } | - | ||||||||||||
| 515 | - | |||||||||||||
| 516 | RSA_up_ref(rsa); | - | ||||||||||||
| 517 | EVP_PKEY_assign((pkey),6, (char *)(rsa)); | - | ||||||||||||
| 518 | - | |||||||||||||
| 519 | ret = ssl_set_pkey(ctx->internal->cert, pkey); | - | ||||||||||||
| 520 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 521 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 522 | } | - | ||||||||||||
| 523 | - | |||||||||||||
| 524 | int | - | ||||||||||||
| 525 | SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type) | - | ||||||||||||
| 526 | { | - | ||||||||||||
| 527 | int j, ret = 0; | - | ||||||||||||
| 528 | BIO *in; | - | ||||||||||||
| 529 | RSA *rsa = | - | ||||||||||||
| 530 | ((void *)0) | - | ||||||||||||
| 531 | ; | - | ||||||||||||
| 532 | - | |||||||||||||
| 533 | in = BIO_new(BIO_s_file()); | - | ||||||||||||
| 534 | if (in ==
| 0 | ||||||||||||
| 535 | ((void *)0)
| 0 | ||||||||||||
| 536 | ) { | - | ||||||||||||
| 537 | ERR_put_error(20,(0xfff),(7),__FILE__,511); | - | ||||||||||||
| 538 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 539 | } | - | ||||||||||||
| 540 | - | |||||||||||||
| 541 | if (BIO_ctrl(in,108, 0x01|0x02,(char *)file) <= 0
| 0 | ||||||||||||
| 542 | ERR_put_error(20,(0xfff),(2),__FILE__,516); | - | ||||||||||||
| 543 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 544 | } | - | ||||||||||||
| 545 | if (type == 2
| 0 | ||||||||||||
| 546 | j = 13; | - | ||||||||||||
| 547 | rsa = d2i_RSAPrivateKey_bio(in, | - | ||||||||||||
| 548 | ((void *)0) | - | ||||||||||||
| 549 | ); | - | ||||||||||||
| 550 | } never executed: else if (type == 1end of block
| 0 | ||||||||||||
| 551 | j = 9; | - | ||||||||||||
| 552 | rsa = PEM_read_bio_RSAPrivateKey(in, | - | ||||||||||||
| 553 | ((void *)0) | - | ||||||||||||
| 554 | , | - | ||||||||||||
| 555 | ctx->default_passwd_callback, | - | ||||||||||||
| 556 | ctx->default_passwd_callback_userdata); | - | ||||||||||||
| 557 | } never executed: else {end of block | 0 | ||||||||||||
| 558 | ERR_put_error(20,(0xfff),(124),__FILE__,528); | - | ||||||||||||
| 559 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 560 | } | - | ||||||||||||
| 561 | if (rsa ==
| 0 | ||||||||||||
| 562 | ((void *)0)
| 0 | ||||||||||||
| 563 | ) { | - | ||||||||||||
| 564 | ERR_put_error(20,(0xfff),(j),__FILE__,532); | - | ||||||||||||
| 565 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 566 | } | - | ||||||||||||
| 567 | ret = SSL_CTX_use_RSAPrivateKey(ctx, rsa); | - | ||||||||||||
| 568 | RSA_free(rsa); | - | ||||||||||||
| 569 | end: code before this statement never executed: end: | 0 | ||||||||||||
| 570 | BIO_free(in); | - | ||||||||||||
| 571 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 572 | } | - | ||||||||||||
| 573 | - | |||||||||||||
| 574 | int | - | ||||||||||||
| 575 | SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len) | - | ||||||||||||
| 576 | { | - | ||||||||||||
| 577 | int ret; | - | ||||||||||||
| 578 | RSA *rsa; | - | ||||||||||||
| 579 | - | |||||||||||||
| 580 | if ((
| 0 | ||||||||||||
| 581 | ((void *)0)
| 0 | ||||||||||||
| 582 | , &d, (long)len)) ==
| 0 | ||||||||||||
| 583 | ((void *)0)
| 0 | ||||||||||||
| 584 | ) { | - | ||||||||||||
| 585 | ERR_put_error(20,(0xfff),(13),__FILE__,549); | - | ||||||||||||
| 586 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 587 | } | - | ||||||||||||
| 588 | - | |||||||||||||
| 589 | ret = SSL_CTX_use_RSAPrivateKey(ctx, rsa); | - | ||||||||||||
| 590 | RSA_free(rsa); | - | ||||||||||||
| 591 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 592 | } | - | ||||||||||||
| 593 | - | |||||||||||||
| 594 | int | - | ||||||||||||
| 595 | SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) | - | ||||||||||||
| 596 | { | - | ||||||||||||
| 597 | if (pkey ==
| 0-63 | ||||||||||||
| 598 | ((void *)0)
| 0-63 | ||||||||||||
| 599 | ) { | - | ||||||||||||
| 600 | ERR_put_error(20,(0xfff),((3|64)),__FILE__,562); | - | ||||||||||||
| 601 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 602 | } | - | ||||||||||||
| 603 | if (!ssl_cert_inst(&ctx->internal->cert)
| 0-63 | ||||||||||||
| 604 | ERR_put_error(20,(0xfff),((1|64)),__FILE__,566); | - | ||||||||||||
| 605 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 606 | } | - | ||||||||||||
| 607 | return executed 63 times by 3 tests: (ssl_set_pkey(ctx->internal->cert, pkey));return (ssl_set_pkey(ctx->internal->cert, pkey));Executed by:
executed 63 times by 3 tests: return (ssl_set_pkey(ctx->internal->cert, pkey));Executed by:
| 63 | ||||||||||||
| 608 | } | - | ||||||||||||
| 609 | - | |||||||||||||
| 610 | int | - | ||||||||||||
| 611 | SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type) | - | ||||||||||||
| 612 | { | - | ||||||||||||
| 613 | int j, ret = 0; | - | ||||||||||||
| 614 | BIO *in; | - | ||||||||||||
| 615 | EVP_PKEY *pkey = | - | ||||||||||||
| 616 | ((void *)0) | - | ||||||||||||
| 617 | ; | - | ||||||||||||
| 618 | - | |||||||||||||
| 619 | in = BIO_new(BIO_s_file()); | - | ||||||||||||
| 620 | if (in ==
| 0-59 | ||||||||||||
| 621 | ((void *)0)
| 0-59 | ||||||||||||
| 622 | ) { | - | ||||||||||||
| 623 | ERR_put_error(20,(0xfff),(7),__FILE__,581); | - | ||||||||||||
| 624 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 625 | } | - | ||||||||||||
| 626 | - | |||||||||||||
| 627 | if (BIO_ctrl(in,108, 0x01|0x02,(char *)file) <= 0
| 0-59 | ||||||||||||
| 628 | ERR_put_error(20,(0xfff),(2),__FILE__,586); | - | ||||||||||||
| 629 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 630 | } | - | ||||||||||||
| 631 | if (type == 1
| 0-59 | ||||||||||||
| 632 | j = 9; | - | ||||||||||||
| 633 | pkey = PEM_read_bio_PrivateKey(in, | - | ||||||||||||
| 634 | ((void *)0) | - | ||||||||||||
| 635 | , | - | ||||||||||||
| 636 | ctx->default_passwd_callback, | - | ||||||||||||
| 637 | ctx->default_passwd_callback_userdata); | - | ||||||||||||
| 638 | } executed 59 times by 2 tests: else if (type == 2end of blockExecuted by:
| 0-59 | ||||||||||||
| 639 | j = 13; | - | ||||||||||||
| 640 | pkey = d2i_PrivateKey_bio(in, | - | ||||||||||||
| 641 | ((void *)0) | - | ||||||||||||
| 642 | ); | - | ||||||||||||
| 643 | } never executed: else {end of block | 0 | ||||||||||||
| 644 | ERR_put_error(20,(0xfff),(124),__FILE__,598); | - | ||||||||||||
| 645 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 646 | } | - | ||||||||||||
| 647 | if (pkey ==
| 0-59 | ||||||||||||
| 648 | ((void *)0)
| 0-59 | ||||||||||||
| 649 | ) { | - | ||||||||||||
| 650 | ERR_put_error(20,(0xfff),(j),__FILE__,602); | - | ||||||||||||
| 651 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 652 | } | - | ||||||||||||
| 653 | ret = SSL_CTX_use_PrivateKey(ctx, pkey); | - | ||||||||||||
| 654 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 655 | end: code before this statement executed 59 times by 2 tests: end:Executed by:
| 59 | ||||||||||||
| 656 | BIO_free(in); | - | ||||||||||||
| 657 | return executed 59 times by 2 tests: (ret);return (ret);Executed by:
executed 59 times by 2 tests: return (ret);Executed by:
| 59 | ||||||||||||
| 658 | } | - | ||||||||||||
| 659 | - | |||||||||||||
| 660 | int | - | ||||||||||||
| 661 | SSL_CTX_use_PrivateKey_ASN1(int type, SSL_CTX *ctx, const unsigned char *d, | - | ||||||||||||
| 662 | long len) | - | ||||||||||||
| 663 | { | - | ||||||||||||
| 664 | int ret; | - | ||||||||||||
| 665 | EVP_PKEY *pkey; | - | ||||||||||||
| 666 | - | |||||||||||||
| 667 | if ((
| 0 | ||||||||||||
| 668 | ((void *)0)
| 0 | ||||||||||||
| 669 | , &d, (long)len)) ==
| 0 | ||||||||||||
| 670 | ((void *)0)
| 0 | ||||||||||||
| 671 | ) { | - | ||||||||||||
| 672 | ERR_put_error(20,(0xfff),(13),__FILE__,620); | - | ||||||||||||
| 673 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||
| 674 | } | - | ||||||||||||
| 675 | - | |||||||||||||
| 676 | ret = SSL_CTX_use_PrivateKey(ctx, pkey); | - | ||||||||||||
| 677 | EVP_PKEY_free(pkey); | - | ||||||||||||
| 678 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 679 | } | - | ||||||||||||
| 680 | - | |||||||||||||
| 681 | - | |||||||||||||
| 682 | - | |||||||||||||
| 683 | - | |||||||||||||
| 684 | - | |||||||||||||
| 685 | - | |||||||||||||
| 686 | - | |||||||||||||
| 687 | static int | - | ||||||||||||
| 688 | ssl_ctx_use_certificate_chain_bio(SSL_CTX *ctx, BIO *in) | - | ||||||||||||
| 689 | { | - | ||||||||||||
| 690 | int ret = 0; | - | ||||||||||||
| 691 | X509 *x = | - | ||||||||||||
| 692 | ((void *)0) | - | ||||||||||||
| 693 | ; | - | ||||||||||||
| 694 | - | |||||||||||||
| 695 | ERR_clear_error(); | - | ||||||||||||
| 696 | - | |||||||||||||
| 697 | x = PEM_read_bio_X509_AUX(in, | - | ||||||||||||
| 698 | ((void *)0) | - | ||||||||||||
| 699 | , ctx->default_passwd_callback, | - | ||||||||||||
| 700 | ctx->default_passwd_callback_userdata); | - | ||||||||||||
| 701 | if (x ==
| 0-4 | ||||||||||||
| 702 | ((void *)0)
| 0-4 | ||||||||||||
| 703 | ) { | - | ||||||||||||
| 704 | ERR_put_error(20,(0xfff),(9),__FILE__,646); | - | ||||||||||||
| 705 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 706 | } | - | ||||||||||||
| 707 | - | |||||||||||||
| 708 | ret = SSL_CTX_use_certificate(ctx, x); | - | ||||||||||||
| 709 | - | |||||||||||||
| 710 | if (ERR_peek_error() != 0
| 0-4 | ||||||||||||
| 711 | ret = 0; never executed: ret = 0; | 0 | ||||||||||||
| 712 | - | |||||||||||||
| 713 | if (ret
| 0-4 | ||||||||||||
| 714 | - | |||||||||||||
| 715 | - | |||||||||||||
| 716 | - | |||||||||||||
| 717 | - | |||||||||||||
| 718 | X509 *ca; | - | ||||||||||||
| 719 | int r; | - | ||||||||||||
| 720 | unsigned long err; | - | ||||||||||||
| 721 | - | |||||||||||||
| 722 | sk_pop_free(((_STACK*) (1 ? (ctx->extra_certs) : (struct stack_st_X509*)0)), ((void (*)(void *)) ((1 ? (X509_free) : (void (*)(X509 *))0)))); | - | ||||||||||||
| 723 | ctx->extra_certs = | - | ||||||||||||
| 724 | ((void *)0) | - | ||||||||||||
| 725 | ; | - | ||||||||||||
| 726 | - | |||||||||||||
| 727 | while ((
| 0-4 | ||||||||||||
| 728 | ((void *)0)
| 0-4 | ||||||||||||
| 729 | ,
| 0-4 | ||||||||||||
| 730 | ctx->default_passwd_callback,
| 0-4 | ||||||||||||
| 731 | ctx->default_passwd_callback_userdata)) !=
| 0-4 | ||||||||||||
| 732 | ((void *)0)
| 0-4 | ||||||||||||
| 733 | ) { | - | ||||||||||||
| 734 | r = SSL_CTX_ctrl(ctx,14,0,(char *)ca); | - | ||||||||||||
| 735 | if (!r
| 0 | ||||||||||||
| 736 | X509_free(ca); | - | ||||||||||||
| 737 | ret = 0; | - | ||||||||||||
| 738 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 739 | } | - | ||||||||||||
| 740 | - | |||||||||||||
| 741 | - | |||||||||||||
| 742 | - | |||||||||||||
| 743 | - | |||||||||||||
| 744 | - | |||||||||||||
| 745 | - | |||||||||||||
| 746 | } never executed: end of block | 0 | ||||||||||||
| 747 | - | |||||||||||||
| 748 | - | |||||||||||||
| 749 | err = ERR_peek_last_error(); | - | ||||||||||||
| 750 | if ((
| 0-4 | ||||||||||||
| 751 | (
| 0-4 | ||||||||||||
| 752 | ERR_clear_error(); executed 4 times by 1 test: ERR_clear_error();Executed by:
| 4 | ||||||||||||
| 753 | else | - | ||||||||||||
| 754 | ret = 0; never executed: ret = 0; | 0 | ||||||||||||
| 755 | } | - | ||||||||||||
| 756 | - | |||||||||||||
| 757 | end: code before this statement executed 4 times by 1 test: end:Executed by:
| 4 | ||||||||||||
| 758 | X509_free(x); | - | ||||||||||||
| 759 | return executed 4 times by 1 test: (ret);return (ret);Executed by:
executed 4 times by 1 test: return (ret);Executed by:
| 4 | ||||||||||||
| 760 | } | - | ||||||||||||
| 761 | - | |||||||||||||
| 762 | int | - | ||||||||||||
| 763 | SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file) | - | ||||||||||||
| 764 | { | - | ||||||||||||
| 765 | BIO *in; | - | ||||||||||||
| 766 | int ret = 0; | - | ||||||||||||
| 767 | - | |||||||||||||
| 768 | in = BIO_new(BIO_s_file()); | - | ||||||||||||
| 769 | if (in ==
| 0 | ||||||||||||
| 770 | ((void *)0)
| 0 | ||||||||||||
| 771 | ) { | - | ||||||||||||
| 772 | ERR_put_error(20,(0xfff),(7),__FILE__,706); | - | ||||||||||||
| 773 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 774 | } | - | ||||||||||||
| 775 | - | |||||||||||||
| 776 | if (BIO_ctrl(in,108, 0x01|0x02,(char *)file) <= 0
| 0 | ||||||||||||
| 777 | ERR_put_error(20,(0xfff),(2),__FILE__,711); | - | ||||||||||||
| 778 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 779 | } | - | ||||||||||||
| 780 | - | |||||||||||||
| 781 | ret = ssl_ctx_use_certificate_chain_bio(ctx, in); | - | ||||||||||||
| 782 | - | |||||||||||||
| 783 | end: code before this statement never executed: end: | 0 | ||||||||||||
| 784 | BIO_free(in); | - | ||||||||||||
| 785 | return never executed: (ret);return (ret);never executed: return (ret); | 0 | ||||||||||||
| 786 | } | - | ||||||||||||
| 787 | - | |||||||||||||
| 788 | int | - | ||||||||||||
| 789 | SSL_CTX_use_certificate_chain_mem(SSL_CTX *ctx, void *buf, int len) | - | ||||||||||||
| 790 | { | - | ||||||||||||
| 791 | BIO *in; | - | ||||||||||||
| 792 | int ret = 0; | - | ||||||||||||
| 793 | - | |||||||||||||
| 794 | in = BIO_new_mem_buf(buf, len); | - | ||||||||||||
| 795 | if (in ==
| 0-4 | ||||||||||||
| 796 | ((void *)0)
| 0-4 | ||||||||||||
| 797 | ) { | - | ||||||||||||
| 798 | ERR_put_error(20,(0xfff),(7),__FILE__,730); | - | ||||||||||||
| 799 | goto never executed: end;goto end;never executed: goto end; | 0 | ||||||||||||
| 800 | } | - | ||||||||||||
| 801 | - | |||||||||||||
| 802 | ret = ssl_ctx_use_certificate_chain_bio(ctx, in); | - | ||||||||||||
| 803 | - | |||||||||||||
| 804 | end: code before this statement executed 4 times by 1 test: end:Executed by:
| 4 | ||||||||||||
| 805 | BIO_free(in); | - | ||||||||||||
| 806 | return executed 4 times by 1 test: (ret);return (ret);Executed by:
executed 4 times by 1 test: return (ret);Executed by:
| 4 | ||||||||||||
| 807 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |