Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/e_idea.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||||||||
7 | typedef struct { | - | ||||||||||||||||||||||||||||||
8 | IDEA_KEY_SCHEDULE ks; | - | ||||||||||||||||||||||||||||||
9 | } EVP_IDEA_KEY; | - | ||||||||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||||||||
11 | static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||||||||
12 | const unsigned char *iv, int enc); | - | ||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||||||||
19 | static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||||||||
20 | const unsigned char *in, size_t inl) | - | ||||||||||||||||||||||||||||||
21 | { | - | ||||||||||||||||||||||||||||||
22 | size_t i, bl; bl = EVP_CIPHER_CTX_cipher(ctx)->block_size; if (inl < bl
never executed: 1;return 1; never executed: inl -= bl; for (i=0; i <= inlreturn 1;
| 0-1572 | ||||||||||||||||||||||||||||||
23 | IDEA_ecb_encrypt(in + i, out + i, &((EVP_IDEA_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks); executed 1572 times by 1 test: IDEA_ecb_encrypt(in + i, out + i, &((EVP_IDEA_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks); Executed by:
| 1572 | ||||||||||||||||||||||||||||||
24 | return executed 129 times by 1 test: 1;return 1; Executed by:
executed 129 times by 1 test: return 1; Executed by:
| 129 | ||||||||||||||||||||||||||||||
25 | } | - | ||||||||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||||||||
27 | static int idea_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { while(inl>=((size_t)1<<(sizeof(long)*8-2))
never executed: if (inlend of block
executed 519 times by 1 test: returnIDEA_cbc_encrypt(in, out, (long)inl, &((EVP_IDEA_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx)); Executed by:
executed 519 times by 1 test: 1;return 1; Executed by:
executed 519 times by 1 test: }return 1; Executed by:
| 0-519 | ||||||||||||||||||||||||||||||
28 | static int idea_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { while(inl>=((size_t)1<<(sizeof(long)*8-2))
never executed: if (inlend of block
executed 70 times by 1 test: returnend of block Executed by:
executed 70 times by 1 test: 1;return 1; Executed by:
executed 70 times by 1 test: }return 1; Executed by:
| 0-70 | ||||||||||||||||||||||||||||||
29 | static int idea_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { size_t chunk = ((size_t)1<<(sizeof(long)*8-2)); if (64 == 1
never executed: if (inl < chunkchunk >>= 3;
executed 70 times by 1 test: while (inlchunk = inl; Executed by:
executed 70 times by 1 test: }chunk = inl; Executed by:
executed 70 times by 1 test: returnend of block Executed by:
executed 70 times by 1 test: 1;return 1; Executed by:
executed 70 times by 1 test: }return 1; Executed by:
| 0-70 | ||||||||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||||||||
31 | static const EVP_CIPHER idea_cbc = { 34, 8, 16, 8, 0 | 0x2, idea_init_key, idea_cbc_cipher, | - | ||||||||||||||||||||||||||||||
32 | ((void *)0) | - | ||||||||||||||||||||||||||||||
33 | , sizeof(IDEA_KEY_SCHEDULE), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, | - | ||||||||||||||||||||||||||||||
34 | ((void *)0) | - | ||||||||||||||||||||||||||||||
35 | , | - | ||||||||||||||||||||||||||||||
36 | ((void *)0) | - | ||||||||||||||||||||||||||||||
37 | }; const EVP_CIPHER *EVP_idea_cbc(void) { return executed 3920 times by 1 test: &idea_cbc;return &idea_cbc; Executed by:
executed 3920 times by 1 test: } static const EVP_CIPHER idea_cfb64 = { 35, 1, 16, 8, 0 | 0x3, idea_init_key, idea_cfb64_cipher, return &idea_cbc; Executed by:
| 3920 | ||||||||||||||||||||||||||||||
38 | ((void *)0) | - | ||||||||||||||||||||||||||||||
39 | , sizeof(IDEA_KEY_SCHEDULE), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, | - | ||||||||||||||||||||||||||||||
40 | ((void *)0) | - | ||||||||||||||||||||||||||||||
41 | , | - | ||||||||||||||||||||||||||||||
42 | ((void *)0) | - | ||||||||||||||||||||||||||||||
43 | }; const EVP_CIPHER *EVP_idea_cfb64(void) { return executed 1962 times by 1 test: &idea_cfb64;return &idea_cfb64; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER idea_ofb = { 46, 1, 16, 8, 0 | 0x4, idea_init_key, idea_ofb_cipher, return &idea_cfb64; Executed by:
| 1962 | ||||||||||||||||||||||||||||||
44 | ((void *)0) | - | ||||||||||||||||||||||||||||||
45 | , sizeof(IDEA_KEY_SCHEDULE), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, | - | ||||||||||||||||||||||||||||||
46 | ((void *)0) | - | ||||||||||||||||||||||||||||||
47 | , | - | ||||||||||||||||||||||||||||||
48 | ((void *)0) | - | ||||||||||||||||||||||||||||||
49 | }; const EVP_CIPHER *EVP_idea_ofb(void) { return executed 1962 times by 1 test: &idea_ofb;return &idea_ofb; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER idea_ecb = { 36, 8, 16, 0, 0 | 0x1, idea_init_key, idea_ecb_cipher, return &idea_ofb; Executed by:
| 1962 | ||||||||||||||||||||||||||||||
50 | ((void *)0) | - | ||||||||||||||||||||||||||||||
51 | , sizeof(IDEA_KEY_SCHEDULE), EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, | - | ||||||||||||||||||||||||||||||
52 | ((void *)0) | - | ||||||||||||||||||||||||||||||
53 | , | - | ||||||||||||||||||||||||||||||
54 | ((void *)0) | - | ||||||||||||||||||||||||||||||
55 | }; const EVP_CIPHER *EVP_idea_ecb(void) { return executed 1962 times by 1 test: &idea_ecb;return &idea_ecb; Executed by:
executed 1962 times by 1 test: }return &idea_ecb; Executed by:
| 1962 | ||||||||||||||||||||||||||||||
56 | - | |||||||||||||||||||||||||||||||
57 | - | |||||||||||||||||||||||||||||||
58 | - | |||||||||||||||||||||||||||||||
59 | static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||||||||
60 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||||||||
61 | { | - | ||||||||||||||||||||||||||||||
62 | if (!enc
| 83-141 | ||||||||||||||||||||||||||||||
63 | if ((
| 3-80 | ||||||||||||||||||||||||||||||
64 | enc = 1; executed 3 times by 1 test: enc = 1; Executed by:
| 3 | ||||||||||||||||||||||||||||||
65 | else if ((
| 3-77 | ||||||||||||||||||||||||||||||
66 | enc = 1; executed 3 times by 1 test: enc = 1; Executed by:
| 3 | ||||||||||||||||||||||||||||||
67 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||||||||||||||
68 | if (enc
| 77-147 | ||||||||||||||||||||||||||||||
69 | IDEA_set_encrypt_key(key, &((EVP_IDEA_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks); executed 147 times by 1 test: IDEA_set_encrypt_key(key, &((EVP_IDEA_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks); Executed by:
| 147 | ||||||||||||||||||||||||||||||
70 | else { | - | ||||||||||||||||||||||||||||||
71 | IDEA_KEY_SCHEDULE tmp; | - | ||||||||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||||||||
73 | IDEA_set_encrypt_key(key, &tmp); | - | ||||||||||||||||||||||||||||||
74 | IDEA_set_decrypt_key(&tmp, &((EVP_IDEA_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks); | - | ||||||||||||||||||||||||||||||
75 | OPENSSL_cleanse((unsigned char *)&tmp, sizeof(IDEA_KEY_SCHEDULE)); | - | ||||||||||||||||||||||||||||||
76 | } executed 77 times by 1 test: end of block Executed by:
| 77 | ||||||||||||||||||||||||||||||
77 | return executed 224 times by 1 test: 1;return 1; Executed by:
executed 224 times by 1 test: return 1; Executed by:
| 224 | ||||||||||||||||||||||||||||||
78 | } | - | ||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |