]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - crypto/chacha20_generic.c
xen/pvh: Split CONFIG_XEN_PVH into CONFIG_PVH and CONFIG_XEN_PVH
[linux.git] / crypto / chacha20_generic.c
index e451c3cb6a56e863e8da71170b3e676de1b0cb16..3ae96587caf9a4e18216c8a0f1308eb0812eb912 100644 (file)
 static void chacha20_docrypt(u32 *state, u8 *dst, const u8 *src,
                             unsigned int bytes)
 {
-       u32 stream[CHACHA20_BLOCK_WORDS];
+       /* aligned to potentially speed up crypto_xor() */
+       u8 stream[CHACHA20_BLOCK_SIZE] __aligned(sizeof(long));
 
        if (dst != src)
                memcpy(dst, src, bytes);
 
        while (bytes >= CHACHA20_BLOCK_SIZE) {
                chacha20_block(state, stream);
-               crypto_xor(dst, (const u8 *)stream, CHACHA20_BLOCK_SIZE);
+               crypto_xor(dst, stream, CHACHA20_BLOCK_SIZE);
                bytes -= CHACHA20_BLOCK_SIZE;
                dst += CHACHA20_BLOCK_SIZE;
        }
        if (bytes) {
                chacha20_block(state, stream);
-               crypto_xor(dst, (const u8 *)stream, bytes);
+               crypto_xor(dst, stream, bytes);
        }
 }