line |
true |
false |
branch |
12
|
0 |
133 |
if (!RETVAL) croak("FATAL: Newz failed"); |
18
|
0 |
133 |
if (RETVAL->cipher_id == -1) { |
41
|
0 |
328 |
if (!SvPOK(key)) croak("FATAL: key must be string/buffer scalar"); |
42
|
328 |
0 |
k = (unsigned char *) SvPVbyte(key, k_len); |
45
|
0 |
328 |
if (rv != CRYPT_OK) { |
49
|
164 |
164 |
self->direction = ix == 1 ? 1 : -1; |
51
|
0 |
328 |
XPUSHs(ST(0)); /* return self */ |
64
|
3484 |
3484 |
for (j = 1; j < items; j++) { |
65
|
130 |
3354 |
in_data = (unsigned char *)SvPVbyte(ST(j), in_data_len); |
69
|
3484 |
0 |
if (in_data_len > 0) { |
70
|
1682 |
1802 |
if (self->direction == 1) { |
72
|
1356 |
326 |
if (self->padlen > 0) { |
74
|
585 |
771 |
if (in_data_len >= i) { /* enough data to fill pad */ |
79
|
0 |
585 |
if (rv != CRYPT_OK) { |
94
|
741 |
941 |
if (in_data_len > 0 && i > 0) { /* save tail of data into pad */ |
|
628 |
113 |
if (in_data_len > 0 && i > 0) { /* save tail of data into pad */ |
100
|
257 |
1425 |
if (in_data_len > 0) { |
101
|
96 |
161 |
i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); |
102
|
257 |
0 |
out_data = (unsigned char*)SvGROW(RETVAL, out_len + i + 1) + out_len; |
|
250 |
7 |
out_data = (unsigned char*)SvGROW(RETVAL, out_len + i + 1) + out_len; |
104
|
96 |
161 |
if (has_tmp_block) { |
109
|
0 |
257 |
if (rv != CRYPT_OK) { |
114
|
489 |
936 |
else if (has_tmp_block) { |
115
|
489 |
0 |
out_data = (unsigned char*)SvGROW(RETVAL, out_len + blen + 1) + out_len; |
|
489 |
0 |
out_data = (unsigned char*)SvGROW(RETVAL, out_len + blen + 1) + out_len; |
120
|
1802 |
0 |
else if (self->direction == -1) { |
121
|
116 |
1686 |
if (self->padlen == blen) { |
123
|
0 |
116 |
if (rv != CRYPT_OK) { |
130
|
1470 |
216 |
else if (self->padlen > 0) { |
132
|
633 |
837 |
if (in_data_len >= i) { /* enough data to fill pad */ |
137
|
196 |
437 |
if (in_data_len>0 || self->padding_mode == 0) { |
|
64 |
132 |
if (in_data_len>0 || self->padding_mode == 0) { |
139
|
0 |
501 |
if (rv != CRYPT_OK) { |
155
|
769 |
1033 |
if (in_data_len>0) { |
157
|
633 |
136 |
if (i>0) { /* save tail of data into pad */ |
164
|
275 |
1527 |
if (in_data_len>0) { |
165
|
136 |
139 |
if (self->padlen == 0 && self->padding_mode !=0) { |
|
62 |
74 |
if (self->padlen == 0 && self->padding_mode !=0) { |
171
|
142 |
133 |
i = (unsigned long)(has_tmp_block ? in_data_len + blen : in_data_len); |
172
|
273 |
2 |
if (i > 0) { |
173
|
273 |
0 |
out_data = (unsigned char*)SvGROW(RETVAL, out_len + i + 1) + out_len; |
|
266 |
7 |
out_data = (unsigned char*)SvGROW(RETVAL, out_len + i + 1) + out_len; |
175
|
142 |
131 |
if (has_tmp_block) { |
180
|
0 |
273 |
if (rv != CRYPT_OK) { |
186
|
475 |
1052 |
else if (has_tmp_block) { |
187
|
475 |
0 |
out_data = (unsigned char*)SvGROW(RETVAL, out_len + blen + 1) + out_len; |
|
475 |
0 |
out_data = (unsigned char*)SvGROW(RETVAL, out_len + blen + 1) + out_len; |
198
|
1494 |
1990 |
if (out_len > 0) SvCUR_set(RETVAL, out_len); |
212
|
164 |
164 |
if (self->direction == 1) { |
213
|
164 |
0 |
if (self->padlen < 0 || self->padlen >= (int)blen) croak("FATAL: invalid padlen"); |
|
0 |
164 |
if (self->padlen < 0 || self->padlen >= (int)blen) croak("FATAL: invalid padlen"); |
214
|
78 |
86 |
if (self->padding_mode != 0) { |
215
|
78 |
0 |
if (self->padding_mode == 1) { padmode = LTC_PAD_PKCS7 | (&self->state)->blocklen; } |
216
|
0 |
0 |
else if (self->padding_mode == 2) { padmode = LTC_PAD_ONE_AND_ZERO | (&self->state)->blocklen; } |
217
|
0 |
0 |
else if (self->padding_mode == 3) { padmode = LTC_PAD_ANSI_X923 | (&self->state)->blocklen; } |
218
|
0 |
0 |
else if (self->padding_mode == 4) { padmode = LTC_PAD_ZERO | (&self->state)->blocklen; } |
219
|
0 |
0 |
else if (self->padding_mode == 5) { padmode = LTC_PAD_ZERO_ALWAYS | (&self->state)->blocklen; } |
223
|
0 |
78 |
if (rv != CRYPT_OK) croak("FATAL: padding_pad failed: %s", error_to_string(rv)); |
225
|
0 |
78 |
if (rv != CRYPT_OK) croak("FATAL: ecb_encrypt failed: %s", error_to_string(rv)); |
228
|
0 |
86 |
if (self->padlen > 0) croak("FATAL: ecb_encrypt, input data length not multiple of %d", (int)blen); |
232
|
164 |
0 |
else if (self->direction == -1) { |
233
|
78 |
86 |
if (self->padlen > 0) { |
234
|
0 |
78 |
if (self->padlen != (int)blen) croak("FATAL: cipher text length has to be multiple of %d (%d)", (int)blen, self->padlen); |
236
|
0 |
78 |
if (rv != CRYPT_OK) croak("FATAL: ecb_decrypt failed: %s", error_to_string(rv)); |
237
|
78 |
0 |
if (self->padding_mode != 0) { |
238
|
78 |
0 |
if (self->padding_mode == 1) { padmode = LTC_PAD_PKCS7 | (&self->state)->blocklen; } |
239
|
0 |
0 |
else if (self->padding_mode == 2) { padmode = LTC_PAD_ONE_AND_ZERO | (&self->state)->blocklen; } |
240
|
0 |
0 |
else if (self->padding_mode == 3) { padmode = LTC_PAD_ANSI_X923 | (&self->state)->blocklen; } |
241
|
0 |
0 |
else if (self->padding_mode == 4) { padmode = LTC_PAD_ZERO | (&self->state)->blocklen; } |
242
|
0 |
0 |
else if (self->padding_mode == 5) { padmode = LTC_PAD_ZERO_ALWAYS | (&self->state)->blocklen; } |
245
|
0 |
78 |
if (rv != CRYPT_OK) croak("FATAL: padding_depad failed: %s", error_to_string(rv)); |