Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/f_int.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a) | - | ||||||||||||||||||||||||
4 | { | - | ||||||||||||||||||||||||
5 | int i, n = 0; | - | ||||||||||||||||||||||||
6 | static const char *h = "0123456789ABCDEF"; | - | ||||||||||||||||||||||||
7 | char buf[2]; | - | ||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||
9 | if (a ==
| 0-8492 | ||||||||||||||||||||||||
10 | ((void *)0)
| 0-8492 | ||||||||||||||||||||||||
11 | ) | - | ||||||||||||||||||||||||
12 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||
14 | if (a->type & 0x100
| 1125-7367 | ||||||||||||||||||||||||
15 | if (BIO_write(bp, "-", 1) != 1
| 0-1125 | ||||||||||||||||||||||||
16 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
17 | n = 1; | - | ||||||||||||||||||||||||
18 | } executed 1125 times by 1 test: end of block Executed by:
| 1125 | ||||||||||||||||||||||||
19 | - | |||||||||||||||||||||||||
20 | if (a->length == 0
| 0-8492 | ||||||||||||||||||||||||
21 | if (BIO_write(bp, "00", 2) != 2
| 0 | ||||||||||||||||||||||||
22 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
23 | n += 2; | - | ||||||||||||||||||||||||
24 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
25 | for (i = 0; i < a->length
| 8492-35784 | ||||||||||||||||||||||||
26 | if ((
| 213-27292 | ||||||||||||||||||||||||
27 | if (BIO_write(bp, "\\\n", 2) != 2
| 0-213 | ||||||||||||||||||||||||
28 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
29 | n += 2; | - | ||||||||||||||||||||||||
30 | } executed 213 times by 1 test: end of block Executed by:
| 213 | ||||||||||||||||||||||||
31 | buf[0] = h[((unsigned char)a->data[i] >> 4) & 0x0f]; | - | ||||||||||||||||||||||||
32 | buf[1] = h[((unsigned char)a->data[i]) & 0x0f]; | - | ||||||||||||||||||||||||
33 | if (BIO_write(bp, buf, 2) != 2
| 0-35784 | ||||||||||||||||||||||||
34 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
35 | n += 2; | - | ||||||||||||||||||||||||
36 | } executed 35784 times by 1 test: end of block Executed by:
| 35784 | ||||||||||||||||||||||||
37 | } executed 8492 times by 1 test: end of block Executed by:
| 8492 | ||||||||||||||||||||||||
38 | return executed 8492 times by 1 test: n;return n; Executed by:
executed 8492 times by 1 test: return n; Executed by:
| 8492 | ||||||||||||||||||||||||
39 | err: | - | ||||||||||||||||||||||||
40 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
41 | } | - | ||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||
43 | int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) | - | ||||||||||||||||||||||||
44 | { | - | ||||||||||||||||||||||||
45 | int i, j, k, m, n, again, bufsize; | - | ||||||||||||||||||||||||
46 | unsigned char *s = | - | ||||||||||||||||||||||||
47 | ((void *)0) | - | ||||||||||||||||||||||||
48 | , *sp; | - | ||||||||||||||||||||||||
49 | unsigned char *bufp; | - | ||||||||||||||||||||||||
50 | int num = 0, slen = 0, first = 1; | - | ||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||
52 | bs->type = 2; | - | ||||||||||||||||||||||||
53 | - | |||||||||||||||||||||||||
54 | bufsize = BIO_gets(bp, buf, size); | - | ||||||||||||||||||||||||
55 | for (;;) { | - | ||||||||||||||||||||||||
56 | if (bufsize < 1
| 0-2 | ||||||||||||||||||||||||
57 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
58 | i = bufsize; | - | ||||||||||||||||||||||||
59 | if (buf[i - 1] == '\n'
| 0-2 | ||||||||||||||||||||||||
60 | buf[--i] = '\0'; executed 2 times by 1 test: buf[--i] = '\0'; Executed by:
| 2 | ||||||||||||||||||||||||
61 | if (i == 0
| 0-2 | ||||||||||||||||||||||||
62 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
63 | if (buf[i - 1] == '\r'
| 0-2 | ||||||||||||||||||||||||
64 | buf[--i] = '\0'; never executed: buf[--i] = '\0'; | 0 | ||||||||||||||||||||||||
65 | if (i == 0
| 0-2 | ||||||||||||||||||||||||
66 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
67 | again = (buf[i - 1] == '\\'); | - | ||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||
69 | for (j = 0; j < i
| 2-80 | ||||||||||||||||||||||||
70 | if (!(ossl_ctype_check((buf[j]), 0x10))
| 0-80 | ||||||||||||||||||||||||
71 | { | - | ||||||||||||||||||||||||
72 | i = j; | - | ||||||||||||||||||||||||
73 | break; never executed: break; | 0 | ||||||||||||||||||||||||
74 | } | - | ||||||||||||||||||||||||
75 | } executed 80 times by 1 test: end of block Executed by:
| 80 | ||||||||||||||||||||||||
76 | buf[i] = '\0'; | - | ||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||
80 | if (i < 2
| 0-2 | ||||||||||||||||||||||||
81 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||
83 | bufp = (unsigned char *)buf; | - | ||||||||||||||||||||||||
84 | if (first
| 0-2 | ||||||||||||||||||||||||
85 | first = 0; | - | ||||||||||||||||||||||||
86 | if ((
| 0-2 | ||||||||||||||||||||||||
87 | bufp += 2; | - | ||||||||||||||||||||||||
88 | i -= 2; | - | ||||||||||||||||||||||||
89 | } never executed: end of block | 0 | ||||||||||||||||||||||||
90 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
91 | k = 0; | - | ||||||||||||||||||||||||
92 | i -= again; | - | ||||||||||||||||||||||||
93 | if (i % 2 != 0
| 0-2 | ||||||||||||||||||||||||
94 | ERR_put_error(13,(102),(145),__FILE__,103); | - | ||||||||||||||||||||||||
95 | CRYPTO_free(s, __FILE__, 104); | - | ||||||||||||||||||||||||
96 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
97 | } | - | ||||||||||||||||||||||||
98 | i /= 2; | - | ||||||||||||||||||||||||
99 | if (num + i > slen
| 0-2 | ||||||||||||||||||||||||
100 | sp = CRYPTO_clear_realloc(s, slen, num + i * 2, __FILE__, 109); | - | ||||||||||||||||||||||||
101 | if (sp ==
| 0-2 | ||||||||||||||||||||||||
102 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
103 | ) { | - | ||||||||||||||||||||||||
104 | ERR_put_error(13,(102),((1|64)),__FILE__,111); | - | ||||||||||||||||||||||||
105 | CRYPTO_free(s, __FILE__, 112); | - | ||||||||||||||||||||||||
106 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
107 | } | - | ||||||||||||||||||||||||
108 | s = sp; | - | ||||||||||||||||||||||||
109 | slen = num + i * 2; | - | ||||||||||||||||||||||||
110 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
111 | for (j = 0; j < i
| 2-40 | ||||||||||||||||||||||||
112 | for (n = 0; n < 2
| 40-80 | ||||||||||||||||||||||||
113 | m = OPENSSL_hexchar2int(bufp[k + n]); | - | ||||||||||||||||||||||||
114 | if (m < 0
| 0-80 | ||||||||||||||||||||||||
115 | ERR_put_error(13,(102),(141),__FILE__,123) | - | ||||||||||||||||||||||||
116 | ; | - | ||||||||||||||||||||||||
117 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
118 | } | - | ||||||||||||||||||||||||
119 | s[num + j] <<= 4; | - | ||||||||||||||||||||||||
120 | s[num + j] |= m; | - | ||||||||||||||||||||||||
121 | } executed 80 times by 1 test: end of block Executed by:
| 80 | ||||||||||||||||||||||||
122 | } executed 40 times by 1 test: end of block Executed by:
| 40 | ||||||||||||||||||||||||
123 | num += i; | - | ||||||||||||||||||||||||
124 | if (again
| 0-2 | ||||||||||||||||||||||||
125 | bufsize = BIO_gets(bp, buf, size); never executed: bufsize = BIO_gets(bp, buf, size); | 0 | ||||||||||||||||||||||||
126 | else | - | ||||||||||||||||||||||||
127 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||||||||||||||
128 | } | - | ||||||||||||||||||||||||
129 | bs->length = num; | - | ||||||||||||||||||||||||
130 | bs->data = s; | - | ||||||||||||||||||||||||
131 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||
132 | err: | - | ||||||||||||||||||||||||
133 | ERR_put_error(13,(102),(150),__FILE__,140); | - | ||||||||||||||||||||||||
134 | CRYPTO_free(s, __FILE__, 141); | - | ||||||||||||||||||||||||
135 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
136 | } | - | ||||||||||||||||||||||||
137 | - | |||||||||||||||||||||||||
138 | int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a) | - | ||||||||||||||||||||||||
139 | { | - | ||||||||||||||||||||||||
140 | return never executed: i2a_ASN1_INTEGER(bp, a);return i2a_ASN1_INTEGER(bp, a); never executed: return i2a_ASN1_INTEGER(bp, a); | 0 | ||||||||||||||||||||||||
141 | } | - | ||||||||||||||||||||||||
142 | - | |||||||||||||||||||||||||
143 | int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) | - | ||||||||||||||||||||||||
144 | { | - | ||||||||||||||||||||||||
145 | int rv = a2i_ASN1_INTEGER(bp, bs, buf, size); | - | ||||||||||||||||||||||||
146 | if (rv == 1
| 0 | ||||||||||||||||||||||||
147 | bs->type = 2 | (bs->type & 0x100); never executed: bs->type = 2 | (bs->type & 0x100); | 0 | ||||||||||||||||||||||||
148 | return never executed: rv;return rv; never executed: return rv; | 0 | ||||||||||||||||||||||||
149 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |