]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
stream cipher: Allow in-place encryption.
authorAndre Noll <maan@systemlinux.org>
Mon, 7 Mar 2011 07:07:37 +0000 (08:07 +0100)
committerAndre Noll <maan@systemlinux.org>
Wed, 6 Jul 2011 06:41:25 +0000 (08:41 +0200)
unlike openssl's RC4(), the RC4 implemenation of libgcrypt can encrypt
a buffer in-place. For this the "buf" argument of the various send
and receive functions must not be const.

crypt.c
crypt.h
crypt_common.c

diff --git a/crypt.c b/crypt.c
index 7b602d995d3deccaba5e2e6ab76f4dec5570c95b..2dc15461705cdd535da871fbf2c3bfc607367d4d 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -365,7 +365,7 @@ void sc_free(struct stream_cipher *sc)
  *
  * \sa \ref write_all(), RC4(3).
  */
-int sc_send_bin_buffer(struct stream_cipher_context *scc, const char *buf,
+int sc_send_bin_buffer(struct stream_cipher_context *scc, char *buf,
                size_t len)
 {
        int ret;
diff --git a/crypt.h b/crypt.h
index d2c2b32024ccdaa1d35af2b7b3813976040f61e7..fc41acf3f04efcedcad75a7a61e9dae3b8dfd6fa 100644 (file)
--- a/crypt.h
+++ b/crypt.h
@@ -54,9 +54,9 @@ struct stream_cipher_context {
 };
 struct stream_cipher *sc_new(const unsigned char *data, int len);
 void sc_free(struct stream_cipher *sc);
-int sc_send_bin_buffer(struct stream_cipher_context *scc, const char *buf,
+int sc_send_bin_buffer(struct stream_cipher_context *scc, char *buf,
                size_t len);
-int sc_send_buffer(struct stream_cipher_context *scc, const char *buf);
+int sc_send_buffer(struct stream_cipher_context *scc, char *buf);
 __printf_2_3 int sc_send_va_buffer(struct stream_cipher_context *scc,
                const char *fmt, ...);
 int sc_recv_bin_buffer(struct stream_cipher_context *scc, char *buf,
index 3bd603c0ec698ab6be9c3e48d99e7a76e52c53f0..a2f682687928dd2cee0f603e98e56f1bf3c9534f 100644 (file)
@@ -325,7 +325,7 @@ int sc_recv_buffer(struct stream_cipher_context *scc, char *buf, size_t size)
  *
  * \return The return value of the underyling call to sc_send_bin_buffer().
  */
-int sc_send_buffer(struct stream_cipher_context *scc, const char *buf)
+int sc_send_buffer(struct stream_cipher_context *scc, char *buf)
 {
        return sc_send_bin_buffer(scc, buf, strlen(buf));
 }