summaryrefslogtreecommitdiff
path: root/crypto/salsa20_generic.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2019-05-20 15:31:34 +0200
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2019-05-20 15:31:34 +0200
commitcd574ee16ffa2f2cad8414b9c59520e3e08a77f9 (patch)
tree8511c7a250b9bd6f6b0285f7fdfb05cd917c0373 /crypto/salsa20_generic.c
parent831fd9fdce82ad6727c15552b430c5e54420d92f (diff)
parent8648646bd7927eccf4334248e94827d5dd47acf9 (diff)
downloadlinux-crypto-cd574ee16ffa2f2cad8414b9c59520e3e08a77f9.tar.gz
linux-crypto-cd574ee16ffa2f2cad8414b9c59520e3e08a77f9.zip
Merge tag 'v5.2-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into fbdev-for-next
Linux 5.2-rc1 Sync with upstream (which now contains fbdev-v5.2 changes) to prepare a base for fbdev-v5.3 changes.
Diffstat (limited to 'crypto/salsa20_generic.c')
-rw-r--r--crypto/salsa20_generic.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/crypto/salsa20_generic.c b/crypto/salsa20_generic.c
index 00fce32a..c81a4440 100644
--- a/crypto/salsa20_generic.c
+++ b/crypto/salsa20_generic.c
@@ -86,18 +86,17 @@ static void salsa20_docrypt(u32 *state, u8 *dst, const u8 *src,
{
__le32 stream[SALSA20_BLOCK_SIZE / sizeof(__le32)];
- if (dst != src)
- memcpy(dst, src, bytes);
-
while (bytes >= SALSA20_BLOCK_SIZE) {
salsa20_block(state, stream);
- crypto_xor(dst, (const u8 *)stream, SALSA20_BLOCK_SIZE);
+ crypto_xor_cpy(dst, src, (const u8 *)stream,
+ SALSA20_BLOCK_SIZE);
bytes -= SALSA20_BLOCK_SIZE;
dst += SALSA20_BLOCK_SIZE;
+ src += SALSA20_BLOCK_SIZE;
}
if (bytes) {
salsa20_block(state, stream);
- crypto_xor(dst, (const u8 *)stream, bytes);
+ crypto_xor_cpy(dst, src, (const u8 *)stream, bytes);
}
}
@@ -161,7 +160,7 @@ static int salsa20_crypt(struct skcipher_request *req)
err = skcipher_walk_virt(&walk, req, false);
- salsa20_init(state, ctx, walk.iv);
+ salsa20_init(state, ctx, req->iv);
while (walk.nbytes > 0) {
unsigned int nbytes = walk.nbytes;
@@ -204,7 +203,7 @@ static void __exit salsa20_generic_mod_fini(void)
crypto_unregister_skcipher(&alg);
}
-module_init(salsa20_generic_mod_init);
+subsys_initcall(salsa20_generic_mod_init);
module_exit(salsa20_generic_mod_fini);
MODULE_LICENSE("GPL");