Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/encode.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
2 | static unsigned char conv_ascii2bin(unsigned char a, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
3 | const unsigned char *table); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
4 | static int evp_encodeblock_int(EVP_ENCODE_CTX *ctx, unsigned char *t, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
5 | const unsigned char *f, int dlen); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
6 | static int evp_decodeblock_int(EVP_ENCODE_CTX *ctx, unsigned char *t, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
7 | const unsigned char *f, int n); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
8 | static const unsigned char data_bin2ascii[65] = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
9 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
12 | static const unsigned char srpdata_bin2ascii[65] = | - | ||||||||||||||||||||||||||||||||||||||||||||||||
13 | "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./"; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
14 | static const unsigned char data_ascii2bin[128] = { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
15 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
16 | 0xFF, 0xE0, 0xF0, 0xFF, 0xFF, 0xF1, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
17 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
18 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
19 | 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
20 | 0xFF, 0xFF, 0xFF, 0x3E, 0xFF, 0xF2, 0xFF, 0x3F, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
21 | 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
22 | 0x3C, 0x3D, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
23 | 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
24 | 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
25 | 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
26 | 0x17, 0x18, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
27 | 0xFF, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
28 | 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
29 | 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
30 | 0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
31 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
32 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
33 | static const unsigned char srpdata_ascii2bin[128] = { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
34 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
35 | 0xFF, 0xE0, 0xF0, 0xFF, 0xFF, 0xF1, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
36 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
37 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
38 | 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
39 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF2, 0x3E, 0x3F, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
40 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
41 | 0x08, 0x09, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
42 | 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
43 | 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
44 | 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
45 | 0x21, 0x22, 0x23, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
46 | 0xFF, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
47 | 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
48 | 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
49 | 0x3B, 0x3C, 0x3D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
50 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
52 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
53 | static unsigned char conv_ascii2bin(unsigned char a, const unsigned char *table) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
54 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
55 | if (a & 0x80
| 2-35049650 | ||||||||||||||||||||||||||||||||||||||||||||||||
56 | return executed 2 times by 1 test: 0xFF;return 0xFF; Executed by:
executed 2 times by 1 test: return 0xFF; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
57 | return executed 35049650 times by 1 test: table[a];return table[a]; Executed by:
executed 35049650 times by 1 test: return table[a]; Executed by:
| 35049650 | ||||||||||||||||||||||||||||||||||||||||||||||||
58 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
59 | EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
60 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
61 | return executed 22934 times by 1 test: CRYPTO_zalloc(sizeof(EVP_ENCODE_CTX), __FILE__, 129);return CRYPTO_zalloc(sizeof(EVP_ENCODE_CTX), __FILE__, 129); Executed by:
executed 22934 times by 1 test: return CRYPTO_zalloc(sizeof(EVP_ENCODE_CTX), __FILE__, 129); Executed by:
| 22934 | ||||||||||||||||||||||||||||||||||||||||||||||||
62 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
64 | void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
65 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
66 | CRYPTO_free(ctx, __FILE__, 134); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
67 | } executed 22934 times by 1 test: end of block Executed by:
| 22934 | ||||||||||||||||||||||||||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
69 | int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
70 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
71 | memcpy(dctx, sctx, sizeof(EVP_ENCODE_CTX)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
73 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
74 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
75 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
76 | int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
77 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
78 | return executed 352 times by 1 test: ctx->num;return ctx->num; Executed by:
executed 352 times by 1 test: return ctx->num; Executed by:
| 352 | ||||||||||||||||||||||||||||||||||||||||||||||||
79 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
81 | void evp_encode_ctx_set_flags(EVP_ENCODE_CTX *ctx, unsigned int flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
82 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
83 | ctx->flags = flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
84 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
86 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
87 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
88 | ctx->length = 48; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
89 | ctx->num = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
90 | ctx->line_num = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
91 | ctx->flags = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
92 | } executed 402 times by 1 test: end of block Executed by:
| 402 | ||||||||||||||||||||||||||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
94 | int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
95 | const unsigned char *in, int inl) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
96 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
97 | int i, j; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
98 | size_t total = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
100 | *outl = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
101 | if (inl <= 0
| 1-2425 | ||||||||||||||||||||||||||||||||||||||||||||||||
102 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
103 | (void)((ctx->length <= (int)sizeof(ctx->enc_data)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->length <= (int)sizeof(ctx->enc_data)", __FILE__, 171), 1)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
104 | if (ctx->length - ctx->num > inl
| 386-2039 | ||||||||||||||||||||||||||||||||||||||||||||||||
105 | memcpy(&(ctx->enc_data[ctx->num]), in, inl); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
106 | ctx->num += inl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
107 | return executed 386 times by 1 test: 1;return 1; Executed by:
executed 386 times by 1 test: return 1; Executed by:
| 386 | ||||||||||||||||||||||||||||||||||||||||||||||||
108 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
109 | if (ctx->num != 0
| 557-1482 | ||||||||||||||||||||||||||||||||||||||||||||||||
110 | i = ctx->length - ctx->num; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
111 | memcpy(&(ctx->enc_data[ctx->num]), in, i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
112 | in += i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
113 | inl -= i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
114 | j = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->length); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
115 | ctx->num = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
116 | out += j; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
117 | total = j; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
118 | if ((
| 2-1480 | ||||||||||||||||||||||||||||||||||||||||||||||||
119 | *(out++) = '\n'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
120 | total++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
121 | } executed 1480 times by 1 test: end of block Executed by:
| 1480 | ||||||||||||||||||||||||||||||||||||||||||||||||
122 | *out = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
123 | } executed 1482 times by 1 test: end of block Executed by:
| 1482 | ||||||||||||||||||||||||||||||||||||||||||||||||
124 | while (inl >= ctx->length
| 0-8968 | ||||||||||||||||||||||||||||||||||||||||||||||||
125 | j = evp_encodeblock_int(ctx, out, in, ctx->length); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
126 | in += ctx->length; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
127 | inl -= ctx->length; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
128 | out += j; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
129 | total += j; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
130 | if ((
| 40-8928 | ||||||||||||||||||||||||||||||||||||||||||||||||
131 | *(out++) = '\n'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
132 | total++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
133 | } executed 8928 times by 1 test: end of block Executed by:
| 8928 | ||||||||||||||||||||||||||||||||||||||||||||||||
134 | *out = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
135 | } executed 8968 times by 1 test: end of block Executed by:
| 8968 | ||||||||||||||||||||||||||||||||||||||||||||||||
136 | if (total > 0x7fffffff
| 0-2039 | ||||||||||||||||||||||||||||||||||||||||||||||||
137 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
138 | *outl = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
139 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
140 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
141 | if (inl != 0
| 317-1722 | ||||||||||||||||||||||||||||||||||||||||||||||||
142 | memcpy(&(ctx->enc_data[0]), in, inl); executed 1722 times by 1 test: memcpy(&(ctx->enc_data[0]), in, inl); Executed by:
| 1722 | ||||||||||||||||||||||||||||||||||||||||||||||||
143 | ctx->num = inl; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
144 | *outl = total; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
146 | return executed 2039 times by 1 test: 1;return 1; Executed by:
executed 2039 times by 1 test: return 1; Executed by:
| 2039 | ||||||||||||||||||||||||||||||||||||||||||||||||
147 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
148 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
149 | void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
150 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
151 | unsigned int ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
152 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
153 | if (ctx->num != 0
| 5-395 | ||||||||||||||||||||||||||||||||||||||||||||||||
154 | ret = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->num); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
155 | if ((
| 4-391 | ||||||||||||||||||||||||||||||||||||||||||||||||
156 | out[ret++] = '\n'; executed 391 times by 1 test: out[ret++] = '\n'; Executed by:
| 391 | ||||||||||||||||||||||||||||||||||||||||||||||||
157 | out[ret] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
158 | ctx->num = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
159 | } executed 395 times by 1 test: end of block Executed by:
| 395 | ||||||||||||||||||||||||||||||||||||||||||||||||
160 | *outl = ret; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
161 | } executed 400 times by 1 test: end of block Executed by:
| 400 | ||||||||||||||||||||||||||||||||||||||||||||||||
162 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
163 | static int evp_encodeblock_int(EVP_ENCODE_CTX *ctx, unsigned char *t, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
164 | const unsigned char *f, int dlen) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
165 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
166 | int i, ret = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
167 | unsigned long l; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
168 | const unsigned char *table; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
169 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
170 | if (ctx !=
| 0-10845 | ||||||||||||||||||||||||||||||||||||||||||||||||
171 | ((void *)0)
| 0-10845 | ||||||||||||||||||||||||||||||||||||||||||||||||
172 | && (
| 46-10799 | ||||||||||||||||||||||||||||||||||||||||||||||||
173 | table = srpdata_bin2ascii; executed 46 times by 1 test: table = srpdata_bin2ascii; Executed by:
| 46 | ||||||||||||||||||||||||||||||||||||||||||||||||
174 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
175 | table = data_bin2ascii; executed 10799 times by 1 test: table = data_bin2ascii; Executed by:
| 10799 | ||||||||||||||||||||||||||||||||||||||||||||||||
176 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
177 | for (i = dlen; i > 0
| 10845-171032 | ||||||||||||||||||||||||||||||||||||||||||||||||
178 | if (i >= 3
| 291-170741 | ||||||||||||||||||||||||||||||||||||||||||||||||
179 | l = (((unsigned long)f[0]) << 16L) | | - | ||||||||||||||||||||||||||||||||||||||||||||||||
180 | (((unsigned long)f[1]) << 8L) | f[2]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
181 | *(t++) = ((table)[(l >> 18L)&0x3f]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
182 | *(t++) = ((table)[(l >> 12L)&0x3f]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
183 | *(t++) = ((table)[(l >> 6L)&0x3f]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
184 | *(t++) = ((table)[(l)&0x3f]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
185 | } executed 170741 times by 1 test: else {end of block Executed by:
| 170741 | ||||||||||||||||||||||||||||||||||||||||||||||||
186 | l = ((unsigned long)f[0]) << 16L; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
187 | if (i == 2
| 43-248 | ||||||||||||||||||||||||||||||||||||||||||||||||
188 | l |= ((unsigned long)f[1] << 8L); executed 43 times by 1 test: l |= ((unsigned long)f[1] << 8L); Executed by:
| 43 | ||||||||||||||||||||||||||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
190 | *(t++) = ((table)[(l >> 18L)&0x3f]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
191 | *(t++) = ((table)[(l >> 12L)&0x3f]); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
192 | *(t++) = (
| 43-248 | ||||||||||||||||||||||||||||||||||||||||||||||||
193 | *(t++) = '='; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
194 | } executed 291 times by 1 test: end of block Executed by:
| 291 | ||||||||||||||||||||||||||||||||||||||||||||||||
195 | ret += 4; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
196 | f += 3; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
197 | } executed 171032 times by 1 test: end of block Executed by:
| 171032 | ||||||||||||||||||||||||||||||||||||||||||||||||
198 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
199 | *t = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
200 | return executed 10845 times by 1 test: ret;return ret; Executed by:
executed 10845 times by 1 test: return ret; Executed by:
| 10845 | ||||||||||||||||||||||||||||||||||||||||||||||||
201 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
203 | int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int dlen) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
204 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
205 | return never executed: evp_encodeblock_int(return evp_encodeblock_int( ((void *)0) , t, f, dlen); never executed: return evp_encodeblock_int( ((void *)0) , t, f, dlen); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
206 | ((void *)0) never executed: return evp_encodeblock_int( ((void *)0) , t, f, dlen); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
207 | , t, f, dlen); never executed: return evp_encodeblock_int( ((void *)0) , t, f, dlen); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
208 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
210 | void EVP_DecodeInit(EVP_ENCODE_CTX *ctx) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
211 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
213 | ctx->num = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
214 | ctx->length = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
215 | ctx->line_num = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
216 | ctx->flags = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
217 | } executed 18641 times by 1 test: end of block Executed by:
| 18641 | ||||||||||||||||||||||||||||||||||||||||||||||||
218 | int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
219 | const unsigned char *in, int inl) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
220 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
221 | int seof = 0, eof = 0, rv = -1, ret = 0, i, v, tmp, n, decoded_len; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
222 | unsigned char *d; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
223 | const unsigned char *table; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
224 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
225 | n = ctx->num; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
226 | d = ctx->enc_data; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
228 | if (n > 0
| 0-18656 | ||||||||||||||||||||||||||||||||||||||||||||||||
229 | eof++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
230 | if (n > 1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
231 | eof++; never executed: eof++; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
232 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
233 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
235 | if (inl == 0
| 2-18941 | ||||||||||||||||||||||||||||||||||||||||||||||||
236 | rv = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
237 | goto executed 2 times by 1 test: end;goto end; Executed by:
executed 2 times by 1 test: goto end; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
238 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
239 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
240 | if ((
| 16-18925 | ||||||||||||||||||||||||||||||||||||||||||||||||
241 | table = srpdata_ascii2bin; executed 16 times by 1 test: table = srpdata_ascii2bin; Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
242 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
243 | table = data_ascii2bin; executed 18925 times by 1 test: table = data_ascii2bin; Executed by:
| 18925 | ||||||||||||||||||||||||||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
245 | for (i = 0; i < inl
| 18917-16252417 | ||||||||||||||||||||||||||||||||||||||||||||||||
246 | tmp = *(in++); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
247 | v = conv_ascii2bin(tmp, table); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
248 | if (v == 0xFF
| 6-16252411 | ||||||||||||||||||||||||||||||||||||||||||||||||
249 | rv = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
250 | goto executed 6 times by 1 test: end;goto end; Executed by:
executed 6 times by 1 test: goto end; Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||
251 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
252 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
253 | if (tmp == '='
| 23615-16228796 | ||||||||||||||||||||||||||||||||||||||||||||||||
254 | eof++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
255 | } executed 23615 times by 1 test: else if (eof > 0end of block Executed by:
| 4-16215481 | ||||||||||||||||||||||||||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
257 | rv = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
258 | goto executed 4 times by 1 test: end;goto end; Executed by:
executed 4 times by 1 test: goto end; Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
259 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
261 | if (eof > 2
| 10-16252397 | ||||||||||||||||||||||||||||||||||||||||||||||||
262 | rv = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
263 | goto executed 10 times by 1 test: end;goto end; Executed by:
executed 10 times by 1 test: goto end; Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||
264 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
266 | if (v == 0xF2
| 4-16252393 | ||||||||||||||||||||||||||||||||||||||||||||||||
267 | seof = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
268 | goto executed 4 times by 1 test: tail;goto tail; Executed by:
executed 4 times by 1 test: goto tail; Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||
269 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
270 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
272 | if ((
| 260898-15991495 | ||||||||||||||||||||||||||||||||||||||||||||||||
273 | if (n >= 64
| 0-15991495 | ||||||||||||||||||||||||||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
277 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
279 | rv = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
280 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
281 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
282 | (void)((n < (int)sizeof(ctx->enc_data)) ? 0 : (OPENSSL_die("assertion failed: " "n < (int)sizeof(ctx->enc_data)", __FILE__, 367), 1)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
283 | d[n++] = tmp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
284 | } executed 15991495 times by 1 test: end of block Executed by:
| 15991495 | ||||||||||||||||||||||||||||||||||||||||||||||||
285 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
286 | if (n == 64
| 239986-16012407 | ||||||||||||||||||||||||||||||||||||||||||||||||
287 | decoded_len = evp_decodeblock_int(ctx, out, d, n); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
288 | n = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
289 | if (decoded_len < 0
| 0-239986 | ||||||||||||||||||||||||||||||||||||||||||||||||
290 | rv = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
291 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
292 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
293 | ret += decoded_len - eof; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
294 | out += decoded_len - eof; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
295 | } executed 239986 times by 1 test: end of block Executed by:
| 239986 | ||||||||||||||||||||||||||||||||||||||||||||||||
296 | } executed 16252393 times by 1 test: end of block Executed by:
| 16252393 | ||||||||||||||||||||||||||||||||||||||||||||||||
297 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
299 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
300 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
301 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
303 | tail: code before this statement executed 18917 times by 1 test: tail: Executed by:
| 18917 | ||||||||||||||||||||||||||||||||||||||||||||||||
304 | if (n > 0
| 419-18502 | ||||||||||||||||||||||||||||||||||||||||||||||||
305 | if ((
| 299-18203 | ||||||||||||||||||||||||||||||||||||||||||||||||
306 | decoded_len = evp_decodeblock_int(ctx, out, d, n); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
307 | n = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
308 | if (decoded_len < 0
| 0-18203 | ||||||||||||||||||||||||||||||||||||||||||||||||
309 | rv = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
310 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
311 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
312 | ret += (decoded_len - eof); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
313 | } executed 18203 times by 1 test: else if (seofend of block Executed by:
| 0-18203 | ||||||||||||||||||||||||||||||||||||||||||||||||
314 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
315 | rv = -1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
316 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
317 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
318 | } executed 18502 times by 1 test: end of block Executed by:
| 18502 | ||||||||||||||||||||||||||||||||||||||||||||||||
319 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
320 | rv = seof
| 4-18917 | ||||||||||||||||||||||||||||||||||||||||||||||||
321 | end: code before this statement executed 18921 times by 1 test: end: Executed by:
| 18921 | ||||||||||||||||||||||||||||||||||||||||||||||||
322 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
323 | *outl = ret; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
324 | ctx->num = n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
325 | return executed 18943 times by 1 test: rv;return rv; Executed by:
executed 18943 times by 1 test: return rv; Executed by:
| 18943 | ||||||||||||||||||||||||||||||||||||||||||||||||
326 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
327 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
328 | static int evp_decodeblock_int(EVP_ENCODE_CTX *ctx, unsigned char *t, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
329 | const unsigned char *f, int n) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
330 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
331 | int i, ret = 0, a, b, c, d; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
332 | unsigned long l; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
333 | const unsigned char *table; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
334 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
335 | if (ctx !=
| 14701-258201 | ||||||||||||||||||||||||||||||||||||||||||||||||
336 | ((void *)0)
| 14701-258201 | ||||||||||||||||||||||||||||||||||||||||||||||||
337 | && (
| 92-258109 | ||||||||||||||||||||||||||||||||||||||||||||||||
338 | table = srpdata_ascii2bin; executed 92 times by 1 test: table = srpdata_ascii2bin; Executed by:
| 92 | ||||||||||||||||||||||||||||||||||||||||||||||||
339 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
340 | table = data_ascii2bin; executed 272810 times by 1 test: table = data_ascii2bin; Executed by:
| 272810 | ||||||||||||||||||||||||||||||||||||||||||||||||
341 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
342 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
343 | while ((
| 0-272902 | ||||||||||||||||||||||||||||||||||||||||||||||||
344 | f++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
345 | n--; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
346 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
347 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
349 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
350 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
351 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
352 | while ((
| 0-272897 | ||||||||||||||||||||||||||||||||||||||||||||||||
353 | n--; never executed: n--; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
355 | if (n % 4 != 0
| 12-272890 | ||||||||||||||||||||||||||||||||||||||||||||||||
356 | return executed 12 times by 1 test: -1;return -1; Executed by:
executed 12 times by 1 test: return -1; Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
357 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
358 | for (i = 0; i < n
| 272889-4562859 | ||||||||||||||||||||||||||||||||||||||||||||||||
359 | a = conv_ascii2bin(*(f++), table); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
360 | b = conv_ascii2bin(*(f++), table); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
361 | c = conv_ascii2bin(*(f++), table); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
362 | d = conv_ascii2bin(*(f++), table); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
363 | if ((
| 0-4562858 | ||||||||||||||||||||||||||||||||||||||||||||||||
364 | return executed 1 time by 1 test: -1;return -1; Executed by:
executed 1 time by 1 test: return -1; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
365 | l = ((((unsigned long)a) << 18L) | | - | ||||||||||||||||||||||||||||||||||||||||||||||||
366 | (((unsigned long)b) << 12L) | | - | ||||||||||||||||||||||||||||||||||||||||||||||||
367 | (((unsigned long)c) << 6L) | (((unsigned long)d))); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
368 | *(t++) = (unsigned char)(l >> 16L) & 0xff; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
369 | *(t++) = (unsigned char)(l >> 8L) & 0xff; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
370 | *(t++) = (unsigned char)(l) & 0xff; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
371 | ret += 3; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
372 | } executed 4562858 times by 1 test: end of block Executed by:
| 4562858 | ||||||||||||||||||||||||||||||||||||||||||||||||
373 | return executed 272889 times by 1 test: ret;return ret; Executed by:
executed 272889 times by 1 test: return ret; Executed by:
| 272889 | ||||||||||||||||||||||||||||||||||||||||||||||||
374 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
375 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
376 | int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
377 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
378 | return executed 14701 times by 1 test: evp_decodeblock_int(return evp_decodeblock_int( ((void *)0) , t, f, n); Executed by:
executed 14701 times by 1 test: return evp_decodeblock_int( ((void *)0) , t, f, n); Executed by:
| 14701 | ||||||||||||||||||||||||||||||||||||||||||||||||
379 | ((void *)0) executed 14701 times by 1 test: return evp_decodeblock_int( ((void *)0) , t, f, n); Executed by:
| 14701 | ||||||||||||||||||||||||||||||||||||||||||||||||
380 | , t, f, n); executed 14701 times by 1 test: return evp_decodeblock_int( ((void *)0) , t, f, n); Executed by:
| 14701 | ||||||||||||||||||||||||||||||||||||||||||||||||
381 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
382 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
383 | int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
384 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
385 | int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
387 | *outl = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
388 | if (ctx->num != 0
| 12-18261 | ||||||||||||||||||||||||||||||||||||||||||||||||
389 | i = evp_decodeblock_int(ctx, out, ctx->enc_data, ctx->num); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
390 | if (i < 0
| 0-12 | ||||||||||||||||||||||||||||||||||||||||||||||||
391 | return executed 12 times by 1 test: -1;return -1; Executed by:
executed 12 times by 1 test: return -1; Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
392 | ctx->num = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
393 | *outl = i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
394 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
395 | } else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
396 | return executed 18261 times by 1 test: 1;return 1; Executed by:
executed 18261 times by 1 test: return 1; Executed by:
| 18261 | ||||||||||||||||||||||||||||||||||||||||||||||||
397 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |