asn1_get_next:
  172|   303k|{
  173|   303k|	const u8 *pos, *end;
  174|   303k|	u8 tmp;
  175|       |
  176|   303k|	os_memset(hdr, 0, sizeof(*hdr));
  ------------------
  |  |  529|   303k|#define os_memset(s, c, n) memset(s, c, n)
  ------------------
  177|   303k|	pos = buf;
  178|   303k|	end = buf + len;
  179|       |
  180|   303k|	if (pos >= end) {
  ------------------
  |  Branch (180:6): [True: 0, False: 303k]
  ------------------
  181|      0|		wpa_printf(MSG_DEBUG, "ASN.1: No room for Identifier");
  182|      0|		return -1;
  183|      0|	}
  184|   303k|	hdr->identifier = *pos++;
  185|   303k|	hdr->class = hdr->identifier >> 6;
  186|   303k|	hdr->constructed = !!(hdr->identifier & (1 << 5));
  187|       |
  188|   303k|	if ((hdr->identifier & 0x1f) == 0x1f) {
  ------------------
  |  Branch (188:6): [True: 295k, False: 8.71k]
  ------------------
  189|   295k|		size_t ext_len = 0;
  190|       |
  191|   295k|		hdr->tag = 0;
  192|   295k|		if (pos == end || (*pos & 0x7f) == 0) {
  ------------------
  |  Branch (192:7): [True: 2, False: 295k]
  |  Branch (192:21): [True: 2, False: 295k]
  ------------------
  193|      4|			wpa_printf(MSG_DEBUG,
  194|      4|				   "ASN.1: Invalid extended tag (first octet has to be included with at least one nonzero bit for the tag value)");
  195|      4|			return -1;
  196|      4|		}
  197|  1.69M|		do {
  198|  1.69M|			if (pos >= end) {
  ------------------
  |  Branch (198:8): [True: 10, False: 1.69M]
  ------------------
  199|     10|				wpa_printf(MSG_DEBUG, "ASN.1: Identifier "
  200|     10|					   "underflow");
  201|     10|				return -1;
  202|     10|			}
  203|  1.69M|			ext_len++;
  204|  1.69M|			tmp = *pos++;
  205|  1.69M|			wpa_printf(MSG_MSGDUMP, "ASN.1: Extended tag data: "
  206|  1.69M|				   "0x%02x", tmp);
  207|  1.69M|			hdr->tag = (hdr->tag << 7) | (tmp & 0x7f);
  208|  1.69M|		} while (tmp & 0x80);
  ------------------
  |  Branch (208:12): [True: 1.40M, False: 295k]
  ------------------
  209|   295k|		wpa_printf(MSG_MSGDUMP, "ASN.1: Extended Tag: 0x%x (len=%zu)",
  210|   295k|			   hdr->tag, ext_len);
  211|   295k|		if ((hdr->class != ASN1_CLASS_PRIVATE && hdr->tag < 31) ||
  ------------------
  |  |   46|   590k|#define ASN1_CLASS_PRIVATE		3
  ------------------
  |  Branch (211:8): [True: 486, False: 294k]
  |  Branch (211:44): [True: 6, False: 480]
  ------------------
  212|   295k|		    ext_len * 7 > sizeof(hdr->tag) * 8) {
  ------------------
  |  Branch (212:7): [True: 54, False: 295k]
  ------------------
  213|     60|			wpa_printf(MSG_DEBUG,
  214|     60|				   "ASN.1: Invalid or unsupported (too large) extended Tag: 0x%x (len=%zu)",
  215|     60|				   hdr->tag, ext_len);
  216|     60|			return -1;
  217|     60|		}
  218|   295k|	} else
  219|  8.71k|		hdr->tag = hdr->identifier & 0x1f;
  220|       |
  221|   303k|	if (pos >= end) {
  ------------------
  |  Branch (221:6): [True: 78, False: 303k]
  ------------------
  222|     78|		wpa_printf(MSG_DEBUG, "ASN.1: No room for Length");
  223|     78|		return -1;
  224|     78|	}
  225|   303k|	tmp = *pos++;
  226|   303k|	if (tmp & 0x80) {
  ------------------
  |  Branch (226:6): [True: 547, False: 303k]
  ------------------
  227|    547|		if (tmp == 0xff) {
  ------------------
  |  Branch (227:7): [True: 6, False: 541]
  ------------------
  228|      6|			wpa_printf(MSG_DEBUG, "ASN.1: Reserved length "
  229|      6|				   "value 0xff used");
  230|      6|			return -1;
  231|      6|		}
  232|    541|		tmp &= 0x7f; /* number of subsequent octets */
  233|    541|		hdr->length = 0;
  234|    541|		if (tmp == 0 || pos == end || *pos == 0) {
  ------------------
  |  Branch (234:7): [True: 2, False: 539]
  |  Branch (234:19): [True: 11, False: 528]
  |  Branch (234:33): [True: 2, False: 526]
  ------------------
  235|     15|			wpa_printf(MSG_DEBUG,
  236|     15|				   "ASN.1: Definite long form of the length does not start with a nonzero value");
  237|     15|			return -1;
  238|     15|		}
  239|    526|		if (tmp > 4) {
  ------------------
  |  Branch (239:7): [True: 8, False: 518]
  ------------------
  240|      8|			wpa_printf(MSG_DEBUG, "ASN.1: Too long length field");
  241|      8|			return -1;
  242|      8|		}
  243|  1.45k|		while (tmp--) {
  ------------------
  |  Branch (243:10): [True: 940, False: 514]
  ------------------
  244|    940|			if (pos >= end) {
  ------------------
  |  Branch (244:8): [True: 4, False: 936]
  ------------------
  245|      4|				wpa_printf(MSG_DEBUG, "ASN.1: Length "
  246|      4|					   "underflow");
  247|      4|				return -1;
  248|      4|			}
  249|    936|			hdr->length = (hdr->length << 8) | *pos++;
  250|    936|		}
  251|    514|		if (hdr->length < 128) {
  ------------------
  |  Branch (251:7): [True: 10, False: 504]
  ------------------
  252|     10|			wpa_printf(MSG_DEBUG,
  253|     10|				   "ASN.1: Definite long form of the length used with too short length");
  254|     10|			return -1;
  255|     10|		}
  256|   303k|	} else {
  257|       |		/* Short form - length 0..127 in one octet */
  258|   303k|		hdr->length = tmp;
  259|   303k|	}
  260|       |
  261|   303k|	if (end < pos || hdr->length > (unsigned int) (end - pos)) {
  ------------------
  |  Branch (261:6): [True: 0, False: 303k]
  |  Branch (261:19): [True: 103, False: 303k]
  ------------------
  262|    103|		wpa_printf(MSG_DEBUG, "ASN.1: Contents underflow");
  263|    103|		return -1;
  264|    103|	}
  265|       |
  266|   303k|	hdr->payload = pos;
  267|       |
  268|   303k|	if (!asn1_valid_der(hdr)) {
  ------------------
  |  Branch (268:6): [True: 92, False: 303k]
  ------------------
  269|     92|		asn1_print_hdr(hdr, "ASN.1: Invalid DER encoding: ");
  270|     92|		return -1;
  271|     92|	}
  272|   303k|	return 0;
  273|   303k|}
asn1_print_hdr:
  277|     92|{
  278|     92|	wpa_printf(MSG_DEBUG, "%sclass %d constructed %d tag 0x%x",
  279|     92|		   title, hdr->class, hdr->constructed, hdr->tag);
  280|     92|}
asn1_unexpected:
  284|     10|{
  285|     10|	wpa_printf(MSG_DEBUG, "%s - found class %d constructed %d tag 0x%x",
  286|     10|		   title, hdr->class, hdr->constructed, hdr->tag);
  287|     10|}
asn1_parse_oid:
  291|  1.06k|{
  292|  1.06k|	const u8 *pos, *end;
  293|  1.06k|	unsigned long val;
  294|  1.06k|	u8 tmp;
  295|       |
  296|  1.06k|	os_memset(oid, 0, sizeof(*oid));
  ------------------
  |  |  529|  1.06k|#define os_memset(s, c, n) memset(s, c, n)
  ------------------
  297|       |
  298|  1.06k|	pos = buf;
  299|  1.06k|	end = buf + len;
  300|       |
  301|  6.92k|	while (pos < end) {
  ------------------
  |  Branch (301:9): [True: 5.89k, False: 1.02k]
  ------------------
  302|  5.89k|		val = 0;
  303|       |
  304|  38.0k|		do {
  305|  38.0k|			if (pos >= end)
  ------------------
  |  Branch (305:8): [True: 17, False: 38.0k]
  ------------------
  306|     17|				return -1;
  307|  38.0k|			tmp = *pos++;
  308|  38.0k|			val = (val << 7) | (tmp & 0x7f);
  309|  38.0k|		} while (tmp & 0x80);
  ------------------
  |  Branch (309:12): [True: 32.1k, False: 5.87k]
  ------------------
  310|       |
  311|  5.87k|		if (oid->len >= ASN1_MAX_OID_LEN) {
  ------------------
  |  |   55|  5.87k|#define ASN1_MAX_OID_LEN 20
  ------------------
  |  Branch (311:7): [True: 16, False: 5.86k]
  ------------------
  312|     16|			wpa_printf(MSG_DEBUG, "ASN.1: Too long OID value");
  313|     16|			return -1;
  314|     16|		}
  315|  5.86k|		if (oid->len == 0) {
  ------------------
  |  Branch (315:7): [True: 1.04k, False: 4.81k]
  ------------------
  316|       |			/*
  317|       |			 * The first octet encodes the first two object
  318|       |			 * identifier components in (X*40) + Y formula.
  319|       |			 * X = 0..2.
  320|       |			 */
  321|  1.04k|			oid->oid[0] = val / 40;
  322|  1.04k|			if (oid->oid[0] > 2)
  ------------------
  |  Branch (322:8): [True: 533, False: 512]
  ------------------
  323|    533|				oid->oid[0] = 2;
  324|  1.04k|			oid->oid[1] = val - oid->oid[0] * 40;
  325|  1.04k|			oid->len = 2;
  326|  1.04k|		} else
  327|  4.81k|			oid->oid[oid->len++] = val;
  328|  5.86k|	}
  329|       |
  330|  1.02k|	return 0;
  331|  1.06k|}
asn1_get_oid:
  336|  1.07k|{
  337|  1.07k|	struct asn1_hdr hdr;
  338|       |
  339|  1.07k|	if (asn1_get_next(buf, len, &hdr) < 0 || hdr.length == 0 ||
  ------------------
  |  Branch (339:6): [True: 0, False: 1.07k]
  |  Branch (339:43): [True: 10, False: 1.06k]
  ------------------
  340|  1.06k|	    !asn1_is_oid(&hdr)) {
  ------------------
  |  Branch (340:6): [True: 0, False: 1.06k]
  ------------------
  341|     10|		asn1_unexpected(&hdr, "ASN.1: Expected OID");
  342|     10|		return -1;
  343|     10|	}
  344|       |
  345|  1.06k|	*next = hdr.payload + hdr.length;
  346|       |
  347|  1.06k|	return asn1_parse_oid(hdr.payload, hdr.length, oid);
  348|  1.07k|}
asn1_oid_to_str:
  352|  1.02k|{
  353|  1.02k|	char *pos = buf;
  354|  1.02k|	size_t i;
  355|  1.02k|	int ret;
  356|       |
  357|  1.02k|	if (len == 0)
  ------------------
  |  Branch (357:6): [True: 0, False: 1.02k]
  ------------------
  358|      0|		return;
  359|       |
  360|  1.02k|	buf[0] = '\0';
  361|       |
  362|  7.40k|	for (i = 0; i < oid->len; i++) {
  ------------------
  |  Branch (362:14): [True: 6.56k, False: 833]
  ------------------
  363|  6.56k|		ret = os_snprintf(pos, buf + len - pos,
  ------------------
  |  |  572|  6.56k|#define os_snprintf snprintf
  ------------------
  364|  6.56k|				  "%s%lu",
  365|  6.56k|				  i == 0 ? "" : ".", oid->oid[i]);
  ------------------
  |  Branch (365:7): [True: 1.02k, False: 5.53k]
  ------------------
  366|  6.56k|		if (os_snprintf_error(buf + len - pos, ret))
  ------------------
  |  Branch (366:7): [True: 195, False: 6.37k]
  ------------------
  367|    195|			break;
  368|  6.37k|		pos += ret;
  369|  6.37k|	}
  370|  1.02k|	buf[len - 1] = '\0';
  371|  1.02k|}
asn1.c:asn1_valid_der:
  127|   303k|{
  128|   303k|	if (hdr->class != ASN1_CLASS_UNIVERSAL)
  ------------------
  |  |   43|   303k|#define ASN1_CLASS_UNIVERSAL		0
  ------------------
  |  Branch (128:6): [True: 296k, False: 7.00k]
  ------------------
  129|   296k|		return 1;
  130|  7.00k|	if (hdr->tag == ASN1_TAG_BOOLEAN && !asn1_valid_der_boolean(hdr))
  ------------------
  |  |   13|  14.0k|#define ASN1_TAG_BOOLEAN	0x01
  ------------------
  |  Branch (130:6): [True: 570, False: 6.43k]
  |  Branch (130:38): [True: 30, False: 540]
  ------------------
  131|     30|		return 0;
  132|  6.97k|	if (hdr->tag == ASN1_TAG_NULL && hdr->length != 0)
  ------------------
  |  |   17|  13.9k|#define ASN1_TAG_NULL		0x05
  ------------------
  |  Branch (132:6): [True: 220, False: 6.75k]
  |  Branch (132:35): [True: 19, False: 201]
  ------------------
  133|     19|		return 0;
  134|       |
  135|       |	/* Check for allowed primitive/constructed values */
  136|  6.96k|	if (hdr->constructed &&
  ------------------
  |  Branch (136:6): [True: 1.27k, False: 5.68k]
  ------------------
  137|  1.27k|	    (hdr->tag == ASN1_TAG_BOOLEAN ||
  ------------------
  |  |   13|  2.55k|#define ASN1_TAG_BOOLEAN	0x01
  ------------------
  |  Branch (137:7): [True: 5, False: 1.27k]
  ------------------
  138|  1.27k|	     hdr->tag == ASN1_TAG_INTEGER ||
  ------------------
  |  |   14|  2.55k|#define ASN1_TAG_INTEGER	0x02
  ------------------
  |  Branch (138:7): [True: 2, False: 1.27k]
  ------------------
  139|  1.27k|	     hdr->tag == ASN1_TAG_NULL ||
  ------------------
  |  |   17|  2.55k|#define ASN1_TAG_NULL		0x05
  ------------------
  |  Branch (139:7): [True: 2, False: 1.27k]
  ------------------
  140|  1.27k|	     hdr->tag == ASN1_TAG_OID ||
  ------------------
  |  |   18|  2.54k|#define ASN1_TAG_OID		0x06
  ------------------
  |  Branch (140:7): [True: 1, False: 1.26k]
  ------------------
  141|  1.26k|	     hdr->tag == ANS1_TAG_RELATIVE_OID ||
  ------------------
  |  |   25|  2.54k|#define ANS1_TAG_RELATIVE_OID	0x0D
  ------------------
  |  Branch (141:7): [True: 2, False: 1.26k]
  ------------------
  142|  1.26k|	     hdr->tag == ASN1_TAG_REAL ||
  ------------------
  |  |   21|  2.54k|#define ASN1_TAG_REAL		0x09 /* not yet parsed */
  ------------------
  |  Branch (142:7): [True: 1, False: 1.26k]
  ------------------
  143|  1.26k|	     hdr->tag == ASN1_TAG_ENUMERATED ||
  ------------------
  |  |   22|  2.54k|#define ASN1_TAG_ENUMERATED	0x0A /* not yet parsed */
  ------------------
  |  Branch (143:7): [True: 1, False: 1.26k]
  ------------------
  144|  1.26k|	     hdr->tag == ASN1_TAG_BITSTRING ||
  ------------------
  |  |   15|  2.54k|#define ASN1_TAG_BITSTRING	0x03
  ------------------
  |  Branch (144:7): [True: 1, False: 1.26k]
  ------------------
  145|  1.26k|	     hdr->tag == ASN1_TAG_OCTETSTRING ||
  ------------------
  |  |   16|  2.54k|#define ASN1_TAG_OCTETSTRING	0x04
  ------------------
  |  Branch (145:7): [True: 1, False: 1.26k]
  ------------------
  146|  1.26k|	     hdr->tag == ASN1_TAG_NUMERICSTRING ||
  ------------------
  |  |   29|  2.54k|#define ASN1_TAG_NUMERICSTRING	0x12 /* not yet parsed */
  ------------------
  |  Branch (146:7): [True: 3, False: 1.26k]
  ------------------
  147|  1.26k|	     hdr->tag == ASN1_TAG_PRINTABLESTRING ||
  ------------------
  |  |   30|  2.53k|#define ASN1_TAG_PRINTABLESTRING	0x13
  ------------------
  |  Branch (147:7): [True: 4, False: 1.25k]
  ------------------
  148|  1.25k|	     hdr->tag == ASN1_TAG_T61STRING ||
  ------------------
  |  |   31|  2.53k|#define ASN1_TAG_T61STRING	0x14 /* not yet parsed */
  ------------------
  |  Branch (148:7): [True: 2, False: 1.25k]
  ------------------
  149|  1.25k|	     hdr->tag == ASN1_TAG_VIDEOTEXSTRING ||
  ------------------
  |  |   32|  2.53k|#define ASN1_TAG_VIDEOTEXSTRING	0x15 /* not yet parsed */
  ------------------
  |  Branch (149:7): [True: 2, False: 1.25k]
  ------------------
  150|  1.25k|	     hdr->tag == ASN1_TAG_VISIBLESTRING ||
  ------------------
  |  |   37|  2.53k|#define ASN1_TAG_VISIBLESTRING	0x1A
  ------------------
  |  Branch (150:7): [True: 1, False: 1.25k]
  ------------------
  151|  1.25k|	     hdr->tag == ASN1_TAG_IA5STRING ||
  ------------------
  |  |   33|  2.53k|#define ASN1_TAG_IA5STRING	0x16
  ------------------
  |  Branch (151:7): [True: 1, False: 1.25k]
  ------------------
  152|  1.25k|	     hdr->tag == ASN1_TAG_GRAPHICSTRING ||
  ------------------
  |  |   36|  2.52k|#define ASN1_TAG_GRAPHICSTRING	0x19 /* not yet parsed */
  ------------------
  |  Branch (152:7): [True: 3, False: 1.24k]
  ------------------
  153|  1.24k|	     hdr->tag == ASN1_TAG_GENERALSTRING ||
  ------------------
  |  |   38|  2.52k|#define ASN1_TAG_GENERALSTRING	0x1B /* not yet parsed */
  ------------------
  |  Branch (153:7): [True: 1, False: 1.24k]
  ------------------
  154|  1.24k|	     hdr->tag == ASN1_TAG_UNIVERSALSTRING ||
  ------------------
  |  |   39|  2.52k|#define ASN1_TAG_UNIVERSALSTRING	0x1C /* not yet parsed */
  ------------------
  |  Branch (154:7): [True: 1, False: 1.24k]
  ------------------
  155|  1.24k|	     hdr->tag == ASN1_TAG_UTF8STRING ||
  ------------------
  |  |   24|  2.52k|#define ASN1_TAG_UTF8STRING	0x0C /* not yet parsed */
  ------------------
  |  Branch (155:7): [True: 1, False: 1.24k]
  ------------------
  156|  1.24k|	     hdr->tag == ASN1_TAG_BMPSTRING ||
  ------------------
  |  |   41|  2.52k|#define ASN1_TAG_BMPSTRING	0x1E /* not yet parsed */
  ------------------
  |  Branch (156:7): [True: 1, False: 1.24k]
  ------------------
  157|  1.24k|	     hdr->tag == ASN1_TAG_CHARACTERSTRING ||
  ------------------
  |  |   40|  2.52k|#define ASN1_TAG_CHARACTERSTRING	0x1D /* not yet parsed */
  ------------------
  |  Branch (157:7): [True: 1, False: 1.24k]
  ------------------
  158|  1.24k|	     hdr->tag == ASN1_TAG_UTCTIME ||
  ------------------
  |  |   34|  2.52k|#define ASN1_TAG_UTCTIME	0x17
  ------------------
  |  Branch (158:7): [True: 2, False: 1.24k]
  ------------------
  159|  1.24k|	     hdr->tag == ASN1_TAG_GENERALIZEDTIME ||
  ------------------
  |  |   35|  2.51k|#define ASN1_TAG_GENERALIZEDTIME	0x18 /* not yet parsed */
  ------------------
  |  Branch (159:7): [True: 1, False: 1.23k]
  ------------------
  160|  1.23k|	     hdr->tag == ASN1_TAG_TIME))
  ------------------
  |  |   26|  1.23k|#define ASN1_TAG_TIME		0x0E
  ------------------
  |  Branch (160:7): [True: 1, False: 1.23k]
  ------------------
  161|     41|		return 0;
  162|  6.91k|	if (!hdr->constructed &&
  ------------------
  |  Branch (162:6): [True: 5.68k, False: 1.23k]
  ------------------
  163|  5.68k|	    (hdr->tag == ASN1_TAG_SEQUENCE ||
  ------------------
  |  |   27|  11.3k|#define ASN1_TAG_SEQUENCE	0x10 /* shall be constructed */
  ------------------
  |  Branch (163:7): [True: 1, False: 5.68k]
  ------------------
  164|  5.68k|	     hdr->tag == ASN1_TAG_SET))
  ------------------
  |  |   28|  5.68k|#define ASN1_TAG_SET		0x11
  ------------------
  |  Branch (164:7): [True: 1, False: 5.67k]
  ------------------
  165|      2|		return 0;
  166|       |
  167|  6.91k|	return 1;
  168|  6.91k|}
asn1.c:asn1_valid_der_boolean:
  107|    570|{
  108|       |	/* Enforce DER requirements for a single way of encoding a BOOLEAN */
  109|    570|	if (hdr->length != 1) {
  ------------------
  |  Branch (109:6): [True: 20, False: 550]
  ------------------
  110|     20|		wpa_printf(MSG_DEBUG, "ASN.1: Unexpected BOOLEAN length (%u)",
  111|     20|			   hdr->length);
  112|     20|		return 0;
  113|     20|	}
  114|       |
  115|    550|	if (hdr->payload[0] != 0 && hdr->payload[0] != 0xff) {
  ------------------
  |  Branch (115:6): [True: 279, False: 271]
  |  Branch (115:30): [True: 10, False: 269]
  ------------------
  116|     10|		wpa_printf(MSG_DEBUG,
  117|     10|			   "ASN.1: Invalid BOOLEAN value 0x%x (DER requires 0 or 0xff)",
  118|     10|			   hdr->payload[0]);
  119|     10|		return 0;
  120|     10|	}
  121|       |
  122|    540|	return 1;
  123|    550|}

asn1.c:asn1_is_oid:
   89|  1.06k|{
   90|  1.06k|	return hdr->class == ASN1_CLASS_UNIVERSAL &&
  ------------------
  |  |   43|  2.12k|#define ASN1_CLASS_UNIVERSAL		0
  ------------------
  |  Branch (90:9): [True: 1.06k, False: 0]
  ------------------
   91|  1.06k|		hdr->tag == ASN1_TAG_OID;
  ------------------
  |  |   18|  2.12k|#define ASN1_TAG_OID		0x06
  ------------------
  |  Branch (91:3): [True: 1.06k, False: 0]
  ------------------
   92|  1.06k|}

asn1.c:os_snprintf_error:
  580|  6.56k|{
  581|  6.56k|	return res < 0 || (unsigned int) res >= size;
  ------------------
  |  Branch (581:9): [True: 0, False: 6.56k]
  |  Branch (581:20): [True: 195, False: 6.37k]
  ------------------
  582|  6.56k|}

wpa_printf:
  224|  2.30M|{
  225|  2.30M|	va_list ap;
  226|       |
  227|  2.30M|	if (level >= wpa_debug_level) {
  ------------------
  |  Branch (227:6): [True: 0, False: 2.30M]
  ------------------
  228|       |#ifdef CONFIG_ANDROID_LOG
  229|       |		va_start(ap, fmt);
  230|       |		__android_log_vprint(wpa_to_android_level(level),
  231|       |				     ANDROID_LOG_NAME, fmt, ap);
  232|       |		va_end(ap);
  233|       |#else /* CONFIG_ANDROID_LOG */
  234|       |#ifdef CONFIG_DEBUG_SYSLOG
  235|       |		if (wpa_debug_syslog) {
  236|       |			va_start(ap, fmt);
  237|       |			vsyslog(syslog_priority(level), fmt, ap);
  238|       |			va_end(ap);
  239|       |		}
  240|       |#endif /* CONFIG_DEBUG_SYSLOG */
  241|      0|		wpa_debug_print_timestamp();
  242|       |#ifdef CONFIG_DEBUG_FILE
  243|       |		if (out_file) {
  244|       |			va_start(ap, fmt);
  245|       |			vfprintf(out_file, fmt, ap);
  246|       |			fprintf(out_file, "\n");
  247|       |			va_end(ap);
  248|       |		}
  249|       |#endif /* CONFIG_DEBUG_FILE */
  250|      0|		if (!wpa_debug_syslog && !out_file) {
  ------------------
  |  Branch (250:7): [True: 0, False: 0]
  |  Branch (250:28): [True: 0, False: 0]
  ------------------
  251|      0|			va_start(ap, fmt);
  252|      0|			vprintf(fmt, ap);
  253|      0|			printf("\n");
  254|      0|			va_end(ap);
  255|      0|		}
  256|      0|#endif /* CONFIG_ANDROID_LOG */
  257|      0|	}
  258|       |
  259|       |#ifdef CONFIG_DEBUG_LINUX_TRACING
  260|       |	if (wpa_debug_tracing_file != NULL) {
  261|       |		va_start(ap, fmt);
  262|       |		fprintf(wpa_debug_tracing_file, WPAS_TRACE_PFX, level);
  263|       |		vfprintf(wpa_debug_tracing_file, fmt, ap);
  264|       |		fprintf(wpa_debug_tracing_file, "\n");
  265|       |		fflush(wpa_debug_tracing_file);
  266|       |		va_end(ap);
  267|       |	}
  268|       |#endif /* CONFIG_DEBUG_LINUX_TRACING */
  269|  2.30M|}
wpa_hexdump:
  400|  1.08k|{
  401|  1.08k|	_wpa_hexdump(level, title, buf, len, 1, 0);
  402|  1.08k|}
wpa_hexdump_ascii:
  526|    814|{
  527|    814|	_wpa_hexdump_ascii(level, title, buf, len, 1);
  528|    814|}
wpa_debug.c:_wpa_hexdump:
  274|  1.08k|{
  275|  1.08k|	size_t i;
  276|       |
  277|       |#ifdef CONFIG_DEBUG_LINUX_TRACING
  278|       |	if (wpa_debug_tracing_file != NULL) {
  279|       |		fprintf(wpa_debug_tracing_file,
  280|       |			WPAS_TRACE_PFX "%s - hexdump(len=%lu):",
  281|       |			level, title, (unsigned long) len);
  282|       |		if (buf == NULL) {
  283|       |			fprintf(wpa_debug_tracing_file, " [NULL]\n");
  284|       |		} else if (!show) {
  285|       |			fprintf(wpa_debug_tracing_file, " [REMOVED]\n");
  286|       |		} else {
  287|       |			for (i = 0; i < len; i++)
  288|       |				fprintf(wpa_debug_tracing_file,
  289|       |					" %02x", buf[i]);
  290|       |		}
  291|       |		fflush(wpa_debug_tracing_file);
  292|       |	}
  293|       |#endif /* CONFIG_DEBUG_LINUX_TRACING */
  294|       |
  295|  1.08k|	if (level < wpa_debug_level)
  ------------------
  |  Branch (295:6): [True: 1.08k, False: 0]
  ------------------
  296|  1.08k|		return;
  297|       |#ifdef CONFIG_ANDROID_LOG
  298|       |	{
  299|       |		const char *display;
  300|       |		char *strbuf = NULL;
  301|       |		size_t slen = len;
  302|       |		if (buf == NULL) {
  303|       |			display = " [NULL]";
  304|       |		} else if (len == 0) {
  305|       |			display = "";
  306|       |		} else if (show && len) {
  307|       |			/* Limit debug message length for Android log */
  308|       |			if (slen > 32)
  309|       |				slen = 32;
  310|       |			strbuf = os_malloc(1 + 3 * slen);
  311|       |			if (strbuf == NULL) {
  312|       |				wpa_printf(MSG_ERROR, "wpa_hexdump: Failed to "
  313|       |					   "allocate message buffer");
  314|       |				return;
  315|       |			}
  316|       |
  317|       |			for (i = 0; i < slen; i++)
  318|       |				os_snprintf(&strbuf[i * 3], 4, " %02x",
  319|       |					    buf[i]);
  320|       |
  321|       |			display = strbuf;
  322|       |		} else {
  323|       |			display = " [REMOVED]";
  324|       |		}
  325|       |
  326|       |		__android_log_print(wpa_to_android_level(level),
  327|       |				    ANDROID_LOG_NAME,
  328|       |				    "%s - hexdump(len=%lu):%s%s",
  329|       |				    title, (long unsigned int) len, display,
  330|       |				    len > slen ? " ..." : "");
  331|       |		bin_clear_free(strbuf, 1 + 3 * slen);
  332|       |		return;
  333|       |	}
  334|       |#else /* CONFIG_ANDROID_LOG */
  335|       |#ifdef CONFIG_DEBUG_SYSLOG
  336|       |	if (wpa_debug_syslog) {
  337|       |		const char *display;
  338|       |		char *strbuf = NULL;
  339|       |
  340|       |		if (buf == NULL) {
  341|       |			display = " [NULL]";
  342|       |		} else if (len == 0) {
  343|       |			display = "";
  344|       |		} else if (show && len) {
  345|       |			strbuf = os_malloc(1 + 3 * len);
  346|       |			if (strbuf == NULL) {
  347|       |				wpa_printf(MSG_ERROR, "wpa_hexdump: Failed to "
  348|       |					   "allocate message buffer");
  349|       |				return;
  350|       |			}
  351|       |
  352|       |			for (i = 0; i < len; i++)
  353|       |				os_snprintf(&strbuf[i * 3], 4, " %02x",
  354|       |					    buf[i]);
  355|       |
  356|       |			display = strbuf;
  357|       |		} else {
  358|       |			display = " [REMOVED]";
  359|       |		}
  360|       |
  361|       |		syslog(syslog_priority(level), "%s - hexdump(len=%lu):%s",
  362|       |		       title, (unsigned long) len, display);
  363|       |		bin_clear_free(strbuf, 1 + 3 * len);
  364|       |		if (only_syslog)
  365|       |			return;
  366|       |	}
  367|       |#endif /* CONFIG_DEBUG_SYSLOG */
  368|      0|	wpa_debug_print_timestamp();
  369|       |#ifdef CONFIG_DEBUG_FILE
  370|       |	if (out_file) {
  371|       |		fprintf(out_file, "%s - hexdump(len=%lu):",
  372|       |			title, (unsigned long) len);
  373|       |		if (buf == NULL) {
  374|       |			fprintf(out_file, " [NULL]");
  375|       |		} else if (show) {
  376|       |			for (i = 0; i < len; i++)
  377|       |				fprintf(out_file, " %02x", buf[i]);
  378|       |		} else {
  379|       |			fprintf(out_file, " [REMOVED]");
  380|       |		}
  381|       |		fprintf(out_file, "\n");
  382|       |	}
  383|       |#endif /* CONFIG_DEBUG_FILE */
  384|      0|	if (!wpa_debug_syslog && !out_file) {
  ------------------
  |  Branch (384:6): [True: 0, False: 0]
  |  Branch (384:27): [True: 0, False: 0]
  ------------------
  385|      0|		printf("%s - hexdump(len=%lu):", title, (unsigned long) len);
  386|      0|		if (buf == NULL) {
  ------------------
  |  Branch (386:7): [True: 0, False: 0]
  ------------------
  387|      0|			printf(" [NULL]");
  388|      0|		} else if (show) {
  ------------------
  |  Branch (388:14): [True: 0, False: 0]
  ------------------
  389|      0|			for (i = 0; i < len; i++)
  ------------------
  |  Branch (389:16): [True: 0, False: 0]
  ------------------
  390|      0|				printf(" %02x", buf[i]);
  391|      0|		} else {
  392|      0|			printf(" [REMOVED]");
  393|      0|		}
  394|      0|		printf("\n");
  395|      0|	}
  396|      0|#endif /* CONFIG_ANDROID_LOG */
  397|      0|}
wpa_debug.c:_wpa_hexdump_ascii:
  413|    814|{
  414|    814|	size_t i, llen;
  415|    814|	const u8 *pos = buf;
  416|    814|	const size_t line_len = 16;
  417|       |
  418|       |#ifdef CONFIG_DEBUG_LINUX_TRACING
  419|       |	if (wpa_debug_tracing_file != NULL) {
  420|       |		fprintf(wpa_debug_tracing_file,
  421|       |			WPAS_TRACE_PFX "%s - hexdump_ascii(len=%lu):",
  422|       |			level, title, (unsigned long) len);
  423|       |		if (buf == NULL) {
  424|       |			fprintf(wpa_debug_tracing_file, " [NULL]\n");
  425|       |		} else if (!show) {
  426|       |			fprintf(wpa_debug_tracing_file, " [REMOVED]\n");
  427|       |		} else {
  428|       |			/* can do ascii processing in userspace */
  429|       |			for (i = 0; i < len; i++)
  430|       |				fprintf(wpa_debug_tracing_file,
  431|       |					" %02x", pos[i]);
  432|       |		}
  433|       |		fflush(wpa_debug_tracing_file);
  434|       |	}
  435|       |#endif /* CONFIG_DEBUG_LINUX_TRACING */
  436|       |
  437|    814|	if (level < wpa_debug_level)
  ------------------
  |  Branch (437:6): [True: 814, False: 0]
  ------------------
  438|    814|		return;
  439|       |#ifdef CONFIG_ANDROID_LOG
  440|       |	_wpa_hexdump(level, title, buf, len, show, 0);
  441|       |#else /* CONFIG_ANDROID_LOG */
  442|       |#ifdef CONFIG_DEBUG_SYSLOG
  443|       |	if (wpa_debug_syslog)
  444|       |		_wpa_hexdump(level, title, buf, len, show, 1);
  445|       |#endif /* CONFIG_DEBUG_SYSLOG */
  446|      0|	wpa_debug_print_timestamp();
  447|       |#ifdef CONFIG_DEBUG_FILE
  448|       |	if (out_file) {
  449|       |		if (!show) {
  450|       |			fprintf(out_file,
  451|       |				"%s - hexdump_ascii(len=%lu): [REMOVED]\n",
  452|       |				title, (unsigned long) len);
  453|       |			goto file_done;
  454|       |		}
  455|       |		if (buf == NULL) {
  456|       |			fprintf(out_file,
  457|       |				"%s - hexdump_ascii(len=%lu): [NULL]\n",
  458|       |				title, (unsigned long) len);
  459|       |			goto file_done;
  460|       |		}
  461|       |		fprintf(out_file, "%s - hexdump_ascii(len=%lu):\n",
  462|       |			title, (unsigned long) len);
  463|       |		while (len) {
  464|       |			llen = len > line_len ? line_len : len;
  465|       |			fprintf(out_file, "    ");
  466|       |			for (i = 0; i < llen; i++)
  467|       |				fprintf(out_file, " %02x", pos[i]);
  468|       |			for (i = llen; i < line_len; i++)
  469|       |				fprintf(out_file, "   ");
  470|       |			fprintf(out_file, "   ");
  471|       |			for (i = 0; i < llen; i++) {
  472|       |				if (isprint(pos[i]))
  473|       |					fprintf(out_file, "%c", pos[i]);
  474|       |				else
  475|       |					fprintf(out_file, "_");
  476|       |			}
  477|       |			for (i = llen; i < line_len; i++)
  478|       |				fprintf(out_file, " ");
  479|       |			fprintf(out_file, "\n");
  480|       |			pos += llen;
  481|       |			len -= llen;
  482|       |		}
  483|       |	}
  484|       |file_done:
  485|       |#endif /* CONFIG_DEBUG_FILE */
  486|      0|	if (!wpa_debug_syslog && !out_file) {
  ------------------
  |  Branch (486:6): [True: 0, False: 0]
  |  Branch (486:27): [True: 0, False: 0]
  ------------------
  487|      0|		if (!show) {
  ------------------
  |  Branch (487:7): [True: 0, False: 0]
  ------------------
  488|      0|			printf("%s - hexdump_ascii(len=%lu): [REMOVED]\n",
  489|      0|			       title, (unsigned long) len);
  490|      0|			return;
  491|      0|		}
  492|      0|		if (buf == NULL) {
  ------------------
  |  Branch (492:7): [True: 0, False: 0]
  ------------------
  493|      0|			printf("%s - hexdump_ascii(len=%lu): [NULL]\n",
  494|      0|			       title, (unsigned long) len);
  495|      0|			return;
  496|      0|		}
  497|      0|		printf("%s - hexdump_ascii(len=%lu):\n", title,
  498|      0|		       (unsigned long) len);
  499|      0|		while (len) {
  ------------------
  |  Branch (499:10): [True: 0, False: 0]
  ------------------
  500|      0|			llen = len > line_len ? line_len : len;
  ------------------
  |  Branch (500:11): [True: 0, False: 0]
  ------------------
  501|      0|			printf("    ");
  502|      0|			for (i = 0; i < llen; i++)
  ------------------
  |  Branch (502:16): [True: 0, False: 0]
  ------------------
  503|      0|				printf(" %02x", pos[i]);
  504|      0|			for (i = llen; i < line_len; i++)
  ------------------
  |  Branch (504:19): [True: 0, False: 0]
  ------------------
  505|      0|				printf("   ");
  506|      0|			printf("   ");
  507|      0|			for (i = 0; i < llen; i++) {
  ------------------
  |  Branch (507:16): [True: 0, False: 0]
  ------------------
  508|      0|				if (isprint(pos[i]))
  ------------------
  |  Branch (508:9): [True: 0, False: 0]
  ------------------
  509|      0|					printf("%c", pos[i]);
  510|      0|				else
  511|      0|					printf("_");
  512|      0|			}
  513|      0|			for (i = llen; i < line_len; i++)
  ------------------
  |  Branch (513:19): [True: 0, False: 0]
  ------------------
  514|      0|				printf(" ");
  515|      0|			printf("\n");
  516|      0|			pos += llen;
  517|      0|			len -= llen;
  518|      0|		}
  519|      0|	}
  520|      0|#endif /* CONFIG_ANDROID_LOG */
  521|      0|}

LLVMFuzzerTestOneInput:
  177|    966|{
  178|    966|	wpa_fuzzer_set_debug_level();
  179|       |
  180|    966|	if (asn1_parse(data, size, 0) < 0)
  ------------------
  |  Branch (180:6): [True: 625, False: 341]
  ------------------
  181|    625|		wpa_printf(MSG_DEBUG, "Failed to parse DER ASN.1");
  182|       |
  183|    966|	return 0;
  184|    966|}
asn1.c:asn1_parse:
   34|  3.20k|{
   35|  3.20k|	const u8 *pos, *prev, *end;
   36|  3.20k|	char prefix[10], str[100];
   37|  3.20k|	int _level;
   38|  3.20k|	struct asn1_hdr hdr;
   39|  3.20k|	struct asn1_oid oid;
   40|  3.20k|	u8 tmp;
   41|       |
   42|  3.20k|	_level = level;
   43|  3.20k|	if ((size_t) _level > sizeof(prefix) - 1)
  ------------------
  |  Branch (43:6): [True: 726, False: 2.47k]
  ------------------
   44|    726|		_level = sizeof(prefix) - 1;
   45|  3.20k|	memset(prefix, ' ', _level);
   46|  3.20k|	prefix[_level] = '\0';
   47|       |
   48|  3.20k|	pos = buf;
   49|  3.20k|	end = buf + len;
   50|       |
   51|   304k|	while (pos < end) {
  ------------------
  |  Branch (51:9): [True: 302k, False: 1.93k]
  ------------------
   52|   302k|		if (asn1_get_next(pos, end - pos, &hdr) < 0)
  ------------------
  |  Branch (52:7): [True: 390, False: 302k]
  ------------------
   53|    390|			return -1;
   54|       |
   55|   302k|		prev = pos;
   56|   302k|		pos = hdr.payload;
   57|       |
   58|   302k|		wpa_printf(MSG_MSGDUMP, "ASN.1:%s Class %d(%s) P/C %d(%s) "
   59|   302k|			   "Tag %u Length %u",
   60|   302k|			   prefix, hdr.class, asn1_class_str(hdr.class),
   61|   302k|			   hdr.constructed,
   62|   302k|			   hdr.constructed ? "Constructed" : "Primitive",
  ------------------
  |  Branch (62:7): [True: 297k, False: 5.29k]
  ------------------
   63|   302k|			   hdr.tag, hdr.length);
   64|       |
   65|   302k|		if (hdr.class == ASN1_CLASS_CONTEXT_SPECIFIC &&
  ------------------
  |  |   45|   604k|#define ASN1_CLASS_CONTEXT_SPECIFIC	2
  ------------------
  |  Branch (65:7): [True: 1.54k, False: 300k]
  ------------------
   66|  1.54k|		    hdr.constructed) {
  ------------------
  |  Branch (66:7): [True: 1.15k, False: 393]
  ------------------
   67|  1.15k|			if (asn1_parse(pos, hdr.length, level + 1) < 0)
  ------------------
  |  Branch (67:8): [True: 420, False: 731]
  ------------------
   68|    420|				return -1;
   69|    731|			pos += hdr.length;
   70|    731|		}
   71|       |
   72|   301k|		if (hdr.class != ASN1_CLASS_UNIVERSAL)
  ------------------
  |  |   43|   301k|#define ASN1_CLASS_UNIVERSAL		0
  ------------------
  |  Branch (72:7): [True: 296k, False: 5.84k]
  ------------------
   73|   296k|			continue;
   74|       |
   75|  5.84k|		switch (hdr.tag) {
   76|    871|		case ASN1_TAG_EOC:
  ------------------
  |  |   12|    871|#define ASN1_TAG_EOC		0x00 /* not used with DER */
  ------------------
  |  Branch (76:3): [True: 871, False: 4.97k]
  ------------------
   77|    871|			if (hdr.length) {
  ------------------
  |  Branch (77:8): [True: 5, False: 866]
  ------------------
   78|      5|				wpa_printf(MSG_DEBUG, "ASN.1: Non-zero "
   79|      5|					   "end-of-contents length (%u)",
   80|      5|					   hdr.length);
   81|      5|				return -1;
   82|      5|			}
   83|    866|			wpa_printf(MSG_MSGDUMP, "ASN.1:%s EOC", prefix);
   84|    866|			break;
   85|    535|		case ASN1_TAG_BOOLEAN:
  ------------------
  |  |   13|    535|#define ASN1_TAG_BOOLEAN	0x01
  ------------------
  |  Branch (85:3): [True: 535, False: 5.31k]
  ------------------
   86|    535|			if (hdr.length != 1) {
  ------------------
  |  Branch (86:8): [True: 0, False: 535]
  ------------------
   87|      0|				wpa_printf(MSG_DEBUG, "ASN.1: Unexpected "
   88|      0|					   "Boolean length (%u)", hdr.length);
   89|      0|				return -1;
   90|      0|			}
   91|    535|			tmp = *pos++;
   92|    535|			wpa_printf(MSG_MSGDUMP, "ASN.1:%s Boolean %s",
   93|    535|				   prefix, tmp ? "TRUE" : "FALSE");
  ------------------
  |  Branch (93:16): [True: 266, False: 269]
  ------------------
   94|    535|			break;
   95|    256|		case ASN1_TAG_INTEGER:
  ------------------
  |  |   14|    256|#define ASN1_TAG_INTEGER	0x02
  ------------------
  |  Branch (95:3): [True: 256, False: 5.59k]
  ------------------
   96|    256|			wpa_hexdump(MSG_MSGDUMP, "ASN.1: INTEGER",
   97|    256|				    pos, hdr.length);
   98|    256|			pos += hdr.length;
   99|    256|			break;
  100|    218|		case ASN1_TAG_BITSTRING:
  ------------------
  |  |   15|    218|#define ASN1_TAG_BITSTRING	0x03
  ------------------
  |  Branch (100:3): [True: 218, False: 5.62k]
  ------------------
  101|    218|			wpa_hexdump(MSG_MSGDUMP, "ASN.1: BitString",
  102|    218|				    pos, hdr.length);
  103|    218|			pos += hdr.length;
  104|    218|			break;
  105|    383|		case ASN1_TAG_OCTETSTRING:
  ------------------
  |  |   16|    383|#define ASN1_TAG_OCTETSTRING	0x04
  ------------------
  |  Branch (105:3): [True: 383, False: 5.46k]
  ------------------
  106|    383|			wpa_hexdump(MSG_MSGDUMP, "ASN.1: OctetString",
  107|    383|				    pos, hdr.length);
  108|    383|			pos += hdr.length;
  109|    383|			break;
  110|    199|		case ASN1_TAG_NULL:
  ------------------
  |  |   17|    199|#define ASN1_TAG_NULL		0x05
  ------------------
  |  Branch (110:3): [True: 199, False: 5.64k]
  ------------------
  111|    199|			if (hdr.length) {
  ------------------
  |  Branch (111:8): [True: 0, False: 199]
  ------------------
  112|      0|				wpa_printf(MSG_DEBUG, "ASN.1: Non-zero Null "
  113|      0|					   "length (%u)", hdr.length);
  114|      0|				return -1;
  115|      0|			}
  116|    199|			wpa_printf(MSG_MSGDUMP, "ASN.1:%s Null", prefix);
  117|    199|			break;
  118|  1.07k|		case ASN1_TAG_OID:
  ------------------
  |  |   18|  1.07k|#define ASN1_TAG_OID		0x06
  ------------------
  |  Branch (118:3): [True: 1.07k, False: 4.77k]
  ------------------
  119|  1.07k|			if (asn1_get_oid(prev, end - prev, &oid, &prev) < 0) {
  ------------------
  |  Branch (119:8): [True: 43, False: 1.02k]
  ------------------
  120|     43|				wpa_printf(MSG_DEBUG, "ASN.1: Invalid OID");
  121|     43|				return -1;
  122|     43|			}
  123|  1.02k|			asn1_oid_to_str(&oid, str, sizeof(str));
  124|  1.02k|			wpa_printf(MSG_DEBUG, "ASN.1:%s OID %s", prefix, str);
  125|  1.02k|			pos += hdr.length;
  126|  1.02k|			break;
  127|    225|		case ANS1_TAG_RELATIVE_OID:
  ------------------
  |  |   25|    225|#define ANS1_TAG_RELATIVE_OID	0x0D
  ------------------
  |  Branch (127:3): [True: 225, False: 5.62k]
  ------------------
  128|    225|			wpa_hexdump(MSG_MSGDUMP, "ASN.1: Relative OID",
  129|    225|				    pos, hdr.length);
  130|    225|			pos += hdr.length;
  131|    225|			break;
  132|    584|		case ASN1_TAG_SEQUENCE:
  ------------------
  |  |   27|    584|#define ASN1_TAG_SEQUENCE	0x10 /* shall be constructed */
  ------------------
  |  Branch (132:3): [True: 584, False: 5.26k]
  ------------------
  133|    584|			wpa_printf(MSG_MSGDUMP, "ASN.1:%s SEQUENCE", prefix);
  134|    584|			if (asn1_parse(pos, hdr.length, level + 1) < 0)
  ------------------
  |  Branch (134:8): [True: 134, False: 450]
  ------------------
  135|    134|				return -1;
  136|    450|			pos += hdr.length;
  137|    450|			break;
  138|    503|		case ASN1_TAG_SET:
  ------------------
  |  |   28|    503|#define ASN1_TAG_SET		0x11
  ------------------
  |  Branch (138:3): [True: 503, False: 5.34k]
  ------------------
  139|    503|			wpa_printf(MSG_MSGDUMP, "ASN.1:%s SET", prefix);
  140|    503|			if (asn1_parse(pos, hdr.length, level + 1) < 0)
  ------------------
  |  Branch (140:8): [True: 88, False: 415]
  ------------------
  141|     88|				return -1;
  142|    415|			pos += hdr.length;
  143|    415|			break;
  144|    203|		case ASN1_TAG_PRINTABLESTRING:
  ------------------
  |  |   30|    203|#define ASN1_TAG_PRINTABLESTRING	0x13
  ------------------
  |  Branch (144:3): [True: 203, False: 5.64k]
  ------------------
  145|    203|			wpa_hexdump_ascii(MSG_MSGDUMP,
  146|    203|					  "ASN.1: PrintableString",
  147|    203|					  pos, hdr.length);
  148|    203|			pos += hdr.length;
  149|    203|			break;
  150|    215|		case ASN1_TAG_IA5STRING:
  ------------------
  |  |   33|    215|#define ASN1_TAG_IA5STRING	0x16
  ------------------
  |  Branch (150:3): [True: 215, False: 5.63k]
  ------------------
  151|    215|			wpa_hexdump_ascii(MSG_MSGDUMP, "ASN.1: IA5String",
  152|    215|					  pos, hdr.length);
  153|    215|			pos += hdr.length;
  154|    215|			break;
  155|    202|		case ASN1_TAG_UTCTIME:
  ------------------
  |  |   34|    202|#define ASN1_TAG_UTCTIME	0x17
  ------------------
  |  Branch (155:3): [True: 202, False: 5.64k]
  ------------------
  156|    202|			wpa_hexdump_ascii(MSG_MSGDUMP, "ASN.1: UTCTIME",
  157|    202|					  pos, hdr.length);
  158|    202|			pos += hdr.length;
  159|    202|			break;
  160|    194|		case ASN1_TAG_VISIBLESTRING:
  ------------------
  |  |   37|    194|#define ASN1_TAG_VISIBLESTRING	0x1A
  ------------------
  |  Branch (160:3): [True: 194, False: 5.65k]
  ------------------
  161|    194|			wpa_hexdump_ascii(MSG_MSGDUMP, "ASN.1: VisibleString",
  162|    194|					  pos, hdr.length);
  163|    194|			pos += hdr.length;
  164|    194|			break;
  165|    187|		default:
  ------------------
  |  Branch (165:3): [True: 187, False: 5.65k]
  ------------------
  166|    187|			wpa_printf(MSG_DEBUG, "ASN.1: Unknown tag %d",
  167|    187|				   hdr.tag);
  168|    187|			return -1;
  169|  5.84k|		}
  170|  5.84k|	}
  171|       |
  172|  1.93k|	return 0;
  173|  3.20k|}
asn1.c:asn1_class_str:
   17|   302k|{
   18|   302k|	switch (class) {
   19|  5.84k|	case ASN1_CLASS_UNIVERSAL:
  ------------------
  |  |   43|  5.84k|#define ASN1_CLASS_UNIVERSAL		0
  ------------------
  |  Branch (19:2): [True: 5.84k, False: 296k]
  ------------------
   20|  5.84k|		return "Universal";
   21|    267|	case ASN1_CLASS_APPLICATION:
  ------------------
  |  |   44|    267|#define ASN1_CLASS_APPLICATION		1
  ------------------
  |  Branch (21:2): [True: 267, False: 302k]
  ------------------
   22|    267|		return "Application";
   23|  1.54k|	case ASN1_CLASS_CONTEXT_SPECIFIC:
  ------------------
  |  |   45|  1.54k|#define ASN1_CLASS_CONTEXT_SPECIFIC	2
  ------------------
  |  Branch (23:2): [True: 1.54k, False: 300k]
  ------------------
   24|  1.54k|		return "Context-specific";
   25|   294k|	case ASN1_CLASS_PRIVATE:
  ------------------
  |  |   46|   294k|#define ASN1_CLASS_PRIVATE		3
  ------------------
  |  Branch (25:2): [True: 294k, False: 7.65k]
  ------------------
   26|   294k|		return "Private";
   27|      0|	default:
  ------------------
  |  Branch (27:2): [True: 0, False: 302k]
  ------------------
   28|      0|		return "?";
   29|   302k|	}
   30|   302k|}

wpa_fuzzer_set_debug_level:
   15|    966|{
   16|    966|	static int first = 1;
   17|       |
   18|    966|	if (first) {
  ------------------
  |  Branch (18:6): [True: 1, False: 965]
  ------------------
   19|      1|		char *env;
   20|       |
   21|      1|		first = 0;
   22|      1|		env = getenv("WPADEBUG");
   23|      1|		if (env)
  ------------------
  |  Branch (23:7): [True: 0, False: 1]
  ------------------
   24|      0|			wpa_debug_level = atoi(env);
   25|      1|		else
   26|      1|			wpa_debug_level = MSG_ERROR + 1;
   27|       |
   28|      1|		wpa_debug_show_keys = 1;
   29|      1|	}
   30|    966|}

