Branch Coverage

src/ldns/dnssec.c
Criterion Covered Total %
branch 76 442 17.1


line true false branch
36 0 0 if (!name || !rrs) {
0 0 if (!name || !rrs) {
40 0 0 for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) {
42 0 0 if (ldns_rr_get_type(candidate) == LDNS_RR_TYPE_RRSIG) {
43 0 0 if (ldns_dname_compare(ldns_rr_owner(candidate),
44 0 0 name) == 0 &&
63 0 0 if (!rrsig || !rrs) {
0 0 if (!rrsig || !rrs) {
67 0 0 for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) {
69 0 0 if (ldns_rr_get_type(candidate) == LDNS_RR_TYPE_DNSKEY) {
70 0 0 if (ldns_dname_compare(ldns_rr_owner(candidate),
71 0 0 ldns_rr_rrsig_signame(rrsig)) == 0 &&
85 0 0 if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC) {
87 0 0 } else if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC3) {
120 0 0 if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) {
0 0 if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) {
0 0 if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) {
137 0 0 while (ldns_dname_label_count(sname) > 0) {
148 0 0 if(status != LDNS_STATUS_OK) {
155 0 0 for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsec3s); nsec_i++) {
161 0 0 if (ldns_dname_compare(ldns_rr_owner(nsec), hashed_sname) == 0) {
163 0 0 } else if (ldns_nsec_covers_name(nsec, hashed_sname)) {
168 0 0 if (!exact_match_found && in_range_found) {
0 0 if (!exact_match_found && in_range_found) {
170 0 0 } else if (exact_match_found && flag) {
0 0 } else if (exact_match_found && flag) {
175 0 0 } else if (exact_match_found && !flag) {
0 0 } else if (exact_match_found && !flag) {
201 0 0 for (i = 0; i < ldns_pkt_ancount(pkt); i++) {
202 0 0 if (ldns_rr_get_type(ldns_rr_list_rr(ldns_pkt_answer(pkt), i)) ==
207 0 0 for (i = 0; i < ldns_pkt_nscount(pkt); i++) {
208 0 0 if (ldns_rr_get_type(ldns_rr_list_rr(ldns_pkt_authority(pkt), i)) ==
277 0 19 if (!key) {
289 0 19 if (!keybuf) {
307 0 19 if(keysize < 4) {
311 0 19 if (key[3] == LDNS_RSAMD5) {
313 0 0 if (keysize > 4) {
320 4512 19 for (i = 0; (size_t)i < keysize; ++i) {
321 2256 2256 ac32 += (i & 1) ? key[i] : key[i] << 8;
346 0 0 if(len == 0)
352 0 0 if (T > 8) {
355 0 0 if(len < (size_t)1 + SHA_DIGEST_LENGTH + 3*length)
371 0 0 if(!Q || !P || !G || !Y || !(dsa = DSA_new())) {
0 0 if(!Q || !P || !G || !Y || !(dsa = DSA_new())) {
0 0 if(!Q || !P || !G || !Y || !(dsa = DSA_new())) {
0 0 if(!Q || !P || !G || !Y || !(dsa = DSA_new())) {
0 0 if(!Q || !P || !G || !Y || !(dsa = DSA_new())) {
405 0 3 if (len == 0)
407 0 3 if (key[0] == 0) {
408 0 0 if(len < 3)
422 0 3 if(len < (size_t)offset + exp + 1)
427 0 3 if(!exponent) return NULL;
433 0 3 if(!modulus) {
441 0 3 if(!rsa) {
460 0 2 if(!ctx)
463 0 2 !EVP_DigestUpdate(ctx, data, len) ||
486 0 10 if (ldns_rr_get_type(key) != LDNS_RR_TYPE_DNSKEY) {
491 0 10 if (!ds) {
504 0 3 if (!digest) {
511 0 3 if (!digest) {
520 0 2 if(!md) {
525 0 2 if (!digest) {
538 0 2 if (!digest) {
551 0 10 if (!data_buf) {
565 0 10 if ((tmp = ldns_rr_rdf(key, 2)) == NULL) {
585 0 10 if (ldns_rdf2buffer_wire(data_buf, tmp) != LDNS_STATUS_OK) {
595 0 10 if (ldns_rr_rdata2buffer_wire(data_buf,
625 0 2 if(!ldns_digest_evp((unsigned char *) ldns_buffer_begin(data_buf),
704 0 3 if (nsec_type != LDNS_RR_TYPE_NSEC &&
0 0 if (nsec_type != LDNS_RR_TYPE_NSEC &&
711 9 3 for (d = rr_type_list; d < rr_type_list + size; d++) {
714 9 0 if (windows[window] < subtype) {
722 768 3 for (i = 0; i < 256; i++) {
723 3 765 if (windows[i]) {
727 3 0 if (sz > 0) {
731 0 3 if (!data) {
734 768 3 for (i = 0; i < 256; i++) {
735 3 765 if (windows[i]) {
751 9 3 for (d = rr_type_list; d < rr_type_list + size; d++) {
759 0 3 if (!rdf) {
771 0 0 while (cur_rrset) {
772 0 0 if (cur_rrset->type == type) {
791 0 0 if (!from || !to || (nsec_type != LDNS_RR_TYPE_NSEC)) {
0 0 if (!from || !to || (nsec_type != LDNS_RR_TYPE_NSEC)) {
0 0 if (!from || !to || (nsec_type != LDNS_RR_TYPE_NSEC)) {
802 0 0 && !ldns_dnssec_rrsets_contains_type(
0 0 && !ldns_dnssec_rrsets_contains_type(
806 0 0 while (cur_rrsets) {
809 0 0 if ((on_delegation_point && (
0 0 if ((on_delegation_point && (
811 0 0 || cur_rrsets->type == LDNS_RR_TYPE_DS))
812 0 0 || (!on_delegation_point &&
0 0 || (!on_delegation_point &&
814 0 0 && cur_rrsets->type != LDNS_RR_TYPE_NSEC)) {
851 0 0 if (!from) {
863 0 0 if(status != LDNS_STATUS_OK) {
876 0 0 && !ldns_dnssec_rrsets_contains_type(
0 0 && !ldns_dnssec_rrsets_contains_type(
879 0 0 while (cur_rrsets) {
886 0 0 if ((on_delegation_point && (
0 0 if ((on_delegation_point && (
888 0 0 || cur_rrsets->type == LDNS_RR_TYPE_DS))
889 0 0 || (!on_delegation_point &&
0 0 || (!on_delegation_point &&
900 0 0 if (type_count > 0 &&
0 0 if (type_count > 0 &&
901 0 0 !(type_count == 1 && types[0] == LDNS_RR_TYPE_NS)) {
907 0 0 if (to && to->hashed_name) {
0 0 if (to && to->hashed_name) {
947 0 0 for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) {
949 0 0 if (ldns_rdf_compare(cur_owner,
952 0 0 if (i_type != LDNS_RR_TYPE_RRSIG && i_type != LDNS_RR_TYPE_NSEC) {
0 0 if (i_type != LDNS_RR_TYPE_RRSIG && i_type != LDNS_RR_TYPE_NSEC) {
953 0 0 if (type_count == 0 || i_type_list[type_count-1] != i_type) {
0 0 if (type_count == 0 || i_type_list[type_count-1] != i_type) {
993 0 1 if (algorithm != LDNS_SHA1) {
999 0 1 if(!cann) {
1009 0 1 if(!hashed_owner_str) {
1017 1 1 for (cur_it = iterations + 1; cur_it > 0; cur_it--) {
1024 0 1 if (!hashed_owner_str) {
1038 0 1 if(!hashed_owner_b32) {
1046 0 1 if (hashed_owner_b32_len < 1) {
1060 0 1 if (status != LDNS_STATUS_OK) {
1088 0 0 if (old) ldns_rdf_deep_free(old);
1094 0 0 if (old) ldns_rdf_deep_free(old);
1100 0 0 if (old) ldns_rdf_deep_free(old);
1103 0 0 if(!salt_data) {
1112 0 0 if(!salt_rdf) {
1119 0 0 if (old) ldns_rdf_deep_free(old);
1128 0 0 if (!origin || !rr_list) return 0;
0 0 if (!origin || !rr_list) return 0;
1129 0 0 for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) {
1131 0 0 if (ldns_dname_compare(ldns_rr_owner(cur_rr), origin) == 0) {
1134 0 0 if (ldns_rr_get_type(cur_rr) != LDNS_RR_TYPE_NS) {
1172 0 0 if(status != LDNS_STATUS_OK) {
1177 0 0 if(!nsec) {
1193 0 0 for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) {
1195 0 0 if (ldns_rdf_compare(cur_owner,
1198 0 0 if (type_count == 0 || i_type_list[type_count-1] != i_type) {
0 0 if (type_count == 0 || i_type_list[type_count-1] != i_type) {
1207 0 0 if (!emptynonterminal && !rr_list_delegation_only(cur_zone, rrs)) {
0 0 if (!emptynonterminal && !rr_list_delegation_only(cur_zone, rrs)) {
1213 0 0 if (ldns_dname_compare(cur_zone, cur_owner) == 0) {
1229 0 0 (ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3 ||
1231 2 0 && (ldns_rr_rdf(nsec3_rr, 0) != NULL)
1232 2 0 && ldns_rdf_size(ldns_rr_rdf(nsec3_rr, 0)) > 0) {
1242 0 0 (ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3 ||
1244 2 0 && (ldns_rr_rdf(nsec3_rr, 1) != NULL)
1245 2 0 && ldns_rdf_size(ldns_rr_rdf(nsec3_rr, 1)) > 0) {
1261 0 0 (ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3 ||
1263 2 0 && (ldns_rr_rdf(nsec3_rr, 2) != NULL)
1264 2 0 && ldns_rdf_size(ldns_rr_rdf(nsec3_rr, 2)) > 0) {
1275 0 0 (ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3 ||
1287 2 0 if (salt_rdf && ldns_rdf_size(salt_rdf) > 0) {
2 0 if (salt_rdf && ldns_rdf_size(salt_rdf) > 0) {
1301 1 0 if (salt_rdf && ldns_rdf_size(salt_rdf) > 0) {
1 0 if (salt_rdf && ldns_rdf_size(salt_rdf) > 0) {
1304 0 1 if(!salt) return NULL;
1314 2 0 if (!nsec3_rr || ldns_rr_get_type(nsec3_rr) != LDNS_RR_TYPE_NSEC3) {
0 2 if (!nsec3_rr || ldns_rr_get_type(nsec3_rr) != LDNS_RR_TYPE_NSEC3) {
1324 2 0 if (!nsec3_rr || ldns_rr_get_type(nsec3_rr) != LDNS_RR_TYPE_NSEC3) {
0 2 if (!nsec3_rr || ldns_rr_get_type(nsec3_rr) != LDNS_RR_TYPE_NSEC3) {
1370 0 0 if (! bitmap) {
1381 0 0 while (dptr < dend && dptr[0] <= window) {
0 0 while (dptr < dend && dptr[0] <= window) {
1383 0 0 if (dptr[0] == window && subtype / 8 < dptr[1] &&
0 0 if (dptr[0] == window && subtype / 8 < dptr[1] &&
0 0 if (dptr[0] == window && subtype / 8 < dptr[1] &&
1407 0 0 if (! bitmap) {
1418 0 0 while (dptr < dend && dptr[0] <= window) {
0 0 while (dptr < dend && dptr[0] <= window) {
1420 0 0 if (dptr[0] == window && subtype / 8 < dptr[1] &&
0 0 if (dptr[0] == window && subtype / 8 < dptr[1] &&
0 0 if (dptr[0] == window && subtype / 8 < dptr[1] &&
1445 0 0 if (! bitmap) {
1457 0 0 while (dptr < dend && dptr[0] <= window) {
0 0 while (dptr < dend && dptr[0] <= window) {
1459 0 0 if (dptr[0] == window && subtype / 8 < dptr[1] &&
0 0 if (dptr[0] == window && subtype / 8 < dptr[1] &&
0 0 if (dptr[0] == window && subtype / 8 < dptr[1] &&
1482 1 1 if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC) {
1483 1 0 if (ldns_rr_rdf(nsec, 0) != NULL) {
1488 1 0 } else if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC3) {
1496 0 1 if (status != LDNS_STATUS_OK) {
1505 0 2 if(ldns_dname_compare(nsec_owner, nsec_next) > 0) {
1508 2 0 } else if(ldns_dname_compare(nsec_owner, nsec_next) < 0) {
1533 0 0 if (!k) {
1538 0 0 if (t == LDNS_RR_TYPE_RRSIG) {
1543 0 0 if (s) {
1551 0 0 if (!sigs) {
1567 0 0 if (! sigs_covered) {
1568 0 0 if (! s) {
1577 0 0 if (!rrset) {
1578 0 0 if (! s) {
1603 0 0 for (i = 0; i < ldns_rr_list_rr_count(nsec3_rrs); i++) {
1604 0 0 if (i == ldns_rr_list_rr_count(nsec3_rrs) - 1) {
1609 0 0 if (next_nsec_owner_str[strlen(next_nsec_owner_str) - 1]
1629 0 0 if (next_nsec_owner_str[strlen(next_nsec_owner_str) - 1]
1652 0 0 if (rr1 == NULL && rr2 == NULL) {
0 0 if (rr1 == NULL && rr2 == NULL) {
1655 0 0 if (rr1 == NULL) {
1658 0 0 if (rr2 == NULL) {
1718 0 0 if (!dsasig) {
1724 0 0 if(!dsasig_data) {
1730 0 0 if (byte_offset > 20) {
1738 0 0 if (byte_offset > 20) {
1747 0 0 if(!sigdata_rdf) {
1765 0 0 if(ldns_rdf_size(sig_rdf) < 1 + 2*SHA_DIGEST_LENGTH)
1769 0 0 if(!R) return LDNS_STATUS_MEM_ERR;
1773 0 0 if(!S) {
1781 0 0 if (!dsasig) {
1791 0 0 if (raw_sig_len < 0) {
1796 0 0 if (ldns_buffer_reserve(target_buffer, (size_t) raw_sig_len)) {
1815 0 0 if(!ecdsa_sig) return NULL;
1820 0 0 if(!data) {
1840 0 0 if(bnsize < 16 || (size_t)bnsize*2 != ldns_rdf_size(sig_rdf))
0 0 if(bnsize < 16 || (size_t)bnsize*2 != ldns_rdf_size(sig_rdf))
1845 0 0 if(!sig) return LDNS_STATUS_MEM_ERR;
1850 0 0 if(!sig->r || !sig->s) {
0 0 if(!sig->r || !sig->s) {
1856 0 0 if (ldns_buffer_reserve(target_buffer, (size_t) raw_sig_len)) {