Loading crypto/Kconfig +11 −0 Original line number Diff line number Diff line Loading @@ -1799,6 +1799,17 @@ config CRYPTO_USER_API_AEAD This option enables the user-spaces interface for AEAD cipher algorithms. config CRYPTO_STATS bool "Crypto usage statistics for User-space" help This option enables the gathering of crypto stats. This will collect: - encrypt/decrypt size and numbers of symmeric operations - compress/decompress size and numbers of compress operations - size and numbers of hash operations - encrypt/decrypt/sign/verify numbers for asymmetric operations - generate/seed numbers for rng operations config CRYPTO_HASH_INFO bool Loading crypto/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ cryptomgr-y := algboss.o testmgr.o obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o obj-$(CONFIG_CRYPTO_USER) += crypto_user.o crypto_user-y := crypto_user_base.o crypto_user_stat.o obj-$(CONFIG_CRYPTO_CMAC) += cmac.o obj-$(CONFIG_CRYPTO_HMAC) += hmac.o obj-$(CONFIG_CRYPTO_VMAC) += vmac.o Loading crypto/ahash.c +16 −5 Original line number Diff line number Diff line Loading @@ -364,24 +364,35 @@ static int crypto_ahash_op(struct ahash_request *req, int crypto_ahash_final(struct ahash_request *req) { return crypto_ahash_op(req, crypto_ahash_reqtfm(req)->final); int ret; ret = crypto_ahash_op(req, crypto_ahash_reqtfm(req)->final); crypto_stat_ahash_final(req, ret); return ret; } EXPORT_SYMBOL_GPL(crypto_ahash_final); int crypto_ahash_finup(struct ahash_request *req) { return crypto_ahash_op(req, crypto_ahash_reqtfm(req)->finup); int ret; ret = crypto_ahash_op(req, crypto_ahash_reqtfm(req)->finup); crypto_stat_ahash_final(req, ret); return ret; } EXPORT_SYMBOL_GPL(crypto_ahash_finup); int crypto_ahash_digest(struct ahash_request *req) { struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); int ret; if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) return -ENOKEY; return crypto_ahash_op(req, tfm->digest); ret = -ENOKEY; else ret = crypto_ahash_op(req, tfm->digest); crypto_stat_ahash_final(req, ret); return ret; } EXPORT_SYMBOL_GPL(crypto_ahash_digest); Loading crypto/algapi.c +8 −0 Original line number Diff line number Diff line Loading @@ -258,6 +258,14 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg) list_add(&alg->cra_list, &crypto_alg_list); list_add(&larval->alg.cra_list, &crypto_alg_list); atomic_set(&alg->encrypt_cnt, 0); atomic_set(&alg->decrypt_cnt, 0); atomic64_set(&alg->encrypt_tlen, 0); atomic64_set(&alg->decrypt_tlen, 0); atomic_set(&alg->verify_cnt, 0); atomic_set(&alg->cipher_err_cnt, 0); atomic_set(&alg->sign_cnt, 0); out: return larval; Loading crypto/crypto_user.c→crypto/crypto_user_base.c +7 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <crypto/internal/rng.h> #include <crypto/akcipher.h> #include <crypto/kpp.h> #include <crypto/internal/cryptouser.h> #include "internal.h" Loading @@ -37,7 +38,7 @@ static DEFINE_MUTEX(crypto_cfg_mutex); /* The crypto netlink socket */ static struct sock *crypto_nlsk; struct sock *crypto_nlsk; struct crypto_dump_info { struct sk_buff *in_skb; Loading @@ -46,7 +47,7 @@ struct crypto_dump_info { u16 nlmsg_flags; }; static struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact) struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact) { struct crypto_alg *q, *alg = NULL; Loading Loading @@ -461,6 +462,7 @@ static const int crypto_msg_min[CRYPTO_NR_MSGTYPES] = { [CRYPTO_MSG_UPDATEALG - CRYPTO_MSG_BASE] = MSGSIZE(crypto_user_alg), [CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE] = MSGSIZE(crypto_user_alg), [CRYPTO_MSG_DELRNG - CRYPTO_MSG_BASE] = 0, [CRYPTO_MSG_GETSTAT - CRYPTO_MSG_BASE] = MSGSIZE(crypto_user_alg), }; static const struct nla_policy crypto_policy[CRYPTOCFGA_MAX+1] = { Loading @@ -481,6 +483,9 @@ static const struct crypto_link { .dump = crypto_dump_report, .done = crypto_dump_report_done}, [CRYPTO_MSG_DELRNG - CRYPTO_MSG_BASE] = { .doit = crypto_del_rng }, [CRYPTO_MSG_GETSTAT - CRYPTO_MSG_BASE] = { .doit = crypto_reportstat, .dump = crypto_dump_reportstat, .done = crypto_dump_reportstat_done}, }; static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, Loading Loading
crypto/Kconfig +11 −0 Original line number Diff line number Diff line Loading @@ -1799,6 +1799,17 @@ config CRYPTO_USER_API_AEAD This option enables the user-spaces interface for AEAD cipher algorithms. config CRYPTO_STATS bool "Crypto usage statistics for User-space" help This option enables the gathering of crypto stats. This will collect: - encrypt/decrypt size and numbers of symmeric operations - compress/decompress size and numbers of compress operations - size and numbers of hash operations - encrypt/decrypt/sign/verify numbers for asymmetric operations - generate/seed numbers for rng operations config CRYPTO_HASH_INFO bool Loading
crypto/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ cryptomgr-y := algboss.o testmgr.o obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o obj-$(CONFIG_CRYPTO_USER) += crypto_user.o crypto_user-y := crypto_user_base.o crypto_user_stat.o obj-$(CONFIG_CRYPTO_CMAC) += cmac.o obj-$(CONFIG_CRYPTO_HMAC) += hmac.o obj-$(CONFIG_CRYPTO_VMAC) += vmac.o Loading
crypto/ahash.c +16 −5 Original line number Diff line number Diff line Loading @@ -364,24 +364,35 @@ static int crypto_ahash_op(struct ahash_request *req, int crypto_ahash_final(struct ahash_request *req) { return crypto_ahash_op(req, crypto_ahash_reqtfm(req)->final); int ret; ret = crypto_ahash_op(req, crypto_ahash_reqtfm(req)->final); crypto_stat_ahash_final(req, ret); return ret; } EXPORT_SYMBOL_GPL(crypto_ahash_final); int crypto_ahash_finup(struct ahash_request *req) { return crypto_ahash_op(req, crypto_ahash_reqtfm(req)->finup); int ret; ret = crypto_ahash_op(req, crypto_ahash_reqtfm(req)->finup); crypto_stat_ahash_final(req, ret); return ret; } EXPORT_SYMBOL_GPL(crypto_ahash_finup); int crypto_ahash_digest(struct ahash_request *req) { struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); int ret; if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) return -ENOKEY; return crypto_ahash_op(req, tfm->digest); ret = -ENOKEY; else ret = crypto_ahash_op(req, tfm->digest); crypto_stat_ahash_final(req, ret); return ret; } EXPORT_SYMBOL_GPL(crypto_ahash_digest); Loading
crypto/algapi.c +8 −0 Original line number Diff line number Diff line Loading @@ -258,6 +258,14 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg) list_add(&alg->cra_list, &crypto_alg_list); list_add(&larval->alg.cra_list, &crypto_alg_list); atomic_set(&alg->encrypt_cnt, 0); atomic_set(&alg->decrypt_cnt, 0); atomic64_set(&alg->encrypt_tlen, 0); atomic64_set(&alg->decrypt_tlen, 0); atomic_set(&alg->verify_cnt, 0); atomic_set(&alg->cipher_err_cnt, 0); atomic_set(&alg->sign_cnt, 0); out: return larval; Loading
crypto/crypto_user.c→crypto/crypto_user_base.c +7 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <crypto/internal/rng.h> #include <crypto/akcipher.h> #include <crypto/kpp.h> #include <crypto/internal/cryptouser.h> #include "internal.h" Loading @@ -37,7 +38,7 @@ static DEFINE_MUTEX(crypto_cfg_mutex); /* The crypto netlink socket */ static struct sock *crypto_nlsk; struct sock *crypto_nlsk; struct crypto_dump_info { struct sk_buff *in_skb; Loading @@ -46,7 +47,7 @@ struct crypto_dump_info { u16 nlmsg_flags; }; static struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact) struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact) { struct crypto_alg *q, *alg = NULL; Loading Loading @@ -461,6 +462,7 @@ static const int crypto_msg_min[CRYPTO_NR_MSGTYPES] = { [CRYPTO_MSG_UPDATEALG - CRYPTO_MSG_BASE] = MSGSIZE(crypto_user_alg), [CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE] = MSGSIZE(crypto_user_alg), [CRYPTO_MSG_DELRNG - CRYPTO_MSG_BASE] = 0, [CRYPTO_MSG_GETSTAT - CRYPTO_MSG_BASE] = MSGSIZE(crypto_user_alg), }; static const struct nla_policy crypto_policy[CRYPTOCFGA_MAX+1] = { Loading @@ -481,6 +483,9 @@ static const struct crypto_link { .dump = crypto_dump_report, .done = crypto_dump_report_done}, [CRYPTO_MSG_DELRNG - CRYPTO_MSG_BASE] = { .doit = crypto_del_rng }, [CRYPTO_MSG_GETSTAT - CRYPTO_MSG_BASE] = { .doit = crypto_reportstat, .dump = crypto_dump_reportstat, .done = crypto_dump_reportstat_done}, }; static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, Loading