Closed GoogleCodeExporter closed 9 years ago
i agree it would be better to generate an error.
i ought to have changed that when i added some more functions to Keyring.
Original comment by Charles....@gmail.com
on 16 Jul 2009 at 1:37
see how you fare with the version attached
Original comment by Charles....@gmail.com
on 18 Jul 2009 at 9:52
Attachments:
just read the changes, will run the code after this post.
wrong calling of blowfish cbc can cause a panic. keyring.c doesn't enforce
that the
buffer be a multiple of the block size. the libsec's blowfish asserts
alignment:
void
bfCBCencrypt(uchar *buf, int n, BFstate *s)
{
int i;
uchar *p;
u32int bo[2], bi[2], b;
assert((n & 7) == 0);
aes cbc is fine as libsec handles that case (perhaps that caused the confusion).
tiny nit: in Keyring_desecb, i think the cast in "if(f->state ==
(Keyring_DESstate*)H)" can be removed just as in all the other cases?
although it's now more likely that a programmer doesn't pass a nil/H state to
the
encryption function (since setup throws an error on failure), wouldn't it be
nicer if
crypting with nil state would throw an error too? my imagination on why you
would
call the functions with nil state fails me. returning when buffer is nil makes
sense
though. i also wonder if taking min(f->buf->len, f->n) is the kindest thing to
do to
the programmer. if f->n is what the programmer requested, and keyring does
something
differently if the buffer is too small. changing "n" won't leak sensitive data
of
course, so it's not really harmful.
Original comment by mechiel@ueber.net
on 18 Jul 2009 at 10:31
just tested aes cbc and des. they seem to work fine. errors are caught as
intended.
Original comment by mechiel@ueber.net
on 18 Jul 2009 at 10:56
here's another variant with more error checking
Original comment by Charles....@gmail.com
on 5 Aug 2009 at 10:20
Attachments:
i've installed that at 343
Original comment by Charles....@gmail.com
on 5 Aug 2009 at 6:59
Original issue reported on code.google.com by
mechiel@ueber.net
on 16 Jul 2009 at 9:47