| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/a_int.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x) | - | ||||||||||||||||||||||||
| 4 | { | - | ||||||||||||||||||||||||
| 5 | return executed 41 times by 1 test: ASN1_STRING_dup(x);return ASN1_STRING_dup(x);Executed by:
executed 41 times by 1 test: return ASN1_STRING_dup(x);Executed by:
| 41 | ||||||||||||||||||||||||
| 6 | } | - | ||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y) | - | ||||||||||||||||||||||||
| 9 | { | - | ||||||||||||||||||||||||
| 10 | int neg, ret; | - | ||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | neg = x->type & 0x100; | - | ||||||||||||||||||||||||
| 13 | if (neg != (y->type & 0x100)
| 6-319 | ||||||||||||||||||||||||
| 14 | if (neg
| 3 | ||||||||||||||||||||||||
| 15 | return executed 3 times by 1 test: -1;return -1;Executed by:
executed 3 times by 1 test: return -1;Executed by:
| 3 | ||||||||||||||||||||||||
| 16 | else | - | ||||||||||||||||||||||||
| 17 | return executed 3 times by 1 test: 1;return 1;Executed by:
executed 3 times by 1 test: return 1;Executed by:
| 3 | ||||||||||||||||||||||||
| 18 | } | - | ||||||||||||||||||||||||
| 19 | - | |||||||||||||||||||||||||
| 20 | ret = ASN1_STRING_cmp(x, y); | - | ||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||
| 22 | if (neg
| 3-316 | ||||||||||||||||||||||||
| 23 | return executed 3 times by 1 test: -ret;return -ret;Executed by:
executed 3 times by 1 test: return -ret;Executed by:
| 3 | ||||||||||||||||||||||||
| 24 | else | - | ||||||||||||||||||||||||
| 25 | return executed 316 times by 1 test: ret;return ret;Executed by:
executed 316 times by 1 test: return ret;Executed by:
| 316 | ||||||||||||||||||||||||
| 26 | } | - | ||||||||||||||||||||||||
| 27 | static void twos_complement(unsigned char *dst, const unsigned char *src, | - | ||||||||||||||||||||||||
| 28 | size_t len, unsigned char pad) | - | ||||||||||||||||||||||||
| 29 | { | - | ||||||||||||||||||||||||
| 30 | unsigned int carry = pad & 1; | - | ||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | dst += len; | - | ||||||||||||||||||||||||
| 34 | src += len; | - | ||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | while (len-- != 0
| 242080-1668979 | ||||||||||||||||||||||||
| 37 | *(--dst) = (unsigned char)(carry += *(--src) ^ pad); | - | ||||||||||||||||||||||||
| 38 | carry >>= 8; | - | ||||||||||||||||||||||||
| 39 | } executed 1668979 times by 1 test: end of blockExecuted by:
| 1668979 | ||||||||||||||||||||||||
| 40 | } executed 242080 times by 1 test: end of blockExecuted by:
| 242080 | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | static size_t i2c_ibuf(const unsigned char *b, size_t blen, int neg, | - | ||||||||||||||||||||||||
| 43 | unsigned char **pp) | - | ||||||||||||||||||||||||
| 44 | { | - | ||||||||||||||||||||||||
| 45 | unsigned int pad = 0; | - | ||||||||||||||||||||||||
| 46 | size_t ret, i; | - | ||||||||||||||||||||||||
| 47 | unsigned char *p, pb = 0; | - | ||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | if (b !=
| 0-256127 | ||||||||||||||||||||||||
| 50 | ((void *)0)
| 0-256127 | ||||||||||||||||||||||||
| 51 | && blen
| 1-256126 | ||||||||||||||||||||||||
| 52 | ret = blen; | - | ||||||||||||||||||||||||
| 53 | i = b[0]; | - | ||||||||||||||||||||||||
| 54 | if (!neg
| 15700-198059 | ||||||||||||||||||||||||
| 55 | pad = 1; | - | ||||||||||||||||||||||||
| 56 | pb = 0; | - | ||||||||||||||||||||||||
| 57 | } executed 15700 times by 1 test: else if (negend of blockExecuted by:
| 15700-182359 | ||||||||||||||||||||||||
| 58 | pb = 0xFF; | - | ||||||||||||||||||||||||
| 59 | if (i > 128
| 8692-49375 | ||||||||||||||||||||||||
| 60 | pad = 1; | - | ||||||||||||||||||||||||
| 61 | } executed 8692 times by 1 test: else if (i == 128end of blockExecuted by:
| 8692-32483 | ||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | for (pad = 0, i = 1; i < blen
| 32483-1032271 | ||||||||||||||||||||||||
| 67 | pad |= b[i]; executed 1032271 times by 1 test: pad |= b[i];Executed by:
| 1032271 | ||||||||||||||||||||||||
| 68 | pb = pad != 0
| 10835-21648 | ||||||||||||||||||||||||
| 69 | pad = pb & 1; | - | ||||||||||||||||||||||||
| 70 | } executed 32483 times by 1 test: end of blockExecuted by:
| 32483 | ||||||||||||||||||||||||
| 71 | } executed 58067 times by 1 test: end of blockExecuted by:
| 58067 | ||||||||||||||||||||||||
| 72 | ret += pad; | - | ||||||||||||||||||||||||
| 73 | } executed 256126 times by 1 test: else {end of blockExecuted by:
| 256126 | ||||||||||||||||||||||||
| 74 | ret = 1; | - | ||||||||||||||||||||||||
| 75 | blen = 0; | - | ||||||||||||||||||||||||
| 76 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | if (pp ==
| 109033-147094 | ||||||||||||||||||||||||
| 79 | ((void *)0)
| 109033-147094 | ||||||||||||||||||||||||
| 80 | || (
| 42652-104442 | ||||||||||||||||||||||||
| 81 | ((void *)0)
| 42652-104442 | ||||||||||||||||||||||||
| 82 | ) | - | ||||||||||||||||||||||||
| 83 | return executed 213475 times by 1 test: ret;return ret;Executed by:
executed 213475 times by 1 test: return ret;Executed by:
| 213475 | ||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||
| 90 | *p = pb; | - | ||||||||||||||||||||||||
| 91 | p += pad; | - | ||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | twos_complement(p, b, blen, pb); | - | ||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | *pp += ret; | - | ||||||||||||||||||||||||
| 96 | return executed 42652 times by 1 test: ret;return ret;Executed by:
executed 42652 times by 1 test: return ret;Executed by:
| 42652 | ||||||||||||||||||||||||
| 97 | } | - | ||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | static size_t c2i_ibuf(unsigned char *b, int *pneg, | - | ||||||||||||||||||||||||
| 106 | const unsigned char *p, size_t plen) | - | ||||||||||||||||||||||||
| 107 | { | - | ||||||||||||||||||||||||
| 108 | int neg, pad; | - | ||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | if (plen == 0
| 4801-619073 | ||||||||||||||||||||||||
| 111 | ERR_put_error(13,(226),(222),__FILE__,154); | - | ||||||||||||||||||||||||
| 112 | return executed 4801 times by 1 test: 0;return 0;Executed by:
executed 4801 times by 1 test: return 0;Executed by:
| 4801 | ||||||||||||||||||||||||
| 113 | } | - | ||||||||||||||||||||||||
| 114 | neg = p[0] & 0x80; | - | ||||||||||||||||||||||||
| 115 | if (pneg
| 308110-310963 | ||||||||||||||||||||||||
| 116 | * executed 308110 times by 1 test: pneg = neg;*pneg = neg;Executed by:
executed 308110 times by 1 test: *pneg = neg;Executed by:
| 308110 | ||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | if (plen == 1
| 217364-401709 | ||||||||||||||||||||||||
| 119 | if (b !=
| 108682 | ||||||||||||||||||||||||
| 120 | ((void *)0)
| 108682 | ||||||||||||||||||||||||
| 121 | ) { | - | ||||||||||||||||||||||||
| 122 | if (neg
| 21152-87530 | ||||||||||||||||||||||||
| 123 | b[0] = (p[0] ^ 0xFF) + 1; executed 21152 times by 1 test: b[0] = (p[0] ^ 0xFF) + 1;Executed by:
| 21152 | ||||||||||||||||||||||||
| 124 | else | - | ||||||||||||||||||||||||
| 125 | b[0] = p[0]; executed 87530 times by 1 test: b[0] = p[0];Executed by:
| 87530 | ||||||||||||||||||||||||
| 126 | } | - | ||||||||||||||||||||||||
| 127 | return executed 217364 times by 1 test: 1;return 1;Executed by:
executed 217364 times by 1 test: return 1;Executed by:
| 217364 | ||||||||||||||||||||||||
| 128 | } | - | ||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||
| 130 | pad = 0; | - | ||||||||||||||||||||||||
| 131 | if (p[0] == 0
| 34506-367203 | ||||||||||||||||||||||||
| 132 | pad = 1; | - | ||||||||||||||||||||||||
| 133 | } executed 34506 times by 1 test: else if (p[0] == 0xFFend of blockExecuted by:
| 17549-349654 | ||||||||||||||||||||||||
| 134 | size_t i; | - | ||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||
| 140 | for (pad = 0, i = 1; i < plen
| 17549-379365 | ||||||||||||||||||||||||
| 141 | pad |= p[i]; executed 379365 times by 1 test: pad |= p[i];Executed by:
| 379365 | ||||||||||||||||||||||||
| 142 | pad = pad != 0
| 3184-14365 | ||||||||||||||||||||||||
| 143 | } executed 17549 times by 1 test: end of blockExecuted by:
| 17549 | ||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||
| 145 | if (pad
| 2513-352838 | ||||||||||||||||||||||||
| 146 | ERR_put_error(13,(226),(221),__FILE__,187); | - | ||||||||||||||||||||||||
| 147 | return executed 2513 times by 1 test: 0;return 0;Executed by:
executed 2513 times by 1 test: return 0;Executed by:
| 2513 | ||||||||||||||||||||||||
| 148 | } | - | ||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | - | |||||||||||||||||||||||||
| 151 | p += pad; | - | ||||||||||||||||||||||||
| 152 | plen -= pad; | - | ||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||
| 154 | if (b !=
| 199428-199768 | ||||||||||||||||||||||||
| 155 | ((void *)0)
| 199428-199768 | ||||||||||||||||||||||||
| 156 | ) | - | ||||||||||||||||||||||||
| 157 | twos_complement(b, p, plen, neg ? 0xffU : 0); executed 199428 times by 1 test: twos_complement(b, p, plen, neg ? 0xffU : 0);Executed by:
| 199428 | ||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||
| 159 | return executed 399196 times by 1 test: plen;return plen;Executed by:
executed 399196 times by 1 test: return plen;Executed by:
| 399196 | ||||||||||||||||||||||||
| 160 | } | - | ||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||
| 162 | int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp) | - | ||||||||||||||||||||||||
| 163 | { | - | ||||||||||||||||||||||||
| 164 | return executed 127207 times by 1 test: i2c_ibuf(a->data, a->length, a->type & 0x100, pp);return i2c_ibuf(a->data, a->length, a->type & 0x100, pp);Executed by:
executed 127207 times by 1 test: return i2c_ibuf(a->data, a->length, a->type & 0x100, pp);Executed by:
| 127207 | ||||||||||||||||||||||||
| 165 | } | - | ||||||||||||||||||||||||
| 166 | - | |||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||
| 168 | static int asn1_get_uint64(uint64_t *pr, const unsigned char *b, size_t blen) | - | ||||||||||||||||||||||||
| 169 | { | - | ||||||||||||||||||||||||
| 170 | size_t i; | - | ||||||||||||||||||||||||
| 171 | uint64_t r; | - | ||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | if (blen > sizeof(*pr)
| 30-62789 | ||||||||||||||||||||||||
| 174 | ERR_put_error(13,(225),(223),__FILE__,213); | - | ||||||||||||||||||||||||
| 175 | return executed 30 times by 1 test: 0;return 0;Executed by:
executed 30 times by 1 test: return 0;Executed by:
| 30 | ||||||||||||||||||||||||
| 176 | } | - | ||||||||||||||||||||||||
| 177 | if (b ==
| 0-62789 | ||||||||||||||||||||||||
| 178 | ((void *)0)
| 0-62789 | ||||||||||||||||||||||||
| 179 | ) | - | ||||||||||||||||||||||||
| 180 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 181 | for (r = 0, i = 0; i < blen
| 62789-108187 | ||||||||||||||||||||||||
| 182 | r <<= 8; | - | ||||||||||||||||||||||||
| 183 | r |= b[i]; | - | ||||||||||||||||||||||||
| 184 | } executed 108187 times by 1 test: end of blockExecuted by:
| 108187 | ||||||||||||||||||||||||
| 185 | *pr = r; | - | ||||||||||||||||||||||||
| 186 | return executed 62789 times by 1 test: 1;return 1;Executed by:
executed 62789 times by 1 test: return 1;Executed by:
| 62789 | ||||||||||||||||||||||||
| 187 | } | - | ||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||
| 194 | static size_t asn1_put_uint64(unsigned char b[sizeof(uint64_t)], uint64_t r) | - | ||||||||||||||||||||||||
| 195 | { | - | ||||||||||||||||||||||||
| 196 | size_t off = sizeof(uint64_t); | - | ||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||
| 198 | do { | - | ||||||||||||||||||||||||
| 199 | b[--off] = (unsigned char)r; | - | ||||||||||||||||||||||||
| 200 | } executed 255170 times by 1 test: while (r >>= 8end of blockExecuted by:
| 125419-255170 | ||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||
| 202 | return executed 129751 times by 1 test: off;return off;Executed by:
executed 129751 times by 1 test: return off;Executed by:
| 129751 | ||||||||||||||||||||||||
| 203 | } | - | ||||||||||||||||||||||||
| 204 | static int asn1_get_int64(int64_t *pr, const unsigned char *b, size_t blen, | - | ||||||||||||||||||||||||
| 205 | int neg) | - | ||||||||||||||||||||||||
| 206 | { | - | ||||||||||||||||||||||||
| 207 | uint64_t r; | - | ||||||||||||||||||||||||
| 208 | if (asn1_get_uint64(&r, b, blen) == 0
| 30-20421 | ||||||||||||||||||||||||
| 209 | return executed 30 times by 1 test: 0;return 0;Executed by:
executed 30 times by 1 test: return 0;Executed by:
| 30 | ||||||||||||||||||||||||
| 210 | if (neg
| 2587-17834 | ||||||||||||||||||||||||
| 211 | if (r <=
| 1202-1385 | ||||||||||||||||||||||||
| 212 | (9223372036854775807L)
| 1202-1385 | ||||||||||||||||||||||||
| 213 | ) { | - | ||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | *pr = -(int64_t)r; | - | ||||||||||||||||||||||||
| 217 | } executed 1385 times by 1 test: else if (r == ((uint64_t)end of blockExecuted by:
| 587-1385 | ||||||||||||||||||||||||
| 218 | (9223372036854775807L)
| 587-615 | ||||||||||||||||||||||||
| 219 | + (-(
| 587-615 | ||||||||||||||||||||||||
| 220 | (-9223372036854775807L -1)
| 587-615 | ||||||||||||||||||||||||
| 221 | +
| 587-615 | ||||||||||||||||||||||||
| 222 | (9223372036854775807L)
| 587-615 | ||||||||||||||||||||||||
| 223 | )))
| 587-615 | ||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | *pr = (int64_t)(0 - r); | - | ||||||||||||||||||||||||
| 227 | } executed 587 times by 1 test: else {end of blockExecuted by:
| 587 | ||||||||||||||||||||||||
| 228 | ERR_put_error(13,(224),(224),__FILE__,265); | - | ||||||||||||||||||||||||
| 229 | return executed 615 times by 1 test: 0;return 0;Executed by:
executed 615 times by 1 test: return 0;Executed by:
| 615 | ||||||||||||||||||||||||
| 230 | } | - | ||||||||||||||||||||||||
| 231 | } else { | - | ||||||||||||||||||||||||
| 232 | if (r <=
| 713-17121 | ||||||||||||||||||||||||
| 233 | (9223372036854775807L)
| 713-17121 | ||||||||||||||||||||||||
| 234 | ) { | - | ||||||||||||||||||||||||
| 235 | *pr = (int64_t)r; | - | ||||||||||||||||||||||||
| 236 | } executed 17121 times by 1 test: else {end of blockExecuted by:
| 17121 | ||||||||||||||||||||||||
| 237 | ERR_put_error(13,(224),(223),__FILE__,272); | - | ||||||||||||||||||||||||
| 238 | return executed 713 times by 1 test: 0;return 0;Executed by:
executed 713 times by 1 test: return 0;Executed by:
| 713 | ||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||
| 240 | } | - | ||||||||||||||||||||||||
| 241 | return executed 19093 times by 1 test: 1;return 1;Executed by:
executed 19093 times by 1 test: return 1;Executed by:
| 19093 | ||||||||||||||||||||||||
| 242 | } | - | ||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| 245 | ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, | - | ||||||||||||||||||||||||
| 246 | long len) | - | ||||||||||||||||||||||||
| 247 | { | - | ||||||||||||||||||||||||
| 248 | ASN1_INTEGER *ret = | - | ||||||||||||||||||||||||
| 249 | ((void *)0) | - | ||||||||||||||||||||||||
| 250 | ; | - | ||||||||||||||||||||||||
| 251 | size_t r; | - | ||||||||||||||||||||||||
| 252 | int neg; | - | ||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||
| 254 | r = c2i_ibuf( | - | ||||||||||||||||||||||||
| 255 | ((void *)0) | - | ||||||||||||||||||||||||
| 256 | , | - | ||||||||||||||||||||||||
| 257 | ((void *)0) | - | ||||||||||||||||||||||||
| 258 | , *pp, len); | - | ||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||
| 260 | if (r == 0
| 7184-265742 | ||||||||||||||||||||||||
| 261 | return executed 7184 times by 1 test: return ((void *)0) ;Executed by:
executed 7184 times by 1 test: return ((void *)0) ;Executed by:
| 7184 | ||||||||||||||||||||||||
| 262 | ((void *)0) executed 7184 times by 1 test: return ((void *)0) ;Executed by:
| 7184 | ||||||||||||||||||||||||
| 263 | ; executed 7184 times by 1 test: return ((void *)0) ;Executed by:
| 7184 | ||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | if ((
| 0-265742 | ||||||||||||||||||||||||
| 266 | ((void *)0)
| 0-265742 | ||||||||||||||||||||||||
| 267 | )
| 0-265742 | ||||||||||||||||||||||||
| 268 | ((void *)0)
| 93090-172652 | ||||||||||||||||||||||||
| 269 | )
| 93090-172652 | ||||||||||||||||||||||||
| 270 | ret = ASN1_INTEGER_new(); | - | ||||||||||||||||||||||||
| 271 | if (ret ==
| 0-172652 | ||||||||||||||||||||||||
| 272 | ((void *)0)
| 0-172652 | ||||||||||||||||||||||||
| 273 | ) | - | ||||||||||||||||||||||||
| 274 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 275 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 276 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 277 | ret->type = 2; | - | ||||||||||||||||||||||||
| 278 | } executed 172652 times by 1 test: elseend of blockExecuted by:
| 172652 | ||||||||||||||||||||||||
| 279 | ret = *a; executed 93090 times by 1 test: ret = *a;Executed by:
| 93090 | ||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||
| 281 | if (ASN1_STRING_set(ret,
| 0-265742 | ||||||||||||||||||||||||
| 282 | ((void *)0)
| 0-265742 | ||||||||||||||||||||||||
| 283 | , r) == 0
| 0-265742 | ||||||||||||||||||||||||
| 284 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||
| 286 | c2i_ibuf(ret->data, &neg, *pp, len); | - | ||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 | if (neg
| 49814-215928 | ||||||||||||||||||||||||
| 289 | ret->type |= 0x100; executed 49814 times by 1 test: ret->type |= 0x100;Executed by:
| 49814 | ||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | *pp += len; | - | ||||||||||||||||||||||||
| 292 | if (a !=
| 0-265742 | ||||||||||||||||||||||||
| 293 | ((void *)0)
| 0-265742 | ||||||||||||||||||||||||
| 294 | ) | - | ||||||||||||||||||||||||
| 295 | (* executed 265742 times by 1 test: a) = ret;(*a) = ret;Executed by:
executed 265742 times by 1 test: (*a) = ret;Executed by:
| 265742 | ||||||||||||||||||||||||
| 296 | return executed 265742 times by 1 test: ret;return ret;Executed by:
executed 265742 times by 1 test: return ret;Executed by:
| 265742 | ||||||||||||||||||||||||
| 297 | err: | - | ||||||||||||||||||||||||
| 298 | ERR_put_error(13,(194),((1|64)),__FILE__,313); | - | ||||||||||||||||||||||||
| 299 | if ((
| 0 | ||||||||||||||||||||||||
| 300 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 301 | )
| 0 | ||||||||||||||||||||||||
| 302 | ASN1_INTEGER_free(ret); never executed: ASN1_INTEGER_free(ret); | 0 | ||||||||||||||||||||||||
| 303 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 304 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 305 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 306 | } | - | ||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||
| 308 | static int asn1_string_get_int64(int64_t *pr, const ASN1_STRING *a, int itype) | - | ||||||||||||||||||||||||
| 309 | { | - | ||||||||||||||||||||||||
| 310 | if (a ==
| 0-20451 | ||||||||||||||||||||||||
| 311 | ((void *)0)
| 0-20451 | ||||||||||||||||||||||||
| 312 | ) { | - | ||||||||||||||||||||||||
| 313 | ERR_put_error(13,(227),((3|64)),__FILE__,322); | - | ||||||||||||||||||||||||
| 314 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 315 | } | - | ||||||||||||||||||||||||
| 316 | if ((
| 0-20451 | ||||||||||||||||||||||||
| 317 | ERR_put_error(13,(227),(225),__FILE__,326); | - | ||||||||||||||||||||||||
| 318 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 319 | } | - | ||||||||||||||||||||||||
| 320 | return executed 20451 times by 1 test: asn1_get_int64(pr, a->data, a->length, a->type & 0x100);return asn1_get_int64(pr, a->data, a->length, a->type & 0x100);Executed by:
executed 20451 times by 1 test: return asn1_get_int64(pr, a->data, a->length, a->type & 0x100);Executed by:
| 20451 | ||||||||||||||||||||||||
| 321 | } | - | ||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||
| 323 | static int asn1_string_set_int64(ASN1_STRING *a, int64_t r, int itype) | - | ||||||||||||||||||||||||
| 324 | { | - | ||||||||||||||||||||||||
| 325 | unsigned char tbuf[sizeof(r)]; | - | ||||||||||||||||||||||||
| 326 | size_t off; | - | ||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||
| 328 | a->type = itype; | - | ||||||||||||||||||||||||
| 329 | if (r < 0
| 0-829 | ||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||
| 335 | off = asn1_put_uint64(tbuf, 0 - (uint64_t)r); | - | ||||||||||||||||||||||||
| 336 | a->type |= 0x100; | - | ||||||||||||||||||||||||
| 337 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 338 | off = asn1_put_uint64(tbuf, r); | - | ||||||||||||||||||||||||
| 339 | a->type &= ~0x100; | - | ||||||||||||||||||||||||
| 340 | } executed 829 times by 1 test: end of blockExecuted by:
| 829 | ||||||||||||||||||||||||
| 341 | return executed 829 times by 1 test: ASN1_STRING_set(a, tbuf + off, sizeof(tbuf) - off);return ASN1_STRING_set(a, tbuf + off, sizeof(tbuf) - off);Executed by:
executed 829 times by 1 test: return ASN1_STRING_set(a, tbuf + off, sizeof(tbuf) - off);Executed by:
| 829 | ||||||||||||||||||||||||
| 342 | } | - | ||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | static int asn1_string_get_uint64(uint64_t *pr, const ASN1_STRING *a, | - | ||||||||||||||||||||||||
| 345 | int itype) | - | ||||||||||||||||||||||||
| 346 | { | - | ||||||||||||||||||||||||
| 347 | if (a ==
| 0 | ||||||||||||||||||||||||
| 348 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 349 | ) { | - | ||||||||||||||||||||||||
| 350 | ERR_put_error(13,(230),((3|64)),__FILE__,357); | - | ||||||||||||||||||||||||
| 351 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 352 | } | - | ||||||||||||||||||||||||
| 353 | if ((
| 0 | ||||||||||||||||||||||||
| 354 | ERR_put_error(13,(230),(225),__FILE__,361); | - | ||||||||||||||||||||||||
| 355 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 356 | } | - | ||||||||||||||||||||||||
| 357 | if (a->type & 0x100
| 0 | ||||||||||||||||||||||||
| 358 | ERR_put_error(13,(230),(226),__FILE__,365); | - | ||||||||||||||||||||||||
| 359 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 360 | } | - | ||||||||||||||||||||||||
| 361 | return never executed: asn1_get_uint64(pr, a->data, a->length);return asn1_get_uint64(pr, a->data, a->length);never executed: return asn1_get_uint64(pr, a->data, a->length); | 0 | ||||||||||||||||||||||||
| 362 | } | - | ||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | static int asn1_string_set_uint64(ASN1_STRING *a, uint64_t r, int itype) | - | ||||||||||||||||||||||||
| 365 | { | - | ||||||||||||||||||||||||
| 366 | unsigned char tbuf[sizeof(r)]; | - | ||||||||||||||||||||||||
| 367 | size_t off; | - | ||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||
| 369 | a->type = itype; | - | ||||||||||||||||||||||||
| 370 | off = asn1_put_uint64(tbuf, r); | - | ||||||||||||||||||||||||
| 371 | return executed 2 times by 1 test: ASN1_STRING_set(a, tbuf + off, sizeof(tbuf) - off);return ASN1_STRING_set(a, tbuf + off, sizeof(tbuf) - off);Executed by:
executed 2 times by 1 test: return ASN1_STRING_set(a, tbuf + off, sizeof(tbuf) - off);Executed by:
| 2 | ||||||||||||||||||||||||
| 372 | } | - | ||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||
| 380 | ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, | - | ||||||||||||||||||||||||
| 381 | long length) | - | ||||||||||||||||||||||||
| 382 | { | - | ||||||||||||||||||||||||
| 383 | ASN1_INTEGER *ret = | - | ||||||||||||||||||||||||
| 384 | ((void *)0) | - | ||||||||||||||||||||||||
| 385 | ; | - | ||||||||||||||||||||||||
| 386 | const unsigned char *p; | - | ||||||||||||||||||||||||
| 387 | unsigned char *s; | - | ||||||||||||||||||||||||
| 388 | long len; | - | ||||||||||||||||||||||||
| 389 | int inf, tag, xclass; | - | ||||||||||||||||||||||||
| 390 | int i; | - | ||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||
| 392 | if ((
| 0 | ||||||||||||||||||||||||
| 393 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 394 | )
| 0 | ||||||||||||||||||||||||
| 395 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 396 | )
| 0 | ||||||||||||||||||||||||
| 397 | if ((
| 0 | ||||||||||||||||||||||||
| 398 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 399 | ) | - | ||||||||||||||||||||||||
| 400 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 401 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 402 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 403 | ret->type = 2; | - | ||||||||||||||||||||||||
| 404 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
| 405 | ret = (*a); never executed: ret = (*a); | 0 | ||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||
| 407 | p = *pp; | - | ||||||||||||||||||||||||
| 408 | inf = ASN1_get_object(&p, &len, &tag, &xclass, length); | - | ||||||||||||||||||||||||
| 409 | if (inf & 0x80
| 0 | ||||||||||||||||||||||||
| 410 | i = 102; | - | ||||||||||||||||||||||||
| 411 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 412 | } | - | ||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||
| 414 | if (tag != 2
| 0 | ||||||||||||||||||||||||
| 415 | i = 115; | - | ||||||||||||||||||||||||
| 416 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 417 | } | - | ||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||
| 420 | - | |||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||
| 423 | s = CRYPTO_malloc((int)len + 1, __FILE__, 420); | - | ||||||||||||||||||||||||
| 424 | if (s ==
| 0 | ||||||||||||||||||||||||
| 425 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 426 | ) { | - | ||||||||||||||||||||||||
| 427 | i = (1|64); | - | ||||||||||||||||||||||||
| 428 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 429 | } | - | ||||||||||||||||||||||||
| 430 | ret->type = 2; | - | ||||||||||||||||||||||||
| 431 | if (len
| 0 | ||||||||||||||||||||||||
| 432 | if ((*
| 0 | ||||||||||||||||||||||||
| 433 | p++; | - | ||||||||||||||||||||||||
| 434 | len--; | - | ||||||||||||||||||||||||
| 435 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 436 | memcpy(s, p, (int)len); | - | ||||||||||||||||||||||||
| 437 | p += len; | - | ||||||||||||||||||||||||
| 438 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 | CRYPTO_free(ret->data, __FILE__, 435); | - | ||||||||||||||||||||||||
| 441 | ret->data = s; | - | ||||||||||||||||||||||||
| 442 | ret->length = (int)len; | - | ||||||||||||||||||||||||
| 443 | if (a !=
| 0 | ||||||||||||||||||||||||
| 444 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 445 | ) | - | ||||||||||||||||||||||||
| 446 | (* never executed: a) = ret;(*a) = ret;never executed: (*a) = ret; | 0 | ||||||||||||||||||||||||
| 447 | *pp = p; | - | ||||||||||||||||||||||||
| 448 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||
| 449 | err: | - | ||||||||||||||||||||||||
| 450 | ERR_put_error(13,(150),(i),__FILE__,443); | - | ||||||||||||||||||||||||
| 451 | if ((
| 0 | ||||||||||||||||||||||||
| 452 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 453 | )
| 0 | ||||||||||||||||||||||||
| 454 | ASN1_INTEGER_free(ret); never executed: ASN1_INTEGER_free(ret); | 0 | ||||||||||||||||||||||||
| 455 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 456 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 457 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 458 | } | - | ||||||||||||||||||||||||
| 459 | - | |||||||||||||||||||||||||
| 460 | static ASN1_STRING *bn_to_asn1_string(const BIGNUM *bn, ASN1_STRING *ai, | - | ||||||||||||||||||||||||
| 461 | int atype) | - | ||||||||||||||||||||||||
| 462 | { | - | ||||||||||||||||||||||||
| 463 | ASN1_INTEGER *ret; | - | ||||||||||||||||||||||||
| 464 | int len; | - | ||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 | if (ai ==
| 60-131 | ||||||||||||||||||||||||
| 467 | ((void *)0)
| 60-131 | ||||||||||||||||||||||||
| 468 | ) { | - | ||||||||||||||||||||||||
| 469 | ret = ASN1_STRING_type_new(atype); | - | ||||||||||||||||||||||||
| 470 | } executed 131 times by 1 test: else {end of blockExecuted by:
| 131 | ||||||||||||||||||||||||
| 471 | ret = ai; | - | ||||||||||||||||||||||||
| 472 | ret->type = atype; | - | ||||||||||||||||||||||||
| 473 | } executed 60 times by 1 test: end of blockExecuted by:
| 60 | ||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | if (ret ==
| 0-191 | ||||||||||||||||||||||||
| 476 | ((void *)0)
| 0-191 | ||||||||||||||||||||||||
| 477 | ) { | - | ||||||||||||||||||||||||
| 478 | ERR_put_error(13,(229),(58),__FILE__,463); | - | ||||||||||||||||||||||||
| 479 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 480 | } | - | ||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||
| 482 | if (BN_is_negative(bn)
| 0-179 | ||||||||||||||||||||||||
| 483 | ret->type |= (2 | 0x100); executed 12 times by 1 test: ret->type |= (2 | 0x100);Executed by:
| 12 | ||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||
| 485 | len = ((BN_num_bits(bn)+7)/8); | - | ||||||||||||||||||||||||
| 486 | - | |||||||||||||||||||||||||
| 487 | if (len == 0
| 31-160 | ||||||||||||||||||||||||
| 488 | len = 1; executed 31 times by 1 test: len = 1;Executed by:
| 31 | ||||||||||||||||||||||||
| 489 | - | |||||||||||||||||||||||||
| 490 | if (ASN1_STRING_set(ret,
| 0-191 | ||||||||||||||||||||||||
| 491 | ((void *)0)
| 0-191 | ||||||||||||||||||||||||
| 492 | , len) == 0
| 0-191 | ||||||||||||||||||||||||
| 493 | ERR_put_error(13,(229),((1|64)),__FILE__,476); | - | ||||||||||||||||||||||||
| 494 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 495 | } | - | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | if (BN_is_zero(bn)
| 31-160 | ||||||||||||||||||||||||
| 499 | ret->data[0] = 0; executed 31 times by 1 test: ret->data[0] = 0;Executed by:
| 31 | ||||||||||||||||||||||||
| 500 | else | - | ||||||||||||||||||||||||
| 501 | len = BN_bn2bin(bn, ret->data); executed 160 times by 1 test: len = BN_bn2bin(bn, ret->data);Executed by:
| 160 | ||||||||||||||||||||||||
| 502 | ret->length = len; | - | ||||||||||||||||||||||||
| 503 | return executed 191 times by 1 test: ret;return ret;Executed by:
executed 191 times by 1 test: return ret;Executed by:
| 191 | ||||||||||||||||||||||||
| 504 | err: | - | ||||||||||||||||||||||||
| 505 | if (ret != ai
| 0 | ||||||||||||||||||||||||
| 506 | ASN1_INTEGER_free(ret); never executed: ASN1_INTEGER_free(ret); | 0 | ||||||||||||||||||||||||
| 507 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 508 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 509 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 510 | } | - | ||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | static BIGNUM *asn1_string_to_bn(const ASN1_INTEGER *ai, BIGNUM *bn, | - | ||||||||||||||||||||||||
| 513 | int itype) | - | ||||||||||||||||||||||||
| 514 | { | - | ||||||||||||||||||||||||
| 515 | BIGNUM *ret; | - | ||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||
| 517 | if ((
| 38-15168 | ||||||||||||||||||||||||
| 518 | ERR_put_error(13,(228),(225),__FILE__,499); | - | ||||||||||||||||||||||||
| 519 | return executed 38 times by 1 test: return ((void *)0) ;Executed by:
executed 38 times by 1 test: return ((void *)0) ;Executed by:
| 38 | ||||||||||||||||||||||||
| 520 | ((void *)0) executed 38 times by 1 test: return ((void *)0) ;Executed by:
| 38 | ||||||||||||||||||||||||
| 521 | ; executed 38 times by 1 test: return ((void *)0) ;Executed by:
| 38 | ||||||||||||||||||||||||
| 522 | } | - | ||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||
| 524 | ret = BN_bin2bn(ai->data, ai->length, bn); | - | ||||||||||||||||||||||||
| 525 | if (ret ==
| 0-15168 | ||||||||||||||||||||||||
| 526 | ((void *)0)
| 0-15168 | ||||||||||||||||||||||||
| 527 | ) { | - | ||||||||||||||||||||||||
| 528 | ERR_put_error(13,(228),(105),__FILE__,505); | - | ||||||||||||||||||||||||
| 529 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 530 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 531 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 532 | } | - | ||||||||||||||||||||||||
| 533 | if (ai->type & 0x100
| 2868-12300 | ||||||||||||||||||||||||
| 534 | BN_set_negative(ret, 1); executed 2868 times by 1 test: BN_set_negative(ret, 1);Executed by:
| 2868 | ||||||||||||||||||||||||
| 535 | return executed 15168 times by 1 test: ret;return ret;Executed by:
executed 15168 times by 1 test: return ret;Executed by:
| 15168 | ||||||||||||||||||||||||
| 536 | } | - | ||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||
| 538 | int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a) | - | ||||||||||||||||||||||||
| 539 | { | - | ||||||||||||||||||||||||
| 540 | return executed 15773 times by 1 test: asn1_string_get_int64(pr, a, 2);return asn1_string_get_int64(pr, a, 2);Executed by:
executed 15773 times by 1 test: return asn1_string_get_int64(pr, a, 2);Executed by:
| 15773 | ||||||||||||||||||||||||
| 541 | } | - | ||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||
| 543 | int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r) | - | ||||||||||||||||||||||||
| 544 | { | - | ||||||||||||||||||||||||
| 545 | return executed 829 times by 1 test: asn1_string_set_int64(a, r, 2);return asn1_string_set_int64(a, r, 2);Executed by:
executed 829 times by 1 test: return asn1_string_set_int64(a, r, 2);Executed by:
| 829 | ||||||||||||||||||||||||
| 546 | } | - | ||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||
| 548 | int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a) | - | ||||||||||||||||||||||||
| 549 | { | - | ||||||||||||||||||||||||
| 550 | return never executed: asn1_string_get_uint64(pr, a, 2);return asn1_string_get_uint64(pr, a, 2);never executed: return asn1_string_get_uint64(pr, a, 2); | 0 | ||||||||||||||||||||||||
| 551 | } | - | ||||||||||||||||||||||||
| 552 | - | |||||||||||||||||||||||||
| 553 | int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r) | - | ||||||||||||||||||||||||
| 554 | { | - | ||||||||||||||||||||||||
| 555 | return executed 2 times by 1 test: asn1_string_set_uint64(a, r, 2);return asn1_string_set_uint64(a, r, 2);Executed by:
executed 2 times by 1 test: return asn1_string_set_uint64(a, r, 2);Executed by:
| 2 | ||||||||||||||||||||||||
| 556 | } | - | ||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | int ASN1_INTEGER_set(ASN1_INTEGER *a, long v) | - | ||||||||||||||||||||||||
| 559 | { | - | ||||||||||||||||||||||||
| 560 | return executed 829 times by 1 test: ASN1_INTEGER_set_int64(a, v);return ASN1_INTEGER_set_int64(a, v);Executed by:
executed 829 times by 1 test: return ASN1_INTEGER_set_int64(a, v);Executed by:
| 829 | ||||||||||||||||||||||||
| 561 | } | - | ||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||
| 563 | long ASN1_INTEGER_get(const ASN1_INTEGER *a) | - | ||||||||||||||||||||||||
| 564 | { | - | ||||||||||||||||||||||||
| 565 | int i; | - | ||||||||||||||||||||||||
| 566 | int64_t r; | - | ||||||||||||||||||||||||
| 567 | if (a ==
| 2770-15773 | ||||||||||||||||||||||||
| 568 | ((void *)0)
| 2770-15773 | ||||||||||||||||||||||||
| 569 | ) | - | ||||||||||||||||||||||||
| 570 | return executed 2770 times by 1 test: 0;return 0;Executed by:
executed 2770 times by 1 test: return 0;Executed by:
| 2770 | ||||||||||||||||||||||||
| 571 | i = ASN1_INTEGER_get_int64(&r, a); | - | ||||||||||||||||||||||||
| 572 | if (i == 0
| 131-15642 | ||||||||||||||||||||||||
| 573 | return executed 131 times by 1 test: -1;return -1;Executed by:
executed 131 times by 1 test: return -1;Executed by:
| 131 | ||||||||||||||||||||||||
| 574 | if (r > 0x7fffffffffffffffL
| 0-15642 | ||||||||||||||||||||||||
| 575 | (-0x7fffffffffffffffL - 1L)
| 0-15642 | ||||||||||||||||||||||||
| 576 | ) | - | ||||||||||||||||||||||||
| 577 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 578 | return executed 15642 times by 1 test: (long)r;return (long)r;Executed by:
executed 15642 times by 1 test: return (long)r;Executed by:
| 15642 | ||||||||||||||||||||||||
| 579 | } | - | ||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||
| 581 | ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) | - | ||||||||||||||||||||||||
| 582 | { | - | ||||||||||||||||||||||||
| 583 | return executed 191 times by 1 test: bn_to_asn1_string(bn, ai, 2);return bn_to_asn1_string(bn, ai, 2);Executed by:
executed 191 times by 1 test: return bn_to_asn1_string(bn, ai, 2);Executed by:
| 191 | ||||||||||||||||||||||||
| 584 | } | - | ||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||
| 586 | BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn) | - | ||||||||||||||||||||||||
| 587 | { | - | ||||||||||||||||||||||||
| 588 | return executed 13334 times by 1 test: asn1_string_to_bn(ai, bn, 2);return asn1_string_to_bn(ai, bn, 2);Executed by:
executed 13334 times by 1 test: return asn1_string_to_bn(ai, bn, 2);Executed by:
| 13334 | ||||||||||||||||||||||||
| 589 | } | - | ||||||||||||||||||||||||
| 590 | - | |||||||||||||||||||||||||
| 591 | int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a) | - | ||||||||||||||||||||||||
| 592 | { | - | ||||||||||||||||||||||||
| 593 | return executed 4678 times by 1 test: asn1_string_get_int64(pr, a, 10);return asn1_string_get_int64(pr, a, 10);Executed by:
executed 4678 times by 1 test: return asn1_string_get_int64(pr, a, 10);Executed by:
| 4678 | ||||||||||||||||||||||||
| 594 | } | - | ||||||||||||||||||||||||
| 595 | - | |||||||||||||||||||||||||
| 596 | int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r) | - | ||||||||||||||||||||||||
| 597 | { | - | ||||||||||||||||||||||||
| 598 | return never executed: asn1_string_set_int64(a, r, 10);return asn1_string_set_int64(a, r, 10);never executed: return asn1_string_set_int64(a, r, 10); | 0 | ||||||||||||||||||||||||
| 599 | } | - | ||||||||||||||||||||||||
| 600 | - | |||||||||||||||||||||||||
| 601 | int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v) | - | ||||||||||||||||||||||||
| 602 | { | - | ||||||||||||||||||||||||
| 603 | return never executed: ASN1_ENUMERATED_set_int64(a, v);return ASN1_ENUMERATED_set_int64(a, v);never executed: return ASN1_ENUMERATED_set_int64(a, v); | 0 | ||||||||||||||||||||||||
| 604 | } | - | ||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||
| 606 | long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a) | - | ||||||||||||||||||||||||
| 607 | { | - | ||||||||||||||||||||||||
| 608 | int i; | - | ||||||||||||||||||||||||
| 609 | int64_t r; | - | ||||||||||||||||||||||||
| 610 | if (a ==
| 0-5798 | ||||||||||||||||||||||||
| 611 | ((void *)0)
| 0-5798 | ||||||||||||||||||||||||
| 612 | ) | - | ||||||||||||||||||||||||
| 613 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 614 | if ((
| 0-5798 | ||||||||||||||||||||||||
| 615 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 616 | if (a->length > (int)sizeof(long)
| 1120-4678 | ||||||||||||||||||||||||
| 617 | return executed 1120 times by 1 test: 0xffffffffL;return 0xffffffffL;Executed by:
executed 1120 times by 1 test: return 0xffffffffL;Executed by:
| 1120 | ||||||||||||||||||||||||
| 618 | i = ASN1_ENUMERATED_get_int64(&r, a); | - | ||||||||||||||||||||||||
| 619 | if (i == 0
| 1227-3451 | ||||||||||||||||||||||||
| 620 | return executed 1227 times by 1 test: -1;return -1;Executed by:
executed 1227 times by 1 test: return -1;Executed by:
| 1227 | ||||||||||||||||||||||||
| 621 | if (r > 0x7fffffffffffffffL
| 0-3451 | ||||||||||||||||||||||||
| 622 | (-0x7fffffffffffffffL - 1L)
| 0-3451 | ||||||||||||||||||||||||
| 623 | ) | - | ||||||||||||||||||||||||
| 624 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 625 | return executed 3451 times by 1 test: (long)r;return (long)r;Executed by:
executed 3451 times by 1 test: return (long)r;Executed by:
| 3451 | ||||||||||||||||||||||||
| 626 | } | - | ||||||||||||||||||||||||
| 627 | - | |||||||||||||||||||||||||
| 628 | ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai) | - | ||||||||||||||||||||||||
| 629 | { | - | ||||||||||||||||||||||||
| 630 | return never executed: bn_to_asn1_string(bn, ai, 10);return bn_to_asn1_string(bn, ai, 10);never executed: return bn_to_asn1_string(bn, ai, 10); | 0 | ||||||||||||||||||||||||
| 631 | } | - | ||||||||||||||||||||||||
| 632 | - | |||||||||||||||||||||||||
| 633 | BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn) | - | ||||||||||||||||||||||||
| 634 | { | - | ||||||||||||||||||||||||
| 635 | return executed 1872 times by 1 test: asn1_string_to_bn(ai, bn, 10);return asn1_string_to_bn(ai, bn, 10);Executed by:
executed 1872 times by 1 test: return asn1_string_to_bn(ai, bn, 10);Executed by:
| 1872 | ||||||||||||||||||||||||
| 636 | } | - | ||||||||||||||||||||||||
| 637 | - | |||||||||||||||||||||||||
| 638 | - | |||||||||||||||||||||||||
| 639 | int c2i_uint64_int(uint64_t *ret, int *neg, const unsigned char **pp, long len) | - | ||||||||||||||||||||||||
| 640 | { | - | ||||||||||||||||||||||||
| 641 | unsigned char buf[sizeof(uint64_t)]; | - | ||||||||||||||||||||||||
| 642 | size_t buflen; | - | ||||||||||||||||||||||||
| 643 | - | |||||||||||||||||||||||||
| 644 | buflen = c2i_ibuf( | - | ||||||||||||||||||||||||
| 645 | ((void *)0) | - | ||||||||||||||||||||||||
| 646 | , | - | ||||||||||||||||||||||||
| 647 | ((void *)0) | - | ||||||||||||||||||||||||
| 648 | , *pp, len); | - | ||||||||||||||||||||||||
| 649 | if (buflen == 0
| 130-42708 | ||||||||||||||||||||||||
| 650 | return executed 130 times by 1 test: 0;return 0;Executed by:
executed 130 times by 1 test: return 0;Executed by:
| 130 | ||||||||||||||||||||||||
| 651 | if (buflen > sizeof(uint64_t)
| 340-42368 | ||||||||||||||||||||||||
| 652 | ERR_put_error(13,(101),(223),__FILE__,615); | - | ||||||||||||||||||||||||
| 653 | return executed 340 times by 1 test: 0;return 0;Executed by:
executed 340 times by 1 test: return 0;Executed by:
| 340 | ||||||||||||||||||||||||
| 654 | } | - | ||||||||||||||||||||||||
| 655 | (void)c2i_ibuf(buf, neg, *pp, len); | - | ||||||||||||||||||||||||
| 656 | return executed 42368 times by 1 test: asn1_get_uint64(ret, buf, buflen);return asn1_get_uint64(ret, buf, buflen);Executed by:
executed 42368 times by 1 test: return asn1_get_uint64(ret, buf, buflen);Executed by:
| 42368 | ||||||||||||||||||||||||
| 657 | } | - | ||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||
| 659 | int i2c_uint64_int(unsigned char *p, uint64_t r, int neg) | - | ||||||||||||||||||||||||
| 660 | { | - | ||||||||||||||||||||||||
| 661 | unsigned char buf[sizeof(uint64_t)]; | - | ||||||||||||||||||||||||
| 662 | size_t off; | - | ||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||
| 664 | off = asn1_put_uint64(buf, r); | - | ||||||||||||||||||||||||
| 665 | return executed 128920 times by 1 test: i2c_ibuf(buf + off, sizeof(buf) - off, neg, &p);return i2c_ibuf(buf + off, sizeof(buf) - off, neg, &p);Executed by:
executed 128920 times by 1 test: return i2c_ibuf(buf + off, sizeof(buf) - off, neg, &p);Executed by:
| 128920 | ||||||||||||||||||||||||
| 666 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |