On 30-Jul-08, at 5:20 PM, David Vazquez wrote:
gcry_error_t gcry_cipher_encrypt (gcry_cipher_hd_t H,
unsigned char *out,
size_t OUTSIZE,
const unsigned char *IN,
size_t INLEN)
By the way, I think OUTSIZE argument is redundant. We can determine
it for both methods. Is there any form We take advantage of this?
Does OUTSIZE not function as a guard to make it easier to avoid
overflowing the 'out' buffer?
Looking at the documentation, 'in' can also be NULL in this call to
request in-place encryption of the data already in the 'out' buffer,
so a separate length is needed for that case. This doesn't have to
propagated to the gnupdf api, of course.
Separate in and out buffer sizes can also simplify progress
calculations for incremental processing through a ring buffer, since
you can just pass the available input and output space and let the
call make what progress it can. But it doesn't help if the call
doesn't also return how much progress it made so you can advance the
pointers. And because of the AES block padding, this isn't an
entirely trivial calculation for encode, and is impossible to know
ahead of time on decode.
-r