Branch Coverage

deps/libgit2/src/libgit2/streams/openssl.c
Criterion Covered Total %
branch 1 152 0.6


line true false branch
53 0 0 if (git_stream_bio_method) {
58 0 0 if (git__ssl_ctx) {
141 0 0 if (!(git__ssl_ctx = SSL_CTX_new(SSLv23_method())))
147 0 0 if (!SSL_CTX_set_default_verify_paths(git__ssl_ctx))
150 0 0 if (!ciphers)
153 0 0 if(!SSL_CTX_set_cipher_list(git__ssl_ctx, ciphers))
156 0 0 if (init_bio_method() < 0)
182 0 87 if (git_mutex_init(&openssl_mutex) != 0)
194 0 0 if (git_mutex_lock(&openssl_mutex) != 0)
197 0 0 if (!openssl_initialized) {
198 0 0 if ((error = git_openssl_stream_dynamic_init()) == 0)
235 0 0 if (!b)
262 0 0 if (cmd == BIO_CTRL_FLUSH)
285 0 0 GIT_ERROR_CHECK_ALLOC(git_stream_bio_method);
305 0 0 GIT_ASSERT(err != SSL_ERROR_WANT_READ);
306 0 0 GIT_ASSERT(err != SSL_ERROR_WANT_WRITE);
318 0 0 if (e > 0) {
323 0 0 } else if (error < 0) {
352 0 0 if (ret < 0)
362 0 0 if (!strcasecmp(name, host))
365 0 0 if (gitno__match_host(name, host) < 0)
384 0 0 if (SSL_get_verify_result(ssl) != X509_V_OK) {
390 0 0 if (p_inet_pton(AF_INET, host, &addr4)) {
394 0 0 if (p_inet_pton(AF_INET6, host, &addr6)) {
402 0 0 if (!cert) {
410 0 0 if (alts) {
414 0 0 for (i = 0; i < num && matched != 1; i++) {
0 0 for (i = 0; i < num && matched != 1; i++) {
420 0 0 if (gn->type != type)
423 0 0 if (type == GEN_DNS) {
425 0 0 if (memchr(name, '\0', namelen))
428 0 0 if (check_host_name(name, host) < 0)
432 0 0 } else if (type == GEN_IPADD) {
434 0 0 matched = addr && !!memcmp(name, addr, namelen);
0 0 matched = addr && !!memcmp(name, addr, namelen);
440 0 0 if (matched == 0)
443 0 0 if (matched == 1) {
449 0 0 if (peer_name == NULL)
452 0 0 if (peer_name) {
454 0 0 while ((j = X509_NAME_get_index_by_NID(peer_name, NID_commonName, i)) >= 0)
458 0 0 if (i < 0)
462 0 0 if (str == NULL)
466 0 0 if (ASN1_STRING_type(str) == V_ASN1_UTF8STRING) {
469 0 0 if (size > 0) {
471 0 0 GIT_ERROR_CHECK_ALLOC(peer_cn);
479 0 0 GIT_ERROR_CHECK_ALLOC(peer_cn);
480 0 0 if (memchr(peer_cn, '\0', size))
484 0 0 if (check_host_name((char *)peer_cn, host) < 0)
520 0 0 if (st->owned && (ret = git_stream_connect(st->io)) < 0)
0 0 if (st->owned && (ret = git_stream_connect(st->io)) < 0)
524 0 0 GIT_ERROR_CHECK_ALLOC(bio);
534 0 0 if ((ret = SSL_connect(st->ssl)) <= 0)
551 0 0 if (len < 0) {
558 0 0 GIT_ERROR_CHECK_ALLOC(encoded_cert);
563 0 0 if (len < 0) {
597 0 0 if ((ret = SSL_write(st->ssl, data, len)) <= 0)
608 0 0 if ((ret = SSL_read(st->ssl, data, len)) <= 0)
619 0 0 if (st->connected && (ret = ssl_teardown(st->ssl)) < 0)
0 0 if (st->connected && (ret = ssl_teardown(st->ssl)) < 0)
624 0 0 return st->owned ? git_stream_close(st->io) : 0;
631 0 0 if (st->owned)
648 0 0 GIT_ASSERT_ARG(out);
649 0 0 GIT_ASSERT_ARG(in);
650 0 0 GIT_ASSERT_ARG(host);
653 0 0 GIT_ERROR_CHECK_ALLOC(st);
659 0 0 if (st->ssl == NULL) {
666 0 0 GIT_ERROR_CHECK_ALLOC(st->host);
685 0 0 if (openssl_ensure_initialized() < 0)
696 0 0 GIT_ASSERT_ARG(out);
697 0 0 GIT_ASSERT_ARG(host);
698 0 0 GIT_ASSERT_ARG(port);
700 0 0 if (openssl_ensure_initialized() < 0)
703 0 0 if ((error = git_socket_stream_new(&stream, host, port)) < 0)
706 0 0 if ((error = openssl_stream_wrap(out, stream, host, 1)) < 0) {
716 0 0 if (openssl_ensure_initialized() < 0)
719 0 0 if (SSL_CTX_load_verify_locations(git__ssl_ctx, file, path) == 0) {