Increase offset for BIO_f_enc() to avoid problems with overlapping buffers
[oweals/openssl.git] / crypto / evp / e_rc4.c
index 4064cc5fa0471b107ec5db089d9423bf77d7ebed..eadd8d42741e9c6c71fcea5b584d817d470f9154 100644 (file)
  * [including the GNU Public Licence.]
  */
 
-#ifndef OPENSSL_NO_RC4
-
 #include <stdio.h>
 #include "cryptlib.h"
+
+#ifndef OPENSSL_NO_RC4
+
 #include <openssl/evp.h>
 #include <openssl/objects.h>
 #include <openssl/rc4.h>
@@ -69,8 +70,6 @@
 
 typedef struct
     {
-    /* FIXME: what is the key for? */
-    unsigned char key[EVP_RC4_KEY_SIZE];
     RC4_KEY ks;        /* working key */
     } EVP_RC4_KEY;
 
@@ -121,9 +120,8 @@ const EVP_CIPHER *EVP_rc4_40(void)
 static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
                        const unsigned char *iv, int enc)
        {
-       memcpy(&data(ctx)->key[0],key,EVP_CIPHER_CTX_key_length(ctx));
        RC4_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),
-               data(ctx)->key);
+                   key);
        return 1;
        }