| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/tasn_utl.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | int | - | ||||||||||||
| 2 | asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||
| 3 | { | - | ||||||||||||
| 4 | int *sel = (void *)(((char *) *pval) + it->utype); | - | ||||||||||||
| 5 | return executed 276 times by 3 tests: *sel;return *sel;Executed by:
executed 276 times by 3 tests: return *sel;Executed by:
| 276 | ||||||||||||
| 6 | } | - | ||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | - | |||||||||||||
| 10 | - | |||||||||||||
| 11 | - | |||||||||||||
| 12 | int | - | ||||||||||||
| 13 | asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it) | - | ||||||||||||
| 14 | { | - | ||||||||||||
| 15 | int *sel, ret; | - | ||||||||||||
| 16 | sel = (void *)(((char *) *pval) + it->utype); | - | ||||||||||||
| 17 | ret = *sel; | - | ||||||||||||
| 18 | *sel = value; | - | ||||||||||||
| 19 | return executed 96 times by 2 tests: ret;return ret;Executed by:
executed 96 times by 2 tests: return ret;Executed by:
| 96 | ||||||||||||
| 20 | } | - | ||||||||||||
| 21 | - | |||||||||||||
| 22 | - | |||||||||||||
| 23 | - | |||||||||||||
| 24 | - | |||||||||||||
| 25 | - | |||||||||||||
| 26 | - | |||||||||||||
| 27 | - | |||||||||||||
| 28 | int | - | ||||||||||||
| 29 | asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it) | - | ||||||||||||
| 30 | { | - | ||||||||||||
| 31 | const ASN1_AUX *aux; | - | ||||||||||||
| 32 | int *lck, ret; | - | ||||||||||||
| 33 | - | |||||||||||||
| 34 | if ((
| 31-14777 | ||||||||||||
| 35 | (
| 0-31 | ||||||||||||
| 36 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 37 | aux = it->funcs; | - | ||||||||||||
| 38 | if (!aux
| 1032-12729 | ||||||||||||
| 39 | return executed 13761 times by 10 tests: 0;return 0;Executed by:
executed 13761 times by 10 tests: return 0;Executed by:
| 13761 | ||||||||||||
| 40 | lck = (void *)(((char *) *pval) + aux->ref_offset); | - | ||||||||||||
| 41 | if (op == 0
| 251-796 | ||||||||||||
| 42 | *lck = 1; | - | ||||||||||||
| 43 | return executed 251 times by 8 tests: 1;return 1;Executed by:
executed 251 times by 8 tests: return 1;Executed by:
| 251 | ||||||||||||
| 44 | } | - | ||||||||||||
| 45 | ret = CRYPTO_add_lock(lck,op,aux->ref_lock,__FILE__,119); | - | ||||||||||||
| 46 | return executed 796 times by 8 tests: ret;return ret;Executed by:
executed 796 times by 8 tests: return ret;Executed by:
| 796 | ||||||||||||
| 47 | } | - | ||||||||||||
| 48 | - | |||||||||||||
| 49 | static ASN1_ENCODING * | - | ||||||||||||
| 50 | asn1_get_enc_ptr(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||
| 51 | { | - | ||||||||||||
| 52 | const ASN1_AUX *aux; | - | ||||||||||||
| 53 | - | |||||||||||||
| 54 | if (!pval
| 0-30336 | ||||||||||||
| 55 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 56 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 57 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 58 | aux = it->funcs; | - | ||||||||||||
| 59 | if (!aux
| 1830-25635 | ||||||||||||
| 60 | return executed 28506 times by 11 tests: return ((void *)0) ;Executed by:
executed 28506 times by 11 tests: return ((void *)0) ;Executed by:
| 28506 | ||||||||||||
| 61 | ((void *)0) executed 28506 times by 11 tests: return ((void *)0) ;Executed by:
| 28506 | ||||||||||||
| 62 | ; executed 28506 times by 11 tests: return ((void *)0) ;Executed by:
| 28506 | ||||||||||||
| 63 | return executed 1830 times by 8 tests: (void *)(((char *) *pval) + aux->enc_offset);return (void *)(((char *) *pval) + aux->enc_offset);Executed by:
executed 1830 times by 8 tests: return (void *)(((char *) *pval) + aux->enc_offset);Executed by:
| 1830 | ||||||||||||
| 64 | } | - | ||||||||||||
| 65 | - | |||||||||||||
| 66 | void | - | ||||||||||||
| 67 | asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||
| 68 | { | - | ||||||||||||
| 69 | ASN1_ENCODING *enc; | - | ||||||||||||
| 70 | - | |||||||||||||
| 71 | enc = asn1_get_enc_ptr(pval, it); | - | ||||||||||||
| 72 | if (enc
| 251-6942 | ||||||||||||
| 73 | enc->enc = | - | ||||||||||||
| 74 | ((void *)0) | - | ||||||||||||
| 75 | ; | - | ||||||||||||
| 76 | enc->len = 0; | - | ||||||||||||
| 77 | enc->modified = 1; | - | ||||||||||||
| 78 | } executed 251 times by 8 tests: end of blockExecuted by:
| 251 | ||||||||||||
| 79 | } executed 7193 times by 10 tests: end of blockExecuted by:
| 7193 | ||||||||||||
| 80 | - | |||||||||||||
| 81 | void | - | ||||||||||||
| 82 | asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | - | ||||||||||||
| 83 | { | - | ||||||||||||
| 84 | ASN1_ENCODING *enc; | - | ||||||||||||
| 85 | - | |||||||||||||
| 86 | enc = asn1_get_enc_ptr(pval, it); | - | ||||||||||||
| 87 | if (enc
| 246-6819 | ||||||||||||
| 88 | free(enc->enc); | - | ||||||||||||
| 89 | enc->enc = | - | ||||||||||||
| 90 | ((void *)0) | - | ||||||||||||
| 91 | ; | - | ||||||||||||
| 92 | enc->len = 0; | - | ||||||||||||
| 93 | enc->modified = 1; | - | ||||||||||||
| 94 | } executed 246 times by 7 tests: end of blockExecuted by:
| 246 | ||||||||||||
| 95 | } executed 7065 times by 10 tests: end of blockExecuted by:
| 7065 | ||||||||||||
| 96 | - | |||||||||||||
| 97 | int | - | ||||||||||||
| 98 | asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, | - | ||||||||||||
| 99 | const ASN1_ITEM *it) | - | ||||||||||||
| 100 | { | - | ||||||||||||
| 101 | ASN1_ENCODING *enc; | - | ||||||||||||
| 102 | - | |||||||||||||
| 103 | enc = asn1_get_enc_ptr(pval, it); | - | ||||||||||||
| 104 | if (!enc
| 219-5047 | ||||||||||||
| 105 | return executed 5047 times by 11 tests: 1;return 1;Executed by:
executed 5047 times by 11 tests: return 1;Executed by:
| 5047 | ||||||||||||
| 106 | - | |||||||||||||
| 107 | free(enc->enc); | - | ||||||||||||
| 108 | enc->enc = malloc(inlen); | - | ||||||||||||
| 109 | if (!enc->enc
| 0-219 | ||||||||||||
| 110 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 111 | memcpy(enc->enc, in, inlen); | - | ||||||||||||
| 112 | enc->len = inlen; | - | ||||||||||||
| 113 | enc->modified = 0; | - | ||||||||||||
| 114 | - | |||||||||||||
| 115 | return executed 219 times by 7 tests: 1;return 1;Executed by:
executed 219 times by 7 tests: return 1;Executed by:
| 219 | ||||||||||||
| 116 | } | - | ||||||||||||
| 117 | - | |||||||||||||
| 118 | int | - | ||||||||||||
| 119 | asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, | - | ||||||||||||
| 120 | const ASN1_ITEM *it) | - | ||||||||||||
| 121 | { | - | ||||||||||||
| 122 | ASN1_ENCODING *enc; | - | ||||||||||||
| 123 | - | |||||||||||||
| 124 | enc = asn1_get_enc_ptr(pval, it); | - | ||||||||||||
| 125 | if (!enc
| 10-9698 | ||||||||||||
| 126 | return executed 9708 times by 11 tests: 0;return 0;Executed by:
executed 9708 times by 11 tests: return 0;Executed by:
| 9708 | ||||||||||||
| 127 | if (out
| 388-716 | ||||||||||||
| 128 | memcpy(*out, enc->enc, enc->len); | - | ||||||||||||
| 129 | *out += enc->len; | - | ||||||||||||
| 130 | } executed 388 times by 6 tests: end of blockExecuted by:
| 388 | ||||||||||||
| 131 | if (len
| 0-1104 | ||||||||||||
| 132 | * executed 1104 times by 6 tests: len = enc->len;*len = enc->len;Executed by:
executed 1104 times by 6 tests: *len = enc->len;Executed by:
| 1104 | ||||||||||||
| 133 | return executed 1104 times by 6 tests: 1;return 1;Executed by:
executed 1104 times by 6 tests: return 1;Executed by:
| 1104 | ||||||||||||
| 134 | } | - | ||||||||||||
| 135 | - | |||||||||||||
| 136 | - | |||||||||||||
| 137 | ASN1_VALUE ** | - | ||||||||||||
| 138 | asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) | - | ||||||||||||
| 139 | { | - | ||||||||||||
| 140 | ASN1_VALUE **pvaltmp; | - | ||||||||||||
| 141 | - | |||||||||||||
| 142 | if (tt->flags & (0x1<<10)
| 168-77642 | ||||||||||||
| 143 | return executed 168 times by 1 test: pval;return pval;Executed by:
executed 168 times by 1 test: return pval;Executed by:
| 168 | ||||||||||||
| 144 | pvaltmp = (void *)(((char *) *pval) + tt->offset); | - | ||||||||||||
| 145 | - | |||||||||||||
| 146 | - | |||||||||||||
| 147 | - | |||||||||||||
| 148 | - | |||||||||||||
| 149 | return executed 77642 times by 11 tests: pvaltmp;return pvaltmp;Executed by:
executed 77642 times by 11 tests: return pvaltmp;Executed by:
| 77642 | ||||||||||||
| 150 | } | - | ||||||||||||
| 151 | - | |||||||||||||
| 152 | - | |||||||||||||
| 153 | - | |||||||||||||
| 154 | - | |||||||||||||
| 155 | - | |||||||||||||
| 156 | const ASN1_TEMPLATE * | - | ||||||||||||
| 157 | asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr) | - | ||||||||||||
| 158 | { | - | ||||||||||||
| 159 | const ASN1_ADB *adb; | - | ||||||||||||
| 160 | const ASN1_ADB_TABLE *atbl; | - | ||||||||||||
| 161 | long selector; | - | ||||||||||||
| 162 | ASN1_VALUE **sfld; | - | ||||||||||||
| 163 | int i; | - | ||||||||||||
| 164 | - | |||||||||||||
| 165 | if (!(tt->flags & (0x3<<8))
| 39-59911 | ||||||||||||
| 166 | return executed 59911 times by 11 tests: tt;return tt;Executed by:
executed 59911 times by 11 tests: return tt;Executed by:
| 59911 | ||||||||||||
| 167 | - | |||||||||||||
| 168 | - | |||||||||||||
| 169 | adb = (const ASN1_ADB *)tt->item; | - | ||||||||||||
| 170 | - | |||||||||||||
| 171 | - | |||||||||||||
| 172 | sfld = (void *)(((char *) *pval) + adb->offset); | - | ||||||||||||
| 173 | - | |||||||||||||
| 174 | - | |||||||||||||
| 175 | if (!sfld
| 0-39 | ||||||||||||
| 176 | if (!adb->null_tt
| 0 | ||||||||||||
| 177 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 178 | return never executed: adb->null_tt;return adb->null_tt;never executed: return adb->null_tt; | 0 | ||||||||||||
| 179 | } | - | ||||||||||||
| 180 | - | |||||||||||||
| 181 | - | |||||||||||||
| 182 | - | |||||||||||||
| 183 | - | |||||||||||||
| 184 | - | |||||||||||||
| 185 | if (tt->flags & (0x1<<8)
| 0-39 | ||||||||||||
| 186 | selector = OBJ_obj2nid((ASN1_OBJECT *)*sfld); executed 39 times by 1 test: selector = OBJ_obj2nid((ASN1_OBJECT *)*sfld);Executed by:
| 39 | ||||||||||||
| 187 | else | - | ||||||||||||
| 188 | selector = ASN1_INTEGER_get((ASN1_INTEGER *)*sfld); never executed: selector = ASN1_INTEGER_get((ASN1_INTEGER *)*sfld); | 0 | ||||||||||||
| 189 | for (atbl = adb->tbl, i = 0; i < adb->tblcount
| 7-94 | ||||||||||||
| 190 | if (atbl->value == selector
| 32-62 | ||||||||||||
| 191 | return executed 32 times by 1 test: &atbl->tt;return &atbl->tt;Executed by:
executed 32 times by 1 test: return &atbl->tt;Executed by:
| 32 | ||||||||||||
| 192 | - | |||||||||||||
| 193 | - | |||||||||||||
| 194 | - | |||||||||||||
| 195 | - | |||||||||||||
| 196 | if (!adb->default_tt
| 0-7 | ||||||||||||
| 197 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||
| 198 | return executed 7 times by 1 test: adb->default_tt;return adb->default_tt;Executed by:
executed 7 times by 1 test: return adb->default_tt;Executed by:
| 7 | ||||||||||||
| 199 | - | |||||||||||||
| 200 | err: | - | ||||||||||||
| 201 | - | |||||||||||||
| 202 | if (nullerr
| 0 | ||||||||||||
| 203 | ERR_put_error(13,(0xfff),(164),__FILE__,278); never executed: ERR_put_error(13,(0xfff),(164),__FILE__,278); | 0 | ||||||||||||
| 204 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 205 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 206 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 207 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |