OpenCoverage

asn1_par.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/asn1_par.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.-
3 *-
4 * Licensed under the OpenSSL license (the "License"). You may not use-
5 * this file except in compliance with the License. You can obtain a copy-
6 * in the file LICENSE in the source distribution or at-
7 * https://www.openssl.org/source/license.html-
8 */-
9-
10#include <stdio.h>-
11#include "internal/cryptlib.h"-
12#include <openssl/buffer.h>-
13#include <openssl/objects.h>-
14#include <openssl/asn1.h>-
15-
16#ifndef ASN1_PARSE_MAXDEPTH-
17#define ASN1_PARSE_MAXDEPTH 128-
18#endif-
19-
20static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,-
21 int indent);-
22static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,-
23 int offset, int depth, int indent, int dump);-
24static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,-
25 int indent)-
26{-
27 static const char fmt[] = "%-18s";-
28 char str[128];-
29 const char *p;-
30-
31 if (constructed & V_ASN1_CONSTRUCTED)
constructed & 0x20Description
TRUEevaluated 501382 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 927274 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
501382-927274
32 p = "cons: ";
executed 501382 times by 1 test: p = "cons: ";
Executed by:
  • libcrypto.so.1.1
501382
33 else-
34 p = "prim: ";
executed 927274 times by 1 test: p = "prim: ";
Executed by:
  • libcrypto.so.1.1
927274
35 if (BIO_write(bp, p, 6) < 6)
BIO_write(bp, p, 6) < 6Description
TRUEnever evaluated
FALSEevaluated 1428656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1428656
36 goto err;
never executed: goto err;
0
37 BIO_indent(bp, indent, 128);-
38-
39 p = str;-
40 if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE)
(xclass & 0xc0) == 0xc0Description
TRUEevaluated 1476 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1427180 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1476-1427180
41 BIO_snprintf(str, sizeof(str), "priv [ %d ] ", tag);
executed 1476 times by 1 test: BIO_snprintf(str, sizeof(str), "priv [ %d ] ", tag);
Executed by:
  • libcrypto.so.1.1
1476
42 else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC)
(xclass & 0x80) == 0x80Description
TRUEevaluated 55966 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1371214 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
55966-1371214
43 BIO_snprintf(str, sizeof(str), "cont [ %d ]", tag);
executed 55966 times by 1 test: BIO_snprintf(str, sizeof(str), "cont [ %d ]", tag);
Executed by:
  • libcrypto.so.1.1
55966
44 else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)
(xclass & 0x40) == 0x40Description
TRUEevaluated 996 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1370218 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
996-1370218
45 BIO_snprintf(str, sizeof(str), "appl [ %d ]", tag);
executed 996 times by 1 test: BIO_snprintf(str, sizeof(str), "appl [ %d ]", tag);
Executed by:
  • libcrypto.so.1.1
996
46 else if (tag > 30)
tag > 30Description
TRUEevaluated 1627 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1368591 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1627-1368591
47 BIO_snprintf(str, sizeof(str), "<ASN1 %d>", tag);
executed 1627 times by 1 test: BIO_snprintf(str, sizeof(str), "<ASN1 %d>", tag);
Executed by:
  • libcrypto.so.1.1
1627
48 else-
49 p = ASN1_tag2str(tag);
executed 1368591 times by 1 test: p = ASN1_tag2str(tag);
Executed by:
  • libcrypto.so.1.1
1368591
50-
51 if (BIO_printf(bp, fmt, p) <= 0)
BIO_printf(bp, fmt, p) <= 0Description
TRUEnever evaluated
FALSEevaluated 1428656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1428656
52 goto err;
never executed: goto err;
0
53 return 1;
executed 1428656 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1428656
54 err:-
55 return 0;
never executed: return 0;
0
56}-
57-
58int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent)-
59{-
60 return asn1_parse2(bp, &pp, len, 0, 0, indent, 0);
never executed: return asn1_parse2(bp, &pp, len, 0, 0, indent, 0);
0
61}-
62-
63int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent,-
64 int dump)-
65{-
66 return asn1_parse2(bp, &pp, len, 0, 0, indent, dump);
executed 20821 times by 1 test: return asn1_parse2(bp, &pp, len, 0, 0, indent, dump);
Executed by:
  • libcrypto.so.1.1
20821
67}-
68-
69static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,-
70 int offset, int depth, int indent, int dump)-
71{-
72 const unsigned char *p, *ep, *tot, *op, *opp;-
73 long len;-
74 int tag, xclass, ret = 0;-
75 int nl, hl, j, r;-
76 ASN1_OBJECT *o = NULL;-
77 ASN1_OCTET_STRING *os = NULL;-
78 /* ASN1_BMPSTRING *bmp=NULL; */-
79 int dump_indent, dump_cont = 0;-
80-
81 if (depth > ASN1_PARSE_MAXDEPTH) {
depth > 128Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 422615 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
22-422615
82 BIO_puts(bp, "BAD RECURSION DEPTH\n");-
83 return 0;
executed 22 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
22
84 }-
85-
86 dump_indent = 6; /* Because we know BIO_dump_indent() */-
87 p = *pp;-
88 tot = p + length;-
89 while (length > 0) {
length > 0Description
TRUEevaluated 1429533 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 113398 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
113398-1429533
90 op = p;-
91 j = ASN1_get_object(&p, &len, &tag, &xclass, length);-
92 if (j & 0x80) {
j & 0x80Description
TRUEevaluated 877 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1428656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
877-1428656
93 if (BIO_write(bp, "Error in encoding\n", 18) <= 0)
BIO_write(bp, ...g\n", 18) <= 0Description
TRUEnever evaluated
FALSEevaluated 877 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-877
94 goto end;
never executed: goto end;
0
95 ret = 0;-
96 goto end;
executed 877 times by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
877
97 }-
98 hl = (p - op);-
99 length -= hl;-
100 /*-
101 * if j == 0x21 it is a constructed indefinite length object-
102 */-
103 if (BIO_printf(bp, "%5ld:", (long)offset + (long)(op - *pp))
BIO_printf(bp,...p - *pp)) <= 0Description
TRUEnever evaluated
FALSEevaluated 1428656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1428656
104 <= 0)
BIO_printf(bp,...p - *pp)) <= 0Description
TRUEnever evaluated
FALSEevaluated 1428656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1428656
105 goto end;
never executed: goto end;
0
106-
107 if (j != (V_ASN1_CONSTRUCTED | 1)) {
j != (0x20 | 1)Description
TRUEevaluated 1121759 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 306897 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
306897-1121759
108 if (BIO_printf(bp, "d=%-2d hl=%ld l=%4ld ",
BIO_printf(bp,...)hl, len) <= 0Description
TRUEnever evaluated
FALSEevaluated 1121759 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1121759
109 depth, (long)hl, len) <= 0)
BIO_printf(bp,...)hl, len) <= 0Description
TRUEnever evaluated
FALSEevaluated 1121759 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1121759
110 goto end;
never executed: goto end;
0
111 } else {
executed 1121759 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1121759
112 if (BIO_printf(bp, "d=%-2d hl=%ld l=inf ", depth, (long)hl) <= 0)
BIO_printf(bp,...(long)hl) <= 0Description
TRUEnever evaluated
FALSEevaluated 306897 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-306897
113 goto end;
never executed: goto end;
0
114 }
executed 306897 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
306897
115 if (!asn1_print_info(bp, tag, xclass, j, (indent) ? depth : 0))
!asn1_print_in...) ? depth : 0)Description
TRUEnever evaluated
FALSEevaluated 1428656 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1428656
116 goto end;
never executed: goto end;
0
117 if (j & V_ASN1_CONSTRUCTED) {
j & 0x20Description
TRUEevaluated 501382 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 927274 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
501382-927274
118 const unsigned char *sp = p;-
119-
120 ep = p + len;-
121 if (BIO_write(bp, "\n", 1) <= 0)
BIO_write(bp, "\n", 1) <= 0Description
TRUEnever evaluated
FALSEevaluated 501382 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-501382
122 goto end;
never executed: goto end;
0
123 if (len > length) {
len > lengthDescription
TRUEnever evaluated
FALSEevaluated 501382 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-501382
124 BIO_printf(bp, "length is greater than %ld\n", length);-
125 ret = 0;-
126 goto end;
never executed: goto end;
0
127 }-
128 if ((j == 0x21) && (len == 0)) {
(j == 0x21)Description
TRUEevaluated 306897 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 194485 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(len == 0)Description
TRUEevaluated 306897 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-306897
129 for (;;) {-
130 r = asn1_parse2(bp, &p, (long)(tot - p),-
131 offset + (p - *pp), depth + 1,-
132 indent, dump);-
133 if (r == 0) {
r == 0Description
TRUEevaluated 5441 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 301456 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5441-301456
134 ret = 0;-
135 goto end;
executed 5441 times by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
5441
136 }-
137 if ((r == 2) || (p >= tot)) {
(r == 2)Description
TRUEevaluated 300364 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1092 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(p >= tot)Description
TRUEevaluated 1092 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-300364
138 len = p - sp;-
139 break;
executed 301456 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
301456
140 }-
141 }
never executed: end of block
0
142 } else {
executed 301456 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
301456
143 long tmp = len;-
144-
145 while (p < ep) {
p < epDescription
TRUEevaluated 94919 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 193207 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
94919-193207
146 sp = p;-
147 r = asn1_parse2(bp, &p, tmp,-
148 offset + (p - *pp), depth + 1,-
149 indent, dump);-
150 if (r == 0) {
r == 0Description
TRUEevaluated 1278 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 93641 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1278-93641
151 ret = 0;-
152 goto end;
executed 1278 times by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
1278
153 }-
154 tmp -= p - sp;-
155 }
executed 93641 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
93641
156 }
executed 193207 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
193207
157 } else if (xclass != 0) {
xclass != 0Description
TRUEevaluated 11082 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 916192 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
11082-916192
158 p += len;-
159 if (BIO_write(bp, "\n", 1) <= 0)
BIO_write(bp, "\n", 1) <= 0Description
TRUEnever evaluated
FALSEevaluated 11082 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-11082
160 goto end;
never executed: goto end;
0
161 } else {
executed 11082 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
11082
162 nl = 0;-
163 if ((tag == V_ASN1_PRINTABLESTRING) ||
(tag == 19)Description
TRUEevaluated 1945 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 914247 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1945-914247
164 (tag == V_ASN1_T61STRING) ||
(tag == 20)Description
TRUEevaluated 512 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 913735 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
512-913735
165 (tag == V_ASN1_IA5STRING) ||
(tag == 22)Description
TRUEevaluated 533 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 913202 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
533-913202
166 (tag == V_ASN1_VISIBLESTRING) ||
(tag == 26)Description
TRUEevaluated 2691 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 910511 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2691-910511
167 (tag == V_ASN1_NUMERICSTRING) ||
(tag == 18)Description
TRUEevaluated 398 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 910113 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
398-910113
168 (tag == V_ASN1_UTF8STRING) ||
(tag == 12)Description
TRUEevaluated 4220 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 905893 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4220-905893
169 (tag == V_ASN1_UTCTIME) || (tag == V_ASN1_GENERALIZEDTIME)) {
(tag == 23)Description
TRUEevaluated 8665 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 897228 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(tag == 24)Description
TRUEevaluated 55076 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 842152 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8665-897228
170 if (BIO_write(bp, ":", 1) <= 0)
BIO_write(bp, ":", 1) <= 0Description
TRUEnever evaluated
FALSEevaluated 74040 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-74040
171 goto end;
never executed: goto end;
0
172 if ((len > 0) && BIO_write(bp, (const char *)p, (int)len)
(len > 0)Description
TRUEevaluated 71128 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2912 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
BIO_write(bp, ...n) != (int)lenDescription
TRUEnever evaluated
FALSEevaluated 71128 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-71128
173 != (int)len)
BIO_write(bp, ...n) != (int)lenDescription
TRUEnever evaluated
FALSEevaluated 71128 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-71128
174 goto end;
never executed: goto end;
0
175 } else if (tag == V_ASN1_OBJECT) {
executed 74040 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
tag == 6Description
TRUEevaluated 231990 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 610162 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
74040-610162
176 opp = op;-
177 if (d2i_ASN1_OBJECT(&o, &opp, len + hl) != NULL) {
d2i_ASN1_OBJEC...!= ((void *)0)Description
TRUEevaluated 223007 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8983 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8983-223007
178 if (BIO_write(bp, ":", 1) <= 0)
BIO_write(bp, ":", 1) <= 0Description
TRUEnever evaluated
FALSEevaluated 223007 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-223007
179 goto end;
never executed: goto end;
0
180 i2a_ASN1_OBJECT(bp, o);-
181 } else {
executed 223007 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
223007
182 if (BIO_puts(bp, ":BAD OBJECT") <= 0)
BIO_puts(bp, "... OBJECT") <= 0Description
TRUEnever evaluated
FALSEevaluated 8983 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8983
183 goto end;
never executed: goto end;
0
184 dump_cont = 1;-
185 }
executed 8983 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8983
186 } else if (tag == V_ASN1_BOOLEAN) {
tag == 1Description
TRUEevaluated 13032 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 597130 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
13032-597130
187 if (len != 1) {
len != 1Description
TRUEevaluated 957 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12075 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
957-12075
188 if (BIO_puts(bp, ":BAD BOOLEAN") <= 0)
BIO_puts(bp, "...BOOLEAN") <= 0Description
TRUEnever evaluated
FALSEevaluated 957 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-957
189 goto end;
never executed: goto end;
0
190 dump_cont = 1;-
191 }
executed 957 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
957
192 if (len > 0)
len > 0Description
TRUEevaluated 12545 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 487 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
487-12545
193 BIO_printf(bp, ":%u", p[0]);
executed 12545 times by 1 test: BIO_printf(bp, ":%u", p[0]);
Executed by:
  • libcrypto.so.1.1
12545
194 } else if (tag == V_ASN1_BMPSTRING) {
executed 13032 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
tag == 30Description
TRUEevaluated 2457 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 594673 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2457-594673
195 /* do the BMP thang */-
196 } else if (tag == V_ASN1_OCTET_STRING) {
executed 2457 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
tag == 4Description
TRUEevaluated 94530 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 500143 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2457-500143
197 int i, printable = 1;-
198-
199 opp = op;-
200 os = d2i_ASN1_OCTET_STRING(NULL, &opp, len + hl);-
201 if (os != NULL && os->length > 0) {
os != ((void *)0)Description
TRUEevaluated 93423 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1107 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
os->length > 0Description
TRUEevaluated 86204 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7219 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1107-93423
202 opp = os->data;-
203 /*-
204 * testing whether the octet string is printable-
205 */-
206 for (i = 0; i < os->length; i++) {
i < os->lengthDescription
TRUEevaluated 156154 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2531 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2531-156154
207 if (((opp[i] < ' ') &&
(opp[i] < ' ')Description
TRUEevaluated 45136 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 111018 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
45136-111018
208 (opp[i] != '\n') &&
(opp[i] != '\n')Description
TRUEevaluated 35967 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9169 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
9169-35967
209 (opp[i] != '\r') &&
(opp[i] != '\r')Description
TRUEevaluated 35568 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 399 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
399-35568
210 (opp[i] != '\t')) || (opp[i] > '~')) {
(opp[i] != '\t')Description
TRUEevaluated 33439 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(opp[i] > '~')Description
TRUEevaluated 50234 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 72481 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2129-72481
211 printable = 0;-
212 break;
executed 83673 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
83673
213 }-
214 }
executed 72481 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
72481
215 if (printable)
printableDescription
TRUEevaluated 2531 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 83673 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2531-83673
216 /* printable string */-
217 {-
218 if (BIO_write(bp, ":", 1) <= 0)
BIO_write(bp, ":", 1) <= 0Description
TRUEnever evaluated
FALSEevaluated 2531 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2531
219 goto end;
never executed: goto end;
0
220 if (BIO_write(bp, (const char *)opp, os->length) <= 0)
BIO_write(bp, ...->length) <= 0Description
TRUEnever evaluated
FALSEevaluated 2531 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2531
221 goto end;
never executed: goto end;
0
222 } else if (!dump)
executed 2531 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
!dumpDescription
TRUEevaluated 83673 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-83673
223 /*-
224 * not printable => print octet string as hex dump-
225 */-
226 {-
227 if (BIO_write(bp, "[HEX DUMP]:", 11) <= 0)
BIO_write(bp, ...P]:", 11) <= 0Description
TRUEnever evaluated
FALSEevaluated 83673 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-83673
228 goto end;
never executed: goto end;
0
229 for (i = 0; i < os->length; i++) {
i < os->lengthDescription
TRUEevaluated 1644636 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 83673 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
83673-1644636
230 if (BIO_printf(bp, "%02X", opp[i]) <= 0)
BIO_printf(bp,..., opp[i]) <= 0Description
TRUEnever evaluated
FALSEevaluated 1644636 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1644636
231 goto end;
never executed: goto end;
0
232 }
executed 1644636 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1644636
233 } else
executed 83673 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
83673
234 /* print the normal dump */-
235 {-
236 if (!nl) {
!nlDescription
TRUEnever evaluated
FALSEnever evaluated
0
237 if (BIO_write(bp, "\n", 1) <= 0)
BIO_write(bp, "\n", 1) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
238 goto end;
never executed: goto end;
0
239 }
never executed: end of block
0
240 if (BIO_dump_indent(bp,
BIO_dump_inden...p_indent) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
241 (const char *)opp,
BIO_dump_inden...p_indent) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
242 ((dump == -1 || dump >
BIO_dump_inden...p_indent) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
243 os->
BIO_dump_inden...p_indent) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
244 length) ? os->length : dump),
BIO_dump_inden...p_indent) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
245 dump_indent) <= 0)
BIO_dump_inden...p_indent) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
246 goto end;
never executed: goto end;
0
247 nl = 1;-
248 }
never executed: end of block
0
249 }-
250 ASN1_OCTET_STRING_free(os);-
251 os = NULL;-
252 } else if (tag == V_ASN1_INTEGER) {
executed 94530 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
tag == 2Description
TRUEevaluated 114787 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 385356 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
94530-385356
253 ASN1_INTEGER *bs;-
254 int i;-
255-
256 opp = op;-
257 bs = d2i_ASN1_INTEGER(NULL, &opp, len + hl);-
258 if (bs != NULL) {
bs != ((void *)0)Description
TRUEevaluated 110712 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4075 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4075-110712
259 if (BIO_write(bp, ":", 1) <= 0)
BIO_write(bp, ":", 1) <= 0Description
TRUEnever evaluated
FALSEevaluated 110712 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-110712
260 goto end;
never executed: goto end;
0
261 if (bs->type == V_ASN1_NEG_INTEGER)
bs->type == (2 | 0x100)Description
TRUEevaluated 19672 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 91040 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
19672-91040
262 if (BIO_write(bp, "-", 1) <= 0)
BIO_write(bp, "-", 1) <= 0Description
TRUEnever evaluated
FALSEevaluated 19672 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-19672
263 goto end;
never executed: goto end;
0
264 for (i = 0; i < bs->length; i++) {
i < bs->lengthDescription
TRUEevaluated 465734 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 110712 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
110712-465734
265 if (BIO_printf(bp, "%02X", bs->data[i]) <= 0)
BIO_printf(bp,...>data[i]) <= 0Description
TRUEnever evaluated
FALSEevaluated 465734 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-465734
266 goto end;
never executed: goto end;
0
267 }
executed 465734 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
465734
268 if (bs->length == 0) {
bs->length == 0Description
TRUEnever evaluated
FALSEevaluated 110712 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-110712
269 if (BIO_write(bp, "00", 2) <= 0)
BIO_write(bp, "00", 2) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
270 goto end;
never executed: goto end;
0
271 }
never executed: end of block
0
272 } else {
executed 110712 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
110712
273 if (BIO_puts(bp, ":BAD INTEGER") <= 0)
BIO_puts(bp, "...INTEGER") <= 0Description
TRUEnever evaluated
FALSEevaluated 4075 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4075
274 goto end;
never executed: goto end;
0
275 dump_cont = 1;-
276 }
executed 4075 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
4075
277 ASN1_INTEGER_free(bs);-
278 } else if (tag == V_ASN1_ENUMERATED) {
executed 114787 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
tag == 10Description
TRUEevaluated 3812 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 381544 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3812-381544
279 ASN1_ENUMERATED *bs;-
280 int i;-
281-
282 opp = op;-
283 bs = d2i_ASN1_ENUMERATED(NULL, &opp, len + hl);-
284 if (bs != NULL) {
bs != ((void *)0)Description
TRUEevaluated 3080 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 732 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
732-3080
285 if (BIO_write(bp, ":", 1) <= 0)
BIO_write(bp, ":", 1) <= 0Description
TRUEnever evaluated
FALSEevaluated 3080 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3080
286 goto end;
never executed: goto end;
0
287 if (bs->type == V_ASN1_NEG_ENUMERATED)
bs->type == (10 | 0x100)Description
TRUEevaluated 1907 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1173 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1173-1907
288 if (BIO_write(bp, "-", 1) <= 0)
BIO_write(bp, "-", 1) <= 0Description
TRUEnever evaluated
FALSEevaluated 1907 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1907
289 goto end;
never executed: goto end;
0
290 for (i = 0; i < bs->length; i++) {
i < bs->lengthDescription
TRUEevaluated 9706 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3080 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3080-9706
291 if (BIO_printf(bp, "%02X", bs->data[i]) <= 0)
BIO_printf(bp,...>data[i]) <= 0Description
TRUEnever evaluated
FALSEevaluated 9706 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9706
292 goto end;
never executed: goto end;
0
293 }
executed 9706 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
9706
294 if (bs->length == 0) {
bs->length == 0Description
TRUEnever evaluated
FALSEevaluated 3080 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3080
295 if (BIO_write(bp, "00", 2) <= 0)
BIO_write(bp, "00", 2) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
296 goto end;
never executed: goto end;
0
297 }
never executed: end of block
0
298 } else {
executed 3080 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
3080
299 if (BIO_puts(bp, ":BAD ENUMERATED") <= 0)
BIO_puts(bp, "...MERATED") <= 0Description
TRUEnever evaluated
FALSEevaluated 732 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-732
300 goto end;
never executed: goto end;
0
301 dump_cont = 1;-
302 }
executed 732 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
732
303 ASN1_ENUMERATED_free(bs);-
304 } else if (len > 0 && dump) {
executed 3812 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
len > 0Description
TRUEevaluated 74043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 307501 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
dumpDescription
TRUEnever evaluated
FALSEevaluated 74043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-307501
305 if (!nl) {
!nlDescription
TRUEnever evaluated
FALSEnever evaluated
0
306 if (BIO_write(bp, "\n", 1) <= 0)
BIO_write(bp, "\n", 1) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
307 goto end;
never executed: goto end;
0
308 }
never executed: end of block
0
309 if (BIO_dump_indent(bp, (const char *)p,
BIO_dump_inden...p_indent) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
310 ((dump == -1 || dump > len) ? len : dump),
BIO_dump_inden...p_indent) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
311 dump_indent) <= 0)
BIO_dump_inden...p_indent) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
312 goto end;
never executed: goto end;
0
313 nl = 1;-
314 }
never executed: end of block
0
315 if (dump_cont) {
dump_contDescription
TRUEevaluated 34139 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 882053 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
34139-882053
316 int i;-
317 const unsigned char *tmp = op + hl;-
318 if (BIO_puts(bp, ":[") <= 0)
BIO_puts(bp, ":[") <= 0Description
TRUEnever evaluated
FALSEevaluated 34139 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-34139
319 goto end;
never executed: goto end;
0
320 for (i = 0; i < len; i++) {
i < lenDescription
TRUEevaluated 604108 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 34139 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
34139-604108
321 if (BIO_printf(bp, "%02X", tmp[i]) <= 0)
BIO_printf(bp,..., tmp[i]) <= 0Description
TRUEnever evaluated
FALSEevaluated 604108 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-604108
322 goto end;
never executed: goto end;
0
323 }
executed 604108 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
604108
324 if (BIO_puts(bp, "]") <= 0)
BIO_puts(bp, "]") <= 0Description
TRUEnever evaluated
FALSEevaluated 34139 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-34139
325 goto end;
never executed: goto end;
0
326 }
executed 34139 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
34139
327-
328 if (!nl) {
!nlDescription
TRUEevaluated 916192 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-916192
329 if (BIO_write(bp, "\n", 1) <= 0)
BIO_write(bp, "\n", 1) <= 0Description
TRUEnever evaluated
FALSEevaluated 916192 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-916192
330 goto end;
never executed: goto end;
0
331 }
executed 916192 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
916192
332 p += len;-
333 if ((tag == V_ASN1_EOC) && (xclass == 0)) {
(tag == 0)Description
TRUEevaluated 301621 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 614571 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(xclass == 0)Description
TRUEevaluated 301621 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-614571
334 ret = 2; /* End of sequence */-
335 goto end;
executed 301621 times by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
301621
336 }-
337 }
executed 614571 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
614571
338 length -= len;-
339 }
executed 1120316 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1120316
340 ret = 1;-
341 end:
code before this statement executed 113398 times by 1 test: end:
Executed by:
  • libcrypto.so.1.1
113398
342 ASN1_OBJECT_free(o);-
343 ASN1_OCTET_STRING_free(os);-
344 *pp = p;-
345 return ret;
executed 422615 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
422615
346}-
347-
348const char *ASN1_tag2str(int tag)-
349{-
350 static const char *const tag2str[] = {-
351 /* 0-4 */-
352 "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING",-
353 /* 5-9 */-
354 "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL",-
355 /* 10-13 */-
356 "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>",-
357 /* 15-17 */-
358 "<ASN1 14>", "<ASN1 15>", "SEQUENCE", "SET",-
359 /* 18-20 */-
360 "NUMERICSTRING", "PRINTABLESTRING", "T61STRING",-
361 /* 21-24 */-
362 "VIDEOTEXSTRING", "IA5STRING", "UTCTIME", "GENERALIZEDTIME",-
363 /* 25-27 */-
364 "GRAPHICSTRING", "VISIBLESTRING", "GENERALSTRING",-
365 /* 28-30 */-
366 "UNIVERSALSTRING", "<ASN1 29>", "BMPSTRING"-
367 };-
368-
369 if ((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED))
(tag == (2 | 0x100))Description
TRUEevaluated 354 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1424723 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(tag == (10 | 0x100))Description
TRUEevaluated 616 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1424107 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
354-1424723
370 tag &= ~0x100;
executed 970 times by 1 test: tag &= ~0x100;
Executed by:
  • libcrypto.so.1.1
970
371-
372 if (tag < 0 || tag > 30)
tag < 0Description
TRUEevaluated 7955 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1417122 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
tag > 30Description
TRUEevaluated 250 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1416872 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
250-1417122
373 return "(unknown)";
executed 8205 times by 1 test: return "(unknown)";
Executed by:
  • libcrypto.so.1.1
8205
374 return tag2str[tag];
executed 1416872 times by 1 test: return tag2str[tag];
Executed by:
  • libcrypto.so.1.1
1416872
375}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2