hc
2024-02-20 e636c8d336489bf3eed5878299e6cc045bbad077
kernel/include/crypto/rng.h
....@@ -1,14 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * RNG: Random Number Generator algorithms under the crypto API
34 *
45 * Copyright (c) 2008 Neil Horman <nhorman@tuxdriver.com>
56 * Copyright (c) 2015 Herbert Xu <herbert@gondor.apana.org.au>
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms of the GNU General Public License as published by the Free
9
- * Software Foundation; either version 2 of the License, or (at your option)
10
- * any later version.
11
- *
127 */
138
149 #ifndef _CRYPTO_RNG_H
....@@ -142,7 +137,13 @@
142137 const u8 *src, unsigned int slen,
143138 u8 *dst, unsigned int dlen)
144139 {
145
- return crypto_rng_alg(tfm)->generate(tfm, src, slen, dst, dlen);
140
+ struct crypto_alg *alg = tfm->base.__crt_alg;
141
+ int ret;
142
+
143
+ crypto_stats_get(alg);
144
+ ret = crypto_rng_alg(tfm)->generate(tfm, src, slen, dst, dlen);
145
+ crypto_stats_rng_generate(alg, dlen, ret);
146
+ return ret;
146147 }
147148
148149 /**