Skip to content

Commit 22cf705

Browse files
ardbiesheuvelherbertx
authored andcommitted
crypto: chacha - unexport chacha_generic routines
Now that all users of generic ChaCha code have moved to the core library, there is no longer a need for the generic ChaCha skcpiher driver to export parts of it implementation for reuse by other drivers. So drop the exports, and make the symbols static. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 3a2f58f commit 22cf705

2 files changed

Lines changed: 8 additions & 28 deletions

File tree

‎crypto/chacha_generic.c‎

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static int chacha_stream_xor(struct skcipher_request *req,
2121

2222
err = skcipher_walk_virt(&walk, req, false);
2323

24-
crypto_chacha_init(state, ctx, iv);
24+
chacha_init_generic(state, ctx->key, iv);
2525

2626
while (walk.nbytes > 0) {
2727
unsigned int nbytes = walk.nbytes;
@@ -37,36 +37,27 @@ static int chacha_stream_xor(struct skcipher_request *req,
3737
return err;
3838
}
3939

40-
void crypto_chacha_init(u32 *state, const struct chacha_ctx *ctx, const u8 *iv)
41-
{
42-
chacha_init_generic(state, ctx->key, iv);
43-
}
44-
EXPORT_SYMBOL_GPL(crypto_chacha_init);
45-
46-
int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key,
47-
unsigned int keysize)
40+
static int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key,
41+
unsigned int keysize)
4842
{
4943
return chacha_setkey(tfm, key, keysize, 20);
5044
}
51-
EXPORT_SYMBOL_GPL(crypto_chacha20_setkey);
5245

53-
int crypto_chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key,
54-
unsigned int keysize)
46+
static int crypto_chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key,
47+
unsigned int keysize)
5548
{
5649
return chacha_setkey(tfm, key, keysize, 12);
5750
}
58-
EXPORT_SYMBOL_GPL(crypto_chacha12_setkey);
5951

60-
int crypto_chacha_crypt(struct skcipher_request *req)
52+
static int crypto_chacha_crypt(struct skcipher_request *req)
6153
{
6254
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
6355
struct chacha_ctx *ctx = crypto_skcipher_ctx(tfm);
6456

6557
return chacha_stream_xor(req, ctx, req->iv);
6658
}
67-
EXPORT_SYMBOL_GPL(crypto_chacha_crypt);
6859

69-
int crypto_xchacha_crypt(struct skcipher_request *req)
60+
static int crypto_xchacha_crypt(struct skcipher_request *req)
7061
{
7162
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
7263
struct chacha_ctx *ctx = crypto_skcipher_ctx(tfm);
@@ -75,7 +66,7 @@ int crypto_xchacha_crypt(struct skcipher_request *req)
7566
u8 real_iv[16];
7667

7768
/* Compute the subkey given the original key and first 128 nonce bits */
78-
crypto_chacha_init(state, ctx, req->iv);
69+
chacha_init_generic(state, ctx->key, req->iv);
7970
hchacha_block_generic(state, subctx.key, ctx->nrounds);
8071
subctx.nrounds = ctx->nrounds;
8172

@@ -86,7 +77,6 @@ int crypto_xchacha_crypt(struct skcipher_request *req)
8677
/* Generate the stream and XOR it with the data */
8778
return chacha_stream_xor(req, &subctx, real_iv);
8879
}
89-
EXPORT_SYMBOL_GPL(crypto_xchacha_crypt);
9080

9181
static struct skcipher_alg algs[] = {
9282
{

‎include/crypto/internal/chacha.h‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ struct chacha_ctx {
1212
int nrounds;
1313
};
1414

15-
void crypto_chacha_init(u32 *state, const struct chacha_ctx *ctx, const u8 *iv);
16-
1715
static inline int chacha_setkey(struct crypto_skcipher *tfm, const u8 *key,
1816
unsigned int keysize, int nrounds)
1917
{
@@ -42,12 +40,4 @@ static int inline chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key,
4240
return chacha_setkey(tfm, key, keysize, 12);
4341
}
4442

45-
int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key,
46-
unsigned int keysize);
47-
int crypto_chacha12_setkey(struct crypto_skcipher *tfm, const u8 *key,
48-
unsigned int keysize);
49-
50-
int crypto_chacha_crypt(struct skcipher_request *req);
51-
int crypto_xchacha_crypt(struct skcipher_request *req);
52-
5343
#endif /* _CRYPTO_CHACHA_H */

0 commit comments

Comments
 (0)