OpenCoverage

x_long.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/x_long.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9static int long_new(ASN1_VALUE **pval, const ASN1_ITEM *it);-
10static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it);-
11-
12static int long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);-
13static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);-
14static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx);-
15-
16static ASN1_PRIMITIVE_FUNCS long_pf = {-
17 -
18((void *)0)-
19 , 0,-
20 long_new,-
21 long_free,-
22 long_free,-
23 long_c2i,-
24 long_i2c,-
25 long_print-
26};-
27-
28const ASN1_ITEM LONG_it = {-
29 .itype = 0x0,-
30 .utype = 2,-
31 .templates = -
32 ((void *)0)-
33 ,-
34 .tcount = 0,-
35 .funcs = &long_pf,-
36 .size = 0x7fffffffL,-
37 .sname = "LONG",-
38};-
39-
40const ASN1_ITEM ZLONG_it = {-
41 .itype = 0x0,-
42 .utype = 2,-
43 .templates = -
44 ((void *)0)-
45 ,-
46 .tcount = 0,-
47 .funcs = &long_pf,-
48 .size = 0,-
49 .sname = "ZLONG",-
50};-
51-
52static int-
53long_new(ASN1_VALUE **pval, const ASN1_ITEM *it)-
54{-
55 *(long *)pval = it->size;-
56 return
never executed: return 1;
1;
never executed: return 1;
0
57}-
58-
59static void-
60long_free(ASN1_VALUE **pval, const ASN1_ITEM *it)-
61{-
62 *(long *)pval = it->size;-
63}
executed 126 times by 1 test: end of block
Executed by:
  • ssltest
126
64-
65static int-
66long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype,-
67 const ASN1_ITEM *it)-
68{-
69 long ltmp;-
70 unsigned long utmp;-
71 int clen, pad, i;-
72-
73 char *cp = (char *)pval;-
74-
75-
76 memcpy(&ltmp, cp, sizeof(long));-
77-
78 if (ltmp == it->size
ltmp == it->sizeDescription
TRUEevaluated 378 times by 1 test
Evaluated by:
  • ssltest
FALSEevaluated 60 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
)
60-378
79 return
executed 378 times by 1 test: return -1;
Executed by:
  • ssltest
-1;
executed 378 times by 1 test: return -1;
Executed by:
  • ssltest
378
80-
81-
82-
83-
84 if (ltmp < 0
ltmp < 0Description
TRUEnever evaluated
FALSEevaluated 60 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
)
0-60
85 utmp = -ltmp - 1;
never executed: utmp = -ltmp - 1;
0
86 else-
87 utmp = ltmp;
executed 60 times by 2 tests: utmp = ltmp;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
60
88 clen = BN_num_bits_word(utmp);-
89-
90 if (!(clen & 0x7)
!(clen & 0x7)Description
TRUEevaluated 60 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
FALSEnever evaluated
)
0-60
91 pad = 1;
executed 60 times by 2 tests: pad = 1;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
60
92 else-
93 pad = 0;
never executed: pad = 0;
0
94-
95-
96 clen = (clen + 7) >> 3;-
97-
98 if (cont
contDescription
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
FALSEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
) {
15-45
99 if (pad
padDescription
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
FALSEnever evaluated
)
0-15
100 *
executed 15 times by 2 tests: *cont++ = (ltmp < 0) ? 0xff : 0;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
cont++ = (
(ltmp < 0)Description
TRUEnever evaluated
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
ltmp < 0)
(ltmp < 0)Description
TRUEnever evaluated
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
? 0xff : 0;
executed 15 times by 2 tests: *cont++ = (ltmp < 0) ? 0xff : 0;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
0-15
101 for (i = clen - 1; i >= 0
i >= 0Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • ssltest
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • ssltest
; i--) {
14-15
102 cont[i] = (unsigned char)(utmp & 0xff);-
103 if (ltmp < 0
ltmp < 0Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • ssltest
)
0-14
104 cont[i] ^= 0xff;
never executed: cont[i] ^= 0xff;
0
105 utmp >>= 8;-
106 }
executed 14 times by 1 test: end of block
Executed by:
  • ssltest
14
107 }
executed 15 times by 2 tests: end of block
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
15
108 return
executed 60 times by 2 tests: return clen + pad;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
clen + pad;
executed 60 times by 2 tests: return clen + pad;
Executed by:
  • libcrypto.so.44.0.1
  • ssltest
60
109}-
110-
111static int-
112long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype,-
113 char *free_cont, const ASN1_ITEM *it)-
114{-
115 int neg, i;-
116 long ltmp;-
117 unsigned long utmp = 0;-
118 char *cp = (char *)pval;-
119 if (len > (int)sizeof(long)
len > (int)sizeof(long)Description
TRUEnever evaluated
FALSEevaluated 79 times by 5 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
) {
0-79
120 ERR_put_error(13,(0xfff),(128),__FILE__,176);-
121 return
never executed: return 0;
0;
never executed: return 0;
0
122 }-
123-
124 if (len
lenDescription
TRUEevaluated 79 times by 5 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
FALSEnever evaluated
&& (
(cont[0] & 0x80)Description
TRUEnever evaluated
FALSEevaluated 79 times by 5 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
cont[0] & 0x80)
(cont[0] & 0x80)Description
TRUEnever evaluated
FALSEevaluated 79 times by 5 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
)
0-79
125 neg = 1;
never executed: neg = 1;
0
126 else-
127 neg = 0;
executed 79 times by 5 tests: neg = 0;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
79
128 utmp = 0;-
129 for (i = 0; i < len
i < lenDescription
TRUEevaluated 93 times by 5 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
FALSEevaluated 79 times by 5 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
; i++) {
79-93
130 utmp <<= 8;-
131 if (neg
negDescription
TRUEnever evaluated
FALSEevaluated 93 times by 5 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
)
0-93
132 utmp |= cont[i] ^ 0xff;
never executed: utmp |= cont[i] ^ 0xff;
0
133 else-
134 utmp |= cont[i];
executed 93 times by 5 tests: utmp |= cont[i];
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
93
135 }-
136 ltmp = (long)utmp;-
137 if (neg
negDescription
TRUEnever evaluated
FALSEevaluated 79 times by 5 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
) {
0-79
138 ltmp++;-
139 ltmp = -ltmp;-
140 }
never executed: end of block
0
141 if (ltmp == it->size
ltmp == it->sizeDescription
TRUEnever evaluated
FALSEevaluated 79 times by 5 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
) {
0-79
142 ERR_put_error(13,(0xfff),(128),__FILE__,198);-
143 return
never executed: return 0;
0;
never executed: return 0;
0
144 }-
145 memcpy(cp, &ltmp, sizeof(long));-
146 return
executed 79 times by 5 tests: return 1;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
1;
executed 79 times by 5 tests: return 1;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • servertest
  • ssltest
  • tlstest
79
147}-
148-
149static int-
150long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent,-
151 const ASN1_PCTX *pctx)-
152{-
153 return
never executed: return BIO_printf(out, "%ld\n", *(long *)pval);
BIO_printf(out, "%ld\n", *(long *)pval);
never executed: return BIO_printf(out, "%ld\n", *(long *)pval);
0
154}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2