Codebase list libcryptx-perl / 6232787
small fixes to `Crypt::Mode::*` Karel Miko 10 years ago
7 changed file(s) with 19 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
110110 if (rv != CRYPT_OK) croak("FATAL: [%lc_name%]_decrypt failed: %s", error_to_string(rv));
111111 }
112112 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");
114114 }
115115 }
116116 }
7878 STRLEN in_data_len, in_data_start;
7979 unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
8080
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);
8282
8383 blen = (&self->state)->blocklen;
8484 in_data_start = 0;
166166 blen = 0;
167167 }
168168
169 self->direction = 0;
169170 RETVAL = newSVpvn((char*)tmp_block, blen);
170171 }
171172 OUTPUT:
180181 STRLEN in_data_len, in_data_start;
181182 unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
182183
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);
184185
185186 blen = (&self->state)->blocklen;
186187 in_data_start = 0;
292293 if (rv_len<0) rv_len = 0;
293294 }
294295 }
296
297 self->direction = 0;
295298 RETVAL = newSVpvn((char*)tmp_block, rv_len);
296299 }
297300 OUTPUT:
6666 STRLEN in_data_len, in_data_start;
6767 unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
6868
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);
7070
7171 blen = (&self->state)->blocklen;
7272 in_data_start = 0;
154154 blen = 0;
155155 }
156156
157 self->direction = 0;
157158 RETVAL = newSVpvn((char*)tmp_block, blen);
158159 }
159160 OUTPUT:
168169 STRLEN in_data_len, in_data_start;
169170 unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
170171
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);
172173
173174 blen = (&self->state)->blocklen;
174175 in_data_start = 0;
280281 if (rv_len<0) rv_len = 0;
281282 }
282283 }
284
285 self->direction = 0;
283286 RETVAL = newSVpvn((char*)tmp_block, rv_len);
284287 }
285288 OUTPUT:
8181 if (rv != CRYPT_OK) croak("FATAL: cfb_decrypt failed: %s", error_to_string(rv));
8282 }
8383 else {
84 croak("FATAL: cfb_crypt failed: call start() first");
84 croak("FATAL: cfb_crypt failed: call start_encrypt or start_decrypt first");
8585 }
8686 }
8787 }
8686 if (rv != CRYPT_OK) croak("FATAL: ctr_decrypt failed: %s", error_to_string(rv));
8787 }
8888 else {
89 croak("FATAL: ctr_crypt failed: call start() first");
89 croak("FATAL: ctr_crypt failed: call start_encrypt or start_decrypt first");
9090 }
9191 }
9292 }
5959 STRLEN in_data_len, in_data_start;
6060 unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
6161
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);
6363
6464 blen = (&self->state)->blocklen;
6565 in_data_start = 0;
147147 blen = 0;
148148 }
149149
150 self->direction = 0;
150151 RETVAL = newSVpvn((char*)tmp_block, blen);
151152 }
152153 OUTPUT:
161162 STRLEN in_data_len, in_data_start;
162163 unsigned char *in_data, *out_data, tmp_block[MAXBLOCKSIZE];
163164
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);
165166
166167 blen = (&self->state)->blocklen;
167168 in_data_start = 0;
273274 if (rv_len<0) rv_len = 0;
274275 }
275276 }
277
278 self->direction = 0;
276279 RETVAL = newSVpvn((char*)tmp_block, rv_len);
277280 }
278281 OUTPUT:
8181 if (rv != CRYPT_OK) croak("FATAL: ofb_decrypt failed: %s", error_to_string(rv));
8282 }
8383 else {
84 croak("FATAL: ofb_crypt failed: call start() first");
84 croak("FATAL: ofb_crypt failed: call start_encrypt or start_decrypt first");
8585 }
8686 }
8787 }