hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/crypto/salsa20_generic.c
....@@ -9,8 +9,8 @@
99 * Salsa20 is a stream cipher candidate in eSTREAM, the ECRYPT Stream
1010 * Cipher Project. It is designed by Daniel J. Bernstein <djb@cr.yp.to>.
1111 * More information about eSTREAM and Salsa20 can be found here:
12
- * http://www.ecrypt.eu.org/stream/
13
- * http://cr.yp.to/snuffle.html
12
+ * https://www.ecrypt.eu.org/stream/
13
+ * https://cr.yp.to/snuffle.html
1414 *
1515 * This program is free software; you can redistribute it and/or modify it
1616 * under the terms of the GNU General Public License as published by the Free
....@@ -86,18 +86,17 @@
8686 {
8787 __le32 stream[SALSA20_BLOCK_SIZE / sizeof(__le32)];
8888
89
- if (dst != src)
90
- memcpy(dst, src, bytes);
91
-
9289 while (bytes >= SALSA20_BLOCK_SIZE) {
9390 salsa20_block(state, stream);
94
- crypto_xor(dst, (const u8 *)stream, SALSA20_BLOCK_SIZE);
91
+ crypto_xor_cpy(dst, src, (const u8 *)stream,
92
+ SALSA20_BLOCK_SIZE);
9593 bytes -= SALSA20_BLOCK_SIZE;
9694 dst += SALSA20_BLOCK_SIZE;
95
+ src += SALSA20_BLOCK_SIZE;
9796 }
9897 if (bytes) {
9998 salsa20_block(state, stream);
100
- crypto_xor(dst, (const u8 *)stream, bytes);
99
+ crypto_xor_cpy(dst, src, (const u8 *)stream, bytes);
101100 }
102101 }
103102
....@@ -159,7 +158,7 @@
159158 u32 state[16];
160159 int err;
161160
162
- err = skcipher_walk_virt(&walk, req, true);
161
+ err = skcipher_walk_virt(&walk, req, false);
163162
164163 salsa20_init(state, ctx, req->iv);
165164
....@@ -204,7 +203,7 @@
204203 crypto_unregister_skcipher(&alg);
205204 }
206205
207
-module_init(salsa20_generic_mod_init);
206
+subsys_initcall(salsa20_generic_mod_init);
208207 module_exit(salsa20_generic_mod_fini);
209208
210209 MODULE_LICENSE("GPL");