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