From 54cf5827521ddf1d4be9bed2da196ca58e773e4e Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 14 Mar 2011 17:25:14 +0100 Subject: [PATCH] Document RC4_ALIGN. It's not obvious what is going on there, so add explain why we are doing this ugly dance. --- crypt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crypt.c b/crypt.c index 9085f66b..8e1814dd 100644 --- a/crypt.c +++ b/crypt.c @@ -219,7 +219,6 @@ int pub_encrypt(struct asymmetric_key *pub, unsigned char *inbuf, return ret < 0? -E_ENCRYPT : ret; } -#define RC4_ALIGN 8 struct stream_cipher { RC4_KEY key; }; @@ -249,6 +248,13 @@ void sc_free(struct stream_cipher *sc) free(sc); } +/** + * The RC4() implementation of openssl apparently reads and writes data in + * blocks of 8 bytes. So we have to make sure our buffer sizes are a multiple + * of this. + */ +#define RC4_ALIGN 8 + /** * Encrypt and send a buffer. * -- 2.39.5