| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/tasn_fre.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) | - | ||||||||||||||||||||||||
| 5 | { | - | ||||||||||||||||||||||||
| 6 | asn1_item_embed_free(&val, it, 0); | - | ||||||||||||||||||||||||
| 7 | } executed 1150500 times by 2 tests: end of blockExecuted by:
| 1150500 | ||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||||||||||||||
| 10 | { | - | ||||||||||||||||||||||||
| 11 | asn1_item_embed_free(pval, it, 0); | - | ||||||||||||||||||||||||
| 12 | } executed 629352 times by 1 test: end of blockExecuted by:
| 629352 | ||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | void asn1_item_embed_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed) | - | ||||||||||||||||||||||||
| 15 | { | - | ||||||||||||||||||||||||
| 16 | const ASN1_TEMPLATE *tt = | - | ||||||||||||||||||||||||
| 17 | ((void *)0) | - | ||||||||||||||||||||||||
| 18 | , *seqtt; | - | ||||||||||||||||||||||||
| 19 | const ASN1_EXTERN_FUNCS *ef; | - | ||||||||||||||||||||||||
| 20 | const ASN1_AUX *aux = it->funcs; | - | ||||||||||||||||||||||||
| 21 | ASN1_aux_cb *asn1_cb; | - | ||||||||||||||||||||||||
| 22 | int i; | - | ||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||
| 24 | if (!pval
| 0-7658496 | ||||||||||||||||||||||||
| 25 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 26 | if ((
| 873915-4245722 | ||||||||||||||||||||||||
| 27 | return; executed 873915 times by 1 test: return;Executed by:
| 873915 | ||||||||||||||||||||||||
| 28 | if (aux
| 208407-6050738 | ||||||||||||||||||||||||
| 29 | asn1_cb = aux->asn1_cb; executed 525436 times by 2 tests: asn1_cb = aux->asn1_cb;Executed by:
| 525436 | ||||||||||||||||||||||||
| 30 | else | - | ||||||||||||||||||||||||
| 31 | asn1_cb = 0; executed 6259145 times by 2 tests: asn1_cb = 0;Executed by:
| 6259145 | ||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | switch (it->itype) { | - | ||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | case executed 4245722 times by 2 tests: 0x0:case 0x0:Executed by:
executed 4245722 times by 2 tests: case 0x0:Executed by:
| 4245722 | ||||||||||||||||||||||||
| 36 | if (it->templates
| 191828-4053894 | ||||||||||||||||||||||||
| 37 | asn1_template_free(pval, it->templates); executed 191828 times by 1 test: asn1_template_free(pval, it->templates);Executed by:
| 191828 | ||||||||||||||||||||||||
| 38 | else | - | ||||||||||||||||||||||||
| 39 | asn1_primitive_free(pval, it, embed); executed 4053894 times by 2 tests: asn1_primitive_free(pval, it, embed);Executed by:
| 4053894 | ||||||||||||||||||||||||
| 40 | break; executed 4245722 times by 2 tests: break;Executed by:
| 4245722 | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | case executed 440593 times by 1 test: 0x5:case 0x5:Executed by:
executed 440593 times by 1 test: case 0x5:Executed by:
| 440593 | ||||||||||||||||||||||||
| 43 | asn1_primitive_free(pval, it, embed); | - | ||||||||||||||||||||||||
| 44 | break; executed 440593 times by 1 test: break;Executed by:
| 440593 | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | case executed 221755 times by 1 test: 0x2:case 0x2:Executed by:
executed 221755 times by 1 test: case 0x2:Executed by:
| 221755 | ||||||||||||||||||||||||
| 47 | if (asn1_cb
| 32587-189168 | ||||||||||||||||||||||||
| 48 | i = asn1_cb(2, pval, it, | - | ||||||||||||||||||||||||
| 49 | ((void *)0) | - | ||||||||||||||||||||||||
| 50 | ); | - | ||||||||||||||||||||||||
| 51 | if (i == 2
| 0-32587 | ||||||||||||||||||||||||
| 52 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 53 | } executed 32587 times by 1 test: end of blockExecuted by:
| 32587 | ||||||||||||||||||||||||
| 54 | i = asn1_get_choice_selector(pval, it); | - | ||||||||||||||||||||||||
| 55 | if ((
| 0-128753 | ||||||||||||||||||||||||
| 56 | ASN1_VALUE **pchval; | - | ||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | tt = it->templates + i; | - | ||||||||||||||||||||||||
| 59 | pchval = asn1_get_field_ptr(pval, tt); | - | ||||||||||||||||||||||||
| 60 | asn1_template_free(pchval, tt); | - | ||||||||||||||||||||||||
| 61 | } executed 128753 times by 1 test: end of blockExecuted by:
| 128753 | ||||||||||||||||||||||||
| 62 | if (asn1_cb
| 32587-189168 | ||||||||||||||||||||||||
| 63 | asn1_cb(3, pval, it, executed 32587 times by 1 test: asn1_cb(3, pval, it, ((void *)0) );Executed by:
| 32587 | ||||||||||||||||||||||||
| 64 | ((void *)0) executed 32587 times by 1 test: asn1_cb(3, pval, it, ((void *)0) );Executed by:
| 32587 | ||||||||||||||||||||||||
| 65 | ); executed 32587 times by 1 test: asn1_cb(3, pval, it, ((void *)0) );Executed by:
| 32587 | ||||||||||||||||||||||||
| 66 | if (embed == 0
| 5986-215769 | ||||||||||||||||||||||||
| 67 | CRYPTO_free(*pval, __FILE__, 75); | - | ||||||||||||||||||||||||
| 68 | *pval = | - | ||||||||||||||||||||||||
| 69 | ((void *)0) | - | ||||||||||||||||||||||||
| 70 | ; | - | ||||||||||||||||||||||||
| 71 | } executed 215769 times by 1 test: end of blockExecuted by:
| 215769 | ||||||||||||||||||||||||
| 72 | break; executed 221755 times by 1 test: break;Executed by:
| 221755 | ||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | case executed 162664 times by 1 test: 0x4:case 0x4:Executed by:
executed 162664 times by 1 test: case 0x4:Executed by:
| 162664 | ||||||||||||||||||||||||
| 75 | ef = it->funcs; | - | ||||||||||||||||||||||||
| 76 | if (ef
| 0-162664 | ||||||||||||||||||||||||
| 77 | ef->asn1_ex_free(pval, it); executed 162664 times by 1 test: ef->asn1_ex_free(pval, it);Executed by:
| 162664 | ||||||||||||||||||||||||
| 78 | break; executed 162664 times by 1 test: break;Executed by:
| 162664 | ||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | case executed 50927 times by 1 test: 0x6:case 0x6:Executed by:
executed 50927 times by 1 test: case 0x6:Executed by:
| 50927 | ||||||||||||||||||||||||
| 81 | case executed 1662920 times by 2 tests: 0x1:case 0x1:Executed by:
executed 1662920 times by 2 tests: case 0x1:Executed by:
| 1662920 | ||||||||||||||||||||||||
| 82 | if (asn1_do_lock(pval, -1, it) != 0
| 35281-1678566 | ||||||||||||||||||||||||
| 83 | return; executed 35281 times by 1 test: return;Executed by:
| 35281 | ||||||||||||||||||||||||
| 84 | if (asn1_cb
| 293216-1385350 | ||||||||||||||||||||||||
| 85 | i = asn1_cb(2, pval, it, | - | ||||||||||||||||||||||||
| 86 | ((void *)0) | - | ||||||||||||||||||||||||
| 87 | ); | - | ||||||||||||||||||||||||
| 88 | if (i == 2
| 27583-265633 | ||||||||||||||||||||||||
| 89 | return; executed 27583 times by 1 test: return;Executed by:
| 27583 | ||||||||||||||||||||||||
| 90 | } executed 265633 times by 1 test: end of blockExecuted by:
| 265633 | ||||||||||||||||||||||||
| 91 | asn1_enc_free(pval, it); | - | ||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | tt = it->templates + it->tcount; | - | ||||||||||||||||||||||||
| 98 | for (i = 0; i < it->tcount
| 1650983-4837158 | ||||||||||||||||||||||||
| 99 | ASN1_VALUE **pseqval; | - | ||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | tt--; | - | ||||||||||||||||||||||||
| 102 | seqtt = asn1_do_adb(pval, tt, 0); | - | ||||||||||||||||||||||||
| 103 | if (!seqtt
| 20812-4816346 | ||||||||||||||||||||||||
| 104 | continue; executed 20812 times by 1 test: continue;Executed by:
| 20812 | ||||||||||||||||||||||||
| 105 | pseqval = asn1_get_field_ptr(pval, seqtt); | - | ||||||||||||||||||||||||
| 106 | asn1_template_free(pseqval, seqtt); | - | ||||||||||||||||||||||||
| 107 | } executed 4816346 times by 2 tests: end of blockExecuted by:
| 4816346 | ||||||||||||||||||||||||
| 108 | if (asn1_cb
| 265633-1385350 | ||||||||||||||||||||||||
| 109 | asn1_cb(3, pval, it, executed 265633 times by 1 test: asn1_cb(3, pval, it, ((void *)0) );Executed by:
| 265633 | ||||||||||||||||||||||||
| 110 | ((void *)0) executed 265633 times by 1 test: asn1_cb(3, pval, it, ((void *)0) );Executed by:
| 265633 | ||||||||||||||||||||||||
| 111 | ); executed 265633 times by 1 test: asn1_cb(3, pval, it, ((void *)0) );Executed by:
| 265633 | ||||||||||||||||||||||||
| 112 | if (embed == 0
| 312117-1338866 | ||||||||||||||||||||||||
| 113 | CRYPTO_free(*pval, __FILE__, 115); | - | ||||||||||||||||||||||||
| 114 | *pval = | - | ||||||||||||||||||||||||
| 115 | ((void *)0) | - | ||||||||||||||||||||||||
| 116 | ; | - | ||||||||||||||||||||||||
| 117 | } executed 1338866 times by 2 tests: end of blockExecuted by:
| 1338866 | ||||||||||||||||||||||||
| 118 | break; executed 1650983 times by 2 tests: break;Executed by:
| 1650983 | ||||||||||||||||||||||||
| 119 | } | - | ||||||||||||||||||||||||
| 120 | } executed 6721717 times by 2 tests: end of blockExecuted by:
| 6721717 | ||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | void asn1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) | - | ||||||||||||||||||||||||
| 123 | { | - | ||||||||||||||||||||||||
| 124 | int embed = tt->flags & (0x1 << 12); | - | ||||||||||||||||||||||||
| 125 | ASN1_VALUE *tval; | - | ||||||||||||||||||||||||
| 126 | if (embed
| 783161-5293230 | ||||||||||||||||||||||||
| 127 | tval = (ASN1_VALUE *)pval; | - | ||||||||||||||||||||||||
| 128 | pval = &tval; | - | ||||||||||||||||||||||||
| 129 | } executed 783161 times by 1 test: end of blockExecuted by:
| 783161 | ||||||||||||||||||||||||
| 130 | if (tt->flags & (0x3 << 1)
| 688095-5388296 | ||||||||||||||||||||||||
| 131 | struct stack_st_ASN1_VALUE *sk = (struct stack_st_ASN1_VALUE *)*pval; | - | ||||||||||||||||||||||||
| 132 | int i; | - | ||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | for (i = 0; i < sk_ASN1_VALUE_num(sk)
| 490348-688095 | ||||||||||||||||||||||||
| 135 | ASN1_VALUE *vtmp = sk_ASN1_VALUE_value(sk, i); | - | ||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | asn1_item_embed_free(&vtmp, (tt->item), embed); | - | ||||||||||||||||||||||||
| 138 | } executed 490348 times by 1 test: end of blockExecuted by:
| 490348 | ||||||||||||||||||||||||
| 139 | sk_ASN1_VALUE_free(sk); | - | ||||||||||||||||||||||||
| 140 | *pval = | - | ||||||||||||||||||||||||
| 141 | ((void *)0) | - | ||||||||||||||||||||||||
| 142 | ; | - | ||||||||||||||||||||||||
| 143 | } executed 688095 times by 1 test: else {end of blockExecuted by:
| 688095 | ||||||||||||||||||||||||
| 144 | asn1_item_embed_free(pval, (tt->item), embed); | - | ||||||||||||||||||||||||
| 145 | } executed 5388296 times by 2 tests: end of blockExecuted by:
| 5388296 | ||||||||||||||||||||||||
| 146 | } | - | ||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||
| 148 | void asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed) | - | ||||||||||||||||||||||||
| 149 | { | - | ||||||||||||||||||||||||
| 150 | int utype; | - | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | if (it
| 237207-4494487 | ||||||||||||||||||||||||
| 154 | const ASN1_PRIMITIVE_FUNCS *pf = it->funcs; | - | ||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||
| 156 | if (embed
| 465058-4029429 | ||||||||||||||||||||||||
| 157 | if (pf
| 0-373108 | ||||||||||||||||||||||||
| 158 | pf->prim_clear(pval, it); | - | ||||||||||||||||||||||||
| 159 | return; executed 91950 times by 1 test: return;Executed by:
| 91950 | ||||||||||||||||||||||||
| 160 | } | - | ||||||||||||||||||||||||
| 161 | } executed 373108 times by 1 test: else if (pfend of blockExecuted by:
| 0-3957027 | ||||||||||||||||||||||||
| 162 | pf->prim_free(pval, it); | - | ||||||||||||||||||||||||
| 163 | return; executed 72402 times by 2 tests: return;Executed by:
| 72402 | ||||||||||||||||||||||||
| 164 | } | - | ||||||||||||||||||||||||
| 165 | } executed 4330135 times by 2 tests: end of blockExecuted by:
| 4330135 | ||||||||||||||||||||||||
| 166 | - | |||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||
| 168 | if (!it
| 237207-4330135 | ||||||||||||||||||||||||
| 169 | ASN1_TYPE *typ = (ASN1_TYPE *)*pval; | - | ||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||
| 171 | utype = typ->type; | - | ||||||||||||||||||||||||
| 172 | pval = &typ->value.asn1_value; | - | ||||||||||||||||||||||||
| 173 | if (!*pval
| 52418-184789 | ||||||||||||||||||||||||
| 174 | return; executed 52418 times by 1 test: return;Executed by:
| 52418 | ||||||||||||||||||||||||
| 175 | } executed 184789 times by 1 test: else if (it->itype == 0x5end of blockExecuted by:
| 184789-3889542 | ||||||||||||||||||||||||
| 176 | utype = -1; | - | ||||||||||||||||||||||||
| 177 | if (!*pval
| 0-440593 | ||||||||||||||||||||||||
| 178 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 179 | } executed 440593 times by 1 test: else {end of blockExecuted by:
| 440593 | ||||||||||||||||||||||||
| 180 | utype = it->utype; | - | ||||||||||||||||||||||||
| 181 | if ((
| 673290-3216252 | ||||||||||||||||||||||||
| 182 | return; executed 1181928 times by 1 test: return;Executed by:
| 1181928 | ||||||||||||||||||||||||
| 183 | } executed 2707614 times by 2 tests: end of blockExecuted by:
| 2707614 | ||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||
| 185 | switch (utype) { | - | ||||||||||||||||||||||||
| 186 | case executed 974308 times by 1 test: 6:case 6:Executed by:
executed 974308 times by 1 test: case 6:Executed by:
| 974308 | ||||||||||||||||||||||||
| 187 | ASN1_OBJECT_free((ASN1_OBJECT *)*pval); | - | ||||||||||||||||||||||||
| 188 | break; executed 974308 times by 1 test: break;Executed by:
| 974308 | ||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | case executed 674231 times by 1 test: 1:case 1:Executed by:
executed 674231 times by 1 test: case 1:Executed by:
| 674231 | ||||||||||||||||||||||||
| 191 | if (it
| 941-673290 | ||||||||||||||||||||||||
| 192 | *( executed 673290 times by 1 test: ASN1_BOOLEAN *)pval = it->size;*(ASN1_BOOLEAN *)pval = it->size;Executed by:
executed 673290 times by 1 test: *(ASN1_BOOLEAN *)pval = it->size;Executed by:
| 673290 | ||||||||||||||||||||||||
| 193 | else | - | ||||||||||||||||||||||||
| 194 | *( executed 941 times by 1 test: ASN1_BOOLEAN *)pval = -1;*(ASN1_BOOLEAN *)pval = -1;Executed by:
executed 941 times by 1 test: *(ASN1_BOOLEAN *)pval = -1;Executed by:
| 941 | ||||||||||||||||||||||||
| 195 | return; executed 674231 times by 1 test: return;Executed by:
| 674231 | ||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | case executed 1162 times by 1 test: 5:case 5:Executed by:
executed 1162 times by 1 test: case 5:Executed by:
| 1162 | ||||||||||||||||||||||||
| 198 | break; executed 1162 times by 1 test: break;Executed by:
| 1162 | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | case executed 237207 times by 1 test: -4:case -4:Executed by:
executed 237207 times by 1 test: case -4:Executed by:
| 237207 | ||||||||||||||||||||||||
| 201 | asn1_primitive_free(pval, | - | ||||||||||||||||||||||||
| 202 | ((void *)0) | - | ||||||||||||||||||||||||
| 203 | , 0); | - | ||||||||||||||||||||||||
| 204 | CRYPTO_free(*pval, __FILE__, 200); | - | ||||||||||||||||||||||||
| 205 | break; executed 237207 times by 1 test: break;Executed by:
| 237207 | ||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||
| 207 | default executed 1446088 times by 2 tests: :default:Executed by:
executed 1446088 times by 2 tests: default:Executed by:
| 1446088 | ||||||||||||||||||||||||
| 208 | asn1_string_embed_free((ASN1_STRING *)*pval, embed); | - | ||||||||||||||||||||||||
| 209 | break; executed 1446088 times by 2 tests: break;Executed by:
| 1446088 | ||||||||||||||||||||||||
| 210 | } | - | ||||||||||||||||||||||||
| 211 | *pval = | - | ||||||||||||||||||||||||
| 212 | ((void *)0) | - | ||||||||||||||||||||||||
| 213 | ; | - | ||||||||||||||||||||||||
| 214 | } executed 2658765 times by 2 tests: end of blockExecuted by:
| 2658765 | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |