OpenCoverage

f_int.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/f_int.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3int 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 ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8492 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8492
10 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8492 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8492
11 )-
12 return
never executed: return 0;
0;
never executed: return 0;
0
13-
14 if (a->type & 0x100
a->type & 0x100Description
TRUEevaluated 1125 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1125-7367
15 if (BIO_write(bp, "-", 1) != 1
BIO_write(bp, "-", 1) != 1Description
TRUEnever evaluated
FALSEevaluated 1125 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-1125
16 goto
never executed: goto err;
err;
never executed: goto err;
0
17 n = 1;-
18 }
executed 1125 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1125
19-
20 if (a->length == 0
a->length == 0Description
TRUEnever evaluated
FALSEevaluated 8492 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-8492
21 if (BIO_write(bp, "00", 2) != 2
BIO_write(bp, "00", 2) != 2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
22 goto
never executed: goto err;
err;
never executed: goto err;
0
23 n += 2;-
24 }
never executed: end of block
else {
0
25 for (i = 0; i < a->length
i < a->lengthDescription
TRUEevaluated 35784 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8492 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++) {
8492-35784
26 if ((
(i != 0)Description
TRUEevaluated 27292 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8492 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i != 0)
(i != 0)Description
TRUEevaluated 27292 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8492 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(i % 35 == 0)Description
TRUEevaluated 213 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 27079 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i % 35 == 0)
(i % 35 == 0)Description
TRUEevaluated 213 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 27079 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
213-27292
27 if (BIO_write(bp, "\\\n", 2) != 2
BIO_write(bp, "\\\n", 2) != 2Description
TRUEnever evaluated
FALSEevaluated 213 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-213
28 goto
never executed: goto err;
err;
never executed: goto err;
0
29 n += 2;-
30 }
executed 213 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
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
BIO_write(bp, buf, 2) != 2Description
TRUEnever evaluated
FALSEevaluated 35784 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-35784
34 goto
never executed: goto err;
err;
never executed: goto err;
0
35 n += 2;-
36 }
executed 35784 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
35784
37 }
executed 8492 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8492
38 return
executed 8492 times by 1 test: return n;
Executed by:
  • libcrypto.so.1.1
n;
executed 8492 times by 1 test: return n;
Executed by:
  • libcrypto.so.1.1
8492
39 err:-
40 return
never executed: return -1;
-1;
never executed: return -1;
0
41}-
42-
43int 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
bufsize < 1Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2
57 goto
never executed: goto err;
err;
never executed: goto err;
0
58 i = bufsize;-
59 if (buf[i - 1] == '\n'
buf[i - 1] == '\n'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-2
60 buf[--i] = '\0';
executed 2 times by 1 test: buf[--i] = '\0';
Executed by:
  • libcrypto.so.1.1
2
61 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2
62 goto
never executed: goto err;
err;
never executed: goto err;
0
63 if (buf[i - 1] == '\r'
buf[i - 1] == '\r'Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2
64 buf[--i] = '\0';
never executed: buf[--i] = '\0';
0
65 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2
66 goto
never executed: goto err;
err;
never executed: goto err;
0
67 again = (buf[i - 1] == '\\');-
68-
69 for (j = 0; j < i
j < iDescription
TRUEevaluated 80 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; j++) {
2-80
70 if (!(ossl_ctype_check((buf[j]), 0x10))
!(ossl_ctype_c...uf[j]), 0x10))Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
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:
  • libcrypto.so.1.1
80
76 buf[i] = '\0';-
77-
78-
79-
80 if (i < 2
i < 2Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2
81 goto
never executed: goto err;
err;
never executed: goto err;
0
82-
83 bufp = (unsigned char *)buf;-
84 if (first
firstDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-2
85 first = 0;-
86 if ((
(bufp[0] == '0')Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
bufp[0] == '0')
(bufp[0] == '0')Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& (
(bufp[1] == '0')Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
bufp[1] == '0')
(bufp[1] == '0')Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
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:
  • libcrypto.so.1.1
2
91 k = 0;-
92 i -= again;-
93 if (i % 2 != 0
i % 2 != 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2
94 ERR_put_error(13,(102),(145),__FILE__,103);-
95 CRYPTO_free(s, __FILE__, 104);-
96 return
never executed: return 0;
0;
never executed: return 0;
0
97 }-
98 i /= 2;-
99 if (num + i > slen
num + i > slenDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-2
100 sp = CRYPTO_clear_realloc(s, slen, num + i * 2, __FILE__, 109);-
101 if (sp ==
sp == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
102 ((void *)0)
sp == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
103 ) {-
104 ERR_put_error(13,(102),((1|64)),__FILE__,111);-
105 CRYPTO_free(s, __FILE__, 112);-
106 return
never executed: return 0;
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:
  • libcrypto.so.1.1
2
111 for (j = 0; j < i
j < iDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; j++, k += 2) {
2-40
112 for (n = 0; n < 2
n < 2Description
TRUEevaluated 80 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 40 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; n++) {
40-80
113 m = OPENSSL_hexchar2int(bufp[k + n]);-
114 if (m < 0
m < 0Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-80
115 ERR_put_error(13,(102),(141),__FILE__,123)-
116 ;-
117 goto
never executed: goto err;
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:
  • libcrypto.so.1.1
80
122 }
executed 40 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
40
123 num += i;-
124 if (again
againDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
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:
  • libcrypto.so.1.1
2
128 }-
129 bs->length = num;-
130 bs->data = s;-
131 return
executed 2 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 2 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
2
132 err:-
133 ERR_put_error(13,(102),(150),__FILE__,140);-
134 CRYPTO_free(s, __FILE__, 141);-
135 return
never executed: return 0;
0;
never executed: return 0;
0
136}-
137-
138int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a)-
139{-
140 return
never executed: return i2a_ASN1_INTEGER(bp, a);
i2a_ASN1_INTEGER(bp, a);
never executed: return i2a_ASN1_INTEGER(bp, a);
0
141}-
142-
143int 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
rv == 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
147 bs->type = 2 | (bs->type & 0x100);
never executed: bs->type = 2 | (bs->type & 0x100);
0
148 return
never executed: return rv;
rv;
never executed: return rv;
0
149}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2