OpenCoverage

evp_lib.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/evp_lib.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type)-
4{-
5 int ret;-
6-
7 if (c->cipher->set_asn1_parameters !=
c->cipher->set...!= ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 33 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-33
8 ((void *)0)
c->cipher->set...!= ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 33 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-33
9 )-
10 ret = c->cipher->set_asn1_parameters(c, type);
executed 2 times by 1 test: ret = c->cipher->set_asn1_parameters(c, type);
Executed by:
  • libcrypto.so.1.1
2
11 else if (c->cipher->flags & 0x1000
c->cipher->flags & 0x1000Description
TRUEevaluated 33 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-33
12 switch ((EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) & 0xF0007)) {-
13 case
executed 7 times by 1 test: case 0x10002:
Executed by:
  • libcrypto.so.1.1
0x10002:
executed 7 times by 1 test: case 0x10002:
Executed by:
  • libcrypto.so.1.1
7
14 if (EVP_CIPHER_CTX_nid(c) == 246
EVP_CIPHER_CTX_nid(c) == 246Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
3-4
15 ASN1_TYPE_set(type, 5,
executed 4 times by 1 test: ASN1_TYPE_set(type, 5, ((void *)0) );
Executed by:
  • libcrypto.so.1.1
4
16 ((void *)0)
executed 4 times by 1 test: ASN1_TYPE_set(type, 5, ((void *)0) );
Executed by:
  • libcrypto.so.1.1
4
17 );
executed 4 times by 1 test: ASN1_TYPE_set(type, 5, ((void *)0) );
Executed by:
  • libcrypto.so.1.1
4
18 ret = 1;-
19 break;
executed 7 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
7
20-
21 case
never executed: case 0x6:
0x6:
never executed: case 0x6:
0
22 case
never executed: case 0x7:
0x7:
never executed: case 0x7:
0
23 case
never executed: case 0x10001:
0x10001:
never executed: case 0x10001:
0
24 case
never executed: case 0x10003:
0x10003:
never executed: case 0x10003:
0
25 ret = -2;-
26 break;
never executed: break;
0
27-
28 default
executed 26 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
:
executed 26 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
26
29 ret = EVP_CIPHER_set_asn1_iv(c, type);-
30 }
executed 26 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
26
31 } else-
32 ret = -1;
never executed: ret = -1;
0
33 if (ret <= 0
ret <= 0Description
TRUEnever evaluated
FALSEevaluated 35 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-35
34 ERR_put_error(6,(205),(ret == -2 ? 228 : 122),__FILE__,46)
never executed: ERR_put_error(6,(205),(ret == -2 ? 228 : 122),__FILE__,46) ;
0
350
36 ;
never executed: ERR_put_error(6,(205),(ret == -2 ? 228 : 122),__FILE__,46) ;
0
37 if (ret < -1
ret < -1Description
TRUEnever evaluated
FALSEevaluated 35 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-35
38 ret = -1;
never executed: ret = -1;
0
39 return
executed 35 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 35 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
35
40}-
41-
42int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type)-
43{-
44 int ret;-
45-
46 if (c->cipher->get_asn1_parameters !=
c->cipher->get...!= ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-32
47 ((void *)0)
c->cipher->get...!= ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-32
48 )-
49 ret = c->cipher->get_asn1_parameters(c, type);
executed 2 times by 1 test: ret = c->cipher->get_asn1_parameters(c, type);
Executed by:
  • libcrypto.so.1.1
2
50 else if (c->cipher->flags & 0x1000
c->cipher->flags & 0x1000Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-32
51 switch ((EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) & 0xF0007)) {-
52-
53 case
executed 6 times by 1 test: case 0x10002:
Executed by:
  • libcrypto.so.1.1
0x10002:
executed 6 times by 1 test: case 0x10002:
Executed by:
  • libcrypto.so.1.1
6
54 ret = 1;-
55 break;
executed 6 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
6
56-
57 case
never executed: case 0x6:
0x6:
never executed: case 0x6:
0
58 case
never executed: case 0x7:
0x7:
never executed: case 0x7:
0
59 case
never executed: case 0x10001:
0x10001:
never executed: case 0x10001:
0
60 case
never executed: case 0x10003:
0x10003:
never executed: case 0x10003:
0
61 ret = -2;-
62 break;
never executed: break;
0
63-
64 default
executed 26 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
:
executed 26 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
26
65 ret = EVP_CIPHER_get_asn1_iv(c, type);-
66 break;
executed 26 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
26
67 }-
68 } else-
69 ret = -1;
never executed: ret = -1;
0
70 if (ret <= 0
ret <= 0Description
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-34
71 ERR_put_error(6,(204),(ret == -2 ? 107 : 122),__FILE__,81)
never executed: ERR_put_error(6,(204),(ret == -2 ? 107 : 122),__FILE__,81) ;
0
720
73 ;
never executed: ERR_put_error(6,(204),(ret == -2 ? 107 : 122),__FILE__,81) ;
0
74 if (ret < -1
ret < -1Description
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-34
75 ret = -1;
never executed: ret = -1;
0
76 return
executed 34 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 34 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
34
77}-
78-
79int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)-
80{-
81 int i = 0;-
82 unsigned int l;-
83-
84 if (type !=
type != ((void *)0)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-26
85 ((void *)0)
type != ((void *)0)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-26
86 ) {-
87 l = EVP_CIPHER_CTX_iv_length(c);-
88 (void)((l <= sizeof(c->iv)) ? 0 : (OPENSSL_die("assertion failed: " "l <= sizeof(c->iv)", __FILE__, 94), 1));-
89 i = ASN1_TYPE_get_octetstring(type, c->oiv, l);-
90 if (i != (int)l
i != (int)lDescription
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-26
91 return
never executed: return -1;
-1;
never executed: return -1;
0
92 else if (i > 0
i > 0Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-26
93 memcpy(c->iv, c->oiv, l);
executed 26 times by 1 test: memcpy(c->iv, c->oiv, l);
Executed by:
  • libcrypto.so.1.1
26
94 }
executed 26 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
26
95 return
executed 26 times by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
i;
executed 26 times by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
26
96}-
97-
98int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)-
99{-
100 int i = 0;-
101 unsigned int j;-
102-
103 if (type !=
type != ((void *)0)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-26
104 ((void *)0)
type != ((void *)0)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-26
105 ) {-
106 j = EVP_CIPHER_CTX_iv_length(c);-
107 (void)((j <= sizeof(c->iv)) ? 0 : (OPENSSL_die("assertion failed: " "j <= sizeof(c->iv)", __FILE__, 111), 1));-
108 i = ASN1_TYPE_set_octetstring(type, c->oiv, j);-
109 }
executed 26 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
26
110 return
executed 26 times by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
i;
executed 26 times by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
26
111}-
112-
113-
114int EVP_CIPHER_type(const EVP_CIPHER *ctx)-
115{-
116 int nid;-
117 ASN1_OBJECT *otmp;-
118 nid = EVP_CIPHER_nid(ctx);-
119-
120 switch (nid) {-
121-
122 case
executed 2 times by 1 test: case 37:
Executed by:
  • libcrypto.so.1.1
37:
executed 2 times by 1 test: case 37:
Executed by:
  • libcrypto.so.1.1
2
123 case
never executed: case 166:
166:
never executed: case 166:
0
124 case
never executed: case 98:
98:
never executed: case 98:
0
125-
126 return
executed 2 times by 1 test: return 37;
Executed by:
  • libcrypto.so.1.1
37;
executed 2 times by 1 test: return 37;
Executed by:
  • libcrypto.so.1.1
2
127-
128 case
never executed: case 5:
5:
never executed: case 5:
0
129 case
never executed: case 97:
97:
never executed: case 97:
0
130-
131 return
never executed: return 5;
5;
never executed: return 5;
0
132-
133 case
never executed: case 421:
421:
never executed: case 421:
0
134 case
never executed: case 653:
653:
never executed: case 653:
0
135 case
never executed: case 650:
650:
never executed: case 650:
0
136-
137 return
never executed: return 421;
421;
never executed: return 421;
0
138-
139 case
never executed: case 425:
425:
never executed: case 425:
0
140 case
never executed: case 654:
654:
never executed: case 654:
0
141 case
never executed: case 651:
651:
never executed: case 651:
0
142-
143 return
never executed: return 425;
425;
never executed: return 425;
0
144-
145 case
never executed: case 429:
429:
never executed: case 429:
0
146 case
never executed: case 655:
655:
never executed: case 655:
0
147 case
never executed: case 652:
652:
never executed: case 652:
0
148-
149 return
never executed: return 429;
429;
never executed: return 429;
0
150-
151 case
never executed: case 30:
30:
never executed: case 30:
0
152 case
never executed: case 657:
657:
never executed: case 657:
0
153 case
never executed: case 656:
656:
never executed: case 656:
0
154-
155 return
never executed: return 30;
30;
never executed: return 30;
0
156-
157 case
never executed: case 61:
61:
never executed: case 61:
0
158 case
never executed: case 659:
659:
never executed: case 659:
0
159 case
never executed: case 658:
658:
never executed: case 658:
0
160-
161 return
never executed: return 30;
30;
never executed: return 30;
0
162-
163 default
executed 45 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
:
executed 45 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
45
164-
165 otmp = OBJ_nid2obj(nid);-
166 if (OBJ_get0_data(otmp) ==
OBJ_get0_data(...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
167 ((void *)0)
OBJ_get0_data(...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 45 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-45
168 )-
169 nid = 0;
never executed: nid = 0;
0
170 ASN1_OBJECT_free(otmp);-
171 return
executed 45 times by 1 test: return nid;
Executed by:
  • libcrypto.so.1.1
nid;
executed 45 times by 1 test: return nid;
Executed by:
  • libcrypto.so.1.1
45
172 }-
173}-
174-
175int EVP_CIPHER_block_size(const EVP_CIPHER *e)-
176{-
177 return
executed 18082 times by 1 test: return e->block_size;
Executed by:
  • libcrypto.so.1.1
e->block_size;
executed 18082 times by 1 test: return e->block_size;
Executed by:
  • libcrypto.so.1.1
18082
178}-
179-
180int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)-
181{-
182 return
executed 28804263 times by 2 tests: return ctx->cipher->block_size;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ctx->cipher->block_size;
executed 28804263 times by 2 tests: return ctx->cipher->block_size;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
28804263
183}-
184-
185int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *e)-
186{-
187 return
executed 256 times by 1 test: return e->ctx_size;
Executed by:
  • libcrypto.so.1.1
e->ctx_size;
executed 256 times by 1 test: return e->ctx_size;
Executed by:
  • libcrypto.so.1.1
256
188}-
189-
190int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,-
191 const unsigned char *in, unsigned int inl)-
192{-
193 return
executed 17755 times by 1 test: return ctx->cipher->do_cipher(ctx, out, in, inl);
Executed by:
  • libcrypto.so.1.1
ctx->cipher->do_cipher(ctx, out, in, inl);
executed 17755 times by 1 test: return ctx->cipher->do_cipher(ctx, out, in, inl);
Executed by:
  • libcrypto.so.1.1
17755
194}-
195-
196const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx)-
197{-
198 return
executed 12820273 times by 2 tests: return ctx->cipher;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ctx->cipher;
executed 12820273 times by 2 tests: return ctx->cipher;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
12820273
199}-
200-
201int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx)-
202{-
203 return
executed 158312 times by 1 test: return ctx->encrypt;
Executed by:
  • libcrypto.so.1.1
ctx->encrypt;
executed 158312 times by 1 test: return ctx->encrypt;
Executed by:
  • libcrypto.so.1.1
158312
204}-
205-
206unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher)-
207{-
208 return
executed 12940989 times by 2 tests: return cipher->flags;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
cipher->flags;
executed 12940989 times by 2 tests: return cipher->flags;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
12940989
209}-
210-
211void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx)-
212{-
213 return
never executed: return ctx->app_data;
ctx->app_data;
never executed: return ctx->app_data;
0
214}-
215-
216void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data)-
217{-
218 ctx->app_data = data;-
219}
never executed: end of block
0
220-
221void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx)-
222{-
223 return
executed 31265188 times by 2 tests: return ctx->cipher_data;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ctx->cipher_data;
executed 31265188 times by 2 tests: return ctx->cipher_data;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
31265188
224}-
225-
226void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data)-
227{-
228 void *old_cipher_data;-
229-
230 old_cipher_data = ctx->cipher_data;-
231 ctx->cipher_data = cipher_data;-
232-
233 return
never executed: return old_cipher_data;
old_cipher_data;
never executed: return old_cipher_data;
0
234}-
235-
236int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)-
237{-
238 return
executed 18408 times by 1 test: return cipher->iv_len;
Executed by:
  • libcrypto.so.1.1
cipher->iv_len;
executed 18408 times by 1 test: return cipher->iv_len;
Executed by:
  • libcrypto.so.1.1
18408
239}-
240-
241int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)-
242{-
243 return
executed 120663 times by 1 test: return ctx->cipher->iv_len;
Executed by:
  • libcrypto.so.1.1
ctx->cipher->iv_len;
executed 120663 times by 1 test: return ctx->cipher->iv_len;
Executed by:
  • libcrypto.so.1.1
120663
244}-
245-
246const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx)-
247{-
248 return
executed 2 times by 1 test: return ctx->oiv;
Executed by:
  • libcrypto.so.1.1
ctx->oiv;
executed 2 times by 1 test: return ctx->oiv;
Executed by:
  • libcrypto.so.1.1
2
249}-
250-
251const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx)-
252{-
253 return
executed 9 times by 1 test: return ctx->iv;
Executed by:
  • libcrypto.so.1.1
ctx->iv;
executed 9 times by 1 test: return ctx->iv;
Executed by:
  • libcrypto.so.1.1
9
254}-
255-
256unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx)-
257{-
258 return
executed 187233 times by 1 test: return ctx->iv;
Executed by:
  • libcrypto.so.1.1
ctx->iv;
executed 187233 times by 1 test: return ctx->iv;
Executed by:
  • libcrypto.so.1.1
187233
259}-
260-
261unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx)-
262{-
263 return
executed 24043 times by 1 test: return ctx->buf;
Executed by:
  • libcrypto.so.1.1
ctx->buf;
executed 24043 times by 1 test: return ctx->buf;
Executed by:
  • libcrypto.so.1.1
24043
264}-
265-
266int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx)-
267{-
268 return
executed 61168 times by 1 test: return ctx->num;
Executed by:
  • libcrypto.so.1.1
ctx->num;
executed 61168 times by 1 test: return ctx->num;
Executed by:
  • libcrypto.so.1.1
61168
269}-
270-
271void EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num)-
272{-
273 ctx->num = num;-
274}
executed 61168 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
61168
275-
276int EVP_CIPHER_key_length(const EVP_CIPHER *cipher)-
277{-
278 return
executed 14443 times by 1 test: return cipher->key_len;
Executed by:
  • libcrypto.so.1.1
cipher->key_len;
executed 14443 times by 1 test: return cipher->key_len;
Executed by:
  • libcrypto.so.1.1
14443
279}-
280-
281int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx)-
282{-
283 return
executed 3186973 times by 2 tests: return ctx->key_len;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ctx->key_len;
executed 3186973 times by 2 tests: return ctx->key_len;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3186973
284}-
285-
286int EVP_CIPHER_nid(const EVP_CIPHER *cipher)-
287{-
288 return
executed 47 times by 1 test: return cipher->nid;
Executed by:
  • libcrypto.so.1.1
cipher->nid;
executed 47 times by 1 test: return cipher->nid;
Executed by:
  • libcrypto.so.1.1
47
289}-
290-
291int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)-
292{-
293 return
executed 13 times by 1 test: return ctx->cipher->nid;
Executed by:
  • libcrypto.so.1.1
ctx->cipher->nid;
executed 13 times by 1 test: return ctx->cipher->nid;
Executed by:
  • libcrypto.so.1.1
13
294}-
295-
296int EVP_MD_block_size(const EVP_MD *md)-
297{-
298 return
executed 160570 times by 1 test: return md->block_size;
Executed by:
  • libcrypto.so.1.1
md->block_size;
executed 160570 times by 1 test: return md->block_size;
Executed by:
  • libcrypto.so.1.1
160570
299}-
300-
301int EVP_MD_type(const EVP_MD *md)-
302{-
303 return
executed 28459 times by 1 test: return md->type;
Executed by:
  • libcrypto.so.1.1
md->type;
executed 28459 times by 1 test: return md->type;
Executed by:
  • libcrypto.so.1.1
28459
304}-
305-
306int EVP_MD_pkey_type(const EVP_MD *md)-
307{-
308 return
never executed: return md->pkey_type;
md->pkey_type;
never executed: return md->pkey_type;
0
309}-
310-
311int EVP_MD_size(const EVP_MD *md)-
312{-
313 if (!md
!mdDescription
TRUEnever evaluated
FALSEevaluated 426109 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-426109
314 ERR_put_error(6,(162),(159),__FILE__,316);-
315 return
never executed: return -1;
-1;
never executed: return -1;
0
316 }-
317 return
executed 426109 times by 2 tests: return md->md_size;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
md->md_size;
executed 426109 times by 2 tests: return md->md_size;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
426109
318}-
319-
320unsigned long EVP_MD_flags(const EVP_MD *md)-
321{-
322 return
executed 119 times by 1 test: return md->flags;
Executed by:
  • libcrypto.so.1.1
md->flags;
executed 119 times by 1 test: return md->flags;
Executed by:
  • libcrypto.so.1.1
119
323}-
324-
325EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type)-
326{-
327 EVP_MD *md = CRYPTO_zalloc(sizeof(*md), __FILE__, 329);-
328-
329 if (md !=
md != ((void *)0)Description
TRUEevaluated 1835 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1835
330 ((void *)0)
md != ((void *)0)Description
TRUEevaluated 1835 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1835
331 ) {-
332 md->type = md_type;-
333 md->pkey_type = pkey_type;-
334 }
executed 1835 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1835
335 return
executed 1835 times by 1 test: return md;
Executed by:
  • libcrypto.so.1.1
md;
executed 1835 times by 1 test: return md;
Executed by:
  • libcrypto.so.1.1
1835
336}-
337EVP_MD *EVP_MD_meth_dup(const EVP_MD *md)-
338{-
339 EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type);-
340-
341 if (to !=
to != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
342 ((void *)0)
to != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
343 )-
344 memcpy(to, md, sizeof(*to));
never executed: memcpy(to, md, sizeof(*to));
0
345 return
never executed: return to;
to;
never executed: return to;
0
346}-
347void EVP_MD_meth_free(EVP_MD *md)-
348{-
349 CRYPTO_free(md, __FILE__, 347);-
350}
executed 1835 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1835
351int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize)-
352{-
353 md->block_size = blocksize;-
354 return
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1835
355}-
356int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize)-
357{-
358 md->md_size = resultsize;-
359 return
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1835
360}-
361int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize)-
362{-
363 md->ctx_size = datasize;-
364 return
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1835
365}-
366int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags)-
367{-
368 md->flags = flags;-
369 return
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1835
370}-
371int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx))-
372{-
373 md->init = init;-
374 return
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1835
375}-
376int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,-
377 const void *data,-
378 size_t count))-
379{-
380 md->update = update;-
381 return
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1835
382}-
383int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,-
384 unsigned char *md))-
385{-
386 md->final = final;-
387 return
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 1835 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1835
388}-
389int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,-
390 const EVP_MD_CTX *from))-
391{-
392 md->copy = copy;-
393 return
never executed: return 1;
1;
never executed: return 1;
0
394}-
395int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx))-
396{-
397 md->cleanup = cleanup;-
398 return
never executed: return 1;
1;
never executed: return 1;
0
399}-
400int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd,-
401 int p1, void *p2))-
402{-
403 md->md_ctrl = ctrl;-
404 return
never executed: return 1;
1;
never executed: return 1;
0
405}-
406-
407int EVP_MD_meth_get_input_blocksize(const EVP_MD *md)-
408{-
409 return
never executed: return md->block_size;
md->block_size;
never executed: return md->block_size;
0
410}-
411int EVP_MD_meth_get_result_size(const EVP_MD *md)-
412{-
413 return
never executed: return md->md_size;
md->md_size;
never executed: return md->md_size;
0
414}-
415int EVP_MD_meth_get_app_datasize(const EVP_MD *md)-
416{-
417 return
never executed: return md->ctx_size;
md->ctx_size;
never executed: return md->ctx_size;
0
418}-
419unsigned long EVP_MD_meth_get_flags(const EVP_MD *md)-
420{-
421 return
never executed: return md->flags;
md->flags;
never executed: return md->flags;
0
422}-
423int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx)-
424{-
425 return
never executed: return md->init;
md->init;
never executed: return md->init;
0
426}-
427int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx,-
428 const void *data,-
429 size_t count)-
430{-
431 return
never executed: return md->update;
md->update;
never executed: return md->update;
0
432}-
433int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx,-
434 unsigned char *md)-
435{-
436 return
never executed: return md->final;
md->final;
never executed: return md->final;
0
437}-
438int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,-
439 const EVP_MD_CTX *from)-
440{-
441 return
never executed: return md->copy;
md->copy;
never executed: return md->copy;
0
442}-
443int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx)-
444{-
445 return
never executed: return md->cleanup;
md->cleanup;
never executed: return md->cleanup;
0
446}-
447int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,-
448 int p1, void *p2)-
449{-
450 return
never executed: return md->md_ctrl;
md->md_ctrl;
never executed: return md->md_ctrl;
0
451}-
452-
453const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)-
454{-
455 if (!ctx
!ctxDescription
TRUEevaluated 79614 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 171354 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
79614-171354
456 return
executed 79614 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
executed 79614 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
79614
457 ((void *)0)
executed 79614 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
79614
458 ;
executed 79614 times by 1 test: return ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
79614
459 return
executed 171354 times by 1 test: return ctx->digest;
Executed by:
  • libcrypto.so.1.1
ctx->digest;
executed 171354 times by 1 test: return ctx->digest;
Executed by:
  • libcrypto.so.1.1
171354
460}-
461-
462EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx)-
463{-
464 return
executed 106253 times by 1 test: return ctx->pctx;
Executed by:
  • libcrypto.so.1.1
ctx->pctx;
executed 106253 times by 1 test: return ctx->pctx;
Executed by:
  • libcrypto.so.1.1
106253
465}-
466-
467void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx)-
468{-
469-
470-
471-
472-
473 if (!EVP_MD_CTX_test_flags(ctx, 0x0400)
!EVP_MD_CTX_te...s(ctx, 0x0400)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-3
474 EVP_PKEY_CTX_free(ctx->pctx);
executed 3 times by 1 test: EVP_PKEY_CTX_free(ctx->pctx);
Executed by:
  • libcrypto.so.1.1
3
475-
476 ctx->pctx = pctx;-
477-
478 if (pctx !=
pctx != ((void *)0)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-3
479 ((void *)0)
pctx != ((void *)0)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-3
480 ) {-
481-
482 EVP_MD_CTX_set_flags(ctx, 0x0400);-
483 }
executed 3 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
3
484 EVP_MD_CTX_clear_flags(ctx, 0x0400);-
485 }
never executed: end of block
0
486}-
487-
488void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx)-
489{-
490 return
executed 4002432 times by 2 tests: return ctx->md_data;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
ctx->md_data;
executed 4002432 times by 2 tests: return ctx->md_data;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
4002432
491}-
492-
493int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx,-
494 const void *data, size_t count)-
495{-
496 return
never executed: return ctx->update;
ctx->update;
never executed: return ctx->update;
0
497}-
498-
499void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx,-
500 int (*update) (EVP_MD_CTX *ctx,-
501 const void *data, size_t count))-
502{-
503 ctx->update = update;-
504}
executed 19278 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
19278
505-
506void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)-
507{-
508 ctx->flags |= flags;-
509}
executed 494387 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
494387
510-
511void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags)-
512{-
513 ctx->flags &= ~flags;-
514}
executed 1712324 times by 3 tests: end of block
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
  • sm2_internal_test
1712324
515-
516int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags)-
517{-
518 return
executed 3624465 times by 3 tests: return (ctx->flags & flags);
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
  • sm2_internal_test
(ctx->flags & flags);
executed 3624465 times by 3 tests: return (ctx->flags & flags);
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
  • sm2_internal_test
3624465
519}-
520-
521void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags)-
522{-
523 ctx->flags |= flags;-
524}
executed 8361 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8361
525-
526void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags)-
527{-
528 ctx->flags &= ~flags;-
529}
never executed: end of block
0
530-
531int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags)-
532{-
533 return
executed 28481639 times by 2 tests: return (ctx->flags & flags);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
(ctx->flags & flags);
executed 28481639 times by 2 tests: return (ctx->flags & flags);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
28481639
534}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2