Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/evp/e_des3.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | - | |||||||||||||
8 | static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||
9 | const unsigned char *iv, int enc); | - | ||||||||||||
10 | - | |||||||||||||
11 | static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||
12 | const unsigned char *iv, int enc); | - | ||||||||||||
13 | - | |||||||||||||
14 | static int des3_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); | - | ||||||||||||
15 | - | |||||||||||||
16 | typedef struct { | - | ||||||||||||
17 | DES_key_schedule ks1; | - | ||||||||||||
18 | DES_key_schedule ks2; | - | ||||||||||||
19 | DES_key_schedule ks3; | - | ||||||||||||
20 | } DES_EDE_KEY; | - | ||||||||||||
21 | - | |||||||||||||
22 | - | |||||||||||||
23 | - | |||||||||||||
24 | - | |||||||||||||
25 | - | |||||||||||||
26 | static int | - | ||||||||||||
27 | des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||
28 | const unsigned char *in, size_t inl) | - | ||||||||||||
29 | { | - | ||||||||||||
30 | size_t i, bl; bl = ctx->cipher->block_size; if(inl < bl
never executed: 1;return 1; never executed: inl -= bl; for(i=0; i <= inlreturn 1;
| 0-896 | ||||||||||||
31 | DES_ecb3_encrypt((const_DES_cblock *)(in + i), (DES_cblock *)(out + i), executed 896 times by 1 test: DES_ecb3_encrypt((const_DES_cblock *)(in + i), (DES_cblock *)(out + i), &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, ctx->encrypt); Executed by:
| 896 | ||||||||||||
32 | &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, ctx->encrypt); executed 896 times by 1 test: DES_ecb3_encrypt((const_DES_cblock *)(in + i), (DES_cblock *)(out + i), &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, ctx->encrypt); Executed by:
| 896 | ||||||||||||
33 | return executed 12 times by 1 test: 1;return 1; Executed by:
executed 12 times by 1 test: return 1; Executed by:
| 12 | ||||||||||||
34 | } | - | ||||||||||||
35 | - | |||||||||||||
36 | static int | - | ||||||||||||
37 | des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||
38 | const unsigned char *in, size_t inl) | - | ||||||||||||
39 | { | - | ||||||||||||
40 | while (inl >= ((size_t)1<<(sizeof(long)*8-2))
| 0-8 | ||||||||||||
41 | DES_ede3_ofb64_encrypt(in, out, (long)((size_t)1<<(sizeof(long)*8-2)), | - | ||||||||||||
42 | &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, | - | ||||||||||||
43 | (DES_cblock *)ctx->iv, &ctx->num); | - | ||||||||||||
44 | inl -= ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
45 | in += ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
46 | out += ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
47 | } never executed: end of block | 0 | ||||||||||||
48 | if (inl
| 0-8 | ||||||||||||
49 | DES_ede3_ofb64_encrypt(in, out, (long)inl, executed 8 times by 1 test: DES_ede3_ofb64_encrypt(in, out, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, &ctx->num); Executed by:
| 8 | ||||||||||||
50 | &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, executed 8 times by 1 test: DES_ede3_ofb64_encrypt(in, out, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, &ctx->num); Executed by:
| 8 | ||||||||||||
51 | (DES_cblock *)ctx->iv, &ctx->num); executed 8 times by 1 test: DES_ede3_ofb64_encrypt(in, out, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, &ctx->num); Executed by:
| 8 | ||||||||||||
52 | - | |||||||||||||
53 | return executed 8 times by 1 test: 1;return 1; Executed by:
executed 8 times by 1 test: return 1; Executed by:
| 8 | ||||||||||||
54 | } | - | ||||||||||||
55 | - | |||||||||||||
56 | static int | - | ||||||||||||
57 | des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||
58 | const unsigned char *in, size_t inl) | - | ||||||||||||
59 | { | - | ||||||||||||
60 | while (inl >= ((size_t)1<<(sizeof(long)*8-2))
| 0-24 | ||||||||||||
61 | DES_ede3_cbc_encrypt(in, out, (long)((size_t)1<<(sizeof(long)*8-2)), | - | ||||||||||||
62 | &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, | - | ||||||||||||
63 | (DES_cblock *)ctx->iv, ctx->encrypt); | - | ||||||||||||
64 | inl -= ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
65 | in += ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
66 | out += ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
67 | } never executed: end of block | 0 | ||||||||||||
68 | if (inl
| 0-24 | ||||||||||||
69 | DES_ede3_cbc_encrypt(in, out, (long)inl, executed 24 times by 3 tests: DES_ede3_cbc_encrypt(in, out, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, ctx->encrypt); Executed by:
| 24 | ||||||||||||
70 | &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, executed 24 times by 3 tests: DES_ede3_cbc_encrypt(in, out, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, ctx->encrypt); Executed by:
| 24 | ||||||||||||
71 | (DES_cblock *)ctx->iv, ctx->encrypt); executed 24 times by 3 tests: DES_ede3_cbc_encrypt(in, out, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, ctx->encrypt); Executed by:
| 24 | ||||||||||||
72 | return executed 24 times by 3 tests: 1;return 1; Executed by:
executed 24 times by 3 tests: return 1; Executed by:
| 24 | ||||||||||||
73 | } | - | ||||||||||||
74 | - | |||||||||||||
75 | static int | - | ||||||||||||
76 | des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||
77 | const unsigned char *in, size_t inl) | - | ||||||||||||
78 | { | - | ||||||||||||
79 | while (inl >= ((size_t)1<<(sizeof(long)*8-2))
| 0-8 | ||||||||||||
80 | DES_ede3_cfb64_encrypt(in, out, (long)((size_t)1<<(sizeof(long)*8-2)), | - | ||||||||||||
81 | &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, | - | ||||||||||||
82 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); | - | ||||||||||||
83 | inl -= ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
84 | in += ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
85 | out += ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
86 | } never executed: end of block | 0 | ||||||||||||
87 | if (inl
| 0-8 | ||||||||||||
88 | DES_ede3_cfb64_encrypt(in, out, (long)inl, executed 8 times by 1 test: DES_ede3_cfb64_encrypt(in, out, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); Executed by:
| 8 | ||||||||||||
89 | &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, executed 8 times by 1 test: DES_ede3_cfb64_encrypt(in, out, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); Executed by:
| 8 | ||||||||||||
90 | (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); executed 8 times by 1 test: DES_ede3_cfb64_encrypt(in, out, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, &ctx->num, ctx->encrypt); Executed by:
| 8 | ||||||||||||
91 | return executed 8 times by 1 test: 1;return 1; Executed by:
executed 8 times by 1 test: return 1; Executed by:
| 8 | ||||||||||||
92 | } | - | ||||||||||||
93 | - | |||||||||||||
94 | - | |||||||||||||
95 | - | |||||||||||||
96 | static int | - | ||||||||||||
97 | des_ede3_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||
98 | const unsigned char *in, size_t inl) | - | ||||||||||||
99 | { | - | ||||||||||||
100 | size_t n; | - | ||||||||||||
101 | unsigned char c[1], d[1]; | - | ||||||||||||
102 | - | |||||||||||||
103 | for (n = 0; n < inl
| 0 | ||||||||||||
104 | c[0] = (
| 0 | ||||||||||||
105 | DES_ede3_cfb_encrypt(c, d, 1, 1, | - | ||||||||||||
106 | &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, | - | ||||||||||||
107 | (DES_cblock *)ctx->iv, ctx->encrypt); | - | ||||||||||||
108 | out[n / 8] = (out[n / 8] & ~(0x80 >> (unsigned int)(n % 8))) | | - | ||||||||||||
109 | ((d[0] & 0x80) >> (unsigned int)(n % 8)); | - | ||||||||||||
110 | } never executed: end of block | 0 | ||||||||||||
111 | - | |||||||||||||
112 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||
113 | } | - | ||||||||||||
114 | - | |||||||||||||
115 | static int | - | ||||||||||||
116 | des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||
117 | const unsigned char *in, size_t inl) | - | ||||||||||||
118 | { | - | ||||||||||||
119 | while (inl >= ((size_t)1<<(sizeof(long)*8-2))
| 0 | ||||||||||||
120 | DES_ede3_cfb_encrypt(in, out, 8, (long)((size_t)1<<(sizeof(long)*8-2)), | - | ||||||||||||
121 | &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, | - | ||||||||||||
122 | (DES_cblock *)ctx->iv, ctx->encrypt); | - | ||||||||||||
123 | inl -= ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
124 | in += ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
125 | out += ((size_t)1<<(sizeof(long)*8-2)); | - | ||||||||||||
126 | } never executed: end of block | 0 | ||||||||||||
127 | if (inl
| 0 | ||||||||||||
128 | DES_ede3_cfb_encrypt(in, out, 8, (long)inl, never executed: DES_ede3_cfb_encrypt(in, out, 8, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, ctx->encrypt); | 0 | ||||||||||||
129 | &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, never executed: DES_ede3_cfb_encrypt(in, out, 8, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, ctx->encrypt); | 0 | ||||||||||||
130 | (DES_cblock *)ctx->iv, ctx->encrypt); never executed: DES_ede3_cfb_encrypt(in, out, 8, (long)inl, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, (DES_cblock *)ctx->iv, ctx->encrypt); | 0 | ||||||||||||
131 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||
132 | } | - | ||||||||||||
133 | - | |||||||||||||
134 | static const EVP_CIPHER des_ede_cbc = { 43, 8, 16, 8, 0x200 | 0x2, des_ede_init_key, des_ede_cbc_cipher, | - | ||||||||||||
135 | ((void *)0) | - | ||||||||||||
136 | , sizeof(DES_EDE_KEY), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, des3_ctrl, | - | ||||||||||||
137 | ((void *)0) | - | ||||||||||||
138 | }; const EVP_CIPHER *EVP_des_ede_cbc(void) { return executed 292 times by 33 tests: &des_ede_cbc;return &des_ede_cbc; Executed by:
executed 292 times by 33 tests: } static const EVP_CIPHER des_ede_cfb64 = { 60, 1, 16, 8, 0x200 | 0x3, des_ede_init_key, des_ede_cfb64_cipher, return &des_ede_cbc; Executed by:
| 292 | ||||||||||||
139 | ((void *)0) | - | ||||||||||||
140 | , sizeof(DES_EDE_KEY), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, des3_ctrl, | - | ||||||||||||
141 | ((void *)0) | - | ||||||||||||
142 | }; const EVP_CIPHER *EVP_des_ede_cfb64(void) { return executed 292 times by 33 tests: &des_ede_cfb64;return &des_ede_cfb64; Executed by:
executed 292 times by 33 tests: } static const EVP_CIPHER des_ede_ofb = { 62, 1, 16, 8, 0x200 | 0x4, des_ede_init_key, des_ede_ofb_cipher, return &des_ede_cfb64; Executed by:
| 292 | ||||||||||||
143 | ((void *)0) | - | ||||||||||||
144 | , sizeof(DES_EDE_KEY), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, des3_ctrl, | - | ||||||||||||
145 | ((void *)0) | - | ||||||||||||
146 | }; const EVP_CIPHER *EVP_des_ede_ofb(void) { return executed 292 times by 33 tests: &des_ede_ofb;return &des_ede_ofb; Executed by:
executed 292 times by 33 tests: } static const EVP_CIPHER des_ede_ecb = { 32, 8, 16, 0, 0x200 | 0x1, des_ede_init_key, des_ede_ecb_cipher, return &des_ede_ofb; Executed by:
| 292 | ||||||||||||
147 | ((void *)0) | - | ||||||||||||
148 | , sizeof(DES_EDE_KEY), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, des3_ctrl, | - | ||||||||||||
149 | ((void *)0) | - | ||||||||||||
150 | }; const EVP_CIPHER *EVP_des_ede_ecb(void) { return never executed: &des_ede_ecb;return &des_ede_ecb; never executed: }return &des_ede_ecb; | 0 | ||||||||||||
151 | static const EVP_CIPHER des_ede3_cbc = { 44, 8, 24, 8, 0x200 | 0x2, des_ede3_init_key, des_ede_cbc_cipher, | - | ||||||||||||
152 | ((void *)0) | - | ||||||||||||
153 | , sizeof(DES_EDE_KEY), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, des3_ctrl, | - | ||||||||||||
154 | ((void *)0) | - | ||||||||||||
155 | }; const EVP_CIPHER *EVP_des_ede3_cbc(void) { return executed 625 times by 33 tests: &des_ede3_cbc;return &des_ede3_cbc; Executed by:
executed 625 times by 33 tests: } static const EVP_CIPHER des_ede3_cfb64 = { 61, 1, 24, 8, 0x200 | 0x3, des_ede3_init_key, des_ede_cfb64_cipher, return &des_ede3_cbc; Executed by:
| 625 | ||||||||||||
156 | ((void *)0) | - | ||||||||||||
157 | , sizeof(DES_EDE_KEY), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, des3_ctrl, | - | ||||||||||||
158 | ((void *)0) | - | ||||||||||||
159 | }; const EVP_CIPHER *EVP_des_ede3_cfb64(void) { return executed 292 times by 33 tests: &des_ede3_cfb64;return &des_ede3_cfb64; Executed by:
executed 292 times by 33 tests: } static const EVP_CIPHER des_ede3_ofb = { 63, 1, 24, 8, 0x200 | 0x4, des_ede3_init_key, des_ede_ofb_cipher, return &des_ede3_cfb64; Executed by:
| 292 | ||||||||||||
160 | ((void *)0) | - | ||||||||||||
161 | , sizeof(DES_EDE_KEY), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, des3_ctrl, | - | ||||||||||||
162 | ((void *)0) | - | ||||||||||||
163 | }; const EVP_CIPHER *EVP_des_ede3_ofb(void) { return executed 292 times by 33 tests: &des_ede3_ofb;return &des_ede3_ofb; Executed by:
executed 292 times by 33 tests: } static const EVP_CIPHER des_ede3_ecb = { 33, 8, 24, 0, 0x200 | 0x1, des_ede3_init_key, des_ede_ecb_cipher, return &des_ede3_ofb; Executed by:
| 292 | ||||||||||||
164 | ((void *)0) | - | ||||||||||||
165 | , sizeof(DES_EDE_KEY), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, des3_ctrl, | - | ||||||||||||
166 | ((void *)0) | - | ||||||||||||
167 | }; const EVP_CIPHER *EVP_des_ede3_ecb(void) { return never executed: &des_ede3_ecb;return &des_ede3_ecb; never executed: }return &des_ede3_ecb; | 0 | ||||||||||||
168 | - | |||||||||||||
169 | - | |||||||||||||
170 | - | |||||||||||||
171 | - | |||||||||||||
172 | - | |||||||||||||
173 | static const EVP_CIPHER des_ede3_cfb1 = { 658, 1, 24, 8, 0x200 | 0x3, des_ede3_init_key, des_ede3_cfb1_cipher, | - | ||||||||||||
174 | ((void *)0) | - | ||||||||||||
175 | , sizeof(DES_EDE_KEY), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, des3_ctrl, | - | ||||||||||||
176 | ((void *)0) | - | ||||||||||||
177 | }; const EVP_CIPHER *EVP_des_ede3_cfb1(void) { return executed 292 times by 33 tests: &des_ede3_cfb1;return &des_ede3_cfb1; Executed by:
executed 292 times by 33 tests: }return &des_ede3_cfb1; Executed by:
| 292 | ||||||||||||
178 | - | |||||||||||||
179 | - | |||||||||||||
180 | - | |||||||||||||
181 | - | |||||||||||||
182 | - | |||||||||||||
183 | static const EVP_CIPHER des_ede3_cfb8 = { 659, 1, 24, 8, 0x200 | 0x3, des_ede3_init_key, des_ede3_cfb8_cipher, | - | ||||||||||||
184 | ((void *)0) | - | ||||||||||||
185 | , sizeof(DES_EDE_KEY), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, des3_ctrl, | - | ||||||||||||
186 | ((void *)0) | - | ||||||||||||
187 | }; const EVP_CIPHER *EVP_des_ede3_cfb8(void) { return executed 292 times by 33 tests: &des_ede3_cfb8;return &des_ede3_cfb8; Executed by:
executed 292 times by 33 tests: }return &des_ede3_cfb8; Executed by:
| 292 | ||||||||||||
188 | - | |||||||||||||
189 | - | |||||||||||||
190 | - | |||||||||||||
191 | - | |||||||||||||
192 | - | |||||||||||||
193 | static int | - | ||||||||||||
194 | des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||
195 | const unsigned char *iv, int enc) | - | ||||||||||||
196 | { | - | ||||||||||||
197 | DES_cblock *deskey = (DES_cblock *)key; | - | ||||||||||||
198 | - | |||||||||||||
199 | DES_set_key_unchecked(&deskey[0], &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1); | - | ||||||||||||
200 | DES_set_key_unchecked(&deskey[1], &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2); | - | ||||||||||||
201 | memcpy(&((DES_EDE_KEY *)(ctx)->cipher_data)->ks3, &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1, | - | ||||||||||||
202 | sizeof(((DES_EDE_KEY *)(ctx)->cipher_data)->ks1)); | - | ||||||||||||
203 | return executed 16 times by 1 test: 1;return 1; Executed by:
executed 16 times by 1 test: return 1; Executed by:
| 16 | ||||||||||||
204 | } | - | ||||||||||||
205 | - | |||||||||||||
206 | static int | - | ||||||||||||
207 | des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||
208 | const unsigned char *iv, int enc) | - | ||||||||||||
209 | { | - | ||||||||||||
210 | DES_cblock *deskey = (DES_cblock *)key; | - | ||||||||||||
211 | - | |||||||||||||
212 | - | |||||||||||||
213 | DES_set_key_unchecked(&deskey[0], &((DES_EDE_KEY *)(ctx)->cipher_data)->ks1); | - | ||||||||||||
214 | DES_set_key_unchecked(&deskey[1], &((DES_EDE_KEY *)(ctx)->cipher_data)->ks2); | - | ||||||||||||
215 | DES_set_key_unchecked(&deskey[2], &((DES_EDE_KEY *)(ctx)->cipher_data)->ks3); | - | ||||||||||||
216 | return executed 22 times by 3 tests: 1;return 1; Executed by:
executed 22 times by 3 tests: return 1; Executed by:
| 22 | ||||||||||||
217 | } | - | ||||||||||||
218 | - | |||||||||||||
219 | static int | - | ||||||||||||
220 | des3_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | - | ||||||||||||
221 | { | - | ||||||||||||
222 | DES_cblock *deskey = ptr; | - | ||||||||||||
223 | - | |||||||||||||
224 | switch (type) { | - | ||||||||||||
225 | case never executed: 0x6:case 0x6: never executed: case 0x6: | 0 | ||||||||||||
226 | if (DES_random_key(deskey) == 0
| 0 | ||||||||||||
227 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
228 | if (c->key_len >= 16
| 0 | ||||||||||||
229 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
230 | if (c->key_len >= 24
| 0 | ||||||||||||
231 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
232 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||
233 | - | |||||||||||||
234 | default never executed: :default: never executed: default: | 0 | ||||||||||||
235 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
236 | } | - | ||||||||||||
237 | } | - | ||||||||||||
238 | - | |||||||||||||
239 | const EVP_CIPHER * | - | ||||||||||||
240 | EVP_des_ede(void) | - | ||||||||||||
241 | { | - | ||||||||||||
242 | return executed 292 times by 33 tests: &des_ede_ecb;return &des_ede_ecb; Executed by:
executed 292 times by 33 tests: return &des_ede_ecb; Executed by:
| 292 | ||||||||||||
243 | } | - | ||||||||||||
244 | - | |||||||||||||
245 | const EVP_CIPHER * | - | ||||||||||||
246 | EVP_des_ede3(void) | - | ||||||||||||
247 | { | - | ||||||||||||
248 | return executed 292 times by 33 tests: &des_ede3_ecb;return &des_ede3_ecb; Executed by:
executed 292 times by 33 tests: return &des_ede3_ecb; Executed by:
| 292 | ||||||||||||
249 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |