OpenCoverage

drbg_ctr.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/rand/drbg_ctr.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5static void inc_128(RAND_DRBG_CTR *ctr)-
6{-
7 int i;-
8 unsigned char c;-
9 unsigned char *p = &ctr->V[15];-
10-
11 for (i = 0; i < 16
i < 16Description
TRUEevaluated 17777205 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
; i++, p--) {
0-17777205
12 c = *p;-
13 c++;-
14 *p = c;-
15 if (c != 0
c != 0Description
TRUEevaluated 17923679 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 77099 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
77099-17923679
16-
17 break;
executed 17729011 times by 2 tests: break;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
17729011
18 }-
19 }
executed 77097 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
77097
20}
executed 17675448 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
17675448
21-
22static void ctr_XOR(RAND_DRBG_CTR *ctr, const unsigned char *in, size_t inlen)-
23{-
24 size_t i, n;-
25-
26 if (in ==
in == ((void *)0)Description
TRUEevaluated 7218 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2100727 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
7218-2100727
27 ((void *)0)
in == ((void *)0)Description
TRUEevaluated 7218 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2100727 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
7218-2100727
28 || inlen == 0
inlen == 0Description
TRUEevaluated 3600 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2113562 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
3600-2113562
29 return;
executed 10818 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
10818
30-
31-
32-
33-
34-
35 n = inlen < ctr->keylen
inlen < ctr->keylenDescription
TRUEnever evaluated
FALSEevaluated 2107945 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
? inlen : ctr->keylen;
0-2107945
36 for (i = 0; i < n
i < nDescription
TRUEevaluated 65699309 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2133729 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
; i++)
2133729-65699309
37 ctr->K[i] ^= in[i];
executed 65704331 times by 2 tests: ctr->K[i] ^= in[i];
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
65704331
38 if (inlen <= ctr->keylen
inlen <= ctr->keylenDescription
TRUEnever evaluated
FALSEevaluated 2120534 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-2120534
39 return;
never executed: return;
0
40-
41 n = inlen - ctr->keylen;-
42 if (n > 16
n > 16Description
TRUEnever evaluated
FALSEevaluated 2116629 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-2116629
43-
44 n = 16;-
45 }
never executed: end of block
0
46 for (i = 0; i < n
i < nDescription
TRUEevaluated 33413748 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2131999 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
; i++)
2131999-33413748
47 ctr->V[i] ^= in[i + ctr->keylen];
executed 33447824 times by 2 tests: ctr->V[i] ^= in[i + ctr->keylen];
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
33447824
48}
executed 2119266 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2119266
49-
50-
51-
52-
53 static int ctr_BCC_block(RAND_DRBG_CTR *ctr, unsigned char *out,-
54 const unsigned char *in)-
55{-
56 int i, outlen = 16;-
57-
58 for (i = 0; i < 16
i < 16Description
TRUEevaluated 144141478 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 9487527 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
; i++)
9487527-144141478
59 out[i] ^= in[i];
executed 144315469 times by 2 tests: out[i] ^= in[i];
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
144315469
60-
61 if (!EVP_CipherUpdate(ctr->ctx_df, out, &outlen, out, 16)
!EVP_CipherUpd...tlen, out, 16)Description
TRUEnever evaluated
FALSEevaluated 9107744 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-9107744
62 || outlen != 16
outlen != 16Description
TRUEnever evaluated
FALSEevaluated 9277088 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-9277088
63 return
never executed: return 0;
0;
never executed: return 0;
0
64 return
executed 9242579 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 9242579 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
9242579
65}-
66-
67-
68-
69-
70-
71 static int ctr_BCC_blocks(RAND_DRBG_CTR *ctr, const unsigned char *in)-
72{-
73 if (!ctr_BCC_block(ctr, ctr->KX, in)
!ctr_BCC_block..., ctr->KX, in)Description
TRUEnever evaluated
FALSEevaluated 2126716 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-2126716
74 || !ctr_BCC_block(ctr, ctr->KX + 16, in)
!ctr_BCC_block...->KX + 16, in)Description
TRUEnever evaluated
FALSEevaluated 2126487 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-2126487
75 return
never executed: return 0;
0;
never executed: return 0;
0
76 if (ctr->keylen != 16
ctr->keylen != 16Description
TRUEevaluated 2125097 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 5779 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !ctr_BCC_block(ctr, ctr->KX + 32, in)
!ctr_BCC_block...->KX + 32, in)Description
TRUEnever evaluated
FALSEevaluated 2122961 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-2125097
77 return
never executed: return 0;
0;
never executed: return 0;
0
78 return
executed 2128112 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 2128112 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2128112
79}-
80-
81-
82-
83-
84-
85 static int ctr_BCC_init(RAND_DRBG_CTR *ctr)-
86{-
87 memset(ctr->KX, 0, 48);-
88 memset(ctr->bltmp, 0, 16);-
89 if (!ctr_BCC_block(ctr, ctr->KX, ctr->bltmp)
!ctr_BCC_block...X, ctr->bltmp)Description
TRUEnever evaluated
FALSEevaluated 1048909 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1048909
90 return
never executed: return 0;
0;
never executed: return 0;
0
91 ctr->bltmp[3] = 1;-
92 if (!ctr_BCC_block(ctr, ctr->KX + 16, ctr->bltmp)
!ctr_BCC_block...6, ctr->bltmp)Description
TRUEnever evaluated
FALSEevaluated 1054781 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1054781
93 return
never executed: return 0;
0;
never executed: return 0;
0
94 if (ctr->keylen != 16
ctr->keylen != 16Description
TRUEevaluated 1055022 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2406 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2406-1055022
95 ctr->bltmp[3] = 2;-
96 if (!ctr_BCC_block(ctr, ctr->KX + 32, ctr->bltmp)
!ctr_BCC_block...2, ctr->bltmp)Description
TRUEnever evaluated
FALSEevaluated 1052786 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1052786
97 return
never executed: return 0;
0;
never executed: return 0;
0
98 }
executed 1052231 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1052231
99 return
executed 1056216 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 1056216 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1056216
100}-
101-
102-
103-
104-
105 static int ctr_BCC_update(RAND_DRBG_CTR *ctr,-
106 const unsigned char *in, size_t inlen)-
107{-
108 if (in ==
in == ((void *)0)Description
TRUEevaluated 2109284 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2116530 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
2109284-2116530
109 ((void *)0)
in == ((void *)0)Description
TRUEevaluated 2109284 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2116530 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
2109284-2116530
110 || inlen == 0
inlen == 0Description
TRUEevaluated 3600 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2127705 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
3600-2127705
111 return
executed 2114178 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 2114178 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2114178
112-
113-
114 if (ctr->bltmp_pos
ctr->bltmp_posDescription
TRUEevaluated 2121858 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 4757 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
4757-2121858
115 size_t left = 16 - ctr->bltmp_pos;-
116-
117-
118 if (inlen >= left
inlen >= leftDescription
TRUEevaluated 1068528 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1062805 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
1062805-1068528
119 memcpy(ctr->bltmp + ctr->bltmp_pos, in, left);-
120 if (!ctr_BCC_blocks(ctr, ctr->bltmp)
!ctr_BCC_block...r, ctr->bltmp)Description
TRUEnever evaluated
FALSEevaluated 1061982 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1061982
121 return
never executed: return 0;
0;
never executed: return 0;
0
122 ctr->bltmp_pos = 0;-
123 inlen -= left;-
124 in += left;-
125 }
executed 1060802 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1060802
126 }
executed 2120769 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2120769
127-
128-
129 for (; inlen >= 16
inlen >= 16Description
TRUEevaluated 14057 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2122941 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
; in += 16, inlen -= 16) {
14057-2122941
130 if (!ctr_BCC_blocks(ctr, in)
!ctr_BCC_blocks(ctr, in)Description
TRUEnever evaluated
FALSEevaluated 14057 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-14057
131 return
never executed: return 0;
0;
never executed: return 0;
0
132 }
executed 14057 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
14057
133-
134-
135 if (inlen > 0
inlen > 0Description
TRUEevaluated 2116703 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 4757 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
4757-2116703
136 memcpy(ctr->bltmp + ctr->bltmp_pos, in, inlen);-
137 ctr->bltmp_pos += inlen;-
138 }
executed 2118794 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2118794
139 return
executed 2128649 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 2128649 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2128649
140}-
141-
142 static int ctr_BCC_final(RAND_DRBG_CTR *ctr)-
143{-
144 if (ctr->bltmp_pos
ctr->bltmp_posDescription
TRUEevaluated 1065727 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
) {
0-1065727
145 memset(ctr->bltmp + ctr->bltmp_pos, 0, 16 - ctr->bltmp_pos);-
146 if (!ctr_BCC_blocks(ctr, ctr->bltmp)
!ctr_BCC_block...r, ctr->bltmp)Description
TRUEnever evaluated
FALSEevaluated 1058357 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1058357
147 return
never executed: return 0;
0;
never executed: return 0;
0
148 }
executed 1058171 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1058171
149 return
executed 1060204 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 1060204 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1060204
150}-
151-
152 static int ctr_df(RAND_DRBG_CTR *ctr,-
153 const unsigned char *in1, size_t in1len,-
154 const unsigned char *in2, size_t in2len,-
155 const unsigned char *in3, size_t in3len)-
156{-
157 static unsigned char c80 = 0x80;-
158 size_t inlen;-
159 unsigned char *p = ctr->bltmp;-
160 int outlen = 16;-
161-
162 if (!ctr_BCC_init(ctr)
!ctr_BCC_init(ctr)Description
TRUEnever evaluated
FALSEevaluated 1054484 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1054484
163 return
never executed: return 0;
0;
never executed: return 0;
0
164 if (in1 ==
in1 == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1056829 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1056829
165 ((void *)0)
in1 == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1056829 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1056829
166 )-
167 in1len = 0;
never executed: in1len = 0;
0
168 if (in2 ==
in2 == ((void *)0)Description
TRUEevaluated 1058043 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2947 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
2947-1058043
169 ((void *)0)
in2 == ((void *)0)Description
TRUEevaluated 1058043 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2947 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
2947-1058043
170 )-
171 in2len = 0;
executed 1057171 times by 2 tests: in2len = 0;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1057171
172 if (in3 ==
in3 == ((void *)0)Description
TRUEevaluated 1055418 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6171 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
6171-1055418
173 ((void *)0)
in3 == ((void *)0)Description
TRUEevaluated 1055418 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6171 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
6171-1055418
174 )-
175 in3len = 0;
executed 1057536 times by 2 tests: in3len = 0;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1057536
176 inlen = in1len + in2len + in3len;-
177-
178 *p++ = (inlen >> 24) & 0xff;-
179 *p++ = (inlen >> 16) & 0xff;-
180 *p++ = (inlen >> 8) & 0xff;-
181 *p++ = inlen & 0xff;-
182-
183-
184 *p++ = 0;-
185 *p++ = 0;-
186 *p++ = 0;-
187 *p = (unsigned char)((ctr->keylen + 16) & 0xff);-
188 ctr->bltmp_pos = 8;-
189 if (!ctr_BCC_update(ctr, in1, in1len)
!ctr_BCC_updat..., in1, in1len)Description
TRUEnever evaluated
FALSEevaluated 1060519 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1060519
190 || !ctr_BCC_update(ctr, in2, in2len)
!ctr_BCC_updat..., in2, in2len)Description
TRUEnever evaluated
FALSEevaluated 1061657 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1061657
191 || !ctr_BCC_update(ctr, in3, in3len)
!ctr_BCC_updat..., in3, in3len)Description
TRUEnever evaluated
FALSEevaluated 1061592 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1061592
192 || !ctr_BCC_update(ctr, &c80, 1)
!ctr_BCC_update(ctr, &c80, 1)Description
TRUEnever evaluated
FALSEevaluated 1067026 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1067026
193 || !ctr_BCC_final(ctr)
!ctr_BCC_final(ctr)Description
TRUEnever evaluated
FALSEevaluated 1059890 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1059890
194 return
never executed: return 0;
0;
never executed: return 0;
0
195-
196 if (!EVP_CipherInit_ex(ctr->ctx, ctr->cipher,
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 1039622 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1039622
197 ((void *)0)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 1039622 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1039622
198 , ctr->KX,
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 1039622 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1039622
199 ((void *)0)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 1039622 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1039622
200 , 1)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 1039622 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1039622
201 return
never executed: return 0;
0;
never executed: return 0;
0
202-
203 if (!EVP_CipherUpdate(ctr->ctx, ctr->KX, &outlen, ctr->KX + ctr->keylen,
!EVP_CipherUpd...r->keylen, 16)Description
TRUEnever evaluated
FALSEevaluated 1033080 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1033080
204 16)
!EVP_CipherUpd...r->keylen, 16)Description
TRUEnever evaluated
FALSEevaluated 1033080 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1033080
205 || outlen != 16
outlen != 16Description
TRUEnever evaluated
FALSEevaluated 1032116 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1032116
206 return
never executed: return 0;
0;
never executed: return 0;
0
207 if (!EVP_CipherUpdate(ctr->ctx, ctr->KX + 16, &outlen, ctr->KX,
!EVP_CipherUpd..., ctr->KX, 16)Description
TRUEnever evaluated
FALSEevaluated 1036967 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1036967
208 16)
!EVP_CipherUpd..., ctr->KX, 16)Description
TRUEnever evaluated
FALSEevaluated 1036967 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1036967
209 || outlen != 16
outlen != 16Description
TRUEnever evaluated
FALSEevaluated 1053122 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1053122
210 return
never executed: return 0;
0;
never executed: return 0;
0
211 if (ctr->keylen != 16
ctr->keylen != 16Description
TRUEevaluated 1048801 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2406 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
2406-1048801
212 if (!EVP_CipherUpdate(ctr->ctx, ctr->KX + 32, &outlen, ctr->KX + 16,
!EVP_CipherUpd...->KX + 16, 16)Description
TRUEnever evaluated
FALSEevaluated 1036021 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1036021
213 16)
!EVP_CipherUpd...->KX + 16, 16)Description
TRUEnever evaluated
FALSEevaluated 1036021 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1036021
214 || outlen != 16
outlen != 16Description
TRUEnever evaluated
FALSEevaluated 1036464 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1036464
215 return
never executed: return 0;
0;
never executed: return 0;
0
216 return
executed 1037211 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 1037211 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1037211
217}-
218-
219-
220-
221-
222-
223-
224-
225 static int ctr_update(RAND_DRBG *drbg,-
226 const unsigned char *in1, size_t in1len,-
227 const unsigned char *in2, size_t in2len,-
228 const unsigned char *nonce, size_t noncelen)-
229{-
230 RAND_DRBG_CTR *ctr = &drbg->data.ctr;-
231 int outlen = 16;-
232-
233-
234 inc_128(ctr);-
235 if (!EVP_CipherUpdate(ctr->ctx, ctr->K, &outlen, ctr->V, 16)
!EVP_CipherUpd...n, ctr->V, 16)Description
TRUEnever evaluated
FALSEevaluated 2077957 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-2077957
236 || outlen != 16
outlen != 16Description
TRUEnever evaluated
FALSEevaluated 2090106 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-2090106
237 return
never executed: return 0;
0;
never executed: return 0;
0
238-
239-
240 if (ctr->keylen != 16
ctr->keylen != 16Description
TRUEevaluated 2084114 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6738 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
6738-2084114
241 inc_128(ctr);-
242 if (!EVP_CipherUpdate(ctr->ctx, ctr->K+16, &outlen, ctr->V,
!EVP_CipherUpd...n, ctr->V, 16)Description
TRUEnever evaluated
FALSEevaluated 2083800 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-2083800
243 16)
!EVP_CipherUpd...n, ctr->V, 16)Description
TRUEnever evaluated
FALSEevaluated 2083800 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-2083800
244 || outlen != 16
outlen != 16Description
TRUEnever evaluated
FALSEevaluated 2085401 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-2085401
245 return
never executed: return 0;
0;
never executed: return 0;
0
246 }
executed 2077559 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2077559
247 inc_128(ctr);-
248 if (!EVP_CipherUpdate(ctr->ctx, ctr->V, &outlen, ctr->V, 16)
!EVP_CipherUpd...n, ctr->V, 16)Description
TRUEnever evaluated
FALSEevaluated 2091943 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-2091943
249 || outlen != 16
outlen != 16Description
TRUEnever evaluated
FALSEevaluated 2109462 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-2109462
250 return
never executed: return 0;
0;
never executed: return 0;
0
251-
252-
253 if (ctr->keylen == 24
ctr->keylen == 24Description
TRUEevaluated 6738 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2099521 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
6738-2099521
254 memcpy(ctr->V + 8, ctr->V, 8);-
255 memcpy(ctr->V, ctr->K + 24, 8);-
256 }
executed 6738 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
6738
257-
258 if ((
(drbg->flags & 0x1) == 0Description
TRUEevaluated 2094452 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 10107 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
drbg->flags & 0x1) == 0
(drbg->flags & 0x1) == 0Description
TRUEevaluated 2094452 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 10107 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
10107-2094452
259-
260 if (in1 !=
in1 != ((void *)0)Description
TRUEevaluated 1051507 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1052792 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1051507-1052792
261 ((void *)0)
in1 != ((void *)0)Description
TRUEevaluated 1051507 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1052792 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1051507-1052792
262 || nonce !=
nonce != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1053558 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1053558
263 ((void *)0)
nonce != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1053558 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1053558
264 || in2 !=
in2 != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1059308 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1059308
265 ((void *)0)
in2 != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1059308 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1059308
266 )-
267 if (!ctr_df(ctr, in1, in1len, nonce, noncelen, in2, in2len)
!ctr_df(ctr, i..., in2, in2len)Description
TRUEnever evaluated
FALSEevaluated 1036562 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1036562
268 return
never executed: return 0;
0;
never executed: return 0;
0
269-
270 if (in1len
in1lenDescription
TRUEevaluated 2104731 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 3984 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
3984-2104731
271 ctr_XOR(ctr, ctr->KX, drbg->seedlen);
executed 2094558 times by 2 tests: ctr_XOR(ctr, ctr->KX, drbg->seedlen);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2094558
272 }
executed 2112796 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
else {
2112796
273 ctr_XOR(ctr, in1, in1len);-
274 ctr_XOR(ctr, in2, in2len);-
275 }
executed 10107 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
10107
276-
277 if (!EVP_CipherInit_ex(ctr->ctx, ctr->cipher,
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 2082205 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-2082205
278 ((void *)0)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 2082205 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-2082205
279 , ctr->K,
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 2082205 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-2082205
280 ((void *)0)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 2082205 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-2082205
281 , 1)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 2082205 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-2082205
282 return
never executed: return 0;
0;
never executed: return 0;
0
283 return
executed 2079305 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 2079305 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2079305
284}-
285-
286 static int drbg_ctr_instantiate(RAND_DRBG *drbg,-
287 const unsigned char *entropy, size_t entropylen,-
288 const unsigned char *nonce, size_t noncelen,-
289 const unsigned char *pers, size_t perslen)-
290{-
291 RAND_DRBG_CTR *ctr = &drbg->data.ctr;-
292-
293 if (entropy ==
entropy == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6125
294 ((void *)0)
entropy == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6125
295 )-
296 return
never executed: return 0;
0;
never executed: return 0;
0
297-
298 memset(ctr->K, 0, sizeof(ctr->K));-
299 memset(ctr->V, 0, sizeof(ctr->V));-
300 if (!EVP_CipherInit_ex(ctr->ctx, ctr->cipher,
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6125
301 ((void *)0)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6125
302 , ctr->K,
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6125
303 ((void *)0)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6125
304 , 1)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-6125
305 return
never executed: return 0;
0;
never executed: return 0;
0
306 if (!ctr_update(drbg, entropy, entropylen, pers, perslen, nonce, noncelen)
!ctr_update(dr...nce, noncelen)Description
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-6125
307 return
never executed: return 0;
0;
never executed: return 0;
0
308 return
executed 6125 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 6125 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6125
309}-
310-
311 static int drbg_ctr_reseed(RAND_DRBG *drbg,-
312 const unsigned char *entropy, size_t entropylen,-
313 const unsigned char *adin, size_t adinlen)-
314{-
315 if (entropy ==
entropy == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4400
316 ((void *)0)
entropy == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4400
317 )-
318 return
never executed: return 0;
0;
never executed: return 0;
0
319 if (!ctr_update(drbg, entropy, entropylen, adin, adinlen,
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4400
320 ((void *)0)
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4400
321 , 0)
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4400
322 return
never executed: return 0;
0;
never executed: return 0;
0
323 return
executed 4400 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 4400 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
4400
324}-
325-
326 static int drbg_ctr_generate(RAND_DRBG *drbg,-
327 unsigned char *out, size_t outlen,-
328 const unsigned char *adin, size_t adinlen)-
329{-
330 RAND_DRBG_CTR *ctr = &drbg->data.ctr;-
331-
332 if (adin !=
adin != ((void *)0)Description
TRUEevaluated 1043409 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 3990 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
3990-1043409
333 ((void *)0)
adin != ((void *)0)Description
TRUEevaluated 1043409 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 3990 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
3990-1043409
334 && adinlen != 0
adinlen != 0Description
TRUEevaluated 1044062 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2880 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2880-1044062
335 if (!ctr_update(drbg, adin, adinlen,
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1034495 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1034495
336 ((void *)0)
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1034495 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1034495
337 , 0,
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1034495 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1034495
338 ((void *)0)
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1034495 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1034495
339 , 0)
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1034495 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1034495
340 return
never executed: return 0;
0;
never executed: return 0;
0
341-
342 if ((
(drbg->flags & 0x1) == 0Description
TRUEevaluated 1035196 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1443 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
drbg->flags & 0x1) == 0
(drbg->flags & 0x1) == 0Description
TRUEevaluated 1035196 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1443 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1443-1035196
343 adin = -
344 ((void *)0)-
345 ;-
346 adinlen = 1;-
347 }
executed 1033532 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1033532
348 }
executed 1039031 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
else {
1039031
349 adinlen = 0;-
350 }
executed 6870 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6870
351-
352 for ( ; ; ) {-
353 int outl = 16;-
354-
355 inc_128(ctr);-
356 if (outlen < 16
outlen < 16Description
TRUEevaluated 230486 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 11753918 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
230486-11753918
357-
358 if (!EVP_CipherUpdate(ctr->ctx, ctr->K, &outl, ctr->V,
!EVP_CipherUpd...l, ctr->V, 16)Description
TRUEnever evaluated
FALSEevaluated 230486 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-230486
359 16)
!EVP_CipherUpd...l, ctr->V, 16)Description
TRUEnever evaluated
FALSEevaluated 230486 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-230486
360 || outl != 16
outl != 16Description
TRUEnever evaluated
FALSEevaluated 230486 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-230486
361 return
never executed: return 0;
0;
never executed: return 0;
0
362 memcpy(out, ctr->K, outlen);-
363 break;
executed 230486 times by 2 tests: break;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
230486
364 }-
365 if (!EVP_CipherUpdate(ctr->ctx, out, &outl, ctr->V, 16)
!EVP_CipherUpd...l, ctr->V, 16)Description
TRUEnever evaluated
FALSEevaluated 11465781 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-11465781
366 || outl != 16
outl != 16Description
TRUEnever evaluated
FALSEevaluated 11885959 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-11885959
367 return
never executed: return 0;
0;
never executed: return 0;
0
368 out += 16;-
369 outlen -= 16;-
370 if (outlen == 0
outlen == 0Description
TRUEevaluated 827529 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 11119617 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
827529-11119617
371 break;
executed 827491 times by 2 tests: break;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
827491
372 }
executed 11085862 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
11085862
373-
374 if (!ctr_update(drbg, adin, adinlen,
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1038266 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1038266
375 ((void *)0)
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1038266 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1038266
376 , 0,
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1038266 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1038266
377 ((void *)0)
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1038266 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1038266
378 , 0)
!ctr_update(dr...void *)0) , 0)Description
TRUEnever evaluated
FALSEevaluated 1038266 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1038266
379 return
never executed: return 0;
0;
never executed: return 0;
0
380 return
executed 1036700 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 1036700 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1036700
381}-
382-
383static int drbg_ctr_uninstantiate(RAND_DRBG *drbg)-
384{-
385 EVP_CIPHER_CTX_free(drbg->data.ctr.ctx);-
386 EVP_CIPHER_CTX_free(drbg->data.ctr.ctx_df);-
387 OPENSSL_cleanse(&drbg->data.ctr, sizeof(drbg->data.ctr));-
388 return
executed 14785 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 14785 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
14785
389}-
390-
391static RAND_DRBG_METHOD drbg_ctr_meth = {-
392 drbg_ctr_instantiate,-
393 drbg_ctr_reseed,-
394 drbg_ctr_generate,-
395 drbg_ctr_uninstantiate-
396};-
397-
398int drbg_ctr_init(RAND_DRBG *drbg)-
399{-
400 RAND_DRBG_CTR *ctr = &drbg->data.ctr;-
401 size_t keylen;-
402-
403 switch (drbg->type) {-
404 default
never executed: default:
:
never executed: default:
0
405-
406 return
never executed: return 0;
0;
never executed: return 0;
0
407 case
executed 4332 times by 1 test: case 904:
Executed by:
  • libcrypto.so.1.1
904:
executed 4332 times by 1 test: case 904:
Executed by:
  • libcrypto.so.1.1
4332
408 keylen = 16;-
409 ctr->cipher = EVP_aes_128_ecb();-
410 break;
executed 4332 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
4332
411 case
executed 4332 times by 1 test: case 905:
Executed by:
  • libcrypto.so.1.1
905:
executed 4332 times by 1 test: case 905:
Executed by:
  • libcrypto.so.1.1
4332
412 keylen = 24;-
413 ctr->cipher = EVP_aes_192_ecb();-
414 break;
executed 4332 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
4332
415 case
executed 6133 times by 2 tests: case 906:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
906:
executed 6133 times by 2 tests: case 906:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6133
416 keylen = 32;-
417 ctr->cipher = EVP_aes_256_ecb();-
418 break;
executed 6133 times by 2 tests: break;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6133
419 }-
420-
421 drbg->meth = &drbg_ctr_meth;-
422-
423 ctr->keylen = keylen;-
424 if (ctr->ctx ==
ctr->ctx == ((void *)0)Description
TRUEevaluated 14785 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
12-14785
425 ((void *)0)
ctr->ctx == ((void *)0)Description
TRUEevaluated 14785 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
12-14785
426 )-
427 ctr->ctx = EVP_CIPHER_CTX_new();
executed 14785 times by 2 tests: ctr->ctx = EVP_CIPHER_CTX_new();
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
14785
428 if (ctr->ctx ==
ctr->ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 14797 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-14797
429 ((void *)0)
ctr->ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 14797 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-14797
430 )-
431 return
never executed: return 0;
0;
never executed: return 0;
0
432 drbg->strength = keylen * 8;-
433 drbg->seedlen = keylen + 16;-
434-
435 if ((
(drbg->flags & 0x1) == 0Description
TRUEevaluated 8299 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6498 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
drbg->flags & 0x1) == 0
(drbg->flags & 0x1) == 0Description
TRUEevaluated 8299 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6498 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
6498-8299
436-
437 static const unsigned char df_key[32] = {-
438 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,-
439 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,-
440 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,-
441 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f-
442 };-
443-
444 if (ctr->ctx_df ==
ctr->ctx_df == ((void *)0)Description
TRUEevaluated 8293 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
6-8293
445 ((void *)0)
ctr->ctx_df == ((void *)0)Description
TRUEevaluated 8293 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
6-8293
446 )-
447 ctr->ctx_df = EVP_CIPHER_CTX_new();
executed 8293 times by 2 tests: ctr->ctx_df = EVP_CIPHER_CTX_new();
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
8293
448 if (ctr->ctx_df ==
ctr->ctx_df == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8299 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8299
449 ((void *)0)
ctr->ctx_df == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8299 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8299
450 )-
451 return
never executed: return 0;
0;
never executed: return 0;
0
452-
453 if (!EVP_CipherInit_ex(ctr->ctx_df, ctr->cipher,
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 8299 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8299
454 ((void *)0)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 8299 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8299
455 , df_key,
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 8299 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8299
456 ((void *)0)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 8299 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-8299
457 , 1)
!EVP_CipherIni...void *)0) , 1)Description
TRUEnever evaluated
FALSEevaluated 8299 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-8299
458 return
never executed: return 0;
0;
never executed: return 0;
0
459-
460 drbg->min_entropylen = ctr->keylen;-
461 drbg->max_entropylen = 128 * drbg->min_entropylen;-
462 drbg->min_noncelen = drbg->min_entropylen / 2;-
463 drbg->max_noncelen = 128 * drbg->min_noncelen;-
464 drbg->max_perslen = 4096;-
465 drbg->max_adinlen = 4096;-
466 }
executed 8299 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
else {
8299
467 drbg->min_entropylen = drbg->seedlen;-
468 drbg->max_entropylen = drbg->seedlen;-
469-
470 drbg->min_noncelen = 0;-
471 drbg->max_noncelen = 0;-
472 drbg->max_perslen = drbg->seedlen;-
473 drbg->max_adinlen = drbg->seedlen;-
474 }
executed 6498 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
6498
475-
476 drbg->max_request = 1 << 16;-
477-
478 return
executed 14797 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 14797 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
14797
479}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2