small fixes to `Crypt::Mode::*`
Karel Miko
10 years ago
110 | 110 |
if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_decrypt failed: %s", error_to_string(rv));
|
111 | 111 |
}
|
112 | 112 |
else {
|
113 | |
croak("FATAL: [%lc_name%]_crypt failed: call start() first");
|
|
113 |
croak("FATAL: [%lc_name%]_crypt failed: call start_encrypt or start_decrypt first");
|
114 | 114 |
}
|
115 | 115 |
}
|
116 | 116 |
}
|
78 | 78 |
STRLEN in_data_len, in_data_start;
|
79 | 79 |
unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
|
80 | 80 |
|
81 | |
if (self->direction != 1) croak("FATAL: encrypt error, call start('enc') first (%d)", self->direction);
|
|
81 |
if (self->direction != 1) croak("FATAL: encrypt error, call start_encrypt first (%d)", self->direction);
|
82 | 82 |
|
83 | 83 |
blen = (&self->state)->blocklen;
|
84 | 84 |
in_data_start = 0;
|
|
166 | 166 |
blen = 0;
|
167 | 167 |
}
|
168 | 168 |
|
|
169 |
self->direction = 0;
|
169 | 170 |
RETVAL = newSVpvn((char*)tmp_block, blen);
|
170 | 171 |
}
|
171 | 172 |
OUTPUT:
|
|
180 | 181 |
STRLEN in_data_len, in_data_start;
|
181 | 182 |
unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
|
182 | 183 |
|
183 | |
if (self->direction != -1) croak("FATAL: decrypt error, call start('dec') first (%d)", self->direction);
|
|
184 |
if (self->direction != -1) croak("FATAL: decrypt error, call start_decryt first (%d)", self->direction);
|
184 | 185 |
|
185 | 186 |
blen = (&self->state)->blocklen;
|
186 | 187 |
in_data_start = 0;
|
|
292 | 293 |
if (rv_len<0) rv_len = 0;
|
293 | 294 |
}
|
294 | 295 |
}
|
|
296 |
|
|
297 |
self->direction = 0;
|
295 | 298 |
RETVAL = newSVpvn((char*)tmp_block, rv_len);
|
296 | 299 |
}
|
297 | 300 |
OUTPUT:
|
66 | 66 |
STRLEN in_data_len, in_data_start;
|
67 | 67 |
unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
|
68 | 68 |
|
69 | |
if (self->direction != 1) croak("FATAL: encrypt error, call start('enc') first (%d)", self->direction);
|
|
69 |
if (self->direction != 1) croak("FATAL: encrypt error, call start_encrypt first (%d)", self->direction);
|
70 | 70 |
|
71 | 71 |
blen = (&self->state)->blocklen;
|
72 | 72 |
in_data_start = 0;
|
|
154 | 154 |
blen = 0;
|
155 | 155 |
}
|
156 | 156 |
|
|
157 |
self->direction = 0;
|
157 | 158 |
RETVAL = newSVpvn((char*)tmp_block, blen);
|
158 | 159 |
}
|
159 | 160 |
OUTPUT:
|
|
168 | 169 |
STRLEN in_data_len, in_data_start;
|
169 | 170 |
unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
|
170 | 171 |
|
171 | |
if (self->direction != -1) croak("FATAL: decrypt error, call start('dec') first (%d)", self->direction);
|
|
172 |
if (self->direction != -1) croak("FATAL: decrypt error, call start_decryt first (%d)", self->direction);
|
172 | 173 |
|
173 | 174 |
blen = (&self->state)->blocklen;
|
174 | 175 |
in_data_start = 0;
|
|
280 | 281 |
if (rv_len<0) rv_len = 0;
|
281 | 282 |
}
|
282 | 283 |
}
|
|
284 |
|
|
285 |
self->direction = 0;
|
283 | 286 |
RETVAL = newSVpvn((char*)tmp_block, rv_len);
|
284 | 287 |
}
|
285 | 288 |
OUTPUT:
|
81 | 81 |
if (rv != CRYPT_OK) croak("FATAL: cfb_decrypt failed: %s", error_to_string(rv));
|
82 | 82 |
}
|
83 | 83 |
else {
|
84 | |
croak("FATAL: cfb_crypt failed: call start() first");
|
|
84 |
croak("FATAL: cfb_crypt failed: call start_encrypt or start_decrypt first");
|
85 | 85 |
}
|
86 | 86 |
}
|
87 | 87 |
}
|
86 | 86 |
if (rv != CRYPT_OK) croak("FATAL: ctr_decrypt failed: %s", error_to_string(rv));
|
87 | 87 |
}
|
88 | 88 |
else {
|
89 | |
croak("FATAL: ctr_crypt failed: call start() first");
|
|
89 |
croak("FATAL: ctr_crypt failed: call start_encrypt or start_decrypt first");
|
90 | 90 |
}
|
91 | 91 |
}
|
92 | 92 |
}
|
59 | 59 |
STRLEN in_data_len, in_data_start;
|
60 | 60 |
unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
|
61 | 61 |
|
62 | |
if (self->direction != 1) croak("FATAL: encrypt error, call start('enc') first (%d)", self->direction);
|
|
62 |
if (self->direction != 1) croak("FATAL: encrypt error, call start_encrypt first (%d)", self->direction);
|
63 | 63 |
|
64 | 64 |
blen = (&self->state)->blocklen;
|
65 | 65 |
in_data_start = 0;
|
|
147 | 147 |
blen = 0;
|
148 | 148 |
}
|
149 | 149 |
|
|
150 |
self->direction = 0;
|
150 | 151 |
RETVAL = newSVpvn((char*)tmp_block, blen);
|
151 | 152 |
}
|
152 | 153 |
OUTPUT:
|
|
161 | 162 |
STRLEN in_data_len, in_data_start;
|
162 | 163 |
unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
|
163 | 164 |
|
164 | |
if (self->direction != -1) croak("FATAL: decrypt error, call start('dec') first (%d)", self->direction);
|
|
165 |
if (self->direction != -1) croak("FATAL: decrypt error, call start_decryt first (%d)", self->direction);
|
165 | 166 |
|
166 | 167 |
blen = (&self->state)->blocklen;
|
167 | 168 |
in_data_start = 0;
|
|
273 | 274 |
if (rv_len<0) rv_len = 0;
|
274 | 275 |
}
|
275 | 276 |
}
|
|
277 |
|
|
278 |
self->direction = 0;
|
276 | 279 |
RETVAL = newSVpvn((char*)tmp_block, rv_len);
|
277 | 280 |
}
|
278 | 281 |
OUTPUT:
|
81 | 81 |
if (rv != CRYPT_OK) croak("FATAL: ofb_decrypt failed: %s", error_to_string(rv));
|
82 | 82 |
}
|
83 | 83 |
else {
|
84 | |
croak("FATAL: ofb_crypt failed: call start() first");
|
|
84 |
croak("FATAL: ofb_crypt failed: call start_encrypt or start_decrypt first");
|
85 | 85 |
}
|
86 | 86 |
}
|
87 | 87 |
}
|