summaryrefslogtreecommitdiff
path: root/fitz/filt_aesd.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2009-11-29 04:40:31 +0100
committerTor Andersson <tor@ghostscript.com>2009-11-29 04:40:31 +0100
commit2c080e248a47cb94d2069f6523c314d039f70919 (patch)
tree46180621f350edfb63ac578a04125dcd9db31f9d /fitz/filt_aesd.c
parentaf27ce7576c323665bb9986fbbab63acb6c81c17 (diff)
downloadmupdf-2c080e248a47cb94d2069f6523c314d039f70919.tar.xz
Fix up indentation.
Diffstat (limited to 'fitz/filt_aesd.c')
-rw-r--r--fitz/filt_aesd.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/fitz/filt_aesd.c b/fitz/filt_aesd.c
index 122a284d..a4425c2e 100644
--- a/fitz/filt_aesd.c
+++ b/fitz/filt_aesd.c
@@ -5,19 +5,19 @@ typedef struct fz_aesd_s fz_aesd;
struct fz_aesd_s
{
- fz_filter super;
- fz_aes aes;
- unsigned char iv[16];
- int ivcount;
+ fz_filter super;
+ fz_aes aes;
+ unsigned char iv[16];
+ int ivcount;
};
fz_filter *
fz_newaesdfilter(unsigned char *key, unsigned keylen)
{
- FZ_NEWFILTER(fz_aesd, f, aesdfilter);
- aes_setkey_dec(&f->aes, key, keylen * 8);
- f->ivcount = 0;
- return (fz_filter *)f;
+ FZ_NEWFILTER(fz_aesd, f, aesdfilter);
+ aes_setkey_dec(&f->aes, key, keylen * 8);
+ f->ivcount = 0;
+ return (fz_filter *)f;
}
void
@@ -28,43 +28,43 @@ fz_dropaesdfilter(fz_filter *f)
fz_error
fz_processaesdfilter(fz_filter *filter, fz_buffer *in, fz_buffer *out)
{
- fz_aesd *f = (fz_aesd*)filter;
- int n;
+ fz_aesd *f = (fz_aesd*)filter;
+ int n;
- while (1)
- {
- if (in->rp + 16 > in->wp)
+ while (1)
{
- if (in->eof)
- return fz_iodone;
- return fz_ioneedin;
- }
+ if (in->rp + 16 > in->wp)
+ {
+ if (in->eof)
+ return fz_iodone;
+ return fz_ioneedin;
+ }
- if (f->ivcount < 16)
- {
- f->iv[f->ivcount++] = *in->rp++;
- }
- else
- {
- if (out->wp + 16 > out->ep)
- return fz_ioneedout;
+ if (f->ivcount < 16)
+ {
+ f->iv[f->ivcount++] = *in->rp++;
+ }
+ else
+ {
+ if (out->wp + 16 > out->ep)
+ return fz_ioneedout;
- n = MIN(in->wp - in->rp, out->ep - out->wp);
- n = (n / 16) * 16;
+ n = MIN(in->wp - in->rp, out->ep - out->wp);
+ n = (n / 16) * 16;
- aes_crypt_cbc(&f->aes, AES_DECRYPT, n, f->iv, in->rp, out->wp);
- in->rp += n;
- out->wp += n;
+ aes_crypt_cbc(&f->aes, AES_DECRYPT, n, f->iv, in->rp, out->wp);
+ in->rp += n;
+ out->wp += n;
- /* Remove padding bytes */
- if (in->eof && in->rp == in->wp)
- {
- int pad = out->wp[-1];
- if (pad < 1 || pad > 16)
- return fz_throw("aes padding out of range: %d", pad);
- out->wp -= pad;
- }
+ /* Remove padding bytes */
+ if (in->eof && in->rp == in->wp)
+ {
+ int pad = out->wp[-1];
+ if (pad < 1 || pad > 16)
+ return fz_throw("aes padding out of range: %d", pad);
+ out->wp -= pad;
+ }
+ }
}
- }
}