Skip to content

Commit 2043323

Browse files
ebiggersherbertx
authored andcommitted
crypto: chacha_generic - remove unnecessary setkey() functions
Use chacha20_setkey() and chacha12_setkey() from <crypto/internal/chacha.h> instead of defining them again in chacha_generic.c. Signed-off-by: Eric Biggers <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 3d04158 commit 2043323

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

crypto/chacha_generic.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ static int chacha_stream_xor(struct skcipher_request *req,
3737
return err;
3838
}
3939

40-
static int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key,
41-
unsigned int keysize)
42-
{
43-
return chacha_setkey(tfm, key, keysize, 20);
44-
}
45-
46-
static int crypto_chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key,
47-
unsigned int keysize)
48-
{
49-
return chacha_setkey(tfm, key, keysize, 12);
50-
}
51-
5240
static int crypto_chacha_crypt(struct skcipher_request *req)
5341
{
5442
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
@@ -91,7 +79,7 @@ static struct skcipher_alg algs[] = {
9179
.max_keysize = CHACHA_KEY_SIZE,
9280
.ivsize = CHACHA_IV_SIZE,
9381
.chunksize = CHACHA_BLOCK_SIZE,
94-
.setkey = crypto_chacha20_setkey,
82+
.setkey = chacha20_setkey,
9583
.encrypt = crypto_chacha_crypt,
9684
.decrypt = crypto_chacha_crypt,
9785
}, {
@@ -106,7 +94,7 @@ static struct skcipher_alg algs[] = {
10694
.max_keysize = CHACHA_KEY_SIZE,
10795
.ivsize = XCHACHA_IV_SIZE,
10896
.chunksize = CHACHA_BLOCK_SIZE,
109-
.setkey = crypto_chacha20_setkey,
97+
.setkey = chacha20_setkey,
11098
.encrypt = crypto_xchacha_crypt,
11199
.decrypt = crypto_xchacha_crypt,
112100
}, {
@@ -121,7 +109,7 @@ static struct skcipher_alg algs[] = {
121109
.max_keysize = CHACHA_KEY_SIZE,
122110
.ivsize = XCHACHA_IV_SIZE,
123111
.chunksize = CHACHA_BLOCK_SIZE,
124-
.setkey = crypto_chacha12_setkey,
112+
.setkey = chacha12_setkey,
125113
.encrypt = crypto_xchacha_crypt,
126114
.decrypt = crypto_xchacha_crypt,
127115
}

0 commit comments

Comments
 (0)