crypto: user - convert all stats from u32 to u64

All the 32-bit fields need to be 64-bit.  In some cases, UINT32_MAX crypto
operations can be done in seconds.

Reported-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Corentin Labbe
2018-11-29 14:42:18 +00:00
committed by Herbert Xu
parent a6a3138536
commit 6e8e72cd20
11 changed files with 133 additions and 141 deletions

View File

@@ -517,11 +517,11 @@ struct crypto_alg {
#ifdef CONFIG_CRYPTO_STATS
union {
atomic_t encrypt_cnt;
atomic_t compress_cnt;
atomic_t generate_cnt;
atomic_t hash_cnt;
atomic_t setsecret_cnt;
atomic64_t encrypt_cnt;
atomic64_t compress_cnt;
atomic64_t generate_cnt;
atomic64_t hash_cnt;
atomic64_t setsecret_cnt;
};
union {
atomic64_t encrypt_tlen;
@@ -530,29 +530,29 @@ struct crypto_alg {
atomic64_t hash_tlen;
};
union {
atomic_t akcipher_err_cnt;
atomic_t cipher_err_cnt;
atomic_t compress_err_cnt;
atomic_t aead_err_cnt;
atomic_t hash_err_cnt;
atomic_t rng_err_cnt;
atomic_t kpp_err_cnt;
atomic64_t akcipher_err_cnt;
atomic64_t cipher_err_cnt;
atomic64_t compress_err_cnt;
atomic64_t aead_err_cnt;
atomic64_t hash_err_cnt;
atomic64_t rng_err_cnt;
atomic64_t kpp_err_cnt;
};
union {
atomic_t decrypt_cnt;
atomic_t decompress_cnt;
atomic_t seed_cnt;
atomic_t generate_public_key_cnt;
atomic64_t decrypt_cnt;
atomic64_t decompress_cnt;
atomic64_t seed_cnt;
atomic64_t generate_public_key_cnt;
};
union {
atomic64_t decrypt_tlen;
atomic64_t decompress_tlen;
};
union {
atomic_t verify_cnt;
atomic_t compute_shared_secret_cnt;
atomic64_t verify_cnt;
atomic64_t compute_shared_secret_cnt;
};
atomic_t sign_cnt;
atomic64_t sign_cnt;
#endif /* CONFIG_CRYPTO_STATS */
} CRYPTO_MINALIGN_ATTR;
@@ -983,9 +983,9 @@ static inline void crypto_stat_ablkcipher_encrypt(struct ablkcipher_request *req
crypto_ablkcipher_crt(crypto_ablkcipher_reqtfm(req));
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
atomic_inc(&crt->base->base.__crt_alg->cipher_err_cnt);
atomic64_inc(&crt->base->base.__crt_alg->cipher_err_cnt);
} else {
atomic_inc(&crt->base->base.__crt_alg->encrypt_cnt);
atomic64_inc(&crt->base->base.__crt_alg->encrypt_cnt);
atomic64_add(req->nbytes, &crt->base->base.__crt_alg->encrypt_tlen);
}
#endif
@@ -999,9 +999,9 @@ static inline void crypto_stat_ablkcipher_decrypt(struct ablkcipher_request *req
crypto_ablkcipher_crt(crypto_ablkcipher_reqtfm(req));
if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
atomic_inc(&crt->base->base.__crt_alg->cipher_err_cnt);
atomic64_inc(&crt->base->base.__crt_alg->cipher_err_cnt);
} else {
atomic_inc(&crt->base->base.__crt_alg->decrypt_cnt);
atomic64_inc(&crt->base->base.__crt_alg->decrypt_cnt);
atomic64_add(req->nbytes, &crt->base->base.__crt_alg->decrypt_tlen);
}
#endif