| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/tasn_dec.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, | - | ||||||||||||||||||||||||
| 2 | long len, const ASN1_ITEM *it, | - | ||||||||||||||||||||||||
| 3 | int tag, int aclass, char opt, ASN1_TLC *ctx, | - | ||||||||||||||||||||||||
| 4 | int depth); | - | ||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | static int asn1_check_eoc(const unsigned char **in, long len); | - | ||||||||||||||||||||||||
| 7 | static int asn1_find_end(const unsigned char **in, long len, char inf); | - | ||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | static int asn1_collect(BUF_MEM *buf, const unsigned char **in, long len, | - | ||||||||||||||||||||||||
| 10 | char inf, int tag, int aclass, int depth); | - | ||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | static int collect_data(BUF_MEM *buf, const unsigned char **p, long plen); | - | ||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, | - | ||||||||||||||||||||||||
| 15 | char *inf, char *cst, | - | ||||||||||||||||||||||||
| 16 | const unsigned char **in, long len, | - | ||||||||||||||||||||||||
| 17 | int exptag, int expclass, char opt, ASN1_TLC *ctx); | - | ||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||
| 19 | static int asn1_template_ex_d2i(ASN1_VALUE **pval, | - | ||||||||||||||||||||||||
| 20 | const unsigned char **in, long len, | - | ||||||||||||||||||||||||
| 21 | const ASN1_TEMPLATE *tt, char opt, | - | ||||||||||||||||||||||||
| 22 | ASN1_TLC *ctx, int depth); | - | ||||||||||||||||||||||||
| 23 | static int asn1_template_noexp_d2i(ASN1_VALUE **val, | - | ||||||||||||||||||||||||
| 24 | const unsigned char **in, long len, | - | ||||||||||||||||||||||||
| 25 | const ASN1_TEMPLATE *tt, char opt, | - | ||||||||||||||||||||||||
| 26 | ASN1_TLC *ctx, int depth); | - | ||||||||||||||||||||||||
| 27 | static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, | - | ||||||||||||||||||||||||
| 28 | const unsigned char **in, long len, | - | ||||||||||||||||||||||||
| 29 | const ASN1_ITEM *it, | - | ||||||||||||||||||||||||
| 30 | int tag, int aclass, char opt, | - | ||||||||||||||||||||||||
| 31 | ASN1_TLC *ctx); | - | ||||||||||||||||||||||||
| 32 | static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, | - | ||||||||||||||||||||||||
| 33 | int utype, char *free_cont, const ASN1_ITEM *it); | - | ||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | static const unsigned long tag2bit[32] = { | - | ||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||
| 38 | 0, 0, 0, 0x0400, | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | 0x0200, 0, 0, 0x1000, | - | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | 0x1000, 0x1000, 0x1000, 0x1000, | - | ||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||
| 44 | 0x2000, 0x1000, 0x1000, 0x1000, | - | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | 0x10000, 0, 0x0001, 0x0002, | - | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | 0x0004, 0x0008, 0x0010, | - | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | 0x4000, 0x8000, | - | ||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||
| 52 | 0x0020, 0x0040, 0x0080, | - | ||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | 0x0100, 0x1000, 0x0800, 0x1000, | - | ||||||||||||||||||||||||
| 55 | }; | - | ||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | unsigned long ASN1_tag2bit(int tag) | - | ||||||||||||||||||||||||
| 58 | { | - | ||||||||||||||||||||||||
| 59 | if ((
| 0-426869 | ||||||||||||||||||||||||
| 60 | return executed 5655 times by 1 test: 0;return 0;Executed by:
executed 5655 times by 1 test: return 0;Executed by:
| 5655 | ||||||||||||||||||||||||
| 61 | return executed 421214 times by 1 test: tag2bit[tag];return tag2bit[tag];Executed by:
executed 421214 times by 1 test: return tag2bit[tag];Executed by:
| 421214 | ||||||||||||||||||||||||
| 62 | } | - | ||||||||||||||||||||||||
| 63 | ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, | - | ||||||||||||||||||||||||
| 64 | const unsigned char **in, long len, | - | ||||||||||||||||||||||||
| 65 | const ASN1_ITEM *it) | - | ||||||||||||||||||||||||
| 66 | { | - | ||||||||||||||||||||||||
| 67 | ASN1_TLC c; | - | ||||||||||||||||||||||||
| 68 | ASN1_VALUE *ptmpval = | - | ||||||||||||||||||||||||
| 69 | ((void *)0) | - | ||||||||||||||||||||||||
| 70 | ; | - | ||||||||||||||||||||||||
| 71 | if (!pval
| 9281-1044253 | ||||||||||||||||||||||||
| 72 | pval = &ptmpval; executed 1044253 times by 2 tests: pval = &ptmpval;Executed by:
| 1044253 | ||||||||||||||||||||||||
| 73 | (&c)->valid = 0; | - | ||||||||||||||||||||||||
| 74 | if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0
| 440372-613162 | ||||||||||||||||||||||||
| 75 | return executed 440372 times by 2 tests: *pval;return *pval;Executed by:
executed 440372 times by 2 tests: return *pval;Executed by:
| 440372 | ||||||||||||||||||||||||
| 76 | return executed 613162 times by 1 test: return ((void *)0) ;Executed by:
executed 613162 times by 1 test: return ((void *)0) ;Executed by:
| 613162 | ||||||||||||||||||||||||
| 77 | ((void *)0) executed 613162 times by 1 test: return ((void *)0) ;Executed by:
| 613162 | ||||||||||||||||||||||||
| 78 | ; executed 613162 times by 1 test: return ((void *)0) ;Executed by:
| 613162 | ||||||||||||||||||||||||
| 79 | } | - | ||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | - | ||||||||||||||||||||||||
| 82 | const ASN1_ITEM *it, | - | ||||||||||||||||||||||||
| 83 | int tag, int aclass, char opt, ASN1_TLC *ctx) | - | ||||||||||||||||||||||||
| 84 | { | - | ||||||||||||||||||||||||
| 85 | int rv; | - | ||||||||||||||||||||||||
| 86 | rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0); | - | ||||||||||||||||||||||||
| 87 | if (rv <= 0
| 564053-628266 | ||||||||||||||||||||||||
| 88 | ASN1_item_ex_free(pval, it); executed 628266 times by 1 test: ASN1_item_ex_free(pval, it);Executed by:
| 628266 | ||||||||||||||||||||||||
| 89 | return executed 1192319 times by 2 tests: rv;return rv;Executed by:
executed 1192319 times by 2 tests: return rv;Executed by:
| 1192319 | ||||||||||||||||||||||||
| 90 | } | - | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, | - | ||||||||||||||||||||||||
| 98 | long len, const ASN1_ITEM *it, | - | ||||||||||||||||||||||||
| 99 | int tag, int aclass, char opt, ASN1_TLC *ctx, | - | ||||||||||||||||||||||||
| 100 | int depth) | - | ||||||||||||||||||||||||
| 101 | { | - | ||||||||||||||||||||||||
| 102 | const ASN1_TEMPLATE *tt, *errtt = | - | ||||||||||||||||||||||||
| 103 | ((void *)0) | - | ||||||||||||||||||||||||
| 104 | ; | - | ||||||||||||||||||||||||
| 105 | const ASN1_EXTERN_FUNCS *ef; | - | ||||||||||||||||||||||||
| 106 | const ASN1_AUX *aux = it->funcs; | - | ||||||||||||||||||||||||
| 107 | ASN1_aux_cb *asn1_cb; | - | ||||||||||||||||||||||||
| 108 | const unsigned char *p = | - | ||||||||||||||||||||||||
| 109 | ((void *)0) | - | ||||||||||||||||||||||||
| 110 | , *q; | - | ||||||||||||||||||||||||
| 111 | unsigned char oclass; | - | ||||||||||||||||||||||||
| 112 | char seq_eoc, seq_nolen, cst, isopt; | - | ||||||||||||||||||||||||
| 113 | long tmplen; | - | ||||||||||||||||||||||||
| 114 | int i; | - | ||||||||||||||||||||||||
| 115 | int otag; | - | ||||||||||||||||||||||||
| 116 | int ret = 0; | - | ||||||||||||||||||||||||
| 117 | ASN1_VALUE **pchptr; | - | ||||||||||||||||||||||||
| 118 | if (!pval
| 0-5388010 | ||||||||||||||||||||||||
| 119 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 120 | if (aux
| 184708-4625934 | ||||||||||||||||||||||||
| 121 | asn1_cb = aux->asn1_cb; executed 577368 times by 2 tests: asn1_cb = aux->asn1_cb;Executed by:
| 577368 | ||||||||||||||||||||||||
| 122 | else | - | ||||||||||||||||||||||||
| 123 | asn1_cb = 0; executed 4810642 times by 2 tests: asn1_cb = 0;Executed by:
| 4810642 | ||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | if (++
| 1-5388009 | ||||||||||||||||||||||||
| 126 | ERR_put_error(13,(120),(201),__FILE__,160); | - | ||||||||||||||||||||||||
| 127 | goto executed 1 time by 1 test: err;goto err;Executed by:
executed 1 time by 1 test: goto err;Executed by:
| 1 | ||||||||||||||||||||||||
| 128 | } | - | ||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||
| 130 | switch (it->itype) { | - | ||||||||||||||||||||||||
| 131 | case executed 3075763 times by 2 tests: 0x0:case 0x0:Executed by:
executed 3075763 times by 2 tests: case 0x0:Executed by:
| 3075763 | ||||||||||||||||||||||||
| 132 | if (it->templates
| 333662-2742101 | ||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | if ((
| 0-333662 | ||||||||||||||||||||||||
| 140 | ERR_put_error(13,(120),(170),__FILE__,175) | - | ||||||||||||||||||||||||
| 141 | ; | - | ||||||||||||||||||||||||
| 142 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 143 | } | - | ||||||||||||||||||||||||
| 144 | return executed 333662 times by 1 test: asn1_template_ex_d2i(pval, in, len,return asn1_template_ex_d2i(pval, in, len, it->templates, opt, ctx, depth);Executed by:
executed 333662 times by 1 test: return asn1_template_ex_d2i(pval, in, len, it->templates, opt, ctx, depth);Executed by:
| 333662 | ||||||||||||||||||||||||
| 145 | it->templates, opt, ctx, depth); executed 333662 times by 1 test: return asn1_template_ex_d2i(pval, in, len, it->templates, opt, ctx, depth);Executed by:
| 333662 | ||||||||||||||||||||||||
| 146 | } | - | ||||||||||||||||||||||||
| 147 | return executed 2742101 times by 2 tests: asn1_d2i_ex_primitive(pval, in, len, it,return asn1_d2i_ex_primitive(pval, in, len, it, tag, aclass, opt, ctx);Executed by:
executed 2742101 times by 2 tests: return asn1_d2i_ex_primitive(pval, in, len, it, tag, aclass, opt, ctx);Executed by:
| 2742101 | ||||||||||||||||||||||||
| 148 | tag, aclass, opt, ctx); executed 2742101 times by 2 tests: return asn1_d2i_ex_primitive(pval, in, len, it, tag, aclass, opt, ctx);Executed by:
| 2742101 | ||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | case executed 338797 times by 1 test: 0x5:case 0x5:Executed by:
executed 338797 times by 1 test: case 0x5:Executed by:
| 338797 | ||||||||||||||||||||||||
| 151 | p = *in; | - | ||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | ret = asn1_check_tlen( | - | ||||||||||||||||||||||||
| 154 | ((void *)0) | - | ||||||||||||||||||||||||
| 155 | , &otag, &oclass, | - | ||||||||||||||||||||||||
| 156 | ((void *)0) | - | ||||||||||||||||||||||||
| 157 | , | - | ||||||||||||||||||||||||
| 158 | ((void *)0) | - | ||||||||||||||||||||||||
| 159 | , | - | ||||||||||||||||||||||||
| 160 | &p, len, -1, 0, 1, ctx); | - | ||||||||||||||||||||||||
| 161 | if (!ret
| 1986-336811 | ||||||||||||||||||||||||
| 162 | ERR_put_error(13,(120),(58),__FILE__,190); | - | ||||||||||||||||||||||||
| 163 | goto executed 1986 times by 1 test: err;goto err;Executed by:
executed 1986 times by 1 test: goto err;Executed by:
| 1986 | ||||||||||||||||||||||||
| 164 | } | - | ||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||
| 166 | - | |||||||||||||||||||||||||
| 167 | if (oclass != 0x00
| 30143-306668 | ||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||
| 169 | if (opt
| 2717-27426 | ||||||||||||||||||||||||
| 170 | return executed 27426 times by 1 test: -1;return -1;Executed by:
executed 27426 times by 1 test: return -1;Executed by:
| 27426 | ||||||||||||||||||||||||
| 171 | ERR_put_error(13,(120),(139),__FILE__,199); | - | ||||||||||||||||||||||||
| 172 | goto executed 2717 times by 1 test: err;goto err;Executed by:
executed 2717 times by 1 test: goto err;Executed by:
| 2717 | ||||||||||||||||||||||||
| 173 | } | - | ||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||
| 175 | if (!(ASN1_tag2bit(otag) & it->utype)
| 29666-277002 | ||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||
| 177 | if (opt
| 6116-23550 | ||||||||||||||||||||||||
| 178 | return executed 6116 times by 1 test: -1;return -1;Executed by:
executed 6116 times by 1 test: return -1;Executed by:
| 6116 | ||||||||||||||||||||||||
| 179 | ERR_put_error(13,(120),(140),__FILE__,207); | - | ||||||||||||||||||||||||
| 180 | goto executed 23550 times by 1 test: err;goto err;Executed by:
executed 23550 times by 1 test: goto err;Executed by:
| 23550 | ||||||||||||||||||||||||
| 181 | } | - | ||||||||||||||||||||||||
| 182 | return executed 277002 times by 1 test: asn1_d2i_ex_primitive(pval, in, len, it, otag, 0, 0, ctx);return asn1_d2i_ex_primitive(pval, in, len, it, otag, 0, 0, ctx);Executed by:
executed 277002 times by 1 test: return asn1_d2i_ex_primitive(pval, in, len, it, otag, 0, 0, ctx);Executed by:
| 277002 | ||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | case executed 138785 times by 1 test: 0x4:case 0x4:Executed by:
executed 138785 times by 1 test: case 0x4:Executed by:
| 138785 | ||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||
| 186 | ef = it->funcs; | - | ||||||||||||||||||||||||
| 187 | return executed 138785 times by 1 test: ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);return ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);Executed by:
executed 138785 times by 1 test: return ef->asn1_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx);Executed by:
| 138785 | ||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | case executed 207436 times by 1 test: 0x2:case 0x2:Executed by:
executed 207436 times by 1 test: case 0x2:Executed by:
| 207436 | ||||||||||||||||||||||||
| 190 | if (asn1_cb
| 0-174888 | ||||||||||||||||||||||||
| 191 | ((void *)0)
| 0-32548 | ||||||||||||||||||||||||
| 192 | )
| 0-32548 | ||||||||||||||||||||||||
| 193 | goto never executed: auxerr;goto auxerr;never executed: goto auxerr; | 0 | ||||||||||||||||||||||||
| 194 | if (*
| 22129-185307 | ||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||
| 196 | i = asn1_get_choice_selector(pval, it); | - | ||||||||||||||||||||||||
| 197 | if ((
| 0-22129 | ||||||||||||||||||||||||
| 198 | tt = it->templates + i; | - | ||||||||||||||||||||||||
| 199 | pchptr = asn1_get_field_ptr(pval, tt); | - | ||||||||||||||||||||||||
| 200 | asn1_template_free(pchptr, tt); | - | ||||||||||||||||||||||||
| 201 | asn1_set_choice_selector(pval, -1, it); | - | ||||||||||||||||||||||||
| 202 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 203 | } executed 22129 times by 1 test: else if (!ASN1_item_ex_new(pval, it)end of blockExecuted by:
| 0-185307 | ||||||||||||||||||||||||
| 204 | ERR_put_error(13,(120),(58),__FILE__,230); | - | ||||||||||||||||||||||||
| 205 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 206 | } | - | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | p = *in; | - | ||||||||||||||||||||||||
| 209 | for (i = 0, tt = it->templates; i < it->tcount
| 31535-643268 | ||||||||||||||||||||||||
| 210 | pchptr = asn1_get_field_ptr(pval, tt); | - | ||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx, depth); | - | ||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | if (ret == -1
| 175901-467367 | ||||||||||||||||||||||||
| 217 | continue; executed 467367 times by 1 test: continue;Executed by:
| 467367 | ||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | if (ret > 0
| 47727-128174 | ||||||||||||||||||||||||
| 220 | break; executed 128174 times by 1 test: break;Executed by:
| 128174 | ||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||
| 225 | asn1_template_free(pchptr, tt); | - | ||||||||||||||||||||||||
| 226 | errtt = tt; | - | ||||||||||||||||||||||||
| 227 | ERR_put_error(13,(120),(58),__FILE__,253); | - | ||||||||||||||||||||||||
| 228 | goto executed 47727 times by 1 test: err;goto err;Executed by:
executed 47727 times by 1 test: goto err;Executed by:
| 47727 | ||||||||||||||||||||||||
| 229 | } | - | ||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | - | |||||||||||||||||||||||||
| 232 | if (i == it->tcount
| 31535-128174 | ||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||
| 234 | if (opt
| 1086-30449 | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | ASN1_item_ex_free(pval, it); | - | ||||||||||||||||||||||||
| 237 | return executed 1086 times by 1 test: -1;return -1;Executed by:
executed 1086 times by 1 test: return -1;Executed by:
| 1086 | ||||||||||||||||||||||||
| 238 | } | - | ||||||||||||||||||||||||
| 239 | ERR_put_error(13,(120),(143),__FILE__,265); | - | ||||||||||||||||||||||||
| 240 | goto executed 30449 times by 1 test: err;goto err;Executed by:
executed 30449 times by 1 test: goto err;Executed by:
| 30449 | ||||||||||||||||||||||||
| 241 | } | - | ||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||
| 243 | asn1_set_choice_selector(pval, i, it); | - | ||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| 245 | if (asn1_cb
| 0-103358 | ||||||||||||||||||||||||
| 246 | ((void *)0)
| 0-24816 | ||||||||||||||||||||||||
| 247 | )
| 0-24816 | ||||||||||||||||||||||||
| 248 | goto never executed: auxerr;goto auxerr;never executed: goto auxerr; | 0 | ||||||||||||||||||||||||
| 249 | *in = p; | - | ||||||||||||||||||||||||
| 250 | return executed 128174 times by 1 test: 1;return 1;Executed by:
executed 128174 times by 1 test: return 1;Executed by:
| 128174 | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | case executed 40257 times by 1 test: 0x6:case 0x6:Executed by:
executed 40257 times by 1 test: case 0x6:Executed by:
| 40257 | ||||||||||||||||||||||||
| 253 | case executed 1586971 times by 2 tests: 0x1:case 0x1:Executed by:
executed 1586971 times by 2 tests: case 0x1:Executed by:
| 1586971 | ||||||||||||||||||||||||
| 254 | p = *in; | - | ||||||||||||||||||||||||
| 255 | tmplen = len; | - | ||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | if (tag == -1
| 159033-1468195 | ||||||||||||||||||||||||
| 259 | tag = 16; | - | ||||||||||||||||||||||||
| 260 | aclass = 0x00; | - | ||||||||||||||||||||||||
| 261 | } executed 1468195 times by 2 tests: end of blockExecuted by:
| 1468195 | ||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | ret = asn1_check_tlen(&len, | - | ||||||||||||||||||||||||
| 264 | ((void *)0) | - | ||||||||||||||||||||||||
| 265 | , | - | ||||||||||||||||||||||||
| 266 | ((void *)0) | - | ||||||||||||||||||||||||
| 267 | , &seq_eoc, &cst, | - | ||||||||||||||||||||||||
| 268 | &p, len, tag, aclass, opt, ctx); | - | ||||||||||||||||||||||||
| 269 | if (!ret
| 119024-1508204 | ||||||||||||||||||||||||
| 270 | ERR_put_error(13,(120),(58),__FILE__,290); | - | ||||||||||||||||||||||||
| 271 | goto executed 119024 times by 1 test: err;goto err;Executed by:
executed 119024 times by 1 test: goto err;Executed by:
| 119024 | ||||||||||||||||||||||||
| 272 | } else if (ret == -1
| 158106-1350098 | ||||||||||||||||||||||||
| 273 | return executed 158106 times by 1 test: -1;return -1;Executed by:
executed 158106 times by 1 test: return -1;Executed by:
| 158106 | ||||||||||||||||||||||||
| 274 | if (aux
| 0-1040613 | ||||||||||||||||||||||||
| 275 | len = tmplen - (p - *in); | - | ||||||||||||||||||||||||
| 276 | seq_nolen = 1; | - | ||||||||||||||||||||||||
| 277 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||
| 279 | else | - | ||||||||||||||||||||||||
| 280 | seq_nolen = seq_eoc; executed 1350098 times by 2 tests: seq_nolen = seq_eoc;Executed by:
| 1350098 | ||||||||||||||||||||||||
| 281 | if (!cst
| 7603-1342495 | ||||||||||||||||||||||||
| 282 | ERR_put_error(13,(120),(149),__FILE__,302); | - | ||||||||||||||||||||||||
| 283 | goto executed 7603 times by 1 test: err;goto err;Executed by:
executed 7603 times by 1 test: goto err;Executed by:
| 7603 | ||||||||||||||||||||||||
| 284 | } | - | ||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||
| 286 | if (!*pval
| 0-966645 | ||||||||||||||||||||||||
| 287 | ERR_put_error(13,(120),(58),__FILE__,307); | - | ||||||||||||||||||||||||
| 288 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 289 | } | - | ||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | if (asn1_cb
| 0-1077287 | ||||||||||||||||||||||||
| 292 | ((void *)0)
| 0-265208 | ||||||||||||||||||||||||
| 293 | )
| 0-265208 | ||||||||||||||||||||||||
| 294 | goto never executed: auxerr;goto auxerr;never executed: goto auxerr; | 0 | ||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | for (i = 0, tt = it->templates; i < it->tcount
| 1342495-4249393 | ||||||||||||||||||||||||
| 298 | if (tt->flags & (0x3<<8)
| 29687-4219706 | ||||||||||||||||||||||||
| 299 | const ASN1_TEMPLATE *seqtt; | - | ||||||||||||||||||||||||
| 300 | ASN1_VALUE **pseqval; | - | ||||||||||||||||||||||||
| 301 | seqtt = asn1_do_adb(pval, tt, 0); | - | ||||||||||||||||||||||||
| 302 | if (seqtt ==
| 7441-22246 | ||||||||||||||||||||||||
| 303 | ((void *)0)
| 7441-22246 | ||||||||||||||||||||||||
| 304 | ) | - | ||||||||||||||||||||||||
| 305 | continue; executed 22246 times by 1 test: continue;Executed by:
| 22246 | ||||||||||||||||||||||||
| 306 | pseqval = asn1_get_field_ptr(pval, seqtt); | - | ||||||||||||||||||||||||
| 307 | asn1_template_free(pseqval, seqtt); | - | ||||||||||||||||||||||||
| 308 | } executed 7441 times by 1 test: end of blockExecuted by:
| 7441 | ||||||||||||||||||||||||
| 309 | } executed 4227147 times by 2 tests: end of blockExecuted by:
| 4227147 | ||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||
| 312 | for (i = 0, tt = it->templates; i < it->tcount
| 745538-3364357 | ||||||||||||||||||||||||
| 313 | const ASN1_TEMPLATE *seqtt; | - | ||||||||||||||||||||||||
| 314 | ASN1_VALUE **pseqval; | - | ||||||||||||||||||||||||
| 315 | seqtt = asn1_do_adb(pval, tt, 1); | - | ||||||||||||||||||||||||
| 316 | if (seqtt ==
| 0-3364357 | ||||||||||||||||||||||||
| 317 | ((void *)0)
| 0-3364357 | ||||||||||||||||||||||||
| 318 | ) | - | ||||||||||||||||||||||||
| 319 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 320 | pseqval = asn1_get_field_ptr(pval, seqtt); | - | ||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||
| 322 | if (!len
| 78309-3286048 | ||||||||||||||||||||||||
| 323 | break; executed 78309 times by 1 test: break;Executed by:
| 78309 | ||||||||||||||||||||||||
| 324 | q = p; | - | ||||||||||||||||||||||||
| 325 | if (asn1_check_eoc(&p, len)
| 139562-3146486 | ||||||||||||||||||||||||
| 326 | if (!seq_eoc
| 1023-138539 | ||||||||||||||||||||||||
| 327 | ERR_put_error(13,(120),(159),__FILE__,341); | - | ||||||||||||||||||||||||
| 328 | goto executed 1023 times by 1 test: err;goto err;Executed by:
executed 1023 times by 1 test: goto err;Executed by:
| 1023 | ||||||||||||||||||||||||
| 329 | } | - | ||||||||||||||||||||||||
| 330 | len -= p - q; | - | ||||||||||||||||||||||||
| 331 | seq_eoc = 0; | - | ||||||||||||||||||||||||
| 332 | q = p; | - | ||||||||||||||||||||||||
| 333 | break; executed 138539 times by 1 test: break;Executed by:
| 138539 | ||||||||||||||||||||||||
| 334 | } | - | ||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||
| 341 | if (i == (it->tcount - 1)
| 827565-2318921 | ||||||||||||||||||||||||
| 342 | isopt = 0; executed 827565 times by 2 tests: isopt = 0;Executed by:
| 827565 | ||||||||||||||||||||||||
| 343 | else | - | ||||||||||||||||||||||||
| 344 | isopt = (char)(seqtt->flags & (0x1)); executed 2318921 times by 2 tests: isopt = (char)(seqtt->flags & (0x1));Executed by:
| 2318921 | ||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||
| 349 | ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx, | - | ||||||||||||||||||||||||
| 350 | depth); | - | ||||||||||||||||||||||||
| 351 | if (!ret
| 379086-2767400 | ||||||||||||||||||||||||
| 352 | errtt = seqtt; | - | ||||||||||||||||||||||||
| 353 | goto executed 379086 times by 1 test: err;goto err;Executed by:
executed 379086 times by 1 test: goto err;Executed by:
| 379086 | ||||||||||||||||||||||||
| 354 | } else if (ret == -1
| 516782-2250618 | ||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | asn1_template_free(pseqval, seqtt); | - | ||||||||||||||||||||||||
| 359 | continue; executed 516782 times by 1 test: continue;Executed by:
| 516782 | ||||||||||||||||||||||||
| 360 | } | - | ||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | len -= p - q; | - | ||||||||||||||||||||||||
| 363 | } executed 2250618 times by 2 tests: end of blockExecuted by:
| 2250618 | ||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | if (seq_eoc
| 6416-629389 | ||||||||||||||||||||||||
| 367 | ERR_put_error(13,(120),(137),__FILE__,381); | - | ||||||||||||||||||||||||
| 368 | goto executed 6416 times by 1 test: err;goto err;Executed by:
executed 6416 times by 1 test: goto err;Executed by:
| 6416 | ||||||||||||||||||||||||
| 369 | } | - | ||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||
| 371 | if (!seq_nolen
| 1118-490850 | ||||||||||||||||||||||||
| 372 | ERR_put_error(13,(120),(148),__FILE__,386); | - | ||||||||||||||||||||||||
| 373 | goto executed 1118 times by 1 test: err;goto err;Executed by:
executed 1118 times by 1 test: goto err;Executed by:
| 1118 | ||||||||||||||||||||||||
| 374 | } | - | ||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||
| 381 | for (; i < it->tcount
| 370403-951963 | ||||||||||||||||||||||||
| 382 | const ASN1_TEMPLATE *seqtt; | - | ||||||||||||||||||||||||
| 383 | seqtt = asn1_do_adb(pval, tt, 1); | - | ||||||||||||||||||||||||
| 384 | if (seqtt ==
| 0-370403 | ||||||||||||||||||||||||
| 385 | ((void *)0)
| 0-370403 | ||||||||||||||||||||||||
| 386 | ) | - | ||||||||||||||||||||||||
| 387 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 388 | if (seqtt->flags & (0x1)
| 2889-367514 | ||||||||||||||||||||||||
| 389 | ASN1_VALUE **pseqval; | - | ||||||||||||||||||||||||
| 390 | pseqval = asn1_get_field_ptr(pval, seqtt); | - | ||||||||||||||||||||||||
| 391 | asn1_template_free(pseqval, seqtt); | - | ||||||||||||||||||||||||
| 392 | } executed 367514 times by 1 test: else {end of blockExecuted by:
| 367514 | ||||||||||||||||||||||||
| 393 | errtt = seqtt; | - | ||||||||||||||||||||||||
| 394 | ERR_put_error(13,(120),(121),__FILE__,406); | - | ||||||||||||||||||||||||
| 395 | goto executed 2889 times by 1 test: err;goto err;Executed by:
executed 2889 times by 1 test: goto err;Executed by:
| 2889 | ||||||||||||||||||||||||
| 396 | } | - | ||||||||||||||||||||||||
| 397 | } | - | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | if (!asn1_enc_save(pval, *in, p - *in, it)
| 0-951963 | ||||||||||||||||||||||||
| 400 | goto never executed: auxerr;goto auxerr;never executed: goto auxerr; | 0 | ||||||||||||||||||||||||
| 401 | if (asn1_cb
| 8-764894 | ||||||||||||||||||||||||
| 402 | ((void *)0)
| 8-187061 | ||||||||||||||||||||||||
| 403 | )
| 8-187061 | ||||||||||||||||||||||||
| 404 | goto executed 8 times by 1 test: auxerr;goto auxerr;Executed by:
executed 8 times by 1 test: goto auxerr;Executed by:
| 8 | ||||||||||||||||||||||||
| 405 | *in = p; | - | ||||||||||||||||||||||||
| 406 | return executed 951955 times by 2 tests: 1;return 1;Executed by:
executed 951955 times by 2 tests: return 1;Executed by:
| 951955 | ||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||
| 408 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 409 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 410 | } | - | ||||||||||||||||||||||||
| 411 | auxerr: code before this statement never executed: auxerr: | 0 | ||||||||||||||||||||||||
| 412 | ERR_put_error(13,(120),(100),__FILE__,422); | - | ||||||||||||||||||||||||
| 413 | err: code before this statement executed 8 times by 1 test: err:Executed by:
| 8 | ||||||||||||||||||||||||
| 414 | if (errtt
| 193895-429702 | ||||||||||||||||||||||||
| 415 | ERR_add_error_data(4, "Field=", errtt->field_name, executed 429702 times by 1 test: ERR_add_error_data(4, "Field=", errtt->field_name, ", Type=", it->sname);Executed by:
| 429702 | ||||||||||||||||||||||||
| 416 | ", Type=", it->sname); executed 429702 times by 1 test: ERR_add_error_data(4, "Field=", errtt->field_name, ", Type=", it->sname);Executed by:
| 429702 | ||||||||||||||||||||||||
| 417 | else | - | ||||||||||||||||||||||||
| 418 | ERR_add_error_data(2, "Type=", it->sname); executed 193895 times by 1 test: ERR_add_error_data(2, "Type=", it->sname);Executed by:
| 193895 | ||||||||||||||||||||||||
| 419 | return executed 623597 times by 1 test: 0;return 0;Executed by:
executed 623597 times by 1 test: return 0;Executed by:
| 623597 | ||||||||||||||||||||||||
| 420 | } | - | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||
| 423 | - | |||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||
| 427 | static int asn1_template_ex_d2i(ASN1_VALUE **val, | - | ||||||||||||||||||||||||
| 428 | const unsigned char **in, long inlen, | - | ||||||||||||||||||||||||
| 429 | const ASN1_TEMPLATE *tt, char opt, | - | ||||||||||||||||||||||||
| 430 | ASN1_TLC *ctx, int depth) | - | ||||||||||||||||||||||||
| 431 | { | - | ||||||||||||||||||||||||
| 432 | int flags, aclass; | - | ||||||||||||||||||||||||
| 433 | int ret; | - | ||||||||||||||||||||||||
| 434 | long len; | - | ||||||||||||||||||||||||
| 435 | const unsigned char *p, *q; | - | ||||||||||||||||||||||||
| 436 | char exp_eoc; | - | ||||||||||||||||||||||||
| 437 | if (!val
| 0-4123416 | ||||||||||||||||||||||||
| 438 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 439 | flags = tt->flags; | - | ||||||||||||||||||||||||
| 440 | aclass = flags & (0x3<<6); | - | ||||||||||||||||||||||||
| 441 | - | |||||||||||||||||||||||||
| 442 | p = *in; | - | ||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | if (flags & (0x2 << 3)
| 270022-3853394 | ||||||||||||||||||||||||
| 446 | char cst; | - | ||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||
| 451 | ret = asn1_check_tlen(&len, | - | ||||||||||||||||||||||||
| 452 | ((void *)0) | - | ||||||||||||||||||||||||
| 453 | , | - | ||||||||||||||||||||||||
| 454 | ((void *)0) | - | ||||||||||||||||||||||||
| 455 | , &exp_eoc, &cst, | - | ||||||||||||||||||||||||
| 456 | &p, inlen, tt->tag, aclass, opt, ctx); | - | ||||||||||||||||||||||||
| 457 | q = p; | - | ||||||||||||||||||||||||
| 458 | if (!ret
| 13767-256255 | ||||||||||||||||||||||||
| 459 | ERR_put_error(13,(132),(58),__FILE__,465); | - | ||||||||||||||||||||||||
| 460 | return executed 13767 times by 1 test: 0;return 0;Executed by:
executed 13767 times by 1 test: return 0;Executed by:
| 13767 | ||||||||||||||||||||||||
| 461 | } else if (ret == -1
| 109651-146604 | ||||||||||||||||||||||||
| 462 | return executed 146604 times by 1 test: -1;return -1;Executed by:
executed 146604 times by 1 test: return -1;Executed by:
| 146604 | ||||||||||||||||||||||||
| 463 | if (!cst
| 947-108704 | ||||||||||||||||||||||||
| 464 | ERR_put_error(13,(132),(120),__FILE__,471) | - | ||||||||||||||||||||||||
| 465 | ; | - | ||||||||||||||||||||||||
| 466 | return executed 947 times by 1 test: 0;return 0;Executed by:
executed 947 times by 1 test: return 0;Executed by:
| 947 | ||||||||||||||||||||||||
| 467 | } | - | ||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||
| 469 | ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx, depth); | - | ||||||||||||||||||||||||
| 470 | if (!ret
| 12816-95888 | ||||||||||||||||||||||||
| 471 | ERR_put_error(13,(132),(58),__FILE__,477); | - | ||||||||||||||||||||||||
| 472 | return executed 12816 times by 1 test: 0;return 0;Executed by:
executed 12816 times by 1 test: return 0;Executed by:
| 12816 | ||||||||||||||||||||||||
| 473 | } | - | ||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | len -= p - q; | - | ||||||||||||||||||||||||
| 476 | if (exp_eoc
| 44513-51375 | ||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | if (!asn1_check_eoc(&p, len)
| 1537-42976 | ||||||||||||||||||||||||
| 479 | ERR_put_error(13,(132),(137),__FILE__,485); | - | ||||||||||||||||||||||||
| 480 | goto executed 1537 times by 1 test: err;goto err;Executed by:
executed 1537 times by 1 test: goto err;Executed by:
| 1537 | ||||||||||||||||||||||||
| 481 | } | - | ||||||||||||||||||||||||
| 482 | } executed 42976 times by 1 test: else {end of blockExecuted by:
| 42976 | ||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||
| 486 | if (len
| 790-50585 | ||||||||||||||||||||||||
| 487 | ERR_put_error(13,(132),(119),__FILE__,494) | - | ||||||||||||||||||||||||
| 488 | ; | - | ||||||||||||||||||||||||
| 489 | goto executed 790 times by 1 test: err;goto err;Executed by:
executed 790 times by 1 test: goto err;Executed by:
| 790 | ||||||||||||||||||||||||
| 490 | } | - | ||||||||||||||||||||||||
| 491 | } executed 50585 times by 1 test: end of blockExecuted by:
| 50585 | ||||||||||||||||||||||||
| 492 | } else | - | ||||||||||||||||||||||||
| 493 | return executed 3853394 times by 2 tests: asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx, depth);return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx, depth);Executed by:
executed 3853394 times by 2 tests: return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx, depth);Executed by:
| 3853394 | ||||||||||||||||||||||||
| 494 | - | |||||||||||||||||||||||||
| 495 | *in = p; | - | ||||||||||||||||||||||||
| 496 | return executed 93561 times by 1 test: 1;return 1;Executed by:
executed 93561 times by 1 test: return 1;Executed by:
| 93561 | ||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | err: | - | ||||||||||||||||||||||||
| 499 | return executed 2327 times by 1 test: 0;return 0;Executed by:
executed 2327 times by 1 test: return 0;Executed by:
| 2327 | ||||||||||||||||||||||||
| 500 | } | - | ||||||||||||||||||||||||
| 501 | - | |||||||||||||||||||||||||
| 502 | static int asn1_template_noexp_d2i(ASN1_VALUE **val, | - | ||||||||||||||||||||||||
| 503 | const unsigned char **in, long len, | - | ||||||||||||||||||||||||
| 504 | const ASN1_TEMPLATE *tt, char opt, | - | ||||||||||||||||||||||||
| 505 | ASN1_TLC *ctx, int depth) | - | ||||||||||||||||||||||||
| 506 | { | - | ||||||||||||||||||||||||
| 507 | int flags, aclass; | - | ||||||||||||||||||||||||
| 508 | int ret; | - | ||||||||||||||||||||||||
| 509 | ASN1_VALUE *tval; | - | ||||||||||||||||||||||||
| 510 | const unsigned char *p, *q; | - | ||||||||||||||||||||||||
| 511 | if (!val
| 0-3962098 | ||||||||||||||||||||||||
| 512 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 513 | flags = tt->flags; | - | ||||||||||||||||||||||||
| 514 | aclass = flags & (0x3<<6); | - | ||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||
| 516 | p = *in; | - | ||||||||||||||||||||||||
| 517 | q = p; | - | ||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||
| 519 | - | |||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||
| 523 | if (tt->flags & (0x1 << 12)
| 669091-3293007 | ||||||||||||||||||||||||
| 524 | tval = (ASN1_VALUE *)val; | - | ||||||||||||||||||||||||
| 525 | val = &tval; | - | ||||||||||||||||||||||||
| 526 | } executed 669091 times by 1 test: end of blockExecuted by:
| 669091 | ||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||
| 528 | if (flags & (0x3 << 1)
| 533882-3428216 | ||||||||||||||||||||||||
| 529 | - | |||||||||||||||||||||||||
| 530 | int sktag, skaclass; | - | ||||||||||||||||||||||||
| 531 | char sk_eoc; | - | ||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||
| 533 | if (flags & (0x1 << 3)
| 77332-456550 | ||||||||||||||||||||||||
| 534 | sktag = tt->tag; | - | ||||||||||||||||||||||||
| 535 | skaclass = aclass; | - | ||||||||||||||||||||||||
| 536 | } executed 77332 times by 1 test: else {end of blockExecuted by:
| 77332 | ||||||||||||||||||||||||
| 537 | skaclass = 0x00; | - | ||||||||||||||||||||||||
| 538 | if (flags & (0x1 << 1)
| 106057-350493 | ||||||||||||||||||||||||
| 539 | sktag = 17; executed 106057 times by 1 test: sktag = 17;Executed by:
| 106057 | ||||||||||||||||||||||||
| 540 | else | - | ||||||||||||||||||||||||
| 541 | sktag = 16; executed 350493 times by 1 test: sktag = 16;Executed by:
| 350493 | ||||||||||||||||||||||||
| 542 | } | - | ||||||||||||||||||||||||
| 543 | - | |||||||||||||||||||||||||
| 544 | ret = asn1_check_tlen(&len, | - | ||||||||||||||||||||||||
| 545 | ((void *)0) | - | ||||||||||||||||||||||||
| 546 | , | - | ||||||||||||||||||||||||
| 547 | ((void *)0) | - | ||||||||||||||||||||||||
| 548 | , &sk_eoc, | - | ||||||||||||||||||||||||
| 549 | ((void *)0) | - | ||||||||||||||||||||||||
| 550 | , | - | ||||||||||||||||||||||||
| 551 | &p, len, sktag, skaclass, opt, ctx); | - | ||||||||||||||||||||||||
| 552 | if (!ret
| 55199-478683 | ||||||||||||||||||||||||
| 553 | ERR_put_error(13,(131),(58),__FILE__,553); | - | ||||||||||||||||||||||||
| 554 | return executed 55199 times by 1 test: 0;return 0;Executed by:
executed 55199 times by 1 test: return 0;Executed by:
| 55199 | ||||||||||||||||||||||||
| 555 | } else if (ret == -1
| 64322-414361 | ||||||||||||||||||||||||
| 556 | return executed 64322 times by 1 test: -1;return -1;Executed by:
executed 64322 times by 1 test: return -1;Executed by:
| 64322 | ||||||||||||||||||||||||
| 557 | if (!*val
| 12636-401725 | ||||||||||||||||||||||||
| 558 | * executed 401725 times by 1 test: val = (ASN1_VALUE *)sk_ASN1_VALUE_new_null();*val = (ASN1_VALUE *)sk_ASN1_VALUE_new_null();Executed by:
executed 401725 times by 1 test: *val = (ASN1_VALUE *)sk_ASN1_VALUE_new_null();Executed by:
| 401725 | ||||||||||||||||||||||||
| 559 | else { | - | ||||||||||||||||||||||||
| 560 | - | |||||||||||||||||||||||||
| 561 | - | |||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||
| 563 | struct stack_st_ASN1_VALUE *sktmp = (struct stack_st_ASN1_VALUE *)*val; | - | ||||||||||||||||||||||||
| 564 | ASN1_VALUE *vtmp; | - | ||||||||||||||||||||||||
| 565 | while (sk_ASN1_VALUE_num(sktmp) > 0
| 0-12636 | ||||||||||||||||||||||||
| 566 | vtmp = sk_ASN1_VALUE_pop(sktmp); | - | ||||||||||||||||||||||||
| 567 | ASN1_item_ex_free(&vtmp, (tt->item)); | - | ||||||||||||||||||||||||
| 568 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 569 | } executed 12636 times by 1 test: end of blockExecuted by:
| 12636 | ||||||||||||||||||||||||
| 570 | - | |||||||||||||||||||||||||
| 571 | if (!*val
| 0-414361 | ||||||||||||||||||||||||
| 572 | ERR_put_error(13,(131),((1|64)),__FILE__,572); | - | ||||||||||||||||||||||||
| 573 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 574 | } | - | ||||||||||||||||||||||||
| 575 | - | |||||||||||||||||||||||||
| 576 | - | |||||||||||||||||||||||||
| 577 | while (len > 0
| 270318-840095 | ||||||||||||||||||||||||
| 578 | ASN1_VALUE *skfield; | - | ||||||||||||||||||||||||
| 579 | q = p; | - | ||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||
| 581 | if (asn1_check_eoc(&p, len)
| 72620-767475 | ||||||||||||||||||||||||
| 582 | if (!sk_eoc
| 833-71787 | ||||||||||||||||||||||||
| 583 | ERR_put_error(13,(131),(159),__FILE__,584) | - | ||||||||||||||||||||||||
| 584 | ; | - | ||||||||||||||||||||||||
| 585 | goto executed 833 times by 1 test: err;goto err;Executed by:
executed 833 times by 1 test: goto err;Executed by:
| 833 | ||||||||||||||||||||||||
| 586 | } | - | ||||||||||||||||||||||||
| 587 | len -= p - q; | - | ||||||||||||||||||||||||
| 588 | sk_eoc = 0; | - | ||||||||||||||||||||||||
| 589 | break; executed 71787 times by 1 test: break;Executed by:
| 71787 | ||||||||||||||||||||||||
| 590 | } | - | ||||||||||||||||||||||||
| 591 | skfield = | - | ||||||||||||||||||||||||
| 592 | ((void *)0) | - | ||||||||||||||||||||||||
| 593 | ; | - | ||||||||||||||||||||||||
| 594 | if (!asn1_item_embed_d2i(&skfield, &p, len,
| 71423-696052 | ||||||||||||||||||||||||
| 595 | (tt->item), -1, 0, 0, ctx,
| 71423-696052 | ||||||||||||||||||||||||
| 596 | depth)
| 71423-696052 | ||||||||||||||||||||||||
| 597 | ERR_put_error(13,(131),(58),__FILE__,596) | - | ||||||||||||||||||||||||
| 598 | ; | - | ||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||
| 600 | ASN1_item_free(skfield, (tt->item)); | - | ||||||||||||||||||||||||
| 601 | goto executed 71423 times by 1 test: err;goto err;Executed by:
executed 71423 times by 1 test: goto err;Executed by:
| 71423 | ||||||||||||||||||||||||
| 602 | } | - | ||||||||||||||||||||||||
| 603 | len -= p - q; | - | ||||||||||||||||||||||||
| 604 | if (!sk_ASN1_VALUE_push((struct stack_st_ASN1_VALUE *)*val, skfield)
| 0-696052 | ||||||||||||||||||||||||
| 605 | ERR_put_error(13,(131),((1|64)),__FILE__,603); | - | ||||||||||||||||||||||||
| 606 | ASN1_item_free(skfield, (tt->item)); | - | ||||||||||||||||||||||||
| 607 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 608 | } | - | ||||||||||||||||||||||||
| 609 | } executed 696052 times by 1 test: end of blockExecuted by:
| 696052 | ||||||||||||||||||||||||
| 610 | if (sk_eoc
| 1116-340989 | ||||||||||||||||||||||||
| 611 | ERR_put_error(13,(131),(137),__FILE__,609); | - | ||||||||||||||||||||||||
| 612 | goto executed 1116 times by 1 test: err;goto err;Executed by:
executed 1116 times by 1 test: goto err;Executed by:
| 1116 | ||||||||||||||||||||||||
| 613 | } | - | ||||||||||||||||||||||||
| 614 | } executed 340989 times by 1 test: else if (flags & (0x1 << 3)end of blockExecuted by:
| 340989-2838319 | ||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||
| 616 | ret = asn1_item_embed_d2i(val, &p, len, | - | ||||||||||||||||||||||||
| 617 | (tt->item), tt->tag, aclass, opt, | - | ||||||||||||||||||||||||
| 618 | ctx, depth); | - | ||||||||||||||||||||||||
| 619 | if (!ret
| 43659-546238 | ||||||||||||||||||||||||
| 620 | ERR_put_error(13,(131),(58),__FILE__,618); | - | ||||||||||||||||||||||||
| 621 | goto executed 43659 times by 1 test: err;goto err;Executed by:
executed 43659 times by 1 test: goto err;Executed by:
| 43659 | ||||||||||||||||||||||||
| 622 | } else if (ret == -1
| 90984-455254 | ||||||||||||||||||||||||
| 623 | return executed 455254 times by 1 test: -1;return -1;Executed by:
executed 455254 times by 1 test: return -1;Executed by:
| 455254 | ||||||||||||||||||||||||
| 624 | } executed 90984 times by 1 test: else {end of blockExecuted by:
| 90984 | ||||||||||||||||||||||||
| 625 | - | |||||||||||||||||||||||||
| 626 | ret = asn1_item_embed_d2i(val, &p, len, (tt->item), | - | ||||||||||||||||||||||||
| 627 | -1, 0, opt, ctx, depth); | - | ||||||||||||||||||||||||
| 628 | if (!ret
| 318226-2520093 | ||||||||||||||||||||||||
| 629 | ERR_put_error(13,(131),(58),__FILE__,627); | - | ||||||||||||||||||||||||
| 630 | goto executed 318226 times by 1 test: err;goto err;Executed by:
executed 318226 times by 1 test: goto err;Executed by:
| 318226 | ||||||||||||||||||||||||
| 631 | } else if (ret == -1
| 317969-2202124 | ||||||||||||||||||||||||
| 632 | return executed 317969 times by 1 test: -1;return -1;Executed by:
executed 317969 times by 1 test: return -1;Executed by:
| 317969 | ||||||||||||||||||||||||
| 633 | } executed 2202124 times by 2 tests: end of blockExecuted by:
| 2202124 | ||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||
| 635 | *in = p; | - | ||||||||||||||||||||||||
| 636 | return executed 2634097 times by 2 tests: 1;return 1;Executed by:
executed 2634097 times by 2 tests: return 1;Executed by:
| 2634097 | ||||||||||||||||||||||||
| 637 | - | |||||||||||||||||||||||||
| 638 | err: | - | ||||||||||||||||||||||||
| 639 | return executed 435257 times by 1 test: 0;return 0;Executed by:
executed 435257 times by 1 test: return 0;Executed by:
| 435257 | ||||||||||||||||||||||||
| 640 | } | - | ||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||
| 642 | static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, | - | ||||||||||||||||||||||||
| 643 | const unsigned char **in, long inlen, | - | ||||||||||||||||||||||||
| 644 | const ASN1_ITEM *it, | - | ||||||||||||||||||||||||
| 645 | int tag, int aclass, char opt, ASN1_TLC *ctx) | - | ||||||||||||||||||||||||
| 646 | { | - | ||||||||||||||||||||||||
| 647 | int ret = 0, utype; | - | ||||||||||||||||||||||||
| 648 | long plen; | - | ||||||||||||||||||||||||
| 649 | char cst, inf, free_cont = 0; | - | ||||||||||||||||||||||||
| 650 | const unsigned char *p; | - | ||||||||||||||||||||||||
| 651 | BUF_MEM buf = { 0, | - | ||||||||||||||||||||||||
| 652 | ((void *)0) | - | ||||||||||||||||||||||||
| 653 | , 0, 0 }; | - | ||||||||||||||||||||||||
| 654 | const unsigned char *cont = | - | ||||||||||||||||||||||||
| 655 | ((void *)0) | - | ||||||||||||||||||||||||
| 656 | ; | - | ||||||||||||||||||||||||
| 657 | long len; | - | ||||||||||||||||||||||||
| 658 | if (!pval
| 0-3019103 | ||||||||||||||||||||||||
| 659 | ERR_put_error(13,(108),(125),__FILE__,653); | - | ||||||||||||||||||||||||
| 660 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 661 | } | - | ||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||
| 663 | if (it->itype == 0x5
| 277002-2742101 | ||||||||||||||||||||||||
| 664 | utype = tag; | - | ||||||||||||||||||||||||
| 665 | tag = -1; | - | ||||||||||||||||||||||||
| 666 | } executed 277002 times by 1 test: elseend of blockExecuted by:
| 277002 | ||||||||||||||||||||||||
| 667 | utype = it->utype; executed 2742101 times by 2 tests: utype = it->utype;Executed by:
| 2742101 | ||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||
| 669 | if (utype == -4
| 225601-2793502 | ||||||||||||||||||||||||
| 670 | - | |||||||||||||||||||||||||
| 671 | unsigned char oclass; | - | ||||||||||||||||||||||||
| 672 | if (tag >= 0
| 0-225601 | ||||||||||||||||||||||||
| 673 | ERR_put_error(13,(108),(127),__FILE__,667); | - | ||||||||||||||||||||||||
| 674 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 675 | } | - | ||||||||||||||||||||||||
| 676 | if (opt
| 0-225601 | ||||||||||||||||||||||||
| 677 | ERR_put_error(13,(108),(126),__FILE__,672) | - | ||||||||||||||||||||||||
| 678 | ; | - | ||||||||||||||||||||||||
| 679 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 680 | } | - | ||||||||||||||||||||||||
| 681 | p = *in; | - | ||||||||||||||||||||||||
| 682 | ret = asn1_check_tlen( | - | ||||||||||||||||||||||||
| 683 | ((void *)0) | - | ||||||||||||||||||||||||
| 684 | , &utype, &oclass, | - | ||||||||||||||||||||||||
| 685 | ((void *)0) | - | ||||||||||||||||||||||||
| 686 | , | - | ||||||||||||||||||||||||
| 687 | ((void *)0) | - | ||||||||||||||||||||||||
| 688 | , | - | ||||||||||||||||||||||||
| 689 | &p, inlen, -1, 0, 0, ctx); | - | ||||||||||||||||||||||||
| 690 | if (!ret
| 424-225177 | ||||||||||||||||||||||||
| 691 | ERR_put_error(13,(108),(58),__FILE__,679); | - | ||||||||||||||||||||||||
| 692 | return executed 424 times by 1 test: 0;return 0;Executed by:
executed 424 times by 1 test: return 0;Executed by:
| 424 | ||||||||||||||||||||||||
| 693 | } | - | ||||||||||||||||||||||||
| 694 | if (oclass != 0x00
| 30060-195117 | ||||||||||||||||||||||||
| 695 | utype = -3; executed 30060 times by 1 test: utype = -3;Executed by:
| 30060 | ||||||||||||||||||||||||
| 696 | } executed 225177 times by 1 test: end of blockExecuted by:
| 225177 | ||||||||||||||||||||||||
| 697 | if (tag == -1
| 418483-2600196 | ||||||||||||||||||||||||
| 698 | tag = utype; | - | ||||||||||||||||||||||||
| 699 | aclass = 0x00; | - | ||||||||||||||||||||||||
| 700 | } executed 2600196 times by 2 tests: end of blockExecuted by:
| 2600196 | ||||||||||||||||||||||||
| 701 | p = *in; | - | ||||||||||||||||||||||||
| 702 | - | |||||||||||||||||||||||||
| 703 | ret = asn1_check_tlen(&plen, | - | ||||||||||||||||||||||||
| 704 | ((void *)0) | - | ||||||||||||||||||||||||
| 705 | , | - | ||||||||||||||||||||||||
| 706 | ((void *)0) | - | ||||||||||||||||||||||||
| 707 | , &inf, &cst, | - | ||||||||||||||||||||||||
| 708 | &p, inlen, tag, aclass, opt, ctx); | - | ||||||||||||||||||||||||
| 709 | if (!ret
| 303113-2715566 | ||||||||||||||||||||||||
| 710 | ERR_put_error(13,(108),(58),__FILE__,694); | - | ||||||||||||||||||||||||
| 711 | return executed 303113 times by 1 test: 0;return 0;Executed by:
executed 303113 times by 1 test: return 0;Executed by:
| 303113 | ||||||||||||||||||||||||
| 712 | } else if (ret == -1
| 580489-2135077 | ||||||||||||||||||||||||
| 713 | return executed 580489 times by 1 test: -1;return -1;Executed by:
executed 580489 times by 1 test: return -1;Executed by:
| 580489 | ||||||||||||||||||||||||
| 714 | ret = 0; | - | ||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||
| 716 | if ((
| 52051-2083026 | ||||||||||||||||||||||||
| 717 | || (
| 3154-2079872 | ||||||||||||||||||||||||
| 718 | - | |||||||||||||||||||||||||
| 719 | - | |||||||||||||||||||||||||
| 720 | - | |||||||||||||||||||||||||
| 721 | - | |||||||||||||||||||||||||
| 722 | if (utype == -3
| 30060-55205 | ||||||||||||||||||||||||
| 723 | if (ctx
executed 30060 times by 1 test: ctx)->valid = 0;(ctx)->valid = 0;Executed by:
executed 30060 times by 1 test: (ctx)->valid = 0;Executed by:
| 0-30060 | ||||||||||||||||||||||||
| 724 | } executed 30060 times by 1 test: end of blockExecuted by:
| 30060 | ||||||||||||||||||||||||
| 725 | - | |||||||||||||||||||||||||
| 726 | else if (!cst
| 1047-54158 | ||||||||||||||||||||||||
| 727 | ERR_put_error(13,(108),(156),__FILE__,712) | - | ||||||||||||||||||||||||
| 728 | ; | - | ||||||||||||||||||||||||
| 729 | return executed 1047 times by 1 test: 0;return 0;Executed by:
executed 1047 times by 1 test: return 0;Executed by:
| 1047 | ||||||||||||||||||||||||
| 730 | } | - | ||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||
| 732 | cont = *in; | - | ||||||||||||||||||||||||
| 733 | - | |||||||||||||||||||||||||
| 734 | if (inf
| 30513-53705 | ||||||||||||||||||||||||
| 735 | if (!asn1_find_end(&p, plen, inf)
| 13173-17340 | ||||||||||||||||||||||||
| 736 | goto executed 13173 times by 1 test: err;goto err;Executed by:
executed 13173 times by 1 test: goto err;Executed by:
| 13173 | ||||||||||||||||||||||||
| 737 | len = p - cont; | - | ||||||||||||||||||||||||
| 738 | } executed 17340 times by 1 test: else {end of blockExecuted by:
| 17340 | ||||||||||||||||||||||||
| 739 | len = p - cont + plen; | - | ||||||||||||||||||||||||
| 740 | p += plen; | - | ||||||||||||||||||||||||
| 741 | } executed 53705 times by 1 test: end of blockExecuted by:
| 53705 | ||||||||||||||||||||||||
| 742 | } else if (cst
| 63711-1986101 | ||||||||||||||||||||||||
| 743 | if (utype == 5
| 434-63277 | ||||||||||||||||||||||||
| 744 | || utype == 6
| 667-61937 | ||||||||||||||||||||||||
| 745 | || utype == 10
| 474-60621 | ||||||||||||||||||||||||
| 746 | ERR_put_error(13,(108),(195),__FILE__,730); | - | ||||||||||||||||||||||||
| 747 | return executed 3090 times by 1 test: 0;return 0;Executed by:
executed 3090 times by 1 test: return 0;Executed by:
| 3090 | ||||||||||||||||||||||||
| 748 | } | - | ||||||||||||||||||||||||
| 749 | - | |||||||||||||||||||||||||
| 750 | - | |||||||||||||||||||||||||
| 751 | free_cont = 1; | - | ||||||||||||||||||||||||
| 752 | - | |||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||
| 756 | - | |||||||||||||||||||||||||
| 757 | - | |||||||||||||||||||||||||
| 758 | if (!asn1_collect(&buf, &p, plen, inf, -1, 0x00, 0)
| 3652-56969 | ||||||||||||||||||||||||
| 759 | goto executed 3652 times by 1 test: err;goto err;Executed by:
executed 3652 times by 1 test: goto err;Executed by:
| 3652 | ||||||||||||||||||||||||
| 760 | } | - | ||||||||||||||||||||||||
| 761 | len = buf.length; | - | ||||||||||||||||||||||||
| 762 | - | |||||||||||||||||||||||||
| 763 | if (!BUF_MEM_grow_clean(&buf, len + 1)
| 0-56969 | ||||||||||||||||||||||||
| 764 | ERR_put_error(13,(108),((1|64)),__FILE__,748); | - | ||||||||||||||||||||||||
| 765 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 766 | } | - | ||||||||||||||||||||||||
| 767 | buf.data[len] = 0; | - | ||||||||||||||||||||||||
| 768 | cont = (const unsigned char *)buf.data; | - | ||||||||||||||||||||||||
| 769 | } executed 56969 times by 1 test: else {end of blockExecuted by:
| 56969 | ||||||||||||||||||||||||
| 770 | cont = p; | - | ||||||||||||||||||||||||
| 771 | len = plen; | - | ||||||||||||||||||||||||
| 772 | p += plen; | - | ||||||||||||||||||||||||
| 773 | } executed 1986101 times by 2 tests: end of blockExecuted by:
| 1986101 | ||||||||||||||||||||||||
| 774 | - | |||||||||||||||||||||||||
| 775 | - | |||||||||||||||||||||||||
| 776 | - | |||||||||||||||||||||||||
| 777 | if (!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it)
| 16527-2097588 | ||||||||||||||||||||||||
| 778 | goto executed 16527 times by 1 test: err;goto err;Executed by:
executed 16527 times by 1 test: goto err;Executed by:
| 16527 | ||||||||||||||||||||||||
| 779 | - | |||||||||||||||||||||||||
| 780 | *in = p; | - | ||||||||||||||||||||||||
| 781 | ret = 1; | - | ||||||||||||||||||||||||
| 782 | err: code before this statement executed 2097588 times by 2 tests: err:Executed by:
| 2097588 | ||||||||||||||||||||||||
| 783 | if (free_cont
| 4097-2126843 | ||||||||||||||||||||||||
| 784 | CRYPTO_free(buf.data, __FILE__, 768); executed 4097 times by 1 test: CRYPTO_free(buf.data, __FILE__, 768);Executed by:
| 4097 | ||||||||||||||||||||||||
| 785 | return executed 2130940 times by 2 tests: ret;return ret;Executed by:
executed 2130940 times by 2 tests: return ret;Executed by:
| 2130940 | ||||||||||||||||||||||||
| 786 | } | - | ||||||||||||||||||||||||
| 787 | - | |||||||||||||||||||||||||
| 788 | - | |||||||||||||||||||||||||
| 789 | - | |||||||||||||||||||||||||
| 790 | static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, | - | ||||||||||||||||||||||||
| 791 | int utype, char *free_cont, const ASN1_ITEM *it) | - | ||||||||||||||||||||||||
| 792 | { | - | ||||||||||||||||||||||||
| 793 | ASN1_VALUE **opval = | - | ||||||||||||||||||||||||
| 794 | ((void *)0) | - | ||||||||||||||||||||||||
| 795 | ; | - | ||||||||||||||||||||||||
| 796 | ASN1_STRING *stmp; | - | ||||||||||||||||||||||||
| 797 | ASN1_TYPE *typ = | - | ||||||||||||||||||||||||
| 798 | ((void *)0) | - | ||||||||||||||||||||||||
| 799 | ; | - | ||||||||||||||||||||||||
| 800 | int ret = 0; | - | ||||||||||||||||||||||||
| 801 | const ASN1_PRIMITIVE_FUNCS *pf; | - | ||||||||||||||||||||||||
| 802 | ASN1_INTEGER **tint; | - | ||||||||||||||||||||||||
| 803 | pf = it->funcs; | - | ||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||
| 805 | if (pf
| 0-1950856 | ||||||||||||||||||||||||
| 806 | return executed 163259 times by 2 tests: pf->prim_c2i(pval, cont, len, utype, free_cont, it);return pf->prim_c2i(pval, cont, len, utype, free_cont, it);Executed by:
executed 163259 times by 2 tests: return pf->prim_c2i(pval, cont, len, utype, free_cont, it);Executed by:
| 163259 | ||||||||||||||||||||||||
| 807 | - | |||||||||||||||||||||||||
| 808 | if (it->utype == -4
| 217001-1733855 | ||||||||||||||||||||||||
| 809 | if (!*pval
| 3603-213398 | ||||||||||||||||||||||||
| 810 | typ = ASN1_TYPE_new(); | - | ||||||||||||||||||||||||
| 811 | if (typ ==
| 0-213398 | ||||||||||||||||||||||||
| 812 | ((void *)0)
| 0-213398 | ||||||||||||||||||||||||
| 813 | ) | - | ||||||||||||||||||||||||
| 814 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 815 | *pval = (ASN1_VALUE *)typ; | - | ||||||||||||||||||||||||
| 816 | } executed 213398 times by 1 test: elseend of blockExecuted by:
| 213398 | ||||||||||||||||||||||||
| 817 | typ = (ASN1_TYPE *)*pval; executed 3603 times by 1 test: typ = (ASN1_TYPE *)*pval;Executed by:
| 3603 | ||||||||||||||||||||||||
| 818 | - | |||||||||||||||||||||||||
| 819 | if (utype != typ->type
| 0-217001 | ||||||||||||||||||||||||
| 820 | ASN1_TYPE_set(typ, utype, executed 217001 times by 1 test: ASN1_TYPE_set(typ, utype, ((void *)0) );Executed by:
| 217001 | ||||||||||||||||||||||||
| 821 | ((void *)0) executed 217001 times by 1 test: ASN1_TYPE_set(typ, utype, ((void *)0) );Executed by:
| 217001 | ||||||||||||||||||||||||
| 822 | ); executed 217001 times by 1 test: ASN1_TYPE_set(typ, utype, ((void *)0) );Executed by:
| 217001 | ||||||||||||||||||||||||
| 823 | opval = pval; | - | ||||||||||||||||||||||||
| 824 | pval = &typ->value.asn1_value; | - | ||||||||||||||||||||||||
| 825 | } executed 217001 times by 1 test: end of blockExecuted by:
| 217001 | ||||||||||||||||||||||||
| 826 | switch (utype) { | - | ||||||||||||||||||||||||
| 827 | case executed 666098 times by 1 test: 6:case 6:Executed by:
executed 666098 times by 1 test: case 6:Executed by:
| 666098 | ||||||||||||||||||||||||
| 828 | if (!c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, len)
| 4369-661729 | ||||||||||||||||||||||||
| 829 | goto executed 4369 times by 1 test: err;goto err;Executed by:
executed 4369 times by 1 test: goto err;Executed by:
| 4369 | ||||||||||||||||||||||||
| 830 | break; executed 661729 times by 1 test: break;Executed by:
| 661729 | ||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||
| 832 | case executed 46684 times by 1 test: 5:case 5:Executed by:
executed 46684 times by 1 test: case 5:Executed by:
| 46684 | ||||||||||||||||||||||||
| 833 | if (len
| 322-46362 | ||||||||||||||||||||||||
| 834 | ERR_put_error(13,(204),(144),__FILE__,810); | - | ||||||||||||||||||||||||
| 835 | goto executed 322 times by 1 test: err;goto err;Executed by:
executed 322 times by 1 test: goto err;Executed by:
| 322 | ||||||||||||||||||||||||
| 836 | } | - | ||||||||||||||||||||||||
| 837 | *pval = (ASN1_VALUE *)1; | - | ||||||||||||||||||||||||
| 838 | break; executed 46362 times by 1 test: break;Executed by:
| 46362 | ||||||||||||||||||||||||
| 839 | - | |||||||||||||||||||||||||
| 840 | case executed 27684 times by 1 test: 1:case 1:Executed by:
executed 27684 times by 1 test: case 1:Executed by:
| 27684 | ||||||||||||||||||||||||
| 841 | if (len != 1
| 536-27148 | ||||||||||||||||||||||||
| 842 | ERR_put_error(13,(204),(106),__FILE__,818); | - | ||||||||||||||||||||||||
| 843 | goto executed 536 times by 1 test: err;goto err;Executed by:
executed 536 times by 1 test: goto err;Executed by:
| 536 | ||||||||||||||||||||||||
| 844 | } else { | - | ||||||||||||||||||||||||
| 845 | ASN1_BOOLEAN *tbool; | - | ||||||||||||||||||||||||
| 846 | tbool = (ASN1_BOOLEAN *)pval; | - | ||||||||||||||||||||||||
| 847 | *tbool = *cont; | - | ||||||||||||||||||||||||
| 848 | } executed 27148 times by 1 test: end of blockExecuted by:
| 27148 | ||||||||||||||||||||||||
| 849 | break; executed 27148 times by 1 test: break;Executed by:
| 27148 | ||||||||||||||||||||||||
| 850 | - | |||||||||||||||||||||||||
| 851 | case executed 147882 times by 1 test: 3:case 3:Executed by:
executed 147882 times by 1 test: case 3:Executed by:
| 147882 | ||||||||||||||||||||||||
| 852 | if (!c2i_ASN1_BIT_STRING((ASN1_BIT_STRING **)pval, &cont, len)
| 1870-146012 | ||||||||||||||||||||||||
| 853 | goto executed 1870 times by 1 test: err;goto err;Executed by:
executed 1870 times by 1 test: goto err;Executed by:
| 1870 | ||||||||||||||||||||||||
| 854 | break; executed 146012 times by 1 test: break;Executed by:
| 146012 | ||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||
| 856 | case executed 255497 times by 1 test: 2:case 2:Executed by:
executed 255497 times by 1 test: case 2:Executed by:
| 255497 | ||||||||||||||||||||||||
| 857 | case executed 17429 times by 1 test: 10:case 10:Executed by:
executed 17429 times by 1 test: case 10:Executed by:
| 17429 | ||||||||||||||||||||||||
| 858 | tint = (ASN1_INTEGER **)pval; | - | ||||||||||||||||||||||||
| 859 | if (!c2i_ASN1_INTEGER(tint, &cont, len)
| 7184-265742 | ||||||||||||||||||||||||
| 860 | goto executed 7184 times by 1 test: err;goto err;Executed by:
executed 7184 times by 1 test: goto err;Executed by:
| 7184 | ||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||
| 862 | (*tint)->type = utype | ((*tint)->type & 0x100); | - | ||||||||||||||||||||||||
| 863 | break; executed 265742 times by 1 test: break;Executed by:
| 265742 | ||||||||||||||||||||||||
| 864 | - | |||||||||||||||||||||||||
| 865 | case executed 355812 times by 2 tests: 4:case 4:Executed by:
executed 355812 times by 2 tests: case 4:Executed by:
| 355812 | ||||||||||||||||||||||||
| 866 | case executed 5914 times by 1 test: 18:case 18:Executed by:
executed 5914 times by 1 test: case 18:Executed by:
| 5914 | ||||||||||||||||||||||||
| 867 | case executed 28425 times by 1 test: 19:case 19:Executed by:
executed 28425 times by 1 test: case 19:Executed by:
| 28425 | ||||||||||||||||||||||||
| 868 | case executed 17382 times by 1 test: 20:case 20:Executed by:
executed 17382 times by 1 test: case 20:Executed by:
| 17382 | ||||||||||||||||||||||||
| 869 | case executed 423 times by 1 test: 21:case 21:Executed by:
executed 423 times by 1 test: case 21:Executed by:
| 423 | ||||||||||||||||||||||||
| 870 | case executed 50244 times by 1 test: 22:case 22:Executed by:
executed 50244 times by 1 test: case 22:Executed by:
| 50244 | ||||||||||||||||||||||||
| 871 | case executed 79365 times by 1 test: 23:case 23:Executed by:
executed 79365 times by 1 test: case 23:Executed by:
| 79365 | ||||||||||||||||||||||||
| 872 | case executed 55881 times by 1 test: 24:case 24:Executed by:
executed 55881 times by 1 test: case 24:Executed by:
| 55881 | ||||||||||||||||||||||||
| 873 | case executed 1086 times by 1 test: 25:case 25:Executed by:
executed 1086 times by 1 test: case 25:Executed by:
| 1086 | ||||||||||||||||||||||||
| 874 | case executed 1782 times by 1 test: 26:case 26:Executed by:
executed 1782 times by 1 test: case 26:Executed by:
| 1782 | ||||||||||||||||||||||||
| 875 | case executed 1807 times by 1 test: 27:case 27:Executed by:
executed 1807 times by 1 test: case 27:Executed by:
| 1807 | ||||||||||||||||||||||||
| 876 | case executed 14720 times by 1 test: 28:case 28:Executed by:
executed 14720 times by 1 test: case 28:Executed by:
| 14720 | ||||||||||||||||||||||||
| 877 | case executed 13083 times by 1 test: 30:case 30:Executed by:
executed 13083 times by 1 test: case 30:Executed by:
| 13083 | ||||||||||||||||||||||||
| 878 | case executed 64473 times by 1 test: 12:case 12:Executed by:
executed 64473 times by 1 test: case 12:Executed by:
| 64473 | ||||||||||||||||||||||||
| 879 | case executed 26809 times by 1 test: -3:case -3:Executed by:
executed 26809 times by 1 test: case -3:Executed by:
| 26809 | ||||||||||||||||||||||||
| 880 | case executed 2902 times by 1 test: 17:case 17:Executed by:
executed 2902 times by 1 test: case 17:Executed by:
| 2902 | ||||||||||||||||||||||||
| 881 | case executed 41334 times by 1 test: 16:case 16:Executed by:
executed 41334 times by 1 test: case 16:Executed by:
| 41334 | ||||||||||||||||||||||||
| 882 | default executed 28140 times by 1 test: :default:Executed by:
executed 28140 times by 1 test: default:Executed by:
| 28140 | ||||||||||||||||||||||||
| 883 | if (utype == 30
| 726-776499 | ||||||||||||||||||||||||
| 884 | ERR_put_error(13,(204),(214),__FILE__,860); | - | ||||||||||||||||||||||||
| 885 | goto executed 726 times by 1 test: err;goto err;Executed by:
executed 726 times by 1 test: goto err;Executed by:
| 726 | ||||||||||||||||||||||||
| 886 | } | - | ||||||||||||||||||||||||
| 887 | if (utype == 28
| 471-774136 | ||||||||||||||||||||||||
| 888 | ERR_put_error(13,(204),(215),__FILE__,865) | - | ||||||||||||||||||||||||
| 889 | ; | - | ||||||||||||||||||||||||
| 890 | goto executed 471 times by 1 test: err;goto err;Executed by:
executed 471 times by 1 test: goto err;Executed by:
| 471 | ||||||||||||||||||||||||
| 891 | } | - | ||||||||||||||||||||||||
| 892 | - | |||||||||||||||||||||||||
| 893 | if (!*pval
| 298851-489534 | ||||||||||||||||||||||||
| 894 | stmp = ASN1_STRING_type_new(utype); | - | ||||||||||||||||||||||||
| 895 | if (stmp ==
| 0-298851 | ||||||||||||||||||||||||
| 896 | ((void *)0)
| 0-298851 | ||||||||||||||||||||||||
| 897 | ) { | - | ||||||||||||||||||||||||
| 898 | ERR_put_error(13,(204),((1|64)),__FILE__,872); | - | ||||||||||||||||||||||||
| 899 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 900 | } | - | ||||||||||||||||||||||||
| 901 | *pval = (ASN1_VALUE *)stmp; | - | ||||||||||||||||||||||||
| 902 | } executed 298851 times by 1 test: else {end of blockExecuted by:
| 298851 | ||||||||||||||||||||||||
| 903 | stmp = (ASN1_STRING *)*pval; | - | ||||||||||||||||||||||||
| 904 | stmp->type = utype; | - | ||||||||||||||||||||||||
| 905 | } executed 489534 times by 2 tests: end of blockExecuted by:
| 489534 | ||||||||||||||||||||||||
| 906 | - | |||||||||||||||||||||||||
| 907 | if (*
| 56524-731861 | ||||||||||||||||||||||||
| 908 | CRYPTO_free(stmp->data, __FILE__, 882); | - | ||||||||||||||||||||||||
| 909 | stmp->data = (unsigned char *)cont; | - | ||||||||||||||||||||||||
| 910 | stmp->length = len; | - | ||||||||||||||||||||||||
| 911 | *free_cont = 0; | - | ||||||||||||||||||||||||
| 912 | } executed 56524 times by 1 test: else {end of blockExecuted by:
| 56524 | ||||||||||||||||||||||||
| 913 | if (!ASN1_STRING_set(stmp, cont, len)
| 0-731861 | ||||||||||||||||||||||||
| 914 | ERR_put_error(13,(204),((1|64)),__FILE__,888); | - | ||||||||||||||||||||||||
| 915 | ASN1_STRING_free(stmp); | - | ||||||||||||||||||||||||
| 916 | *pval = | - | ||||||||||||||||||||||||
| 917 | ((void *)0) | - | ||||||||||||||||||||||||
| 918 | ; | - | ||||||||||||||||||||||||
| 919 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 920 | } | - | ||||||||||||||||||||||||
| 921 | } executed 731861 times by 2 tests: end of blockExecuted by:
| 731861 | ||||||||||||||||||||||||
| 922 | break; executed 788385 times by 2 tests: break;Executed by:
| 788385 | ||||||||||||||||||||||||
| 923 | } | - | ||||||||||||||||||||||||
| 924 | - | |||||||||||||||||||||||||
| 925 | if (typ
| 45202-1718973 | ||||||||||||||||||||||||
| 926 | typ->value.ptr = executed 45202 times by 1 test: typ->value.ptr = ((void *)0) ;Executed by:
| 45202 | ||||||||||||||||||||||||
| 927 | ((void *)0) executed 45202 times by 1 test: typ->value.ptr = ((void *)0) ;Executed by:
| 45202 | ||||||||||||||||||||||||
| 928 | ; executed 45202 times by 1 test: typ->value.ptr = ((void *)0) ;Executed by:
| 45202 | ||||||||||||||||||||||||
| 929 | - | |||||||||||||||||||||||||
| 930 | ret = 1; | - | ||||||||||||||||||||||||
| 931 | err: code before this statement executed 1935378 times by 2 tests: err:Executed by:
| 1935378 | ||||||||||||||||||||||||
| 932 | if (!ret
| 15478-1935378 | ||||||||||||||||||||||||
| 933 | ASN1_TYPE_free(typ); | - | ||||||||||||||||||||||||
| 934 | if (opval
| 596-14882 | ||||||||||||||||||||||||
| 935 | * executed 596 times by 1 test: opval = *opval = ((void *)0) ;Executed by:
executed 596 times by 1 test: *opval = ((void *)0) ;Executed by:
| 596 | ||||||||||||||||||||||||
| 936 | ((void *)0) executed 596 times by 1 test: *opval = ((void *)0) ;Executed by:
| 596 | ||||||||||||||||||||||||
| 937 | ; executed 596 times by 1 test: *opval = ((void *)0) ;Executed by:
| 596 | ||||||||||||||||||||||||
| 938 | } executed 15478 times by 1 test: end of blockExecuted by:
| 15478 | ||||||||||||||||||||||||
| 939 | return executed 1950856 times by 2 tests: ret;return ret;Executed by:
executed 1950856 times by 2 tests: return ret;Executed by:
| 1950856 | ||||||||||||||||||||||||
| 940 | } | - | ||||||||||||||||||||||||
| 941 | static int asn1_find_end(const unsigned char **in, long len, char inf) | - | ||||||||||||||||||||||||
| 942 | { | - | ||||||||||||||||||||||||
| 943 | uint32_t expected_eoc; | - | ||||||||||||||||||||||||
| 944 | long plen; | - | ||||||||||||||||||||||||
| 945 | const unsigned char *p = *in, *q; | - | ||||||||||||||||||||||||
| 946 | - | |||||||||||||||||||||||||
| 947 | if (inf == 0
| 0-30513 | ||||||||||||||||||||||||
| 948 | *in += len; | - | ||||||||||||||||||||||||
| 949 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 950 | } | - | ||||||||||||||||||||||||
| 951 | expected_eoc = 1; | - | ||||||||||||||||||||||||
| 952 | - | |||||||||||||||||||||||||
| 953 | - | |||||||||||||||||||||||||
| 954 | - | |||||||||||||||||||||||||
| 955 | - | |||||||||||||||||||||||||
| 956 | - | |||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||
| 958 | while (len > 0
| 4610-7407911 | ||||||||||||||||||||||||
| 959 | if (asn1_check_eoc(&p, len)
| 1956678-5451233 | ||||||||||||||||||||||||
| 960 | expected_eoc--; | - | ||||||||||||||||||||||||
| 961 | if (expected_eoc == 0
| 17340-1939338 | ||||||||||||||||||||||||
| 962 | break; executed 17340 times by 1 test: break;Executed by:
| 17340 | ||||||||||||||||||||||||
| 963 | len -= 2; | - | ||||||||||||||||||||||||
| 964 | continue; executed 1939338 times by 1 test: continue;Executed by:
| 1939338 | ||||||||||||||||||||||||
| 965 | } | - | ||||||||||||||||||||||||
| 966 | q = p; | - | ||||||||||||||||||||||||
| 967 | - | |||||||||||||||||||||||||
| 968 | if (!asn1_check_tlen(&plen,
| 8563-5442670 | ||||||||||||||||||||||||
| 969 | ((void *)0)
| 8563-5442670 | ||||||||||||||||||||||||
| 970 | ,
| 8563-5442670 | ||||||||||||||||||||||||
| 971 | ((void *)0)
| 8563-5442670 | ||||||||||||||||||||||||
| 972 | , &inf,
| 8563-5442670 | ||||||||||||||||||||||||
| 973 | ((void *)0)
| 8563-5442670 | ||||||||||||||||||||||||
| 974 | , &p, len,
| 8563-5442670 | ||||||||||||||||||||||||
| 975 | -1, 0, 0,
| 8563-5442670 | ||||||||||||||||||||||||
| 976 | ((void *)0)
| 8563-5442670 | ||||||||||||||||||||||||
| 977 | )
| 8563-5442670 | ||||||||||||||||||||||||
| 978 | ERR_put_error(13,(190),(58),__FILE__,946); | - | ||||||||||||||||||||||||
| 979 | return executed 8563 times by 1 test: 0;return 0;Executed by:
executed 8563 times by 1 test: return 0;Executed by:
| 8563 | ||||||||||||||||||||||||
| 980 | } | - | ||||||||||||||||||||||||
| 981 | if (inf
| 1964365-3478305 | ||||||||||||||||||||||||
| 982 | if (expected_eoc ==
| 0-1964365 | ||||||||||||||||||||||||
| 983 | (4294967295U)
| 0-1964365 | ||||||||||||||||||||||||
| 984 | ) { | - | ||||||||||||||||||||||||
| 985 | ERR_put_error(13,(190),(58),__FILE__,951); | - | ||||||||||||||||||||||||
| 986 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 987 | } | - | ||||||||||||||||||||||||
| 988 | expected_eoc++; | - | ||||||||||||||||||||||||
| 989 | } executed 1964365 times by 1 test: else {end of blockExecuted by:
| 1964365 | ||||||||||||||||||||||||
| 990 | p += plen; | - | ||||||||||||||||||||||||
| 991 | } executed 3478305 times by 1 test: end of blockExecuted by:
| 3478305 | ||||||||||||||||||||||||
| 992 | len -= p - q; | - | ||||||||||||||||||||||||
| 993 | } executed 5442670 times by 1 test: end of blockExecuted by:
| 5442670 | ||||||||||||||||||||||||
| 994 | if (expected_eoc
| 4610-17340 | ||||||||||||||||||||||||
| 995 | ERR_put_error(13,(190),(137),__FILE__,961); | - | ||||||||||||||||||||||||
| 996 | return executed 4610 times by 1 test: 0;return 0;Executed by:
executed 4610 times by 1 test: return 0;Executed by:
| 4610 | ||||||||||||||||||||||||
| 997 | } | - | ||||||||||||||||||||||||
| 998 | *in = p; | - | ||||||||||||||||||||||||
| 999 | return executed 17340 times by 1 test: 1;return 1;Executed by:
executed 17340 times by 1 test: return 1;Executed by:
| 17340 | ||||||||||||||||||||||||
| 1000 | } | - | ||||||||||||||||||||||||
| 1001 | static int asn1_collect(BUF_MEM *buf, const unsigned char **in, long len, | - | ||||||||||||||||||||||||
| 1002 | char inf, int tag, int aclass, int depth) | - | ||||||||||||||||||||||||
| 1003 | { | - | ||||||||||||||||||||||||
| 1004 | const unsigned char *p, *q; | - | ||||||||||||||||||||||||
| 1005 | long plen; | - | ||||||||||||||||||||||||
| 1006 | char cst, ininf; | - | ||||||||||||||||||||||||
| 1007 | p = *in; | - | ||||||||||||||||||||||||
| 1008 | inf &= 1; | - | ||||||||||||||||||||||||
| 1009 | - | |||||||||||||||||||||||||
| 1010 | - | |||||||||||||||||||||||||
| 1011 | - | |||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||
| 1013 | if (!buf
| 0-83235 | ||||||||||||||||||||||||
| 1014 | *in += len; | - | ||||||||||||||||||||||||
| 1015 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 1016 | } | - | ||||||||||||||||||||||||
| 1017 | while (len > 0
| 57614-94320 | ||||||||||||||||||||||||
| 1018 | q = p; | - | ||||||||||||||||||||||||
| 1019 | - | |||||||||||||||||||||||||
| 1020 | if (asn1_check_eoc(&p, len)
| 18830-75490 | ||||||||||||||||||||||||
| 1021 | - | |||||||||||||||||||||||||
| 1022 | - | |||||||||||||||||||||||||
| 1023 | - | |||||||||||||||||||||||||
| 1024 | if (!inf
| 821-18009 | ||||||||||||||||||||||||
| 1025 | ERR_put_error(13,(106),(159),__FILE__,1008); | - | ||||||||||||||||||||||||
| 1026 | return executed 821 times by 1 test: 0;return 0;Executed by:
executed 821 times by 1 test: return 0;Executed by:
| 821 | ||||||||||||||||||||||||
| 1027 | } | - | ||||||||||||||||||||||||
| 1028 | inf = 0; | - | ||||||||||||||||||||||||
| 1029 | break; executed 18009 times by 1 test: break;Executed by:
| 18009 | ||||||||||||||||||||||||
| 1030 | } | - | ||||||||||||||||||||||||
| 1031 | - | |||||||||||||||||||||||||
| 1032 | if (!asn1_check_tlen(&plen,
| 1309-74181 | ||||||||||||||||||||||||
| 1033 | ((void *)0)
| 1309-74181 | ||||||||||||||||||||||||
| 1034 | ,
| 1309-74181 | ||||||||||||||||||||||||
| 1035 | ((void *)0)
| 1309-74181 | ||||||||||||||||||||||||
| 1036 | , &ininf, &cst, &p,
| 1309-74181 | ||||||||||||||||||||||||
| 1037 | len, tag, aclass, 0,
| 1309-74181 | ||||||||||||||||||||||||
| 1038 | ((void *)0)
| 1309-74181 | ||||||||||||||||||||||||
| 1039 | )
| 1309-74181 | ||||||||||||||||||||||||
| 1040 | ERR_put_error(13,(106),(58),__FILE__,1017); | - | ||||||||||||||||||||||||
| 1041 | return executed 1309 times by 1 test: 0;return 0;Executed by:
executed 1309 times by 1 test: return 0;Executed by:
| 1309 | ||||||||||||||||||||||||
| 1042 | } | - | ||||||||||||||||||||||||
| 1043 | - | |||||||||||||||||||||||||
| 1044 | - | |||||||||||||||||||||||||
| 1045 | if (cst
| 23156-51025 | ||||||||||||||||||||||||
| 1046 | if (depth >= 5
| 542-22614 | ||||||||||||||||||||||||
| 1047 | ERR_put_error(13,(106),(197),__FILE__,1024); | - | ||||||||||||||||||||||||
| 1048 | return executed 542 times by 1 test: 0;return 0;Executed by:
executed 542 times by 1 test: return 0;Executed by:
| 542 | ||||||||||||||||||||||||
| 1049 | } | - | ||||||||||||||||||||||||
| 1050 | if (!asn1_collect(buf, &p, plen, ininf, tag, aclass, depth + 1)
| 4940-17674 | ||||||||||||||||||||||||
| 1051 | return executed 4940 times by 1 test: 0;return 0;Executed by:
executed 4940 times by 1 test: return 0;Executed by:
| 4940 | ||||||||||||||||||||||||
| 1052 | } executed 17674 times by 1 test: else if (plenend of blockExecuted by:
| 0-43604 | ||||||||||||||||||||||||
| 1053 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1054 | len -= p - q; | - | ||||||||||||||||||||||||
| 1055 | } executed 68699 times by 1 test: end of blockExecuted by:
| 68699 | ||||||||||||||||||||||||
| 1056 | if (inf
| 980-74643 | ||||||||||||||||||||||||
| 1057 | ERR_put_error(13,(106),(137),__FILE__,1034); | - | ||||||||||||||||||||||||
| 1058 | return executed 980 times by 1 test: 0;return 0;Executed by:
executed 980 times by 1 test: return 0;Executed by:
| 980 | ||||||||||||||||||||||||
| 1059 | } | - | ||||||||||||||||||||||||
| 1060 | *in = p; | - | ||||||||||||||||||||||||
| 1061 | return executed 74643 times by 1 test: 1;return 1;Executed by:
executed 74643 times by 1 test: return 1;Executed by:
| 74643 | ||||||||||||||||||||||||
| 1062 | } | - | ||||||||||||||||||||||||
| 1063 | - | |||||||||||||||||||||||||
| 1064 | static int collect_data(BUF_MEM *buf, const unsigned char **p, long plen) | - | ||||||||||||||||||||||||
| 1065 | { | - | ||||||||||||||||||||||||
| 1066 | int len; | - | ||||||||||||||||||||||||
| 1067 | if (buf
| 0-43604 | ||||||||||||||||||||||||
| 1068 | len = buf->length; | - | ||||||||||||||||||||||||
| 1069 | if (!BUF_MEM_grow_clean(buf, len + plen)
| 0-43604 | ||||||||||||||||||||||||
| 1070 | ERR_put_error(13,(140),((1|64)),__FILE__,1047); | - | ||||||||||||||||||||||||
| 1071 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1072 | } | - | ||||||||||||||||||||||||
| 1073 | memcpy(buf->data + len, *p, plen); | - | ||||||||||||||||||||||||
| 1074 | } executed 43604 times by 1 test: end of blockExecuted by:
| 43604 | ||||||||||||||||||||||||
| 1075 | *p += plen; | - | ||||||||||||||||||||||||
| 1076 | return executed 43604 times by 1 test: 1;return 1;Executed by:
executed 43604 times by 1 test: return 1;Executed by:
| 43604 | ||||||||||||||||||||||||
| 1077 | } | - | ||||||||||||||||||||||||
| 1078 | - | |||||||||||||||||||||||||
| 1079 | - | |||||||||||||||||||||||||
| 1080 | - | |||||||||||||||||||||||||
| 1081 | static int asn1_check_eoc(const unsigned char **in, long len) | - | ||||||||||||||||||||||||
| 1082 | { | - | ||||||||||||||||||||||||
| 1083 | const unsigned char *p; | - | ||||||||||||||||||||||||
| 1084 | if (len < 2
| 7707-11998177 | ||||||||||||||||||||||||
| 1085 | return executed 7707 times by 1 test: 0;return 0;Executed by:
executed 7707 times by 1 test: return 0;Executed by:
| 7707 | ||||||||||||||||||||||||
| 1086 | p = *in; | - | ||||||||||||||||||||||||
| 1087 | if (!p[0]
| 67847-9373083 | ||||||||||||||||||||||||
| 1088 | *in += 2; | - | ||||||||||||||||||||||||
| 1089 | return executed 2557247 times by 1 test: 1;return 1;Executed by:
executed 2557247 times by 1 test: return 1;Executed by:
| 2557247 | ||||||||||||||||||||||||
| 1090 | } | - | ||||||||||||||||||||||||
| 1091 | return executed 9440930 times by 2 tests: 0;return 0;Executed by:
executed 9440930 times by 2 tests: return 0;Executed by:
| 9440930 | ||||||||||||||||||||||||
| 1092 | } | - | ||||||||||||||||||||||||
| 1093 | static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, | - | ||||||||||||||||||||||||
| 1094 | char *inf, char *cst, | - | ||||||||||||||||||||||||
| 1095 | const unsigned char **in, long len, | - | ||||||||||||||||||||||||
| 1096 | int exptag, int expclass, char opt, ASN1_TLC *ctx) | - | ||||||||||||||||||||||||
| 1097 | { | - | ||||||||||||||||||||||||
| 1098 | int i; | - | ||||||||||||||||||||||||
| 1099 | int ptag, pclass; | - | ||||||||||||||||||||||||
| 1100 | long plen; | - | ||||||||||||||||||||||||
| 1101 | const unsigned char *p, *q; | - | ||||||||||||||||||||||||
| 1102 | p = *in; | - | ||||||||||||||||||||||||
| 1103 | q = p; | - | ||||||||||||||||||||||||
| 1104 | - | |||||||||||||||||||||||||
| 1105 | if (ctx
| 1454793-6014209 | ||||||||||||||||||||||||
| 1106 | i = ctx->ret; | - | ||||||||||||||||||||||||
| 1107 | plen = ctx->plen; | - | ||||||||||||||||||||||||
| 1108 | pclass = ctx->pclass; | - | ||||||||||||||||||||||||
| 1109 | ptag = ctx->ptag; | - | ||||||||||||||||||||||||
| 1110 | p += ctx->hdrlen; | - | ||||||||||||||||||||||||
| 1111 | } executed 1454793 times by 1 test: else {end of blockExecuted by:
| 1454793 | ||||||||||||||||||||||||
| 1112 | i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); | - | ||||||||||||||||||||||||
| 1113 | if (ctx
| 4559416-5526723 | ||||||||||||||||||||||||
| 1114 | ctx->ret = i; | - | ||||||||||||||||||||||||
| 1115 | ctx->plen = plen; | - | ||||||||||||||||||||||||
| 1116 | ctx->pclass = pclass; | - | ||||||||||||||||||||||||
| 1117 | ctx->ptag = ptag; | - | ||||||||||||||||||||||||
| 1118 | ctx->hdrlen = p - q; | - | ||||||||||||||||||||||||
| 1119 | ctx->valid = 1; | - | ||||||||||||||||||||||||
| 1120 | - | |||||||||||||||||||||||||
| 1121 | - | |||||||||||||||||||||||||
| 1122 | - | |||||||||||||||||||||||||
| 1123 | - | |||||||||||||||||||||||||
| 1124 | if (!(i & 0x81)
| 0-3314160 | ||||||||||||||||||||||||
| 1125 | ERR_put_error(13,(104),(155),__FILE__,1110); | - | ||||||||||||||||||||||||
| 1126 | if (ctx
never executed: ctx)->valid = 0;(ctx)->valid = 0;never executed: (ctx)->valid = 0; | 0 | ||||||||||||||||||||||||
| 1127 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1128 | } | - | ||||||||||||||||||||||||
| 1129 | } executed 4559416 times by 2 tests: end of blockExecuted by:
| 4559416 | ||||||||||||||||||||||||
| 1130 | } executed 10086139 times by 2 tests: end of blockExecuted by:
| 10086139 | ||||||||||||||||||||||||
| 1131 | - | |||||||||||||||||||||||||
| 1132 | if (i & 0x80
| 37472-11503460 | ||||||||||||||||||||||||
| 1133 | ERR_put_error(13,(104),(102),__FILE__,1118); | - | ||||||||||||||||||||||||
| 1134 | if (ctx
executed 27600 times by 1 test: ctx)->valid = 0;(ctx)->valid = 0;Executed by:
executed 27600 times by 1 test: (ctx)->valid = 0;Executed by:
| 9872-27600 | ||||||||||||||||||||||||
| 1135 | return executed 37472 times by 1 test: 0;return 0;Executed by:
executed 37472 times by 1 test: return 0;Executed by:
| 37472 | ||||||||||||||||||||||||
| 1136 | } | - | ||||||||||||||||||||||||
| 1137 | if (exptag >= 0
| 5394561-6108899 | ||||||||||||||||||||||||
| 1138 | if ((
| 16550-3995677 | ||||||||||||||||||||||||
| 1139 | - | |||||||||||||||||||||||||
| 1140 | - | |||||||||||||||||||||||||
| 1141 | - | |||||||||||||||||||||||||
| 1142 | if (opt
| 465913-949521 | ||||||||||||||||||||||||
| 1143 | return executed 949521 times by 1 test: -1;return -1;Executed by:
executed 949521 times by 1 test: return -1;Executed by:
| 949521 | ||||||||||||||||||||||||
| 1144 | if (ctx
executed 465913 times by 1 test: ctx)->valid = 0;(ctx)->valid = 0;Executed by:
executed 465913 times by 1 test: (ctx)->valid = 0;Executed by:
| 0-465913 | ||||||||||||||||||||||||
| 1145 | ERR_put_error(13,(104),(168),__FILE__,1130); | - | ||||||||||||||||||||||||
| 1146 | return executed 465913 times by 1 test: 0;return 0;Executed by:
executed 465913 times by 1 test: return 0;Executed by:
| 465913 | ||||||||||||||||||||||||
| 1147 | } | - | ||||||||||||||||||||||||
| 1148 | - | |||||||||||||||||||||||||
| 1149 | - | |||||||||||||||||||||||||
| 1150 | - | |||||||||||||||||||||||||
| 1151 | - | |||||||||||||||||||||||||
| 1152 | if (ctx
executed 3979127 times by 2 tests: ctx)->valid = 0;(ctx)->valid = 0;Executed by:
executed 3979127 times by 2 tests: (ctx)->valid = 0;Executed by:
| 0-3979127 | ||||||||||||||||||||||||
| 1153 | } executed 3979127 times by 2 tests: end of blockExecuted by:
| 3979127 | ||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||
| 1155 | if (i & 1
| 3064256-7023770 | ||||||||||||||||||||||||
| 1156 | plen = len - (p - q); executed 3064256 times by 1 test: plen = len - (p - q);Executed by:
| 3064256 | ||||||||||||||||||||||||
| 1157 | - | |||||||||||||||||||||||||
| 1158 | if (inf
| 561988-9526038 | ||||||||||||||||||||||||
| 1159 | * executed 9526038 times by 2 tests: inf = i & 1;*inf = i & 1;Executed by:
executed 9526038 times by 2 tests: *inf = i & 1;Executed by:
| 9526038 | ||||||||||||||||||||||||
| 1160 | - | |||||||||||||||||||||||||
| 1161 | if (cst
| 3669007-6419019 | ||||||||||||||||||||||||
| 1162 | * executed 3669007 times by 2 tests: cst = i & 0x20;*cst = i & 0x20;Executed by:
executed 3669007 times by 2 tests: *cst = i & 0x20;Executed by:
| 3669007 | ||||||||||||||||||||||||
| 1163 | - | |||||||||||||||||||||||||
| 1164 | if (olen
| 561988-9526038 | ||||||||||||||||||||||||
| 1165 | * executed 9526038 times by 2 tests: olen = plen;*olen = plen;Executed by:
executed 9526038 times by 2 tests: *olen = plen;Executed by:
| 9526038 | ||||||||||||||||||||||||
| 1166 | - | |||||||||||||||||||||||||
| 1167 | if (oclass
| 561988-9526038 | ||||||||||||||||||||||||
| 1168 | * executed 561988 times by 1 test: oclass = pclass;*oclass = pclass;Executed by:
executed 561988 times by 1 test: *oclass = pclass;Executed by:
| 561988 | ||||||||||||||||||||||||
| 1169 | - | |||||||||||||||||||||||||
| 1170 | if (otag
| 561988-9526038 | ||||||||||||||||||||||||
| 1171 | * executed 561988 times by 1 test: otag = ptag;*otag = ptag;Executed by:
executed 561988 times by 1 test: *otag = ptag;Executed by:
| 561988 | ||||||||||||||||||||||||
| 1172 | - | |||||||||||||||||||||||||
| 1173 | *in = p; | - | ||||||||||||||||||||||||
| 1174 | return executed 10088026 times by 2 tests: 1;return 1;Executed by:
executed 10088026 times by 2 tests: return 1;Executed by:
| 10088026 | ||||||||||||||||||||||||
| 1175 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |