OpenCoverage

e_des3.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/e_des3.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4typedef struct {-
5 union {-
6 double align;-
7 DES_key_schedule ks[3];-
8 } ks;-
9 union {-
10 void (*cbc) (const void *, void *, size_t,-
11 const DES_key_schedule *, unsigned char *);-
12 } stream;-
13} DES_EDE_KEY;-
14static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,-
15 const unsigned char *iv, int enc);-
16-
17static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,-
18 const unsigned char *iv, int enc);-
19-
20static int des3_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr);-
21static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,-
22 const unsigned char *in, size_t inl)-
23{-
24 size_t i, bl; bl = EVP_CIPHER_CTX_cipher(ctx)->block_size; if (inl < bl
inl < blDescription
TRUEnever evaluated
FALSEevaluated 264 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) return
never executed: return 1;
1;
never executed: return 1;
inl -= bl; for (i=0; i <= inl
i <= inlDescription
TRUEevaluated 4128 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 264 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i+=bl)
0-4128
25 DES_ecb3_encrypt((const_DES_cblock *)(in + i),
executed 4128 times by 1 test: DES_ecb3_encrypt((const_DES_cblock *)(in + i), (DES_cblock *)(out + i), &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2], EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
4128
26 (DES_cblock *)(out + i),
executed 4128 times by 1 test: DES_ecb3_encrypt((const_DES_cblock *)(in + i), (DES_cblock *)(out + i), &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2], EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
4128
27 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1],
executed 4128 times by 1 test: DES_ecb3_encrypt((const_DES_cblock *)(in + i), (DES_cblock *)(out + i), &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2], EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
4128
28 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2], EVP_CIPHER_CTX_encrypting(ctx));
executed 4128 times by 1 test: DES_ecb3_encrypt((const_DES_cblock *)(in + i), (DES_cblock *)(out + i), &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2], EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
4128
29 return
executed 264 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 264 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
264
30}-
31-
32static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,-
33 const unsigned char *in, size_t inl)-
34{-
35 while (inl >= ((size_t)1<<(sizeof(long)*8-2))
inl >= ((size_...of(long)*8-2))Description
TRUEnever evaluated
FALSEevaluated 140 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-140
36 int num = EVP_CIPHER_CTX_num(ctx);-
37 DES_ede3_ofb64_encrypt(in, out, (long)((size_t)1<<(sizeof(long)*8-2)),-
38 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1],-
39 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2],-
40 (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx),-
41 &num);-
42 EVP_CIPHER_CTX_set_num(ctx, num);-
43 inl -= ((size_t)1<<(sizeof(long)*8-2));-
44 in += ((size_t)1<<(sizeof(long)*8-2));-
45 out += ((size_t)1<<(sizeof(long)*8-2));-
46 }
never executed: end of block
0
47 if (inl
inlDescription
TRUEevaluated 140 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-140
48 int num = EVP_CIPHER_CTX_num(ctx);-
49 DES_ede3_ofb64_encrypt(in, out, (long)inl,-
50 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1],-
51 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2],-
52 (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx),-
53 &num);-
54 EVP_CIPHER_CTX_set_num(ctx, num);-
55 }
executed 140 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
140
56 return
executed 140 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 140 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
140
57}-
58-
59static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,-
60 const unsigned char *in, size_t inl)-
61{-
62 DES_EDE_KEY *dat = ((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx));-
63-
64 if (dat->stream.cbc !=
dat->stream.cbc != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 511 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-511
65 ((void *)0)
dat->stream.cbc != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 511 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-511
66 ) {-
67 (*dat->stream.cbc) (in, out, inl, dat->ks.ks,-
68 EVP_CIPHER_CTX_iv_noconst(ctx));-
69 return
never executed: return 1;
1;
never executed: return 1;
0
70 }-
71-
72 while (inl >= ((size_t)1<<(sizeof(long)*8-2))
inl >= ((size_...of(long)*8-2))Description
TRUEnever evaluated
FALSEevaluated 511 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-511
73 DES_ede3_cbc_encrypt(in, out, (long)((size_t)1<<(sizeof(long)*8-2)),-
74 &dat->ks.ks[0], &dat->ks.ks[1], &dat->ks.ks[2],-
75 (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx),-
76 EVP_CIPHER_CTX_encrypting(ctx));-
77 inl -= ((size_t)1<<(sizeof(long)*8-2));-
78 in += ((size_t)1<<(sizeof(long)*8-2));-
79 out += ((size_t)1<<(sizeof(long)*8-2));-
80 }
never executed: end of block
0
81 if (inl
inlDescription
TRUEevaluated 511 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-511
82 DES_ede3_cbc_encrypt(in, out, (long)inl,
executed 511 times by 1 test: DES_ede3_cbc_encrypt(in, out, (long)inl, &dat->ks.ks[0], &dat->ks.ks[1], &dat->ks.ks[2], (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
511
83 &dat->ks.ks[0], &dat->ks.ks[1], &dat->ks.ks[2],
executed 511 times by 1 test: DES_ede3_cbc_encrypt(in, out, (long)inl, &dat->ks.ks[0], &dat->ks.ks[1], &dat->ks.ks[2], (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
511
84 (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx),
executed 511 times by 1 test: DES_ede3_cbc_encrypt(in, out, (long)inl, &dat->ks.ks[0], &dat->ks.ks[1], &dat->ks.ks[2], (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
511
85 EVP_CIPHER_CTX_encrypting(ctx));
executed 511 times by 1 test: DES_ede3_cbc_encrypt(in, out, (long)inl, &dat->ks.ks[0], &dat->ks.ks[1], &dat->ks.ks[2], (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
511
86 return
executed 511 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 511 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
511
87}-
88-
89static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,-
90 const unsigned char *in, size_t inl)-
91{-
92 while (inl >= ((size_t)1<<(sizeof(long)*8-2))
inl >= ((size_...of(long)*8-2))Description
TRUEnever evaluated
FALSEevaluated 140 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-140
93 int num = EVP_CIPHER_CTX_num(ctx);-
94 DES_ede3_cfb64_encrypt(in, out, (long)((size_t)1<<(sizeof(long)*8-2)),-
95 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1],-
96 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2],-
97 (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx),-
98 &num, EVP_CIPHER_CTX_encrypting(ctx));-
99 EVP_CIPHER_CTX_set_num(ctx, num);-
100 inl -= ((size_t)1<<(sizeof(long)*8-2));-
101 in += ((size_t)1<<(sizeof(long)*8-2));-
102 out += ((size_t)1<<(sizeof(long)*8-2));-
103 }
never executed: end of block
0
104 if (inl
inlDescription
TRUEevaluated 140 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-140
105 int num = EVP_CIPHER_CTX_num(ctx);-
106 DES_ede3_cfb64_encrypt(in, out, (long)inl,-
107 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1],-
108 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2],-
109 (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx),-
110 &num, EVP_CIPHER_CTX_encrypting(ctx));-
111 EVP_CIPHER_CTX_set_num(ctx, num);-
112 }
executed 140 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
140
113 return
executed 140 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 140 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
140
114}-
115-
116-
117-
118-
119-
120static int des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,-
121 const unsigned char *in, size_t inl)-
122{-
123 size_t n;-
124 unsigned char c[1], d[1];-
125-
126 if (!EVP_CIPHER_CTX_test_flags(ctx, 0x2000)
!EVP_CIPHER_CT...s(ctx, 0x2000)Description
TRUEevaluated 74 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-74
127 inl *= 8;
executed 74 times by 1 test: inl *= 8;
Executed by:
  • libcrypto.so.1.1
74
128 for (n = 0; n < inl
n < inlDescription
TRUEevaluated 34528 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 74 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++n) {
74-34528
129 c[0] = (
(in[n / 8] & (... (7 - n % 8)))Description
TRUEevaluated 15912 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 18616 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
in[n / 8] & (1 << (7 - n % 8)))
(in[n / 8] & (... (7 - n % 8)))Description
TRUEevaluated 15912 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 18616 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? 0x80 : 0;
15912-18616
130 DES_ede3_cfb_encrypt(c, d, 1, 1,-
131 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1],-
132 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2],-
133 (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx),-
134 EVP_CIPHER_CTX_encrypting(ctx));-
135 out[n / 8] = (out[n / 8] & ~(0x80 >> (unsigned int)(n % 8)))-
136 | ((d[0] & 0x80) >> (unsigned int)(n % 8));-
137 }
executed 34528 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
34528
138-
139 return
executed 74 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 74 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
74
140}-
141-
142static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,-
143 const unsigned char *in, size_t inl)-
144{-
145 while (inl >= ((size_t)1<<(sizeof(long)*8-2))
inl >= ((size_...of(long)*8-2))Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2
146 DES_ede3_cfb_encrypt(in, out, 8, (long)((size_t)1<<(sizeof(long)*8-2)),-
147 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1],-
148 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2],-
149 (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx),-
150 EVP_CIPHER_CTX_encrypting(ctx));-
151 inl -= ((size_t)1<<(sizeof(long)*8-2));-
152 in += ((size_t)1<<(sizeof(long)*8-2));-
153 out += ((size_t)1<<(sizeof(long)*8-2));-
154 }
never executed: end of block
0
155 if (inl
inlDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-2
156 DES_ede3_cfb_encrypt(in, out, 8, (long)inl,
executed 2 times by 1 test: DES_ede3_cfb_encrypt(in, out, 8, (long)inl, &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2], (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
2
157 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1],
executed 2 times by 1 test: DES_ede3_cfb_encrypt(in, out, 8, (long)inl, &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2], (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
2
158 &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2],
executed 2 times by 1 test: DES_ede3_cfb_encrypt(in, out, 8, (long)inl, &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2], (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
2
159 (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx),
executed 2 times by 1 test: DES_ede3_cfb_encrypt(in, out, 8, (long)inl, &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2], (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
2
160 EVP_CIPHER_CTX_encrypting(ctx));
executed 2 times by 1 test: DES_ede3_cfb_encrypt(in, out, 8, (long)inl, &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[0], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[1], &((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks[2], (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));
Executed by:
  • libcrypto.so.1.1
2
161 return
executed 2 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 2 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
2
162}-
163-
164static const EVP_CIPHER des_ede_cbc = { 43, 8, 16, 8, 0x200 | 0x1000 | 0x2, des_ede_init_key, des_ede_cbc_cipher, -
165((void *)0)-
166, sizeof(DES_EDE_KEY), -
167((void *)0)-
168, -
169((void *)0)-
170, des3_ctrl, -
171((void *)0) -
172}; const EVP_CIPHER *EVP_des_ede_cbc(void) { return
executed 1962 times by 1 test: return &des_ede_cbc;
Executed by:
  • libcrypto.so.1.1
&des_ede_cbc;
executed 1962 times by 1 test: return &des_ede_cbc;
Executed by:
  • libcrypto.so.1.1
} static const EVP_CIPHER des_ede_cfb64 = { 60, 1, 16, 8, 0x200 | 0x1000 | 0x3, des_ede_init_key, des_ede_cfb64_cipher,
1962
173((void *)0)-
174, sizeof(DES_EDE_KEY), -
175((void *)0)-
176, -
177((void *)0)-
178, des3_ctrl, -
179((void *)0) -
180}; const EVP_CIPHER *EVP_des_ede_cfb64(void) { return
executed 1962 times by 1 test: return &des_ede_cfb64;
Executed by:
  • libcrypto.so.1.1
&des_ede_cfb64;
executed 1962 times by 1 test: return &des_ede_cfb64;
Executed by:
  • libcrypto.so.1.1
} static const EVP_CIPHER des_ede_ofb = { 62, 1, 16, 8, 0x200 | 0x1000 | 0x4, des_ede_init_key, des_ede_ofb_cipher,
1962
181((void *)0)-
182, sizeof(DES_EDE_KEY), -
183((void *)0)-
184, -
185((void *)0)-
186, des3_ctrl, -
187((void *)0) -
188}; const EVP_CIPHER *EVP_des_ede_ofb(void) { return
executed 1962 times by 1 test: return &des_ede_ofb;
Executed by:
  • libcrypto.so.1.1
&des_ede_ofb;
executed 1962 times by 1 test: return &des_ede_ofb;
Executed by:
  • libcrypto.so.1.1
} static const EVP_CIPHER des_ede_ecb = { 32, 8, 16, 0, 0x200 | 0x1000 | 0x1, des_ede_init_key, des_ede_ecb_cipher,
1962
189((void *)0)-
190, sizeof(DES_EDE_KEY), -
191((void *)0)-
192, -
193((void *)0)-
194, des3_ctrl, -
195((void *)0) -
196}; const EVP_CIPHER *EVP_des_ede_ecb(void) { return
never executed: return &des_ede_ecb;
&des_ede_ecb;
never executed: return &des_ede_ecb;
}
0
197-
198-
199-
200-
201-
202-
203 static const EVP_CIPHER des_ede3_cbc = { 44, 8, 24, 8, 0x200 | 0x1000 | 0x2, des_ede3_init_key, des_ede_cbc_cipher, -
204 ((void *)0)-
205 , sizeof(DES_EDE_KEY), -
206 ((void *)0)-
207 , -
208 ((void *)0)-
209 , des3_ctrl, -
210 ((void *)0) -
211 }; const EVP_CIPHER *EVP_des_ede3_cbc(void) { return
executed 3968 times by 1 test: return &des_ede3_cbc;
Executed by:
  • libcrypto.so.1.1
&des_ede3_cbc;
executed 3968 times by 1 test: return &des_ede3_cbc;
Executed by:
  • libcrypto.so.1.1
} static const EVP_CIPHER des_ede3_cfb64 = { 61, 1, 24, 8, 0x200 | 0x1000 | 0x3, des_ede3_init_key, des_ede_cfb64_cipher,
3968
212 ((void *)0)-
213 , sizeof(DES_EDE_KEY), -
214 ((void *)0)-
215 , -
216 ((void *)0)-
217 , des3_ctrl, -
218 ((void *)0) -
219 }; const EVP_CIPHER *EVP_des_ede3_cfb64(void) { return
executed 1962 times by 1 test: return &des_ede3_cfb64;
Executed by:
  • libcrypto.so.1.1
&des_ede3_cfb64;
executed 1962 times by 1 test: return &des_ede3_cfb64;
Executed by:
  • libcrypto.so.1.1
} static const EVP_CIPHER des_ede3_ofb = { 63, 1, 24, 8, 0x200 | 0x1000 | 0x4, des_ede3_init_key, des_ede_ofb_cipher,
1962
220 ((void *)0)-
221 , sizeof(DES_EDE_KEY), -
222 ((void *)0)-
223 , -
224 ((void *)0)-
225 , des3_ctrl, -
226 ((void *)0) -
227 }; const EVP_CIPHER *EVP_des_ede3_ofb(void) { return
executed 1962 times by 1 test: return &des_ede3_ofb;
Executed by:
  • libcrypto.so.1.1
&des_ede3_ofb;
executed 1962 times by 1 test: return &des_ede3_ofb;
Executed by:
  • libcrypto.so.1.1
} static const EVP_CIPHER des_ede3_ecb = { 33, 8, 24, 0, 0x200 | 0x1000 | 0x1, des_ede3_init_key, des_ede_ecb_cipher,
1962
228 ((void *)0)-
229 , sizeof(DES_EDE_KEY), -
230 ((void *)0)-
231 , -
232 ((void *)0)-
233 , des3_ctrl, -
234 ((void *)0) -
235 }; const EVP_CIPHER *EVP_des_ede3_ecb(void) { return
never executed: return &des_ede3_ecb;
&des_ede3_ecb;
never executed: return &des_ede3_ecb;
}
0
236-
237-
238-
239 static const EVP_CIPHER des_ede3_cfb1 = { 658, 1, 24, 8, 0x200 | 0x1000 | 0x3, des_ede3_init_key, des_ede3_cfb1_cipher, -
240 ((void *)0)-
241 , sizeof(DES_EDE_KEY), -
242 ((void *)0)-
243 , -
244 ((void *)0)-
245 , des3_ctrl, -
246 ((void *)0) -
247 }; const EVP_CIPHER *EVP_des_ede3_cfb1(void) { return
executed 1962 times by 1 test: return &des_ede3_cfb1;
Executed by:
  • libcrypto.so.1.1
&des_ede3_cfb1;
executed 1962 times by 1 test: return &des_ede3_cfb1;
Executed by:
  • libcrypto.so.1.1
}
1962
248-
249-
250-
251 static const EVP_CIPHER des_ede3_cfb8 = { 659, 1, 24, 8, 0x200 | 0x1000 | 0x3, des_ede3_init_key, des_ede3_cfb8_cipher, -
252 ((void *)0)-
253 , sizeof(DES_EDE_KEY), -
254 ((void *)0)-
255 , -
256 ((void *)0)-
257 , des3_ctrl, -
258 ((void *)0) -
259 }; const EVP_CIPHER *EVP_des_ede3_cfb8(void) { return
executed 1962 times by 1 test: return &des_ede3_cfb8;
Executed by:
  • libcrypto.so.1.1
&des_ede3_cfb8;
executed 1962 times by 1 test: return &des_ede3_cfb8;
Executed by:
  • libcrypto.so.1.1
}
1962
260-
261-
262-
263static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,-
264 const unsigned char *iv, int enc)-
265{-
266 DES_cblock *deskey = (DES_cblock *)key;-
267 DES_EDE_KEY *dat = ((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx));-
268-
269 dat->stream.cbc = -
270 ((void *)0)-
271 ;-
272 DES_set_key_unchecked(&deskey[0], &dat->ks.ks[0]);-
273 DES_set_key_unchecked(&deskey[1], &dat->ks.ks[1]);-
274 memcpy(&dat->ks.ks[2], &dat->ks.ks[0], sizeof(dat->ks.ks[0]));-
275 return
executed 26 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 26 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
26
276}-
277-
278static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,-
279 const unsigned char *iv, int enc)-
280{-
281 DES_cblock *deskey = (DES_cblock *)key;-
282 DES_EDE_KEY *dat = ((DES_EDE_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx));-
283-
284 dat->stream.cbc = -
285 ((void *)0)-
286 ;-
287 DES_set_key_unchecked(&deskey[0], &dat->ks.ks[0]);-
288 DES_set_key_unchecked(&deskey[1], &dat->ks.ks[1]);-
289 DES_set_key_unchecked(&deskey[2], &dat->ks.ks[2]);-
290 return
executed 136 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 136 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
136
291}-
292-
293static int des3_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)-
294{-
295-
296 DES_cblock *deskey = ptr;-
297-
298 switch (type) {-
299 case
executed 31 times by 1 test: case 0x6:
Executed by:
  • libcrypto.so.1.1
0x6:
executed 31 times by 1 test: case 0x6:
Executed by:
  • libcrypto.so.1.1
31
300 if (RAND_priv_bytes(ptr, EVP_CIPHER_CTX_key_length(ctx)) <= 0
RAND_priv_byte...gth(ctx)) <= 0Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-31
301 return
never executed: return 0;
0;
never executed: return 0;
0
302 DES_set_odd_parity(deskey);-
303 if (EVP_CIPHER_CTX_key_length(ctx) >= 16
EVP_CIPHER_CTX...gth(ctx) >= 16Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-31
304 DES_set_odd_parity(deskey + 1);
executed 31 times by 1 test: DES_set_odd_parity(deskey + 1);
Executed by:
  • libcrypto.so.1.1
31
305 if (EVP_CIPHER_CTX_key_length(ctx) >= 24
EVP_CIPHER_CTX...gth(ctx) >= 24Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-31
306 DES_set_odd_parity(deskey + 2);
executed 31 times by 1 test: DES_set_odd_parity(deskey + 2);
Executed by:
  • libcrypto.so.1.1
31
307 return
executed 31 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 31 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
31
308-
309 default
never executed: default:
:
never executed: default:
0
310 return
never executed: return -1;
-1;
never executed: return -1;
0
311 }-
312}-
313-
314const EVP_CIPHER *EVP_des_ede(void)-
315{-
316 return
executed 1962 times by 1 test: return &des_ede_ecb;
Executed by:
  • libcrypto.so.1.1
&des_ede_ecb;
executed 1962 times by 1 test: return &des_ede_ecb;
Executed by:
  • libcrypto.so.1.1
1962
317}-
318-
319const EVP_CIPHER *EVP_des_ede3(void)-
320{-
321 return
executed 1962 times by 1 test: return &des_ede3_ecb;
Executed by:
  • libcrypto.so.1.1
&des_ede3_ecb;
executed 1962 times by 1 test: return &des_ede3_ecb;
Executed by:
  • libcrypto.so.1.1
1962
322}-
323-
324-
325-
326static const unsigned char wrap_iv[8] =-
327 { 0x4a, 0xdd, 0xa2, 0x2c, 0x79, 0xe8, 0x21, 0x05 };-
328-
329static int des_ede3_unwrap(EVP_CIPHER_CTX *ctx, unsigned char *out,-
330 const unsigned char *in, size_t inl)-
331{-
332 unsigned char icv[8], iv[8], sha1tmp[20];-
333 int rv = -1;-
334 if (inl < 24
inl < 24Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-6
335 return
never executed: return -1;
-1;
never executed: return -1;
0
336 if (out ==
out == ((void *)0)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3
337 ((void *)0)
out == ((void *)0)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3
338 )-
339 return
executed 3 times by 1 test: return inl - 16;
Executed by:
  • libcrypto.so.1.1
inl - 16;
executed 3 times by 1 test: return inl - 16;
Executed by:
  • libcrypto.so.1.1
3
340 memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), wrap_iv, 8);-
341-
342 des_ede_cbc_cipher(ctx, icv, in, 8);-
343-
344-
345-
346-
347-
348 if (out == in
out == inDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-3
349 memmove(out, out + 8, inl - 8);-
350 in -= 8;-
351 }
never executed: end of block
0
352 des_ede_cbc_cipher(ctx, out, in + 8, inl - 16);-
353-
354 des_ede_cbc_cipher(ctx, iv, in + inl - 8, 8);-
355-
356 BUF_reverse(icv, -
357 ((void *)0)-
358 , 8);-
359 BUF_reverse(out, -
360 ((void *)0)-
361 , inl - 16);-
362 BUF_reverse(EVP_CIPHER_CTX_iv_noconst(ctx), iv, 8);-
363-
364 des_ede_cbc_cipher(ctx, out, out, inl - 16);-
365 des_ede_cbc_cipher(ctx, icv, icv, 8);-
366-
367 SHA1(out, inl - 16, sha1tmp);-
368-
369 if (!CRYPTO_memcmp(sha1tmp, icv, 8)
!CRYPTO_memcmp...a1tmp, icv, 8)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-3
370 rv = inl - 16;
executed 3 times by 1 test: rv = inl - 16;
Executed by:
  • libcrypto.so.1.1
3
371 OPENSSL_cleanse(icv, 8);-
372 OPENSSL_cleanse(sha1tmp, 20);-
373 OPENSSL_cleanse(iv, 8);-
374 OPENSSL_cleanse(EVP_CIPHER_CTX_iv_noconst(ctx), 8);-
375 if (rv == -1
rv == -1Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-3
376 OPENSSL_cleanse(out, inl - 16);
never executed: OPENSSL_cleanse(out, inl - 16);
0
377-
378 return
executed 3 times by 1 test: return rv;
Executed by:
  • libcrypto.so.1.1
rv;
executed 3 times by 1 test: return rv;
Executed by:
  • libcrypto.so.1.1
3
379}-
380-
381static int des_ede3_wrap(EVP_CIPHER_CTX *ctx, unsigned char *out,-
382 const unsigned char *in, size_t inl)-
383{-
384 unsigned char sha1tmp[20];-
385 if (out ==
out == ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4
386 ((void *)0)
out == ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4
387 )-
388 return
executed 4 times by 1 test: return inl + 16;
Executed by:
  • libcrypto.so.1.1
inl + 16;
executed 4 times by 1 test: return inl + 16;
Executed by:
  • libcrypto.so.1.1
4
389-
390 memmove(out + 8, in, inl);-
391-
392 SHA1(in, inl, sha1tmp);-
393 memcpy(out + inl + 8, sha1tmp, 8);-
394 OPENSSL_cleanse(sha1tmp, 20);-
395-
396 if (RAND_bytes(EVP_CIPHER_CTX_iv_noconst(ctx), 8) <= 0
RAND_bytes(EVP...(ctx), 8) <= 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-4
397 return
never executed: return -1;
-1;
never executed: return -1;
0
398 memcpy(out, EVP_CIPHER_CTX_iv_noconst(ctx), 8);-
399-
400 des_ede_cbc_cipher(ctx, out + 8, out + 8, inl + 8);-
401 BUF_reverse(out, -
402 ((void *)0)-
403 , inl + 16);-
404 memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), wrap_iv, 8);-
405 des_ede_cbc_cipher(ctx, out, out, inl + 16);-
406 return
executed 4 times by 1 test: return inl + 16;
Executed by:
  • libcrypto.so.1.1
inl + 16;
executed 4 times by 1 test: return inl + 16;
Executed by:
  • libcrypto.so.1.1
4
407}-
408-
409static int des_ede3_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,-
410 const unsigned char *in, size_t inl)-
411{-
412-
413-
414-
415-
416-
417 if (inl >= ((size_t)1<<(sizeof(long)*8-2))
inl >= ((size_...of(long)*8-2))Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| inl % 8
inl % 8Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-14
418 return
never executed: return -1;
-1;
never executed: return -1;
0
419-
420 if (is_partially_overlapping(out, in, inl)
is_partially_o...(out, in, inl)Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-14
421 ERR_put_error(6,(171),(162),__FILE__,398);-
422 return
never executed: return 0;
0;
never executed: return 0;
0
423 }-
424-
425 if (EVP_CIPHER_CTX_encrypting(ctx)
EVP_CIPHER_CTX_encrypting(ctx)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
6-8
426 return
executed 8 times by 1 test: return des_ede3_wrap(ctx, out, in, inl);
Executed by:
  • libcrypto.so.1.1
des_ede3_wrap(ctx, out, in, inl);
executed 8 times by 1 test: return des_ede3_wrap(ctx, out, in, inl);
Executed by:
  • libcrypto.so.1.1
8
427 else-
428 return
executed 6 times by 1 test: return des_ede3_unwrap(ctx, out, in, inl);
Executed by:
  • libcrypto.so.1.1
des_ede3_unwrap(ctx, out, in, inl);
executed 6 times by 1 test: return des_ede3_unwrap(ctx, out, in, inl);
Executed by:
  • libcrypto.so.1.1
6
429}-
430-
431static const EVP_CIPHER des3_wrap = {-
432 246,-
433 8, 24, 0,-
434 0x10002 | 0x10 | 0x100000-
435 | 0x1000,-
436 des_ede3_init_key, des_ede3_wrap_cipher,-
437 -
438 ((void *)0)-
439 ,-
440 sizeof(DES_EDE_KEY),-
441 -
442 ((void *)0)-
443 , -
444 ((void *)0)-
445 , -
446 ((void *)0)-
447 , -
448 ((void *)0)-
449-
450};-
451-
452const EVP_CIPHER *EVP_des_ede3_wrap(void)-
453{-
454 return
executed 1966 times by 1 test: return &des3_wrap;
Executed by:
  • libcrypto.so.1.1
&des3_wrap;
executed 1966 times by 1 test: return &des3_wrap;
Executed by:
  • libcrypto.so.1.1
1966
455}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2