OpenCoverage

drbg_lib.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/rand/drbg_lib.c
Switch to Source codePreprocessed file
LineSourceCount
1static RAND_DRBG *master_drbg;-
2-
3-
4-
5-
6-
7-
8-
9static CRYPTO_THREAD_LOCAL public_drbg;-
10-
11-
12-
13-
14-
15-
16-
17static CRYPTO_THREAD_LOCAL private_drbg;-
18-
19-
20-
21-
22static const char ossl_pers_string[] = "OpenSSL NIST SP 800-90A DRBG";-
23-
24static CRYPTO_ONCE rand_drbg_init = -
25 0-
26 ;-
27-
28-
29-
30static int rand_drbg_type = 906;-
31static unsigned int rand_drbg_flags = 0;-
32-
33static unsigned int master_reseed_interval = (1 << 8);-
34static unsigned int slave_reseed_interval = (1 << 16);-
35-
36static time_t master_reseed_time_interval = (60*60);-
37static time_t slave_reseed_time_interval = (7*60);-
38-
39-
40static const unsigned int rand_drbg_used_flags =-
41 0x1;-
42-
43static RAND_DRBG *drbg_setup(RAND_DRBG *parent);-
44-
45static RAND_DRBG *rand_drbg_new(int secure,-
46 int type,-
47 unsigned int flags,-
48 RAND_DRBG *parent);-
49int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags)-
50{-
51 int ret = 1;-
52-
53 if (type == 0
type == 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14791 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& flags == 0
flags == 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-14791
54 type = rand_drbg_type;-
55 flags = rand_drbg_flags;-
56 }
executed 6 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
6
57-
58 drbg->state = DRBG_UNINITIALISED;-
59 drbg->flags = flags;-
60 drbg->type = type;-
61-
62 switch (type) {-
63 default
never executed: default:
:
never executed: default:
0
64 ERR_put_error(36,(104),(120),__FILE__,118);-
65 return
never executed: return 0;
0;
never executed: return 0;
0
66 case
never executed: case 0:
0:
never executed: case 0:
0
67-
68 return
never executed: return 1;
1;
never executed: return 1;
0
69 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
70 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
71 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
72 ret = drbg_ctr_init(drbg);-
73 break;
executed 14797 times by 2 tests: break;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
14797
74 }-
75-
76 if (ret == 0
ret == 0Description
TRUEnever evaluated
FALSEevaluated 14797 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-14797
77 ERR_put_error(36,(104),(107),__FILE__,131);
never executed: ERR_put_error(36,(104),(107),__FILE__,131);
0
78 return
executed 14797 times by 2 tests: return ret;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ret;
executed 14797 times by 2 tests: return ret;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
14797
79}-
80-
81-
82-
83-
84-
85-
86int RAND_DRBG_set_defaults(int type, unsigned int flags)-
87{-
88 int ret = 1;-
89-
90 switch (type) {-
91 default
never executed: default:
:
never executed: default:
0
92 ERR_put_error(36,(121),(120),__FILE__,146);-
93 return
never executed: return 0;
0;
never executed: return 0;
0
94 case
never executed: case 904:
904:
never executed: case 904:
0
95 case
never executed: case 905:
905:
never executed: case 905:
0
96 case
never executed: case 906:
906:
never executed: case 906:
0
97 break;
never executed: break;
0
98 }-
99-
100 if ((
(flags & ~rand...ed_flags) != 0Description
TRUEnever evaluated
FALSEnever evaluated
flags & ~rand_drbg_used_flags) != 0
(flags & ~rand...ed_flags) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
101 ERR_put_error(36,(121),(132),__FILE__,155);-
102 return
never executed: return 0;
0;
never executed: return 0;
0
103 }-
104-
105 rand_drbg_type = type;-
106 rand_drbg_flags = flags;-
107-
108 return
never executed: return ret;
ret;
never executed: return ret;
0
109}-
110static RAND_DRBG *rand_drbg_new(int secure,-
111 int type,-
112 unsigned int flags,-
113 RAND_DRBG *parent)-
114{-
115 RAND_DRBG *drbg = secure
secureDescription
TRUEevaluated 1787 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 4332 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
?
1787-4332
116 CRYPTO_secure_zalloc(sizeof(*drbg), __FILE__, 179) : CRYPTO_zalloc(sizeof(*drbg), __FILE__, 179);-
117-
118 if (drbg ==
drbg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6119
119 ((void *)0)
drbg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6119
120 ) {-
121 ERR_put_error(36,(109),((1|64)),__FILE__,182);-
122 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
123 ((void *)0)
never executed: return ((void *)0) ;
0
124 ;
never executed: return ((void *)0) ;
0
125 }-
126-
127 drbg->secure = secure
secureDescription
TRUEevaluated 1787 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 4332 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& CRYPTO_secure_allocated(drbg)
CRYPTO_secure_allocated(drbg)Description
TRUEnever evaluated
FALSEevaluated 1787 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
;
0-4332
128 drbg->fork_count = rand_fork_count;-
129 drbg->parent = parent;-
130-
131 if (parent ==
parent == ((void *)0)Description
TRUEevaluated 5111 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1008 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1008-5111
132 ((void *)0)
parent == ((void *)0)Description
TRUEevaluated 5111 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1008 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1008-5111
133 ) {-
134 drbg->get_entropy = rand_drbg_get_entropy;-
135 drbg->cleanup_entropy = rand_drbg_cleanup_entropy;-
136-
137 drbg->get_nonce = rand_drbg_get_nonce;-
138 drbg->cleanup_nonce = rand_drbg_cleanup_nonce;-
139-
140-
141 drbg->reseed_interval = master_reseed_interval;-
142 drbg->reseed_time_interval = master_reseed_time_interval;-
143 }
executed 5111 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
else {
5111
144 drbg->get_entropy = rand_drbg_get_entropy;-
145 drbg->cleanup_entropy = rand_drbg_cleanup_entropy;-
146-
147-
148-
149-
150-
151 drbg->reseed_interval = slave_reseed_interval;-
152 drbg->reseed_time_interval = slave_reseed_time_interval;-
153 }
executed 1008 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1008
154-
155 if (RAND_DRBG_set(drbg, type, flags) == 0
RAND_DRBG_set(...e, flags) == 0Description
TRUEnever evaluated
FALSEevaluated 6119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-6119
156 goto
never executed: goto err;
err;
never executed: goto err;
0
157-
158 if (parent !=
parent != ((void *)0)Description
TRUEevaluated 1008 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 5111 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1008-5111
159 ((void *)0)
parent != ((void *)0)Description
TRUEevaluated 1008 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 5111 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1008-5111
160 ) {-
161 rand_drbg_lock(parent);-
162 if (drbg->strength > parent->strength
drbg->strength...rent->strengthDescription
TRUEnever evaluated
FALSEevaluated 1008 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-1008
163-
164-
165-
166-
167 rand_drbg_unlock(parent);-
168 ERR_put_error(36,(109),(131),__FILE__,223);-
169 goto
never executed: goto err;
err;
never executed: goto err;
0
170 }-
171 rand_drbg_unlock(parent);-
172 }
executed 1008 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1008
173-
174 return
executed 6119 times by 2 tests: return drbg;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
drbg;
executed 6119 times by 2 tests: return drbg;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6119
175-
176err:-
177 if (drbg->secure
drbg->secureDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
178 CRYPTO_secure_free(drbg, __FILE__, 233);
never executed: CRYPTO_secure_free(drbg, __FILE__, 233);
0
179 else-
180 CRYPTO_free(drbg, __FILE__, 235);
never executed: CRYPTO_free(drbg, __FILE__, 235);
0
181-
182 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
183 ((void *)0)
never executed: return ((void *)0) ;
0
184 ;
never executed: return ((void *)0) ;
0
185}-
186-
187RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent)-
188{-
189 return
executed 4332 times by 1 test: return rand_drbg_new(0, type, flags, parent);
Executed by:
  • libcrypto.so.1.1
rand_drbg_new(0, type, flags, parent);
executed 4332 times by 1 test: return rand_drbg_new(0, type, flags, parent);
Executed by:
  • libcrypto.so.1.1
4332
190}-
191-
192RAND_DRBG *RAND_DRBG_secure_new(int type, unsigned int flags, RAND_DRBG *parent)-
193{-
194 return
executed 1787 times by 2 tests: return rand_drbg_new(1, type, flags, parent);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
rand_drbg_new(1, type, flags, parent);
executed 1787 times by 2 tests: return rand_drbg_new(1, type, flags, parent);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1787
195}-
196-
197-
198-
199-
200void RAND_DRBG_free(RAND_DRBG *drbg)-
201{-
202 if (drbg ==
drbg == ((void *)0)Description
TRUEevaluated 556 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
556-6119
203 ((void *)0)
drbg == ((void *)0)Description
TRUEevaluated 556 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
556-6119
204 )-
205 return;
executed 556 times by 2 tests: return;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
556
206-
207 if (drbg->meth !=
drbg->meth != ((void *)0)Description
TRUEevaluated 6119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
0-6119
208 ((void *)0)
drbg->meth != ((void *)0)Description
TRUEevaluated 6119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
0-6119
209 )-
210 drbg->meth->uninstantiate(drbg);
executed 6119 times by 2 tests: drbg->meth->uninstantiate(drbg);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6119
211 CRYPTO_THREAD_lock_free(drbg->lock);-
212 CRYPTO_free_ex_data(15, drbg, &drbg->ex_data);-
213-
214 if (drbg->secure
drbg->secureDescription
TRUEnever evaluated
FALSEevaluated 6119 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-6119
215 CRYPTO_secure_clear_free(drbg, sizeof(*drbg), __FILE__, 264);
never executed: CRYPTO_secure_clear_free(drbg, sizeof(*drbg), __FILE__, 264);
0
216 else-
217 CRYPTO_clear_free(drbg, sizeof(*drbg), __FILE__, 266);
executed 6119 times by 2 tests: CRYPTO_clear_free(drbg, sizeof(*drbg), __FILE__, 266);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6119
218}-
219int RAND_DRBG_instantiate(RAND_DRBG *drbg,-
220 const unsigned char *pers, size_t perslen)-
221{-
222 unsigned char *nonce = -
223 ((void *)0)-
224 , *entropy = -
225 ((void *)0)-
226 ;-
227 size_t noncelen = 0, entropylen = 0;-
228 size_t min_entropy = drbg->strength;-
229 size_t min_entropylen = drbg->min_entropylen;-
230 size_t max_entropylen = drbg->max_entropylen;-
231-
232 if (perslen > drbg->max_perslen
perslen > drbg->max_perslenDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6134 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
6-6134
233 ERR_put_error(36,(108),(116),__FILE__,288)-
234 ;-
235 goto
executed 6 times by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
end;
executed 6 times by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
6
236 }-
237-
238 if (drbg->meth ==
drbg->meth == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6134 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6134
239 ((void *)0)
drbg->meth == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6134 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6134
240 ) {-
241 ERR_put_error(36,(108),(128),__FILE__,294)-
242 ;-
243 goto
never executed: goto end;
end;
never executed: goto end;
0
244 }-
245-
246 if (drbg->state != DRBG_UNINITIALISED
drbg->state !=..._UNINITIALISEDDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6133 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
1-6133
247 ERR_put_error(36,(108),(drbg->state == DRBG_ERROR ? 114 : 103),__FILE__,301)-
248-
249 ;-
250 goto
executed 1 time by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
end;
executed 1 time by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
1
251 }-
252-
253 drbg->state = DRBG_ERROR;-
254-
255-
256-
257-
258-
259-
260-
261 if (drbg->min_noncelen > 0
drbg->min_noncelen > 0Description
TRUEevaluated 3964 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2169 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& drbg->get_nonce ==
drbg->get_nonce == ((void *)0)Description
TRUEevaluated 1012 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2952 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1012-3964
262 ((void *)0)
drbg->get_nonce == ((void *)0)Description
TRUEevaluated 1012 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2952 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1012-2952
263 ) {-
264 min_entropy += drbg->strength / 2;-
265 min_entropylen += drbg->min_noncelen;-
266 max_entropylen += drbg->max_noncelen;-
267 }
executed 1012 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1012
268-
269 if (drbg->get_entropy !=
drbg->get_entr...!= ((void *)0)Description
TRUEevaluated 6133 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
0-6133
270 ((void *)0)
drbg->get_entr...!= ((void *)0)Description
TRUEevaluated 6133 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
0-6133
271 )-
272 entropylen = drbg->get_entropy(drbg, &entropy, min_entropy,
executed 6133 times by 2 tests: entropylen = drbg->get_entropy(drbg, &entropy, min_entropy, min_entropylen, max_entropylen, 0);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6133
273 min_entropylen, max_entropylen, 0);
executed 6133 times by 2 tests: entropylen = drbg->get_entropy(drbg, &entropy, min_entropy, min_entropylen, max_entropylen, 0);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6133
274 if (entropylen < min_entropylen
entropylen < min_entropylenDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
8-6125
275 || entropylen > max_entropylen
entropylen > max_entropylenDescription
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-6125
276 ERR_put_error(36,(108),(110),__FILE__,324);-
277 goto
executed 8 times by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
end;
executed 8 times by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
8
278 }-
279-
280 if (drbg->min_noncelen > 0
drbg->min_noncelen > 0Description
TRUEevaluated 3959 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2166 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& drbg->get_nonce !=
drbg->get_nonce != ((void *)0)Description
TRUEevaluated 2947 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1012 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1012-3959
281 ((void *)0)
drbg->get_nonce != ((void *)0)Description
TRUEevaluated 2947 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1012 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1012-2947
282 ) {-
283 noncelen = drbg->get_nonce(drbg, &nonce, drbg->strength / 2,-
284 drbg->min_noncelen, drbg->max_noncelen);-
285 if (noncelen < drbg->min_noncelen
noncelen < drbg->min_noncelenDescription
TRUEnever evaluated
FALSEevaluated 2947 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
|| noncelen > drbg->max_noncelen
noncelen > drbg->max_noncelenDescription
TRUEnever evaluated
FALSEevaluated 2947 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-2947
286 ERR_put_error(36,(108),(111),__FILE__,332);-
287 goto
never executed: goto end;
end;
never executed: goto end;
0
288 }-
289 }
executed 2947 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2947
290-
291 if (!drbg->meth->instantiate(drbg, entropy, entropylen,
!drbg->meth->i...pers, perslen)Description
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6125
292 nonce, noncelen, pers, perslen)
!drbg->meth->i...pers, perslen)Description
TRUEnever evaluated
FALSEevaluated 6125 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-6125
293 ERR_put_error(36,(108),(108),__FILE__,339);-
294 goto
never executed: goto end;
end;
never executed: goto end;
0
295 }-
296-
297 drbg->state = DRBG_READY;-
298 drbg->generate_counter = 0;-
299 drbg->reseed_time = time(-
300 ((void *)0)-
301 );-
302 if (drbg->reseed_counter > 0
drbg->reseed_counter > 0Description
TRUEevaluated 1793 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 4332 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1793-4332
303 if (drbg->parent ==
drbg->parent == ((void *)0)Description
TRUEevaluated 781 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1012 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
781-1012
304 ((void *)0)
drbg->parent == ((void *)0)Description
TRUEevaluated 781 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1012 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
781-1012
305 )-
306 drbg->reseed_counter++;
executed 781 times by 2 tests: drbg->reseed_counter++;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
781
307 else-
308 drbg->reseed_counter = drbg->parent->reseed_counter;
executed 1012 times by 2 tests: drbg->reseed_counter = drbg->parent->reseed_counter;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1012
309 }-
310-
311end:
code before this statement executed 6125 times by 2 tests: end:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6125
312 if (entropy !=
entropy != ((void *)0)Description
TRUEevaluated 6131 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
9-6131
313 ((void *)0)
entropy != ((void *)0)Description
TRUEevaluated 6131 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
9-6131
314 && drbg->cleanup_entropy !=
drbg->cleanup_...!= ((void *)0)Description
TRUEevaluated 1793 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 4338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1793-4338
315 ((void *)0)
drbg->cleanup_...!= ((void *)0)Description
TRUEevaluated 1793 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 4338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1793-4338
316 )-
317 drbg->cleanup_entropy(drbg, entropy, entropylen);
executed 1793 times by 2 tests: drbg->cleanup_entropy(drbg, entropy, entropylen);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1793
318 if (nonce !=
nonce != ((void *)0)Description
TRUEevaluated 2947 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 3193 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
2947-3193
319 ((void *)0)
nonce != ((void *)0)Description
TRUEevaluated 2947 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 3193 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
2947-3193
320 && drbg->cleanup_nonce!=
drbg->cleanup_...!= ((void *)0)Description
TRUEevaluated 781 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2166 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
781-2166
321 ((void *)0)
drbg->cleanup_...!= ((void *)0)Description
TRUEevaluated 781 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 2166 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
781-2166
322 )-
323 drbg->cleanup_nonce(drbg, nonce, noncelen);
executed 781 times by 2 tests: drbg->cleanup_nonce(drbg, nonce, noncelen);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
781
324 if (drbg->pool !=
drbg->pool != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6140 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6140
325 ((void *)0)
drbg->pool != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6140 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-6140
326 ) {-
327 if (drbg->state == DRBG_READY
drbg->state == DRBG_READYDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
328 ERR_put_error(36,(108),(127),__FILE__,361)-
329 ;-
330 drbg->state = DRBG_ERROR;-
331 }
never executed: end of block
0
332 rand_pool_free(drbg->pool);-
333 drbg->pool = -
334 ((void *)0)-
335 ;-
336 }
never executed: end of block
0
337 if (drbg->state == DRBG_READY
drbg->state == DRBG_READYDescription
TRUEevaluated 6126 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
14-6126
338 return
executed 6126 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 6126 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
6126
339 return
executed 14 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 14 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
14
340}-
341int RAND_DRBG_uninstantiate(RAND_DRBG *drbg)-
342{-
343 if (drbg->meth ==
drbg->meth == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8666 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8666
344 ((void *)0)
drbg->meth == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8666 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8666
345 ) {-
346 ERR_put_error(36,(118),(128),__FILE__,383)-
347 ;-
348 return
never executed: return 0;
0;
never executed: return 0;
0
349 }-
350-
351-
352-
353-
354-
355 drbg->meth->uninstantiate(drbg);-
356 return
executed 8666 times by 1 test: return RAND_DRBG_set(drbg, drbg->type, drbg->flags);
Executed by:
  • libcrypto.so.1.1
RAND_DRBG_set(drbg, drbg->type, drbg->flags);
executed 8666 times by 1 test: return RAND_DRBG_set(drbg, drbg->type, drbg->flags);
Executed by:
  • libcrypto.so.1.1
8666
357}-
358int RAND_DRBG_reseed(RAND_DRBG *drbg,-
359 const unsigned char *adin, size_t adinlen,-
360 int prediction_resistance)-
361{-
362 unsigned char *entropy = -
363 ((void *)0)-
364 ;-
365 size_t entropylen = 0;-
366-
367 if (drbg->state == DRBG_ERROR
drbg->state == DRBG_ERRORDescription
TRUEnever evaluated
FALSEevaluated 4402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-4402
368 ERR_put_error(36,(110),(114),__FILE__,410);-
369 return
never executed: return 0;
0;
never executed: return 0;
0
370 }-
371 if (drbg->state == DRBG_UNINITIALISED
drbg->state ==..._UNINITIALISEDDescription
TRUEnever evaluated
FALSEevaluated 4402 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-4402
372 ERR_put_error(36,(110),(115),__FILE__,414);-
373 return
never executed: return 0;
0;
never executed: return 0;
0
374 }-
375-
376 if (adin ==
adin == ((void *)0)Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4382 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
20-4382
377 ((void *)0)
adin == ((void *)0)Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4382 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
20-4382
378 ) {-
379 adinlen = 0;-
380 }
executed 20 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else if (adinlen > drbg->max_adinlen
adinlen > drbg->max_adinlenDescription
TRUEnever evaluated
FALSEevaluated 4382 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-4382
381 ERR_put_error(36,(110),(102),__FILE__,421);-
382 return
never executed: return 0;
0;
never executed: return 0;
0
383 }-
384-
385 drbg->state = DRBG_ERROR;-
386 if (drbg->get_entropy !=
drbg->get_entr...!= ((void *)0)Description
TRUEevaluated 4403 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-4403
387 ((void *)0)
drbg->get_entr...!= ((void *)0)Description
TRUEevaluated 4403 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-4403
388 )-
389 entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength,
executed 4403 times by 1 test: entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength, drbg->min_entropylen, drbg->max_entropylen, prediction_resistance);
Executed by:
  • libcrypto.so.1.1
4403
390 drbg->min_entropylen,
executed 4403 times by 1 test: entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength, drbg->min_entropylen, drbg->max_entropylen, prediction_resistance);
Executed by:
  • libcrypto.so.1.1
4403
391 drbg->max_entropylen,
executed 4403 times by 1 test: entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength, drbg->min_entropylen, drbg->max_entropylen, prediction_resistance);
Executed by:
  • libcrypto.so.1.1
4403
392 prediction_resistance);
executed 4403 times by 1 test: entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength, drbg->min_entropylen, drbg->max_entropylen, prediction_resistance);
Executed by:
  • libcrypto.so.1.1
4403
393 if (entropylen < drbg->min_entropylen
entropylen < d...min_entropylenDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3-4400
394 || entropylen > drbg->max_entropylen
entropylen > d...max_entropylenDescription
TRUEnever evaluated
FALSEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-4400
395 ERR_put_error(36,(110),(110),__FILE__,433);-
396 goto
executed 3 times by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
end;
executed 3 times by 1 test: goto end;
Executed by:
  • libcrypto.so.1.1
3
397 }-
398-
399 if (!drbg->meth->reseed(drbg, entropy, entropylen, adin, adinlen)
!drbg->meth->r...adin, adinlen)Description
TRUEnever evaluated
FALSEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4400
400 goto
never executed: goto end;
end;
never executed: goto end;
0
401-
402 drbg->state = DRBG_READY;-
403 drbg->generate_counter = 0;-
404 drbg->reseed_time = time(-
405 ((void *)0)-
406 );-
407 if (drbg->reseed_counter > 0
drbg->reseed_counter > 0Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
62-4338
408 if (drbg->parent ==
drbg->parent == ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 43 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
19-43
409 ((void *)0)
drbg->parent == ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 43 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
19-43
410 )-
411 drbg->reseed_counter++;
executed 19 times by 1 test: drbg->reseed_counter++;
Executed by:
  • libcrypto.so.1.1
19
412 else-
413 drbg->reseed_counter = drbg->parent->reseed_counter;
executed 43 times by 1 test: drbg->reseed_counter = drbg->parent->reseed_counter;
Executed by:
  • libcrypto.so.1.1
43
414 }-
415-
416end:
code before this statement executed 4400 times by 1 test: end:
Executed by:
  • libcrypto.so.1.1
4400
417 if (entropy !=
entropy != ((void *)0)Description
TRUEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3-4400
418 ((void *)0)
entropy != ((void *)0)Description
TRUEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3-4400
419 && drbg->cleanup_entropy !=
drbg->cleanup_...!= ((void *)0)Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
62-4338
420 ((void *)0)
drbg->cleanup_...!= ((void *)0)Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
62-4338
421 )-
422 drbg->cleanup_entropy(drbg, entropy, entropylen);
executed 62 times by 1 test: drbg->cleanup_entropy(drbg, entropy, entropylen);
Executed by:
  • libcrypto.so.1.1
62
423 if (drbg->state == DRBG_READY
drbg->state == DRBG_READYDescription
TRUEevaluated 4400 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
3-4400
424 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
425 return
executed 3 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 3 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
3
426}-
427int rand_drbg_restart(RAND_DRBG *drbg,-
428 const unsigned char *buffer, size_t len, size_t entropy)-
429{-
430 int reseeded = 0;-
431 const unsigned char *adin = -
432 ((void *)0)-
433 ;-
434 size_t adinlen = 0;-
435-
436 if (drbg->pool !=
drbg->pool != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-28
437 ((void *)0)
drbg->pool != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-28
438 ) {-
439 ERR_put_error(36,(102),((4|64)),__FILE__,483);-
440 rand_pool_free(drbg->pool);-
441 drbg->pool = -
442 ((void *)0)-
443 ;-
444 }
never executed: end of block
0
445-
446 if (buffer !=
buffer != ((void *)0)Description
TRUEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
7-21
447 ((void *)0)
buffer != ((void *)0)Description
TRUEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
7-21
448 ) {-
449 if (entropy > 0
entropy > 0Description
TRUEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-21
450 if (drbg->max_entropylen < len
drbg->max_entropylen < lenDescription
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-21
451 ERR_put_error(36,(102),(106),__FILE__,492)-
452 ;-
453 return
never executed: return 0;
0;
never executed: return 0;
0
454 }-
455-
456 if (entropy > 8 * len
entropy > 8 * lenDescription
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-21
457 ERR_put_error(36,(102),(124),__FILE__,497);-
458 return
never executed: return 0;
0;
never executed: return 0;
0
459 }-
460-
461-
462 drbg->pool = rand_pool_new(entropy, len, len);-
463 if (drbg->pool ==
drbg->pool == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-21
464 ((void *)0)
drbg->pool == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-21
465 )-
466 return
never executed: return 0;
0;
never executed: return 0;
0
467-
468 rand_pool_add(drbg->pool, buffer, len, entropy);-
469 }
executed 21 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
21
470 if (drbg->max_adinlen < len
drbg->max_adinlen < lenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
471 ERR_put_error(36,(102),(102),__FILE__,510)-
472 ;-
473 return
never executed: return 0;
0;
never executed: return 0;
0
474 }-
475 adin = buffer;-
476 adinlen = len;-
477 }
never executed: end of block
0
478 }-
479-
480-
481 if (drbg->state == DRBG_ERROR
drbg->state == DRBG_ERRORDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
4-24
482 RAND_DRBG_uninstantiate(drbg);
executed 4 times by 1 test: RAND_DRBG_uninstantiate(drbg);
Executed by:
  • libcrypto.so.1.1
4
483-
484-
485 if (drbg->state == DRBG_UNINITIALISED
drbg->state ==..._UNINITIALISEDDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 20 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
8-20
486-
487 RAND_DRBG_instantiate(drbg,-
488 (const unsigned char *) ossl_pers_string,-
489 sizeof(ossl_pers_string) - 1);-
490-
491 reseeded = (drbg->state == DRBG_READY);-
492 }
executed 8 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8
493-
494-
495 if (drbg->state == DRBG_READY
drbg->state == DRBG_READYDescription
TRUEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-26
496 if (adin !=
adin != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-26
497 ((void *)0)
adin != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-26
498 ) {-
499 drbg->meth->reseed(drbg, adin, adinlen, -
500 ((void *)0)-
501 , 0);-
502 }
never executed: end of block
else if (reseeded == 0
reseeded == 0Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-20
503-
504 RAND_DRBG_reseed(drbg, -
505 ((void *)0)-
506 , 0, 0);-
507 }
executed 20 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
20
508 }
executed 26 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
26
509-
510-
511 if (drbg->pool !=
drbg->pool != ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 27 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-27
512 ((void *)0)
drbg->pool != ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 27 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-27
513 ) {-
514 drbg->state = DRBG_ERROR;-
515 ERR_put_error(36,(102),((4|64)),__FILE__,553);-
516 rand_pool_free(drbg->pool);-
517 drbg->pool = -
518 ((void *)0)-
519 ;-
520 return
executed 1 time by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 1 time by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
1
521 }-
522-
523 return
executed 27 times by 1 test: return drbg->state == DRBG_READY;
Executed by:
  • libcrypto.so.1.1
drbg->state == DRBG_READY;
executed 27 times by 1 test: return drbg->state == DRBG_READY;
Executed by:
  • libcrypto.so.1.1
27
524}-
525int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen,-
526 int prediction_resistance,-
527 const unsigned char *adin, size_t adinlen)-
528{-
529 int reseed_required = 0;-
530-
531 if (drbg->state != DRBG_READY
drbg->state != DRBG_READYDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1038601 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
7-1038601
532-
533 rand_drbg_restart(drbg, -
534 ((void *)0)-
535 , 0, 0);-
536-
537 if (drbg->state == DRBG_ERROR
drbg->state == DRBG_ERRORDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-5
538 ERR_put_error(36,(107),(114),__FILE__,583);-
539 return
executed 2 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 2 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
2
540 }-
541 if (drbg->state == DRBG_UNINITIALISED
drbg->state ==..._UNINITIALISEDDescription
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-5
542 ERR_put_error(36,(107),(115),__FILE__,587);-
543 return
never executed: return 0;
0;
never executed: return 0;
0
544 }-
545 }
executed 5 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5
546-
547 if (outlen > drbg->max_request
outlen > drbg->max_requestDescription
TRUEnever evaluated
FALSEevaluated 1036308 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-1036308
548 ERR_put_error(36,(107),(117),__FILE__,593);-
549 return
never executed: return 0;
0;
never executed: return 0;
0
550 }-
551 if (adinlen > drbg->max_adinlen
adinlen > drbg->max_adinlenDescription
TRUEnever evaluated
FALSEevaluated 1044845 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-1044845
552 ERR_put_error(36,(107),(102),__FILE__,597);-
553 return
never executed: return 0;
0;
never executed: return 0;
0
554 }-
555-
556 if (drbg->fork_count != rand_fork_count
drbg->fork_cou...and_fork_countDescription
TRUEnever evaluated
FALSEevaluated 1049337 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-1049337
557 drbg->fork_count = rand_fork_count;-
558 reseed_required = 1;-
559 }
never executed: end of block
0
560-
561 if (drbg->reseed_interval > 0
drbg->reseed_interval > 0Description
TRUEevaluated 1056824 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
) {
0-1056824
562 if (drbg->generate_counter >= drbg->reseed_interval
drbg->generate...eseed_intervalDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1071657 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
3-1071657
563 reseed_required = 1;
executed 3 times by 1 test: reseed_required = 1;
Executed by:
  • libcrypto.so.1.1
3
564 }
executed 1064277 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1064277
565 if (drbg->reseed_time_interval > 0
drbg->reseed_time_interval > 0Description
TRUEevaluated 1063945 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
) {
0-1063945
566 time_t now = time(-
567 ((void *)0)-
568 );-
569 if (now < drbg->reseed_time
now < drbg->reseed_timeDescription
TRUEnever evaluated
FALSEevaluated 1067482 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1067482
570 || now - drbg->reseed_time >= drbg->reseed_time_interval
now - drbg->re..._time_intervalDescription
TRUEevaluated 34 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1067256 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
34-1067256
571 reseed_required = 1;
executed 34 times by 1 test: reseed_required = 1;
Executed by:
  • libcrypto.so.1.1
34
572 }
executed 1069303 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1069303
573 if (drbg->reseed_counter > 0
drbg->reseed_counter > 0Description
TRUEevaluated 1061309 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 8658 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& drbg->parent !=
drbg->parent != ((void *)0)Description
TRUEevaluated 1057850 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1055 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1055-1061309
574 ((void *)0)
drbg->parent != ((void *)0)Description
TRUEevaluated 1057850 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1055 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
1055-1057850
575 ) {-
576 if (drbg->reseed_counter != drbg->parent->reseed_counter
drbg->reseed_c...reseed_counterDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1061390 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
8-1061390
577 reseed_required = 1;
executed 8 times by 1 test: reseed_required = 1;
Executed by:
  • libcrypto.so.1.1
8
578 }
executed 1061020 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1061020
579-
580 if (reseed_required
reseed_requiredDescription
TRUEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1070847 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
|| prediction_resistance
prediction_resistanceDescription
TRUEevaluated 2892 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1066780 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
45-1070847
581 if (!RAND_DRBG_reseed(drbg, adin, adinlen, prediction_resistance)
!RAND_DRBG_res...on_resistance)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2935 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-2935
582 ERR_put_error(36,(107),(118),__FILE__,623);-
583 return
executed 2 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 2 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
2
584 }-
585 adin = -
586 ((void *)0)-
587 ;-
588 adinlen = 0;-
589 }
executed 2935 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2935
590-
591 if (!drbg->meth->generate(drbg, out, outlen, adin, adinlen)
!drbg->meth->g...adin, adinlen)Description
TRUEnever evaluated
FALSEevaluated 1034268 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-1034268
592 drbg->state = DRBG_ERROR;-
593 ERR_put_error(36,(107),(112),__FILE__,632);-
594 return
never executed: return 0;
0;
never executed: return 0;
0
595 }-
596-
597 drbg->generate_counter++;-
598-
599 return
executed 1033938 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 1033938 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1033938
600}-
601int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen)-
602{-
603 unsigned char *additional = -
604 ((void *)0)-
605 ;-
606 size_t additional_len;-
607 size_t chunk;-
608 size_t ret;-
609-
610 additional_len = rand_drbg_get_additional_data(&additional, drbg->max_adinlen);-
611-
612 for ( ; outlen > 0
outlen > 0Description
TRUEevaluated 1043108 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1032809 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
; outlen -= chunk, out += chunk) {
1032809-1043108
613 chunk = outlen;-
614 if (chunk > drbg->max_request
chunk > drbg->max_requestDescription
TRUEnever evaluated
FALSEevaluated 1041917 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-1041917
615 chunk = drbg->max_request;
never executed: chunk = drbg->max_request;
0
616 ret = RAND_DRBG_generate(drbg, out, chunk, 0, additional, additional_len);-
617 if (!ret
!retDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1025801 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
2-1025801
618 goto
executed 2 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
err;
executed 2 times by 1 test: goto err;
Executed by:
  • libcrypto.so.1.1
2
619 }
executed 1034540 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1034540
620 ret = 1;-
621-
622err:
code before this statement executed 1031170 times by 2 tests: err:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1031170
623 if (additional_len != 0
additional_len != 0Description
TRUEevaluated 1035520 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
)
0-1035520
624 CRYPTO_secure_clear_free(additional, additional_len, __FILE__, 670);
executed 1039376 times by 2 tests: CRYPTO_secure_clear_free(additional, additional_len, __FILE__, 670);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1039376
625-
626 return
executed 1060959 times by 2 tests: return ret;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ret;
executed 1060959 times by 2 tests: return ret;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1060959
627}-
628int RAND_DRBG_set_callbacks(RAND_DRBG *drbg,-
629 RAND_DRBG_get_entropy_fn get_entropy,-
630 RAND_DRBG_cleanup_entropy_fn cleanup_entropy,-
631 RAND_DRBG_get_nonce_fn get_nonce,-
632 RAND_DRBG_cleanup_nonce_fn cleanup_nonce)-
633{-
634 if (drbg->state != DRBG_UNINITIALISED
drbg->state !=..._UNINITIALISEDDescription
TRUEnever evaluated
FALSEevaluated 4338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4338
635 return
never executed: return 0;
0;
never executed: return 0;
0
636 drbg->get_entropy = get_entropy;-
637 drbg->cleanup_entropy = cleanup_entropy;-
638 drbg->get_nonce = get_nonce;-
639 drbg->cleanup_nonce = cleanup_nonce;-
640 return
executed 4338 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 4338 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
4338
641}-
642int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg, unsigned int interval)-
643{-
644 if (interval > (1 << 24)
interval > (1 << 24)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
645 return
never executed: return 0;
0;
never executed: return 0;
0
646 drbg->reseed_interval = interval;-
647 return
never executed: return 1;
1;
never executed: return 1;
0
648}-
649int RAND_DRBG_set_reseed_time_interval(RAND_DRBG *drbg, time_t interval)-
650{-
651 if (interval > (1 << 20)
interval > (1 << 20)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
652 return
never executed: return 0;
0;
never executed: return 0;
0
653 drbg->reseed_time_interval = interval;-
654 return
executed 8 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 8 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
8
655}-
656int RAND_DRBG_set_reseed_defaults(-
657 unsigned int _master_reseed_interval,-
658 unsigned int _slave_reseed_interval,-
659 time_t _master_reseed_time_interval,-
660 time_t _slave_reseed_time_interval-
661 )-
662{-
663 if (_master_reseed_interval > (1 << 24)
_master_reseed...al > (1 << 24)Description
TRUEnever evaluated
FALSEnever evaluated
0
664 || _slave_reseed_interval > (1 << 24)
_slave_reseed_...al > (1 << 24)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
665 return
never executed: return 0;
0;
never executed: return 0;
0
666-
667 if (_master_reseed_time_interval > (1 << 20)
_master_reseed...al > (1 << 20)Description
TRUEnever evaluated
FALSEnever evaluated
0
668 || _slave_reseed_time_interval > (1 << 20)
_slave_reseed_...al > (1 << 20)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
669 return
never executed: return 0;
0;
never executed: return 0;
0
670-
671 master_reseed_interval = _master_reseed_interval;-
672 slave_reseed_interval = _slave_reseed_interval;-
673-
674 master_reseed_time_interval = _master_reseed_time_interval;-
675 slave_reseed_time_interval = _slave_reseed_time_interval;-
676-
677 return
never executed: return 1;
1;
never executed: return 1;
0
678}-
679-
680-
681-
682-
683-
684-
685-
686int rand_drbg_lock(RAND_DRBG *drbg)-
687{-
688 if (drbg->lock !=
drbg->lock != ((void *)0)Description
TRUEevaluated 2085 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
0-2085
689 ((void *)0)
drbg->lock != ((void *)0)Description
TRUEevaluated 2085 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
0-2085
690 )-
691 return
executed 2085 times by 2 tests: return CRYPTO_THREAD_write_lock(drbg->lock);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
CRYPTO_THREAD_write_lock(drbg->lock);
executed 2085 times by 2 tests: return CRYPTO_THREAD_write_lock(drbg->lock);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2085
692-
693 return
never executed: return 1;
1;
never executed: return 1;
0
694}-
695-
696-
697-
698-
699-
700-
701-
702int rand_drbg_unlock(RAND_DRBG *drbg)-
703{-
704 if (drbg->lock !=
drbg->lock != ((void *)0)Description
TRUEevaluated 2086 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
0-2086
705 ((void *)0)
drbg->lock != ((void *)0)Description
TRUEevaluated 2086 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
0-2086
706 )-
707 return
executed 2086 times by 2 tests: return CRYPTO_THREAD_unlock(drbg->lock);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
CRYPTO_THREAD_unlock(drbg->lock);
executed 2086 times by 2 tests: return CRYPTO_THREAD_unlock(drbg->lock);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
2086
708-
709 return
never executed: return 1;
1;
never executed: return 1;
0
710}-
711int rand_drbg_enable_locking(RAND_DRBG *drbg)-
712{-
713 if (drbg->state != DRBG_UNINITIALISED
drbg->state !=..._UNINITIALISEDDescription
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-779
714 ERR_put_error(36,(119),(129),__FILE__,806)-
715 ;-
716 return
never executed: return 0;
0;
never executed: return 0;
0
717 }-
718-
719 if (drbg->lock ==
drbg->lock == ((void *)0)Description
TRUEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
0-779
720 ((void *)0)
drbg->lock == ((void *)0)Description
TRUEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
0-779
721 ) {-
722 if (drbg->parent !=
drbg->parent != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
723 ((void *)0)
drbg->parent != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
724 && drbg->parent->lock ==
drbg->parent->...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
725 ((void *)0)
drbg->parent->...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
726 ) {-
727 ERR_put_error(36,(119),(130),__FILE__,813)-
728 ;-
729 return
never executed: return 0;
0;
never executed: return 0;
0
730 }-
731-
732 drbg->lock = CRYPTO_THREAD_lock_new();-
733 if (drbg->lock ==
drbg->lock == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
734 ((void *)0)
drbg->lock == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
735 ) {-
736 ERR_put_error(36,(119),(126),__FILE__,820)-
737 ;-
738 return
never executed: return 0;
0;
never executed: return 0;
0
739 }-
740 }
executed 779 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
779
741-
742 return
executed 779 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 779 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
779
743}-
744-
745-
746-
747-
748int RAND_DRBG_set_ex_data(RAND_DRBG *drbg, int idx, void *arg)-
749{-
750 return
executed 4341 times by 1 test: return CRYPTO_set_ex_data(&drbg->ex_data, idx, arg);
Executed by:
  • libcrypto.so.1.1
CRYPTO_set_ex_data(&drbg->ex_data, idx, arg);
executed 4341 times by 1 test: return CRYPTO_set_ex_data(&drbg->ex_data, idx, arg);
Executed by:
  • libcrypto.so.1.1
4341
751}-
752-
753void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)-
754{-
755 return
executed 10860 times by 1 test: return CRYPTO_get_ex_data(&drbg->ex_data, idx);
Executed by:
  • libcrypto.so.1.1
CRYPTO_get_ex_data(&drbg->ex_data, idx);
executed 10860 times by 1 test: return CRYPTO_get_ex_data(&drbg->ex_data, idx);
Executed by:
  • libcrypto.so.1.1
10860
756}-
757static RAND_DRBG *drbg_setup(RAND_DRBG *parent)-
758{-
759 RAND_DRBG *drbg;-
760-
761 drbg = RAND_DRBG_secure_new(rand_drbg_type, rand_drbg_flags, parent);-
762 if (drbg ==
drbg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1787 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1787
763 ((void *)0)
drbg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1787 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-1787
764 )-
765 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
766 ((void *)0)
never executed: return ((void *)0) ;
0
767 ;
never executed: return ((void *)0) ;
0
768-
769-
770 if (parent ==
parent == ((void *)0)Description
TRUEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1008 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
779-1008
771 ((void *)0)
parent == ((void *)0)Description
TRUEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1008 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
779-1008
772 && rand_drbg_enable_locking(drbg) == 0
rand_drbg_enab...ing(drbg) == 0Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-779
773 goto
never executed: goto err;
err;
never executed: goto err;
0
774-
775-
776 drbg->reseed_counter = 1;-
777-
778-
779-
780-
781-
782-
783-
784 (void)RAND_DRBG_instantiate(drbg,-
785 (const unsigned char *) ossl_pers_string,-
786 sizeof(ossl_pers_string) - 1);-
787 return
executed 1787 times by 2 tests: return drbg;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
drbg;
executed 1787 times by 2 tests: return drbg;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1787
788-
789err:-
790 RAND_DRBG_free(drbg);-
791 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
792 ((void *)0)
never executed: return ((void *)0) ;
0
793 ;
never executed: return ((void *)0) ;
0
794}-
795-
796-
797-
798-
799-
800static int do_rand_drbg_init(void); static int do_rand_drbg_init_ossl_ret_ = 0; static void do_rand_drbg_init_ossl_(void) { do_rand_drbg_init_ossl_ret_ = do_rand_drbg_init(); }
executed 779 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
static int do_rand_drbg_init(void)
779
801{-
802-
803-
804-
805-
806 if (!OPENSSL_init_crypto(0,
!OPENSSL_init_... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
807 ((void *)0)
!OPENSSL_init_... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
808 )
!OPENSSL_init_... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-779
809 return
never executed: return 0;
0;
never executed: return 0;
0
810-
811 if (!CRYPTO_THREAD_init_local(&private_drbg,
!CRYPTO_THREAD... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
812 ((void *)0)
!CRYPTO_THREAD... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
813 )
!CRYPTO_THREAD... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-779
814 return
never executed: return 0;
0;
never executed: return 0;
0
815-
816 if (!CRYPTO_THREAD_init_local(&public_drbg,
!CRYPTO_THREAD... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
817 ((void *)0)
!CRYPTO_THREAD... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
818 )
!CRYPTO_THREAD... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-779
819 goto
never executed: goto err1;
err1;
never executed: goto err1;
0
820-
821 master_drbg = drbg_setup(-
822 ((void *)0)-
823 );-
824 if (master_drbg ==
master_drbg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
825 ((void *)0)
master_drbg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-779
826 )-
827 goto
never executed: goto err2;
err2;
never executed: goto err2;
0
828-
829 return
executed 779 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 779 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
779
830-
831err2:-
832 CRYPTO_THREAD_cleanup_local(&public_drbg);-
833err1:
code before this statement never executed: err1:
0
834 CRYPTO_THREAD_cleanup_local(&private_drbg);-
835 return
never executed: return 0;
0;
never executed: return 0;
0
836}-
837-
838-
839void rand_drbg_cleanup_int(void)-
840{-
841 if (master_drbg !=
master_drbg != ((void *)0)Description
TRUEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1297 times by 11 tests
Evaluated by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm4_internal_test
  • x509_internal_test
779-1297
842 ((void *)0)
master_drbg != ((void *)0)Description
TRUEevaluated 779 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1297 times by 11 tests
Evaluated by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm4_internal_test
  • x509_internal_test
779-1297
843 ) {-
844 RAND_DRBG_free(master_drbg);-
845 master_drbg = -
846 ((void *)0)-
847 ;-
848-
849 CRYPTO_THREAD_cleanup_local(&private_drbg);-
850 CRYPTO_THREAD_cleanup_local(&public_drbg);-
851 }
executed 779 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
779
852}
executed 2076 times by 12 tests: end of block
Executed by:
  • asn1_internal_test
  • chacha_internal_test
  • ctype_internal_test
  • curve448_internal_test
  • libcrypto.so.1.1
  • modes_internal_test
  • poly1305_internal_test
  • rdrand_sanitytest
  • siphash_internal_test
  • sm2_internal_test
  • sm4_internal_test
  • x509_internal_test
2076
853-
854void drbg_delete_thread_state(void)-
855{-
856 RAND_DRBG *drbg;-
857-
858 drbg = CRYPTO_THREAD_get_local(&public_drbg);-
859 CRYPTO_THREAD_set_local(&public_drbg, -
860 ((void *)0)-
861 );-
862 RAND_DRBG_free(drbg);-
863-
864 drbg = CRYPTO_THREAD_get_local(&private_drbg);-
865 CRYPTO_THREAD_set_local(&private_drbg, -
866 ((void *)0)-
867 );-
868 RAND_DRBG_free(drbg);-
869}
executed 782 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
782
870-
871-
872static int drbg_bytes(unsigned char *out, int count)-
873{-
874 int ret;-
875 RAND_DRBG *drbg = RAND_DRBG_get0_public();-
876-
877 if (drbg ==
drbg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 564240 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-564240
878 ((void *)0)
drbg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 564240 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-564240
879 )-
880 return
never executed: return 0;
0;
never executed: return 0;
0
881-
882 ret = RAND_DRBG_bytes(drbg, out, count);-
883-
884 return
executed 564990 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 564990 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
564990
885}-
886-
887-
888static int drbg_add(const void *buf, int num, double randomness)-
889{-
890 int ret = 0;-
891 RAND_DRBG *drbg = RAND_DRBG_get0_master();-
892-
893 if (drbg ==
drbg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-21
894 ((void *)0)
drbg == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-21
895 )-
896 return
never executed: return 0;
0;
never executed: return 0;
0
897-
898 if (num < 0
num < 0Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| randomness < 0.0
randomness < 0.0Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-21
899 return
never executed: return 0;
0;
never executed: return 0;
0
900-
901 if (randomness > (double)drbg->max_entropylen
randomness > (...max_entropylenDescription
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-21
902-
903-
904-
905-
906-
907-
908 return
never executed: return 0;
0;
never executed: return 0;
0
909 }-
910-
911 rand_drbg_lock(drbg);-
912 ret = rand_drbg_restart(drbg, buf,-
913 (size_t)(unsigned int)num,-
914 (size_t)(8*randomness));-
915 rand_drbg_unlock(drbg);-
916-
917 return
executed 21 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 21 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
21
918}-
919-
920-
921static int drbg_seed(const void *buf, int num)-
922{-
923 return
never executed: return drbg_add(buf, num, num);
drbg_add(buf, num, num);
never executed: return drbg_add(buf, num, num);
0
924}-
925-
926-
927static int drbg_status(void)-
928{-
929 int ret;-
930 RAND_DRBG *drbg = RAND_DRBG_get0_master();-
931-
932 if (drbg ==
drbg == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
933 ((void *)0)
drbg == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
934 )-
935 return
never executed: return 0;
0;
never executed: return 0;
0
936-
937 rand_drbg_lock(drbg);-
938 ret = drbg->state == DRBG_READY
drbg->state == DRBG_READYDescription
TRUEnever evaluated
FALSEnever evaluated
? 1 : 0;
0
939 rand_drbg_unlock(drbg);-
940 return
never executed: return ret;
ret;
never executed: return ret;
0
941}-
942-
943-
944-
945-
946-
947-
948RAND_DRBG *RAND_DRBG_get0_master(void)-
949{-
950 if (!(CRYPTO_THREAD_run_once(&rand_drbg_init, do_rand_drbg_init_ossl_)
CRYPTO_THREAD_...bg_init_ossl_)Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
? do_rand_drbg_init_ossl_ret_ : 0)
!(CRYPTO_THREA...ossl_ret_ : 0)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-23
951 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
952 ((void *)0)
never executed: return ((void *)0) ;
0
953 ;
never executed: return ((void *)0) ;
0
954-
955 return
executed 23 times by 1 test: return master_drbg;
Executed by:
  • libcrypto.so.1.1
master_drbg;
executed 23 times by 1 test: return master_drbg;
Executed by:
  • libcrypto.so.1.1
23
956}-
957-
958-
959-
960-
961-
962RAND_DRBG *RAND_DRBG_get0_public(void)-
963{-
964 RAND_DRBG *drbg;-
965-
966 if (!(CRYPTO_THREAD_run_once(&rand_drbg_init, do_rand_drbg_init_ossl_)
CRYPTO_THREAD_...bg_init_ossl_)Description
TRUEevaluated 565554 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
? do_rand_drbg_init_ossl_ret_ : 0)
!(CRYPTO_THREA...ossl_ret_ : 0)Description
TRUEnever evaluated
FALSEevaluated 565196 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-565554
967 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
968 ((void *)0)
never executed: return ((void *)0) ;
0
969 ;
never executed: return ((void *)0) ;
0
970-
971 drbg = CRYPTO_THREAD_get_local(&public_drbg);-
972 if (drbg ==
drbg == ((void *)0)Description
TRUEevaluated 550 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 565216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
550-565216
973 ((void *)0)
drbg == ((void *)0)Description
TRUEevaluated 550 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 565216 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
550-565216
974 ) {-
975 if (!ossl_init_thread_start(0x04)
!ossl_init_thread_start(0x04)Description
TRUEnever evaluated
FALSEevaluated 550 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-550
976 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
977 ((void *)0)
never executed: return ((void *)0) ;
0
978 ;
never executed: return ((void *)0) ;
0
979 drbg = drbg_setup(master_drbg);-
980 CRYPTO_THREAD_set_local(&public_drbg, drbg);-
981 }
executed 550 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
550
982 return
executed 564027 times by 1 test: return drbg;
Executed by:
  • libcrypto.so.1.1
drbg;
executed 564027 times by 1 test: return drbg;
Executed by:
  • libcrypto.so.1.1
564027
983}-
984-
985-
986-
987-
988-
989RAND_DRBG *RAND_DRBG_get0_private(void)-
990{-
991 RAND_DRBG *drbg;-
992-
993 if (!(CRYPTO_THREAD_run_once(&rand_drbg_init, do_rand_drbg_init_ossl_)
CRYPTO_THREAD_...bg_init_ossl_)Description
TRUEevaluated 498118 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEnever evaluated
? do_rand_drbg_init_ossl_ret_ : 0)
!(CRYPTO_THREA...ossl_ret_ : 0)Description
TRUEnever evaluated
FALSEevaluated 497797 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-498118
994 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
995 ((void *)0)
never executed: return ((void *)0) ;
0
996 ;
never executed: return ((void *)0) ;
0
997-
998 drbg = CRYPTO_THREAD_get_local(&private_drbg);-
999 if (drbg ==
drbg == ((void *)0)Description
TRUEevaluated 458 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 498110 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
458-498110
1000 ((void *)0)
drbg == ((void *)0)Description
TRUEevaluated 458 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 498110 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
458-498110
1001 ) {-
1002 if (!ossl_init_thread_start(0x04)
!ossl_init_thread_start(0x04)Description
TRUEnever evaluated
FALSEevaluated 458 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-458
1003 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
1004 ((void *)0)
never executed: return ((void *)0) ;
0
1005 ;
never executed: return ((void *)0) ;
0
1006 drbg = drbg_setup(master_drbg);-
1007 CRYPTO_THREAD_set_local(&private_drbg, drbg);-
1008 }
executed 458 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
458
1009 return
executed 498444 times by 2 tests: return drbg;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
drbg;
executed 498444 times by 2 tests: return drbg;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
498444
1010}-
1011-
1012RAND_METHOD rand_meth = {-
1013 drbg_seed,-
1014 drbg_bytes,-
1015 -
1016 ((void *)0)-
1017 ,-
1018 drbg_add,-
1019 drbg_bytes,-
1020 drbg_status-
1021};-
1022-
1023RAND_METHOD *RAND_OpenSSL(void)-
1024{-
1025 return
executed 566075 times by 2 tests: return &rand_meth;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
&rand_meth;
executed 566075 times by 2 tests: return &rand_meth;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
566075
1026}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2