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