| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509v3/v3_prn.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | static int unknown_ext_print(BIO *out, const unsigned char *ext, int extlen, | - | ||||||||||||
| 5 | unsigned long flag, int indent, int supported); | - | ||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | void X509V3_EXT_val_prn(BIO *out, struct stack_st_CONF_VALUE *val, int indent, | - | ||||||||||||
| 10 | int ml) | - | ||||||||||||
| 11 | { | - | ||||||||||||
| 12 | int i; | - | ||||||||||||
| 13 | CONF_VALUE *nval; | - | ||||||||||||
| 14 | if (!val
| 0-8662 | ||||||||||||
| 15 | return; never executed: return; | 0 | ||||||||||||
| 16 | if (!ml
| 562-6261 | ||||||||||||
| 17 | BIO_printf(out, "%*s", indent, ""); | - | ||||||||||||
| 18 | if (!sk_CONF_VALUE_num(val)
| 624-6199 | ||||||||||||
| 19 | BIO_puts(out, "<EMPTY>\n"); executed 624 times by 1 test: BIO_puts(out, "<EMPTY>\n");Executed by:
| 624 | ||||||||||||
| 20 | } executed 6823 times by 1 test: end of blockExecuted by:
| 6823 | ||||||||||||
| 21 | for (i = 0; i < sk_CONF_VALUE_num(val)
| 8662-16157 | ||||||||||||
| 22 | if (ml
| 2441-13716 | ||||||||||||
| 23 | BIO_printf(out, "%*s", indent, ""); executed 2441 times by 1 test: BIO_printf(out, "%*s", indent, "");Executed by:
| 2441 | ||||||||||||
| 24 | else if (i > 0
| 6199-7517 | ||||||||||||
| 25 | BIO_printf(out, ", "); executed 7517 times by 1 test: BIO_printf(out, ", ");Executed by:
| 7517 | ||||||||||||
| 26 | nval = sk_CONF_VALUE_value(val, i); | - | ||||||||||||
| 27 | if (!nval->name
| 2367-13790 | ||||||||||||
| 28 | BIO_puts(out, nval->value); executed 2367 times by 1 test: BIO_puts(out, nval->value);Executed by:
| 2367 | ||||||||||||
| 29 | else if (!nval->value
| 3247-10543 | ||||||||||||
| 30 | BIO_puts(out, nval->name); executed 3247 times by 1 test: BIO_puts(out, nval->name);Executed by:
| 3247 | ||||||||||||
| 31 | - | |||||||||||||
| 32 | else | - | ||||||||||||
| 33 | BIO_printf(out, "%s:%s", nval->name, nval->value); executed 10543 times by 1 test: BIO_printf(out, "%s:%s", nval->name, nval->value);Executed by:
| 10543 | ||||||||||||
| 34 | if (ml
| 2441-13716 | ||||||||||||
| 35 | BIO_puts(out, "\n"); executed 2441 times by 1 test: BIO_puts(out, "\n");Executed by:
| 2441 | ||||||||||||
| 36 | } executed 16157 times by 1 test: end of blockExecuted by:
| 16157 | ||||||||||||
| 37 | } executed 8662 times by 1 test: end of blockExecuted by:
| 8662 | ||||||||||||
| 38 | - | |||||||||||||
| 39 | - | |||||||||||||
| 40 | - | |||||||||||||
| 41 | int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, | - | ||||||||||||
| 42 | int indent) | - | ||||||||||||
| 43 | { | - | ||||||||||||
| 44 | void *ext_str = | - | ||||||||||||
| 45 | ((void *)0) | - | ||||||||||||
| 46 | ; | - | ||||||||||||
| 47 | char *value = | - | ||||||||||||
| 48 | ((void *)0) | - | ||||||||||||
| 49 | ; | - | ||||||||||||
| 50 | ASN1_OCTET_STRING *extoct; | - | ||||||||||||
| 51 | const unsigned char *p; | - | ||||||||||||
| 52 | int extlen; | - | ||||||||||||
| 53 | const X509V3_EXT_METHOD *method; | - | ||||||||||||
| 54 | struct stack_st_CONF_VALUE *nval = | - | ||||||||||||
| 55 | ((void *)0) | - | ||||||||||||
| 56 | ; | - | ||||||||||||
| 57 | int ok = 1; | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | extoct = X509_EXTENSION_get_data(ext); | - | ||||||||||||
| 60 | p = ASN1_STRING_get0_data(extoct); | - | ||||||||||||
| 61 | extlen = ASN1_STRING_length(extoct); | - | ||||||||||||
| 62 | - | |||||||||||||
| 63 | if ((
| 13699-85245 | ||||||||||||
| 64 | ((void *)0)
| 13699-85245 | ||||||||||||
| 65 | ) | - | ||||||||||||
| 66 | return executed 13699 times by 1 test: unknown_ext_print(out, p, extlen, flag, indent, 0);return unknown_ext_print(out, p, extlen, flag, indent, 0);Executed by:
executed 13699 times by 1 test: return unknown_ext_print(out, p, extlen, flag, indent, 0);Executed by:
| 13699 | ||||||||||||
| 67 | if (method->it
| 7233-78012 | ||||||||||||
| 68 | ext_str = ASN1_item_d2i( executed 78012 times by 1 test: ext_str = ASN1_item_d2i( ((void *)0) , &p, extlen, (method->it));Executed by:
| 78012 | ||||||||||||
| 69 | ((void *)0) executed 78012 times by 1 test: ext_str = ASN1_item_d2i( ((void *)0) , &p, extlen, (method->it));Executed by:
| 78012 | ||||||||||||
| 70 | , &p, extlen, (method->it)); executed 78012 times by 1 test: ext_str = ASN1_item_d2i( ((void *)0) , &p, extlen, (method->it));Executed by:
| 78012 | ||||||||||||
| 71 | else | - | ||||||||||||
| 72 | ext_str = method->d2i( executed 7233 times by 1 test: ext_str = method->d2i( ((void *)0) , &p, extlen);Executed by:
| 7233 | ||||||||||||
| 73 | ((void *)0) executed 7233 times by 1 test: ext_str = method->d2i( ((void *)0) , &p, extlen);Executed by:
| 7233 | ||||||||||||
| 74 | , &p, extlen); executed 7233 times by 1 test: ext_str = method->d2i( ((void *)0) , &p, extlen);Executed by:
| 7233 | ||||||||||||
| 75 | - | |||||||||||||
| 76 | if (!ext_str
| 38372-46873 | ||||||||||||
| 77 | return executed 38372 times by 1 test: unknown_ext_print(out, p, extlen, flag, indent, 1);return unknown_ext_print(out, p, extlen, flag, indent, 1);Executed by:
executed 38372 times by 1 test: return unknown_ext_print(out, p, extlen, flag, indent, 1);Executed by:
| 38372 | ||||||||||||
| 78 | - | |||||||||||||
| 79 | if (method->i2s
| 4536-42337 | ||||||||||||
| 80 | if ((
| 388-4148 | ||||||||||||
| 81 | ((void *)0)
| 388-4148 | ||||||||||||
| 82 | ) { | - | ||||||||||||
| 83 | ok = 0; | - | ||||||||||||
| 84 | goto executed 388 times by 1 test: err;goto err;Executed by:
executed 388 times by 1 test: goto err;Executed by:
| 388 | ||||||||||||
| 85 | } | - | ||||||||||||
| 86 | - | |||||||||||||
| 87 | BIO_printf(out, "%*s%s", indent, "", value); | - | ||||||||||||
| 88 | } executed 4148 times by 1 test: else if (method->i2vend of blockExecuted by:
| 4148-31622 | ||||||||||||
| 89 | if ((
| 2053-8662 | ||||||||||||
| 90 | ((void *)0)
| 2053-8662 | ||||||||||||
| 91 | )) ==
| 2053-8662 | ||||||||||||
| 92 | ((void *)0)
| 2053-8662 | ||||||||||||
| 93 | ) { | - | ||||||||||||
| 94 | ok = 0; | - | ||||||||||||
| 95 | goto executed 2053 times by 1 test: err;goto err;Executed by:
executed 2053 times by 1 test: goto err;Executed by:
| 2053 | ||||||||||||
| 96 | } | - | ||||||||||||
| 97 | X509V3_EXT_val_prn(out, nval, indent, | - | ||||||||||||
| 98 | method->ext_flags & 0x4); | - | ||||||||||||
| 99 | } executed 8662 times by 1 test: else if (method->i2rend of blockExecuted by:
| 0-31622 | ||||||||||||
| 100 | if (!method->i2r(method, ext_str, out, indent)
| 5762-25860 | ||||||||||||
| 101 | ok = 0; executed 5762 times by 1 test: ok = 0;Executed by:
| 5762 | ||||||||||||
| 102 | } executed 31622 times by 1 test: elseend of blockExecuted by:
| 31622 | ||||||||||||
| 103 | ok = 0; never executed: ok = 0; | 0 | ||||||||||||
| 104 | - | |||||||||||||
| 105 | err: code before this statement executed 44432 times by 1 test: err:Executed by:
| 44432 | ||||||||||||
| 106 | sk_CONF_VALUE_pop_free(nval, X509V3_conf_free); | - | ||||||||||||
| 107 | CRYPTO_free(value, __FILE__, 130); | - | ||||||||||||
| 108 | if (method->it
| 3605-43268 | ||||||||||||
| 109 | ASN1_item_free(ext_str, (method->it)); executed 43268 times by 1 test: ASN1_item_free(ext_str, (method->it));Executed by:
| 43268 | ||||||||||||
| 110 | else | - | ||||||||||||
| 111 | method->ext_free(ext_str); executed 3605 times by 1 test: method->ext_free(ext_str);Executed by:
| 3605 | ||||||||||||
| 112 | return executed 46873 times by 1 test: ok;return ok;Executed by:
executed 46873 times by 1 test: return ok;Executed by:
| 46873 | ||||||||||||
| 113 | } | - | ||||||||||||
| 114 | - | |||||||||||||
| 115 | int X509V3_extensions_print(BIO *bp, const char *title, | - | ||||||||||||
| 116 | const struct stack_st_X509_EXTENSION *exts, | - | ||||||||||||
| 117 | unsigned long flag, int indent) | - | ||||||||||||
| 118 | { | - | ||||||||||||
| 119 | int i, j; | - | ||||||||||||
| 120 | - | |||||||||||||
| 121 | if (sk_X509_EXTENSION_num(exts) <= 0
| 4338-7323 | ||||||||||||
| 122 | return executed 7323 times by 1 test: 1;return 1;Executed by:
executed 7323 times by 1 test: return 1;Executed by:
| 7323 | ||||||||||||
| 123 | - | |||||||||||||
| 124 | if (title
| 0-4338 | ||||||||||||
| 125 | BIO_printf(bp, "%*s%s:\n", indent, "", title); | - | ||||||||||||
| 126 | indent += 4; | - | ||||||||||||
| 127 | } executed 4338 times by 1 test: end of blockExecuted by:
| 4338 | ||||||||||||
| 128 | - | |||||||||||||
| 129 | for (i = 0; i < sk_X509_EXTENSION_num(exts)
| 4338-82948 | ||||||||||||
| 130 | ASN1_OBJECT *obj; | - | ||||||||||||
| 131 | X509_EXTENSION *ex; | - | ||||||||||||
| 132 | ex = sk_X509_EXTENSION_value(exts, i); | - | ||||||||||||
| 133 | if (indent
| 0-82948 | ||||||||||||
| 134 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 135 | obj = X509_EXTENSION_get_object(ex); | - | ||||||||||||
| 136 | i2a_ASN1_OBJECT(bp, obj); | - | ||||||||||||
| 137 | j = X509_EXTENSION_get_critical(ex); | - | ||||||||||||
| 138 | if (BIO_printf(bp, ": %s\n", j ? "critical" : "") <= 0
| 0-82948 | ||||||||||||
| 139 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 140 | if (!X509V3_EXT_print(bp, ex, flag, indent + 4)
| 28375-54573 | ||||||||||||
| 141 | BIO_printf(bp, "%*s", indent + 4, ""); | - | ||||||||||||
| 142 | ASN1_STRING_print(bp, X509_EXTENSION_get_data(ex)); | - | ||||||||||||
| 143 | } executed 54573 times by 1 test: end of blockExecuted by:
| 54573 | ||||||||||||
| 144 | if (BIO_write(bp, "\n", 1) <= 0
| 0-82948 | ||||||||||||
| 145 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 146 | } executed 82948 times by 1 test: end of blockExecuted by:
| 82948 | ||||||||||||
| 147 | return executed 4338 times by 1 test: 1;return 1;Executed by:
executed 4338 times by 1 test: return 1;Executed by:
| 4338 | ||||||||||||
| 148 | } | - | ||||||||||||
| 149 | - | |||||||||||||
| 150 | static int unknown_ext_print(BIO *out, const unsigned char *ext, int extlen, | - | ||||||||||||
| 151 | unsigned long flag, int indent, int supported) | - | ||||||||||||
| 152 | { | - | ||||||||||||
| 153 | switch (flag & (0xfL << 16)) { | - | ||||||||||||
| 154 | - | |||||||||||||
| 155 | case executed 52071 times by 1 test: 0:case 0:Executed by:
executed 52071 times by 1 test: case 0:Executed by:
| 52071 | ||||||||||||
| 156 | return executed 52071 times by 1 test: 0;return 0;Executed by:
executed 52071 times by 1 test: return 0;Executed by:
| 52071 | ||||||||||||
| 157 | - | |||||||||||||
| 158 | case never executed: (1L << 16):case (1L << 16):never executed: case (1L << 16): | 0 | ||||||||||||
| 159 | if (supported
| 0 | ||||||||||||
| 160 | BIO_printf(out, "%*s<Parse Error>", indent, ""); never executed: BIO_printf(out, "%*s<Parse Error>", indent, ""); | 0 | ||||||||||||
| 161 | else | - | ||||||||||||
| 162 | BIO_printf(out, "%*s<Not Supported>", indent, ""); never executed: BIO_printf(out, "%*s<Not Supported>", indent, ""); | 0 | ||||||||||||
| 163 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 164 | - | |||||||||||||
| 165 | case never executed: (2L << 16):case (2L << 16):never executed: case (2L << 16): | 0 | ||||||||||||
| 166 | return never executed: ASN1_parse_dump(out, ext, extlen, indent, -1);return ASN1_parse_dump(out, ext, extlen, indent, -1);never executed: return ASN1_parse_dump(out, ext, extlen, indent, -1); | 0 | ||||||||||||
| 167 | case never executed: (3L << 16):case (3L << 16):never executed: case (3L << 16): | 0 | ||||||||||||
| 168 | return never executed: BIO_dump_indent(out, (const char *)ext, extlen, indent);return BIO_dump_indent(out, (const char *)ext, extlen, indent);never executed: return BIO_dump_indent(out, (const char *)ext, extlen, indent); | 0 | ||||||||||||
| 169 | - | |||||||||||||
| 170 | default never executed: :default:never executed: default: | 0 | ||||||||||||
| 171 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||
| 172 | } | - | ||||||||||||
| 173 | } | - | ||||||||||||
| 174 | - | |||||||||||||
| 175 | - | |||||||||||||
| 176 | int X509V3_EXT_print_fp(FILE *fp, X509_EXTENSION *ext, int flag, int indent) | - | ||||||||||||
| 177 | { | - | ||||||||||||
| 178 | BIO *bio_tmp; | - | ||||||||||||
| 179 | int ret; | - | ||||||||||||
| 180 | - | |||||||||||||
| 181 | if ((
| 0 | ||||||||||||
| 182 | ((void *)0)
| 0 | ||||||||||||
| 183 | ) | - | ||||||||||||
| 184 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 185 | ret = X509V3_EXT_print(bio_tmp, ext, flag, indent); | - | ||||||||||||
| 186 | BIO_free(bio_tmp); | - | ||||||||||||
| 187 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||
| 188 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |