]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - crypt.c
Document RC4_ALIGN.
[paraslash.git] / crypt.c
diff --git a/crypt.c b/crypt.c
index f3bfed3be755ccce6ba9ec1d89c40934babedc35..8e1814dd3d82e5fd1d50301402faea6b0d9a9934 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -7,7 +7,6 @@
 /** \file crypt.c Openssl-based encryption/decryption routines. */
 
 #include <regex.h>
 /** \file crypt.c Openssl-based encryption/decryption routines. */
 
 #include <regex.h>
-#include <dirent.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <openssl/rand.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <openssl/rand.h>
@@ -220,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;
 };
@@ -250,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.
  *