Document RC4_ALIGN.
authorAndre Noll <maan@systemlinux.org>
Mon, 14 Mar 2011 16:25:14 +0000 (17:25 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 27 Mar 2011 14:43:12 +0000 (16:43 +0200)
It's not obvious what is going on there, so add explain why we are doing
this ugly dance.

crypt.c

diff --git a/crypt.c b/crypt.c
index 9085f66b1ad88b316801739fef480c84ab3fb2c4..8e1814dd3d82e5fd1d50301402faea6b0d9a9934 100644 (file)
--- 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;
 }
 
        return ret < 0? -E_ENCRYPT : ret;
 }
 
-#define RC4_ALIGN 8
 struct stream_cipher {
        RC4_KEY key;
 };
 struct stream_cipher {
        RC4_KEY key;
 };
@@ -249,6 +248,13 @@ void sc_free(struct stream_cipher *sc)
        free(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.
  *
 /**
  * Encrypt and send a buffer.
  *