summaryrefslogtreecommitdiff
path: root/crypto/jitterentropy-kcapi.c
diff options
context:
space:
mode:
authorStephan Müller <smueller@chronox.de>2023-09-21 13:48:33 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2023-10-01 16:28:15 +0800
commit0df5253004914f3f52b582ac6ceff2abb9f999c1 (patch)
tree8d414f3cdc0c5434ca5e064b0ed051d4ce8cec0d /crypto/jitterentropy-kcapi.c
parentf0be2a5192f007dd2ff2442e9701f5d55fb106a2 (diff)
downloadlinux-crypto-0df5253004914f3f52b582ac6ceff2abb9f999c1.tar.gz
linux-crypto-0df5253004914f3f52b582ac6ceff2abb9f999c1.zip
crypto: jitter - Allow configuration of memory size
The memory size consumed by the Jitter RNG is one contributing factor in the amount of entropy that is gathered. As the amount of entropy directly correlates with the distance of the memory from the CPU, the caches that are possibly present on a given system have an impact on the collected entropy. Thus, the kernel compile time should offer a means to configure the amount of memory used by the Jitter RNG. Although this option could be turned into a runtime option (e.g. a kernel command line option), it should remain a compile time option as otherwise adminsitrators who may not have performed an entropy assessment may select a value that is inappropriate. The default value selected by the configuration is identical to the current Jitter RNG value. Thus, the patch should not lead to any change in the Jitter RNG behavior. To accommodate larger memory buffers, kvzalloc / kvfree is used. Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/jitterentropy-kcapi.c')
-rw-r--r--crypto/jitterentropy-kcapi.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c
index 1de730f9..a8e7bbd2 100644
--- a/crypto/jitterentropy-kcapi.c
+++ b/crypto/jitterentropy-kcapi.c
@@ -54,6 +54,17 @@
* Helper function
***************************************************************************/
+void *jent_kvzalloc(unsigned int len)
+{
+ return kvzalloc(len, GFP_KERNEL);
+}
+
+void jent_kvzfree(void *ptr, unsigned int len)
+{
+ memzero_explicit(ptr, len);
+ kvfree(ptr);
+}
+
void *jent_zalloc(unsigned int len)
{
return kzalloc(len, GFP_KERNEL);