diff options
author | Corentin Labbe <clabbe@baylibre.com> | 2018-11-29 09:42:16 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-12-07 01:15:00 -0500 |
commit | 2ced26078fcff26db532d6300a1b5f8ffd11a5e1 (patch) | |
tree | b132cfafef62c742cc0bcfa680984736f3d6e59f /crypto | |
parent | c97e4df573f2434b07f08d3b93673f61158d267f (diff) |
crypto: user - made crypto_user_stat optional
Even if CRYPTO_STATS is set to n, some part of CRYPTO_STATS are
compiled.
This patch made all part of crypto_user_stat uncompiled in that case.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/Makefile | 3 | ||||
-rw-r--r-- | crypto/algapi.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/crypto/Makefile b/crypto/Makefile index 5e789dc2d4fd..799ed5e94606 100644 --- a/crypto/Makefile +++ b/crypto/Makefile | |||
@@ -54,7 +54,8 @@ cryptomgr-y := algboss.o testmgr.o | |||
54 | 54 | ||
55 | obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o | 55 | obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o |
56 | obj-$(CONFIG_CRYPTO_USER) += crypto_user.o | 56 | obj-$(CONFIG_CRYPTO_USER) += crypto_user.o |
57 | crypto_user-y := crypto_user_base.o crypto_user_stat.o | 57 | crypto_user-y := crypto_user_base.o |
58 | crypto_user-$(CONFIG_CRYPTO_STATS) += crypto_user_stat.o | ||
58 | obj-$(CONFIG_CRYPTO_CMAC) += cmac.o | 59 | obj-$(CONFIG_CRYPTO_CMAC) += cmac.o |
59 | obj-$(CONFIG_CRYPTO_HMAC) += hmac.o | 60 | obj-$(CONFIG_CRYPTO_HMAC) += hmac.o |
60 | obj-$(CONFIG_CRYPTO_VMAC) += vmac.o | 61 | obj-$(CONFIG_CRYPTO_VMAC) += vmac.o |
diff --git a/crypto/algapi.c b/crypto/algapi.c index 2545c5f89c4c..f5396c88e8cd 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -258,6 +258,7 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg) | |||
258 | list_add(&alg->cra_list, &crypto_alg_list); | 258 | list_add(&alg->cra_list, &crypto_alg_list); |
259 | list_add(&larval->alg.cra_list, &crypto_alg_list); | 259 | list_add(&larval->alg.cra_list, &crypto_alg_list); |
260 | 260 | ||
261 | #ifdef CONFIG_CRYPTO_STATS | ||
261 | atomic_set(&alg->encrypt_cnt, 0); | 262 | atomic_set(&alg->encrypt_cnt, 0); |
262 | atomic_set(&alg->decrypt_cnt, 0); | 263 | atomic_set(&alg->decrypt_cnt, 0); |
263 | atomic64_set(&alg->encrypt_tlen, 0); | 264 | atomic64_set(&alg->encrypt_tlen, 0); |
@@ -265,6 +266,7 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg) | |||
265 | atomic_set(&alg->verify_cnt, 0); | 266 | atomic_set(&alg->verify_cnt, 0); |
266 | atomic_set(&alg->cipher_err_cnt, 0); | 267 | atomic_set(&alg->cipher_err_cnt, 0); |
267 | atomic_set(&alg->sign_cnt, 0); | 268 | atomic_set(&alg->sign_cnt, 0); |
269 | #endif | ||
268 | 270 | ||
269 | out: | 271 | out: |
270 | return larval; | 272 | return larval; |