Branch Coverage

lib/Crypt/Bear.xs
Criterion Covered Total %
branch 118 236 50.0


line true false branch
25 74 0 for (i = 0; i < table_size; ++i) {
26 72 2 if (table[i].length == name_length && strEQ(name, table[i].key))
26 46 if (table[i].length == name_length && strEQ(name, table[i].key))
37 0 26 if (item == NULL)
45 2 0 for (i = 0; i < table_size; ++i) {
46 2 0 if (memcmp(&table[i].value, &value, sizeof(union value)) == 0)
55 34 0 SvGROW(result, size);
34 0 SvGROW(result, size);
148 0 0 return entry ? entry->key : NULL;
500 0 2 if (decoder->buffer)
502 0 2 if (decoder->name)
620 2 2 if (public_key->key_type == BR_KEYTYPE_RSA) {
624 2 0 } else if (public_key->key_type == BR_KEYTYPE_EC) {
636 104 45 if (source->key_type == BR_KEYTYPE_RSA) {
638 45 0 } else if (source->key_type == BR_KEYTYPE_EC) {
645 104 45 if (target->key_type == BR_KEYTYPE_RSA) {
647 45 0 } else if (target->key_type == BR_KEYTYPE_EC) {
681 149 5 for (size_t i = 0; i < target->used; i++) {
693 1 1 for (size_t i = 0; i < source->used; i++) {
700 4 144 if (anchors->allocated == 0) {
704 5 139 else if (anchors->used == anchors->allocated) {
705 5 0 anchors->allocated = anchors->allocated ? 2 * anchors->allocated : 4;
749 2 0 if (certificates->used == certificates->allocated) {
750 0 2 certificates->allocated = certificates->allocated ? 2 * certificates->allocated : 4;
764 3 3 for (size_t i = 0; i < source->used; i++) {
778 5 6 for (size_t i = 0; i < chain->used; i++) {
807 2 0 if (old->key_type == BR_KEYTYPE_RSA)
822 4 1 if (self->key_type == BR_KEYTYPE_RSA)
841 0 1 if (key->key_type == BR_KEYTYPE_EC) {
1028 41 1 while (current->name) {
1066 0 0 if (STRLEN_length_of_state != br_hash_state_size(self))
1158 0 11 if ((STRLEN_length_of_data % br_block_cbcenc_block_size(self)) != 0)
1160 0 11 if (STRLEN_length_of_iv != br_block_cbcenc_block_size(self))
1177 0 11 if ((STRLEN_length_of_data % br_block_cbcdec_block_size(self)) != 0)
1179 0 11 if (STRLEN_length_of_iv != br_block_cbcdec_block_size(self))
1196 0 22 if ((STRLEN_length_of_data % br_block_ctr_block_size(self)) != 0)
1198 0 22 if (STRLEN_length_of_iv != br_block_ctr_block_size(self))
1213 0 50 if (!aes_cbc_enc)
1228 0 50 if (!aes_cbc_dec)
1247 0 50 if (!aes_ctr)
1268 0 50 if (!aes_ctrcbc)
1306 0 8 if (STRLEN_length_of_tag != (*self)->tag_size)
1308 8 0 RETVAL = br_aead_check_tag(self, tag);
1317 0 50 if (!ghash_impl)
1374 4 0 RETVAL = system_seeder ? system_seeder(self) : FALSE;
4 0 RETVAL = system_seeder ? system_seeder(self) : FALSE;
4 0 RETVAL = system_seeder ? system_seeder(self) : FALSE;
1419 0 1 if (!RETVAL)
1432 0 1 if (!success)
1441 1 0 if (length)
1457 0 1 if (STRLEN_length_of_hash != hash_oid->length)
1461 0 1 if (!success)
1471 1 0 if (succes)
1487 0 0 for (UV i = 0; i < 31; i++) {
1488 0 0 if (ec_default->supported_curves & (1 << i)) {
1491 0 0 mXPUSHp(entry->key, entry->length);
1516 0 1 if (STRLEN_length_of_hash_value != hash_size)
1518 1 0 RETVAL = ec_verify_default(ec_default, hash_value, hash_size, self, signature, STRLEN_length_of_signature);
1561 0 1 if (STRLEN_length_of_hash_value != hash_size)
1565 0 1 if (!length)
1573 0 2 if (self->curve != other->curve)
1584 2 0 if (xoff)
1595 0 1 for (int i = 3; i < items; i++) {
1614 306 11 while (left) {
1627 153 0 if (decoder.buffer) {
1628 0 153 mXPUSHs(decoder.name);
1629 0 153 mXPUSHs(decoder.buffer);
1636 0 0 if (decoder.name)
1638 0 0 if (decoder.buffer)
1664 45 45 while (left) {
1677 2 0 if (self->buffer) {
1680 0 2 PUSHMARK(SP);
1681 0 2 mXPUSHs(self->name);
1682 0 2 mXPUSHs(self->buffer);
1686 2 0 FREETMPS;
1694 0 0 if (self->buffer) {
1706 0 0 RETVAL = self->buffer != NULL;
1727 0 152 if (error != 0) {
1763 0 2 if (error != 0)
1769 2 0 if (RETVAL->key_type == BR_KEYTYPE_RSA) {
1771 0 0 } else if (RETVAL->key_type == BR_KEYTYPE_EC) {
1781 0 0 if (self->key_type == BR_KEYTYPE_RSA) {
1785 0 0 } else if (self->key_type == BR_KEYTYPE_EC) {
1820 2 1 for (size_t i = 0; i < other->used; i++) {
1830 0 0 for (size_t i = 0; i < self->used; i++) {
1832 0 0 mXPUSHp((const char*)anchor->dn.data, anchor->dn.len);
1837 0 6 RETVAL = self->used;
1868 0 0 if (wanted_usage && (usage & wanted_usage) != wanted_usage)
0 0 if (wanted_usage && (usage & wanted_usage) != wanted_usage)
1870 0 0 else if (public_key)
1924 2 0 if (self->used == 1)
1930 0 2 RETVAL = self->used;
1987 2 4 RETVAL = br_ssl_engine_current_state(self) == BR_SSL_CLOSED;
1993 1 2 RETVAL = cBOOL(br_ssl_engine_current_state(self) & BR_SSL_SENDAPP);
2002 0 8 while (br_ssl_engine_current_state(self) & BR_SSL_RECVAPP) {
2011 0 22 if (br_ssl_engine_current_state(self) == BR_SSL_CLOSED)
2017 22 0 if (len) {
2020 0 22 if (len > available)
2028 2 22 while (br_ssl_engine_current_state(self) & BR_SSL_RECVAPP) {
2035 14 8 } while (offset < STRLEN_length_of_data);
2045 0 2 while (br_ssl_engine_current_state(self) & BR_SSL_SENDREC) {
2053 0 2 if (br_ssl_engine_current_state(self) == BR_SSL_CLOSED)
2059 2 0 if (len && STRLEN_length_of_data) {
2 0 if (len && STRLEN_length_of_data) {
2062 2 0 if (len > available)
2069 0 2 } while (offset < STRLEN_length_of_data);
2071 2 0 if (flush)
2074 2 2 while (br_ssl_engine_current_state(self) & BR_SSL_SENDREC) {
2090 9 6 while (br_ssl_engine_current_state(self) & BR_SSL_SENDREC) {
2120 1 0 if (SvOK(server_name))
2132 0 0 if (priv_cert->key.key_type == BR_KEYTYPE_RSA) {
2134 0 0 } else if (priv_cert->key.key_type == BR_KEYTYPE_EC) {
2154 1 0 if (priv_cert->key.key_type == BR_KEYTYPE_RSA) {
2156 0 0 } else if (priv_cert->key.key_type == BR_KEYTYPE_EC) {
2165 0 1 if (error) {
2176 0 0 for (size_t i = 0; i < len; i++) {
2180 0 0 mXPUSHs(newRV_noinc((SV*)pair));
2186 1 0 RETVAL = br_ssl_server_reset(&self->context);