Revert "crypto: remove CONFIG_CRYPTO_STATS"
[linux-2.6-microblaze.git] / include / crypto / hash.h
index 0014bdd..5d61f57 100644 (file)
@@ -23,8 +23,27 @@ struct crypto_ahash;
  * crypto_unregister_shash().
  */
 
+/*
+ * struct crypto_istat_hash - statistics for has algorithm
+ * @hash_cnt:          number of hash requests
+ * @hash_tlen:         total data size hashed
+ * @err_cnt:           number of error for hash requests
+ */
+struct crypto_istat_hash {
+       atomic64_t hash_cnt;
+       atomic64_t hash_tlen;
+       atomic64_t err_cnt;
+};
+
+#ifdef CONFIG_CRYPTO_STATS
+#define HASH_ALG_COMMON_STAT struct crypto_istat_hash stat;
+#else
+#define HASH_ALG_COMMON_STAT
+#endif
+
 /*
  * struct hash_alg_common - define properties of message digest
+ * @stat: Statistics for hash algorithm.
  * @digestsize: Size of the result of the transformation. A buffer of this size
  *             must be available to the @final and @finup calls, so they can
  *             store the resulting hash into it. For various predefined sizes,
@@ -41,6 +60,8 @@ struct crypto_ahash;
  *       information.
  */
 #define HASH_ALG_COMMON {              \
+       HASH_ALG_COMMON_STAT            \
+                                       \
        unsigned int digestsize;        \
        unsigned int statesize;         \
                                        \
@@ -222,6 +243,7 @@ struct shash_alg {
        };
 };
 #undef HASH_ALG_COMMON
+#undef HASH_ALG_COMMON_STAT
 
 struct crypto_ahash {
        bool using_shash; /* Underlying algorithm is shash, not ahash */